@fieldwangai/agentflow 0.1.50 → 0.1.52
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 +6 -1
- package/builtin/web-ui/dist/assets/index-CGls6aTE.js +238 -0
- package/builtin/web-ui/dist/assets/{index-CP_UFJ5h.css → index-DlZeY5p1.css} +1 -1
- package/builtin/web-ui/dist/index.html +2 -2
- package/package.json +1 -1
- package/builtin/web-ui/dist/assets/index-BFA38FD5.js +0 -238
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
var bR=Object.defineProperty;var vR=(e,t,n)=>t in e?bR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Jn=(e,t,n)=>vR(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 af=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function cl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var oC={exports:{}},lg={},aC={exports:{}},Lt={};/**
|
|
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 qf=Symbol.for("react.element"),kR=Symbol.for("react.portal"),SR=Symbol.for("react.fragment"),NR=Symbol.for("react.strict_mode"),jR=Symbol.for("react.profiler"),CR=Symbol.for("react.provider"),ER=Symbol.for("react.context"),_R=Symbol.for("react.forward_ref"),PR=Symbol.for("react.suspense"),AR=Symbol.for("react.memo"),IR=Symbol.for("react.lazy"),H0=Symbol.iterator;function TR(e){return e===null||typeof e!="object"?null:(e=H0&&e[H0]||e["@@iterator"],typeof e=="function"?e:null)}var lC={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},cC=Object.assign,uC={};function zu(e,t,n){this.props=e,this.context=t,this.refs=uC,this.updater=n||lC}zu.prototype.isReactComponent={};zu.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")};zu.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function dC(){}dC.prototype=zu.prototype;function Eb(e,t,n){this.props=e,this.context=t,this.refs=uC,this.updater=n||lC}var _b=Eb.prototype=new dC;_b.constructor=Eb;cC(_b,zu.prototype);_b.isPureReactComponent=!0;var W0=Array.isArray,fC=Object.prototype.hasOwnProperty,Pb={current:null},pC={key:!0,ref:!0,__self:!0,__source:!0};function hC(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)fC.call(t,r)&&!pC.hasOwnProperty(r)&&(s[r]=t[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var c=Array(l),d=0;d<l;d++)c[d]=arguments[d+2];s.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:qf,type:e,key:i,ref:a,props:s,_owner:Pb.current}}function RR(e,t){return{$$typeof:qf,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Ab(e){return typeof e=="object"&&e!==null&&e.$$typeof===qf}function LR(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var V0=/\/+/g;function uy(e,t){return typeof e=="object"&&e!==null&&e.key!=null?LR(""+e.key):t.toString(36)}function Ph(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 qf:case kR:a=!0}}if(a)return a=e,s=s(a),e=r===""?"."+uy(a,0):r,W0(s)?(n="",e!=null&&(n=e.replace(V0,"$&/")+"/"),Ph(s,t,n,"",function(d){return d})):s!=null&&(Ab(s)&&(s=RR(s,n+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(V0,"$&/")+"/")+e)),t.push(s)),1;if(a=0,r=r===""?".":r+":",W0(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+uy(i,l);a+=Ph(i,t,n,c,s)}else if(c=TR(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+uy(i,l++),a+=Ph(i,t,n,c,s);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function Dp(e,t,n){if(e==null)return e;var r=[],s=0;return Ph(e,r,"","",function(i){return t.call(n,i,s++)}),r}function OR(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 as={current:null},Ah={transition:null},MR={ReactCurrentDispatcher:as,ReactCurrentBatchConfig:Ah,ReactCurrentOwner:Pb};function mC(){throw Error("act(...) is not supported in production builds of React.")}Lt.Children={map:Dp,forEach:function(e,t,n){Dp(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Dp(e,function(){t++}),t},toArray:function(e){return Dp(e,function(t){return t})||[]},only:function(e){if(!Ab(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Lt.Component=zu;Lt.Fragment=SR;Lt.Profiler=jR;Lt.PureComponent=Eb;Lt.StrictMode=NR;Lt.Suspense=PR;Lt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=MR;Lt.act=mC;Lt.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=cC({},e.props),s=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=Pb.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)fC.call(t,c)&&!pC.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var d=0;d<c;d++)l[d]=arguments[d+2];r.children=l}return{$$typeof:qf,type:e.type,key:s,ref:i,props:r,_owner:a}};Lt.createContext=function(e){return e={$$typeof:ER,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:CR,_context:e},e.Consumer=e};Lt.createElement=hC;Lt.createFactory=function(e){var t=hC.bind(null,e);return t.type=e,t};Lt.createRef=function(){return{current:null}};Lt.forwardRef=function(e){return{$$typeof:_R,render:e}};Lt.isValidElement=Ab;Lt.lazy=function(e){return{$$typeof:IR,_payload:{_status:-1,_result:e},_init:OR}};Lt.memo=function(e,t){return{$$typeof:AR,type:e,compare:t===void 0?null:t}};Lt.startTransition=function(e){var t=Ah.transition;Ah.transition={};try{e()}finally{Ah.transition=t}};Lt.unstable_act=mC;Lt.useCallback=function(e,t){return as.current.useCallback(e,t)};Lt.useContext=function(e){return as.current.useContext(e)};Lt.useDebugValue=function(){};Lt.useDeferredValue=function(e){return as.current.useDeferredValue(e)};Lt.useEffect=function(e,t){return as.current.useEffect(e,t)};Lt.useId=function(){return as.current.useId()};Lt.useImperativeHandle=function(e,t,n){return as.current.useImperativeHandle(e,t,n)};Lt.useInsertionEffect=function(e,t){return as.current.useInsertionEffect(e,t)};Lt.useLayoutEffect=function(e,t){return as.current.useLayoutEffect(e,t)};Lt.useMemo=function(e,t){return as.current.useMemo(e,t)};Lt.useReducer=function(e,t,n){return as.current.useReducer(e,t,n)};Lt.useRef=function(e){return as.current.useRef(e)};Lt.useState=function(e){return as.current.useState(e)};Lt.useSyncExternalStore=function(e,t,n){return as.current.useSyncExternalStore(e,t,n)};Lt.useTransition=function(){return as.current.useTransition()};Lt.version="18.3.1";aC.exports=Lt;var h=aC.exports;const at=cl(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 $R=h,DR=Symbol.for("react.element"),FR=Symbol.for("react.fragment"),zR=Object.prototype.hasOwnProperty,BR=$R.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,HR={key:!0,ref:!0,__self:!0,__source:!0};function gC(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)zR.call(t,r)&&!HR.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:DR,type:e,key:i,ref:a,props:s,_owner:BR.current}}lg.Fragment=FR;lg.jsx=gC;lg.jsxs=gC;oC.exports=lg;var o=oC.exports,Ix={},yC={exports:{}},Us={},xC={exports:{}},wC={};/**
|
|
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(_,R){var P=_.length;_.push(R);e:for(;0<P;){var G=P-1>>>1,Z=_[G];if(0<s(Z,R))_[G]=R,_[P]=Z,P=G;else break e}}function n(_){return _.length===0?null:_[0]}function r(_){if(_.length===0)return null;var R=_[0],P=_.pop();if(P!==R){_[0]=P;e:for(var G=0,Z=_.length,V=Z>>>1;G<V;){var se=2*(G+1)-1,ue=_[se],pe=se+1,ge=_[pe];if(0>s(ue,P))pe<Z&&0>s(ge,ue)?(_[G]=ge,_[pe]=P,G=pe):(_[G]=ue,_[se]=P,G=se);else if(pe<Z&&0>s(ge,P))_[G]=ge,_[pe]=P,G=pe;else break e}}return R}function s(_,R){var P=_.sortIndex-R.sortIndex;return P!==0?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 c=[],d=[],f=1,u=null,p=3,m=!1,g=!1,b=!1,v=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(_){for(var R=n(d);R!==null;){if(R.callback===null)r(d);else if(R.startTime<=_)r(d),R.sortIndex=R.expirationTime,t(c,R);else break;R=n(d)}}function j(_){if(b=!1,w(_),!g)if(n(c)!==null)g=!0,E(A);else{var R=n(d);R!==null&&D(j,R.startTime-_)}}function A(_,R){g=!1,b&&(b=!1,y(B),B=-1),m=!0;var P=p;try{for(w(R),u=n(c);u!==null&&(!(u.expirationTime>R)||_&&!L());){var G=u.callback;if(typeof G=="function"){u.callback=null,p=u.priorityLevel;var Z=G(u.expirationTime<=R);R=e.unstable_now(),typeof Z=="function"?u.callback=Z:u===n(c)&&r(c),w(R)}else r(c);u=n(c)}if(u!==null)var V=!0;else{var se=n(d);se!==null&&D(j,se.startTime-R),V=!1}return V}finally{u=null,p=P,m=!1}}var C=!1,$=null,B=-1,F=5,z=-1;function L(){return!(e.unstable_now()-z<F)}function O(){if($!==null){var _=e.unstable_now();z=_;var R=!0;try{R=$(!0,_)}finally{R?W():(C=!1,$=null)}}else C=!1}var W;if(typeof k=="function")W=function(){k(O)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,T=M.port2;M.port1.onmessage=O,W=function(){T.postMessage(null)}}else W=function(){v(O,0)};function E(_){$=_,C||(C=!0,W())}function D(_,R){B=v(function(){_(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(_){_.callback=null},e.unstable_continueExecution=function(){g||m||(g=!0,E(A))},e.unstable_forceFrameRate=function(_){0>_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<_?Math.floor(1e3/_):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(_){switch(p){case 1:case 2:case 3:var R=3;break;default:R=p}var P=p;p=R;try{return _()}finally{p=P}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(_,R){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var P=p;p=_;try{return R()}finally{p=P}},e.unstable_scheduleCallback=function(_,R,P){var G=e.unstable_now();switch(typeof P=="object"&&P!==null?(P=P.delay,P=typeof P=="number"&&0<P?G+P:G):P=G,_){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=P+Z,_={id:f++,callback:R,priorityLevel:_,startTime:P,expirationTime:Z,sortIndex:-1},P>G?(_.sortIndex=P,t(d,_),n(c)===null&&_===n(d)&&(b?(y(B),B=-1):b=!0,D(j,P-G))):(_.sortIndex=Z,t(c,_),g||m||(g=!0,E(A))),_},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(_){var R=p;return function(){var P=p;p=R;try{return _.apply(this,arguments)}finally{p=P}}}})(wC);xC.exports=wC;var WR=xC.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 VR=h,Ws=WR;function je(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 bC=new Set,lf={};function fc(e,t){wu(e,t),wu(e+"Capture",t)}function wu(e,t){for(lf[e]=t,e=0;e<t.length;e++)bC.add(t[e])}var Zo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Tx=Object.prototype.hasOwnProperty,UR=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,U0={},K0={};function KR(e){return Tx.call(K0,e)?!0:Tx.call(U0,e)?!1:UR.test(e)?K0[e]=!0:(U0[e]=!0,!1)}function qR(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 YR(e,t,n,r){if(t===null||typeof t>"u"||qR(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 ls(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 Fr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Fr[e]=new ls(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Fr[t]=new ls(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Fr[e]=new ls(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Fr[e]=new ls(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){Fr[e]=new ls(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Fr[e]=new ls(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Fr[e]=new ls(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Fr[e]=new ls(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Fr[e]=new ls(e,5,!1,e.toLowerCase(),null,!1,!1)});var Ib=/[\-:]([a-z])/g;function Tb(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(Ib,Tb);Fr[t]=new ls(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(Ib,Tb);Fr[t]=new ls(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(Ib,Tb);Fr[t]=new ls(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Fr[e]=new ls(e,1,!1,e.toLowerCase(),null,!1,!1)});Fr.xlinkHref=new ls("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Fr[e]=new ls(e,1,!1,e.toLowerCase(),null,!0,!0)});function Rb(e,t,n,r){var s=Fr.hasOwnProperty(t)?Fr[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(YR(t,n,s,r)&&(n=null),r||s===null?KR(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 oa=VR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Fp=Symbol.for("react.element"),Wc=Symbol.for("react.portal"),Vc=Symbol.for("react.fragment"),Lb=Symbol.for("react.strict_mode"),Rx=Symbol.for("react.profiler"),vC=Symbol.for("react.provider"),kC=Symbol.for("react.context"),Ob=Symbol.for("react.forward_ref"),Lx=Symbol.for("react.suspense"),Ox=Symbol.for("react.suspense_list"),Mb=Symbol.for("react.memo"),Ra=Symbol.for("react.lazy"),SC=Symbol.for("react.offscreen"),q0=Symbol.iterator;function pd(e){return e===null||typeof e!="object"?null:(e=q0&&e[q0]||e["@@iterator"],typeof e=="function"?e:null)}var qn=Object.assign,dy;function Id(e){if(dy===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);dy=t&&t[1]||""}return`
|
|
34
|
-
`+dy+e}var fy=!1;function py(e,t){if(!e||fy)return"";fy=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(d){var r=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){r=d}e.call(t.prototype)}else{try{throw Error()}catch(d){r=d}e()}}catch(d){if(d&&r&&typeof d.stack=="string"){for(var s=d.stack.split(`
|
|
35
|
-
`),i=r.stack.split(`
|
|
36
|
-
`),a=s.length-1,l=i.length-1;1<=a&&0<=l&&s[a]!==i[l];)l--;for(;1<=a&&0<=l;a--,l--)if(s[a]!==i[l]){if(a!==1||l!==1)do if(a--,l--,0>l||s[a]!==i[l]){var c=`
|
|
37
|
-
`+s[a].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=a&&0<=l);break}}}finally{fy=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Id(e):""}function GR(e){switch(e.tag){case 5:return Id(e.type);case 16:return Id("Lazy");case 13:return Id("Suspense");case 19:return Id("SuspenseList");case 0:case 2:case 15:return e=py(e.type,!1),e;case 11:return e=py(e.type.render,!1),e;case 1:return e=py(e.type,!0),e;default:return""}}function Mx(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 Vc:return"Fragment";case Wc:return"Portal";case Rx:return"Profiler";case Lb:return"StrictMode";case Lx:return"Suspense";case Ox:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case kC:return(e.displayName||"Context")+".Consumer";case vC:return(e._context.displayName||"Context")+".Provider";case Ob:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Mb:return t=e.displayName||null,t!==null?t:Mx(e.type)||"Memo";case Ra:t=e._payload,e=e._init;try{return Mx(e(t))}catch{}}return null}function XR(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 Mx(t);case 8:return t===Lb?"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 nl(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function NC(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function JR(e){var t=NC(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 zp(e){e._valueTracker||(e._valueTracker=JR(e))}function jC(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=NC(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Zh(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 $x(e,t){var n=t.checked;return qn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Y0(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=nl(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 CC(e,t){t=t.checked,t!=null&&Rb(e,"checked",t,!1)}function Dx(e,t){CC(e,t);var n=nl(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")?Fx(e,t.type,n):t.hasOwnProperty("defaultValue")&&Fx(e,t.type,nl(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function G0(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 Fx(e,t,n){(t!=="number"||Zh(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Td=Array.isArray;function au(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=""+nl(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 zx(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(je(91));return qn({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function X0(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(je(92));if(Td(n)){if(1<n.length)throw Error(je(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:nl(n)}}function EC(e,t){var n=nl(t.value),r=nl(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 J0(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function _C(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 Bx(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?_C(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Bp,PC=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(Bp=Bp||document.createElement("div"),Bp.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Bp.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 Hd={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},QR=["Webkit","ms","Moz","O"];Object.keys(Hd).forEach(function(e){QR.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Hd[t]=Hd[e]})});function AC(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Hd.hasOwnProperty(e)&&Hd[e]?(""+t).trim():t+"px"}function IC(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=AC(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var ZR=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 Hx(e,t){if(t){if(ZR[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(je(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(je(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(je(61))}if(t.style!=null&&typeof t.style!="object")throw Error(je(62))}}function Wx(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 Vx=null;function $b(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ux=null,lu=null,cu=null;function Q0(e){if(e=Xf(e)){if(typeof Ux!="function")throw Error(je(280));var t=e.stateNode;t&&(t=pg(t),Ux(e.stateNode,e.type,t))}}function TC(e){lu?cu?cu.push(e):cu=[e]:lu=e}function RC(){if(lu){var e=lu,t=cu;if(cu=lu=null,Q0(e),t)for(e=0;e<t.length;e++)Q0(t[e])}}function LC(e,t){return e(t)}function OC(){}var hy=!1;function MC(e,t,n){if(hy)return e(t,n);hy=!0;try{return LC(e,t,n)}finally{hy=!1,(lu!==null||cu!==null)&&(OC(),RC())}}function uf(e,t){var n=e.stateNode;if(n===null)return null;var r=pg(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(je(231,t,typeof n));return n}var Kx=!1;if(Zo)try{var hd={};Object.defineProperty(hd,"passive",{get:function(){Kx=!0}}),window.addEventListener("test",hd,hd),window.removeEventListener("test",hd,hd)}catch{Kx=!1}function eL(e,t,n,r,s,i,a,l,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(f){this.onError(f)}}var Wd=!1,em=null,tm=!1,qx=null,tL={onError:function(e){Wd=!0,em=e}};function nL(e,t,n,r,s,i,a,l,c){Wd=!1,em=null,eL.apply(tL,arguments)}function rL(e,t,n,r,s,i,a,l,c){if(nL.apply(this,arguments),Wd){if(Wd){var d=em;Wd=!1,em=null}else throw Error(je(198));tm||(tm=!0,qx=d)}}function pc(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 $C(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 Z0(e){if(pc(e)!==e)throw Error(je(188))}function sL(e){var t=e.alternate;if(!t){if(t=pc(e),t===null)throw Error(je(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 Z0(s),e;if(i===r)return Z0(s),t;i=i.sibling}throw Error(je(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(je(189))}}if(n.alternate!==r)throw Error(je(190))}if(n.tag!==3)throw Error(je(188));return n.stateNode.current===n?e:t}function DC(e){return e=sL(e),e!==null?FC(e):null}function FC(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=FC(e);if(t!==null)return t;e=e.sibling}return null}var zC=Ws.unstable_scheduleCallback,ek=Ws.unstable_cancelCallback,iL=Ws.unstable_shouldYield,oL=Ws.unstable_requestPaint,sr=Ws.unstable_now,aL=Ws.unstable_getCurrentPriorityLevel,Db=Ws.unstable_ImmediatePriority,BC=Ws.unstable_UserBlockingPriority,nm=Ws.unstable_NormalPriority,lL=Ws.unstable_LowPriority,HC=Ws.unstable_IdlePriority,cg=null,go=null;function cL(e){if(go&&typeof go.onCommitFiberRoot=="function")try{go.onCommitFiberRoot(cg,e,void 0,(e.current.flags&128)===128)}catch{}}var Bi=Math.clz32?Math.clz32:fL,uL=Math.log,dL=Math.LN2;function fL(e){return e>>>=0,e===0?32:31-(uL(e)/dL|0)|0}var Hp=64,Wp=4194304;function Rd(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 rm(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=Rd(l):(i&=a,i!==0&&(r=Rd(i)))}else a=n&~s,a!==0?r=Rd(a):i!==0&&(r=Rd(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-Bi(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 hL(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-Bi(i),l=1<<a,c=s[a];c===-1?(!(l&n)||l&r)&&(s[a]=pL(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function Yx(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function WC(){var e=Hp;return Hp<<=1,!(Hp&4194240)&&(Hp=64),e}function my(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Yf(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Bi(t),e[t]=n}function mL(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-Bi(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function Fb(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Bi(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var ln=0;function VC(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var UC,zb,KC,qC,YC,Gx=!1,Vp=[],Va=null,Ua=null,Ka=null,df=new Map,ff=new Map,$a=[],gL="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 tk(e,t){switch(e){case"focusin":case"focusout":Va=null;break;case"dragenter":case"dragleave":Ua=null;break;case"mouseover":case"mouseout":Ka=null;break;case"pointerover":case"pointerout":df.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ff.delete(t.pointerId)}}function md(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=Xf(t),t!==null&&zb(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function yL(e,t,n,r,s){switch(t){case"focusin":return Va=md(Va,e,t,n,r,s),!0;case"dragenter":return Ua=md(Ua,e,t,n,r,s),!0;case"mouseover":return Ka=md(Ka,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return df.set(i,md(df.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,ff.set(i,md(ff.get(i)||null,e,t,n,r,s)),!0}return!1}function GC(e){var t=Vl(e.target);if(t!==null){var n=pc(t);if(n!==null){if(t=n.tag,t===13){if(t=$C(n),t!==null){e.blockedOn=t,YC(e.priority,function(){KC(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 Ih(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Xx(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Vx=r,n.target.dispatchEvent(r),Vx=null}else return t=Xf(n),t!==null&&zb(t),e.blockedOn=n,!1;t.shift()}return!0}function nk(e,t,n){Ih(e)&&n.delete(t)}function xL(){Gx=!1,Va!==null&&Ih(Va)&&(Va=null),Ua!==null&&Ih(Ua)&&(Ua=null),Ka!==null&&Ih(Ka)&&(Ka=null),df.forEach(nk),ff.forEach(nk)}function gd(e,t){e.blockedOn===t&&(e.blockedOn=null,Gx||(Gx=!0,Ws.unstable_scheduleCallback(Ws.unstable_NormalPriority,xL)))}function pf(e){function t(s){return gd(s,e)}if(0<Vp.length){gd(Vp[0],e);for(var n=1;n<Vp.length;n++){var r=Vp[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Va!==null&&gd(Va,e),Ua!==null&&gd(Ua,e),Ka!==null&&gd(Ka,e),df.forEach(t),ff.forEach(t),n=0;n<$a.length;n++)r=$a[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<$a.length&&(n=$a[0],n.blockedOn===null);)GC(n),n.blockedOn===null&&$a.shift()}var uu=oa.ReactCurrentBatchConfig,sm=!0;function wL(e,t,n,r){var s=ln,i=uu.transition;uu.transition=null;try{ln=1,Bb(e,t,n,r)}finally{ln=s,uu.transition=i}}function bL(e,t,n,r){var s=ln,i=uu.transition;uu.transition=null;try{ln=4,Bb(e,t,n,r)}finally{ln=s,uu.transition=i}}function Bb(e,t,n,r){if(sm){var s=Xx(e,t,n,r);if(s===null)jy(e,t,r,im,n),tk(e,r);else if(yL(s,e,t,n,r))r.stopPropagation();else if(tk(e,r),t&4&&-1<gL.indexOf(e)){for(;s!==null;){var i=Xf(s);if(i!==null&&UC(i),i=Xx(e,t,n,r),i===null&&jy(e,t,r,im,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else jy(e,t,r,null,n)}}var im=null;function Xx(e,t,n,r){if(im=null,e=$b(r),e=Vl(e),e!==null)if(t=pc(e),t===null)e=null;else if(n=t.tag,n===13){if(e=$C(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 im=e,null}function XC(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(aL()){case Db:return 1;case BC:return 4;case nm:case lL:return 16;case HC:return 536870912;default:return 16}default:return 16}}var za=null,Hb=null,Th=null;function JC(){if(Th)return Th;var e,t=Hb,n=t.length,r,s="value"in za?za.value:za.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 Th=s.slice(e,1<r?1-r:void 0)}function Rh(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 Up(){return!0}function rk(){return!1}function Ks(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)?Up:rk,this.isPropagationStopped=rk,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=Up)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Up)},persist:function(){},isPersistent:Up}),t}var Bu={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Wb=Ks(Bu),Gf=qn({},Bu,{view:0,detail:0}),vL=Ks(Gf),gy,yy,yd,ug=qn({},Gf,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Vb,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!==yd&&(yd&&e.type==="mousemove"?(gy=e.screenX-yd.screenX,yy=e.screenY-yd.screenY):yy=gy=0,yd=e),gy)},movementY:function(e){return"movementY"in e?e.movementY:yy}}),sk=Ks(ug),kL=qn({},ug,{dataTransfer:0}),SL=Ks(kL),NL=qn({},Gf,{relatedTarget:0}),xy=Ks(NL),jL=qn({},Bu,{animationName:0,elapsedTime:0,pseudoElement:0}),CL=Ks(jL),EL=qn({},Bu,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),_L=Ks(EL),PL=qn({},Bu,{data:0}),ik=Ks(PL),AL={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},IL={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"},TL={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function RL(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=TL[e])?!!t[e]:!1}function Vb(){return RL}var LL=qn({},Gf,{key:function(e){if(e.key){var t=AL[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Rh(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?IL[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Vb,charCode:function(e){return e.type==="keypress"?Rh(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Rh(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),OL=Ks(LL),ML=qn({},ug,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ok=Ks(ML),$L=qn({},Gf,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Vb}),DL=Ks($L),FL=qn({},Bu,{propertyName:0,elapsedTime:0,pseudoElement:0}),zL=Ks(FL),BL=qn({},ug,{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}),HL=Ks(BL),WL=[9,13,27,32],Ub=Zo&&"CompositionEvent"in window,Vd=null;Zo&&"documentMode"in document&&(Vd=document.documentMode);var VL=Zo&&"TextEvent"in window&&!Vd,QC=Zo&&(!Ub||Vd&&8<Vd&&11>=Vd),ak=" ",lk=!1;function ZC(e,t){switch(e){case"keyup":return WL.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function eE(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Uc=!1;function UL(e,t){switch(e){case"compositionend":return eE(t);case"keypress":return t.which!==32?null:(lk=!0,ak);case"textInput":return e=t.data,e===ak&&lk?null:e;default:return null}}function KL(e,t){if(Uc)return e==="compositionend"||!Ub&&ZC(e,t)?(e=JC(),Th=Hb=za=null,Uc=!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 QC&&t.locale!=="ko"?null:t.data;default:return null}}var qL={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 ck(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!qL[e.type]:t==="textarea"}function tE(e,t,n,r){TC(r),t=om(t,"onChange"),0<t.length&&(n=new Wb("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Ud=null,hf=null;function YL(e){fE(e,0)}function dg(e){var t=Yc(e);if(jC(t))return e}function GL(e,t){if(e==="change")return t}var nE=!1;if(Zo){var wy;if(Zo){var by="oninput"in document;if(!by){var uk=document.createElement("div");uk.setAttribute("oninput","return;"),by=typeof uk.oninput=="function"}wy=by}else wy=!1;nE=wy&&(!document.documentMode||9<document.documentMode)}function dk(){Ud&&(Ud.detachEvent("onpropertychange",rE),hf=Ud=null)}function rE(e){if(e.propertyName==="value"&&dg(hf)){var t=[];tE(t,hf,e,$b(e)),MC(YL,t)}}function XL(e,t,n){e==="focusin"?(dk(),Ud=t,hf=n,Ud.attachEvent("onpropertychange",rE)):e==="focusout"&&dk()}function JL(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return dg(hf)}function QL(e,t){if(e==="click")return dg(t)}function ZL(e,t){if(e==="input"||e==="change")return dg(t)}function eO(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Wi=typeof Object.is=="function"?Object.is:eO;function mf(e,t){if(Wi(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(!Tx.call(t,s)||!Wi(e[s],t[s]))return!1}return!0}function fk(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function pk(e,t){var n=fk(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=fk(n)}}function sE(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?sE(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function iE(){for(var e=window,t=Zh();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Zh(e.document)}return t}function Kb(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 tO(e){var t=iE(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&sE(n.ownerDocument.documentElement,n)){if(r!==null&&Kb(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=pk(n,i);var a=pk(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 nO=Zo&&"documentMode"in document&&11>=document.documentMode,Kc=null,Jx=null,Kd=null,Qx=!1;function hk(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Qx||Kc==null||Kc!==Zh(r)||(r=Kc,"selectionStart"in r&&Kb(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}),Kd&&mf(Kd,r)||(Kd=r,r=om(Jx,"onSelect"),0<r.length&&(t=new Wb("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Kc)))}function Kp(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var qc={animationend:Kp("Animation","AnimationEnd"),animationiteration:Kp("Animation","AnimationIteration"),animationstart:Kp("Animation","AnimationStart"),transitionend:Kp("Transition","TransitionEnd")},vy={},oE={};Zo&&(oE=document.createElement("div").style,"AnimationEvent"in window||(delete qc.animationend.animation,delete qc.animationiteration.animation,delete qc.animationstart.animation),"TransitionEvent"in window||delete qc.transitionend.transition);function fg(e){if(vy[e])return vy[e];if(!qc[e])return e;var t=qc[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in oE)return vy[e]=t[n];return e}var aE=fg("animationend"),lE=fg("animationiteration"),cE=fg("animationstart"),uE=fg("transitionend"),dE=new Map,mk="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 ul(e,t){dE.set(e,t),fc(t,[e])}for(var ky=0;ky<mk.length;ky++){var Sy=mk[ky],rO=Sy.toLowerCase(),sO=Sy[0].toUpperCase()+Sy.slice(1);ul(rO,"on"+sO)}ul(aE,"onAnimationEnd");ul(lE,"onAnimationIteration");ul(cE,"onAnimationStart");ul("dblclick","onDoubleClick");ul("focusin","onFocus");ul("focusout","onBlur");ul(uE,"onTransitionEnd");wu("onMouseEnter",["mouseout","mouseover"]);wu("onMouseLeave",["mouseout","mouseover"]);wu("onPointerEnter",["pointerout","pointerover"]);wu("onPointerLeave",["pointerout","pointerover"]);fc("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));fc("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));fc("onBeforeInput",["compositionend","keypress","textInput","paste"]);fc("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));fc("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));fc("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ld="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(" "),iO=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ld));function gk(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,rL(r,t,void 0,e),e.currentTarget=null}function fE(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var a=r.length-1;0<=a;a--){var l=r[a],c=l.instance,d=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;gk(s,l,d),i=c}else for(a=0;a<r.length;a++){if(l=r[a],c=l.instance,d=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;gk(s,l,d),i=c}}}if(tm)throw e=qx,tm=!1,qx=null,e}function _n(e,t){var n=t[rw];n===void 0&&(n=t[rw]=new Set);var r=e+"__bubble";n.has(r)||(pE(t,e,2,!1),n.add(r))}function Ny(e,t,n){var r=0;t&&(r|=4),pE(n,e,r,t)}var qp="_reactListening"+Math.random().toString(36).slice(2);function gf(e){if(!e[qp]){e[qp]=!0,bC.forEach(function(n){n!=="selectionchange"&&(iO.has(n)||Ny(n,!1,e),Ny(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[qp]||(t[qp]=!0,Ny("selectionchange",!1,t))}}function pE(e,t,n,r){switch(XC(t)){case 1:var s=wL;break;case 4:s=bL;break;default:s=Bb}n=s.bind(null,t,n,e),s=void 0,!Kx||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 jy(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(a===4)for(a=r.return;a!==null;){var c=a.tag;if((c===3||c===4)&&(c=a.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;a=a.return}for(;l!==null;){if(a=Vl(l),a===null)return;if(c=a.tag,c===5||c===6){r=i=a;continue e}l=l.parentNode}}r=r.return}MC(function(){var d=i,f=$b(n),u=[];e:{var p=dE.get(e);if(p!==void 0){var m=Wb,g=e;switch(e){case"keypress":if(Rh(n)===0)break e;case"keydown":case"keyup":m=OL;break;case"focusin":g="focus",m=xy;break;case"focusout":g="blur",m=xy;break;case"beforeblur":case"afterblur":m=xy;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=sk;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=SL;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=DL;break;case aE:case lE:case cE:m=CL;break;case uE:m=zL;break;case"scroll":m=vL;break;case"wheel":m=HL;break;case"copy":case"cut":case"paste":m=_L;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=ok}var b=(t&4)!==0,v=!b&&e==="scroll",y=b?p!==null?p+"Capture":null:p;b=[];for(var k=d,w;k!==null;){w=k;var j=w.stateNode;if(w.tag===5&&j!==null&&(w=j,y!==null&&(j=uf(k,y),j!=null&&b.push(yf(k,j,w)))),v)break;k=k.return}0<b.length&&(p=new m(p,g,null,n,f),u.push({event:p,listeners:b}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",m=e==="mouseout"||e==="pointerout",p&&n!==Vx&&(g=n.relatedTarget||n.fromElement)&&(Vl(g)||g[ea]))break e;if((m||p)&&(p=f.window===f?f:(p=f.ownerDocument)?p.defaultView||p.parentWindow:window,m?(g=n.relatedTarget||n.toElement,m=d,g=g?Vl(g):null,g!==null&&(v=pc(g),g!==v||g.tag!==5&&g.tag!==6)&&(g=null)):(m=null,g=d),m!==g)){if(b=sk,j="onMouseLeave",y="onMouseEnter",k="mouse",(e==="pointerout"||e==="pointerover")&&(b=ok,j="onPointerLeave",y="onPointerEnter",k="pointer"),v=m==null?p:Yc(m),w=g==null?p:Yc(g),p=new b(j,k+"leave",m,n,f),p.target=v,p.relatedTarget=w,j=null,Vl(f)===d&&(b=new b(y,k+"enter",g,n,f),b.target=w,b.relatedTarget=v,j=b),v=j,m&&g)t:{for(b=m,y=g,k=0,w=b;w;w=Tc(w))k++;for(w=0,j=y;j;j=Tc(j))w++;for(;0<k-w;)b=Tc(b),k--;for(;0<w-k;)y=Tc(y),w--;for(;k--;){if(b===y||y!==null&&b===y.alternate)break t;b=Tc(b),y=Tc(y)}b=null}else b=null;m!==null&&yk(u,p,m,b,!1),g!==null&&v!==null&&yk(u,v,g,b,!0)}}e:{if(p=d?Yc(d):window,m=p.nodeName&&p.nodeName.toLowerCase(),m==="select"||m==="input"&&p.type==="file")var A=GL;else if(ck(p))if(nE)A=ZL;else{A=JL;var C=XL}else(m=p.nodeName)&&m.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(A=QL);if(A&&(A=A(e,d))){tE(u,A,n,f);break e}C&&C(e,p,d),e==="focusout"&&(C=p._wrapperState)&&C.controlled&&p.type==="number"&&Fx(p,"number",p.value)}switch(C=d?Yc(d):window,e){case"focusin":(ck(C)||C.contentEditable==="true")&&(Kc=C,Jx=d,Kd=null);break;case"focusout":Kd=Jx=Kc=null;break;case"mousedown":Qx=!0;break;case"contextmenu":case"mouseup":case"dragend":Qx=!1,hk(u,n,f);break;case"selectionchange":if(nO)break;case"keydown":case"keyup":hk(u,n,f)}var $;if(Ub)e:{switch(e){case"compositionstart":var B="onCompositionStart";break e;case"compositionend":B="onCompositionEnd";break e;case"compositionupdate":B="onCompositionUpdate";break e}B=void 0}else Uc?ZC(e,n)&&(B="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(B="onCompositionStart");B&&(QC&&n.locale!=="ko"&&(Uc||B!=="onCompositionStart"?B==="onCompositionEnd"&&Uc&&($=JC()):(za=f,Hb="value"in za?za.value:za.textContent,Uc=!0)),C=om(d,B),0<C.length&&(B=new ik(B,e,null,n,f),u.push({event:B,listeners:C}),$?B.data=$:($=eE(n),$!==null&&(B.data=$)))),($=VL?UL(e,n):KL(e,n))&&(d=om(d,"onBeforeInput"),0<d.length&&(f=new ik("onBeforeInput","beforeinput",null,n,f),u.push({event:f,listeners:d}),f.data=$))}fE(u,t)})}function yf(e,t,n){return{instance:e,listener:t,currentTarget:n}}function om(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=uf(e,n),i!=null&&r.unshift(yf(e,i,s)),i=uf(e,t),i!=null&&r.push(yf(e,i,s))),e=e.return}return r}function Tc(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function yk(e,t,n,r,s){for(var i=t._reactName,a=[];n!==null&&n!==r;){var l=n,c=l.alternate,d=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&d!==null&&(l=d,s?(c=uf(n,i),c!=null&&a.unshift(yf(n,c,l))):s||(c=uf(n,i),c!=null&&a.push(yf(n,c,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var oO=/\r\n?/g,aO=/\u0000|\uFFFD/g;function xk(e){return(typeof e=="string"?e:""+e).replace(oO,`
|
|
38
|
-
`).replace(aO,"")}function Yp(e,t,n){if(t=xk(t),xk(e)!==t&&n)throw Error(je(425))}function am(){}var Zx=null,ew=null;function tw(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,lO=typeof clearTimeout=="function"?clearTimeout:void 0,wk=typeof Promise=="function"?Promise:void 0,cO=typeof queueMicrotask=="function"?queueMicrotask:typeof wk<"u"?function(e){return wk.resolve(null).then(e).catch(uO)}:nw;function uO(e){setTimeout(function(){throw e})}function Cy(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),pf(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);pf(t)}function qa(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 bk(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 Hu=Math.random().toString(36).slice(2),fo="__reactFiber$"+Hu,xf="__reactProps$"+Hu,ea="__reactContainer$"+Hu,rw="__reactEvents$"+Hu,dO="__reactListeners$"+Hu,fO="__reactHandles$"+Hu;function Vl(e){var t=e[fo];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ea]||n[fo]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=bk(e);e!==null;){if(n=e[fo])return n;e=bk(e)}return t}e=n,n=e.parentNode}return null}function Xf(e){return e=e[fo]||e[ea],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Yc(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(je(33))}function pg(e){return e[xf]||null}var sw=[],Gc=-1;function dl(e){return{current:e}}function An(e){0>Gc||(e.current=sw[Gc],sw[Gc]=null,Gc--)}function bn(e,t){Gc++,sw[Gc]=e.current,e.current=t}var rl={},Xr=dl(rl),vs=dl(!1),tc=rl;function bu(e,t){var n=e.type.contextTypes;if(!n)return rl;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 ks(e){return e=e.childContextTypes,e!=null}function lm(){An(vs),An(Xr)}function vk(e,t,n){if(Xr.current!==rl)throw Error(je(168));bn(Xr,t),bn(vs,n)}function hE(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(je(108,XR(e)||"Unknown",s));return qn({},n,r)}function cm(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||rl,tc=Xr.current,bn(Xr,e),bn(vs,vs.current),!0}function kk(e,t,n){var r=e.stateNode;if(!r)throw Error(je(169));n?(e=hE(e,t,tc),r.__reactInternalMemoizedMergedChildContext=e,An(vs),An(Xr),bn(Xr,e)):An(vs),bn(vs,n)}var Vo=null,hg=!1,Ey=!1;function mE(e){Vo===null?Vo=[e]:Vo.push(e)}function pO(e){hg=!0,mE(e)}function fl(){if(!Ey&&Vo!==null){Ey=!0;var e=0,t=ln;try{var n=Vo;for(ln=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Vo=null,hg=!1}catch(s){throw Vo!==null&&(Vo=Vo.slice(e+1)),zC(Db,fl),s}finally{ln=t,Ey=!1}}return null}var Xc=[],Jc=0,um=null,dm=0,oi=[],ai=0,nc=null,qo=1,Yo="";function Fl(e,t){Xc[Jc++]=dm,Xc[Jc++]=um,um=e,dm=t}function gE(e,t,n){oi[ai++]=qo,oi[ai++]=Yo,oi[ai++]=nc,nc=e;var r=qo;e=Yo;var s=32-Bi(r)-1;r&=~(1<<s),n+=1;var i=32-Bi(t)+s;if(30<i){var a=s-s%5;i=(r&(1<<a)-1).toString(32),r>>=a,s-=a,qo=1<<32-Bi(t)+s|n<<s|r,Yo=i+e}else qo=1<<i|n<<s|r,Yo=e}function qb(e){e.return!==null&&(Fl(e,1),gE(e,1,0))}function Yb(e){for(;e===um;)um=Xc[--Jc],Xc[Jc]=null,dm=Xc[--Jc],Xc[Jc]=null;for(;e===nc;)nc=oi[--ai],oi[ai]=null,Yo=oi[--ai],oi[ai]=null,qo=oi[--ai],oi[ai]=null}var Bs=null,Fs=null,Fn=!1,Mi=null;function yE(e,t){var n=ui(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 Sk(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,Bs=e,Fs=qa(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Bs=e,Fs=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=nc!==null?{id:qo,overflow:Yo}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=ui(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Bs=e,Fs=null,!0):!1;default:return!1}}function iw(e){return(e.mode&1)!==0&&(e.flags&128)===0}function ow(e){if(Fn){var t=Fs;if(t){var n=t;if(!Sk(e,t)){if(iw(e))throw Error(je(418));t=qa(n.nextSibling);var r=Bs;t&&Sk(e,t)?yE(r,n):(e.flags=e.flags&-4097|2,Fn=!1,Bs=e)}}else{if(iw(e))throw Error(je(418));e.flags=e.flags&-4097|2,Fn=!1,Bs=e}}}function Nk(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Bs=e}function Gp(e){if(e!==Bs)return!1;if(!Fn)return Nk(e),Fn=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!tw(e.type,e.memoizedProps)),t&&(t=Fs)){if(iw(e))throw xE(),Error(je(418));for(;t;)yE(e,t),t=qa(t.nextSibling)}if(Nk(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(je(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Fs=qa(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Fs=null}}else Fs=Bs?qa(e.stateNode.nextSibling):null;return!0}function xE(){for(var e=Fs;e;)e=qa(e.nextSibling)}function vu(){Fs=Bs=null,Fn=!1}function Gb(e){Mi===null?Mi=[e]:Mi.push(e)}var hO=oa.ReactCurrentBatchConfig;function xd(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(je(309));var r=n.stateNode}if(!r)throw Error(je(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(je(284));if(!n._owner)throw Error(je(290,e))}return e}function Xp(e,t){throw e=Object.prototype.toString.call(t),Error(je(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function jk(e){var t=e._init;return t(e._payload)}function wE(e){function t(y,k){if(e){var w=y.deletions;w===null?(y.deletions=[k],y.flags|=16):w.push(k)}}function n(y,k){if(!e)return null;for(;k!==null;)t(y,k),k=k.sibling;return null}function r(y,k){for(y=new Map;k!==null;)k.key!==null?y.set(k.key,k):y.set(k.index,k),k=k.sibling;return y}function s(y,k){return y=Ja(y,k),y.index=0,y.sibling=null,y}function i(y,k,w){return y.index=w,e?(w=y.alternate,w!==null?(w=w.index,w<k?(y.flags|=2,k):w):(y.flags|=2,k)):(y.flags|=1048576,k)}function a(y){return e&&y.alternate===null&&(y.flags|=2),y}function l(y,k,w,j){return k===null||k.tag!==6?(k=Ly(w,y.mode,j),k.return=y,k):(k=s(k,w),k.return=y,k)}function c(y,k,w,j){var A=w.type;return A===Vc?f(y,k,w.props.children,j,w.key):k!==null&&(k.elementType===A||typeof A=="object"&&A!==null&&A.$$typeof===Ra&&jk(A)===k.type)?(j=s(k,w.props),j.ref=xd(y,k,w),j.return=y,j):(j=zh(w.type,w.key,w.props,null,y.mode,j),j.ref=xd(y,k,w),j.return=y,j)}function d(y,k,w,j){return k===null||k.tag!==4||k.stateNode.containerInfo!==w.containerInfo||k.stateNode.implementation!==w.implementation?(k=Oy(w,y.mode,j),k.return=y,k):(k=s(k,w.children||[]),k.return=y,k)}function f(y,k,w,j,A){return k===null||k.tag!==7?(k=Gl(w,y.mode,j,A),k.return=y,k):(k=s(k,w),k.return=y,k)}function u(y,k,w){if(typeof k=="string"&&k!==""||typeof k=="number")return k=Ly(""+k,y.mode,w),k.return=y,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case Fp:return w=zh(k.type,k.key,k.props,null,y.mode,w),w.ref=xd(y,null,k),w.return=y,w;case Wc:return k=Oy(k,y.mode,w),k.return=y,k;case Ra:var j=k._init;return u(y,j(k._payload),w)}if(Td(k)||pd(k))return k=Gl(k,y.mode,w,null),k.return=y,k;Xp(y,k)}return null}function p(y,k,w,j){var A=k!==null?k.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return A!==null?null:l(y,k,""+w,j);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Fp:return w.key===A?c(y,k,w,j):null;case Wc:return w.key===A?d(y,k,w,j):null;case Ra:return A=w._init,p(y,k,A(w._payload),j)}if(Td(w)||pd(w))return A!==null?null:f(y,k,w,j,null);Xp(y,w)}return null}function m(y,k,w,j,A){if(typeof j=="string"&&j!==""||typeof j=="number")return y=y.get(w)||null,l(k,y,""+j,A);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case Fp:return y=y.get(j.key===null?w:j.key)||null,c(k,y,j,A);case Wc:return y=y.get(j.key===null?w:j.key)||null,d(k,y,j,A);case Ra:var C=j._init;return m(y,k,w,C(j._payload),A)}if(Td(j)||pd(j))return y=y.get(w)||null,f(k,y,j,A,null);Xp(k,j)}return null}function g(y,k,w,j){for(var A=null,C=null,$=k,B=k=0,F=null;$!==null&&B<w.length;B++){$.index>B?(F=$,$=null):F=$.sibling;var z=p(y,$,w[B],j);if(z===null){$===null&&($=F);break}e&&$&&z.alternate===null&&t(y,$),k=i(z,k,B),C===null?A=z:C.sibling=z,C=z,$=F}if(B===w.length)return n(y,$),Fn&&Fl(y,B),A;if($===null){for(;B<w.length;B++)$=u(y,w[B],j),$!==null&&(k=i($,k,B),C===null?A=$:C.sibling=$,C=$);return Fn&&Fl(y,B),A}for($=r(y,$);B<w.length;B++)F=m($,y,B,w[B],j),F!==null&&(e&&F.alternate!==null&&$.delete(F.key===null?B:F.key),k=i(F,k,B),C===null?A=F:C.sibling=F,C=F);return e&&$.forEach(function(L){return t(y,L)}),Fn&&Fl(y,B),A}function b(y,k,w,j){var A=pd(w);if(typeof A!="function")throw Error(je(150));if(w=A.call(w),w==null)throw Error(je(151));for(var C=A=null,$=k,B=k=0,F=null,z=w.next();$!==null&&!z.done;B++,z=w.next()){$.index>B?(F=$,$=null):F=$.sibling;var L=p(y,$,z.value,j);if(L===null){$===null&&($=F);break}e&&$&&L.alternate===null&&t(y,$),k=i(L,k,B),C===null?A=L:C.sibling=L,C=L,$=F}if(z.done)return n(y,$),Fn&&Fl(y,B),A;if($===null){for(;!z.done;B++,z=w.next())z=u(y,z.value,j),z!==null&&(k=i(z,k,B),C===null?A=z:C.sibling=z,C=z);return Fn&&Fl(y,B),A}for($=r(y,$);!z.done;B++,z=w.next())z=m($,y,B,z.value,j),z!==null&&(e&&z.alternate!==null&&$.delete(z.key===null?B:z.key),k=i(z,k,B),C===null?A=z:C.sibling=z,C=z);return e&&$.forEach(function(O){return t(y,O)}),Fn&&Fl(y,B),A}function v(y,k,w,j){if(typeof w=="object"&&w!==null&&w.type===Vc&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Fp:e:{for(var A=w.key,C=k;C!==null;){if(C.key===A){if(A=w.type,A===Vc){if(C.tag===7){n(y,C.sibling),k=s(C,w.props.children),k.return=y,y=k;break e}}else if(C.elementType===A||typeof A=="object"&&A!==null&&A.$$typeof===Ra&&jk(A)===C.type){n(y,C.sibling),k=s(C,w.props),k.ref=xd(y,C,w),k.return=y,y=k;break e}n(y,C);break}else t(y,C);C=C.sibling}w.type===Vc?(k=Gl(w.props.children,y.mode,j,w.key),k.return=y,y=k):(j=zh(w.type,w.key,w.props,null,y.mode,j),j.ref=xd(y,k,w),j.return=y,y=j)}return a(y);case Wc:e:{for(C=w.key;k!==null;){if(k.key===C)if(k.tag===4&&k.stateNode.containerInfo===w.containerInfo&&k.stateNode.implementation===w.implementation){n(y,k.sibling),k=s(k,w.children||[]),k.return=y,y=k;break e}else{n(y,k);break}else t(y,k);k=k.sibling}k=Oy(w,y.mode,j),k.return=y,y=k}return a(y);case Ra:return C=w._init,v(y,k,C(w._payload),j)}if(Td(w))return g(y,k,w,j);if(pd(w))return b(y,k,w,j);Xp(y,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,k!==null&&k.tag===6?(n(y,k.sibling),k=s(k,w),k.return=y,y=k):(n(y,k),k=Ly(w,y.mode,j),k.return=y,y=k),a(y)):n(y,k)}return v}var ku=wE(!0),bE=wE(!1),fm=dl(null),pm=null,Qc=null,Xb=null;function Jb(){Xb=Qc=pm=null}function Qb(e){var t=fm.current;An(fm),e._currentValue=t}function aw(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 du(e,t){pm=e,Xb=Qc=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(gs=!0),e.firstContext=null)}function fi(e){var t=e._currentValue;if(Xb!==e)if(e={context:e,memoizedValue:t,next:null},Qc===null){if(pm===null)throw Error(je(308));Qc=e,pm.dependencies={lanes:0,firstContext:e}}else Qc=Qc.next=e;return t}var Ul=null;function Zb(e){Ul===null?Ul=[e]:Ul.push(e)}function vE(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Zb(t)):(n.next=s.next,s.next=n),t.interleaved=n,ta(e,r)}function ta(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 La=!1;function ev(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function kE(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 Qo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ya(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Kt&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,ta(e,n)}return s=r.interleaved,s===null?(t.next=t,Zb(r)):(t.next=s.next,s.next=t),r.interleaved=t,ta(e,n)}function Lh(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,Fb(e,n)}}function Ck(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 hm(e,t,n,r){var s=e.updateQueue;La=!1;var i=s.firstBaseUpdate,a=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,d=c.next;c.next=null,a===null?i=d:a.next=d,a=c;var f=e.alternate;f!==null&&(f=f.updateQueue,l=f.lastBaseUpdate,l!==a&&(l===null?f.firstBaseUpdate=d:l.next=d,f.lastBaseUpdate=c))}if(i!==null){var u=s.baseState;a=0,f=d=c=null,l=i;do{var p=l.lane,m=l.eventTime;if((r&p)===p){f!==null&&(f=f.next={eventTime:m,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,b=l;switch(p=t,m=n,b.tag){case 1:if(g=b.payload,typeof g=="function"){u=g.call(m,u,p);break e}u=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=b.payload,p=typeof g=="function"?g.call(m,u,p):g,p==null)break e;u=qn({},u,p);break e;case 2:La=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=s.effects,p===null?s.effects=[l]:p.push(l))}else m={eventTime:m,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},f===null?(d=f=m,c=u):f=f.next=m,a|=p;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;p=l,l=p.next,p.next=null,s.lastBaseUpdate=p,s.shared.pending=null}}while(!0);if(f===null&&(c=u),s.baseState=c,s.firstBaseUpdate=d,s.lastBaseUpdate=f,t=s.shared.interleaved,t!==null){s=t;do a|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);sc|=a,e.lanes=a,e.memoizedState=u}}function Ek(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(je(191,s));s.call(r)}}}var Jf={},yo=dl(Jf),wf=dl(Jf),bf=dl(Jf);function Kl(e){if(e===Jf)throw Error(je(174));return e}function tv(e,t){switch(bn(bf,t),bn(wf,e),bn(yo,Jf),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Bx(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Bx(t,e)}An(yo),bn(yo,t)}function Su(){An(yo),An(wf),An(bf)}function SE(e){Kl(bf.current);var t=Kl(yo.current),n=Bx(t,e.type);t!==n&&(bn(wf,e),bn(yo,n))}function nv(e){wf.current===e&&(An(yo),An(wf))}var Un=dl(0);function mm(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 _y=[];function rv(){for(var e=0;e<_y.length;e++)_y[e]._workInProgressVersionPrimary=null;_y.length=0}var Oh=oa.ReactCurrentDispatcher,Py=oa.ReactCurrentBatchConfig,rc=0,Kn=null,xr=null,Pr=null,gm=!1,qd=!1,vf=0,mO=0;function Kr(){throw Error(je(321))}function sv(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Wi(e[n],t[n]))return!1;return!0}function iv(e,t,n,r,s,i){if(rc=i,Kn=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Oh.current=e===null||e.memoizedState===null?wO:bO,e=n(r,s),qd){i=0;do{if(qd=!1,vf=0,25<=i)throw Error(je(301));i+=1,Pr=xr=null,t.updateQueue=null,Oh.current=vO,e=n(r,s)}while(qd)}if(Oh.current=ym,t=xr!==null&&xr.next!==null,rc=0,Pr=xr=Kn=null,gm=!1,t)throw Error(je(300));return e}function ov(){var e=vf!==0;return vf=0,e}function ao(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Pr===null?Kn.memoizedState=Pr=e:Pr=Pr.next=e,Pr}function pi(){if(xr===null){var e=Kn.alternate;e=e!==null?e.memoizedState:null}else e=xr.next;var t=Pr===null?Kn.memoizedState:Pr.next;if(t!==null)Pr=t,xr=e;else{if(e===null)throw Error(je(310));xr=e,e={memoizedState:xr.memoizedState,baseState:xr.baseState,baseQueue:xr.baseQueue,queue:xr.queue,next:null},Pr===null?Kn.memoizedState=Pr=e:Pr=Pr.next=e}return Pr}function kf(e,t){return typeof t=="function"?t(e):t}function Ay(e){var t=pi(),n=t.queue;if(n===null)throw Error(je(311));n.lastRenderedReducer=e;var r=xr,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var a=s.next;s.next=i.next,i.next=a}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var l=a=null,c=null,d=i;do{var f=d.lane;if((rc&f)===f)c!==null&&(c=c.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),r=d.hasEagerState?d.eagerState:e(r,d.action);else{var u={lane:f,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(l=c=u,a=r):c=c.next=u,Kn.lanes|=f,sc|=f}d=d.next}while(d!==null&&d!==i);c===null?a=r:c.next=l,Wi(r,t.memoizedState)||(gs=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do i=s.lane,Kn.lanes|=i,sc|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Iy(e){var t=pi(),n=t.queue;if(n===null)throw Error(je(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);Wi(i,t.memoizedState)||(gs=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function NE(){}function jE(e,t){var n=Kn,r=pi(),s=t(),i=!Wi(r.memoizedState,s);if(i&&(r.memoizedState=s,gs=!0),r=r.queue,av(_E.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Pr!==null&&Pr.memoizedState.tag&1){if(n.flags|=2048,Sf(9,EE.bind(null,n,r,s,t),void 0,null),Ir===null)throw Error(je(349));rc&30||CE(n,t,s)}return s}function CE(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Kn.updateQueue,t===null?(t={lastEffect:null,stores:null},Kn.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function EE(e,t,n,r){t.value=n,t.getSnapshot=r,PE(t)&&AE(e)}function _E(e,t,n){return n(function(){PE(t)&&AE(e)})}function PE(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Wi(e,n)}catch{return!0}}function AE(e){var t=ta(e,1);t!==null&&Hi(t,e,1,-1)}function _k(e){var t=ao();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:kf,lastRenderedState:e},t.queue=e,e=e.dispatch=xO.bind(null,Kn,e),[t.memoizedState,e]}function Sf(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Kn.updateQueue,t===null?(t={lastEffect:null,stores:null},Kn.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 IE(){return pi().memoizedState}function Mh(e,t,n,r){var s=ao();Kn.flags|=e,s.memoizedState=Sf(1|t,n,void 0,r===void 0?null:r)}function mg(e,t,n,r){var s=pi();r=r===void 0?null:r;var i=void 0;if(xr!==null){var a=xr.memoizedState;if(i=a.destroy,r!==null&&sv(r,a.deps)){s.memoizedState=Sf(t,n,i,r);return}}Kn.flags|=e,s.memoizedState=Sf(1|t,n,i,r)}function Pk(e,t){return Mh(8390656,8,e,t)}function av(e,t){return mg(2048,8,e,t)}function TE(e,t){return mg(4,2,e,t)}function RE(e,t){return mg(4,4,e,t)}function LE(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 OE(e,t,n){return n=n!=null?n.concat([e]):null,mg(4,4,LE.bind(null,t,e),n)}function lv(){}function ME(e,t){var n=pi();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&sv(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function $E(e,t){var n=pi();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&sv(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function DE(e,t,n){return rc&21?(Wi(n,t)||(n=WC(),Kn.lanes|=n,sc|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,gs=!0),e.memoizedState=n)}function gO(e,t){var n=ln;ln=n!==0&&4>n?n:4,e(!0);var r=Py.transition;Py.transition={};try{e(!1),t()}finally{ln=n,Py.transition=r}}function FE(){return pi().memoizedState}function yO(e,t,n){var r=Xa(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},zE(e))BE(t,n);else if(n=vE(e,t,n,r),n!==null){var s=os();Hi(n,e,r,s),HE(n,t,r)}}function xO(e,t,n){var r=Xa(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(zE(e))BE(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,Wi(l,a)){var c=t.interleaved;c===null?(s.next=s,Zb(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=vE(e,t,s,r),n!==null&&(s=os(),Hi(n,e,r,s),HE(n,t,r))}}function zE(e){var t=e.alternate;return e===Kn||t!==null&&t===Kn}function BE(e,t){qd=gm=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function HE(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Fb(e,n)}}var ym={readContext:fi,useCallback:Kr,useContext:Kr,useEffect:Kr,useImperativeHandle:Kr,useInsertionEffect:Kr,useLayoutEffect:Kr,useMemo:Kr,useReducer:Kr,useRef:Kr,useState:Kr,useDebugValue:Kr,useDeferredValue:Kr,useTransition:Kr,useMutableSource:Kr,useSyncExternalStore:Kr,useId:Kr,unstable_isNewReconciler:!1},wO={readContext:fi,useCallback:function(e,t){return ao().memoizedState=[e,t===void 0?null:t],e},useContext:fi,useEffect:Pk,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Mh(4194308,4,LE.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Mh(4194308,4,e,t)},useInsertionEffect:function(e,t){return Mh(4,2,e,t)},useMemo:function(e,t){var n=ao();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ao();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=yO.bind(null,Kn,e),[r.memoizedState,e]},useRef:function(e){var t=ao();return e={current:e},t.memoizedState=e},useState:_k,useDebugValue:lv,useDeferredValue:function(e){return ao().memoizedState=e},useTransition:function(){var e=_k(!1),t=e[0];return e=gO.bind(null,e[1]),ao().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Kn,s=ao();if(Fn){if(n===void 0)throw Error(je(407));n=n()}else{if(n=t(),Ir===null)throw Error(je(349));rc&30||CE(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,Pk(_E.bind(null,r,i,e),[e]),r.flags|=2048,Sf(9,EE.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=ao(),t=Ir.identifierPrefix;if(Fn){var n=Yo,r=qo;n=(r&~(1<<32-Bi(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=vf++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=mO++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},bO={readContext:fi,useCallback:ME,useContext:fi,useEffect:av,useImperativeHandle:OE,useInsertionEffect:TE,useLayoutEffect:RE,useMemo:$E,useReducer:Ay,useRef:IE,useState:function(){return Ay(kf)},useDebugValue:lv,useDeferredValue:function(e){var t=pi();return DE(t,xr.memoizedState,e)},useTransition:function(){var e=Ay(kf)[0],t=pi().memoizedState;return[e,t]},useMutableSource:NE,useSyncExternalStore:jE,useId:FE,unstable_isNewReconciler:!1},vO={readContext:fi,useCallback:ME,useContext:fi,useEffect:av,useImperativeHandle:OE,useInsertionEffect:TE,useLayoutEffect:RE,useMemo:$E,useReducer:Iy,useRef:IE,useState:function(){return Iy(kf)},useDebugValue:lv,useDeferredValue:function(e){var t=pi();return xr===null?t.memoizedState=e:DE(t,xr.memoizedState,e)},useTransition:function(){var e=Iy(kf)[0],t=pi().memoizedState;return[e,t]},useMutableSource:NE,useSyncExternalStore:jE,useId:FE,unstable_isNewReconciler:!1};function Ri(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 lw(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 gg={isMounted:function(e){return(e=e._reactInternals)?pc(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=os(),s=Xa(e),i=Qo(r,s);i.payload=t,n!=null&&(i.callback=n),t=Ya(e,i,s),t!==null&&(Hi(t,e,s,r),Lh(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=os(),s=Xa(e),i=Qo(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ya(e,i,s),t!==null&&(Hi(t,e,s,r),Lh(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=os(),r=Xa(e),s=Qo(n,r);s.tag=2,t!=null&&(s.callback=t),t=Ya(e,s,r),t!==null&&(Hi(t,e,r,n),Lh(t,e,r))}};function Ak(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?!mf(n,r)||!mf(s,i):!0}function WE(e,t,n){var r=!1,s=rl,i=t.contextType;return typeof i=="object"&&i!==null?i=fi(i):(s=ks(t)?tc:Xr.current,r=t.contextTypes,i=(r=r!=null)?bu(e,s):rl),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=gg,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function Ik(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&&gg.enqueueReplaceState(t,t.state,null)}function cw(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},ev(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=fi(i):(i=ks(t)?tc:Xr.current,s.context=bu(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(lw(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&&gg.enqueueReplaceState(s,s.state,null),hm(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Nu(e,t){try{var n="",r=t;do n+=GR(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 Ty(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function uw(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var kO=typeof WeakMap=="function"?WeakMap:Map;function VE(e,t,n){n=Qo(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){wm||(wm=!0,bw=r),uw(e,t)},n}function UE(e,t,n){n=Qo(-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(){uw(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){uw(e,t),typeof r!="function"&&(Ga===null?Ga=new Set([this]):Ga.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function Tk(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new kO;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=MO.bind(null,e,t,n),t.then(e,e))}function Rk(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 Lk(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=Qo(-1,1),t.tag=2,Ya(n,t,1))),n.lanes|=1),e)}var SO=oa.ReactCurrentOwner,gs=!1;function ss(e,t,n,r){t.child=e===null?bE(t,null,n,r):ku(t,e.child,n,r)}function Ok(e,t,n,r,s){n=n.render;var i=t.ref;return du(t,s),r=iv(e,t,n,r,i,s),n=ov(),e!==null&&!gs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,na(e,t,s)):(Fn&&n&&qb(t),t.flags|=1,ss(e,t,r,s),t.child)}function Mk(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!gv(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,KE(e,t,i,r,s)):(e=zh(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:mf,n(a,r)&&e.ref===t.ref)return na(e,t,s)}return t.flags|=1,e=Ja(i,r),e.ref=t.ref,e.return=t,t.child=e}function KE(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(mf(i,r)&&e.ref===t.ref)if(gs=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(gs=!0);else return t.lanes=e.lanes,na(e,t,s)}return dw(e,t,n,r,s)}function qE(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},bn(eu,Ms),Ms|=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,bn(eu,Ms),Ms|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,bn(eu,Ms),Ms|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,bn(eu,Ms),Ms|=r;return ss(e,t,s,n),t.child}function YE(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function dw(e,t,n,r,s){var i=ks(n)?tc:Xr.current;return i=bu(t,i),du(t,s),n=iv(e,t,n,r,i,s),r=ov(),e!==null&&!gs?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,na(e,t,s)):(Fn&&r&&qb(t),t.flags|=1,ss(e,t,n,s),t.child)}function $k(e,t,n,r,s){if(ks(n)){var i=!0;cm(t)}else i=!1;if(du(t,s),t.stateNode===null)$h(e,t),WE(t,n,r),cw(t,n,r,s),r=!0;else if(e===null){var a=t.stateNode,l=t.memoizedProps;a.props=l;var c=a.context,d=n.contextType;typeof d=="object"&&d!==null?d=fi(d):(d=ks(n)?tc:Xr.current,d=bu(t,d));var f=n.getDerivedStateFromProps,u=typeof f=="function"||typeof a.getSnapshotBeforeUpdate=="function";u||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||c!==d)&&Ik(t,a,r,d),La=!1;var p=t.memoizedState;a.state=p,hm(t,r,a,s),c=t.memoizedState,l!==r||p!==c||vs.current||La?(typeof f=="function"&&(lw(t,n,f,r),c=t.memoizedState),(l=La||Ak(t,n,l,r,p,c,d))?(u||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),a.props=r,a.state=c,a.context=d,r=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,kE(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:Ri(t.type,l),a.props=d,u=t.pendingProps,p=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=fi(c):(c=ks(n)?tc:Xr.current,c=bu(t,c));var m=n.getDerivedStateFromProps;(f=typeof m=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==u||p!==c)&&Ik(t,a,r,c),La=!1,p=t.memoizedState,a.state=p,hm(t,r,a,s);var g=t.memoizedState;l!==u||p!==g||vs.current||La?(typeof m=="function"&&(lw(t,n,m,r),g=t.memoizedState),(d=La||Ak(t,n,d,r,p,g,c)||!1)?(f||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,g,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,g,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),a.props=r,a.state=g,a.context=c,r=d):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return fw(e,t,n,r,i,s)}function fw(e,t,n,r,s,i){YE(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return s&&kk(t,n,!1),na(e,t,i);r=t.stateNode,SO.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=ku(t,e.child,null,i),t.child=ku(t,null,l,i)):ss(e,t,l,i),t.memoizedState=r.state,s&&kk(t,n,!0),t.child}function GE(e){var t=e.stateNode;t.pendingContext?vk(e,t.pendingContext,t.pendingContext!==t.context):t.context&&vk(e,t.context,!1),tv(e,t.containerInfo)}function Dk(e,t,n,r,s){return vu(),Gb(s),t.flags|=256,ss(e,t,n,r),t.child}var pw={dehydrated:null,treeContext:null,retryLane:0};function hw(e){return{baseLanes:e,cachePool:null,transitions:null}}function XE(e,t,n){var r=t.pendingProps,s=Un.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),bn(Un,s&1),e===null)return ow(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=wg(a,r,0,null),e=Gl(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=hw(n),t.memoizedState=pw,e):cv(t,a));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return NO(e,t,a,r,l,s,n);if(i){i=r.fallback,a=t.mode,s=e.child,l=s.sibling;var c={mode:"hidden",children:r.children};return!(a&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Ja(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=Ja(l,i):(i=Gl(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?hw(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=pw,r}return i=e.child,e=i.sibling,r=Ja(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 cv(e,t){return t=wg({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Jp(e,t,n,r){return r!==null&&Gb(r),ku(t,e.child,null,n),e=cv(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function NO(e,t,n,r,s,i,a){if(n)return t.flags&256?(t.flags&=-257,r=Ty(Error(je(422))),Jp(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=wg({mode:"visible",children:r.children},s,0,null),i=Gl(i,s,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&ku(t,e.child,null,a),t.child.memoizedState=hw(a),t.memoizedState=pw,i);if(!(t.mode&1))return Jp(e,t,a,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(je(419)),r=Ty(i,r,void 0),Jp(e,t,a,r)}if(l=(a&e.childLanes)!==0,gs||l){if(r=Ir,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,ta(e,s),Hi(r,e,s,-1))}return mv(),r=Ty(Error(je(421))),Jp(e,t,a,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=$O.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,Fs=qa(s.nextSibling),Bs=t,Fn=!0,Mi=null,e!==null&&(oi[ai++]=qo,oi[ai++]=Yo,oi[ai++]=nc,qo=e.id,Yo=e.overflow,nc=t),t=cv(t,r.children),t.flags|=4096,t)}function Fk(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),aw(e.return,t,n)}function Ry(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 JE(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(ss(e,t,r.children,n),r=Un.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&&Fk(e,n,t);else if(e.tag===19)Fk(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(bn(Un,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&&mm(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Ry(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&&mm(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Ry(t,!0,n,null,i);break;case"together":Ry(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function $h(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function na(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),sc|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(je(153));if(t.child!==null){for(e=t.child,n=Ja(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ja(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function jO(e,t,n){switch(t.tag){case 3:GE(t),vu();break;case 5:SE(t);break;case 1:ks(t.type)&&cm(t);break;case 4:tv(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;bn(fm,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(bn(Un,Un.current&1),t.flags|=128,null):n&t.child.childLanes?XE(e,t,n):(bn(Un,Un.current&1),e=na(e,t,n),e!==null?e.sibling:null);bn(Un,Un.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return JE(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),bn(Un,Un.current),r)break;return null;case 22:case 23:return t.lanes=0,qE(e,t,n)}return na(e,t,n)}var QE,mw,ZE,e_;QE=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}};mw=function(){};ZE=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Kl(yo.current);var i=null;switch(n){case"input":s=$x(e,s),r=$x(e,r),i=[];break;case"select":s=qn({},s,{value:void 0}),r=qn({},r,{value:void 0}),i=[];break;case"textarea":s=zx(e,s),r=zx(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=am)}Hx(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"&&(lf.hasOwnProperty(d)?i||(i=[]):(i=i||[]).push(d,null));for(d in r){var c=r[d];if(l=s!=null?s[d]:void 0,r.hasOwnProperty(d)&&c!==l&&(c!=null||l!=null))if(d==="style")if(l){for(a in l)!l.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in c)c.hasOwnProperty(a)&&l[a]!==c[a]&&(n||(n={}),n[a]=c[a])}else n||(i||(i=[]),i.push(d,n)),n=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(lf.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&_n("scroll",e),i||l===c||(i=[])):(i=i||[]).push(d,c))}n&&(i=i||[]).push("style",n);var d=i;(t.updateQueue=d)&&(t.flags|=4)}};e_=function(e,t,n,r){n!==r&&(t.flags|=4)};function wd(e,t){if(!Fn)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 qr(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 CO(e,t,n){var r=t.pendingProps;switch(Yb(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return qr(t),null;case 1:return ks(t.type)&&lm(),qr(t),null;case 3:return r=t.stateNode,Su(),An(vs),An(Xr),rv(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Gp(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Mi!==null&&(Sw(Mi),Mi=null))),mw(e,t),qr(t),null;case 5:nv(t);var s=Kl(bf.current);if(n=t.type,e!==null&&t.stateNode!=null)ZE(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(je(166));return qr(t),null}if(e=Kl(yo.current),Gp(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[fo]=t,r[xf]=i,e=(t.mode&1)!==0,n){case"dialog":_n("cancel",r),_n("close",r);break;case"iframe":case"object":case"embed":_n("load",r);break;case"video":case"audio":for(s=0;s<Ld.length;s++)_n(Ld[s],r);break;case"source":_n("error",r);break;case"img":case"image":case"link":_n("error",r),_n("load",r);break;case"details":_n("toggle",r);break;case"input":Y0(r,i),_n("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},_n("invalid",r);break;case"textarea":X0(r,i),_n("invalid",r)}Hx(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&&Yp(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Yp(r.textContent,l,e),s=["children",""+l]):lf.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&_n("scroll",r)}switch(n){case"input":zp(r),G0(r,i,!0);break;case"textarea":zp(r),J0(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=am)}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=_C(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[fo]=t,e[xf]=r,QE(e,t,!1,!1),t.stateNode=e;e:{switch(a=Wx(n,r),n){case"dialog":_n("cancel",e),_n("close",e),s=r;break;case"iframe":case"object":case"embed":_n("load",e),s=r;break;case"video":case"audio":for(s=0;s<Ld.length;s++)_n(Ld[s],e);s=r;break;case"source":_n("error",e),s=r;break;case"img":case"image":case"link":_n("error",e),_n("load",e),s=r;break;case"details":_n("toggle",e),s=r;break;case"input":Y0(e,r),s=$x(e,r),_n("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=qn({},r,{value:void 0}),_n("invalid",e);break;case"textarea":X0(e,r),s=zx(e,r),_n("invalid",e);break;default:s=r}Hx(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?IC(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&PC(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&cf(e,c):typeof c=="number"&&cf(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(lf.hasOwnProperty(i)?c!=null&&i==="onScroll"&&_n("scroll",e):c!=null&&Rb(e,i,c,a))}switch(n){case"input":zp(e),G0(e,r,!1);break;case"textarea":zp(e),J0(e);break;case"option":r.value!=null&&e.setAttribute("value",""+nl(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?au(e,!!r.multiple,i,!1):r.defaultValue!=null&&au(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=am)}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 qr(t),null;case 6:if(e&&t.stateNode!=null)e_(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(je(166));if(n=Kl(bf.current),Kl(yo.current),Gp(t)){if(r=t.stateNode,n=t.memoizedProps,r[fo]=t,(i=r.nodeValue!==n)&&(e=Bs,e!==null))switch(e.tag){case 3:Yp(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Yp(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[fo]=t,t.stateNode=r}return qr(t),null;case 13:if(An(Un),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Fn&&Fs!==null&&t.mode&1&&!(t.flags&128))xE(),vu(),t.flags|=98560,i=!1;else if(i=Gp(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(je(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(je(317));i[fo]=t}else vu(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;qr(t),i=!1}else Mi!==null&&(Sw(Mi),Mi=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||Un.current&1?br===0&&(br=3):mv())),t.updateQueue!==null&&(t.flags|=4),qr(t),null);case 4:return Su(),mw(e,t),e===null&&gf(t.stateNode.containerInfo),qr(t),null;case 10:return Qb(t.type._context),qr(t),null;case 17:return ks(t.type)&&lm(),qr(t),null;case 19:if(An(Un),i=t.memoizedState,i===null)return qr(t),null;if(r=(t.flags&128)!==0,a=i.rendering,a===null)if(r)wd(i,!1);else{if(br!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=mm(e),a!==null){for(t.flags|=128,wd(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 bn(Un,Un.current&1|2),t.child}e=e.sibling}i.tail!==null&&sr()>ju&&(t.flags|=128,r=!0,wd(i,!1),t.lanes=4194304)}else{if(!r)if(e=mm(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),wd(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!Fn)return qr(t),null}else 2*sr()-i.renderingStartTime>ju&&n!==1073741824&&(t.flags|=128,r=!0,wd(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=sr(),t.sibling=null,n=Un.current,bn(Un,r?n&1|2:n&1),t):(qr(t),null);case 22:case 23:return hv(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Ms&1073741824&&(qr(t),t.subtreeFlags&6&&(t.flags|=8192)):qr(t),null;case 24:return null;case 25:return null}throw Error(je(156,t.tag))}function EO(e,t){switch(Yb(t),t.tag){case 1:return ks(t.type)&&lm(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Su(),An(vs),An(Xr),rv(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return nv(t),null;case 13:if(An(Un),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(je(340));vu()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return An(Un),null;case 4:return Su(),null;case 10:return Qb(t.type._context),null;case 22:case 23:return hv(),null;case 24:return null;default:return null}}var Qp=!1,Yr=!1,_O=typeof WeakSet=="function"?WeakSet:Set,He=null;function Zc(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Qn(e,t,r)}else n.current=null}function gw(e,t,n){try{n()}catch(r){Qn(e,t,r)}}var zk=!1;function PO(e,t){if(Zx=sm,e=iE(),Kb(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var a=0,l=-1,c=-1,d=0,f=0,u=e,p=null;t:for(;;){for(var m;u!==n||s!==0&&u.nodeType!==3||(l=a+s),u!==i||r!==0&&u.nodeType!==3||(c=a+r),u.nodeType===3&&(a+=u.nodeValue.length),(m=u.firstChild)!==null;)p=u,u=m;for(;;){if(u===e)break t;if(p===n&&++d===s&&(l=a),p===i&&++f===r&&(c=a),(m=u.nextSibling)!==null)break;u=p,p=u.parentNode}u=m}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(ew={focusedElem:e,selectionRange:n},sm=!1,He=t;He!==null;)if(t=He,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,He=e;else for(;He!==null;){t=He;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var b=g.memoizedProps,v=g.memoizedState,y=t.stateNode,k=y.getSnapshotBeforeUpdate(t.elementType===t.type?b:Ri(t.type,b),v);y.__reactInternalSnapshotBeforeUpdate=k}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(je(163))}}catch(j){Qn(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,He=e;break}He=t.return}return g=zk,zk=!1,g}function Yd(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&&gw(t,n,i)}s=s.next}while(s!==r)}}function yg(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 yw(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 t_(e){var t=e.alternate;t!==null&&(e.alternate=null,t_(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[fo],delete t[xf],delete t[rw],delete t[dO],delete t[fO])),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 n_(e){return e.tag===5||e.tag===3||e.tag===4}function Bk(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||n_(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 xw(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=am));else if(r!==4&&(e=e.child,e!==null))for(xw(e,t,n),e=e.sibling;e!==null;)xw(e,t,n),e=e.sibling}function ww(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(ww(e,t,n),e=e.sibling;e!==null;)ww(e,t,n),e=e.sibling}var Or=null,Li=!1;function Ca(e,t,n){for(n=n.child;n!==null;)r_(e,t,n),n=n.sibling}function r_(e,t,n){if(go&&typeof go.onCommitFiberUnmount=="function")try{go.onCommitFiberUnmount(cg,n)}catch{}switch(n.tag){case 5:Yr||Zc(n,t);case 6:var r=Or,s=Li;Or=null,Ca(e,t,n),Or=r,Li=s,Or!==null&&(Li?(e=Or,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Or.removeChild(n.stateNode));break;case 18:Or!==null&&(Li?(e=Or,n=n.stateNode,e.nodeType===8?Cy(e.parentNode,n):e.nodeType===1&&Cy(e,n),pf(e)):Cy(Or,n.stateNode));break;case 4:r=Or,s=Li,Or=n.stateNode.containerInfo,Li=!0,Ca(e,t,n),Or=r,Li=s;break;case 0:case 11:case 14:case 15:if(!Yr&&(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)&&gw(n,t,a),s=s.next}while(s!==r)}Ca(e,t,n);break;case 1:if(!Yr&&(Zc(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Qn(n,t,l)}Ca(e,t,n);break;case 21:Ca(e,t,n);break;case 22:n.mode&1?(Yr=(r=Yr)||n.memoizedState!==null,Ca(e,t,n),Yr=r):Ca(e,t,n);break;default:Ca(e,t,n)}}function Hk(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new _O),t.forEach(function(r){var s=DO.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Ai(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:Or=l.stateNode,Li=!1;break e;case 3:Or=l.stateNode.containerInfo,Li=!0;break e;case 4:Or=l.stateNode.containerInfo,Li=!0;break e}l=l.return}if(Or===null)throw Error(je(160));r_(i,a,s),Or=null,Li=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(d){Qn(s,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)s_(t,e),t=t.sibling}function s_(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ai(t,e),io(e),r&4){try{Yd(3,e,e.return),yg(3,e)}catch(b){Qn(e,e.return,b)}try{Yd(5,e,e.return)}catch(b){Qn(e,e.return,b)}}break;case 1:Ai(t,e),io(e),r&512&&n!==null&&Zc(n,n.return);break;case 5:if(Ai(t,e),io(e),r&512&&n!==null&&Zc(n,n.return),e.flags&32){var s=e.stateNode;try{cf(s,"")}catch(b){Qn(e,e.return,b)}}if(r&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,a=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&CC(s,i),Wx(l,a);var d=Wx(l,i);for(a=0;a<c.length;a+=2){var f=c[a],u=c[a+1];f==="style"?IC(s,u):f==="dangerouslySetInnerHTML"?PC(s,u):f==="children"?cf(s,u):Rb(s,f,u,d)}switch(l){case"input":Dx(s,i);break;case"textarea":EC(s,i);break;case"select":var p=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var m=i.value;m!=null?au(s,!!i.multiple,m,!1):p!==!!i.multiple&&(i.defaultValue!=null?au(s,!!i.multiple,i.defaultValue,!0):au(s,!!i.multiple,i.multiple?[]:"",!1))}s[xf]=i}catch(b){Qn(e,e.return,b)}}break;case 6:if(Ai(t,e),io(e),r&4){if(e.stateNode===null)throw Error(je(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(b){Qn(e,e.return,b)}}break;case 3:if(Ai(t,e),io(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{pf(t.containerInfo)}catch(b){Qn(e,e.return,b)}break;case 4:Ai(t,e),io(e);break;case 13:Ai(t,e),io(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(fv=sr())),r&4&&Hk(e);break;case 22:if(f=n!==null&&n.memoizedState!==null,e.mode&1?(Yr=(d=Yr)||f,Ai(t,e),Yr=d):Ai(t,e),io(e),r&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!f&&e.mode&1)for(He=e,f=e.child;f!==null;){for(u=He=f;He!==null;){switch(p=He,m=p.child,p.tag){case 0:case 11:case 14:case 15:Yd(4,p,p.return);break;case 1:Zc(p,p.return);var g=p.stateNode;if(typeof g.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(b){Qn(r,n,b)}}break;case 5:Zc(p,p.return);break;case 22:if(p.memoizedState!==null){Vk(u);continue}}m!==null?(m.return=p,He=m):Vk(u)}f=f.sibling}e:for(f=null,u=e;;){if(u.tag===5){if(f===null){f=u;try{s=u.stateNode,d?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=u.stateNode,c=u.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=AC("display",a))}catch(b){Qn(e,e.return,b)}}}else if(u.tag===6){if(f===null)try{u.stateNode.nodeValue=d?"":u.memoizedProps}catch(b){Qn(e,e.return,b)}}else if((u.tag!==22&&u.tag!==23||u.memoizedState===null||u===e)&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===e)break e;for(;u.sibling===null;){if(u.return===null||u.return===e)break e;f===u&&(f=null),u=u.return}f===u&&(f=null),u.sibling.return=u.return,u=u.sibling}}break;case 19:Ai(t,e),io(e),r&4&&Hk(e);break;case 21:break;default:Ai(t,e),io(e)}}function io(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(n_(n)){var r=n;break e}n=n.return}throw Error(je(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(cf(s,""),r.flags&=-33);var i=Bk(e);ww(e,i,s);break;case 3:case 4:var a=r.stateNode.containerInfo,l=Bk(e);xw(e,l,a);break;default:throw Error(je(161))}}catch(c){Qn(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function AO(e,t,n){He=e,i_(e)}function i_(e,t,n){for(var r=(e.mode&1)!==0;He!==null;){var s=He,i=s.child;if(s.tag===22&&r){var a=s.memoizedState!==null||Qp;if(!a){var l=s.alternate,c=l!==null&&l.memoizedState!==null||Yr;l=Qp;var d=Yr;if(Qp=a,(Yr=c)&&!d)for(He=s;He!==null;)a=He,c=a.child,a.tag===22&&a.memoizedState!==null?Uk(s):c!==null?(c.return=a,He=c):Uk(s);for(;i!==null;)He=i,i_(i),i=i.sibling;He=s,Qp=l,Yr=d}Wk(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,He=i):Wk(e)}}function Wk(e){for(;He!==null;){var t=He;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Yr||yg(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Yr)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:Ri(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Ek(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}Ek(t,a,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var d=t.alternate;if(d!==null){var f=d.memoizedState;if(f!==null){var u=f.dehydrated;u!==null&&pf(u)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(je(163))}Yr||t.flags&512&&yw(t)}catch(p){Qn(t,t.return,p)}}if(t===e){He=null;break}if(n=t.sibling,n!==null){n.return=t.return,He=n;break}He=t.return}}function Vk(e){for(;He!==null;){var t=He;if(t===e){He=null;break}var n=t.sibling;if(n!==null){n.return=t.return,He=n;break}He=t.return}}function Uk(e){for(;He!==null;){var t=He;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{yg(4,t)}catch(c){Qn(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){Qn(t,s,c)}}var i=t.return;try{yw(t)}catch(c){Qn(t,i,c)}break;case 5:var a=t.return;try{yw(t)}catch(c){Qn(t,a,c)}}}catch(c){Qn(t,t.return,c)}if(t===e){He=null;break}var l=t.sibling;if(l!==null){l.return=t.return,He=l;break}He=t.return}}var IO=Math.ceil,xm=oa.ReactCurrentDispatcher,uv=oa.ReactCurrentOwner,di=oa.ReactCurrentBatchConfig,Kt=0,Ir=null,fr=null,$r=0,Ms=0,eu=dl(0),br=0,Nf=null,sc=0,xg=0,dv=0,Gd=null,ms=null,fv=0,ju=1/0,Wo=null,wm=!1,bw=null,Ga=null,Zp=!1,Ba=null,bm=0,Xd=0,vw=null,Dh=-1,Fh=0;function os(){return Kt&6?sr():Dh!==-1?Dh:Dh=sr()}function Xa(e){return e.mode&1?Kt&2&&$r!==0?$r&-$r:hO.transition!==null?(Fh===0&&(Fh=WC()),Fh):(e=ln,e!==0||(e=window.event,e=e===void 0?16:XC(e.type)),e):1}function Hi(e,t,n,r){if(50<Xd)throw Xd=0,vw=null,Error(je(185));Yf(e,n,r),(!(Kt&2)||e!==Ir)&&(e===Ir&&(!(Kt&2)&&(xg|=n),br===4&&Da(e,$r)),Ss(e,r),n===1&&Kt===0&&!(t.mode&1)&&(ju=sr()+500,hg&&fl()))}function Ss(e,t){var n=e.callbackNode;hL(e,t);var r=rm(e,e===Ir?$r:0);if(r===0)n!==null&&ek(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&ek(n),t===1)e.tag===0?pO(Kk.bind(null,e)):mE(Kk.bind(null,e)),cO(function(){!(Kt&6)&&fl()}),n=null;else{switch(VC(r)){case 1:n=Db;break;case 4:n=BC;break;case 16:n=nm;break;case 536870912:n=HC;break;default:n=nm}n=p_(n,o_.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function o_(e,t){if(Dh=-1,Fh=0,Kt&6)throw Error(je(327));var n=e.callbackNode;if(fu()&&e.callbackNode!==n)return null;var r=rm(e,e===Ir?$r:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=vm(e,r);else{t=r;var s=Kt;Kt|=2;var i=l_();(Ir!==e||$r!==t)&&(Wo=null,ju=sr()+500,Yl(e,t));do try{LO();break}catch(l){a_(e,l)}while(!0);Jb(),xm.current=i,Kt=s,fr!==null?t=0:(Ir=null,$r=0,t=br)}if(t!==0){if(t===2&&(s=Yx(e),s!==0&&(r=s,t=kw(e,s))),t===1)throw n=Nf,Yl(e,0),Da(e,r),Ss(e,sr()),n;if(t===6)Da(e,r);else{if(s=e.current.alternate,!(r&30)&&!TO(s)&&(t=vm(e,r),t===2&&(i=Yx(e),i!==0&&(r=i,t=kw(e,i))),t===1))throw n=Nf,Yl(e,0),Da(e,r),Ss(e,sr()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(je(345));case 2:zl(e,ms,Wo);break;case 3:if(Da(e,r),(r&130023424)===r&&(t=fv+500-sr(),10<t)){if(rm(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){os(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=nw(zl.bind(null,e,ms,Wo),t);break}zl(e,ms,Wo);break;case 4:if(Da(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var a=31-Bi(r);i=1<<a,a=t[a],a>s&&(s=a),r&=~i}if(r=s,r=sr()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*IO(r/1960))-r,10<r){e.timeoutHandle=nw(zl.bind(null,e,ms,Wo),r);break}zl(e,ms,Wo);break;case 5:zl(e,ms,Wo);break;default:throw Error(je(329))}}}return Ss(e,sr()),e.callbackNode===n?o_.bind(null,e):null}function kw(e,t){var n=Gd;return e.current.memoizedState.isDehydrated&&(Yl(e,t).flags|=256),e=vm(e,t),e!==2&&(t=ms,ms=n,t!==null&&Sw(t)),e}function Sw(e){ms===null?ms=e:ms.push.apply(ms,e)}function TO(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(!Wi(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 Da(e,t){for(t&=~dv,t&=~xg,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Bi(t),r=1<<n;e[n]=-1,t&=~r}}function Kk(e){if(Kt&6)throw Error(je(327));fu();var t=rm(e,0);if(!(t&1))return Ss(e,sr()),null;var n=vm(e,t);if(e.tag!==0&&n===2){var r=Yx(e);r!==0&&(t=r,n=kw(e,r))}if(n===1)throw n=Nf,Yl(e,0),Da(e,t),Ss(e,sr()),n;if(n===6)throw Error(je(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,zl(e,ms,Wo),Ss(e,sr()),null}function pv(e,t){var n=Kt;Kt|=1;try{return e(t)}finally{Kt=n,Kt===0&&(ju=sr()+500,hg&&fl())}}function ic(e){Ba!==null&&Ba.tag===0&&!(Kt&6)&&fu();var t=Kt;Kt|=1;var n=di.transition,r=ln;try{if(di.transition=null,ln=1,e)return e()}finally{ln=r,di.transition=n,Kt=t,!(Kt&6)&&fl()}}function hv(){Ms=eu.current,An(eu)}function Yl(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,lO(n)),fr!==null)for(n=fr.return;n!==null;){var r=n;switch(Yb(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&lm();break;case 3:Su(),An(vs),An(Xr),rv();break;case 5:nv(r);break;case 4:Su();break;case 13:An(Un);break;case 19:An(Un);break;case 10:Qb(r.type._context);break;case 22:case 23:hv()}n=n.return}if(Ir=e,fr=e=Ja(e.current,null),$r=Ms=t,br=0,Nf=null,dv=xg=sc=0,ms=Gd=null,Ul!==null){for(t=0;t<Ul.length;t++)if(n=Ul[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}Ul=null}return e}function a_(e,t){do{var n=fr;try{if(Jb(),Oh.current=ym,gm){for(var r=Kn.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}gm=!1}if(rc=0,Pr=xr=Kn=null,qd=!1,vf=0,uv.current=null,n===null||n.return===null){br=1,Nf=t,fr=null;break}e:{var i=e,a=n.return,l=n,c=t;if(t=$r,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,f=l,u=f.tag;if(!(f.mode&1)&&(u===0||u===11||u===15)){var p=f.alternate;p?(f.updateQueue=p.updateQueue,f.memoizedState=p.memoizedState,f.lanes=p.lanes):(f.updateQueue=null,f.memoizedState=null)}var m=Rk(a);if(m!==null){m.flags&=-257,Lk(m,a,l,i,t),m.mode&1&&Tk(i,d,t),t=m,c=d;var g=t.updateQueue;if(g===null){var b=new Set;b.add(c),t.updateQueue=b}else g.add(c);break e}else{if(!(t&1)){Tk(i,d,t),mv();break e}c=Error(je(426))}}else if(Fn&&l.mode&1){var v=Rk(a);if(v!==null){!(v.flags&65536)&&(v.flags|=256),Lk(v,a,l,i,t),Gb(Nu(c,l));break e}}i=c=Nu(c,l),br!==4&&(br=2),Gd===null?Gd=[i]:Gd.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var y=VE(i,c,t);Ck(i,y);break e;case 1:l=c;var k=i.type,w=i.stateNode;if(!(i.flags&128)&&(typeof k.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Ga===null||!Ga.has(w)))){i.flags|=65536,t&=-t,i.lanes|=t;var j=UE(i,l,t);Ck(i,j);break e}}i=i.return}while(i!==null)}u_(n)}catch(A){t=A,fr===n&&n!==null&&(fr=n=n.return);continue}break}while(!0)}function l_(){var e=xm.current;return xm.current=ym,e===null?ym:e}function mv(){(br===0||br===3||br===2)&&(br=4),Ir===null||!(sc&268435455)&&!(xg&268435455)||Da(Ir,$r)}function vm(e,t){var n=Kt;Kt|=2;var r=l_();(Ir!==e||$r!==t)&&(Wo=null,Yl(e,t));do try{RO();break}catch(s){a_(e,s)}while(!0);if(Jb(),Kt=n,xm.current=r,fr!==null)throw Error(je(261));return Ir=null,$r=0,br}function RO(){for(;fr!==null;)c_(fr)}function LO(){for(;fr!==null&&!iL();)c_(fr)}function c_(e){var t=f_(e.alternate,e,Ms);e.memoizedProps=e.pendingProps,t===null?u_(e):fr=t,uv.current=null}function u_(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=EO(n,t),n!==null){n.flags&=32767,fr=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{br=6,fr=null;return}}else if(n=CO(n,t,Ms),n!==null){fr=n;return}if(t=t.sibling,t!==null){fr=t;return}fr=t=e}while(t!==null);br===0&&(br=5)}function zl(e,t,n){var r=ln,s=di.transition;try{di.transition=null,ln=1,OO(e,t,n,r)}finally{di.transition=s,ln=r}return null}function OO(e,t,n,r){do fu();while(Ba!==null);if(Kt&6)throw Error(je(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(je(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(mL(e,i),e===Ir&&(fr=Ir=null,$r=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Zp||(Zp=!0,p_(nm,function(){return fu(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=di.transition,di.transition=null;var a=ln;ln=1;var l=Kt;Kt|=4,uv.current=null,PO(e,n),s_(n,e),tO(ew),sm=!!Zx,ew=Zx=null,e.current=n,AO(n),oL(),Kt=l,ln=a,di.transition=i}else e.current=n;if(Zp&&(Zp=!1,Ba=e,bm=s),i=e.pendingLanes,i===0&&(Ga=null),cL(n.stateNode),Ss(e,sr()),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(wm)throw wm=!1,e=bw,bw=null,e;return bm&1&&e.tag!==0&&fu(),i=e.pendingLanes,i&1?e===vw?Xd++:(Xd=0,vw=e):Xd=0,fl(),null}function fu(){if(Ba!==null){var e=VC(bm),t=di.transition,n=ln;try{if(di.transition=null,ln=16>e?16:e,Ba===null)var r=!1;else{if(e=Ba,Ba=null,bm=0,Kt&6)throw Error(je(331));var s=Kt;for(Kt|=4,He=e.current;He!==null;){var i=He,a=i.child;if(He.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var d=l[c];for(He=d;He!==null;){var f=He;switch(f.tag){case 0:case 11:case 15:Yd(8,f,i)}var u=f.child;if(u!==null)u.return=f,He=u;else for(;He!==null;){f=He;var p=f.sibling,m=f.return;if(t_(f),f===d){He=null;break}if(p!==null){p.return=m,He=p;break}He=m}}}var g=i.alternate;if(g!==null){var b=g.child;if(b!==null){g.child=null;do{var v=b.sibling;b.sibling=null,b=v}while(b!==null)}}He=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,He=a;else e:for(;He!==null;){if(i=He,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Yd(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,He=y;break e}He=i.return}}var k=e.current;for(He=k;He!==null;){a=He;var w=a.child;if(a.subtreeFlags&2064&&w!==null)w.return=a,He=w;else e:for(a=k;He!==null;){if(l=He,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:yg(9,l)}}catch(A){Qn(l,l.return,A)}if(l===a){He=null;break e}var j=l.sibling;if(j!==null){j.return=l.return,He=j;break e}He=l.return}}if(Kt=s,fl(),go&&typeof go.onPostCommitFiberRoot=="function")try{go.onPostCommitFiberRoot(cg,e)}catch{}r=!0}return r}finally{ln=n,di.transition=t}}return!1}function qk(e,t,n){t=Nu(n,t),t=VE(e,t,1),e=Ya(e,t,1),t=os(),e!==null&&(Yf(e,1,t),Ss(e,t))}function Qn(e,t,n){if(e.tag===3)qk(e,e,n);else for(;t!==null;){if(t.tag===3){qk(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ga===null||!Ga.has(r))){e=Nu(n,e),e=UE(t,e,1),t=Ya(t,e,1),e=os(),t!==null&&(Yf(t,1,e),Ss(t,e));break}}t=t.return}}function MO(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=os(),e.pingedLanes|=e.suspendedLanes&n,Ir===e&&($r&n)===n&&(br===4||br===3&&($r&130023424)===$r&&500>sr()-fv?Yl(e,0):dv|=n),Ss(e,t)}function d_(e,t){t===0&&(e.mode&1?(t=Wp,Wp<<=1,!(Wp&130023424)&&(Wp=4194304)):t=1);var n=os();e=ta(e,t),e!==null&&(Yf(e,t,n),Ss(e,n))}function $O(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),d_(e,n)}function DO(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(je(314))}r!==null&&r.delete(t),d_(e,n)}var f_;f_=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||vs.current)gs=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return gs=!1,jO(e,t,n);gs=!!(e.flags&131072)}else gs=!1,Fn&&t.flags&1048576&&gE(t,dm,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;$h(e,t),e=t.pendingProps;var s=bu(t,Xr.current);du(t,n),s=iv(null,t,r,e,s,n);var i=ov();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,ks(r)?(i=!0,cm(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,ev(t),s.updater=gg,t.stateNode=s,s._reactInternals=t,cw(t,r,e,n),t=fw(null,t,r,!0,i,n)):(t.tag=0,Fn&&i&&qb(t),ss(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch($h(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=zO(r),e=Ri(r,e),s){case 0:t=dw(null,t,r,e,n);break e;case 1:t=$k(null,t,r,e,n);break e;case 11:t=Ok(null,t,r,e,n);break e;case 14:t=Mk(null,t,r,Ri(r.type,e),n);break e}throw Error(je(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ri(r,s),dw(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ri(r,s),$k(e,t,r,s,n);case 3:e:{if(GE(t),e===null)throw Error(je(387));r=t.pendingProps,i=t.memoizedState,s=i.element,kE(e,t),hm(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=Nu(Error(je(423)),t),t=Dk(e,t,r,n,s);break e}else if(r!==s){s=Nu(Error(je(424)),t),t=Dk(e,t,r,n,s);break e}else for(Fs=qa(t.stateNode.containerInfo.firstChild),Bs=t,Fn=!0,Mi=null,n=bE(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(vu(),r===s){t=na(e,t,n);break e}ss(e,t,r,n)}t=t.child}return t;case 5:return SE(t),e===null&&ow(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,tw(r,s)?a=null:i!==null&&tw(r,i)&&(t.flags|=32),YE(e,t),ss(e,t,a,n),t.child;case 6:return e===null&&ow(t),null;case 13:return XE(e,t,n);case 4:return tv(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ku(t,null,r,n):ss(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ri(r,s),Ok(e,t,r,s,n);case 7:return ss(e,t,t.pendingProps,n),t.child;case 8:return ss(e,t,t.pendingProps.children,n),t.child;case 12:return ss(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,bn(fm,r._currentValue),r._currentValue=a,i!==null)if(Wi(i.value,a)){if(i.children===s.children&&!vs.current){t=na(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){a=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=Qo(-1,n&-n),c.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var f=d.pending;f===null?c.next=c:(c.next=f.next,f.next=c),d.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),aw(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(je(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),aw(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}ss(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,du(t,n),s=fi(s),r=r(s),t.flags|=1,ss(e,t,r,n),t.child;case 14:return r=t.type,s=Ri(r,t.pendingProps),s=Ri(r.type,s),Mk(e,t,r,s,n);case 15:return KE(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Ri(r,s),$h(e,t),t.tag=1,ks(r)?(e=!0,cm(t)):e=!1,du(t,n),WE(t,r,s),cw(t,r,s,n),fw(null,t,r,!0,e,n);case 19:return JE(e,t,n);case 22:return qE(e,t,n)}throw Error(je(156,t.tag))};function p_(e,t){return zC(e,t)}function FO(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 ui(e,t,n,r){return new FO(e,t,n,r)}function gv(e){return e=e.prototype,!(!e||!e.isReactComponent)}function zO(e){if(typeof e=="function")return gv(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Ob)return 11;if(e===Mb)return 14}return 2}function Ja(e,t){var n=e.alternate;return n===null?(n=ui(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 zh(e,t,n,r,s,i){var a=2;if(r=e,typeof e=="function")gv(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Vc:return Gl(n.children,s,i,t);case Lb:a=8,s|=8;break;case Rx:return e=ui(12,n,t,s|2),e.elementType=Rx,e.lanes=i,e;case Lx:return e=ui(13,n,t,s),e.elementType=Lx,e.lanes=i,e;case Ox:return e=ui(19,n,t,s),e.elementType=Ox,e.lanes=i,e;case SC:return wg(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case vC:a=10;break e;case kC:a=9;break e;case Ob:a=11;break e;case Mb:a=14;break e;case Ra:a=16,r=null;break e}throw Error(je(130,e==null?e:typeof e,""))}return t=ui(a,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function Gl(e,t,n,r){return e=ui(7,e,r,t),e.lanes=n,e}function wg(e,t,n,r){return e=ui(22,e,r,t),e.elementType=SC,e.lanes=n,e.stateNode={isHidden:!1},e}function Ly(e,t,n){return e=ui(6,e,null,t),e.lanes=n,e}function Oy(e,t,n){return t=ui(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function BO(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=my(0),this.expirationTimes=my(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=my(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function yv(e,t,n,r,s,i,a,l,c){return e=new BO(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=ui(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ev(i),e}function HO(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Wc,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function h_(e){if(!e)return rl;e=e._reactInternals;e:{if(pc(e)!==e||e.tag!==1)throw Error(je(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(ks(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(je(171))}if(e.tag===1){var n=e.type;if(ks(n))return hE(e,n,t)}return t}function m_(e,t,n,r,s,i,a,l,c){return e=yv(n,r,!0,e,s,i,a,l,c),e.context=h_(null),n=e.current,r=os(),s=Xa(n),i=Qo(r,s),i.callback=t??null,Ya(n,i,s),e.current.lanes=s,Yf(e,s,r),Ss(e,r),e}function bg(e,t,n,r){var s=t.current,i=os(),a=Xa(s);return n=h_(n),t.context===null?t.context=n:t.pendingContext=n,t=Qo(i,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Ya(s,t,a),e!==null&&(Hi(e,s,a,i),Lh(e,s,a)),a}function km(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 Yk(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function xv(e,t){Yk(e,t),(e=e.alternate)&&Yk(e,t)}function WO(){return null}var g_=typeof reportError=="function"?reportError:function(e){console.error(e)};function wv(e){this._internalRoot=e}vg.prototype.render=wv.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(je(409));bg(e,t,null,null)};vg.prototype.unmount=wv.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ic(function(){bg(null,e,null,null)}),t[ea]=null}};function vg(e){this._internalRoot=e}vg.prototype.unstable_scheduleHydration=function(e){if(e){var t=qC();e={blockedOn:null,target:e,priority:t};for(var n=0;n<$a.length&&t!==0&&t<$a[n].priority;n++);$a.splice(n,0,e),n===0&&GC(e)}};function bv(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function kg(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Gk(){}function VO(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var d=km(a);i.call(d)}}var a=m_(t,r,e,0,null,!1,!1,"",Gk);return e._reactRootContainer=a,e[ea]=a.current,gf(e.nodeType===8?e.parentNode:e),ic(),a}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var d=km(c);l.call(d)}}var c=yv(e,0,!1,null,null,!1,!1,"",Gk);return e._reactRootContainer=c,e[ea]=c.current,gf(e.nodeType===8?e.parentNode:e),ic(function(){bg(t,c,n,r)}),c}function Sg(e,t,n,r,s){var i=n._reactRootContainer;if(i){var a=i;if(typeof s=="function"){var l=s;s=function(){var c=km(a);l.call(c)}}bg(t,a,e,s)}else a=VO(n,t,e,s,r);return km(a)}UC=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Rd(t.pendingLanes);n!==0&&(Fb(t,n|1),Ss(t,sr()),!(Kt&6)&&(ju=sr()+500,fl()))}break;case 13:ic(function(){var r=ta(e,1);if(r!==null){var s=os();Hi(r,e,1,s)}}),xv(e,1)}};zb=function(e){if(e.tag===13){var t=ta(e,134217728);if(t!==null){var n=os();Hi(t,e,134217728,n)}xv(e,134217728)}};KC=function(e){if(e.tag===13){var t=Xa(e),n=ta(e,t);if(n!==null){var r=os();Hi(n,e,t,r)}xv(e,t)}};qC=function(){return ln};YC=function(e,t){var n=ln;try{return ln=e,t()}finally{ln=n}};Ux=function(e,t,n){switch(t){case"input":if(Dx(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=pg(r);if(!s)throw Error(je(90));jC(r),Dx(r,s)}}}break;case"textarea":EC(e,n);break;case"select":t=n.value,t!=null&&au(e,!!n.multiple,t,!1)}};LC=pv;OC=ic;var UO={usingClientEntryPoint:!1,Events:[Xf,Yc,pg,TC,RC,pv]},bd={findFiberByHostInstance:Vl,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},KO={bundleType:bd.bundleType,version:bd.version,rendererPackageName:bd.rendererPackageName,rendererConfig:bd.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:oa.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=DC(e),e===null?null:e.stateNode},findFiberByHostInstance:bd.findFiberByHostInstance||WO,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 eh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!eh.isDisabled&&eh.supportsFiber)try{cg=eh.inject(KO),go=eh}catch{}}Us.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=UO;Us.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!bv(t))throw Error(je(200));return HO(e,t,null,n)};Us.createRoot=function(e,t){if(!bv(e))throw Error(je(299));var n=!1,r="",s=g_;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=yv(e,1,!1,null,null,n,!1,r,s),e[ea]=t.current,gf(e.nodeType===8?e.parentNode:e),new wv(t)};Us.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(je(188)):(e=Object.keys(e).join(","),Error(je(268,e)));return e=DC(t),e=e===null?null:e.stateNode,e};Us.flushSync=function(e){return ic(e)};Us.hydrate=function(e,t,n){if(!kg(t))throw Error(je(200));return Sg(null,e,t,!0,n)};Us.hydrateRoot=function(e,t,n){if(!bv(e))throw Error(je(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",a=g_;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=m_(t,null,e,1,n??null,s,!1,i,a),e[ea]=t.current,gf(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 vg(t)};Us.render=function(e,t,n){if(!kg(t))throw Error(je(200));return Sg(null,e,t,!1,n)};Us.unmountComponentAtNode=function(e){if(!kg(e))throw Error(je(40));return e._reactRootContainer?(ic(function(){Sg(null,null,e,!1,function(){e._reactRootContainer=null,e[ea]=null})}),!0):!1};Us.unstable_batchedUpdates=pv;Us.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!kg(n))throw Error(je(200));if(e==null||e._reactInternals===void 0)throw Error(je(38));return Sg(e,t,n,!1,r)};Us.version="18.3.1-next-f1338f8080-20240426";function y_(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(y_)}catch(e){console.error(e)}}y_(),yC.exports=Us;var Mr=yC.exports,Xk=Mr;Ix.createRoot=Xk.createRoot,Ix.hydrateRoot=Xk.hydrateRoot;const x_=h.createContext(null);function Nw(e){let t=e||"/";return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t||"/"}function qO(){const e=Nw(window.location.pathname);return e==="/"?(window.history.replaceState({},"","/projects"),"/projects"):e}function YO({children:e}){const[t,n]=h.useState(qO);h.useEffect(()=>{const i=()=>n(Nw(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 c=Nw(l.pathname),d=l.search||"";window.history.pushState({},"",c+d),n(c)},[]),s=h.useMemo(()=>({path:t,navigate:r}),[t,r]);return o.jsx(x_.Provider,{value:s,children:e})}function No(){const e=h.useContext(x_);if(!e)throw new Error("useRoute must be used within RouteProvider");return e}function GO(){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 Jk={};function jw(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&Jk[t[0]]||(typeof t[0]=="string"&&(Jk[t[0]]=new Date),GO(...t))}const w_=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function Qk(e,t,n){e.loadNamespaces(t,w_(e,n))}function Zk(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,w_(e,r))}function XO(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],s=t.options?t.options.fallbackLng:!1,i=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(l,c)=>{const d=t.services.backendConnector.state[`${l}|${c}`];return d===-1||d===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!a(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||a(r,e)&&(!s||a(i,e)))}function JO(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(jw("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}}):XO(e,t,n)}const QO=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,ZO={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},eM=e=>ZO[e],tM=e=>e.replace(QO,eM);let Cw={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:tM};function nM(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Cw={...Cw,...e}}function rM(){return Cw}let b_;function sM(e){b_=e}function iM(){return b_}const oM={type:"3rdParty",init(e){nM(e.options.react),sM(e)}},aM=h.createContext();class lM{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const cM=(e,t)=>{const n=h.useRef();return h.useEffect(()=>{n.current=e},[e,t]),n.current};function kn(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:s}=h.useContext(aM)||{},i=n||r||iM();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new lM),!i){jw("You will need to pass in an i18next instance by using initReactI18next");const w=(A,C)=>typeof C=="string"?C:C&&typeof C=="object"&&typeof C.defaultValue=="string"?C.defaultValue:Array.isArray(A)?A[A.length-1]:A,j=[w,{},!1];return j.t=w,j.i18n={},j.ready=!1,j}i.options.react&&i.options.react.wait!==void 0&&jw("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...rM(),...i.options.react,...t},{useSuspense:l,keyPrefix:c}=a;let d=e||s||i.options&&i.options.defaultNS;d=typeof d=="string"?[d]:d||["translation"],i.reportNamespaces.addUsedNamespaces&&i.reportNamespaces.addUsedNamespaces(d);const f=(i.isInitialized||i.initializedStoreOnce)&&d.every(w=>JO(w,i,a));function u(){return i.getFixedT(t.lng||null,a.nsMode==="fallback"?d:d[0],c)}const[p,m]=h.useState(u);let g=d.join();t.lng&&(g=`${t.lng}${g}`);const b=cM(g),v=h.useRef(!0);h.useEffect(()=>{const{bindI18n:w,bindI18nStore:j}=a;v.current=!0,!f&&!l&&(t.lng?Zk(i,t.lng,d,()=>{v.current&&m(u)}):Qk(i,d,()=>{v.current&&m(u)})),f&&b&&b!==g&&v.current&&m(u);function A(){v.current&&m(u)}return w&&i&&i.on(w,A),j&&i&&i.store.on(j,A),()=>{v.current=!1,w&&i&&w.split(" ").forEach(C=>i.off(C,A)),j&&i&&j.split(" ").forEach(C=>i.store.off(C,A))}},[i,g]);const y=h.useRef(!0);h.useEffect(()=>{v.current&&!y.current&&m(u),y.current=!1},[i,c]);const k=[p,i,f];if(k.t=p,k.i18n=i,k.ready=f,f||!f&&!l)return k;throw new Promise(w=>{t.lng?Zk(i,t.lng,d,()=>w()):Qk(i,d,()=>w())})}const v_="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",uM=[{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"}],dM=[{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 fM(e,t){return t==="/projects"?e==="/projects"||e==="/":e===t||e.startsWith(t+"/")}function pM({authUser:e,onLogout:t}){const{path:n,navigate:r}=No(),{t:s}=kn(),[i,a]=h.useState(!1);return h.useEffect(()=>{let l=!1;return fetch("/api/ui-context").then(c=>c.json()).then(c=>{l||a(!!c.hideCommunityLinks)}).catch(()=>{}),()=>{l=!0}},[]),o.jsxs("aside",{className:"af-sidebar","aria-label":s("flow:sidebar.mainNav"),children:[o.jsxs("div",{className:"af-brand",children:[o.jsx("div",{className:"af-brand-mark","aria-hidden":!0,children:o.jsx("img",{src:v_,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:uM.map(l=>o.jsxs("button",{type:"button",className:"af-nav-link"+(fM(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&&dM.map(l=>{const c=s(l.labelKey);return o.jsx("a",{className:"af-sidebar-ext",href:l.href,target:"_blank",rel:"noopener noreferrer","aria-label":c,title:c,children:o.jsx("span",{className:"material-symbols-outlined",children:l.icon})},l.href)})]})]})}const k_="agentflow.pipelineRecent",hM=50,mM=15;function gM(e){try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function S_(){if(typeof localStorage>"u")return[];const e=localStorage.getItem(k_);return e?gM(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 th(e,t){if(typeof localStorage>"u")return;const n=Date.now(),r=S_(),i=[{flowId:e,flowSource:t,kind:"opened",at:n},...r.filter(a=>!(a.flowId===e&&a.flowSource===t))].slice(0,hM);try{localStorage.setItem(k_,JSON.stringify(i))}catch{}}function yM(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 Ew(e,t){const n=Date.now(),r=Math.max(0,n-e),s=Math.floor(r/1e3);if(s<60)return t("flow:time.justNow");const i=Math.floor(s/60);if(i<60)return t("flow:time.minutesAgo",{n:i});const a=Math.floor(i/60);if(a<24)return t("flow:time.hoursAgo",{n:a});const l=new Date(e),c=new Date,d=new Date(c);if(d.setDate(d.getDate()-1),l.toDateString()===d.toDateString())return t("flow:time.yesterday");const f=Math.floor(a/24);return f<7?t("flow:time.daysAgo",{n:f}):`${l.getMonth()+1}/${l.getDate()}`}function xM(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 wM(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:yM(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,mM)}var $s=Uint8Array,tu=Uint16Array,bM=Int32Array,N_=new $s([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]),j_=new $s([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]),vM=new $s([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),C_=function(e,t){for(var n=new tu(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var s=new bM(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}},E_=C_(N_,2),__=E_.b,kM=E_.r;__[28]=258,kM[258]=28;var SM=C_(j_,0),NM=SM.b,_w=new tu(32768);for(var Pn=0;Pn<32768;++Pn){var Ea=(Pn&43690)>>1|(Pn&21845)<<1;Ea=(Ea&52428)>>2|(Ea&13107)<<2,Ea=(Ea&61680)>>4|(Ea&3855)<<4,_w[Pn]=((Ea&65280)>>8|(Ea&255)<<8)>>1}var Jd=function(e,t,n){for(var r=e.length,s=0,i=new tu(t);s<r;++s)e[s]&&++i[e[s]-1];var a=new tu(t);for(s=1;s<t;++s)a[s]=a[s-1]+i[s-1]<<1;var l;if(n){l=new tu(1<<t);var c=15-t;for(s=0;s<r;++s)if(e[s])for(var d=s<<4|e[s],f=t-e[s],u=a[e[s]-1]++<<f,p=u|(1<<f)-1;u<=p;++u)l[_w[u]>>c]=d}else for(l=new tu(r),s=0;s<r;++s)e[s]&&(l[s]=_w[a[e[s]-1]++]>>15-e[s]);return l},Qf=new $s(288);for(var Pn=0;Pn<144;++Pn)Qf[Pn]=8;for(var Pn=144;Pn<256;++Pn)Qf[Pn]=9;for(var Pn=256;Pn<280;++Pn)Qf[Pn]=7;for(var Pn=280;Pn<288;++Pn)Qf[Pn]=8;var P_=new $s(32);for(var Pn=0;Pn<32;++Pn)P_[Pn]=5;var jM=Jd(Qf,9,1),CM=Jd(P_,5,1),My=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Ii=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},$y=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},EM=function(e){return(e+7)/8|0},vv=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new $s(e.subarray(t,n))},_M=["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"],ii=function(e,t,n){var r=new Error(t||_M[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,ii),!n)throw r;return r},PM=function(e,t,n,r){var s=e.length,i=r?r.length:0;if(!s||t.f&&!t.l)return n||new $s(0);var a=!n,l=a||t.i!=2,c=t.i;a&&(n=new $s(s*3));var d=function(we){var _e=n.length;if(we>_e){var Ie=new $s(Math.max(_e*2,we));Ie.set(n),n=Ie}},f=t.f||0,u=t.p||0,p=t.b||0,m=t.l,g=t.d,b=t.m,v=t.n,y=s*8;do{if(!m){f=Ii(e,u,1);var k=Ii(e,u+1,3);if(u+=3,k)if(k==1)m=jM,g=CM,b=9,v=5;else if(k==2){var C=Ii(e,u,31)+257,$=Ii(e,u+10,15)+4,B=C+Ii(e,u+5,31)+1;u+=14;for(var F=new $s(B),z=new $s(19),L=0;L<$;++L)z[vM[L]]=Ii(e,u+L*3,7);u+=$*3;for(var O=My(z),W=(1<<O)-1,M=Jd(z,O,1),L=0;L<B;){var T=M[Ii(e,u,W)];u+=T&15;var w=T>>4;if(w<16)F[L++]=w;else{var E=0,D=0;for(w==16?(D=3+Ii(e,u,3),u+=2,E=F[L-1]):w==17?(D=3+Ii(e,u,7),u+=3):w==18&&(D=11+Ii(e,u,127),u+=7);D--;)F[L++]=E}}var _=F.subarray(0,C),R=F.subarray(C);b=My(_),v=My(R),m=Jd(_,b,1),g=Jd(R,v,1)}else ii(1);else{var w=EM(u)+4,j=e[w-4]|e[w-3]<<8,A=w+j;if(A>s){c&&ii(0);break}l&&d(p+j),n.set(e.subarray(w,A),p),t.b=p+=j,t.p=u=A*8,t.f=f;continue}if(u>y){c&&ii(0);break}}l&&d(p+131072);for(var P=(1<<b)-1,G=(1<<v)-1,Z=u;;Z=u){var E=m[$y(e,u)&P],V=E>>4;if(u+=E&15,u>y){c&&ii(0);break}if(E||ii(2),V<256)n[p++]=V;else if(V==256){Z=u,m=null;break}else{var se=V-254;if(V>264){var L=V-257,ue=N_[L];se=Ii(e,u,(1<<ue)-1)+__[L],u+=ue}var pe=g[$y(e,u)&G],ge=pe>>4;pe||ii(3),u+=pe&15;var R=NM[ge];if(ge>3){var ue=j_[ge];R+=$y(e,u)&(1<<ue)-1,u+=ue}if(u>y){c&&ii(0);break}l&&d(p+131072);var ae=p+se;if(p<R){var be=i-R,Pe=Math.min(R,ae);for(be+p<0&&ii(3);p<Pe;++p)n[p]=r[be+p]}for(;p<ae;++p)n[p]=n[p-R]}}t.l=m,t.p=Z,t.b=p,t.f=f,m&&(f=1,t.m=b,t.d=g,t.n=v)}while(!f);return p!=n.length&&a?vv(n,0,p):n.subarray(0,p)},AM=new $s(0),po=function(e,t){return e[t]|e[t+1]<<8},$i=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Dy=function(e,t){return $i(e,t)+$i(e,t+4)*4294967296};function IM(e,t){return PM(e,{i:2},t&&t.out,t&&t.dictionary)}var Pw=typeof TextDecoder<"u"&&new TextDecoder,TM=0;try{Pw.decode(AM,{stream:!0}),TM=1}catch{}var RM=function(e){for(var t="",n=0;;){var r=e[n++],s=(r>127)+(r>223)+(r>239);if(n+s>e.length)return{s:t,r:vv(e,n-1)};s?s==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):s&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function LM(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(Pw)return Pw.decode(e);var s=RM(e),i=s.s,n=s.r;return n.length&&ii(8),i}}var OM=function(e,t){return t+30+po(e,t+26)+po(e,t+28)},MM=function(e,t,n){var r=po(e,t+28),s=LM(e.subarray(t+46,t+46+r),!(po(e,t+8)&2048)),i=t+46+r,a=$i(e,t+20),l=n&&a==4294967295?$M(e,i):[a,$i(e,t+24),$i(e,t+42)],c=l[0],d=l[1],f=l[2];return[po(e,t+10),c,d,s,i+po(e,t+30)+po(e,t+32),f]},$M=function(e,t){for(;po(e,t)!=1;t+=4+po(e,t+2));return[Dy(e,t+12),Dy(e,t+4),Dy(e,t+20)]};function DM(e,t){for(var n={},r=e.length-22;$i(e,r)!=101010256;--r)(!r||e.length-r>65558)&&ii(13);var s=po(e,r+8);if(!s)return{};var i=$i(e,r+16),a=i==4294967295||s==65535;if(a){var l=$i(e,r-12);a=$i(e,l)==101075792,a&&(s=$i(e,l+32),i=$i(e,l+48))}for(var c=0;c<s;++c){var d=MM(e,i,a),f=d[0],u=d[1],p=d[2],m=d[3],g=d[4],b=d[5],v=OM(e,b);i=g,f?f==8?n[m]=IM(e.subarray(v,v+u),{out:new $s(p)}):ii(14,"unknown compression type "+f):n[m]=vv(e,v,v+u)}return n}const FM=8*1024*1024,zM=500;function BM(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 HM(e){return e?e.split("/").some(n=>n==="__MACOSX"||n.startsWith("._")):!0}function WM(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 VM=/^[a-zA-Z][a-zA-Z0-9_-]*$/;async function UM(e){try{const t=new Uint8Array(await e.arrayBuffer()),n=DM(t),r=new Map;let s=0,i=0;for(const[c,d]of Object.entries(n)){if(c.endsWith("/"))continue;const f=BM(c);if(!f||HM(f))continue;const u=(d==null?void 0:d.length)??0;if(s+=u,s>FM||(i+=1,i>zM))return null;r.set(f,u)}if(r.size===0)return null;const a=new Set;for(const c of r.keys()){const d=WM(c);d!==null&&a.add(d)}if(a.size!==1)return null;const[l]=[...a];if(l==="")return null;for(const c of r.keys())if(!(c===l||c.startsWith(`${l}/`)))return null;return VM.test(l)?l:null}catch{return null}}const Fy=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function KM({file:e,onClose:t,onImported:n}){const{t:r}=kn(),s=h.useId(),i=h.useRef(null),a=h.useRef(null),[l,c]=h.useState(""),[d,f]=h.useState("user"),[u,p]=h.useState(!1),[m,g]=h.useState(""),[b,v]=h.useState(null),y=b??e;h.useEffect(()=>{const A=requestAnimationFrame(()=>{var C;return(C=i.current)==null?void 0:C.focus()});return()=>cancelAnimationFrame(A)},[]),h.useEffect(()=>{let A=!1;return(async()=>{const C=y.name||"",$=C.toLowerCase();let B="";if($.endsWith(".zip")){if(B=await UM(y)||"",!B){const F=C.replace(/\.zip$/i,"");Fy.test(F)&&(B=F)}}else if($.endsWith(".yaml")||$.endsWith(".yml")){const F=C.replace(/\.ya?ml$/i,"");Fy.test(F)&&(B=F)}A||c(B)})(),()=>{A=!0}},[y]);const k=l.trim(),w=k.length>0&&Fy.test(k);async function j(A){if(A.preventDefault(),!(!w||u)){p(!0),g("");try{const C=new FormData;C.set("flowId",k),C.set("targetSpace",d),C.set("file",y,y.name);const $=await fetch("/api/flows/import",{method:"POST",body:C}),B=await $.json().catch(()=>({}));if(!$.ok){g(typeof B.error=="string"?B.error:r("project:importModal.importFailed"));return}n({id:B.flowId,source:B.flowSource??"user"})}catch(C){g(String((C==null?void 0:C.message)||C))}finally{p(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:A=>{A.target===A.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:A=>A.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:s,className:"af-shortcuts-panel__title",children:r("project:importModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":r("project:importModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:j,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:r("project:importModal.lead",{filename:y.name})}),o.jsx("input",{ref:a,type:"file",className:"af-import-file-input",accept:".yaml,.yml,.zip,application/zip","aria-hidden":!0,tabIndex:-1,onChange:A=>{var $;const C=($=A.target.files)==null?void 0:$[0];C&&v(C),A.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:A=>c(A.target.value),"aria-invalid":k.length>0&&!w}),o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r("project:importModal.nameHint")})]}),o.jsx("div",{className:"af-import-repick",children:o.jsx("button",{type:"button",className:"af-btn-secondary af-import-repick-btn",onClick:()=>{var A;return(A=a.current)==null?void 0:A.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:u,children:r("project:importModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!w||u,children:r(u?"project:importModal.importing":"project:importModal.importAndOpen")})]})]})]})})}const qM=/^[a-zA-Z][a-zA-Z0-9_-]*$/,eS="af:newPipelineGuide";function YM({open:e,onClose:t,onCreated:n}){const{t:r}=kn(),s=h.useId(),i=h.useRef(null),[a,l]=h.useState(""),[c,d]=h.useState(""),[f,u]=h.useState("user"),[p,m]=h.useState(!1),[g,b]=h.useState(""),[v,y]=h.useState(!1);h.useEffect(()=>{if(!e)return;l(""),d(""),u("user"),b(""),m(!1),localStorage.getItem(eS)==="true"&&y(!0);const $=requestAnimationFrame(()=>{var B;return(B=i.current)==null?void 0:B.focus()});return()=>cancelAnimationFrame($)},[e]);const k=()=>{localStorage.removeItem(eS),y(!1)};if(!e)return null;const w=a.trim(),j=w.length>0&&qM.test(w);async function A(C){if(C.preventDefault(),!(!j||p)){m(!0),b(""),k();try{const $=await fetch("/api/flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:w,description:c.trim(),targetSpace:f})}),B=await $.json().catch(()=>({}));if(!$.ok){b(typeof B.error=="string"?B.error:r("project:newPipelineModal.createFailed"));return}n({id:B.flowId,source:B.flowSource??"user"})}catch($){b(String(($==null?void 0:$.message)||$))}finally{m(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:C=>{C.target===C.currentTarget&&(k(),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:()=>{k(),t()},"aria-label":r("project:newPipelineModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),v?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:k,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})}):null,o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:A,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":w.length>0&&!j}),o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r(v?"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(v?"onboarding:newPipeline.descPlaceholderGuide":"project:newPipelineModal.descPlaceholder"),value:c,onChange:C=>d(C.target.value)}),v?o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-guide-hint",children:r("onboarding:newPipeline.descHintGuide")}):null]}),g?o.jsx("p",{className:"af-err af-new-pipeline-err",children:g}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:()=>{k(),t()},disabled:p,children:r("project:newPipelineModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!j||p,children:r(p?"project:newPipelineModal.creating":v?"onboarding:newPipeline.createGuide":"project:newPipelineModal.createAndOpen")})]})]})]})})}const A_="agentflow.pipelineViewPreference";function I_(e,t="user",n=!1){return`${String(t||"user")}:${String(e||"")}:${n?"archived":"active"}`}function T_(){if(typeof localStorage>"u")return{};try{const e=JSON.parse(localStorage.getItem(A_)||"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function GM(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(A_,JSON.stringify(e))}catch{}}function Sm(e){return e==="display"?"display":e==="pipeline"?"pipeline":"workspace"}function XM(e){return(e==null?void 0:e.hasPipeline)!==!1&&(e==null?void 0:e.hasFlow)!==!1&&(e==null?void 0:e.flowYaml)!==!1}function R_(e,t,n,r=!1){if(!e)return;const s=T_();s[I_(e,t,r)]={view:Sm(n),at:Date.now()},GM(s)}function JM(e,t="workspace"){if(!(e!=null&&e.id))return Sm(t);const r=T_()[I_(e.id,e.source??"user",!!e.archived)],s=Sm((r==null?void 0:r.view)||t);return s==="pipeline"&&!XM(e)?"workspace":s}function Nm(e,t="workspace"){const n=Sm(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 nh(e,t="workspace"){return Nm(e,JM(e,t))}function QM(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 Aw(e){return String((e==null?void 0:e.version)||"").trim()}function ZM(e){const t=Aw(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 e$({onChanged:e}){const[t,n]=h.useState({available:!1,version:"",loggedIn:!1,user:"",error:""}),[r,s]=h.useState([]),[i,a]=h.useState(""),[l,c]=h.useState("keyword"),[d,f]=h.useState([]),[u,p]=h.useState({}),[m,g]=h.useState(""),[b,v]=h.useState(""),[y,k]=h.useState(""),w=h.useCallback(async()=>{v("");try{const[F,z]=await Promise.all([fetch("/api/skillhub/status"),fetch("/api/skillhub/list?target=global&agent=codex")]),L=await F.json().catch(()=>({}));F.ok&&n({available:!!L.available,version:typeof L.version=="string"?L.version:"",loggedIn:!!L.loggedIn,user:typeof L.user=="string"?L.user:"",error:typeof L.error=="string"?L.error:""});const O=await z.json().catch(()=>({}));if(!z.ok)throw new Error(typeof O.error=="string"?O.error:"HTTP "+z.status);s(Array.isArray(O.skills)?O.skills:[]),p({})}catch(F){v(String(F.message||F))}},[]);h.useEffect(()=>{w()},[w]);const j=h.useCallback(async()=>{const F=i.trim();if(F){g("search"),v(""),k("");try{const z=await fetch(`/api/skillhub/search?q=${encodeURIComponent(F)}&mode=${encodeURIComponent(l)}`),L=await z.json().catch(()=>({}));if(!z.ok)throw new Error(typeof L.error=="string"?L.error:"HTTP "+z.status);f(Array.isArray(L.items)?L.items:[])}catch(z){v(String(z.message||z))}finally{g("")}}},[i,l]),A=h.useCallback(async(F,z=!1)=>{const L=F&&typeof F=="object"?F:null,O=String(L?L.slug||L.name||L.collection||L.skillId||L.id:F||"").trim();if(O){g(`install:${O}`),v(""),k("");try{const W=L?{slug:L.slug||"",skillId:L.skillId||"",collection:L.collection||"",collectionName:L.collection&&L.name||"",target:"global",agent:"codex",force:z}:{slug:O,target:"global",agent:"codex",force:z},M=await fetch("/api/skillhub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(W)}),T=await M.json().catch(()=>({}));if(!M.ok)throw new Error(typeof T.error=="string"?T.error:"HTTP "+M.status);k(z?`已更新 ${O}`:`已安装 ${O}`),await w(),typeof e=="function"&&await e()}catch(W){v(String(W.message||W))}finally{g("")}}},[w,e]),C=h.useCallback(async()=>{if(r.length!==0){g("check-updates"),v(""),k("");try{const F=await Promise.all(r.map(async O=>{const W=String(O.name||"").trim();if(!W)return null;try{const M=await fetch(`/api/skillhub/search?q=${encodeURIComponent(W)}&mode=keyword`),T=await M.json().catch(()=>({}));if(!M.ok)throw new Error(typeof T.error=="string"?T.error:"HTTP "+M.status);const E=Array.isArray(T.items)?T.items:[],D=E.find(G=>G.slug===W||G.name===W||G.id===W)||E[0],_=Aw(O),R=String((D==null?void 0:D.version)||"").trim();let P="unknown";return D?_&&R?P=QM(_,R)<0?"update":"current":R&&(P="remote-only"):P="missing",[W,{state:P,latestVersion:R,installedVersion:_,summary:(D==null?void 0:D.summary)||""}]}catch(M){return[W,{state:"error",error:String(M.message||M),installedVersion:Aw(O)}]}})),z={};for(const O of F)O&&(z[O[0]]=O[1]);p(z);const L=Object.values(z).filter(O=>O.state==="update").length;k(L>0?`发现 ${L} 个可更新 skill`:"已检查,暂无明确可更新项")}finally{g("")}}},[r]),$=h.useCallback(async F=>{const z=String(F||"").trim();if(z){g(`uninstall:${z}`),v(""),k("");try{const L=await fetch("/api/skillhub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:z,target:"global",agent:"codex"})}),O=await L.json().catch(()=>({}));if(!L.ok)throw new Error(typeof O.error=="string"?O.error:"HTTP "+L.status);k(`已卸载 ${z}`),await w(),typeof e=="function"&&await e()}catch(L){v(String(L.message||L))}finally{g("")}}},[w,e]),B=h.useCallback(async()=>{g("update-cli"),v(""),k("");try{const F=await fetch("/api/skillhub/update",{method:"POST"}),z=await F.json().catch(()=>({}));if(!F.ok)throw new Error(typeof z.error=="string"?z.error:"HTTP "+F.status);k("SkillHub CLI 已更新"),await w()}catch(F){v(String(F.message||F))}finally{g("")}},[w]);return o.jsxs("section",{className:"af-set-card af-set-card--span-all af-set-skillhub",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:"SkillHub"}),o.jsx("p",{className:"af-set-p af-set-p--tight",children:"搜索、安装、更新和卸载 Codex 全局 skills。"})]}),o.jsxs("div",{className:"af-set-skillhub-head-actions",children:[o.jsxs("div",{className:"af-set-skillhub-status",children:[o.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:"extension"}),o.jsx("span",{children:t.loggedIn?`已登录 ${t.user}`:"未登录 SkillHub"}),o.jsx("span",{className:"af-set-badge"+(t.available?" af-set-badge--ok":" af-set-badge--err"),children:t.available?`v${t.version}`:"not found"})]}),o.jsxs("div",{className:"af-set-skillhub-toolbar",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:w,disabled:!!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:B,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:F=>{c(F.target.value),f([])},children:[o.jsx("option",{value:"keyword",children:"关键词"}),o.jsx("option",{value:"skillId",children:"Skill ID"}),o.jsx("option",{value:"collectionId",children:"Collection ID"})]}),o.jsx("input",{className:"af-set-input af-set-input--sm",value:i,onChange:F=>a(F.target.value),onKeyDown:F=>{F.key==="Enter"&&j()},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:()=>j(),disabled:!i.trim()||m==="search",children:[o.jsx("span",{className:"material-symbols-outlined",children:"search"}),m==="search"?"搜索中…":"搜索"]})]}),b?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:b}):null,y?o.jsx("p",{className:"af-set-hint af-set-hint--inline",children:y}):null,o.jsxs("div",{className:"af-set-skillhub-grid",children:[o.jsxs("div",{className:"af-set-skillhub-pane",children:[o.jsxs("div",{className:"af-set-skillhub-pane-head",children:[o.jsx("h3",{children:"已安装"}),o.jsx("span",{children:r.length})]}),o.jsx("div",{className:"af-set-skillhub-list",children:r.length===0?o.jsx("div",{className:"af-set-skillhub-empty",children:"暂无 Codex 全局 skills"}):r.map(F=>{const z=u[F.name],L=!z||z.state==="update"||z.state==="remote-only"||z.state==="unknown"||z.state==="error",O=m===`install:${F.name}`?"更新中…":(z==null?void 0:z.state)==="current"?"已最新":(z==null?void 0:z.state)==="update"&&z.latestVersion?`更新到 v${z.latestVersion}`:(z==null?void 0:z.state)==="remote-only"&&z.latestVersion?`安装 v${z.latestVersion}`:"重装";return o.jsxs("div",{className:"af-set-skillhub-item",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-set-skillhub-title",children:F.displayName||F.name}),o.jsx("div",{className:"af-set-skillhub-meta",children:ZM(F)}),o.jsx("div",{className:"af-set-skillhub-version-row",children:z?z.state==="update"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--warn",children:["可更新 ",z.installedVersion?`v${z.installedVersion} -> `:"","v",z.latestVersion]}):z.state==="current"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--ok",children:["已最新 v",z.latestVersion||z.installedVersion]}):z.state==="remote-only"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:["远端 v",z.latestVersion,",本地版本未知"]}):z.state==="missing"?o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"未找到远端匹配项"}):z.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:()=>A(F.name,!0),disabled:!!m||!L,children:O}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>$(F.name),disabled:!!m,children:"卸载"})]})]},`${F.agent}:${F.path}:${F.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(F=>{const z=F.slug||F.name,L=F.kind==="collection"||F.collection,O=!L&&r.some(W=>W.name===z||W.name===F.name);return o.jsxs("div",{className:"af-set-skillhub-item",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-set-skillhub-title",children:F.name||z}),o.jsxs("div",{className:"af-set-skillhub-meta",children:[L?`collection:${F.collection}`:z,F.skillId?` · id:${F.skillId}`:"",F.version?` · ${F.version}`:""]}),F.summary?o.jsx("p",{className:"af-set-skillhub-summary",children:F.summary}):null]}),o.jsx("button",{type:"button",className:O?"af-set-btn-mini":"af-set-btn-add af-set-btn-add--compact",onClick:()=>A(F,O),disabled:!!m,children:O?"更新":L?"安装合集":"安装"})]},F.id||z)})})]})]})]})}function Qa(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 t$(e){return{version:1,collections:Qa({collections:e})}}function sl(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 L_(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 O_(e,t){const n=new Set(Array.isArray(t)?t:[]);return(Array.isArray(e)?e:[]).filter(r=>!n.has(r))}function M_(e,t,n){const r=sl(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 n$(e,t,n){const r=String(e||"").trim().toLowerCase(),s=Qa({collections:n}).find(i=>i.id===r||i.name.toLowerCase()===r);return sl(s,t)}function $_(e,t,n,r){const s=(Array.isArray(n)?n:[]).map(d=>d.key).filter(Boolean),i=String(t||"").trim().toLowerCase(),a=Qa({collections:r}),l=n$(t,n,r),c=l.length>0?l:s;if(!e)return c;try{const d=localStorage.getItem(e);if(d!==null){const f=JSON.parse(d);if(Array.isArray(f)){const u=new Set(s),p=f.map(String).filter(y=>u.has(y));if(s.length>0&&p.length===s.length)return c;const m=new Set(p),g=new Set(l),b=l.length>0&&l.every(y=>m.has(y)),v=a.some(y=>{if(!y.builtin||y.id===i||y.name.toLowerCase()===i)return!1;const k=sl(y,n);return k.length>0&&k.every(w=>m.has(w))});return l.length>0&&v&&!b?c:p}}}catch{}return c}function vd(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 r$(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 Iw(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 D_(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 s$="project:defaultCardDesc";function F_(e,t){const n=e.description!=null?String(e.description).trim():"";return n!==""?n:t(s$)}function i$(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function rr({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(`(${i$(r)})`,"gi"),a=s.split(i);return o.jsx("span",{className:t,children:a.map((l,c)=>c%2===1?o.jsx("mark",{className:"af-search-hit",children:l},c):o.jsx("span",{children:l},c))})}function o$(e,t,n){const r=[String(e.id),F_(e,n),D_(e),Iw(e.source,n).label];return e.archived&&r.push(n("project:archived")),r.join(`
|
|
41
|
-
`).toLowerCase()}function a$(e,t,n){return t?o$(e,t,n).includes(t):!0}function l$(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 zy(e,t){const n=e.trim().toLowerCase();return n?t.filter(Boolean).join(`
|
|
42
|
-
`).toLowerCase().includes(n):!0}function tS(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 nS(e){return e!=null&&e.packageDir?e.packageDir:`marketplace/flow-snippets / ${(e==null?void 0:e.id)||""}`}const c$=["all","agent","control","provide","marketplace"],u$=["all","agent","control","provide"],z_="agentflow.projects.activityPanelOpen",Tw="agentflow.projects.activitySelected";function d$(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(z_);return e!=="0"}function rS(e){return`${(e==null?void 0:e.flowSource)||"user"}:${(e==null?void 0:e.flowId)||""}`}function f$(){return typeof localStorage>"u"?"":localStorage.getItem(Tw)||""}function rh(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,n])=>({key:t,...n&&typeof n=="object"?n:{}}))}function Dn(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 _a(e){return`${(e==null?void 0:e.id)||""}:${(e==null?void 0:e.version)||""}:${(e==null?void 0:e.packageDir)||""}`}function B_(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 H_(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 Rw(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 sS(e,t){return String((e==null?void 0:e.label)||(e==null?void 0:e.displayName)||(e==null?void 0:e.name)||Rw(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 h$(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 By(e,t=16){const n=String(e||"").trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function m$(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 g$(e,t){const n=e.map(f=>f.id),r=new Set(n),s=new Map(n.map(f=>[f,0])),i=new Map(n.map(f=>[f,[]]));t.forEach(f=>{var u;!r.has(f.sourceId)||!r.has(f.targetId)||(s.set(f.targetId,(s.get(f.targetId)||0)+1),(u=i.get(f.sourceId))==null||u.push(f.targetId))});const a=new Map,l=n.filter(f=>(s.get(f)||0)===0);l.length===0&&n[0]&&l.push(n[0]),l.forEach(f=>a.set(f,0));for(let f=0;f<l.length;f+=1){const u=l[f],p=(a.get(u)||0)+1;for(const m of i.get(u)||[])(!a.has(m)||p>a.get(m))&&(a.set(m,p),l.push(m))}n.forEach((f,u)=>{a.has(f)||a.set(f,u%3)});const c=new Map,d=new Map;return n.forEach(f=>{const u=a.get(f)||0,p=c.get(u)||0;c.set(u,p+1),d.set(f,{x:u*190,y:p*86})}),d}function y$(e){var b,v,y,k;const t=B_(e),n=H_(e),r=new Map(t.map((w,j)=>[Rw(w,j),sS(w,j)])),s=t.map((w,j)=>({id:Rw(w,j),title:sS(w,j),meta:p$(w)})),i=n.map((w,j)=>{const A=iS(w,"source"),C=iS(w,"target");return{key:(w==null?void 0:w.id)||`${A}-${C}-${j}`,sourceId:A,targetId:C,source:r.get(A)||A||"?",target:r.get(C)||C||"?",label:h$(w)}}),a=(v=(b=e==null?void 0:e.snippet)==null?void 0:b.ui)!=null&&v.nodePositions&&typeof e.snippet.ui.nodePositions=="object"?e.snippet.ui.nodePositions:{},l=(k=(y=e==null?void 0:e.snippet)==null?void 0:y.ui)!=null&&k.nodeSizes&&typeof e.snippet.ui.nodeSizes=="object"?e.snippet.ui.nodeSizes:{},c=g$(s,i),d=s.map(w=>{const j=m$(a[w.id])||c.get(w.id)||{x:0,y:0},A=l[w.id]&&typeof l[w.id]=="object"?l[w.id]:{},C=Number(A.width),$=Number(A.height),B=Math.max(132,Math.min(210,Number.isFinite(C)?C*.62:150)),F=Math.max(48,Math.min(76,Number.isFinite($)?$*.46:54));return{...w,x:j.x,y:j.y,width:B,height:F}}),f=new Map(d.map(w=>[w.id,w])),u=i.map(w=>{const j=f.get(w.sourceId),A=f.get(w.targetId);if(!j||!A)return null;const C=j.x+j.width,$=j.y+j.height/2,B=A.x,F=A.y+A.height/2,z=Math.max(48,Math.abs(B-C)*.45);return{...w,path:`M ${C} ${$} C ${C+z} ${$}, ${B-z} ${F}, ${B} ${F}`,labelX:(C+B)/2,labelY:($+F)/2}}).filter(Boolean),p=d.reduce((w,j)=>({minX:Math.min(w.minX,j.x),minY:Math.min(w.minY,j.y),maxX:Math.max(w.maxX,j.x+j.width),maxY:Math.max(w.maxY,j.y+j.height)}),{minX:0,minY:0,maxX:420,maxY:220}),m=36,g=`${p.minX-m} ${p.minY-m} ${Math.max(360,p.maxX-p.minX+m*2)} ${Math.max(180,p.maxY-p.minY+m*2)}`;return{nodes:s,edges:i,diagram:{nodes:d,edges:u,viewBox:g}}}function Rc({resourceKind:e="",authUser:t=null}){var Ys,cn,As,Is,Ts,Gs;const{t:n}=kn(),{navigate:r,path:s}=No(),[i,a]=h.useState(e||"all"),[l,c]=h.useState([]),[d,f]=h.useState([]),[u,p]=h.useState([]),[m,g]=h.useState([]),[b,v]=h.useState([]),[y,k]=h.useState(""),[w,j]=h.useState(!1),[A,C]=h.useState([]),[$,B]=h.useState(""),[F,z]=h.useState(""),[L,O]=h.useState(!1),[W,M]=h.useState(!1),[T,E]=h.useState(!1),[D,_]=h.useState(null),[R,P]=h.useState(!1),[G,Z]=h.useState(""),[V,se]=h.useState(d$),[ue,pe]=h.useState(f$),[ge,ae]=h.useState("all"),[be,Pe]=h.useState(""),[we,_e]=h.useState("overview"),[Ie,st]=h.useState({}),[ct,et]=h.useState(""),[Et,Ue]=h.useState({}),[St,tn]=h.useState(""),[gn,Tn]=h.useState(""),[zt,Rn]=h.useState({}),[Bn,le]=h.useState(""),[fe,ze]=h.useState(""),[Ze,ot]=h.useState(""),[Jt,nn]=h.useState(""),[Ln,yn]=h.useState(""),[ir,rn]=h.useState(!1),[Sn,Zt]=h.useState(""),[Nn,xe]=h.useState({hiddenBuiltins:[],promoted:[]}),Re=h.useRef(0),it=h.useRef(0),re=h.useCallback(async()=>{var me,Te;const K=++it.current;B("");try{const Ae=await fetch("/api/flows");if(K!==it.current)return;if(!Ae.ok)throw new Error("HTTP "+Ae.status);const Xe=await Ae.json();if(K!==it.current)return;c(Array.isArray(Xe)?Xe:[])}catch(Ae){if(K!==it.current)return;c([]),B(String(Ae.message||Ae))}try{const Ae=await fetch("/api/pipeline-recent-runs");if(K!==it.current)return;if(Ae.ok){const Xe=await Ae.json();if(K!==it.current)return;C(Array.isArray(Xe.runs)?Xe.runs:[])}else C([])}catch{if(K!==it.current)return;C([])}if(t!=null&&t.isAdmin)try{const Ae=await fetch("/api/admin/builtin-flows");if(K!==it.current)return;const Xe=await Ae.json().catch(()=>({}));Ae.ok&&xe({hiddenBuiltins:Array.isArray((me=Xe==null?void 0:Xe.config)==null?void 0:me.hiddenBuiltins)?Xe.config.hiddenBuiltins:[],promoted:Array.isArray((Te=Xe==null?void 0:Xe.config)==null?void 0:Te.promoted)?Xe.config.promoted:[]})}catch{if(K!==it.current)return;xe({hiddenBuiltins:[],promoted:[]})}else xe({hiddenBuiltins:[],promoted:[]});O(!0)},[t==null?void 0:t.isAdmin]),Ce=h.useCallback(async(K,me)=>{if(!(t!=null&&t.isAdmin)||!(K!=null&&K.id))return;const Te=`${me}:${K.source}:${K.id}`;Zt(Te),B("");try{const Ae=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})}),Xe=await Ae.json().catch(()=>({}));if(!Ae.ok)throw new Error(Xe.error||"更新内置配置失败");await re()}catch(Ae){B(String(Ae.message||Ae))}finally{Zt("")}},[t==null?void 0:t.isAdmin,t==null?void 0:t.userId,re]),Ge=h.useCallback(async()=>{z(""),M(!1);try{const[K,me,Te,Ae]=await Promise.all([fetch("/api/nodes"),fetch("/api/skills"),fetch("/api/skill-collections"),fetch("/api/marketplace/flow-snippets")]),Xe=await K.json().catch(()=>({})),Wt=await me.json().catch(()=>({})),Ot=await Te.json().catch(()=>({})),tr=await Ae.json().catch(()=>({}));if(!K.ok)throw new Error(Xe.error||"Nodes HTTP "+K.status);if(!me.ok)throw new Error(Wt.error||"Skills HTTP "+me.status);if(!Te.ok)throw new Error(Ot.error||"Collections HTTP "+Te.status);if(!Ae.ok)throw new Error(tr.error||"Flow snippets HTTP "+Ae.status);f(Array.isArray(Xe.nodes)?Xe.nodes:Array.isArray(Xe)?Xe:[]),p(Array.isArray(Wt.skills)?Wt.skills:[]),v(Qa(Ot)),g(Array.isArray(tr.snippets)?tr.snippets:[])}catch(K){f([]),p([]),g([]),v([]),z(String(K.message||K))}finally{M(!0)}},[]);h.useEffect(()=>{O(!1),re(),Ge()},[re,Ge]),h.useEffect(()=>{try{localStorage.setItem(z_,V?"1":"0")}catch{}},[V]),h.useEffect(()=>{try{ue?localStorage.setItem(Tw,ue):localStorage.removeItem(Tw)}catch{}},[ue]),h.useEffect(()=>{let K=!1;return fetch("/api/ui-context").then(me=>me.json()).then(me=>{K||rn(!!me.hideCommunityLinks)}).catch(()=>{}),()=>{K=!0}},[]);const Ct=h.useCallback(async K=>{const me=Qa({collections:K});j(!0),z("");try{const Te=await fetch("/api/skill-collections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t$(me))}),Ae=await Te.json().catch(()=>({}));if(!Te.ok)throw new Error(Ae.error||"Collections HTTP "+Te.status);v(Qa(Ae))}catch(Te){z(String(Te.message||Te))}finally{j(!1)}},[]),Ke=h.useCallback(()=>{const K=y.trim();if(!K)return;const me=K.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"collection",Te=new Set(b.map(Ot=>Ot.id));let Ae=me,Xe=2;for(;Te.has(Ae);)Ae=`${me}-${Xe++}`;const Wt=Date.now();Ct([...b,{id:Ae,name:K,skillKeys:[],createdAt:Wt,updatedAt:Wt}]),k(""),ae(`collection:${Ae}`)},[y,Ct,b]),jn=h.useCallback(K=>{const me=b.find(Ae=>Ae.id===K);if(me!=null&&me.builtin)return;const Te=b.filter(Ae=>Ae.id!==K);ge===`collection:${K}`&&ae("all"),Ct(Te)},[ge,Ct,b]),hi=h.useCallback((K,me,Te)=>{const Ae=String(me||"").trim();if(!Ae)return;const Xe=Date.now(),Wt=b.map(Ot=>{if(Ot.id!==K)return Ot;const tr=new Set(Ot.skillKeys||[]);return Te?tr.add(Ae):tr.delete(Ae),{...Ot,skillKeys:Array.from(tr),updatedAt:Xe}});Ct(Wt)},[Ct,b]),Eo=h.useCallback(async K=>{const me=K==null?void 0:K.packageId,Te=K==null?void 0:K.version;if(!me||!Te||!window.confirm(n("project:deleteMyNodeConfirm",{id:me,version:Te})))return;const Ae=Dn(K);ze(Ae),ot(""),z("");try{const Xe=new URLSearchParams({id:me,version:Te}),Wt=await fetch(`/api/marketplace/node?${Xe.toString()}`,{method:"DELETE"}),Ot=await Wt.json().catch(()=>({}));if(!Wt.ok||(Ot==null?void 0:Ot.ok)===!1){const tr=Array.isArray(Ot==null?void 0:Ot.usage)&&Ot.usage.length>0?` ${n("project:deleteMyNodeUsedBy",{count:Ot.usage.length})}`:"";throw new Error(((Ot==null?void 0:Ot.error)||"Delete failed")+tr)}ot(n("project:deleteMyNodeSuccess",{id:me,version:Te})),Ue(tr=>{const Cr={...tr};return delete Cr[Ae],Cr}),Rn(tr=>{const Cr={};for(const[Xs,Io]of Object.entries(tr))Xs.startsWith(`${Ae}:`)||(Cr[Xs]=Io);return Cr}),Pe(""),await Ge()}catch(Xe){ot(String(Xe.message||Xe))}finally{ze("")}},[Ge,n]),vr=h.useCallback(async K=>{const me=K==null?void 0:K.id,Te=(K==null?void 0:K.version)||"1.0.0";if(!me||!Te||!window.confirm(n("project:deleteMyFlowConfirm",{id:me,version:Te})))return;const Ae=_a(K);nn(Ae),yn(""),z("");try{const Xe=new URLSearchParams({id:me,version:Te}),Wt=await fetch(`/api/marketplace/flow-snippet?${Xe.toString()}`,{method:"DELETE"}),Ot=await Wt.json().catch(()=>({}));if(!Wt.ok||(Ot==null?void 0:Ot.ok)===!1)throw new Error((Ot==null?void 0:Ot.error)||"Delete failed");yn(n("project:deleteMyFlowSuccess",{id:me,version:Te})),Pe(""),await Ge()}catch(Xe){yn(String(Xe.message||Xe))}finally{nn("")}},[Ge,n]);h.useEffect(()=>{if(e==="nodes"||e==="my-nodes"||e==="my-flows"||e==="skills"){a(e),ae("all"),Pe(""),_e("overview");return}a(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"&&(a("archived"),K.delete("tab"),me=!0),K.get("new")==="1"&&(E(!0),K.delete("new"),me=!0),me){const Te=K.toString();window.history.replaceState({},"",Te?`/projects?${Te}`:"/projects")}},[s,r]);const kr=h.useMemo(()=>wM(A,S_(),l),[A,l,s]),_o=h.useMemo(()=>kr.filter(K=>l$(G,K)),[kr,G]),or=G.trim().toLowerCase(),qs=h.useMemo(()=>i==="archived"?l.filter(K=>K.archived):l.filter(K=>!K.archived),[l,i]),Me=h.useMemo(()=>qs.filter(K=>a$(K,or,n)),[qs,or,n]),ca=h.useMemo(()=>new Set((Nn.promoted||[]).map(K=>String((K==null?void 0:K.id)||"").trim()).filter(Boolean)),[Nn.promoted]),mi=h.useMemo(()=>(Nn.hiddenBuiltins||[]).map(K=>String(K||"").trim()).filter(Boolean),[Nn.hiddenBuiltins]),Yn=i==="nodes"||i==="my-nodes",Oe=i==="my-nodes",Bt=i==="my-flows",Sr=h.useMemo(()=>d.filter(K=>Oe&&K.source!=="marketplace"?!1:(ge==="all"||(ge==="marketplace"?K.source==="marketplace":K.type===ge))&&zy(G,[K.id,K.label,K.displayName,K.description,K.type,K.source,K.packageId,K.version])),[d,Oe,G,ge]),mt=h.useMemo(()=>{const K=new Map;for(const me of b)K.set(me.id,new Set(me.skillKeys||[]));return K},[b]),Yi=h.useMemo(()=>[{id:"all",label:"全部"},...b.map(K=>({id:`collection:${K.id}`,label:K.name,count:K.skillKeys.length,collection:K})),{id:"ungrouped",label:"未分组"}],[b]),er=h.useMemo(()=>u.filter(K=>{var Ae;const me=Dn(K);let Te=ge==="all";if(ge.startsWith("collection:")){const Xe=ge.slice(11);Te=!!((Ae=mt.get(Xe))!=null&&Ae.has(me))}else ge==="ungrouped"&&(Te=!Array.from(mt.values()).some(Xe=>Xe.has(me)));return Te&&zy(G,[K.name,K.id,K.description,K.sourceLabel,K.source,K.path])}),[u,G,ge,mt]),Hn=h.useMemo(()=>m.filter(K=>zy(G,[K.id,K.name,K.displayName,K.description,K.version,K.packageDir,Array.isArray(K.tags)?K.tags.join(" "):""])),[m,G]),Nr=Yn||Bt||i==="skills",lt=h.useMemo(()=>Sr.find(K=>Dn(K)===be)||Sr[0]||null,[Sr,be]),Ht=h.useMemo(()=>er.find(K=>Dn(K)===be)||er[0]||null,[er,be]),qt=h.useMemo(()=>Hn.find(K=>_a(K)===be)||Hn[0]||null,[Hn,be]),On=Ht?Ie[Dn(Ht)]:null,Je=lt?Et[Dn(lt)]:null,ar=lt&&gn?zt[`${Dn(lt)}:${gn}`]:null,_s=n(Yn?"project:searchNodes":Bt?"project:searchFlows":i==="skills"?"project:searchSkills":"project:searchPipelines");h.useEffect(()=>{if(i!=="skills"||!Ht)return;const K=Dn(Ht);if(Ie[K])return;let me=!1;return et(K),fetch(`/api/skills/detail?key=${encodeURIComponent(K)}`).then(Te=>Te.json().then(Ae=>({ok:Te.ok,json:Ae}))).then(({ok:Te,json:Ae})=>{me||Te&&Ae.skill&&st(Xe=>({...Xe,[K]:Ae.skill}))}).catch(()=>{}).finally(()=>{me||et("")}),()=>{me=!0}},[i,Ht,Ie]),h.useEffect(()=>{if(!Yn||!lt)return;const K=Dn(lt);if(Et[K])return;let me=!1;return tn(K),fetch(`/api/nodes/detail?id=${encodeURIComponent(lt.id)}`).then(Te=>Te.json().then(Ae=>({ok:Te.ok,json:Ae}))).then(({ok:Te,json:Ae})=>{me||Te&&Ue(Xe=>({...Xe,[K]:Ae}))}).catch(()=>{}).finally(()=>{me||tn("")}),()=>{me=!0}},[Yn,lt,Et]),h.useEffect(()=>{if(!Yn)return;const K=Array.isArray(Je==null?void 0:Je.files)?Je.files:[];Tn(me=>{var Te;return me&&K.some(Ae=>Ae.path===me)?me:((Te=K[0])==null?void 0:Te.path)||""})},[Yn,Je]),h.useEffect(()=>{if(!Yn||!lt||!gn)return;const K=`${Dn(lt)}:${gn}`;if(zt[K])return;let me=!1;return le(K),fetch(`/api/nodes/file?id=${encodeURIComponent(lt.id)}&path=${encodeURIComponent(gn)}`).then(Te=>Te.json().then(Ae=>({ok:Te.ok,json:Ae}))).then(({ok:Te,json:Ae})=>{me||Te&&Rn(Xe=>({...Xe,[K]:Ae}))}).catch(()=>{}).finally(()=>{me||le("")}),()=>{me=!0}},[Yn,lt,gn,zt]),h.useEffect(()=>{ot("")},[be,i]);const jr=K=>{r(nh(K,"workspace"))},gi=K=>{pe(rS(K)),r(nh({id:K.flowId,source:K.flowSource,archived:!!K.archived},"workspace"))},Ps=h.useCallback(K=>{var me,Te;K.preventDefault(),K.stopPropagation(),(Te=(me=K.dataTransfer)==null?void 0:me.types)!=null&&Te.includes("Files")&&(Re.current+=1,P(!0))},[]),Po=h.useCallback(K=>{K.preventDefault(),K.stopPropagation(),Re.current-=1,Re.current<=0&&(Re.current=0,P(!1))},[]),Gi=h.useCallback(K=>{K.preventDefault(),K.stopPropagation()},[]),Ao=h.useCallback(K=>{var Ae,Xe;K.preventDefault(),K.stopPropagation(),Re.current=0,P(!1);const me=(Xe=(Ae=K.dataTransfer)==null?void 0:Ae.files)==null?void 0:Xe[0];if(!me)return;const Te=me.name.toLowerCase();!Te.endsWith(".yaml")&&!Te.endsWith(".yml")&&!Te.endsWith(".zip")||_(me)},[]);return o.jsxs("div",{className:"af-projects"+(R?" af-projects--drop-target":""),onDragEnter:Ps,onDragLeave:Po,onDragOver:Gi,onDrop:Ao,children:[o.jsxs("header",{className:"af-projects-top",children:[e?o.jsx("div",{className:"af-projects-tabs af-projects-tabs--empty","aria-hidden":!0}):o.jsxs("div",{className:"af-projects-tabs",children:[o.jsx("button",{type:"button",className:i==="all"?"af-tab af-tab--active":"af-tab",onClick:()=>a("all"),children:n("project:all")}),o.jsx("button",{type:"button",className:i==="archived"?"af-tab af-tab--active":"af-tab",onClick:()=>a("archived"),children:n("project:archived")})]}),o.jsxs("div",{className:"af-projects-top-right",children:[o.jsxs("div",{className:"af-search-wrap",children:[o.jsx("span",{className:"material-symbols-outlined af-search-icon",children:"search"}),o.jsx("input",{className:"af-search"+(G.trim()?" af-search--has-clear":""),type:"search",placeholder:_s,"aria-label":_s,autoComplete:"off",value:G,onChange:K=>Z(K.target.value),onKeyDown:K=>{K.key==="Escape"&&(Z(""),K.currentTarget.blur())}}),G.trim()?o.jsx("button",{type:"button",className:"af-search-clear","aria-label":"Clear search",onClick:()=>Z(""),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),Nr?o.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>Ge(),children:n("project:refreshResources")}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-icon-btn"+(V?" af-icon-btn--active":""),"aria-label":n("flow:palette.toggleRecentActivity"),"aria-expanded":V,"aria-controls":"af-recent-activity-panel",onClick:()=>se(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:()=>E(!0),children:n("project:createNew")})]})]})]}),o.jsxs("div",{className:"af-projects-body",children:[o.jsxs("section",{className:"af-projects-main",children:[o.jsxs("header",{className:"af-projects-section-head",children:[o.jsx("h2",{className:"af-projects-h2",children:n(i==="my-nodes"?"project:myNodes":i==="my-flows"?"project:myFlows":i==="nodes"?"project:globalNodes":i==="skills"?"project:globalSkills":i==="archived"?"project:archivedPipelines":"project:activeProjects")}),o.jsx("p",{className:"af-projects-sub",children:or?n("project:filterResult",{count:i==="nodes"||i==="my-nodes"?Sr.length:i==="my-flows"?Hn.length:i==="skills"?er.length:Me.length}):i==="my-nodes"?n("project:myNodesHint",{count:Sr.length}):i==="my-flows"?n("project:myFlowsHint",{count:Hn.length}):i==="nodes"?n("project:nodesHint",{count:d.length}):i==="skills"?n("project:skillsHint",{count:u.length}):n(i==="archived"?"project:archivedHint":"project:activeHint")}),$?o.jsx("p",{className:"af-err af-projects-api-hint",children:$}):null,F&&Nr?o.jsx("p",{className:"af-err af-projects-api-hint",children:F}):null]}),Nr?o.jsxs("div",{className:"af-resource-toolbar",children:[i==="skills"?o.jsx(e$,{onChanged:Ge}):null,o.jsxs("div",{className:"af-resource-purpose",children:[o.jsx("span",{className:"material-symbols-outlined",children:Bt?"schema":Yn?Oe?"deployed_code":"account_tree":"extension"}),o.jsxs("div",{children:[o.jsx("h3",{children:n(Bt?"project:myFlowsPurposeTitle":Oe?"project:myNodesPurposeTitle":Yn?"project:nodesPurposeTitle":"project:skillsPurposeTitle")}),o.jsx("p",{children:n(Bt?"project:myFlowsPurposeDesc":Oe?"project:myNodesPurposeDesc":Yn?"project:nodesPurposeDesc":"project:skillsPurposeDesc")})]})]}),Bt?null:o.jsx("div",{className:"af-resource-filter-row",children:(Yn?(Oe?u$:c$).map(K=>({id:K,label:n(`project:resourceFilter.${K}`)})):Yi).map(K=>K.collection?o.jsxs("span",{className:"af-resource-filter-chip"+(ge===K.id?" af-resource-filter-chip--active":""),children:[o.jsxs("button",{type:"button",className:"af-resource-filter af-resource-filter--embedded",onClick:()=>{ae(K.id),Pe("")},children:[K.label,o.jsx("em",{children:K.count}),K.collection.builtin?o.jsx("strong",{children:"built-in"}):null]}),K.collection.builtin?null:o.jsx("button",{type:"button",className:"af-resource-filter-chip__delete",disabled:w,"aria-label":`删除 ${K.collection.name}`,onClick:()=>jn(K.collection.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},K.id):o.jsx("button",{type:"button",className:"af-resource-filter"+(ge===K.id?" af-resource-filter--active":""),onClick:()=>{ae(K.id),Pe("")},children:K.label},K.id))}),i==="skills"?o.jsx("div",{className:"af-skill-collections-manager",children:o.jsxs("div",{className:"af-skill-collections-create",children:[o.jsx("input",{className:"af-set-input af-set-input--sm",value:y,onChange:K=>k(K.target.value),onKeyDown:K=>{K.key==="Enter"&&Ke()},placeholder:"新建 skill collection"}),o.jsxs("button",{type:"button",className:"af-set-btn-add af-set-btn-add--compact",disabled:!y.trim()||w,onClick:()=>Ke(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新建"]})]})}):null]}):null,Yn?o.jsx("div",{className:"af-resource-grid",children:Sr.length>0?Sr.map(K=>o.jsxs("button",{type:"button",className:"af-resource-card"+(lt&&Dn(K)===Dn(lt)?" af-resource-card--active":""),onClick:()=>Pe(Dn(K)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:vd(K.type==="control"?"secondary":K.type==="provide"?"primary":"muted"),children:o.jsx(rr,{query:G,children:K.type||"node"})}),o.jsx("span",{className:"af-resource-source",children:o.jsx(rr,{query:G,children:tS(K.source,n)})})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(rr,{query:G,children:K.label||K.displayName||K.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(rr,{query:G,children:K.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:o.jsx(rr,{query:G,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(rr,{query:G,children:`${K.packageId}${K.version?` / ${K.version}`:""}`})})]}):null]},`${K.id}:${K.source||""}:${K.packageId||""}`)):W?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:or?n("project:noNodeMatch",{query:G.trim()}):n(Oe?"project:noMyNodes":"project:noNodes")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):Bt?o.jsx("div",{className:"af-resource-grid",children:Hn.length>0?Hn.map(K=>{const me=B_(K),Te=H_(K),Ae=Number.isFinite(Number(K.nodeCount))?Number(K.nodeCount):me.length,Xe=Number.isFinite(Number(K.edgeCount))?Number(K.edgeCount):Te.length;return o.jsxs("button",{type:"button",className:"af-resource-card"+(qt&&_a(K)===_a(qt)?" af-resource-card--active":""),onClick:()=>Pe(_a(K)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:vd("primary"),children:o.jsx(rr,{query:G,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(rr,{query:G,children:K.displayName||K.name||K.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(rr,{query:G,children:K.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:n("project:flowSnippetNodes",{nodes:Ae,edges:Xe})}),o.jsx("span",{children:o.jsx(rr,{query:G,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(rr,{query:G,children:nS(K)})})]})]},_a(K))}):W?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:or?n("project:noFlowSnippetMatch",{query:G.trim()}):n("project:noMyFlows")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):i==="skills"?o.jsx("div",{className:"af-resource-grid",children:er.length>0?er.map(K=>o.jsxs("button",{type:"button",className:"af-resource-card"+(Ht&&Dn(K)===Dn(Ht)?" af-resource-card--active":""),onClick:()=>Pe(Dn(K)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:vd(K.source==="builtin"?"muted":"primary"),children:o.jsx(rr,{query:G,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(rr,{query:G,children:K.name||K.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(rr,{query:G,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(rr,{query:G,children:K.path||K.key||""})})]}),o.jsxs("div",{className:"af-skill-card-collections",children:[b.filter(me=>me.skillKeys.includes(Dn(K))).slice(0,3).map(me=>o.jsx("span",{children:me.name},me.id)),b.filter(me=>me.skillKeys.includes(Dn(K))).length===0?o.jsx("span",{className:"af-skill-card-collection-empty",children:"未分组"}):null]})]},K.key||`${K.source}:${K.name}`)):W?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:or?n("project:noSkillMatch",{query:G.trim()}):n("project:noSkills")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):o.jsxs(o.Fragment,{children:[t!=null&&t.isAdmin&&i==="all"&&mi.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:mi.map(K=>{const me=Sn===`show-builtin:builtin:${K}`;return o.jsxs("button",{type:"button",disabled:me,onClick:()=>Ce({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:[Me.length>0?Me.map(K=>{const me=(t==null?void 0:t.isAdmin)&&K.source==="user"&&!K.archived&&!ca.has(K.id),Te=(t==null?void 0:t.isAdmin)&&K.source==="admin",Ae=(t==null?void 0:t.isAdmin)&&K.source==="builtin",Xe=Sn.endsWith(`:${K.source}:${K.id}`);return o.jsx("div",{className:"af-project-card",role:"button",tabIndex:0,onClick:()=>jr(K),onKeyDown:Wt=>{(Wt.key==="Enter"||Wt.key===" ")&&(Wt.preventDefault(),jr(K))},children:o.jsxs("div",{className:"af-project-card-body",children:[o.jsx("span",{className:vd(Iw(K.source,n).tone),children:o.jsx(rr,{query:G,children:Iw(K.source,n).label})}),K.archived?o.jsx("span",{className:vd("muted"),children:o.jsx(rr,{query:G,children:n("project:archived")})}):null,o.jsx("h3",{className:"af-project-title",children:o.jsx(rr,{query:G,children:K.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(rr,{query:G,children:F_(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(rr,{query:G,children:D_(K)})})]}),t!=null&&t.isAdmin?o.jsxs("div",{className:"af-project-admin-actions",onClick:Wt=>Wt.stopPropagation(),onKeyDown:Wt=>Wt.stopPropagation(),children:[me?o.jsx("button",{type:"button",disabled:Xe,onClick:()=>Ce(K,"promote"),children:"设为内置"}):null,Te?o.jsx("button",{type:"button",disabled:Xe,onClick:()=>Ce(K,"unpromote"),children:"取消内置"}):null,Ae?o.jsx("button",{type:"button",disabled:Xe,onClick:()=>Ce(K,"hide-builtin"),children:"隐藏内置"}):null]}):null]})},`${K.id}:${K.source??"user"}:${K.archived?"a":""}`)}):L?qs.length===0?o.jsxs("div",{className:"af-projects-empty-block",children:[o.jsx("p",{className:"af-projects-empty",children:i==="archived"?n("project:noArchived"):l.length>0?n("project:noActive"):n($?"project:loadFailed":"project:noPipelines")}),!$&&l.length===0&&i==="all"?o.jsx("p",{className:"af-projects-empty-hint",children:n("project:emptyHint",{code1:"agentflow ui",code2:".agentflow/pipelines"})}):null]}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:noMatch",{query:G.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:()=>E(!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")})]}),ir?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")})]})]})]})]}),Nr?o.jsx("aside",{className:"af-resource-detail","aria-label":n(Yn?"project:nodeDetail":Bt?"project:flowDetail":"project:skillDetail"),children:Yn&<?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:lt.label||lt.displayName||lt.id}),o.jsx("p",{children:lt.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"+(we===K?" af-resource-detail-tab--active":""),onClick:()=>_e(K),children:n(`project:nodeDetailTabs.${K}`)},K))}),St===Dn(lt)?o.jsx("p",{className:"af-resource-detail-desc",children:n("project:loadingResources")}):we==="overview"?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"af-resource-detail-desc",children:lt.description||((Ys=Je==null?void 0:Je.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:lt.type||((cn=Je==null?void 0:Je.node)==null?void 0:cn.type)||"node"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailSource")}),o.jsx("dd",{children:tS(lt.source,n)})]}),lt.packageId?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPackage")}),o.jsx("dd",{children:lt.packageId})]}):null,lt.version?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailVersion")}),o.jsx("dd",{children:lt.version})]}):null,lt.packageDir||Je!=null&&Je.baseDir?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:lt.packageDir||(Je==null?void 0:Je.baseDir)})]}):null,o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailEditable")}),o.jsx("dd",{children:(Je==null?void 0:Je.readOnly)===!1?n("project:editable"):n("project:readOnly")})]})]}),Oe&<.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:fe===Dn(lt),onClick:()=>Eo(lt),children:[o.jsx("span",{className:"material-symbols-outlined",children:"delete"}),fe===Dn(lt)?n("project:deletingMyNode"):n("project:deleteMyNode")]}),Ze?o.jsx("p",{className:"af-resource-action-message",children:Ze}):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")})]})]}):we==="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")}),rh(((As=Je==null?void 0:Je.node)==null?void 0:As.inputs)||lt.inputs).length>0?rh(((Is=Je==null?void 0:Je.node)==null?void 0:Is.inputs)||lt.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")}),rh(((Ts=Je==null?void 0:Je.node)==null?void 0:Ts.outputs)||lt.outputs).length>0?rh(((Gs=Je==null?void 0:Je.node)==null?void 0:Gs.outputs)||lt.outputs).map(K=>o.jsxs("code",{children:[K.name||K.key,K.type?`: ${K.type}`:""]},K.key)):o.jsx("em",{children:n("project:noSlots")})]})]}):we==="runtime"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeRuntime")}),Je!=null&&Je.runtime?o.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(Je.runtime,null,2)}):o.jsx("p",{children:n("project:noRuntimeManifest")}),Je!=null&&Je.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:Je.body})]}):o.jsx("p",{children:n("project:noNodeBody")})]}):we==="files"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeFiles")}),Array.isArray(Je==null?void 0:Je.files)&&Je.files.length>0?o.jsxs("div",{className:"af-node-file-browser",children:[o.jsx("div",{className:"af-node-file-list",children:Je.files.map(K=>o.jsxs("button",{type:"button",className:"af-node-file-item"+(gn===K.path?" af-node-file-item--active":""),onClick:()=>Tn(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:[Bn===`${Dn(lt)}:${gn}`?n("project:loadingResources"):ar!=null&&ar.binary?n("project:binaryFile"):(ar==null?void 0:ar.content)||n("project:selectNodeFile"),ar!=null&&ar.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(Je==null?void 0:Je.usage)&&Je.usage.length>0?o.jsx("div",{className:"af-node-usage-list",children:Je.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")})]})]}):Bt&&qt?(()=>{const K=y$(qt);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:qt.displayName||qt.name||qt.id}),o.jsx("p",{children:qt.id})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:qt.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:qt.version||"1.0.0"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:nS(qt)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:flowSnippetScale")}),o.jsx("dd",{children:n("project:flowSnippetNodes",{nodes:Number.isFinite(Number(qt.nodeCount))?Number(qt.nodeCount):K.nodes.length,edges:Number.isFinite(Number(qt.edgeCount))?Number(qt.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:Jt===_a(qt),onClick:()=>vr(qt),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"}),Jt===_a(qt)?n("project:deletingMyFlow"):n("project:deleteMyFlow")]}),Ln?o.jsx("p",{className:"af-resource-action-message",children:Ln}):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:By(me.label,18)}):null]},me.key))}),o.jsx("g",{className:"af-flow-snippet-map__nodes",children:K.diagram.nodes.map((me,Te)=>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:Te+1}),o.jsx("text",{className:"af-flow-snippet-map__node-title",x:"40",y:me.height/2-3,children:By(me.title)}),o.jsx("text",{className:"af-flow-snippet-map__node-meta",x:"40",y:me.height/2+16,children:By(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(qt.snippet||{},null,2)})]})]})]})})():i==="skills"&&Ht?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:Ht.name||Ht.id}),o.jsx("p",{children:Ht.sourceLabel||Ht.source})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:Ht.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:Ht.sourceLabel||Ht.source})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:Ht.path||Ht.key})]})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:"Collections"}),b.length===0?o.jsx("p",{children:"暂无 collection。可在左侧新建后再添加。"}):o.jsx("div",{className:"af-skill-detail-collections",children:b.map(K=>{const me=Dn(Ht),Te=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:Te,disabled:w,onChange:Ae=>hi(K.id,me,Ae.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:ct===Dn(Ht)?n("project:loadingResources"):(On==null?void 0:On.body)||(On==null?void 0:On.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"+(V?"":" af-activity--hidden"),"aria-hidden":!V,"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:_o.length===0?o.jsx("p",{className:"af-activity-empty",children:kr.length===0?n("project:noRecentActivity"):n("project:noMatchRecent")}):_o.map(K=>{const me=ue===rS(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:()=>gi(K),children:[o.jsxs("div",{className:"af-activity-row-top",children:[o.jsx("h4",{className:"af-activity-name",children:o.jsx(rr,{query:G,children:K.flowId})}),o.jsx("span",{className:"af-activity-time",children:Ew(K.at,n)})]}),o.jsxs("div",{className:"af-activity-meta",children:[o.jsx("span",{className:r$(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")," · ",Ew(K.at,n)]})]})]},`${K.kind}-${K.flowId}-${K.flowSource}-${K.at}`)})})]})]}),o.jsx(YM,{open:T,onClose:()=>E(!1),onCreated:async K=>{E(!1),await re();const me=K.source??"user";r(nh({id:K.id,source:me},"workspace"))}}),D?o.jsx(KM,{file:D,onClose:()=>_(null),onImported:async K=>{_(null),await re();const me=K.source??"user";r(nh({id:K.id,source:me},"workspace"))}},`${D.name}-${D.size}-${D.lastModified}`):null]})}function hr(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=hr(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var x$={value:()=>{}};function Ng(){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 Bh(n)}function Bh(e){this._=e}function w$(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}})}Bh.prototype=Ng.prototype={constructor:Bh,on:function(e,t){var n=this._,r=w$(e+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((s=(e=r[i]).type)&&(s=b$(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]=oS(n[s],e.name,t);else if(t==null)for(s in n)n[s]=oS(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 Bh(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 b$(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function oS(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=x$,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Lw="http://www.w3.org/1999/xhtml";const aS={svg:"http://www.w3.org/2000/svg",xhtml:Lw,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function jg(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),aS.hasOwnProperty(t)?{space:aS[t],local:e}:e}function v$(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Lw&&t.documentElement.namespaceURI===Lw?t.createElement(e):t.createElementNS(n,e)}}function k$(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function W_(e){var t=jg(e);return(t.local?k$:v$)(t)}function S$(){}function kv(e){return e==null?S$:function(){return this.querySelector(e)}}function N$(e){typeof e!="function"&&(e=kv(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],a=i.length,l=r[s]=new Array(a),c,d,f=0;f<a;++f)(c=i[f])&&(d=e.call(c,c.__data__,f,i))&&("__data__"in c&&(d.__data__=c.__data__),l[f]=d);return new Vs(r,this._parents)}function j$(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function C$(){return[]}function V_(e){return e==null?C$:function(){return this.querySelectorAll(e)}}function E$(e){return function(){return j$(e.apply(this,arguments))}}function _$(e){typeof e=="function"?e=E$(e):e=V_(e);for(var t=this._groups,n=t.length,r=[],s=[],i=0;i<n;++i)for(var a=t[i],l=a.length,c,d=0;d<l;++d)(c=a[d])&&(r.push(e.call(c,c.__data__,d,a)),s.push(c));return new Vs(r,s)}function U_(e){return function(){return this.matches(e)}}function K_(e){return function(t){return t.matches(e)}}var P$=Array.prototype.find;function A$(e){return function(){return P$.call(this.children,e)}}function I$(){return this.firstElementChild}function T$(e){return this.select(e==null?I$:A$(typeof e=="function"?e:K_(e)))}var R$=Array.prototype.filter;function L$(){return Array.from(this.children)}function O$(e){return function(){return R$.call(this.children,e)}}function M$(e){return this.selectAll(e==null?L$:O$(typeof e=="function"?e:K_(e)))}function $$(e){typeof e!="function"&&(e=U_(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],a=i.length,l=r[s]=[],c,d=0;d<a;++d)(c=i[d])&&e.call(c,c.__data__,d,i)&&l.push(c);return new Vs(r,this._parents)}function q_(e){return new Array(e.length)}function D$(){return new Vs(this._enter||this._groups.map(q_),this._parents)}function jm(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}jm.prototype={constructor:jm,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 F$(e){return function(){return e}}function z$(e,t,n,r,s,i){for(var a=0,l,c=t.length,d=i.length;a<d;++a)(l=t[a])?(l.__data__=i[a],r[a]=l):n[a]=new jm(e,i[a]);for(;a<c;++a)(l=t[a])&&(s[a]=l)}function B$(e,t,n,r,s,i,a){var l,c,d=new Map,f=t.length,u=i.length,p=new Array(f),m;for(l=0;l<f;++l)(c=t[l])&&(p[l]=m=a.call(c,c.__data__,l,t)+"",d.has(m)?s[l]=c:d.set(m,c));for(l=0;l<u;++l)m=a.call(e,i[l],l,i)+"",(c=d.get(m))?(r[l]=c,c.__data__=i[l],d.delete(m)):n[l]=new jm(e,i[l]);for(l=0;l<f;++l)(c=t[l])&&d.get(p[l])===c&&(s[l]=c)}function H$(e){return e.__data__}function W$(e,t){if(!arguments.length)return Array.from(this,H$);var n=t?B$:z$,r=this._parents,s=this._groups;typeof e!="function"&&(e=F$(e));for(var i=s.length,a=new Array(i),l=new Array(i),c=new Array(i),d=0;d<i;++d){var f=r[d],u=s[d],p=u.length,m=V$(e.call(f,f&&f.__data__,d,r)),g=m.length,b=l[d]=new Array(g),v=a[d]=new Array(g),y=c[d]=new Array(p);n(f,u,b,v,y,m,t);for(var k=0,w=0,j,A;k<g;++k)if(j=b[k]){for(k>=w&&(w=k+1);!(A=v[w])&&++w<g;);j._next=A||null}}return a=new Vs(a,r),a._enter=l,a._exit=c,a}function V$(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function U$(){return new Vs(this._exit||this._groups.map(q_),this._parents)}function K$(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 q$(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,i=r.length,a=Math.min(s,i),l=new Array(s),c=0;c<a;++c)for(var d=n[c],f=r[c],u=d.length,p=l[c]=new Array(u),m,g=0;g<u;++g)(m=d[g]||f[g])&&(p[g]=m);for(;c<s;++c)l[c]=n[c];return new Vs(l,this._parents)}function Y$(){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 G$(e){e||(e=X$);function t(u,p){return u&&p?e(u.__data__,p.__data__):!u-!p}for(var n=this._groups,r=n.length,s=new Array(r),i=0;i<r;++i){for(var a=n[i],l=a.length,c=s[i]=new Array(l),d,f=0;f<l;++f)(d=a[f])&&(c[f]=d);c.sort(t)}return new Vs(s,this._parents).order()}function X$(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function J$(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Q$(){return Array.from(this)}function Z$(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length;s<i;++s){var a=r[s];if(a)return a}return null}function eD(){let e=0;for(const t of this)++e;return e}function tD(){return!this.node()}function nD(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 rD(e){return function(){this.removeAttribute(e)}}function sD(e){return function(){this.removeAttributeNS(e.space,e.local)}}function iD(e,t){return function(){this.setAttribute(e,t)}}function oD(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function aD(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function lD(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 cD(e,t){var n=jg(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?sD:rD:typeof t=="function"?n.local?lD:aD:n.local?oD:iD)(n,t))}function Y_(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function uD(e){return function(){this.style.removeProperty(e)}}function dD(e,t,n){return function(){this.style.setProperty(e,t,n)}}function fD(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?uD:typeof t=="function"?fD:dD)(e,t,n??"")):Cu(this.node(),e)}function Cu(e,t){return e.style.getPropertyValue(t)||Y_(e).getComputedStyle(e,null).getPropertyValue(t)}function hD(e){return function(){delete this[e]}}function mD(e,t){return function(){this[e]=t}}function gD(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function yD(e,t){return arguments.length>1?this.each((t==null?hD:typeof t=="function"?gD:mD)(e,t)):this.node()[e]}function G_(e){return e.trim().split(/^|\s+/)}function Sv(e){return e.classList||new X_(e)}function X_(e){this._node=e,this._names=G_(e.getAttribute("class")||"")}X_.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 J_(e,t){for(var n=Sv(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function Q_(e,t){for(var n=Sv(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function xD(e){return function(){J_(this,e)}}function wD(e){return function(){Q_(this,e)}}function bD(e,t){return function(){(t.apply(this,arguments)?J_:Q_)(this,e)}}function vD(e,t){var n=G_(e+"");if(arguments.length<2){for(var r=Sv(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?bD:t?xD:wD)(n,t))}function kD(){this.textContent=""}function SD(e){return function(){this.textContent=e}}function ND(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function jD(e){return arguments.length?this.each(e==null?kD:(typeof e=="function"?ND:SD)(e)):this.node().textContent}function CD(){this.innerHTML=""}function ED(e){return function(){this.innerHTML=e}}function _D(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function PD(e){return arguments.length?this.each(e==null?CD:(typeof e=="function"?_D:ED)(e)):this.node().innerHTML}function AD(){this.nextSibling&&this.parentNode.appendChild(this)}function ID(){return this.each(AD)}function TD(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function RD(){return this.each(TD)}function LD(e){var t=typeof e=="function"?e:W_(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function OD(){return null}function MD(e,t){var n=typeof e=="function"?e:W_(e),r=t==null?OD:typeof t=="function"?t:kv(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function $D(){var e=this.parentNode;e&&e.removeChild(this)}function DD(){return this.each($D)}function FD(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function zD(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function BD(e){return this.select(e?zD:FD)}function HD(e){return arguments.length?this.property("__data__",e):this.node().__data__}function WD(e){return function(t){e.call(this,t,this.__data__)}}function VD(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function UD(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,i;n<s;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function KD(e,t,n){return function(){var r=this.__on,s,i=WD(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 qD(e,t,n){var r=VD(e+""),s,i=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,d=l.length,f;c<d;++c)for(s=0,f=l[c];s<i;++s)if((a=r[s]).type===f.type&&a.name===f.name)return f.value}return}for(l=t?KD:UD,s=0;s<i;++s)this.each(l(r[s],t,n));return this}function Z_(e,t,n){var r=Y_(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 YD(e,t){return function(){return Z_(this,e,t)}}function GD(e,t){return function(){return Z_(this,e,t.apply(this,arguments))}}function XD(e,t){return this.each((typeof t=="function"?GD:YD)(e,t))}function*JD(){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 eP=[null];function Vs(e,t){this._groups=e,this._parents=t}function Zf(){return new Vs([[document.documentElement]],eP)}function QD(){return this}Vs.prototype=Zf.prototype={constructor:Vs,select:N$,selectAll:_$,selectChild:T$,selectChildren:M$,filter:$$,data:W$,enter:D$,exit:U$,join:K$,merge:q$,selection:QD,order:Y$,sort:G$,call:J$,nodes:Q$,node:Z$,size:eD,empty:tD,each:nD,attr:cD,style:pD,property:yD,classed:vD,text:jD,html:PD,raise:ID,lower:RD,append:LD,insert:MD,remove:DD,clone:BD,datum:HD,on:qD,dispatch:XD,[Symbol.iterator]:JD};function Ds(e){return typeof e=="string"?new Vs([[document.querySelector(e)]],[document.documentElement]):new Vs([[e]],eP)}function ZD(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Oi(e,t){if(e=ZD(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 eF={passive:!1},jf={capture:!0,passive:!1};function Hy(e){e.stopImmediatePropagation()}function pu(e){e.preventDefault(),e.stopImmediatePropagation()}function tP(e){var t=e.document.documentElement,n=Ds(e).on("dragstart.drag",pu,jf);"onselectstart"in t?n.on("selectstart.drag",pu,jf):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function nP(e,t){var n=e.document.documentElement,r=Ds(e).on("dragstart.drag",null);t&&(r.on("click.drag",pu,jf),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 sh=e=>()=>e;function Ow(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:a,y:l,dx:c,dy:d,dispatch:f}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:f}})}Ow.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function tF(e){return!e.ctrlKey&&!e.button}function nF(){return this.parentNode}function rF(e,t){return t??{x:e.x,y:e.y}}function sF(){return navigator.maxTouchPoints||"ontouchstart"in this}function rP(){var e=tF,t=nF,n=rF,r=sF,s={},i=Ng("start","drag","end"),a=0,l,c,d,f,u=0;function p(j){j.on("mousedown.drag",m).filter(r).on("touchstart.drag",v).on("touchmove.drag",y,eF).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(j,A){if(!(f||!e.call(this,j,A))){var C=w(this,t.call(this,j,A),j,A,"mouse");C&&(Ds(j.view).on("mousemove.drag",g,jf).on("mouseup.drag",b,jf),tP(j.view),Hy(j),d=!1,l=j.clientX,c=j.clientY,C("start",j))}}function g(j){if(pu(j),!d){var A=j.clientX-l,C=j.clientY-c;d=A*A+C*C>u}s.mouse("drag",j)}function b(j){Ds(j.view).on("mousemove.drag mouseup.drag",null),nP(j.view,d),pu(j),s.mouse("end",j)}function v(j,A){if(e.call(this,j,A)){var C=j.changedTouches,$=t.call(this,j,A),B=C.length,F,z;for(F=0;F<B;++F)(z=w(this,$,j,A,C[F].identifier,C[F]))&&(Hy(j),z("start",j,C[F]))}}function y(j){var A=j.changedTouches,C=A.length,$,B;for($=0;$<C;++$)(B=s[A[$].identifier])&&(pu(j),B("drag",j,A[$]))}function k(j){var A=j.changedTouches,C=A.length,$,B;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),$=0;$<C;++$)(B=s[A[$].identifier])&&(Hy(j),B("end",j,A[$]))}function w(j,A,C,$,B,F){var z=i.copy(),L=Oi(F||C,A),O,W,M;if((M=n.call(j,new Ow("beforestart",{sourceEvent:C,target:p,identifier:B,active:a,x:L[0],y:L[1],dx:0,dy:0,dispatch:z}),$))!=null)return O=M.x-L[0]||0,W=M.y-L[1]||0,function T(E,D,_){var R=L,P;switch(E){case"start":s[B]=T,P=a++;break;case"end":delete s[B],--a;case"drag":L=Oi(_||D,A),P=a;break}z.call(E,j,new Ow(E,{sourceEvent:D,subject:M,target:p,identifier:B,active:P,x:L[0]+O,y:L[1]+W,dx:L[0]-R[0],dy:L[1]-R[1],dispatch:z}),$)}}return p.filter=function(j){return arguments.length?(e=typeof j=="function"?j:sh(!!j),p):e},p.container=function(j){return arguments.length?(t=typeof j=="function"?j:sh(j),p):t},p.subject=function(j){return arguments.length?(n=typeof j=="function"?j:sh(j),p):n},p.touchable=function(j){return arguments.length?(r=typeof j=="function"?j:sh(!!j),p):r},p.on=function(){var j=i.on.apply(i,arguments);return j===i?p:j},p.clickDistance=function(j){return arguments.length?(u=(j=+j)*j,p):Math.sqrt(u)},p}function Nv(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function sP(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function ep(){}var Cf=.7,Cm=1/Cf,hu="\\s*([+-]?\\d+)\\s*",Ef="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",xo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",iF=/^#([0-9a-f]{3,8})$/,oF=new RegExp(`^rgb\\(${hu},${hu},${hu}\\)$`),aF=new RegExp(`^rgb\\(${xo},${xo},${xo}\\)$`),lF=new RegExp(`^rgba\\(${hu},${hu},${hu},${Ef}\\)$`),cF=new RegExp(`^rgba\\(${xo},${xo},${xo},${Ef}\\)$`),uF=new RegExp(`^hsl\\(${Ef},${xo},${xo}\\)$`),dF=new RegExp(`^hsla\\(${Ef},${xo},${xo},${Ef}\\)$`),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};Nv(ep,oc,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:cS,formatHex:cS,formatHex8:fF,formatHsl:pF,formatRgb:uS,toString:uS});function cS(){return this.rgb().formatHex()}function fF(){return this.rgb().formatHex8()}function pF(){return iP(this).formatHsl()}function uS(){return this.rgb().formatRgb()}function oc(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=iF.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?dS(t):n===3?new ys(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ih(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ih(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=oF.exec(e))?new ys(t[1],t[2],t[3],1):(t=aF.exec(e))?new ys(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=lF.exec(e))?ih(t[1],t[2],t[3],t[4]):(t=cF.exec(e))?ih(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=uF.exec(e))?hS(t[1],t[2]/100,t[3]/100,1):(t=dF.exec(e))?hS(t[1],t[2]/100,t[3]/100,t[4]):lS.hasOwnProperty(e)?dS(lS[e]):e==="transparent"?new ys(NaN,NaN,NaN,0):null}function dS(e){return new ys(e>>16&255,e>>8&255,e&255,1)}function ih(e,t,n,r){return r<=0&&(e=t=n=NaN),new ys(e,t,n,r)}function hF(e){return e instanceof ep||(e=oc(e)),e?(e=e.rgb(),new ys(e.r,e.g,e.b,e.opacity)):new ys}function Mw(e,t,n,r){return arguments.length===1?hF(e):new ys(e,t,n,r??1)}function ys(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Nv(ys,Mw,sP(ep,{brighter(e){return e=e==null?Cm:Math.pow(Cm,e),new ys(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Cf:Math.pow(Cf,e),new ys(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ys(Xl(this.r),Xl(this.g),Xl(this.b),Em(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:fS,formatHex:fS,formatHex8:mF,formatRgb:pS,toString:pS}));function fS(){return`#${ql(this.r)}${ql(this.g)}${ql(this.b)}`}function mF(){return`#${ql(this.r)}${ql(this.g)}${ql(this.b)}${ql((isNaN(this.opacity)?1:this.opacity)*255)}`}function pS(){const e=Em(this.opacity);return`${e===1?"rgb(":"rgba("}${Xl(this.r)}, ${Xl(this.g)}, ${Xl(this.b)}${e===1?")":`, ${e})`}`}function Em(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Xl(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ql(e){return e=Xl(e),(e<16?"0":"")+e.toString(16)}function hS(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Di(e,t,n,r)}function iP(e){if(e instanceof Di)return new Di(e.h,e.s,e.l,e.opacity);if(e instanceof ep||(e=oc(e)),!e)return new Di;if(e instanceof Di)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),a=NaN,l=i-s,c=(i+s)/2;return l?(t===i?a=(n-r)/l+(n<r)*6:n===i?a=(r-t)/l+2:a=(t-n)/l+4,l/=c<.5?i+s:2-i-s,a*=60):l=c>0&&c<1?0:a,new Di(a,l,c,e.opacity)}function gF(e,t,n,r){return arguments.length===1?iP(e):new Di(e,t,n,r??1)}function Di(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Nv(Di,gF,sP(ep,{brighter(e){return e=e==null?Cm:Math.pow(Cm,e),new Di(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Cf:Math.pow(Cf,e),new Di(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,s=2*n-r;return new ys(Wy(e>=240?e-240:e+120,s,r),Wy(e,s,r),Wy(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Di(mS(this.h),oh(this.s),oh(this.l),Em(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=Em(this.opacity);return`${e===1?"hsl(":"hsla("}${mS(this.h)}, ${oh(this.s)*100}%, ${oh(this.l)*100}%${e===1?")":`, ${e})`}`}}));function mS(e){return e=(e||0)%360,e<0?e+360:e}function oh(e){return Math.max(0,Math.min(1,e||0))}function Wy(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const jv=e=>()=>e;function yF(e,t){return function(n){return e+n*t}}function xF(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 wF(e){return(e=+e)==1?oP:function(t,n){return n-t?xF(t,n,e):jv(isNaN(t)?n:t)}}function oP(e,t){var n=t-e;return n?yF(e,n):jv(isNaN(e)?t:e)}const _m=function e(t){var n=wF(t);function r(s,i){var a=n((s=Mw(s)).r,(i=Mw(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),d=oP(s.opacity,i.opacity);return function(f){return s.r=a(f),s.g=l(f),s.b=c(f),s.opacity=d(f),s+""}}return r.gamma=e,r}(1);function bF(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 vF(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function kF(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]=Qd(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 SF(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function co(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function NF(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]=Qd(e[s],t[s]):r[s]=t[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var $w=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Vy=new RegExp($w.source,"g");function jF(e){return function(){return e}}function CF(e){return function(t){return e(t)+""}}function aP(e,t){var n=$w.lastIndex=Vy.lastIndex=0,r,s,i,a=-1,l=[],c=[];for(e=e+"",t=t+"";(r=$w.exec(e))&&(s=Vy.exec(t));)(i=s.index)>n&&(i=t.slice(n,i),l[a]?l[a]+=i:l[++a]=i),(r=r[0])===(s=s[0])?l[a]?l[a]+=s:l[++a]=s:(l[++a]=null,c.push({i:a,x:co(r,s)})),n=Vy.lastIndex;return n<t.length&&(i=t.slice(n),l[a]?l[a]+=i:l[++a]=i),l.length<2?c[0]?CF(c[0].x):jF(t):(t=c.length,function(d){for(var f=0,u;f<t;++f)l[(u=c[f]).i]=u.x(d);return l.join("")})}function Qd(e,t){var n=typeof t,r;return t==null||n==="boolean"?jv(t):(n==="number"?co:n==="string"?(r=oc(t))?(t=r,_m):aP:t instanceof oc?_m:t instanceof Date?SF:vF(t)?bF:Array.isArray(t)?kF:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?NF:co)(e,t)}var gS=180/Math.PI,Dw={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function lP(e,t,n,r,s,i){var a,l,c;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,c/=l),e*r<t*n&&(e=-e,t=-t,c=-c,a=-a),{translateX:s,translateY:i,rotate:Math.atan2(t,e)*gS,skewX:Math.atan(c)*gS,scaleX:a,scaleY:l}}var ah;function EF(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Dw:lP(t.a,t.b,t.c,t.d,t.e,t.f)}function _F(e){return e==null||(ah||(ah=document.createElementNS("http://www.w3.org/2000/svg","g")),ah.setAttribute("transform",e),!(e=ah.transform.baseVal.consolidate()))?Dw:(e=e.matrix,lP(e.a,e.b,e.c,e.d,e.e,e.f))}function cP(e,t,n,r){function s(d){return d.length?d.pop()+" ":""}function i(d,f,u,p,m,g){if(d!==u||f!==p){var b=m.push("translate(",null,t,null,n);g.push({i:b-4,x:co(d,u)},{i:b-2,x:co(f,p)})}else(u||p)&&m.push("translate("+u+t+p+n)}function a(d,f,u,p){d!==f?(d-f>180?f+=360:f-d>180&&(d+=360),p.push({i:u.push(s(u)+"rotate(",null,r)-2,x:co(d,f)})):f&&u.push(s(u)+"rotate("+f+r)}function l(d,f,u,p){d!==f?p.push({i:u.push(s(u)+"skewX(",null,r)-2,x:co(d,f)}):f&&u.push(s(u)+"skewX("+f+r)}function c(d,f,u,p,m,g){if(d!==u||f!==p){var b=m.push(s(m)+"scale(",null,",",null,")");g.push({i:b-4,x:co(d,u)},{i:b-2,x:co(f,p)})}else(u!==1||p!==1)&&m.push(s(m)+"scale("+u+","+p+")")}return function(d,f){var u=[],p=[];return d=e(d),f=e(f),i(d.translateX,d.translateY,f.translateX,f.translateY,u,p),a(d.rotate,f.rotate,u,p),l(d.skewX,f.skewX,u,p),c(d.scaleX,d.scaleY,f.scaleX,f.scaleY,u,p),d=f=null,function(m){for(var g=-1,b=p.length,v;++g<b;)u[(v=p[g]).i]=v.x(m);return u.join("")}}}var PF=cP(EF,"px, ","px)","deg)"),AF=cP(_F,", ",")",")"),IF=1e-12;function yS(e){return((e=Math.exp(e))+1/e)/2}function TF(e){return((e=Math.exp(e))-1/e)/2}function RF(e){return((e=Math.exp(2*e))-1)/(e+1)}const Hh=function e(t,n,r){function s(i,a){var l=i[0],c=i[1],d=i[2],f=a[0],u=a[1],p=a[2],m=f-l,g=u-c,b=m*m+g*g,v,y;if(b<IF)y=Math.log(p/d)/t,v=function($){return[l+$*m,c+$*g,d*Math.exp(t*$*y)]};else{var k=Math.sqrt(b),w=(p*p-d*d+r*b)/(2*d*n*k),j=(p*p-d*d-r*b)/(2*p*n*k),A=Math.log(Math.sqrt(w*w+1)-w),C=Math.log(Math.sqrt(j*j+1)-j);y=(C-A)/t,v=function($){var B=$*y,F=yS(A),z=d/(n*k)*(F*RF(t*B+A)-TF(A));return[l+z*m,c+z*g,d*F/yS(t*B+A)]}}return v.duration=y*1e3*t/Math.SQRT2,v}return s.rho=function(i){var a=Math.max(.001,+i),l=a*a,c=l*l;return e(a,l,c)},s}(Math.SQRT2,2,4);var Eu=0,Od=0,kd=0,uP=1e3,Pm,Md,Am=0,ac=0,Cg=0,_f=typeof performance=="object"&&performance.now?performance:Date,dP=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Cv(){return ac||(dP(LF),ac=_f.now()+Cg)}function LF(){ac=0}function Im(){this._call=this._time=this._next=null}Im.prototype=fP.prototype={constructor:Im,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Cv():+n)+(t==null?0:+t),!this._next&&Md!==this&&(Md?Md._next=this:Pm=this,Md=this),this._call=e,this._time=n,Fw()},stop:function(){this._call&&(this._call=null,this._time=1/0,Fw())}};function fP(e,t,n){var r=new Im;return r.restart(e,t,n),r}function OF(){Cv(),++Eu;for(var e=Pm,t;e;)(t=ac-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Eu}function xS(){ac=(Am=_f.now())+Cg,Eu=Od=0;try{OF()}finally{Eu=0,$F(),ac=0}}function MF(){var e=_f.now(),t=e-Am;t>uP&&(Cg-=t,Am=e)}function $F(){for(var e,t=Pm,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:Pm=n);Md=e,Fw(r)}function Fw(e){if(!Eu){Od&&(Od=clearTimeout(Od));var t=e-ac;t>24?(e<1/0&&(Od=setTimeout(xS,e-_f.now()-Cg)),kd&&(kd=clearInterval(kd))):(kd||(Am=_f.now(),kd=setInterval(MF,uP)),Eu=1,dP(xS))}}function wS(e,t,n){var r=new Im;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var DF=Ng("start","end","cancel","interrupt"),FF=[],pP=0,bS=1,zw=2,Wh=3,vS=4,Bw=5,Vh=6;function Eg(e,t,n,r,s,i){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;zF(e,n,{name:t,index:r,group:s,on:DF,tween:FF,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:pP})}function Ev(e,t){var n=Ki(e,t);if(n.state>pP)throw new Error("too late; already scheduled");return n}function jo(e,t){var n=Ki(e,t);if(n.state>Wh)throw new Error("too late; already running");return n}function Ki(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function zF(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=fP(i,0,n.time);function i(d){n.state=bS,n.timer.restart(a,n.delay,n.time),n.delay<=d&&a(d-n.delay)}function a(d){var f,u,p,m;if(n.state!==bS)return c();for(f in r)if(m=r[f],m.name===n.name){if(m.state===Wh)return wS(a);m.state===vS?(m.state=Vh,m.timer.stop(),m.on.call("interrupt",e,e.__data__,m.index,m.group),delete r[f]):+f<t&&(m.state=Vh,m.timer.stop(),m.on.call("cancel",e,e.__data__,m.index,m.group),delete r[f])}if(wS(function(){n.state===Wh&&(n.state=vS,n.timer.restart(l,n.delay,n.time),l(d))}),n.state=zw,n.on.call("start",e,e.__data__,n.index,n.group),n.state===zw){for(n.state=Wh,s=new Array(p=n.tween.length),f=0,u=-1;f<p;++f)(m=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(s[++u]=m);s.length=u+1}}function l(d){for(var f=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(c),n.state=Bw,1),u=-1,p=s.length;++u<p;)s[u].call(e,f);n.state===Bw&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Vh,n.timer.stop(),delete r[t];for(var d in r)return;delete e.__transition}}function Uh(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>zw&&r.state<Bw,r.state=Vh,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}i&&delete e.__transition}}function BF(e){return this.each(function(){Uh(this,e)})}function HF(e,t){var n,r;return function(){var s=jo(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 WF(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=jo(this,e),a=i.tween;if(a!==r){s=(r=a).slice();for(var l={name:t,value:n},c=0,d=s.length;c<d;++c)if(s[c].name===t){s[c]=l;break}c===d&&s.push(l)}i.tween=s}}function VF(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Ki(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?HF:WF)(n,e,t))}function _v(e,t,n){var r=e._id;return e.each(function(){var s=jo(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return Ki(s,r).value[t]}}function hP(e,t){var n;return(typeof t=="number"?co:t instanceof oc?_m:(n=oc(t))?(t=n,_m):aP)(e,t)}function UF(e){return function(){this.removeAttribute(e)}}function KF(e){return function(){this.removeAttributeNS(e.space,e.local)}}function qF(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 YF(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 GF(e,t,n){var r,s,i;return function(){var a,l=n(this),c;return l==null?void this.removeAttribute(e):(a=this.getAttribute(e),c=l+"",a===c?null:a===r&&c===s?i:(s=c,i=t(r=a,l)))}}function XF(e,t,n){var r,s,i;return function(){var a,l=n(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),c=l+"",a===c?null:a===r&&c===s?i:(s=c,i=t(r=a,l)))}}function JF(e,t){var n=jg(e),r=n==="transform"?AF:hP;return this.attrTween(e,typeof t=="function"?(n.local?XF:GF)(n,r,_v(this,"attr."+e,t)):t==null?(n.local?KF:UF)(n):(n.local?YF:qF)(n,r,t))}function QF(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function ZF(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function ez(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&ZF(e,i)),n}return s._value=t,s}function tz(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&QF(e,i)),n}return s._value=t,s}function nz(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=jg(e);return this.tween(n,(r.local?ez:tz)(r,t))}function rz(e,t){return function(){Ev(this,e).delay=+t.apply(this,arguments)}}function sz(e,t){return t=+t,function(){Ev(this,e).delay=t}}function iz(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?rz:sz)(t,e)):Ki(this.node(),t).delay}function oz(e,t){return function(){jo(this,e).duration=+t.apply(this,arguments)}}function az(e,t){return t=+t,function(){jo(this,e).duration=t}}function lz(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?oz:az)(t,e)):Ki(this.node(),t).duration}function cz(e,t){if(typeof t!="function")throw new Error;return function(){jo(this,e).ease=t}}function uz(e){var t=this._id;return arguments.length?this.each(cz(t,e)):Ki(this.node(),t).ease}function dz(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;jo(this,e).ease=n}}function fz(e){if(typeof e!="function")throw new Error;return this.each(dz(this._id,e))}function pz(e){typeof e!="function"&&(e=U_(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],a=i.length,l=r[s]=[],c,d=0;d<a;++d)(c=i[d])&&e.call(c,c.__data__,d,i)&&l.push(c);return new ra(r,this._parents,this._name,this._id)}function hz(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,i=Math.min(r,s),a=new Array(r),l=0;l<i;++l)for(var c=t[l],d=n[l],f=c.length,u=a[l]=new Array(f),p,m=0;m<f;++m)(p=c[m]||d[m])&&(u[m]=p);for(;l<r;++l)a[l]=t[l];return new ra(a,this._parents,this._name,this._id)}function mz(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 gz(e,t,n){var r,s,i=mz(t)?Ev:jo;return function(){var a=i(this,e),l=a.on;l!==r&&(s=(r=l).copy()).on(t,n),a.on=s}}function yz(e,t){var n=this._id;return arguments.length<2?Ki(this.node(),n).on.on(e):this.each(gz(n,e,t))}function xz(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function wz(){return this.on("end.remove",xz(this._id))}function bz(e){var t=this._name,n=this._id;typeof e!="function"&&(e=kv(e));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a<s;++a)for(var l=r[a],c=l.length,d=i[a]=new Array(c),f,u,p=0;p<c;++p)(f=l[p])&&(u=e.call(f,f.__data__,p,l))&&("__data__"in f&&(u.__data__=f.__data__),d[p]=u,Eg(d[p],t,n,p,d,Ki(f,n)));return new ra(i,this._parents,t,n)}function vz(e){var t=this._name,n=this._id;typeof e!="function"&&(e=V_(e));for(var r=this._groups,s=r.length,i=[],a=[],l=0;l<s;++l)for(var c=r[l],d=c.length,f,u=0;u<d;++u)if(f=c[u]){for(var p=e.call(f,f.__data__,u,c),m,g=Ki(f,n),b=0,v=p.length;b<v;++b)(m=p[b])&&Eg(m,t,n,b,p,g);i.push(p),a.push(f)}return new ra(i,a,t,n)}var kz=Zf.prototype.constructor;function Sz(){return new kz(this._groups,this._parents)}function Nz(e,t){var n,r,s;return function(){var i=Cu(this,e),a=(this.style.removeProperty(e),Cu(this,e));return i===a?null:i===n&&a===r?s:s=t(n=i,r=a)}}function mP(e){return function(){this.style.removeProperty(e)}}function jz(e,t,n){var r,s=n+"",i;return function(){var a=Cu(this,e);return a===s?null:a===r?i:i=t(r=a,n)}}function Cz(e,t,n){var r,s,i;return function(){var a=Cu(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),Cu(this,e))),a===c?null:a===r&&c===s?i:(s=c,i=t(r=a,l))}}function Ez(e,t){var n,r,s,i="style."+t,a="end."+i,l;return function(){var c=jo(this,e),d=c.on,f=c.value[i]==null?l||(l=mP(t)):void 0;(d!==n||s!==f)&&(r=(n=d).copy()).on(a,s=f),c.on=r}}function _z(e,t,n){var r=(e+="")=="transform"?PF:hP;return t==null?this.styleTween(e,Nz(e,r)).on("end.style."+e,mP(e)):typeof t=="function"?this.styleTween(e,Cz(e,r,_v(this,"style."+e,t))).each(Ez(this._id,e)):this.styleTween(e,jz(e,r,t),n).on("end.style."+e,null)}function Pz(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Az(e,t,n){var r,s;function i(){var a=t.apply(this,arguments);return a!==s&&(r=(s=a)&&Pz(e,a,n)),r}return i._value=t,i}function Iz(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,Az(e,t,n??""))}function Tz(e){return function(){this.textContent=e}}function Rz(e){return function(){var t=e(this);this.textContent=t??""}}function Lz(e){return this.tween("text",typeof e=="function"?Rz(_v(this,"text",e)):Tz(e==null?"":e+""))}function Oz(e){return function(t){this.textContent=e.call(this,t)}}function Mz(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&Oz(s)),t}return r._value=e,r}function $z(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,Mz(e))}function Dz(){for(var e=this._name,t=this._id,n=gP(),r=this._groups,s=r.length,i=0;i<s;++i)for(var a=r[i],l=a.length,c,d=0;d<l;++d)if(c=a[d]){var f=Ki(c,t);Eg(c,e,n,d,a,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new ra(r,this._parents,e,n)}function Fz(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(i,a){var l={value:a},c={value:function(){--s===0&&i()}};n.each(function(){var d=jo(this,r),f=d.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),d.on=t}),s===0&&i()})}var zz=0;function ra(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function gP(){return++zz}var Bo=Zf.prototype;ra.prototype={constructor:ra,select:bz,selectAll:vz,selectChild:Bo.selectChild,selectChildren:Bo.selectChildren,filter:pz,merge:hz,selection:Sz,transition:Dz,call:Bo.call,nodes:Bo.nodes,node:Bo.node,size:Bo.size,empty:Bo.empty,each:Bo.each,on:yz,attr:JF,attrTween:nz,style:_z,styleTween:Iz,text:Lz,textTween:$z,remove:wz,tween:VF,delay:iz,duration:lz,ease:uz,easeVarying:fz,end:Fz,[Symbol.iterator]:Bo[Symbol.iterator]};function Bz(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Hz={time:null,delay:0,duration:250,ease:Bz};function Wz(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 Vz(e){var t,n;e instanceof ra?(t=e._id,e=e._name):(t=gP(),(n=Hz).time=Cv(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var a=r[i],l=a.length,c,d=0;d<l;++d)(c=a[d])&&Eg(c,e,t,d,a,n||Wz(c,t));return new ra(r,this._parents,e,t)}Zf.prototype.interrupt=BF;Zf.prototype.transition=Vz;const lh=e=>()=>e;function Uz(e,{sourceEvent:t,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function Go(e,t,n){this.k=e,this.x=t,this.y=n}Go.prototype={constructor:Go,scale:function(e){return e===1?this:new Go(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Go(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var _g=new Go(1,0,0);yP.prototype=Go.prototype;function yP(e){for(;!e.__zoom;)if(!(e=e.parentNode))return _g;return e.__zoom}function Uy(e){e.stopImmediatePropagation()}function Sd(e){e.preventDefault(),e.stopImmediatePropagation()}function Kz(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function qz(){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 kS(){return this.__zoom||_g}function Yz(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Gz(){return navigator.maxTouchPoints||"ontouchstart"in this}function Xz(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 xP(){var e=Kz,t=qz,n=Xz,r=Yz,s=Gz,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Hh,d=Ng("start","zoom","end"),f,u,p,m=500,g=150,b=0,v=10;function y(M){M.property("__zoom",kS).on("wheel.zoom",B,{passive:!1}).on("mousedown.zoom",F).on("dblclick.zoom",z).filter(s).on("touchstart.zoom",L).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",W).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(M,T,E,D){var _=M.selection?M.selection():M;_.property("__zoom",kS),M!==_?A(M,T,E,D):_.interrupt().each(function(){C(this,arguments).event(D).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},y.scaleBy=function(M,T,E,D){y.scaleTo(M,function(){var _=this.__zoom.k,R=typeof T=="function"?T.apply(this,arguments):T;return _*R},E,D)},y.scaleTo=function(M,T,E,D){y.transform(M,function(){var _=t.apply(this,arguments),R=this.__zoom,P=E==null?j(_):typeof E=="function"?E.apply(this,arguments):E,G=R.invert(P),Z=typeof T=="function"?T.apply(this,arguments):T;return n(w(k(R,Z),P,G),_,a)},E,D)},y.translateBy=function(M,T,E,D){y.transform(M,function(){return n(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),a)},null,D)},y.translateTo=function(M,T,E,D,_){y.transform(M,function(){var R=t.apply(this,arguments),P=this.__zoom,G=D==null?j(R):typeof D=="function"?D.apply(this,arguments):D;return n(_g.translate(G[0],G[1]).scale(P.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof E=="function"?-E.apply(this,arguments):-E),R,a)},D,_)};function k(M,T){return T=Math.max(i[0],Math.min(i[1],T)),T===M.k?M:new Go(T,M.x,M.y)}function w(M,T,E){var D=T[0]-E[0]*M.k,_=T[1]-E[1]*M.k;return D===M.x&&_===M.y?M:new Go(M.k,D,_)}function j(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function A(M,T,E,D){M.on("start.zoom",function(){C(this,arguments).event(D).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(D).end()}).tween("zoom",function(){var _=this,R=arguments,P=C(_,R).event(D),G=t.apply(_,R),Z=E==null?j(G):typeof E=="function"?E.apply(_,R):E,V=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),se=_.__zoom,ue=typeof T=="function"?T.apply(_,R):T,pe=c(se.invert(Z).concat(V/se.k),ue.invert(Z).concat(V/ue.k));return function(ge){if(ge===1)ge=ue;else{var ae=pe(ge),be=V/ae[2];ge=new Go(be,Z[0]-ae[0]*be,Z[1]-ae[1]*be)}P.zoom(null,ge)}})}function C(M,T,E){return!E&&M.__zooming||new $(M,T)}function $(M,T){this.that=M,this.args=T,this.active=0,this.sourceEvent=null,this.extent=t.apply(M,T),this.taps=0}$.prototype={event:function(M){return M&&(this.sourceEvent=M),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(M,T){return this.mouse&&M!=="mouse"&&(this.mouse[1]=T.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=T.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=T.invert(this.touch1[0])),this.that.__zoom=T,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var T=Ds(this.that).datum();d.call(M,this.that,new Uz(M,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:d}),T)}};function B(M,...T){if(!e.apply(this,arguments))return;var E=C(this,T).event(M),D=this.__zoom,_=Math.max(i[0],Math.min(i[1],D.k*Math.pow(2,r.apply(this,arguments)))),R=Oi(M);if(E.wheel)(E.mouse[0][0]!==R[0]||E.mouse[0][1]!==R[1])&&(E.mouse[1]=D.invert(E.mouse[0]=R)),clearTimeout(E.wheel);else{if(D.k===_)return;E.mouse=[R,D.invert(R)],Uh(this),E.start()}Sd(M),E.wheel=setTimeout(P,g),E.zoom("mouse",n(w(k(D,_),E.mouse[0],E.mouse[1]),E.extent,a));function P(){E.wheel=null,E.end()}}function F(M,...T){if(p||!e.apply(this,arguments))return;var E=M.currentTarget,D=C(this,T,!0).event(M),_=Ds(M.view).on("mousemove.zoom",Z,!0).on("mouseup.zoom",V,!0),R=Oi(M,E),P=M.clientX,G=M.clientY;tP(M.view),Uy(M),D.mouse=[R,this.__zoom.invert(R)],Uh(this),D.start();function Z(se){if(Sd(se),!D.moved){var ue=se.clientX-P,pe=se.clientY-G;D.moved=ue*ue+pe*pe>b}D.event(se).zoom("mouse",n(w(D.that.__zoom,D.mouse[0]=Oi(se,E),D.mouse[1]),D.extent,a))}function V(se){_.on("mousemove.zoom mouseup.zoom",null),nP(se.view,D.moved),Sd(se),D.event(se).end()}}function z(M,...T){if(e.apply(this,arguments)){var E=this.__zoom,D=Oi(M.changedTouches?M.changedTouches[0]:M,this),_=E.invert(D),R=E.k*(M.shiftKey?.5:2),P=n(w(k(E,R),D,_),t.apply(this,T),a);Sd(M),l>0?Ds(this).transition().duration(l).call(A,P,D,M):Ds(this).call(y.transform,P,D,M)}}function L(M,...T){if(e.apply(this,arguments)){var E=M.touches,D=E.length,_=C(this,T,M.changedTouches.length===D).event(M),R,P,G,Z;for(Uy(M),P=0;P<D;++P)G=E[P],Z=Oi(G,this),Z=[Z,this.__zoom.invert(Z),G.identifier],_.touch0?!_.touch1&&_.touch0[2]!==Z[2]&&(_.touch1=Z,_.taps=0):(_.touch0=Z,R=!0,_.taps=1+!!f);f&&(f=clearTimeout(f)),R&&(_.taps<2&&(u=Z[0],f=setTimeout(function(){f=null},m)),Uh(this),_.start())}}function O(M,...T){if(this.__zooming){var E=C(this,T).event(M),D=M.changedTouches,_=D.length,R,P,G,Z;for(Sd(M),R=0;R<_;++R)P=D[R],G=Oi(P,this),E.touch0&&E.touch0[2]===P.identifier?E.touch0[0]=G:E.touch1&&E.touch1[2]===P.identifier&&(E.touch1[0]=G);if(P=E.that.__zoom,E.touch1){var V=E.touch0[0],se=E.touch0[1],ue=E.touch1[0],pe=E.touch1[1],ge=(ge=ue[0]-V[0])*ge+(ge=ue[1]-V[1])*ge,ae=(ae=pe[0]-se[0])*ae+(ae=pe[1]-se[1])*ae;P=k(P,Math.sqrt(ge/ae)),G=[(V[0]+ue[0])/2,(V[1]+ue[1])/2],Z=[(se[0]+pe[0])/2,(se[1]+pe[1])/2]}else if(E.touch0)G=E.touch0[0],Z=E.touch0[1];else return;E.zoom("touch",n(w(P,G,Z),E.extent,a))}}function W(M,...T){if(this.__zooming){var E=C(this,T).event(M),D=M.changedTouches,_=D.length,R,P;for(Uy(M),p&&clearTimeout(p),p=setTimeout(function(){p=null},m),R=0;R<_;++R)P=D[R],E.touch0&&E.touch0[2]===P.identifier?delete E.touch0:E.touch1&&E.touch1[2]===P.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(P=Oi(P,this),Math.hypot(u[0]-P[0],u[1]-P[1])<v)){var G=Ds(this).on("dblclick.zoom");G&&G.apply(this,arguments)}}}return y.wheelDelta=function(M){return arguments.length?(r=typeof M=="function"?M:lh(+M),y):r},y.filter=function(M){return arguments.length?(e=typeof M=="function"?M:lh(!!M),y):e},y.touchable=function(M){return arguments.length?(s=typeof M=="function"?M:lh(!!M),y):s},y.extent=function(M){return arguments.length?(t=typeof M=="function"?M:lh([[+M[0][0],+M[0][1]],[+M[1][0],+M[1][1]]]),y):t},y.scaleExtent=function(M){return arguments.length?(i[0]=+M[0],i[1]=+M[1],y):[i[0],i[1]]},y.translateExtent=function(M){return arguments.length?(a[0][0]=+M[0][0],a[1][0]=+M[1][0],a[0][1]=+M[0][1],a[1][1]=+M[1][1],y):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},y.constrain=function(M){return arguments.length?(n=M,y):n},y.duration=function(M){return arguments.length?(l=+M,y):l},y.interpolate=function(M){return arguments.length?(c=M,y):c},y.on=function(){var M=d.on.apply(d,arguments);return M===d?y:M},y.clickDistance=function(M){return arguments.length?(b=(M=+M)*M,y):Math.sqrt(b)},y.tapDistance=function(M){return arguments.length?(v=+M,y):v},y}const ko={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."},Pf=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],wP=["Enter"," ","Escape"],bP={"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 _u;(function(e){e.Strict="strict",e.Loose="loose"})(_u||(_u={}));var Jl;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Jl||(Jl={}));var Af;(function(e){e.Partial="partial",e.Full="full"})(Af||(Af={}));const vP={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Fa;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Fa||(Fa={}));var Ns;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Ns||(Ns={}));var Ye;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ye||(Ye={}));const SS={[Ye.Left]:Ye.Right,[Ye.Right]:Ye.Left,[Ye.Top]:Ye.Bottom,[Ye.Bottom]:Ye.Top};function kP(e){return e===null?null:e?"valid":"invalid"}const SP=e=>"id"in e&&"source"in e&&"target"in e,Jz=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Pv=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),tp=(e,t=[0,0])=>{const{width:n,height:r}=aa(e),s=e.origin??t,i=n*s[0],a=r*s[1];return{x:e.position.x-i,y:e.position.y-a}},Qz=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const i=typeof s=="string";let a=!t.nodeLookup&&!i?s:void 0;t.nodeLookup&&(a=i?t.nodeLookup.get(s):Pv(s)?s:t.nodeLookup.get(s.id));const l=a?Tm(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Pg(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Ag(n)},np=(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=Pg(n,Tm(s)),r=!0)}),r?Ag(n):{x:0,y:0,width:0,height:0}},Av=(e,t,[n,r,s]=[0,0,1],i=!1,a=!1)=>{const l={...sp(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const d of e.values()){const{measured:f,selectable:u=!0,hidden:p=!1}=d;if(a&&!u||p)continue;const m=f.width??d.width??d.initialWidth??null,g=f.height??d.height??d.initialHeight??null,b=If(l,Au(d)),v=(m??0)*(g??0),y=i&&b>0;(!d.internals.handleBounds||y||b>=v||d.dragging)&&c.push(d)}return c},Zz=(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 e3(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 t3({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},a){if(e.size===0)return Promise.resolve(!0);const l=e3(e,a),c=np(l),d=Iv(c,t,n,(a==null?void 0:a.minZoom)??s,(a==null?void 0:a.maxZoom)??i,(a==null?void 0:a.padding)??.1);return await r.setViewport(d,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),Promise.resolve(!0)}function NP({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:c,y:d}=l?l.internals.positionAbsolute:{x:0,y:0},f=a.origin??r;let u=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!l)i==null||i("005",ko.error005());else{const m=l.measured.width,g=l.measured.height;m&&g&&(u=[[c,d],[c+m,d+g]])}else l&&Iu(a.extent)&&(u=[[a.extent[0][0]+c,a.extent[0][1]+d],[a.extent[1][0]+c,a.extent[1][1]+d]]);const p=Iu(u)?lc(t,u,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",ko.error015())),{position:{x:p.x-c+(a.measured.width??0)*f[0],y:p.y-d+(a.measured.height??0)*f[1]},positionAbsolute:p}}async function n3({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(p=>p.id)),a=[];for(const p of n){if(p.deletable===!1)continue;const m=i.has(p.id),g=!m&&p.parentId&&a.find(b=>b.id===p.parentId);(m||g)&&a.push(p)}const l=new Set(t.map(p=>p.id)),c=r.filter(p=>p.deletable!==!1),f=Zz(a,c);for(const p of c)l.has(p.id)&&!f.find(g=>g.id===p.id)&&f.push(p);if(!s)return{edges:f,nodes:a};const u=await s({nodes:a,edges:f});return typeof u=="boolean"?u?{edges:f,nodes:a}:{edges:[],nodes:[]}:u}const Pu=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),lc=(e={x:0,y:0},t,n)=>({x:Pu(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Pu(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function jP(e,t,n){const{width:r,height:s}=aa(n),{x:i,y:a}=n.internals.positionAbsolute;return lc(e,[[i,a],[i+r,a+s]],t)}const NS=(e,t,n)=>e<t?Pu(Math.abs(e-t),1,t)/t:e>n?-Pu(Math.abs(e-n),1,t)/t:0,CP=(e,t,n=15,r=40)=>{const s=NS(e.x,r,t.width-r)*n,i=NS(e.y,r,t.height-r)*n;return[s,i]},Pg=(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)}),Hw=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Ag=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Au=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Pv(e)?e.internals.positionAbsolute:tp(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}},Tm=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Pv(e)?e.internals.positionAbsolute:tp(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)}},EP=(e,t)=>Ag(Pg(Hw(e),Hw(t))),If=(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=>Fi(e.width)&&Fi(e.height)&&Fi(e.x)&&Fi(e.y),Fi=e=>!isNaN(e)&&isFinite(e),r3=(e,t)=>{},rp=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),sp=({x:e,y:t},[n,r,s],i=!1,a=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return i?rp(l,a):l},Rm=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function Lc(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 s3(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Lc(e,n),s=Lc(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=Lc(e.top??e.y??0,n),s=Lc(e.bottom??e.y??0,n),i=Lc(e.left??e.x??0,t),a=Lc(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 i3(e,t,n,r,s,i){const{x:a,y:l}=Rm(e,[t,n,r]),{x:c,y:d}=Rm({x:e.x+e.width,y:e.y+e.height},[t,n,r]),f=s-c,u=i-d;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(f),bottom:Math.floor(u)}}const Iv=(e,t,n,r,s,i)=>{const a=s3(i,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,d=Math.min(l,c),f=Pu(d,r,s),u=e.x+e.width/2,p=e.y+e.height/2,m=t/2-u*f,g=n/2-p*f,b=i3(e,m,g,f,t,n),v={left:Math.min(b.left-a.left,0),top:Math.min(b.top-a.top,0),right:Math.min(b.right-a.right,0),bottom:Math.min(b.bottom-a.bottom,0)};return{x:m-v.left+v.right,y:g-v.top+v.bottom,zoom:f}},Tf=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Iu(e){return e!=null&&e!=="parent"}function aa(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function _P(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function PP(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 CS(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function o3(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function a3(e){return{...bP,...e||{}}}function Zd(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:a}=zi(e),l=sp({x:i-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},r),{x:c,y:d}=n?rp(l,t):l;return{xSnapped:c,ySnapped:d,...l}}const Tv=e=>({width:e.offsetWidth,height:e.offsetHeight}),AP=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},l3=["INPUT","SELECT","TEXTAREA"];function IP(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:l3.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const TP=e=>"clientX"in e,zi=(e,t)=>{var i,a;const n=TP(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)}},ES=(e,t,n,r,s)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:s,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...Tv(a)}})};function RP({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:a,targetControlY:l}){const c=e*.125+s*.375+a*.375+n*.125,d=t*.125+i*.375+l*.375+r*.125,f=Math.abs(c-e),u=Math.abs(d-t);return[c,d,f,u]}function ch(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function _S({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case Ye.Left:return[t-ch(t-r,i),n];case Ye.Right:return[t+ch(r-t,i),n];case Ye.Top:return[t,n-ch(n-s,i)];case Ye.Bottom:return[t,n+ch(s-n,i)]}}function LP({sourceX:e,sourceY:t,sourcePosition:n=Ye.Bottom,targetX:r,targetY:s,targetPosition:i=Ye.Top,curvature:a=.25}){const[l,c]=_S({pos:n,x1:e,y1:t,x2:r,y2:s,c:a}),[d,f]=_S({pos:i,x1:r,y1:s,x2:e,y2:t,c:a}),[u,p,m,g]=RP({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:f});return[`M${e},${t} C${l},${c} ${d},${f} ${r},${s}`,u,p,m,g]}function OP({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 c3({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 u3({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=Pg(Tm(e),Tm(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 If(a,Ag(i))>0}const d3=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,f3=(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)),Rf=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||d3;let s;return SP(e)?s={...e}:s={...e,id:r(e)},f3(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function MP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,a,l]=OP({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,a,l]}const PS={[Ye.Left]:{x:-1,y:0},[Ye.Right]:{x:1,y:0},[Ye.Top]:{x:0,y:-1},[Ye.Bottom]:{x:0,y:1}},p3=({source:e,sourcePosition:t=Ye.Bottom,target:n})=>t===Ye.Left||t===Ye.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},AS=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function h3({source:e,sourcePosition:t=Ye.Bottom,target:n,targetPosition:r=Ye.Top,center:s,offset:i,stepPosition:a}){const l=PS[t],c=PS[r],d={x:e.x+l.x*i,y:e.y+l.y*i},f={x:n.x+c.x*i,y:n.y+c.y*i},u=p3({source:d,sourcePosition:t,target:f}),p=u.x!==0?"x":"y",m=u[p];let g=[],b,v;const y={x:0,y:0},k={x:0,y:0},[,,w,j]=OP({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[p]*c[p]===-1){p==="x"?(b=s.x??d.x+(f.x-d.x)*a,v=s.y??(d.y+f.y)/2):(b=s.x??(d.x+f.x)/2,v=s.y??d.y+(f.y-d.y)*a);const B=[{x:b,y:d.y},{x:b,y:f.y}],F=[{x:d.x,y:v},{x:f.x,y:v}];l[p]===m?g=p==="x"?B:F:g=p==="x"?F:B}else{const B=[{x:d.x,y:f.y}],F=[{x:f.x,y:d.y}];if(p==="x"?g=l.x===m?F:B:g=l.y===m?B:F,t===r){const M=Math.abs(e[p]-n[p]);if(M<=i){const T=Math.min(i-1,i-M);l[p]===m?y[p]=(d[p]>e[p]?-1:1)*T:k[p]=(f[p]>n[p]?-1:1)*T}}if(t!==r){const M=p==="x"?"y":"x",T=l[p]===c[M],E=d[M]>f[M],D=d[M]<f[M];(l[p]===1&&(!T&&E||T&&D)||l[p]!==1&&(!T&&D||T&&E))&&(g=p==="x"?B:F)}const z={x:d.x+y.x,y:d.y+y.y},L={x:f.x+k.x,y:f.y+k.y},O=Math.max(Math.abs(z.x-g[0].x),Math.abs(L.x-g[0].x)),W=Math.max(Math.abs(z.y-g[0].y),Math.abs(L.y-g[0].y));O>=W?(b=(z.x+L.x)/2,v=g[0].y):(b=g[0].x,v=(z.y+L.y)/2)}const A={x:d.x+y.x,y:d.y+y.y},C={x:f.x+k.x,y:f.y+k.y};return[[e,...A.x!==g[0].x||A.y!==g[0].y?[A]:[],...g,...C.x!==g[g.length-1].x||C.y!==g[g.length-1].y?[C]:[],n],b,v,w,j]}function m3(e,t,n,r){const s=Math.min(AS(e,t)/2,AS(t,n)/2,r),{x:i,y:a}=t;if(e.x===i&&i===n.x||e.y===a&&a===n.y)return`L${i} ${a}`;if(e.y===a){const d=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${i+s*d},${a}Q ${i},${a} ${i},${a+s*f}`}const l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${a+s*c}Q ${i},${a} ${i+s*l},${a}`}function Ww({sourceX:e,sourceY:t,sourcePosition:n=Ye.Bottom,targetX:r,targetY:s,targetPosition:i=Ye.Top,borderRadius:a=5,centerX:l,centerY:c,offset:d=20,stepPosition:f=.5}){const[u,p,m,g,b]=h3({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:l,y:c},offset:d,stepPosition:f});let v=`M${u[0].x} ${u[0].y}`;for(let y=1;y<u.length-1;y++)v+=m3(u[y-1],u[y],u[y+1],a);return v+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[v,p,m,g,b]}function IS(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function g3(e){var u;const{sourceNode:t,targetNode:n}=e;if(!IS(t)||!IS(n))return null;const r=t.internals.handleBounds||TS(t.handles),s=n.internals.handleBounds||TS(n.handles),i=RS((r==null?void 0:r.source)??[],e.sourceHandle),a=RS(e.connectionMode===_u.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!i||!a)return(u=e.onError)==null||u.call(e,"008",ko.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||Ye.Bottom,c=(a==null?void 0:a.position)||Ye.Top,d=cc(t,i,l),f=cc(n,a,c);return{sourceX:d.x,sourceY:d.y,targetX:f.x,targetY:f.y,sourcePosition:l,targetPosition:c}}function TS(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 cc(e,t,n=Ye.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??aa(e);if(r)return{x:s+a/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case Ye.Top:return{x:s+a/2,y:i};case Ye.Right:return{x:s+a,y:i+l/2};case Ye.Bottom:return{x:s+a/2,y:i+l};case Ye.Left:return{x:s,y:i+l/2}}}function RS(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Vw(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function y3(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((a,l)=>([l.markerStart||r,l.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const d=Vw(c,t);i.has(d)||(a.push({id:d,color:c.color||n,...c}),i.add(d))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const $P=1e3,x3=10,Rv={nodeOrigin:[0,0],nodeExtent:Pf,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},w3={...Rv,checkEquality:!0};function Lv(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function b3(e,t,n){const r=Lv(Rv,n);for(const s of e.values())if(s.parentId)Mv(s,e,t,r);else{const i=tp(s,r.nodeOrigin),a=Iu(s.extent)?s.extent:r.nodeExtent,l=lc(i,a,aa(s));s.internals.positionAbsolute=l}}function v3(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){const i={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(i):s.type==="target"&&r.push(i)}return{source:n,target:r}}function Ov(e){return e==="manual"}function Uw(e,t,n,r={}){var f,u;const s=Lv(w3,r),i={i:0},a=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!Ov(s.zIndexMode)?$P:0;let c=e.length>0,d=!1;t.clear(),n.clear();for(const p of e){let m=a.get(p.id);if(s.checkEquality&&p===(m==null?void 0:m.internals.userNode))t.set(p.id,m);else{const g=tp(p,s.nodeOrigin),b=Iu(p.extent)?p.extent:s.nodeExtent,v=lc(g,b,aa(p));m={...s.defaults,...p,measured:{width:(f=p.measured)==null?void 0:f.width,height:(u=p.measured)==null?void 0:u.height},internals:{positionAbsolute:v,handleBounds:v3(p,m),z:DP(p,l,s.zIndexMode),userNode:p}},t.set(p.id,m)}(m.measured===void 0||m.measured.width===void 0||m.measured.height===void 0)&&!m.hidden&&(c=!1),p.parentId&&Mv(m,t,n,r,i),d||(d=p.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:d}}function k3(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function Mv(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=Lv(Rv,r),d=e.parentId,f=t.get(d);if(!f){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}k3(e,n),s&&!f.parentId&&f.internals.rootParentIndex===void 0&&c==="auto"&&(f.internals.rootParentIndex=++s.i,f.internals.z=f.internals.z+s.i*x3),s&&f.internals.rootParentIndex!==void 0&&(s.i=f.internals.rootParentIndex);const u=i&&!Ov(c)?$P:0,{x:p,y:m,z:g}=S3(e,f,a,l,u,c),{positionAbsolute:b}=e.internals,v=p!==b.x||m!==b.y;(v||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:v?{x:p,y:m}:b,z:g}})}function DP(e,t,n){const r=Fi(e.zIndex)?e.zIndex:0;return Ov(n)?r:r+(e.selected?t:0)}function S3(e,t,n,r,s,i){const{x:a,y:l}=t.internals.positionAbsolute,c=aa(e),d=tp(e,n),f=Iu(e.extent)?lc(d,e.extent,c):d;let u=lc({x:a+f.x,y:l+f.y},r,c);e.extent==="parent"&&(u=jP(u,c,t));const p=DP(e,s,i),m=t.internals.z??0;return{x:u.x,y:u.y,z:m>=p?m+1:p}}function $v(e,t,n,r=[0,0]){var a;const s=[],i=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const d=((a=i.get(l.parentId))==null?void 0:a.expandedRect)??Au(c),f=EP(d,l.rect);i.set(l.parentId,{expandedRect:f,parent:c})}return i.size>0&&i.forEach(({expandedRect:l,parent:c},d)=>{var w;const f=c.internals.positionAbsolute,u=aa(c),p=c.origin??r,m=l.x<f.x?Math.round(Math.abs(f.x-l.x)):0,g=l.y<f.y?Math.round(Math.abs(f.y-l.y)):0,b=Math.max(u.width,Math.round(l.width)),v=Math.max(u.height,Math.round(l.height)),y=(b-u.width)*p[0],k=(v-u.height)*p[1];(m>0||g>0||y||k)&&(s.push({id:d,type:"position",position:{x:c.position.x-m+y,y:c.position.y-g+k}}),(w=n.get(d))==null||w.forEach(j=>{e.some(A=>A.id===j.id)||s.push({id:j.id,type:"position",position:{x:j.position.x+m,y:j.position.y+g}})})),(u.width<l.width||u.height<l.height||m||g)&&s.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:b+(m?p[0]*m-y:0),height:v+(g?p[1]*g-k:0)}})}),s}function N3(e,t,n,r,s,i,a){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const d=[],f=window.getComputedStyle(l),{m22:u}=new window.DOMMatrixReadOnly(f.transform),p=[];for(const m of e.values()){const g=t.get(m.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const b=Tv(m.nodeElement),v=g.measured.width!==b.width||g.measured.height!==b.height;if(!!(b.width&&b.height&&(v||!g.internals.handleBounds||m.force))){const k=m.nodeElement.getBoundingClientRect(),w=Iu(g.extent)?g.extent:i;let{positionAbsolute:j}=g.internals;g.parentId&&g.extent==="parent"?j=jP(j,b,t.get(g.parentId)):w&&(j=lc(j,w,b));const A={...g,measured:b,internals:{...g.internals,positionAbsolute:j,handleBounds:{source:ES("source",m.nodeElement,k,u,g.id),target:ES("target",m.nodeElement,k,u,g.id)}}};t.set(g.id,A),g.parentId&&Mv(A,t,n,{nodeOrigin:s,zIndexMode:a}),c=!0,v&&(d.push({id:g.id,type:"dimensions",dimensions:b}),g.expandParent&&g.parentId&&p.push({id:g.id,parentId:g.parentId,rect:Au(A,s)}))}}if(p.length>0){const m=$v(p,t,n,s);d.push(...m)}return{changes:d,updatedInternals:c}}async function j3({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 LS(e,t,n,r,s,i){let a=s;const l=r.get(a)||new Map;r.set(a,l.set(n,t)),a=`${s}-${e}`;const c=r.get(a)||new Map;if(r.set(a,c.set(n,t)),i){a=`${s}-${e}-${i}`;const d=r.get(a)||new Map;r.set(a,d.set(n,t))}}function FP(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:a=null,targetHandle:l=null}=r,c={edgeId:r.id,source:s,target:i,sourceHandle:a,targetHandle:l},d=`${s}-${a}--${i}-${l}`,f=`${i}-${l}--${s}-${a}`;LS("source",c,f,e,s,a),LS("target",c,d,e,i,l),t.set(r.id,r)}}function zP(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:zP(n,t):!1}function OS(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 C3(e,t,n,r){const s=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!zP(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 Ky({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,l,c;const s=[];for(const[d,f]of t){const u=(a=n.get(d))==null?void 0:a.internals.userNode;u&&s.push({...u,position:f.position,dragging:r})}if(!e)return[s[0],s];const i=(l=n.get(e))==null?void 0:l.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:s[0],s]}function E3({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=rp(i,t);return{x:a.x-i.x,y:a.y-i.y}}function _3({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},a=0,l=new Map,c=!1,d={x:0,y:0},f=null,u=!1,p=null,m=!1,g=!1,b=null;function v({noDragClassName:k,handleSelector:w,domNode:j,isSelectable:A,nodeId:C,nodeClickDistance:$=0}){p=Ds(j);function B({x:O,y:W}){const{nodeLookup:M,nodeExtent:T,snapGrid:E,snapToGrid:D,nodeOrigin:_,onNodeDrag:R,onSelectionDrag:P,onError:G,updateNodePositions:Z}=t();i={x:O,y:W};let V=!1;const se=l.size>1,ue=se&&T?Hw(np(l)):null,pe=se&&D?E3({dragItems:l,snapGrid:E,x:O,y:W}):null;for(const[ge,ae]of l){if(!M.has(ge))continue;let be={x:O-ae.distance.x,y:W-ae.distance.y};D&&(be=pe?{x:Math.round(be.x+pe.x),y:Math.round(be.y+pe.y)}:rp(be,E));let Pe=null;if(se&&T&&!ae.extent&&ue){const{positionAbsolute:Ie}=ae.internals,st=Ie.x-ue.x+T[0][0],ct=Ie.x+ae.measured.width-ue.x2+T[1][0],et=Ie.y-ue.y+T[0][1],Et=Ie.y+ae.measured.height-ue.y2+T[1][1];Pe=[[st,et],[ct,Et]]}const{position:we,positionAbsolute:_e}=NP({nodeId:ge,nextPosition:be,nodeLookup:M,nodeExtent:Pe||T,nodeOrigin:_,onError:G});V=V||ae.position.x!==we.x||ae.position.y!==we.y,ae.position=we,ae.internals.positionAbsolute=_e}if(g=g||V,!!V&&(Z(l,!0),b&&(r||R||!C&&P))){const[ge,ae]=Ky({nodeId:C,dragItems:l,nodeLookup:M});r==null||r(b,l,ge,ae),R==null||R(b,ge,ae),C||P==null||P(b,ae)}}async function F(){if(!f)return;const{transform:O,panBy:W,autoPanSpeed:M,autoPanOnNodeDrag:T}=t();if(!T){c=!1,cancelAnimationFrame(a);return}const[E,D]=CP(d,f,M);(E!==0||D!==0)&&(i.x=(i.x??0)-E/O[2],i.y=(i.y??0)-D/O[2],await W({x:E,y:D})&&B(i)),a=requestAnimationFrame(F)}function z(O){var se;const{nodeLookup:W,multiSelectionActive:M,nodesDraggable:T,transform:E,snapGrid:D,snapToGrid:_,selectNodesOnDrag:R,onNodeDragStart:P,onSelectionDragStart:G,unselectNodesAndEdges:Z}=t();u=!0,(!R||!A)&&!M&&C&&((se=W.get(C))!=null&&se.selected||Z()),A&&R&&C&&(e==null||e(C));const V=Zd(O.sourceEvent,{transform:E,snapGrid:D,snapToGrid:_,containerBounds:f});if(i=V,l=C3(W,T,V,C),l.size>0&&(n||P||!C&&G)){const[ue,pe]=Ky({nodeId:C,dragItems:l,nodeLookup:W});n==null||n(O.sourceEvent,l,ue,pe),P==null||P(O.sourceEvent,ue,pe),C||G==null||G(O.sourceEvent,pe)}}const L=rP().clickDistance($).on("start",O=>{const{domNode:W,nodeDragThreshold:M,transform:T,snapGrid:E,snapToGrid:D}=t();f=(W==null?void 0:W.getBoundingClientRect())||null,m=!1,g=!1,b=O.sourceEvent,M===0&&z(O),i=Zd(O.sourceEvent,{transform:T,snapGrid:E,snapToGrid:D,containerBounds:f}),d=zi(O.sourceEvent,f)}).on("drag",O=>{const{autoPanOnNodeDrag:W,transform:M,snapGrid:T,snapToGrid:E,nodeDragThreshold:D,nodeLookup:_}=t(),R=Zd(O.sourceEvent,{transform:M,snapGrid:T,snapToGrid:E,containerBounds:f});if(b=O.sourceEvent,(O.sourceEvent.type==="touchmove"&&O.sourceEvent.touches.length>1||C&&!_.has(C))&&(m=!0),!m){if(!c&&W&&u&&(c=!0,F()),!u){const P=zi(O.sourceEvent,f),G=P.x-d.x,Z=P.y-d.y;Math.sqrt(G*G+Z*Z)>D&&z(O)}(i.x!==R.xSnapped||i.y!==R.ySnapped)&&l&&u&&(d=zi(O.sourceEvent,f),B(R))}}).on("end",O=>{if(!(!u||m)&&(c=!1,u=!1,cancelAnimationFrame(a),l.size>0)){const{nodeLookup:W,updateNodePositions:M,onNodeDragStop:T,onSelectionDragStop:E}=t();if(g&&(M(l,!1),g=!1),s||T||!C&&E){const[D,_]=Ky({nodeId:C,dragItems:l,nodeLookup:W,dragging:!1});s==null||s(O.sourceEvent,l,D,_),T==null||T(O.sourceEvent,D,_),C||E==null||E(O.sourceEvent,_)}}}).filter(O=>{const W=O.target;return!O.button&&(!k||!OS(W,`.${k}`,j))&&(!w||OS(W,w,j))});p.call(L)}function y(){p==null||p.on(".drag",null)}return{update:v,destroy:y}}function P3(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())If(s,Au(i))>0&&r.push(i);return r}const A3=250;function I3(e,t,n,r){var l,c;let s=[],i=1/0;const a=P3(e,n,t+A3);for(const d of a){const f=[...((l=d.internals.handleBounds)==null?void 0:l.source)??[],...((c=d.internals.handleBounds)==null?void 0:c.target)??[]];for(const u of f){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:p,y:m}=cc(d,u,u.position,!0),g=Math.sqrt(Math.pow(p-e.x,2)+Math.pow(m-e.y,2));g>t||(g<i?(s=[{...u,x:p,y:m}],i=g):g===i&&s.push({...u,x:p,y:m}))}}if(!s.length)return null;if(s.length>1){const d=r.type==="source"?"target":"source";return s.find(f=>f.type===d)??s[0]}return s[0]}function BP(e,t,n,r,s,i=!1){var d,f,u;const a=r.get(e);if(!a)return null;const l=s==="strict"?(d=a.internals.handleBounds)==null?void 0:d[t]:[...((f=a.internals.handleBounds)==null?void 0:f.source)??[],...((u=a.internals.handleBounds)==null?void 0:u.target)??[]],c=(n?l==null?void 0:l.find(p=>p.id===n):l==null?void 0:l[0])??null;return c&&i?{...c,...cc(a,c,c.position,!0)}:c}function HP(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function T3(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const WP=()=>!0;function R3(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:a,domNode:l,nodeLookup:c,lib:d,autoPanOnConnect:f,flowId:u,panBy:p,cancelConnection:m,onConnectStart:g,onConnect:b,onConnectEnd:v,isValidConnection:y=WP,onReconnectEnd:k,updateConnection:w,getTransform:j,getFromHandle:A,autoPanSpeed:C,dragThreshold:$=1,handleDomNode:B}){const F=AP(e.target);let z=0,L;const{x:O,y:W}=zi(e),M=HP(i,B),T=l==null?void 0:l.getBoundingClientRect();let E=!1;if(!T||!M)return;const D=BP(s,M,r,c,t);if(!D)return;let _=zi(e,T),R=!1,P=null,G=!1,Z=null;function V(){if(!f||!T)return;const[we,_e]=CP(_,T,C);p({x:we,y:_e}),z=requestAnimationFrame(V)}const se={...D,nodeId:s,type:M,position:D.position},ue=c.get(s);let ge={inProgress:!0,isValid:null,from:cc(ue,se,Ye.Left,!0),fromHandle:se,fromPosition:se.position,fromNode:ue,to:_,toHandle:null,toPosition:SS[se.position],toNode:null,pointer:_};function ae(){E=!0,w(ge),g==null||g(e,{nodeId:s,handleId:r,handleType:M})}$===0&&ae();function be(we){if(!E){const{x:Et,y:Ue}=zi(we),St=Et-O,tn=Ue-W;if(!(St*St+tn*tn>$*$))return;ae()}if(!A()||!se){Pe(we);return}const _e=j();_=zi(we,T),L=I3(sp(_,_e,!1,[1,1]),n,c,se),R||(V(),R=!0);const Ie=VP(we,{handle:L,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:a?"target":"source",isValidConnection:y,doc:F,lib:d,flowId:u,nodeLookup:c});Z=Ie.handleDomNode,P=Ie.connection,G=T3(!!L,Ie.isValid);const st=c.get(s),ct=st?cc(st,se,Ye.Left,!0):ge.from,et={...ge,from:ct,isValid:G,to:Ie.toHandle&&G?Rm({x:Ie.toHandle.x,y:Ie.toHandle.y},_e):_,toHandle:Ie.toHandle,toPosition:G&&Ie.toHandle?Ie.toHandle.position:SS[se.position],toNode:Ie.toHandle?c.get(Ie.toHandle.nodeId):null,pointer:_};w(et),ge=et}function Pe(we){if(!("touches"in we&&we.touches.length>0)){if(E){(L||Z)&&P&&G&&(b==null||b(P));const{inProgress:_e,...Ie}=ge,st={...Ie,toPosition:ge.toHandle?ge.toPosition:null};v==null||v(we,st),i&&(k==null||k(we,st))}m(),cancelAnimationFrame(z),R=!1,G=!1,P=null,Z=null,F.removeEventListener("mousemove",be),F.removeEventListener("mouseup",Pe),F.removeEventListener("touchmove",be),F.removeEventListener("touchend",Pe)}}F.addEventListener("mousemove",be),F.addEventListener("mouseup",Pe),F.addEventListener("touchmove",be),F.addEventListener("touchend",Pe)}function VP(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:a,lib:l,flowId:c,isValidConnection:d=WP,nodeLookup:f}){const u=i==="target",p=t?a.querySelector(`.${l}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:m,y:g}=zi(e),b=a.elementFromPoint(m,g),v=b!=null&&b.classList.contains(`${l}-flow__handle`)?b:p,y={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const k=HP(void 0,v),w=v.getAttribute("data-nodeid"),j=v.getAttribute("data-handleid"),A=v.classList.contains("connectable"),C=v.classList.contains("connectableend");if(!w||!k)return y;const $={source:u?w:r,sourceHandle:u?j:s,target:u?r:w,targetHandle:u?s:j};y.connection=$;const F=A&&C&&(n===_u.Strict?u&&k==="source"||!u&&k==="target":w!==r||j!==s);y.isValid=F&&d($),y.toHandle=BP(w,k,j,f,n,!0)}return y}const Kw={onPointerDown:R3,isValid:VP};function L3({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=Ds(e);function i({translateExtent:l,width:c,height:d,zoomStep:f=1,pannable:u=!0,zoomable:p=!0,inversePan:m=!1}){const g=w=>{if(w.sourceEvent.type!=="wheel"||!t)return;const j=n(),A=w.sourceEvent.ctrlKey&&Tf()?10:1,C=-w.sourceEvent.deltaY*(w.sourceEvent.deltaMode===1?.05:w.sourceEvent.deltaMode?1:.002)*f,$=j[2]*Math.pow(2,C*A);t.scaleTo($)};let b=[0,0];const v=w=>{(w.sourceEvent.type==="mousedown"||w.sourceEvent.type==="touchstart")&&(b=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY])},y=w=>{const j=n();if(w.sourceEvent.type!=="mousemove"&&w.sourceEvent.type!=="touchmove"||!t)return;const A=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY],C=[A[0]-b[0],A[1]-b[1]];b=A;const $=r()*Math.max(j[2],Math.log(j[2]))*(m?-1:1),B={x:j[0]-C[0]*$,y:j[1]-C[1]*$},F=[[0,0],[c,d]];t.setViewportConstrained({x:B.x,y:B.y,zoom:j[2]},F,l)},k=xP().on("start",v).on("zoom",u?y:null).on("zoom.wheel",p?g:null);s.call(k,{})}function a(){s.on("zoom",null)}return{update:i,destroy:a,pointer:Oi}}const Ig=e=>({x:e.x,y:e.y,zoom:e.k}),qy=({x:e,y:t,zoom:n})=>_g.translate(e,t).scale(n),nu=(e,t)=>e.target.closest(`.${t}`),UP=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),O3=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Yy=(e,t=0,n=O3,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},KP=e=>{const t=e.ctrlKey&&Tf()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function M3({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:d}){return f=>{if(nu(f,t))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(f.ctrlKey&&a){const v=Oi(f),y=KP(f),k=u*Math.pow(2,y);r.scaleTo(n,k,v,f);return}const p=f.deltaMode===1?20:1;let m=s===Jl.Vertical?0:f.deltaX*p,g=s===Jl.Horizontal?0:f.deltaY*p;!Tf()&&f.shiftKey&&s!==Jl.Vertical&&(m=f.deltaY*p,g=0),r.translateBy(n,-(m/u)*i,-(g/u)*i,{internal:!0});const b=Ig(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(f,b),e.panScrollTimeout=setTimeout(()=>{d==null||d(f,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(f,b))}}function $3({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",a=!t&&i&&!r.ctrlKey,l=nu(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,s)}}function D3({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,a,l;if((i=r.sourceEvent)!=null&&i.internal)return;const s=Ig(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 F3({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var a,l;e.usedRightMouseButton=!!(n&&UP(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,Ig(i.transform)))}}function z3({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&&UP(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=Ig(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,c)},n?150:0)}}}function B3({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:f}){return u=>{var v;const p=e||t,m=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(nu(u,`${d}-flow__node`)||nu(u,`${d}-flow__edge`)))return!0;if(!r&&!p&&!s&&!i&&!n||a||f&&!g||nu(u,l)&&g||nu(u,c)&&(!g||s&&g&&!e)||!n&&u.ctrlKey&&g)return!1;if(!n&&u.type==="touchstart"&&((v=u.touches)==null?void 0:v.length)>1)return u.preventDefault(),!1;if(!p&&!s&&!m&&g||!r&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(r)&&!r.includes(u.button)&&u.type==="mousedown")return!1;const b=Array.isArray(r)&&r.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&b}}function H3({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),u=xP().scaleExtent([t,n]).translateExtent(r),p=Ds(e).call(u);k({x:s.x,y:s.y,zoom:Pu(s.zoom,t,n)},[[0,0],[f.width,f.height]],r);const m=p.on("wheel.zoom"),g=p.on("dblclick.zoom");u.wheelDelta(KP);function b(L,O){return p?new Promise(W=>{u==null||u.interpolate((O==null?void 0:O.interpolate)==="linear"?Qd:Hh).transform(Yy(p,O==null?void 0:O.duration,O==null?void 0:O.ease,()=>W(!0)),L)}):Promise.resolve(!1)}function v({noWheelClassName:L,noPanClassName:O,onPaneContextMenu:W,userSelectionActive:M,panOnScroll:T,panOnDrag:E,panOnScrollMode:D,panOnScrollSpeed:_,preventScrolling:R,zoomOnPinch:P,zoomOnScroll:G,zoomOnDoubleClick:Z,zoomActivationKeyPressed:V,lib:se,onTransformChange:ue,connectionInProgress:pe,paneClickDistance:ge,selectionOnDrag:ae}){M&&!d.isZoomingOrPanning&&y();const be=T&&!V&&!M;u.clickDistance(ae?1/0:!Fi(ge)||ge<0?0:ge);const Pe=be?M3({zoomPanValues:d,noWheelClassName:L,d3Selection:p,d3Zoom:u,panOnScrollMode:D,panOnScrollSpeed:_,zoomOnPinch:P,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:l}):$3({noWheelClassName:L,preventScrolling:R,d3ZoomHandler:m});if(p.on("wheel.zoom",Pe,{passive:!1}),!M){const _e=D3({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:a});u.on("start",_e);const Ie=F3({zoomPanValues:d,panOnDrag:E,onPaneContextMenu:!!W,onPanZoom:i,onTransformChange:ue});u.on("zoom",Ie);const st=z3({zoomPanValues:d,panOnDrag:E,panOnScroll:T,onPaneContextMenu:W,onPanZoomEnd:l,onDraggingChange:c});u.on("end",st)}const we=B3({zoomActivationKeyPressed:V,panOnDrag:E,zoomOnScroll:G,panOnScroll:T,zoomOnDoubleClick:Z,zoomOnPinch:P,userSelectionActive:M,noPanClassName:O,noWheelClassName:L,lib:se,connectionInProgress:pe});u.filter(we),Z?p.on("dblclick.zoom",g):p.on("dblclick.zoom",null)}function y(){u.on("zoom",null)}async function k(L,O,W){const M=qy(L),T=u==null?void 0:u.constrain()(M,O,W);return T&&await b(T),new Promise(E=>E(T))}async function w(L,O){const W=qy(L);return await b(W,O),new Promise(M=>M(W))}function j(L){if(p){const O=qy(L),W=p.property("__zoom");(W.k!==L.zoom||W.x!==L.x||W.y!==L.y)&&(u==null||u.transform(p,O,null,{sync:!0}))}}function A(){const L=p?yP(p.node()):{x:0,y:0,k:1};return{x:L.x,y:L.y,zoom:L.k}}function C(L,O){return p?new Promise(W=>{u==null||u.interpolate((O==null?void 0:O.interpolate)==="linear"?Qd:Hh).scaleTo(Yy(p,O==null?void 0:O.duration,O==null?void 0:O.ease,()=>W(!0)),L)}):Promise.resolve(!1)}function $(L,O){return p?new Promise(W=>{u==null||u.interpolate((O==null?void 0:O.interpolate)==="linear"?Qd:Hh).scaleBy(Yy(p,O==null?void 0:O.duration,O==null?void 0:O.ease,()=>W(!0)),L)}):Promise.resolve(!1)}function B(L){u==null||u.scaleExtent(L)}function F(L){u==null||u.translateExtent(L)}function z(L){const O=!Fi(L)||L<0?0:L;u==null||u.clickDistance(O)}return{update:v,destroy:y,setViewport:w,setViewportConstrained:k,getViewport:A,scaleTo:C,scaleBy:$,setScaleExtent:B,setTranslateExtent:F,syncViewport:j,setClickDistance:z}}var Tu;(function(e){e.Line="line",e.Handle="handle"})(Tu||(Tu={}));function W3({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const a=e-t,l=n-r,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&s&&(c[0]=c[0]*-1),l&&i&&(c[1]=c[1]*-1),c}function MS(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 Pa(e,t){return Math.max(0,t-e)}function Aa(e,t){return Math.max(0,e-t)}function uh(e,t,n){return Math.max(0,t-e,e-n)}function $S(e,t){return e?!t:t}function V3(e,t,n,r,s,i,a,l){let{affectsX:c,affectsY:d}=t;const{isHorizontal:f,isVertical:u}=t,p=f&&u,{xSnapped:m,ySnapped:g}=n,{minWidth:b,maxWidth:v,minHeight:y,maxHeight:k}=r,{x:w,y:j,width:A,height:C,aspectRatio:$}=e;let B=Math.floor(f?m-e.pointerX:0),F=Math.floor(u?g-e.pointerY:0);const z=A+(c?-B:B),L=C+(d?-F:F),O=-i[0]*A,W=-i[1]*C;let M=uh(z,b,v),T=uh(L,y,k);if(a){let _=0,R=0;c&&B<0?_=Pa(w+B+O,a[0][0]):!c&&B>0&&(_=Aa(w+z+O,a[1][0])),d&&F<0?R=Pa(j+F+W,a[0][1]):!d&&F>0&&(R=Aa(j+L+W,a[1][1])),M=Math.max(M,_),T=Math.max(T,R)}if(l){let _=0,R=0;c&&B>0?_=Aa(w+B,l[0][0]):!c&&B<0&&(_=Pa(w+z,l[1][0])),d&&F>0?R=Aa(j+F,l[0][1]):!d&&F<0&&(R=Pa(j+L,l[1][1])),M=Math.max(M,_),T=Math.max(T,R)}if(s){if(f){const _=uh(z/$,y,k)*$;if(M=Math.max(M,_),a){let R=0;!c&&!d||c&&!d&&p?R=Aa(j+W+z/$,a[1][1])*$:R=Pa(j+W+(c?B:-B)/$,a[0][1])*$,M=Math.max(M,R)}if(l){let R=0;!c&&!d||c&&!d&&p?R=Pa(j+z/$,l[1][1])*$:R=Aa(j+(c?B:-B)/$,l[0][1])*$,M=Math.max(M,R)}}if(u){const _=uh(L*$,b,v)/$;if(T=Math.max(T,_),a){let R=0;!c&&!d||d&&!c&&p?R=Aa(w+L*$+O,a[1][0])/$:R=Pa(w+(d?F:-F)*$+O,a[0][0])/$,T=Math.max(T,R)}if(l){let R=0;!c&&!d||d&&!c&&p?R=Pa(w+L*$,l[1][0])/$:R=Aa(w+(d?F:-F)*$,l[0][0])/$,T=Math.max(T,R)}}}F=F+(F<0?T:-T),B=B+(B<0?M:-M),s&&(p?z>L*$?F=($S(c,d)?-B:B)/$:B=($S(c,d)?-F:F)*$:f?(F=B/$,d=c):(B=F*$,c=d));const E=c?w+B:w,D=d?j+F:j;return{width:A+(c?-B:B),height:C+(d?-F:F),x:i[0]*B*(c?-1:1)+E,y:i[1]*F*(d?-1:1)+D}}const qP={width:0,height:0,x:0,y:0},U3={...qP,pointerX:0,pointerY:0,aspectRatio:1};function K3(e){return[[0,0],[e.measured.width,e.measured.height]]}function q3(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,l=n[0]*i,c=n[1]*a;return[[r-l,s-c],[r+i-l,s+a-c]]}function Y3({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=Ds(e);let a={controlDirection:MS("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:d,boundaries:f,keepAspectRatio:u,resizeDirection:p,onResizeStart:m,onResize:g,onResizeEnd:b,shouldResize:v}){let y={...qP},k={...U3};a={boundaries:f,resizeDirection:p,keepAspectRatio:u,controlDirection:MS(d)};let w,j=null,A=[],C,$,B,F=!1;const z=rP().on("start",L=>{const{nodeLookup:O,transform:W,snapGrid:M,snapToGrid:T,nodeOrigin:E,paneDomNode:D}=n();if(w=O.get(t),!w)return;j=(D==null?void 0:D.getBoundingClientRect())??null;const{xSnapped:_,ySnapped:R}=Zd(L.sourceEvent,{transform:W,snapGrid:M,snapToGrid:T,containerBounds:j});y={width:w.measured.width??0,height:w.measured.height??0,x:w.position.x??0,y:w.position.y??0},k={...y,pointerX:_,pointerY:R,aspectRatio:y.width/y.height},C=void 0,w.parentId&&(w.extent==="parent"||w.expandParent)&&(C=O.get(w.parentId),$=C&&w.extent==="parent"?K3(C):void 0),A=[],B=void 0;for(const[P,G]of O)if(G.parentId===t&&(A.push({id:P,position:{...G.position},extent:G.extent}),G.extent==="parent"||G.expandParent)){const Z=q3(G,w,G.origin??E);B?B=[[Math.min(Z[0][0],B[0][0]),Math.min(Z[0][1],B[0][1])],[Math.max(Z[1][0],B[1][0]),Math.max(Z[1][1],B[1][1])]]:B=Z}m==null||m(L,{...y})}).on("drag",L=>{const{transform:O,snapGrid:W,snapToGrid:M,nodeOrigin:T}=n(),E=Zd(L.sourceEvent,{transform:O,snapGrid:W,snapToGrid:M,containerBounds:j}),D=[];if(!w)return;const{x:_,y:R,width:P,height:G}=y,Z={},V=w.origin??T,{width:se,height:ue,x:pe,y:ge}=V3(k,a.controlDirection,E,a.boundaries,a.keepAspectRatio,V,$,B),ae=se!==P,be=ue!==G,Pe=pe!==_&&ae,we=ge!==R&&be;if(!Pe&&!we&&!ae&&!be)return;if((Pe||we||V[0]===1||V[1]===1)&&(Z.x=Pe?pe:y.x,Z.y=we?ge:y.y,y.x=Z.x,y.y=Z.y,A.length>0)){const ct=pe-_,et=ge-R;for(const Et of A)Et.position={x:Et.position.x-ct+V[0]*(se-P),y:Et.position.y-et+V[1]*(ue-G)},D.push(Et)}if((ae||be)&&(Z.width=ae&&(!a.resizeDirection||a.resizeDirection==="horizontal")?se:y.width,Z.height=be&&(!a.resizeDirection||a.resizeDirection==="vertical")?ue:y.height,y.width=Z.width,y.height=Z.height),C&&w.expandParent){const ct=V[0]*(Z.width??0);Z.x&&Z.x<ct&&(y.x=ct,k.x=k.x-(Z.x-ct));const et=V[1]*(Z.height??0);Z.y&&Z.y<et&&(y.y=et,k.y=k.y-(Z.y-et))}const _e=W3({width:y.width,prevWidth:P,height:y.height,prevHeight:G,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),Ie={...y,direction:_e};(v==null?void 0:v(L,Ie))!==!1&&(F=!0,g==null||g(L,Ie),r(Z,D))}).on("end",L=>{F&&(b==null||b(L,{...y}),s==null||s({...y}),F=!1)});i.call(z)}function c(){i.on(".drag",null)}return{update:l,destroy:c}}var YP={exports:{}},GP={},XP={exports:{}},JP={};/**
|
|
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 Ru=h;function G3(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var X3=typeof Object.is=="function"?Object.is:G3,J3=Ru.useState,Q3=Ru.useEffect,Z3=Ru.useLayoutEffect,e5=Ru.useDebugValue;function t5(e,t){var n=t(),r=J3({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return Z3(function(){s.value=n,s.getSnapshot=t,Gy(s)&&i({inst:s})},[e,n,t]),Q3(function(){return Gy(s)&&i({inst:s}),e(function(){Gy(s)&&i({inst:s})})},[e]),e5(n),n}function Gy(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!X3(e,n)}catch{return!0}}function n5(e,t){return t()}var r5=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?n5:t5;JP.useSyncExternalStore=Ru.useSyncExternalStore!==void 0?Ru.useSyncExternalStore:r5;XP.exports=JP;var QP=XP.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 Tg=h,s5=QP;function i5(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var o5=typeof Object.is=="function"?Object.is:i5,a5=s5.useSyncExternalStore,l5=Tg.useRef,c5=Tg.useEffect,u5=Tg.useMemo,d5=Tg.useDebugValue;GP.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=l5(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=u5(function(){function c(m){if(!d){if(d=!0,f=m,m=r(m),s!==void 0&&a.hasValue){var g=a.value;if(s(g,m))return u=g}return u=m}if(g=u,o5(f,m))return g;var b=r(m);return s!==void 0&&s(g,b)?(f=m,g):(f=m,u=b)}var d=!1,f,u,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,s]);var l=a5(e,i[0],i[1]);return c5(function(){a.hasValue=!0,a.value=l},[l]),d5(l),l};YP.exports=GP;var f5=YP.exports;const p5=cl(f5),h5={},DS=e=>{let t;const n=new Set,r=(f,u)=>{const p=typeof f=="function"?f(t):f;if(!Object.is(p,t)){const m=t;t=u??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(g=>g(t,m))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>d,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(h5?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(r,s,c);return c},m5=e=>e?DS(e):DS,{useDebugValue:g5}=at,{useSyncExternalStoreWithSelector:y5}=p5,x5=e=>e;function ZP(e,t=x5,n){const r=y5(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return g5(r),r}const FS=(e,t)=>{const n=m5(e),r=(s,i=t)=>ZP(n,s,i);return Object.assign(r,n),r},w5=(e,t)=>e?FS(e,t):FS;function zn(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 Rg=h.createContext(null),b5=Rg.Provider,eA=ko.error001();function Ut(e,t){const n=h.useContext(Rg);if(n===null)throw new Error(eA);return ZP(n,e,t)}function In(){const e=h.useContext(Rg);if(e===null)throw new Error(eA);return h.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const zS={display:"none"},v5={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},tA="react-flow__node-desc",nA="react-flow__edge-desc",k5="react-flow__aria-live",S5=e=>e.ariaLiveMessage,N5=e=>e.ariaLabelConfig;function j5({rfId:e}){const t=Ut(S5);return o.jsx("div",{id:`${k5}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:v5,children:t})}function C5({rfId:e,disableKeyboardA11y:t}){const n=Ut(N5);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${tA}-${e}`,style:zS,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${nA}-${e}`,style:zS,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(j5,{rfId:e})]})}const Lu=h.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const a=`${e}`.split("-");return o.jsx("div",{className:hr(["react-flow__panel",n,...a]),style:r,ref:i,...s,children:t})});Lu.displayName="Panel";function E5({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(Lu,{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 _5=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}},dh=e=>e.id;function P5(e,t){return zn(e.selectedNodes.map(dh),t.selectedNodes.map(dh))&&zn(e.selectedEdges.map(dh),t.selectedEdges.map(dh))}function A5({onSelectionChange:e}){const t=In(),{selectedNodes:n,selectedEdges:r}=Ut(_5,P5);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 I5=e=>!!e.onSelectionChangeHandlers;function T5({onSelectionChange:e}){const t=Ut(I5);return e||t?o.jsx(A5,{onSelectionChange:e}):null}const qw=typeof window<"u"?h.useLayoutEffect:h.useEffect,rA=[0,0],R5={x:0,y:0,zoom:1},L5=["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"],BS=[...L5,"rfId"],O5=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),HS={translateExtent:Pf,nodeOrigin:rA,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function M5(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=Ut(O5,zn),d=In();qw(()=>(c(e.defaultNodes,e.defaultEdges),()=>{f.current=HS,l()}),[]);const f=h.useRef(HS);return qw(()=>{for(const u of BS){const p=e[u],m=f.current[u];p!==m&&(typeof e[u]>"u"||(u==="nodes"?t(p):u==="edges"?n(p):u==="minZoom"?r(p):u==="maxZoom"?s(p):u==="translateExtent"?i(p):u==="nodeExtent"?a(p):u==="ariaLabelConfig"?d.setState({ariaLabelConfig:a3(p)}):u==="fitView"?d.setState({fitViewQueued:p}):u==="fitViewOptions"?d.setState({fitViewOptions:p}):d.setState({[u]:p})))}f.current=e},BS.map(u=>e[u])),null}function WS(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function $5(e){var r;const[t,n]=h.useState(e==="system"?null:e);return h.useEffect(()=>{if(e!=="system"){n(e);return}const s=WS(),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=WS())!=null&&r.matches?"dark":"light"}const VS=typeof document<"u"?document:null;function Lf(e=null,t={target:VS,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(u=>typeof u=="string").map(u=>u.replace("+",`
|
|
61
|
-
`).replace(`
|
|
62
|
-
|
|
63
|
-
`,`
|
|
64
|
-
+`).split(`
|
|
65
|
-
`)),f=d.reduce((u,p)=>u.concat(...p),[]);return[d,f]}return[[],[]]},[e]);return h.useEffect(()=>{const c=(t==null?void 0:t.target)??VS,d=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const f=m=>{var v,y;if(s.current=m.ctrlKey||m.metaKey||m.shiftKey||m.altKey,(!s.current||s.current&&!d)&&IP(m))return!1;const b=KS(m.code,l);if(i.current.add(m[b]),US(a,i.current,!1)){const k=((y=(v=m.composedPath)==null?void 0:v.call(m))==null?void 0:y[0])||m.target,w=(k==null?void 0:k.nodeName)==="BUTTON"||(k==null?void 0:k.nodeName)==="A";t.preventDefault!==!1&&(s.current||!w)&&m.preventDefault(),r(!0)}},u=m=>{const g=KS(m.code,l);US(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(m[g]),m.key==="Meta"&&i.current.clear(),s.current=!1},p=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",f),c==null||c.addEventListener("keyup",u),window.addEventListener("blur",p),window.addEventListener("contextmenu",p),()=>{c==null||c.removeEventListener("keydown",f),c==null||c.removeEventListener("keyup",u),window.removeEventListener("blur",p),window.removeEventListener("contextmenu",p)}}},[e,r]),n}function US(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function KS(e,t){return t.includes(e)?"code":"key"}const D5=()=>{const e=In();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(),c=Iv(t,r,s,i,a,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:i,domNode:a}=e.getState();if(!a)return t;const{x:l,y:c}=a.getBoundingClientRect(),d={x:t.x-l,y:t.y-c},f=n.snapGrid??s,u=n.snapToGrid??i;return sp(d,r,u,f)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),a=Rm(t,n);return{x:a.x+s,y:a.y+i}}}),[])};function sA(e,t){const n=[],r=new Map,s=[];for(const i of e)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const a=r.get(i.id);a?a.push(i):r.set(i.id,[i])}for(const i of t){const a=r.get(i.id);if(!a){n.push(i);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const l={...i};for(const c of a)F5(c,l);n.push(l)}return s.length&&s.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function F5(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 Lm(e,t){return sA(e,t)}function Dv(e,t){return sA(e,t)}function Bl(e,t){return{id:e,type:"select",selected:t}}function ru(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(Bl(i.id,a)))}return r}function qS({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,a]of e.entries()){const l=t.get(a.id),c=((s=l==null?void 0:l.internals)==null?void 0:s.userNode)??l;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function YS(e){return{id:e.id,type:"remove"}}const GS=e=>Jz(e),z5=e=>SP(e);function iA(e){return h.forwardRef(e)}function XS(e){const[t,n]=h.useState(BigInt(0)),[r]=h.useState(()=>B5(()=>n(s=>s+BigInt(1))));return qw(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function B5(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const oA=h.createContext(null);function H5({children:e}){const t=In(),n=h.useCallback(l=>{const{nodes:c=[],setNodes:d,hasDefaultNodes:f,onNodesChange:u,nodeLookup:p,fitViewQueued:m,onNodesChangeMiddlewareMap:g}=t.getState();let b=c;for(const y of l)b=typeof y=="function"?y(b):y;let v=qS({items:b,lookup:p});for(const y of g.values())v=y(v);f&&d(b),v.length>0?u==null||u(v):m&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:k,setNodes:w}=t.getState();y&&w(k)})},[]),r=XS(n),s=h.useCallback(l=>{const{edges:c=[],setEdges:d,hasDefaultEdges:f,onEdgesChange:u,edgeLookup:p}=t.getState();let m=c;for(const g of l)m=typeof g=="function"?g(m):g;f?d(m):u&&u(qS({items:m,lookup:p}))},[]),i=XS(s),a=h.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return o.jsx(oA.Provider,{value:a,children:e})}function W5(){const e=h.useContext(oA);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const V5=e=>!!e.panZoom;function hc(){const e=D5(),t=In(),n=W5(),r=Ut(V5),s=h.useMemo(()=>{const i=u=>t.getState().nodeLookup.get(u),a=u=>{n.nodeQueue.push(u)},l=u=>{n.edgeQueue.push(u)},c=u=>{var y,k;const{nodeLookup:p,nodeOrigin:m}=t.getState(),g=GS(u)?u:p.get(u.id),b=g.parentId?PP(g.position,g.measured,g.parentId,p,m):g.position,v={...g,position:b,width:((y=g.measured)==null?void 0:y.width)??g.width,height:((k=g.measured)==null?void 0:k.height)??g.height};return Au(v)},d=(u,p,m={replace:!1})=>{a(g=>g.map(b=>{if(b.id===u){const v=typeof p=="function"?p(b):p;return m.replace&&GS(v)?v:{...b,...v}}return b}))},f=(u,p,m={replace:!1})=>{l(g=>g.map(b=>{if(b.id===u){const v=typeof p=="function"?p(b):p;return m.replace&&z5(v)?v:{...b,...v}}return b}))};return{getNodes:()=>t.getState().nodes.map(u=>({...u})),getNode:u=>{var p;return(p=i(u))==null?void 0:p.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:u=[]}=t.getState();return u.map(p=>({...p}))},getEdge:u=>t.getState().edgeLookup.get(u),setNodes:a,setEdges:l,addNodes:u=>{const p=Array.isArray(u)?u:[u];n.nodeQueue.push(m=>[...m,...p])},addEdges:u=>{const p=Array.isArray(u)?u:[u];n.edgeQueue.push(m=>[...m,...p])},toObject:()=>{const{nodes:u=[],edges:p=[],transform:m}=t.getState(),[g,b,v]=m;return{nodes:u.map(y=>({...y})),edges:p.map(y=>({...y})),viewport:{x:g,y:b,zoom:v}}},deleteElements:async({nodes:u=[],edges:p=[]})=>{const{nodes:m,edges:g,onNodesDelete:b,onEdgesDelete:v,triggerNodeChanges:y,triggerEdgeChanges:k,onDelete:w,onBeforeDelete:j}=t.getState(),{nodes:A,edges:C}=await n3({nodesToRemove:u,edgesToRemove:p,nodes:m,edges:g,onBeforeDelete:j}),$=C.length>0,B=A.length>0;if($){const F=C.map(YS);v==null||v(C),k(F)}if(B){const F=A.map(YS);b==null||b(A),y(F)}return(B||$)&&(w==null||w({nodes:A,edges:C})),{deletedNodes:A,deletedEdges:C}},getIntersectingNodes:(u,p=!0,m)=>{const g=jS(u),b=g?u:c(u),v=m!==void 0;return b?(m||t.getState().nodes).filter(y=>{const k=t.getState().nodeLookup.get(y.id);if(k&&!g&&(y.id===u.id||!k.internals.positionAbsolute))return!1;const w=Au(v?y:k),j=If(w,b);return p&&j>0||j>=w.width*w.height||j>=b.width*b.height}):[]},isNodeIntersecting:(u,p,m=!0)=>{const b=jS(u)?u:c(u);if(!b)return!1;const v=If(b,p);return m&&v>0||v>=p.width*p.height||v>=b.width*b.height},updateNode:d,updateNodeData:(u,p,m={replace:!1})=>{d(u,g=>{const b=typeof p=="function"?p(g):p;return m.replace?{...g,data:b}:{...g,data:{...g.data,...b}}},m)},updateEdge:f,updateEdgeData:(u,p,m={replace:!1})=>{f(u,g=>{const b=typeof p=="function"?p(g):p;return m.replace?{...g,data:b}:{...g,data:{...g.data,...b}}},m)},getNodesBounds:u=>{const{nodeLookup:p,nodeOrigin:m}=t.getState();return Qz(u,{nodeLookup:p,nodeOrigin:m})},getHandleConnections:({type:u,id:p,nodeId:m})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${m}-${u}${p?`-${p}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:u,handleId:p,nodeId:m})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${m}${u?p?`-${u}-${p}`:`-${u}`:""}`))==null?void 0:g.values())??[])},fitView:async u=>{const p=t.getState().fitViewResolver??o3();return t.setState({fitViewQueued:!0,fitViewOptions:u,fitViewResolver:p}),n.nodeQueue.push(m=>[...m]),p.promise}}},[]);return h.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const JS=e=>e.selected,U5=typeof window<"u"?window:void 0;function K5({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=In(),{deleteElements:r}=hc(),s=Lf(e,{actInsideInputWithModifier:!1}),i=Lf(t,{target:U5});h.useEffect(()=>{if(s){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(JS),edges:a.filter(JS)}),n.setState({nodesSelectionActive:!1})}},[s]),h.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function q5(e){const t=In();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=Tv(e.current);(r.height===0||r.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",ko.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 Lg={position:"absolute",width:"100%",height:"100%",top:0,left:0},Y5=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function G5({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=Jl.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:d,minZoom:f,maxZoom:u,zoomActivationKeyCode:p,preventScrolling:m=!0,children:g,noWheelClassName:b,noPanClassName:v,onViewportChange:y,isControlledViewport:k,paneClickDistance:w,selectionOnDrag:j}){const A=In(),C=h.useRef(null),{userSelectionActive:$,lib:B,connectionInProgress:F}=Ut(Y5,zn),z=Lf(p),L=h.useRef();q5(C);const O=h.useCallback(W=>{y==null||y({x:W[0],y:W[1],zoom:W[2]}),k||A.setState({transform:W})},[y,k]);return h.useEffect(()=>{if(C.current){L.current=H3({domNode:C.current,minZoom:f,maxZoom:u,translateExtent:d,viewport:c,onDraggingChange:E=>A.setState(D=>D.paneDragging===E?D:{paneDragging:E}),onPanZoomStart:(E,D)=>{const{onViewportChangeStart:_,onMoveStart:R}=A.getState();R==null||R(E,D),_==null||_(D)},onPanZoom:(E,D)=>{const{onViewportChange:_,onMove:R}=A.getState();R==null||R(E,D),_==null||_(D)},onPanZoomEnd:(E,D)=>{const{onViewportChangeEnd:_,onMoveEnd:R}=A.getState();R==null||R(E,D),_==null||_(D)}});const{x:W,y:M,zoom:T}=L.current.getViewport();return A.setState({panZoom:L.current,transform:[W,M,T],domNode:C.current.closest(".react-flow")}),()=>{var E;(E=L.current)==null||E.destroy()}}},[]),h.useEffect(()=>{var W;(W=L.current)==null||W.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:z,preventScrolling:m,noPanClassName:v,userSelectionActive:$,noWheelClassName:b,lib:B,onTransformChange:O,connectionInProgress:F,selectionOnDrag:j,paneClickDistance:w})},[e,t,n,r,s,i,a,l,z,m,v,$,b,B,O,F,j,w]),o.jsx("div",{className:"react-flow__renderer",ref:C,style:Lg,children:g})}const X5=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function J5(){const{userSelectionActive:e,userSelectionRect:t}=Ut(X5,zn);return e&&t?o.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Xy=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Q5=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function Z5({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Af.Full,panOnDrag:r,paneClickDistance:s,selectionOnDrag:i,onSelectionStart:a,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:d,onPaneScroll:f,onPaneMouseEnter:u,onPaneMouseMove:p,onPaneMouseLeave:m,children:g}){const b=In(),{userSelectionActive:v,elementsSelectable:y,dragging:k,connectionInProgress:w}=Ut(Q5,zn),j=y&&(e||v),A=h.useRef(null),C=h.useRef(),$=h.useRef(new Set),B=h.useRef(new Set),F=h.useRef(!1),z=_=>{if(F.current||w){F.current=!1;return}c==null||c(_),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},L=_=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){_.preventDefault();return}d==null||d(_)},O=f?_=>f(_):void 0,W=_=>{F.current&&(_.stopPropagation(),F.current=!1)},M=_=>{var ue,pe;const{domNode:R}=b.getState();if(C.current=R==null?void 0:R.getBoundingClientRect(),!C.current)return;const P=_.target===A.current;if(!P&&!!_.target.closest(".nokey")||!e||!(i&&P||t)||_.button!==0||!_.isPrimary)return;(pe=(ue=_.target)==null?void 0:ue.setPointerCapture)==null||pe.call(ue,_.pointerId),F.current=!1;const{x:V,y:se}=zi(_.nativeEvent,C.current);b.setState({userSelectionRect:{width:0,height:0,startX:V,startY:se,x:V,y:se}}),P||(_.stopPropagation(),_.preventDefault())},T=_=>{const{userSelectionRect:R,transform:P,nodeLookup:G,edgeLookup:Z,connectionLookup:V,triggerNodeChanges:se,triggerEdgeChanges:ue,defaultEdgeOptions:pe,resetSelectedElements:ge}=b.getState();if(!C.current||!R)return;const{x:ae,y:be}=zi(_.nativeEvent,C.current),{startX:Pe,startY:we}=R;if(!F.current){const et=t?0:s;if(Math.hypot(ae-Pe,be-we)<=et)return;ge(),a==null||a(_)}F.current=!0;const _e={startX:Pe,startY:we,x:ae<Pe?ae:Pe,y:be<we?be:we,width:Math.abs(ae-Pe),height:Math.abs(be-we)},Ie=$.current,st=B.current;$.current=new Set(Av(G,_e,P,n===Af.Partial,!0).map(et=>et.id)),B.current=new Set;const ct=(pe==null?void 0:pe.selectable)??!0;for(const et of $.current){const Et=V.get(et);if(Et)for(const{edgeId:Ue}of Et.values()){const St=Z.get(Ue);St&&(St.selectable??ct)&&B.current.add(Ue)}}if(!CS(Ie,$.current)){const et=ru(G,$.current,!0);se(et)}if(!CS(st,B.current)){const et=ru(Z,B.current);ue(et)}b.setState({userSelectionRect:_e,userSelectionActive:!0,nodesSelectionActive:!1})},E=_=>{var R,P;_.button===0&&((P=(R=_.target)==null?void 0:R.releasePointerCapture)==null||P.call(R,_.pointerId),!v&&_.target===A.current&&b.getState().userSelectionRect&&(z==null||z(_)),b.setState({userSelectionActive:!1,userSelectionRect:null}),F.current&&(l==null||l(_),b.setState({nodesSelectionActive:$.current.size>0})))},D=r===!0||Array.isArray(r)&&r.includes(0);return o.jsxs("div",{className:hr(["react-flow__pane",{draggable:D,dragging:k,selection:e}]),onClick:j?void 0:Xy(z,A),onContextMenu:Xy(L,A),onWheel:Xy(O,A),onPointerEnter:j?void 0:u,onPointerMove:j?T:p,onPointerUp:j?E:void 0,onPointerDownCapture:j?M:void 0,onClickCapture:j?W:void 0,onPointerLeave:m,ref:A,style:Lg,children:[g,o.jsx(J5,{})]})}function Yw({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:l,onError:c}=t.getState(),d=l.get(e);if(!d){c==null||c("012",ko.error012(e));return}t.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&a)&&(i({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var f;return(f=r==null?void 0:r.current)==null?void 0:f.blur()})):s([e])}function aA({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:a}){const l=In(),[c,d]=h.useState(!1),f=h.useRef();return h.useEffect(()=>{f.current=_3({getStoreItems:()=>l.getState(),onNodeMouseDown:u=>{Yw({id:u,store:l,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),h.useEffect(()=>{if(!(t||!e.current||!f.current))return f.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:a}),()=>{var u;(u=f.current)==null||u.destroy()}},[n,r,t,i,e,s,a]),c}const eB=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function lA(){const e=In();return h.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:d,nodeOrigin:f}=e.getState(),u=new Map,p=eB(a),m=s?i[0]:5,g=s?i[1]:5,b=n.direction.x*m*n.factor,v=n.direction.y*g*n.factor;for(const[,y]of d){if(!p(y))continue;let k={x:y.internals.positionAbsolute.x+b,y:y.internals.positionAbsolute.y+v};s&&(k=rp(k,i));const{position:w,positionAbsolute:j}=NP({nodeId:y.id,nextPosition:k,nodeLookup:d,nodeExtent:r,nodeOrigin:f,onError:l});y.position=w,y.internals.positionAbsolute=j,u.set(y.id,y)}c(u)},[])}const Fv=h.createContext(null),tB=Fv.Provider;Fv.Consumer;const cA=()=>h.useContext(Fv),nB=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),rB=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:a}=r,{fromHandle:l,toHandle:c,isValid:d}=a,f=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:f,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===_u.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!s,valid:f&&d}};function sB({type:e="source",position:t=Ye.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:c,className:d,onMouseDown:f,onTouchStart:u,...p},m){var T,E;const g=a||null,b=e==="target",v=In(),y=cA(),{connectOnClick:k,noPanClassName:w,rfId:j}=Ut(nB,zn),{connectingFrom:A,connectingTo:C,clickConnecting:$,isPossibleEndHandle:B,connectionInProcess:F,clickConnectionInProcess:z,valid:L}=Ut(rB(y,g,e),zn);y||(E=(T=v.getState()).onError)==null||E.call(T,"010",ko.error010());const O=D=>{const{defaultEdgeOptions:_,onConnect:R,hasDefaultEdges:P}=v.getState(),G={..._,...D};if(P){const{edges:Z,setEdges:V}=v.getState();V(Rf(G,Z))}R==null||R(G),l==null||l(G)},W=D=>{if(!y)return;const _=TP(D.nativeEvent);if(s&&(_&&D.button===0||!_)){const R=v.getState();Kw.onPointerDown(D.nativeEvent,{handleDomNode:D.currentTarget,autoPanOnConnect:R.autoPanOnConnect,connectionMode:R.connectionMode,connectionRadius:R.connectionRadius,domNode:R.domNode,nodeLookup:R.nodeLookup,lib:R.lib,isTarget:b,handleId:g,nodeId:y,flowId:R.rfId,panBy:R.panBy,cancelConnection:R.cancelConnection,onConnectStart:R.onConnectStart,onConnectEnd:(...P)=>{var G,Z;return(Z=(G=v.getState()).onConnectEnd)==null?void 0:Z.call(G,...P)},updateConnection:R.updateConnection,onConnect:O,isValidConnection:n||((...P)=>{var G,Z;return((Z=(G=v.getState()).isValidConnection)==null?void 0:Z.call(G,...P))??!0}),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:R.autoPanSpeed,dragThreshold:R.connectionDragThreshold})}_?f==null||f(D):u==null||u(D)},M=D=>{const{onClickConnectStart:_,onClickConnectEnd:R,connectionClickStartHandle:P,connectionMode:G,isValidConnection:Z,lib:V,rfId:se,nodeLookup:ue,connection:pe}=v.getState();if(!y||!P&&!s)return;if(!P){_==null||_(D.nativeEvent,{nodeId:y,handleId:g,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:y,type:e,id:g}});return}const ge=AP(D.target),ae=n||Z,{connection:be,isValid:Pe}=Kw.isValid(D.nativeEvent,{handle:{nodeId:y,id:g,type:e},connectionMode:G,fromNodeId:P.nodeId,fromHandleId:P.id||null,fromType:P.type,isValidConnection:ae,flowId:se,doc:ge,lib:V,nodeLookup:ue});Pe&&be&&O(be);const we=structuredClone(pe);delete we.inProgress,we.toPosition=we.toHandle?we.toHandle.position:null,R==null||R(D,we),v.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":g,"data-nodeid":y,"data-handlepos":t,"data-id":`${j}-${y}-${g}-${e}`,className:hr(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",w,d,{source:!b,target:b,connectable:r,connectablestart:s,connectableend:i,clickconnecting:$,connectingfrom:A,connectingto:C,valid:L,connectionindicator:r&&(!F||B)&&(F||z?i:s)}]),onMouseDown:W,onTouchStart:W,onClick:k?M:void 0,ref:m,...p,children:c})}const Cs=h.memo(iA(sB));function iB({data:e,isConnectable:t,sourcePosition:n=Ye.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(Cs,{type:"source",position:n,isConnectable:t})]})}function oB({data:e,isConnectable:t,targetPosition:n=Ye.Top,sourcePosition:r=Ye.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(Cs,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(Cs,{type:"source",position:r,isConnectable:t})]})}function aB(){return null}function lB({data:e,isConnectable:t,targetPosition:n=Ye.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(Cs,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Om={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},QS={input:iB,default:oB,output:lB,group:aB};function cB(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 uB=e=>{const{width:t,height:n,x:r,y:s}=np(e.nodeLookup,{filter:i=>!!i.selected});return{width:Fi(t)?t:null,height:Fi(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${s}px)`}};function dB({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=In(),{width:s,height:i,transformString:a,userSelectionActive:l}=Ut(uB,zn),c=lA(),d=h.useRef(null);h.useEffect(()=>{var m;n||(m=d.current)==null||m.focus({preventScroll:!0})},[n]);const f=!l&&s!==null&&i!==null;if(aA({nodeRef:d,disabled:!f}),!f)return null;const u=e?m=>{const g=r.getState().nodes.filter(b=>b.selected);e(m,g)}:void 0,p=m=>{Object.prototype.hasOwnProperty.call(Om,m.key)&&(m.preventDefault(),c({direction:Om[m.key],factor:m.shiftKey?4:1}))};return o.jsx("div",{className:hr(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:o.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:n?void 0:-1,onKeyDown:n?void 0:p,style:{width:s,height:i}})})}const ZS=typeof window<"u"?window:void 0,fB=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function uA({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:d,selectionOnDrag:f,selectionMode:u,onSelectionStart:p,onSelectionEnd:m,multiSelectionKeyCode:g,panActivationKeyCode:b,zoomActivationKeyCode:v,elementsSelectable:y,zoomOnScroll:k,zoomOnPinch:w,panOnScroll:j,panOnScrollSpeed:A,panOnScrollMode:C,zoomOnDoubleClick:$,panOnDrag:B,defaultViewport:F,translateExtent:z,minZoom:L,maxZoom:O,preventScrolling:W,onSelectionContextMenu:M,noWheelClassName:T,noPanClassName:E,disableKeyboardA11y:D,onViewportChange:_,isControlledViewport:R}){const{nodesSelectionActive:P,userSelectionActive:G}=Ut(fB,zn),Z=Lf(d,{target:ZS}),V=Lf(b,{target:ZS}),se=V||B,ue=V||j,pe=f&&se!==!0,ge=Z||G||pe;return K5({deleteKeyCode:c,multiSelectionKeyCode:g}),o.jsx(G5,{onPaneContextMenu:i,elementsSelectable:y,zoomOnScroll:k,zoomOnPinch:w,panOnScroll:ue,panOnScrollSpeed:A,panOnScrollMode:C,zoomOnDoubleClick:$,panOnDrag:!Z&&se,defaultViewport:F,translateExtent:z,minZoom:L,maxZoom:O,zoomActivationKeyCode:v,preventScrolling:W,noWheelClassName:T,noPanClassName:E,onViewportChange:_,isControlledViewport:R,paneClickDistance:l,selectionOnDrag:pe,children:o.jsxs(Z5,{onSelectionStart:p,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:se,isSelecting:!!ge,selectionMode:u,selectionKeyPressed:Z,paneClickDistance:l,selectionOnDrag:pe,children:[e,P&&o.jsx(dB,{onSelectionContextMenu:M,noPanClassName:E,disableKeyboardA11y:D})]})})}uA.displayName="FlowRenderer";const pB=h.memo(uA),hB=e=>t=>e?Av(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function mB(e){return Ut(h.useCallback(hB(e),[e]),zn)}const gB=e=>e.updateNodeInternals;function yB(){const e=Ut(gB),[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 xB({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=In(),i=h.useRef(null),a=h.useRef(null),l=h.useRef(e.sourcePosition),c=h.useRef(e.targetPosition),d=h.useRef(t),f=n&&!!e.internals.handleBounds;return h.useEffect(()=>{i.current&&!e.hidden&&(!f||a.current!==i.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(i.current),a.current=i.current)},[f,e.hidden]),h.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),h.useEffect(()=>{if(i.current){const u=d.current!==t,p=l.current!==e.sourcePosition,m=c.current!==e.targetPosition;(u||p||m)&&(d.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function wB({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:d,nodesFocusable:f,resizeObserver:u,noDragClassName:p,noPanClassName:m,disableKeyboardA11y:g,rfId:b,nodeTypes:v,nodeClickDistance:y,onError:k}){const{node:w,internals:j,isParent:A}=Ut(ae=>{const be=ae.nodeLookup.get(e),Pe=ae.parentLookup.has(e);return{node:be,internals:be.internals,isParent:Pe}},zn);let C=w.type||"default",$=(v==null?void 0:v[C])||QS[C];$===void 0&&(k==null||k("003",ko.error003(C)),C="default",$=(v==null?void 0:v.default)||QS.default);const B=!!(w.draggable||l&&typeof w.draggable>"u"),F=!!(w.selectable||c&&typeof w.selectable>"u"),z=!!(w.connectable||d&&typeof w.connectable>"u"),L=!!(w.focusable||f&&typeof w.focusable>"u"),O=In(),W=_P(w),M=xB({node:w,nodeType:C,hasDimensions:W,resizeObserver:u}),T=aA({nodeRef:M,disabled:w.hidden||!B,noDragClassName:p,handleSelector:w.dragHandle,nodeId:e,isSelectable:F,nodeClickDistance:y}),E=lA();if(w.hidden)return null;const D=aa(w),_=cB(w),R=F||B||t||n||r||s,P=n?ae=>n(ae,{...j.userNode}):void 0,G=r?ae=>r(ae,{...j.userNode}):void 0,Z=s?ae=>s(ae,{...j.userNode}):void 0,V=i?ae=>i(ae,{...j.userNode}):void 0,se=a?ae=>a(ae,{...j.userNode}):void 0,ue=ae=>{const{selectNodesOnDrag:be,nodeDragThreshold:Pe}=O.getState();F&&(!be||!B||Pe>0)&&Yw({id:e,store:O,nodeRef:M}),t&&t(ae,{...j.userNode})},pe=ae=>{if(!(IP(ae.nativeEvent)||g)){if(wP.includes(ae.key)&&F){const be=ae.key==="Escape";Yw({id:e,store:O,unselect:be,nodeRef:M})}else if(B&&w.selected&&Object.prototype.hasOwnProperty.call(Om,ae.key)){ae.preventDefault();const{ariaLabelConfig:be}=O.getState();O.setState({ariaLiveMessage:be["node.a11yDescription.ariaLiveMessage"]({direction:ae.key.replace("Arrow","").toLowerCase(),x:~~j.positionAbsolute.x,y:~~j.positionAbsolute.y})}),E({direction:Om[ae.key],factor:ae.shiftKey?4:1})}}},ge=()=>{var st;if(g||!((st=M.current)!=null&&st.matches(":focus-visible")))return;const{transform:ae,width:be,height:Pe,autoPanOnNodeFocus:we,setCenter:_e}=O.getState();if(!we)return;Av(new Map([[e,w]]),{x:0,y:0,width:be,height:Pe},ae,!0).length>0||_e(w.position.x+D.width/2,w.position.y+D.height/2,{zoom:ae[2]})};return o.jsx("div",{className:hr(["react-flow__node",`react-flow__node-${C}`,{[m]:B},w.className,{selected:w.selected,selectable:F,parent:A,draggable:B,dragging:T}]),ref:M,style:{zIndex:j.z,transform:`translate(${j.positionAbsolute.x}px,${j.positionAbsolute.y}px)`,pointerEvents:R?"all":"none",visibility:W?"visible":"hidden",...w.style,..._},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:P,onMouseMove:G,onMouseLeave:Z,onContextMenu:V,onClick:ue,onDoubleClick:se,onKeyDown:L?pe:void 0,tabIndex:L?0:void 0,onFocus:L?ge:void 0,role:w.ariaRole??(L?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${tA}-${b}`,"aria-label":w.ariaLabel,...w.domAttributes,children:o.jsx(tB,{value:e,children:o.jsx($,{id:e,data:w.data,type:C,positionAbsoluteX:j.positionAbsolute.x,positionAbsoluteY:j.positionAbsolute.y,selected:w.selected??!1,selectable:F,draggable:B,deletable:w.deletable??!0,isConnectable:z,sourcePosition:w.sourcePosition,targetPosition:w.targetPosition,dragging:T,dragHandle:w.dragHandle,zIndex:j.z,parentId:w.parentId,...D})})})}var bB=h.memo(wB);const vB=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function dA(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=Ut(vB,zn),a=mB(e.onlyRenderVisibleElements),l=yB();return o.jsx("div",{className:"react-flow__nodes",style:Lg,children:a.map(c=>o.jsx(bB,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:i},c))})}dA.displayName="NodeRenderer";const kB=h.memo(dA);function SB(e){return Ut(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&&u3({sourceNode:i,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),zn)}const NB=({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"})},jB=({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"})},eN={[Ns.Arrow]:NB,[Ns.ArrowClosed]:jB};function CB(e){const t=In();return h.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(eN,e)?eN[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",ko.error009(e)),null)},[e])}const EB=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=CB(t);return c?o.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:o.jsx(c,{color:n,strokeWidth:a})}):null},fA=({defaultColor:e,rfId:t})=>{const n=Ut(i=>i.edges),r=Ut(i=>i.defaultEdgeOptions),s=h.useMemo(()=>y3(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(EB,{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};fA.displayName="MarkerDefinitions";var _B=h.memo(fA);function pA({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:d,...f}){const[u,p]=h.useState({x:1,y:0,width:0,height:0}),m=hr(["react-flow__edge-textwrapper",d]),g=h.useRef(null);return h.useEffect(()=>{if(g.current){const b=g.current.getBBox();p({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?o.jsxs("g",{transform:`translate(${e-u.width/2} ${t-u.height/2})`,className:m,visibility:u.width?"visible":"hidden",...f,children:[s&&o.jsx("rect",{width:u.width+2*a[0],x:-a[0],y:-a[1],height:u.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),o.jsx("text",{className:"react-flow__edge-text",y:u.height/2,dy:"0.3em",ref:g,style:r,children:n}),c]}):null}pA.displayName="EdgeText";const PB=h.memo(pA);function Og({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:d=20,...f}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...f,d:e,fill:"none",className:hr(["react-flow__edge-path",f.className])}),d?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,r&&Fi(t)&&Fi(n)?o.jsx(PB,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function tN({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Ye.Left||e===Ye.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function hA({sourceX:e,sourceY:t,sourcePosition:n=Ye.Bottom,targetX:r,targetY:s,targetPosition:i=Ye.Top}){const[a,l]=tN({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,d]=tN({pos:i,x1:r,y1:s,x2:e,y2:t}),[f,u,p,m]=RP({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${e},${t} C${a},${l} ${c},${d} ${r},${s}`,f,u,p,m]}function mA(e){return h.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:l,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:v,interactionWidth:y})=>{const[k,w,j]=hA({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l}),A=e.isInternal?void 0:t;return o.jsx(Og,{id:A,path:k,labelX:w,labelY:j,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:v,interactionWidth:y})})}const AB=mA({isInternal:!1}),gA=mA({isInternal:!0});AB.displayName="SimpleBezierEdge";gA.displayName="SimpleBezierEdgeInternal";function yA(e){return h.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:u,style:p,sourcePosition:m=Ye.Bottom,targetPosition:g=Ye.Top,markerEnd:b,markerStart:v,pathOptions:y,interactionWidth:k})=>{const[w,j,A]=Ww({sourceX:n,sourceY:r,sourcePosition:m,targetX:s,targetY:i,targetPosition:g,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),C=e.isInternal?void 0:t;return o.jsx(Og,{id:C,path:w,labelX:j,labelY:A,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:u,style:p,markerEnd:b,markerStart:v,interactionWidth:k})})}const xA=yA({isInternal:!1}),wA=yA({isInternal:!0});xA.displayName="SmoothStepEdge";wA.displayName="SmoothStepEdgeInternal";function bA(e){return h.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return o.jsx(xA,{...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 IB=bA({isInternal:!1}),vA=bA({isInternal:!0});IB.displayName="StepEdge";vA.displayName="StepEdgeInternal";function kA(e){return h.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:u,style:p,markerEnd:m,markerStart:g,interactionWidth:b})=>{const[v,y,k]=MP({sourceX:n,sourceY:r,targetX:s,targetY:i}),w=e.isInternal?void 0:t;return o.jsx(Og,{id:w,path:v,labelX:y,labelY:k,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:u,style:p,markerEnd:m,markerStart:g,interactionWidth:b})})}const TB=kA({isInternal:!1}),SA=kA({isInternal:!0});TB.displayName="StraightEdge";SA.displayName="StraightEdgeInternal";function NA(e){return h.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a=Ye.Bottom,targetPosition:l=Ye.Top,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:v,pathOptions:y,interactionWidth:k})=>{const[w,j,A]=LP({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l,curvature:y==null?void 0:y.curvature}),C=e.isInternal?void 0:t;return o.jsx(Og,{id:C,path:w,labelX:j,labelY:A,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:m,style:g,markerEnd:b,markerStart:v,interactionWidth:k})})}const RB=NA({isInternal:!1}),jA=NA({isInternal:!0});RB.displayName="BezierEdge";jA.displayName="BezierEdgeInternal";const nN={default:jA,straight:SA,step:vA,smoothstep:wA,simplebezier:gA},rN={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},LB=(e,t,n)=>n===Ye.Left?e-t:n===Ye.Right?e+t:e,OB=(e,t,n)=>n===Ye.Top?e-t:n===Ye.Bottom?e+t:e,sN="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:hr([sN,`${sN}-${l}`]),cx:LB(t,r,e),cy:OB(n,r,e),r,stroke:"transparent",fill:"transparent"})}function MB({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:d,onReconnectStart:f,onReconnectEnd:u,setReconnecting:p,setUpdateHover:m}){const g=In(),b=(j,A)=>{if(j.button!==0)return;const{autoPanOnConnect:C,domNode:$,connectionMode:B,connectionRadius:F,lib:z,onConnectStart:L,cancelConnection:O,nodeLookup:W,rfId:M,panBy:T,updateConnection:E}=g.getState(),D=A.type==="target",_=(G,Z)=>{p(!1),u==null||u(G,n,A.type,Z)},R=G=>d==null?void 0:d(n,G),P=(G,Z)=>{p(!0),f==null||f(j,n,A.type),L==null||L(G,Z)};Kw.onPointerDown(j.nativeEvent,{autoPanOnConnect:C,connectionMode:B,connectionRadius:F,domNode:$,handleId:A.id,nodeId:A.nodeId,nodeLookup:W,isTarget:D,edgeUpdaterType:A.type,lib:z,flowId:M,cancelConnection:O,panBy:T,isValidConnection:(...G)=>{var Z,V;return((V=(Z=g.getState()).isValidConnection)==null?void 0:V.call(Z,...G))??!0},onConnect:R,onConnectStart:P,onConnectEnd:(...G)=>{var Z,V;return(V=(Z=g.getState()).onConnectEnd)==null?void 0:V.call(Z,...G)},onReconnectEnd:_,updateConnection:E,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:j.currentTarget})},v=j=>b(j,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=j=>b(j,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),k=()=>m(!0),w=()=>m(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(iN,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:v,onMouseEnter:k,onMouseOut:w,type:"source"}),(e===!0||e==="target")&&o.jsx(iN,{position:c,centerX:i,centerY:a,radius:t,onMouseDown:y,onMouseEnter:k,onMouseOut:w,type:"target"})]})}function $B({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:d,reconnectRadius:f,onReconnect:u,onReconnectStart:p,onReconnectEnd:m,rfId:g,edgeTypes:b,noPanClassName:v,onError:y,disableKeyboardA11y:k}){let w=Ut(_e=>_e.edgeLookup.get(e));const j=Ut(_e=>_e.defaultEdgeOptions);w=j?{...j,...w}:w;let A=w.type||"default",C=(b==null?void 0:b[A])||nN[A];C===void 0&&(y==null||y("011",ko.error011(A)),A="default",C=(b==null?void 0:b.default)||nN.default);const $=!!(w.focusable||t&&typeof w.focusable>"u"),B=typeof u<"u"&&(w.reconnectable||n&&typeof w.reconnectable>"u"),F=!!(w.selectable||r&&typeof w.selectable>"u"),z=h.useRef(null),[L,O]=h.useState(!1),[W,M]=h.useState(!1),T=In(),{zIndex:E,sourceX:D,sourceY:_,targetX:R,targetY:P,sourcePosition:G,targetPosition:Z}=Ut(h.useCallback(_e=>{const Ie=_e.nodeLookup.get(w.source),st=_e.nodeLookup.get(w.target);if(!Ie||!st)return{zIndex:w.zIndex,...rN};const ct=g3({id:e,sourceNode:Ie,targetNode:st,sourceHandle:w.sourceHandle||null,targetHandle:w.targetHandle||null,connectionMode:_e.connectionMode,onError:y});return{zIndex:c3({selected:w.selected,zIndex:w.zIndex,sourceNode:Ie,targetNode:st,elevateOnSelect:_e.elevateEdgesOnSelect,zIndexMode:_e.zIndexMode}),...ct||rN}},[w.source,w.target,w.sourceHandle,w.targetHandle,w.selected,w.zIndex]),zn),V=h.useMemo(()=>w.markerStart?`url('#${Vw(w.markerStart,g)}')`:void 0,[w.markerStart,g]),se=h.useMemo(()=>w.markerEnd?`url('#${Vw(w.markerEnd,g)}')`:void 0,[w.markerEnd,g]);if(w.hidden||D===null||_===null||R===null||P===null)return null;const ue=_e=>{var et;const{addSelectedEdges:Ie,unselectNodesAndEdges:st,multiSelectionActive:ct}=T.getState();F&&(T.setState({nodesSelectionActive:!1}),w.selected&&ct?(st({nodes:[],edges:[w]}),(et=z.current)==null||et.blur()):Ie([e])),s&&s(_e,w)},pe=i?_e=>{i(_e,{...w})}:void 0,ge=a?_e=>{a(_e,{...w})}:void 0,ae=l?_e=>{l(_e,{...w})}:void 0,be=c?_e=>{c(_e,{...w})}:void 0,Pe=d?_e=>{d(_e,{...w})}:void 0,we=_e=>{var Ie;if(!k&&wP.includes(_e.key)&&F){const{unselectNodesAndEdges:st,addSelectedEdges:ct}=T.getState();_e.key==="Escape"?((Ie=z.current)==null||Ie.blur(),st({edges:[w]})):ct([e])}};return o.jsx("svg",{style:{zIndex:E},children:o.jsxs("g",{className:hr(["react-flow__edge",`react-flow__edge-${A}`,w.className,v,{selected:w.selected,animated:w.animated,inactive:!F&&!s,updating:L,selectable:F}]),onClick:ue,onDoubleClick:pe,onContextMenu:ge,onMouseEnter:ae,onMouseMove:be,onMouseLeave:Pe,onKeyDown:$?we:void 0,tabIndex:$?0:void 0,role:w.ariaRole??($?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":w.ariaLabel===null?void 0:w.ariaLabel||`Edge from ${w.source} to ${w.target}`,"aria-describedby":$?`${nA}-${g}`:void 0,ref:z,...w.domAttributes,children:[!W&&o.jsx(C,{id:e,source:w.source,target:w.target,type:w.type,selected:w.selected,animated:w.animated,selectable:F,deletable:w.deletable??!0,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,sourceX:D,sourceY:_,targetX:R,targetY:P,sourcePosition:G,targetPosition:Z,data:w.data,style:w.style,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerStart:V,markerEnd:se,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth}),B&&o.jsx(MB,{edge:w,isReconnectable:B,reconnectRadius:f,onReconnect:u,onReconnectStart:p,onReconnectEnd:m,sourceX:D,sourceY:_,targetX:R,targetY:P,sourcePosition:G,targetPosition:Z,setUpdateHover:O,setReconnecting:M})]})})}var DB=h.memo($B);const FB=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function CA({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:d,onEdgeClick:f,reconnectRadius:u,onEdgeDoubleClick:p,onReconnectStart:m,onReconnectEnd:g,disableKeyboardA11y:b}){const{edgesFocusable:v,edgesReconnectable:y,elementsSelectable:k,onError:w}=Ut(FB,zn),j=SB(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(_B,{defaultColor:e,rfId:n}),j.map(A=>o.jsx(DB,{id:A,edgesFocusable:v,edgesReconnectable:y,elementsSelectable:k,noPanClassName:s,onReconnect:i,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:d,onClick:f,reconnectRadius:u,onDoubleClick:p,onReconnectStart:m,onReconnectEnd:g,rfId:n,onError:w,edgeTypes:r,disableKeyboardA11y:b},A))]})}CA.displayName="EdgeRenderer";const zB=h.memo(CA),BB=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function HB({children:e}){const t=Ut(BB);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function WB(e){const t=hc(),n=h.useRef(!1);h.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const VB=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function UB(e){const t=Ut(VB),n=In();return h.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function KB(e){return e.connection.inProgress?{...e.connection,to:sp(e.connection.to,e.transform)}:{...e.connection}}function qB(e){return KB}function YB(e){const t=qB();return Ut(t,zn)}const GB=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function XB({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:a,isValid:l,inProgress:c}=Ut(GB,zn);return!(i&&s&&c)?null:o.jsx("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:hr(["react-flow__connection",kP(l)]),children:o.jsx(EA,{style:t,type:n,CustomComponent:r,isValid:l})})})}const EA=({style:e,type:t=Fa.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:a,fromHandle:l,fromPosition:c,to:d,toNode:f,toHandle:u,toPosition:p,pointer:m}=YB();if(!s)return;if(n)return o.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:i.x,fromY:i.y,toX:d.x,toY:d.y,fromPosition:c,toPosition:p,connectionStatus:kP(r),toNode:f,toHandle:u,pointer:m});let g="";const b={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:d.x,targetY:d.y,targetPosition:p};switch(t){case Fa.Bezier:[g]=LP(b);break;case Fa.SimpleBezier:[g]=hA(b);break;case Fa.Step:[g]=Ww({...b,borderRadius:0});break;case Fa.SmoothStep:[g]=Ww(b);break;default:[g]=MP(b)}return o.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};EA.displayName="ConnectionLine";const JB={};function oN(e=JB){h.useRef(e),In(),h.useEffect(()=>{},[e])}function QB(){In(),h.useRef(!1),h.useEffect(()=>{},[])}function _A({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:d,onNodeContextMenu:f,onSelectionContextMenu:u,onSelectionStart:p,onSelectionEnd:m,connectionLineType:g,connectionLineStyle:b,connectionLineComponent:v,connectionLineContainerStyle:y,selectionKeyCode:k,selectionOnDrag:w,selectionMode:j,multiSelectionKeyCode:A,panActivationKeyCode:C,zoomActivationKeyCode:$,deleteKeyCode:B,onlyRenderVisibleElements:F,elementsSelectable:z,defaultViewport:L,translateExtent:O,minZoom:W,maxZoom:M,preventScrolling:T,defaultMarkerColor:E,zoomOnScroll:D,zoomOnPinch:_,panOnScroll:R,panOnScrollSpeed:P,panOnScrollMode:G,zoomOnDoubleClick:Z,panOnDrag:V,onPaneClick:se,onPaneMouseEnter:ue,onPaneMouseMove:pe,onPaneMouseLeave:ge,onPaneScroll:ae,onPaneContextMenu:be,paneClickDistance:Pe,nodeClickDistance:we,onEdgeContextMenu:_e,onEdgeMouseEnter:Ie,onEdgeMouseMove:st,onEdgeMouseLeave:ct,reconnectRadius:et,onReconnect:Et,onReconnectStart:Ue,onReconnectEnd:St,noDragClassName:tn,noWheelClassName:gn,noPanClassName:Tn,disableKeyboardA11y:zt,nodeExtent:Rn,rfId:Bn,viewport:le,onViewportChange:fe}){return oN(e),oN(t),QB(),WB(n),UB(le),o.jsx(pB,{onPaneClick:se,onPaneMouseEnter:ue,onPaneMouseMove:pe,onPaneMouseLeave:ge,onPaneContextMenu:be,onPaneScroll:ae,paneClickDistance:Pe,deleteKeyCode:B,selectionKeyCode:k,selectionOnDrag:w,selectionMode:j,onSelectionStart:p,onSelectionEnd:m,multiSelectionKeyCode:A,panActivationKeyCode:C,zoomActivationKeyCode:$,elementsSelectable:z,zoomOnScroll:D,zoomOnPinch:_,zoomOnDoubleClick:Z,panOnScroll:R,panOnScrollSpeed:P,panOnScrollMode:G,panOnDrag:V,defaultViewport:L,translateExtent:O,minZoom:W,maxZoom:M,onSelectionContextMenu:u,preventScrolling:T,noDragClassName:tn,noWheelClassName:gn,noPanClassName:Tn,disableKeyboardA11y:zt,onViewportChange:fe,isControlledViewport:!!le,children:o.jsxs(HB,{children:[o.jsx(zB,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:Et,onReconnectStart:Ue,onReconnectEnd:St,onlyRenderVisibleElements:F,onEdgeContextMenu:_e,onEdgeMouseEnter:Ie,onEdgeMouseMove:st,onEdgeMouseLeave:ct,reconnectRadius:et,defaultMarkerColor:E,noPanClassName:Tn,disableKeyboardA11y:zt,rfId:Bn}),o.jsx(XB,{style:b,type:g,component:v,containerStyle:y}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(kB,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:d,onNodeContextMenu:f,nodeClickDistance:we,onlyRenderVisibleElements:F,noPanClassName:Tn,noDragClassName:tn,disableKeyboardA11y:zt,nodeExtent:Rn,rfId:Bn}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}_A.displayName="GraphView";const ZB=h.memo(_A),aN=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c=.5,maxZoom:d=2,nodeOrigin:f,nodeExtent:u,zIndexMode:p="basic"}={})=>{const m=new Map,g=new Map,b=new Map,v=new Map,y=r??t??[],k=n??e??[],w=f??[0,0],j=u??Pf;FP(b,v,y);const{nodesInitialized:A}=Uw(k,m,g,{nodeOrigin:w,nodeExtent:j,zIndexMode:p});let C=[0,0,1];if(a&&s&&i){const $=np(m,{filter:L=>!!((L.width||L.initialWidth)&&(L.height||L.initialHeight))}),{x:B,y:F,zoom:z}=Iv($,s,i,c,d,(l==null?void 0:l.padding)??.1);C=[B,F,z]}return{rfId:"1",width:s??0,height:i??0,transform:C,nodes:k,nodesInitialized:A,nodeLookup:m,parentLookup:g,edges:y,edgeLookup:v,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:d,translateExtent:Pf,nodeExtent:j,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:_u.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:w,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:l,fitViewResolver:null,connection:{...vP},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:r3,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:bP,zIndexMode:p,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},e4=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:f,nodeExtent:u,zIndexMode:p})=>w5((m,g)=>{async function b(){const{nodeLookup:v,panZoom:y,fitViewOptions:k,fitViewResolver:w,width:j,height:A,minZoom:C,maxZoom:$}=g();y&&(await t3({nodes:v,width:j,height:A,panZoom:y,minZoom:C,maxZoom:$},k),w==null||w.resolve(!0),m({fitViewResolver:null}))}return{...aN({nodes:e,edges:t,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:f,nodeExtent:u,defaultNodes:n,defaultEdges:r,zIndexMode:p}),setNodes:v=>{const{nodeLookup:y,parentLookup:k,nodeOrigin:w,elevateNodesOnSelect:j,fitViewQueued:A,zIndexMode:C,nodesSelectionActive:$}=g(),{nodesInitialized:B,hasSelectedNodes:F}=Uw(v,y,k,{nodeOrigin:w,nodeExtent:u,elevateNodesOnSelect:j,checkEquality:!0,zIndexMode:C}),z=$&&F;A&&B?(b(),m({nodes:v,nodesInitialized:B,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:z})):m({nodes:v,nodesInitialized:B,nodesSelectionActive:z})},setEdges:v=>{const{connectionLookup:y,edgeLookup:k}=g();FP(y,k,v),m({edges:v})},setDefaultNodesAndEdges:(v,y)=>{if(v){const{setNodes:k}=g();k(v),m({hasDefaultNodes:!0})}if(y){const{setEdges:k}=g();k(y),m({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:y,nodeLookup:k,parentLookup:w,domNode:j,nodeOrigin:A,nodeExtent:C,debug:$,fitViewQueued:B,zIndexMode:F}=g(),{changes:z,updatedInternals:L}=N3(v,k,w,j,A,C,F);L&&(b3(k,w,{nodeOrigin:A,nodeExtent:C,zIndexMode:F}),B?(b(),m({fitViewQueued:!1,fitViewOptions:void 0})):m({}),(z==null?void 0:z.length)>0&&($&&console.log("React Flow: trigger node changes",z),y==null||y(z)))},updateNodePositions:(v,y=!1)=>{const k=[];let w=[];const{nodeLookup:j,triggerNodeChanges:A,connection:C,updateConnection:$,onNodesChangeMiddlewareMap:B}=g();for(const[F,z]of v){const L=j.get(F),O=!!(L!=null&&L.expandParent&&(L!=null&&L.parentId)&&(z!=null&&z.position)),W={id:F,type:"position",position:O?{x:Math.max(0,z.position.x),y:Math.max(0,z.position.y)}:z.position,dragging:y};if(L&&C.inProgress&&C.fromNode.id===L.id){const M=cc(L,C.fromHandle,Ye.Left,!0);$({...C,from:M})}O&&L.parentId&&k.push({id:F,parentId:L.parentId,rect:{...z.internals.positionAbsolute,width:z.measured.width??0,height:z.measured.height??0}}),w.push(W)}if(k.length>0){const{parentLookup:F,nodeOrigin:z}=g(),L=$v(k,j,F,z);w.push(...L)}for(const F of B.values())w=F(w);A(w)},triggerNodeChanges:v=>{const{onNodesChange:y,setNodes:k,nodes:w,hasDefaultNodes:j,debug:A}=g();if(v!=null&&v.length){if(j){const C=Lm(v,w);k(C)}A&&console.log("React Flow: trigger node changes",v),y==null||y(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:y,setEdges:k,edges:w,hasDefaultEdges:j,debug:A}=g();if(v!=null&&v.length){if(j){const C=Dv(v,w);k(C)}A&&console.log("React Flow: trigger edge changes",v),y==null||y(v)}},addSelectedNodes:v=>{const{multiSelectionActive:y,edgeLookup:k,nodeLookup:w,triggerNodeChanges:j,triggerEdgeChanges:A}=g();if(y){const C=v.map($=>Bl($,!0));j(C);return}j(ru(w,new Set([...v]),!0)),A(ru(k))},addSelectedEdges:v=>{const{multiSelectionActive:y,edgeLookup:k,nodeLookup:w,triggerNodeChanges:j,triggerEdgeChanges:A}=g();if(y){const C=v.map($=>Bl($,!0));A(C);return}A(ru(k,new Set([...v]))),j(ru(w,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:y}={})=>{const{edges:k,nodes:w,nodeLookup:j,triggerNodeChanges:A,triggerEdgeChanges:C}=g(),$=v||w,B=y||k,F=[];for(const L of $){if(!L.selected)continue;const O=j.get(L.id);O&&(O.selected=!1),F.push(Bl(L.id,!1))}const z=[];for(const L of B)L.selected&&z.push(Bl(L.id,!1));A(F),C(z)},setMinZoom:v=>{const{panZoom:y,maxZoom:k}=g();y==null||y.setScaleExtent([v,k]),m({minZoom:v})},setMaxZoom:v=>{const{panZoom:y,minZoom:k}=g();y==null||y.setScaleExtent([k,v]),m({maxZoom:v})},setTranslateExtent:v=>{var y;(y=g().panZoom)==null||y.setTranslateExtent(v),m({translateExtent:v})},resetSelectedElements:()=>{const{edges:v,nodes:y,triggerNodeChanges:k,triggerEdgeChanges:w,elementsSelectable:j}=g();if(!j)return;const A=y.reduce(($,B)=>B.selected?[...$,Bl(B.id,!1)]:$,[]),C=v.reduce(($,B)=>B.selected?[...$,Bl(B.id,!1)]:$,[]);k(A),w(C)},setNodeExtent:v=>{const{nodes:y,nodeLookup:k,parentLookup:w,nodeOrigin:j,elevateNodesOnSelect:A,nodeExtent:C,zIndexMode:$}=g();v[0][0]===C[0][0]&&v[0][1]===C[0][1]&&v[1][0]===C[1][0]&&v[1][1]===C[1][1]||(Uw(y,k,w,{nodeOrigin:j,nodeExtent:v,elevateNodesOnSelect:A,checkEquality:!1,zIndexMode:$}),m({nodeExtent:v}))},panBy:v=>{const{transform:y,width:k,height:w,panZoom:j,translateExtent:A}=g();return j3({delta:v,panZoom:j,transform:y,translateExtent:A,width:k,height:w})},setCenter:async(v,y,k)=>{const{width:w,height:j,maxZoom:A,panZoom:C}=g();if(!C)return Promise.resolve(!1);const $=typeof(k==null?void 0:k.zoom)<"u"?k.zoom:A;return await C.setViewport({x:w/2-v*$,y:j/2-y*$,zoom:$},{duration:k==null?void 0:k.duration,ease:k==null?void 0:k.ease,interpolate:k==null?void 0:k.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{m({connection:{...vP}})},updateConnection:v=>{m({connection:v})},reset:()=>m({...aN()})}},Object.is);function Mg({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:d,nodeOrigin:f,nodeExtent:u,zIndexMode:p,children:m}){const[g]=h.useState(()=>e4({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:d,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:f,nodeExtent:u,zIndexMode:p}));return o.jsx(b5,{value:g,children:o.jsx(H5,{children:m})})}function t4({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:a,fitView:l,fitViewOptions:c,minZoom:d,maxZoom:f,nodeOrigin:u,nodeExtent:p,zIndexMode:m}){return h.useContext(Rg)?o.jsx(o.Fragment,{children:e}):o.jsx(Mg,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:d,initialMaxZoom:f,nodeOrigin:u,nodeExtent:p,zIndexMode:m,children:e})}const n4={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function r4({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:d,onMove:f,onMoveStart:u,onMoveEnd:p,onConnect:m,onConnectStart:g,onConnectEnd:b,onClickConnectStart:v,onClickConnectEnd:y,onNodeMouseEnter:k,onNodeMouseMove:w,onNodeMouseLeave:j,onNodeContextMenu:A,onNodeDoubleClick:C,onNodeDragStart:$,onNodeDrag:B,onNodeDragStop:F,onNodesDelete:z,onEdgesDelete:L,onDelete:O,onSelectionChange:W,onSelectionDragStart:M,onSelectionDrag:T,onSelectionDragStop:E,onSelectionContextMenu:D,onSelectionStart:_,onSelectionEnd:R,onBeforeDelete:P,connectionMode:G,connectionLineType:Z=Fa.Bezier,connectionLineStyle:V,connectionLineComponent:se,connectionLineContainerStyle:ue,deleteKeyCode:pe="Backspace",selectionKeyCode:ge="Shift",selectionOnDrag:ae=!1,selectionMode:be=Af.Full,panActivationKeyCode:Pe="Space",multiSelectionKeyCode:we=Tf()?"Meta":"Control",zoomActivationKeyCode:_e=Tf()?"Meta":"Control",snapToGrid:Ie,snapGrid:st,onlyRenderVisibleElements:ct=!1,selectNodesOnDrag:et,nodesDraggable:Et,autoPanOnNodeFocus:Ue,nodesConnectable:St,nodesFocusable:tn,nodeOrigin:gn=rA,edgesFocusable:Tn,edgesReconnectable:zt,elementsSelectable:Rn=!0,defaultViewport:Bn=R5,minZoom:le=.5,maxZoom:fe=2,translateExtent:ze=Pf,preventScrolling:Ze=!0,nodeExtent:ot,defaultMarkerColor:Jt="#b1b1b7",zoomOnScroll:nn=!0,zoomOnPinch:Ln=!0,panOnScroll:yn=!1,panOnScrollSpeed:ir=.5,panOnScrollMode:rn=Jl.Free,zoomOnDoubleClick:Sn=!0,panOnDrag:Zt=!0,onPaneClick:Nn,onPaneMouseEnter:xe,onPaneMouseMove:Re,onPaneMouseLeave:it,onPaneScroll:re,onPaneContextMenu:Ce,paneClickDistance:Ge=1,nodeClickDistance:Ct=0,children:Ke,onReconnect:jn,onReconnectStart:hi,onReconnectEnd:Eo,onEdgeContextMenu:vr,onEdgeDoubleClick:kr,onEdgeMouseEnter:_o,onEdgeMouseMove:or,onEdgeMouseLeave:qs,reconnectRadius:Me=10,onNodesChange:ca,onEdgesChange:mi,noDragClassName:Yn="nodrag",noWheelClassName:Oe="nowheel",noPanClassName:Bt="nopan",fitView:Sr,fitViewOptions:mt,connectOnClick:Yi,attributionPosition:er,proOptions:Hn,defaultEdgeOptions:Nr,elevateNodesOnSelect:lt=!0,elevateEdgesOnSelect:Ht=!1,disableKeyboardA11y:qt=!1,autoPanOnConnect:On,autoPanOnNodeDrag:Je,autoPanSpeed:ar,connectionRadius:_s,isValidConnection:jr,onError:gi,style:Ps,id:Po,nodeDragThreshold:Gi,connectionDragThreshold:Ao,viewport:Ys,onViewportChange:cn,width:As,height:Is,colorMode:Ts="light",debug:Gs,onScroll:K,ariaLabelConfig:me,zIndexMode:Te="basic",...Ae},Xe){const Wt=Po||"1",Ot=$5(Ts),tr=h.useCallback(Cr=>{Cr.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),K==null||K(Cr)},[K]);return o.jsx("div",{"data-testid":"rf__wrapper",...Ae,onScroll:tr,style:{...Ps,...n4},ref:Xe,className:hr(["react-flow",s,Ot]),id:Po,role:"application",children:o.jsxs(t4,{nodes:e,edges:t,width:As,height:Is,fitView:Sr,fitViewOptions:mt,minZoom:le,maxZoom:fe,nodeOrigin:gn,nodeExtent:ot,zIndexMode:Te,children:[o.jsx(M5,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:m,onConnectStart:g,onConnectEnd:b,onClickConnectStart:v,onClickConnectEnd:y,nodesDraggable:Et,autoPanOnNodeFocus:Ue,nodesConnectable:St,nodesFocusable:tn,edgesFocusable:Tn,edgesReconnectable:zt,elementsSelectable:Rn,elevateNodesOnSelect:lt,elevateEdgesOnSelect:Ht,minZoom:le,maxZoom:fe,nodeExtent:ot,onNodesChange:ca,onEdgesChange:mi,snapToGrid:Ie,snapGrid:st,connectionMode:G,translateExtent:ze,connectOnClick:Yi,defaultEdgeOptions:Nr,fitView:Sr,fitViewOptions:mt,onNodesDelete:z,onEdgesDelete:L,onDelete:O,onNodeDragStart:$,onNodeDrag:B,onNodeDragStop:F,onSelectionDrag:T,onSelectionDragStart:M,onSelectionDragStop:E,onMove:f,onMoveStart:u,onMoveEnd:p,noPanClassName:Bt,nodeOrigin:gn,rfId:Wt,autoPanOnConnect:On,autoPanOnNodeDrag:Je,autoPanSpeed:ar,onError:gi,connectionRadius:_s,isValidConnection:jr,selectNodesOnDrag:et,nodeDragThreshold:Gi,connectionDragThreshold:Ao,onBeforeDelete:P,debug:Gs,ariaLabelConfig:me,zIndexMode:Te}),o.jsx(ZB,{onInit:d,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:k,onNodeMouseMove:w,onNodeMouseLeave:j,onNodeContextMenu:A,onNodeDoubleClick:C,nodeTypes:i,edgeTypes:a,connectionLineType:Z,connectionLineStyle:V,connectionLineComponent:se,connectionLineContainerStyle:ue,selectionKeyCode:ge,selectionOnDrag:ae,selectionMode:be,deleteKeyCode:pe,multiSelectionKeyCode:we,panActivationKeyCode:Pe,zoomActivationKeyCode:_e,onlyRenderVisibleElements:ct,defaultViewport:Bn,translateExtent:ze,minZoom:le,maxZoom:fe,preventScrolling:Ze,zoomOnScroll:nn,zoomOnPinch:Ln,zoomOnDoubleClick:Sn,panOnScroll:yn,panOnScrollSpeed:ir,panOnScrollMode:rn,panOnDrag:Zt,onPaneClick:Nn,onPaneMouseEnter:xe,onPaneMouseMove:Re,onPaneMouseLeave:it,onPaneScroll:re,onPaneContextMenu:Ce,paneClickDistance:Ge,nodeClickDistance:Ct,onSelectionContextMenu:D,onSelectionStart:_,onSelectionEnd:R,onReconnect:jn,onReconnectStart:hi,onReconnectEnd:Eo,onEdgeContextMenu:vr,onEdgeDoubleClick:kr,onEdgeMouseEnter:_o,onEdgeMouseMove:or,onEdgeMouseLeave:qs,reconnectRadius:Me,defaultMarkerColor:Jt,noDragClassName:Yn,noWheelClassName:Oe,noPanClassName:Bt,rfId:Wt,disableKeyboardA11y:qt,nodeExtent:ot,viewport:Ys,onViewportChange:cn}),o.jsx(T5,{onSelectionChange:W}),Ke,o.jsx(E5,{proOptions:Hn,position:er}),o.jsx(C5,{rfId:Wt,disableKeyboardA11y:qt})]})})}var zv=iA(r4);function Bv(){const e=In();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 PA(e){const[t,n]=h.useState(e),r=h.useCallback(s=>n(i=>Lm(s,i)),[]);return[t,n,r]}function AA(e){const[t,n]=h.useState(e),r=h.useCallback(s=>n(i=>Dv(s,i)),[]);return[t,n,r]}function s4({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:hr(["react-flow__background-pattern",n,r])})}function i4({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:hr(["react-flow__background-pattern","dots",t])})}var Za;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Za||(Za={}));const o4={[Za.Dots]:1,[Za.Lines]:1,[Za.Cross]:6},a4=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function IA({id:e,variant:t=Za.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:a,bgColor:l,style:c,className:d,patternClassName:f}){const u=h.useRef(null),{transform:p,patternId:m}=Ut(a4,zn),g=r||o4[t],b=t===Za.Dots,v=t===Za.Cross,y=Array.isArray(n)?n:[n,n],k=[y[0]*p[2]||1,y[1]*p[2]||1],w=g*p[2],j=Array.isArray(i)?i:[i,i],A=v?[w,w]:k,C=[j[0]*p[2]||1+A[0]/2,j[1]*p[2]||1+A[1]/2],$=`${m}${e||""}`;return o.jsxs("svg",{className:hr(["react-flow__background",d]),style:{...c,...Lg,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:u,"data-testid":"rf__background",children:[o.jsx("pattern",{id:$,x:p[0]%k[0],y:p[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:b?o.jsx(i4,{radius:w/2,className:f}):o.jsx(s4,{dimensions:A,lineWidth:s,variant:t,className:f})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${$})`})]})}IA.displayName="Background";const Hv=h.memo(IA);function l4(){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 c4(){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 u4(){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 d4(){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 f4(){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 fh({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:hr(["react-flow__controls-button",t]),...n,children:e})}const p4=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function TA({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:d,children:f,position:u="bottom-left",orientation:p="vertical","aria-label":m}){const g=In(),{isInteractive:b,minZoomReached:v,maxZoomReached:y,ariaLabelConfig:k}=Ut(p4,zn),{zoomIn:w,zoomOut:j,fitView:A}=hc(),C=()=>{w(),i==null||i()},$=()=>{j(),a==null||a()},B=()=>{A(s),l==null||l()},F=()=>{g.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},z=p==="horizontal"?"horizontal":"vertical";return o.jsxs(Lu,{className:hr(["react-flow__controls",z,d]),position:u,style:e,"data-testid":"rf__controls","aria-label":m??k["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(fh,{onClick:C,className:"react-flow__controls-zoomin",title:k["controls.zoomIn.ariaLabel"],"aria-label":k["controls.zoomIn.ariaLabel"],disabled:y,children:o.jsx(l4,{})}),o.jsx(fh,{onClick:$,className:"react-flow__controls-zoomout",title:k["controls.zoomOut.ariaLabel"],"aria-label":k["controls.zoomOut.ariaLabel"],disabled:v,children:o.jsx(c4,{})})]}),n&&o.jsx(fh,{className:"react-flow__controls-fitview",onClick:B,title:k["controls.fitView.ariaLabel"],"aria-label":k["controls.fitView.ariaLabel"],children:o.jsx(u4,{})}),r&&o.jsx(fh,{className:"react-flow__controls-interactive",onClick:F,title:k["controls.interactive.ariaLabel"],"aria-label":k["controls.interactive.ariaLabel"],children:b?o.jsx(f4,{}):o.jsx(d4,{})}),f]})}TA.displayName="Controls";const h4=h.memo(TA);function m4({id:e,x:t,y:n,width:r,height:s,style:i,color:a,strokeColor:l,strokeWidth:c,className:d,borderRadius:f,shapeRendering:u,selected:p,onClick:m}){const{background:g,backgroundColor:b}=i||{},v=a||g||b;return o.jsx("rect",{className:hr(["react-flow__minimap-node",{selected:p},d]),x:t,y:n,rx:f,ry:f,width:r,height:s,style:{fill:v,stroke:l,strokeWidth:c},shapeRendering:u,onClick:m?y=>m(y,e):void 0})}const g4=h.memo(m4),y4=e=>e.nodes.map(t=>t.id),Jy=e=>e instanceof Function?e:()=>e;function x4({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=g4,onClick:a}){const l=Ut(y4,zn),c=Jy(t),d=Jy(e),f=Jy(n),u=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(p=>o.jsx(b4,{id:p,nodeColorFunc:c,nodeStrokeColorFunc:d,nodeClassNameFunc:f,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:a,shapeRendering:u},p))})}function w4({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:d,x:f,y:u,width:p,height:m}=Ut(g=>{const b=g.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const v=b.internals.userNode,{x:y,y:k}=b.internals.positionAbsolute,{width:w,height:j}=aa(v);return{node:v,x:y,y:k,width:w,height:j}},zn);return!d||d.hidden||!_P(d)?null:o.jsx(l,{x:f,y:u,width:p,height:m,style:d.style,selected:!!d.selected,className:r(d),color:t(d),borderRadius:s,strokeColor:n(d),strokeWidth:i,shapeRendering:a,onClick:c,id:d.id})}const b4=h.memo(w4);var v4=h.memo(x4);const k4=200,S4=150,N4=e=>!e.hidden,j4=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?EP(np(e.nodeLookup,{filter:N4}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},C4="react-flow__minimap-desc";function RA({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:d,maskStrokeColor:f,maskStrokeWidth:u,position:p="bottom-right",onClick:m,onNodeClick:g,pannable:b=!1,zoomable:v=!1,ariaLabel:y,inversePan:k,zoomStep:w=1,offsetScale:j=5}){const A=In(),C=h.useRef(null),{boundingRect:$,viewBB:B,rfId:F,panZoom:z,translateExtent:L,flowWidth:O,flowHeight:W,ariaLabelConfig:M}=Ut(j4,zn),T=(e==null?void 0:e.width)??k4,E=(e==null?void 0:e.height)??S4,D=$.width/T,_=$.height/E,R=Math.max(D,_),P=R*T,G=R*E,Z=j*R,V=$.x-(P-$.width)/2-Z,se=$.y-(G-$.height)/2-Z,ue=P+Z*2,pe=G+Z*2,ge=`${C4}-${F}`,ae=h.useRef(0),be=h.useRef();ae.current=R,h.useEffect(()=>{if(C.current&&z)return be.current=L3({domNode:C.current,panZoom:z,getTransform:()=>A.getState().transform,getViewScale:()=>ae.current}),()=>{var Ie;(Ie=be.current)==null||Ie.destroy()}},[z]),h.useEffect(()=>{var Ie;(Ie=be.current)==null||Ie.update({translateExtent:L,width:O,height:W,inversePan:k,pannable:b,zoomStep:w,zoomable:v})},[b,v,k,w,L,O,W]);const Pe=m?Ie=>{var et;const[st,ct]=((et=be.current)==null?void 0:et.pointer(Ie))||[0,0];m(Ie,{x:st,y:ct})}:void 0,we=g?h.useCallback((Ie,st)=>{const ct=A.getState().nodeLookup.get(st).internals.userNode;g(Ie,ct)},[]):void 0,_e=y??M["minimap.ariaLabel"];return o.jsx(Lu,{position:p,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-color-props":typeof f=="string"?f:void 0,"--xy-minimap-mask-stroke-width-props":typeof u=="number"?u*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:hr(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:T,height:E,viewBox:`${V} ${se} ${ue} ${pe}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ge,ref:C,onClick:Pe,children:[_e&&o.jsx("title",{id:ge,children:_e}),o.jsx(v4,{onClick:we,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${V-Z},${se-Z}h${ue+Z*2}v${pe+Z*2}h${-ue-Z*2}z
|
|
66
|
-
M${B.x},${B.y}h${B.width}v${B.height}h${-B.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}RA.displayName="MiniMap";const E4=h.memo(RA),_4=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,P4={[Tu.Line]:"right",[Tu.Handle]:"bottom-right"};function A4({nodeId:e,position:t,variant:n=Tu.Handle,className:r,style:s=void 0,children:i,color:a,minWidth:l=10,minHeight:c=10,maxWidth:d=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:u=!1,resizeDirection:p,autoScale:m=!0,shouldResize:g,onResizeStart:b,onResize:v,onResizeEnd:y}){const k=cA(),w=typeof e=="string"?e:k,j=In(),A=h.useRef(null),C=n===Tu.Handle,$=Ut(h.useCallback(_4(C&&m),[C,m]),zn),B=h.useRef(null),F=t??P4[n];h.useEffect(()=>{if(!(!A.current||!w))return B.current||(B.current=Y3({domNode:A.current,nodeId:w,getStoreItems:()=>{const{nodeLookup:L,transform:O,snapGrid:W,snapToGrid:M,nodeOrigin:T,domNode:E}=j.getState();return{nodeLookup:L,transform:O,snapGrid:W,snapToGrid:M,nodeOrigin:T,paneDomNode:E}},onChange:(L,O)=>{const{triggerNodeChanges:W,nodeLookup:M,parentLookup:T,nodeOrigin:E}=j.getState(),D=[],_={x:L.x,y:L.y},R=M.get(w);if(R&&R.expandParent&&R.parentId){const P=R.origin??E,G=L.width??R.measured.width??0,Z=L.height??R.measured.height??0,V={id:R.id,parentId:R.parentId,rect:{width:G,height:Z,...PP({x:L.x??R.position.x,y:L.y??R.position.y},{width:G,height:Z},R.parentId,M,P)}},se=$v([V],M,T,E);D.push(...se),_.x=L.x?Math.max(P[0]*G,L.x):void 0,_.y=L.y?Math.max(P[1]*Z,L.y):void 0}if(_.x!==void 0&&_.y!==void 0){const P={id:w,type:"position",position:{..._}};D.push(P)}if(L.width!==void 0&&L.height!==void 0){const G={id:w,type:"dimensions",resizing:!0,setAttributes:p?p==="horizontal"?"width":"height":!0,dimensions:{width:L.width,height:L.height}};D.push(G)}for(const P of O){const G={...P,type:"position"};D.push(G)}W(D)},onEnd:({width:L,height:O})=>{const W={id:w,type:"dimensions",resizing:!1,dimensions:{width:L,height:O}};j.getState().triggerNodeChanges([W])}})),B.current.update({controlPosition:F,boundaries:{minWidth:l,minHeight:c,maxWidth:d,maxHeight:f},keepAspectRatio:u,resizeDirection:p,onResizeStart:b,onResize:v,onResizeEnd:y,shouldResize:g}),()=>{var L;(L=B.current)==null||L.destroy()}},[F,l,c,d,f,u,b,v,y,g]);const z=F.split("-");return o.jsx("div",{className:hr(["react-flow__resize-control","nodrag",...z,n,r]),ref:A,style:{...s,scale:$,...a&&{[C?"backgroundColor":"borderColor"]:a}},children:i})}const LA=h.memo(A4);function I4(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const T4=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,R4=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,L4={};function lN(e,t){return(L4.jsx?R4:T4).test(e)}const O4=/[ \t\n\f\r]/g;function M4(e){return typeof e=="object"?e.type==="text"?cN(e.value):!1:cN(e)}function cN(e){return e.replace(O4,"")===""}let ip=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};ip.prototype.normal={};ip.prototype.property={};ip.prototype.space=void 0;function OA(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new ip(n,r,t)}function Gw(e){return e.toLowerCase()}class Es{constructor(t,n){this.attribute=n,this.property=t}}Es.prototype.attribute="";Es.prototype.booleanish=!1;Es.prototype.boolean=!1;Es.prototype.commaOrSpaceSeparated=!1;Es.prototype.commaSeparated=!1;Es.prototype.defined=!1;Es.prototype.mustUseProperty=!1;Es.prototype.number=!1;Es.prototype.overloadedBoolean=!1;Es.prototype.property="";Es.prototype.spaceSeparated=!1;Es.prototype.space=void 0;let $4=0;const Pt=mc(),dr=mc(),Xw=mc(),Ee=mc(),wn=mc(),mu=mc(),Os=mc();function mc(){return 2**++$4}const Jw=Object.freeze(Object.defineProperty({__proto__:null,boolean:Pt,booleanish:dr,commaOrSpaceSeparated:Os,commaSeparated:mu,number:Ee,overloadedBoolean:Xw,spaceSeparated:wn},Symbol.toStringTag,{value:"Module"})),Qy=Object.keys(Jw);class Wv extends Es{constructor(t,n,r,s){let i=-1;if(super(t,n),uN(this,"space",s),typeof r=="number")for(;++i<Qy.length;){const a=Qy[i];uN(this,Qy[i],(r&Jw[a])===Jw[a])}}}Wv.prototype.defined=!0;function uN(e,t,n){n&&(e[t]=n)}function Wu(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new Wv(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Gw(r)]=r,n[Gw(i.attribute)]=r}return new ip(t,n,e.space)}const MA=Wu({properties:{ariaActiveDescendant:null,ariaAtomic:dr,ariaAutoComplete:null,ariaBusy:dr,ariaChecked:dr,ariaColCount:Ee,ariaColIndex:Ee,ariaColSpan:Ee,ariaControls:wn,ariaCurrent:null,ariaDescribedBy:wn,ariaDetails:null,ariaDisabled:dr,ariaDropEffect:wn,ariaErrorMessage:null,ariaExpanded:dr,ariaFlowTo:wn,ariaGrabbed:dr,ariaHasPopup:null,ariaHidden:dr,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:wn,ariaLevel:Ee,ariaLive:null,ariaModal:dr,ariaMultiLine:dr,ariaMultiSelectable:dr,ariaOrientation:null,ariaOwns:wn,ariaPlaceholder:null,ariaPosInSet:Ee,ariaPressed:dr,ariaReadOnly:dr,ariaRelevant:null,ariaRequired:dr,ariaRoleDescription:wn,ariaRowCount:Ee,ariaRowIndex:Ee,ariaRowSpan:Ee,ariaSelected:dr,ariaSetSize:Ee,ariaSort:null,ariaValueMax:Ee,ariaValueMin:Ee,ariaValueNow:Ee,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function $A(e,t){return t in e?e[t]:t}function DA(e,t){return $A(e,t.toLowerCase())}const D4=Wu({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:mu,acceptCharset:wn,accessKey:wn,action:null,allow:null,allowFullScreen:Pt,allowPaymentRequest:Pt,allowUserMedia:Pt,alt:null,as:null,async:Pt,autoCapitalize:null,autoComplete:wn,autoFocus:Pt,autoPlay:Pt,blocking:wn,capture:null,charSet:null,checked:Pt,cite:null,className:wn,cols:Ee,colSpan:null,content:null,contentEditable:dr,controls:Pt,controlsList:wn,coords:Ee|mu,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Pt,defer:Pt,dir:null,dirName:null,disabled:Pt,download:Xw,draggable:dr,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Pt,formTarget:null,headers:wn,height:Ee,hidden:Xw,high:Ee,href:null,hrefLang:null,htmlFor:wn,httpEquiv:wn,id:null,imageSizes:null,imageSrcSet:null,inert:Pt,inputMode:null,integrity:null,is:null,isMap:Pt,itemId:null,itemProp:wn,itemRef:wn,itemScope:Pt,itemType:wn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Pt,low:Ee,manifest:null,max:null,maxLength:Ee,media:null,method:null,min:null,minLength:Ee,multiple:Pt,muted:Pt,name:null,nonce:null,noModule:Pt,noValidate:Pt,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:Pt,optimum:Ee,pattern:null,ping:wn,placeholder:null,playsInline:Pt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Pt,referrerPolicy:null,rel:wn,required:Pt,reversed:Pt,rows:Ee,rowSpan:Ee,sandbox:wn,scope:null,scoped:Pt,seamless:Pt,selected:Pt,shadowRootClonable:Pt,shadowRootDelegatesFocus:Pt,shadowRootMode:null,shape:null,size:Ee,sizes:null,slot:null,span:Ee,spellCheck:dr,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ee,step:null,style:null,tabIndex:Ee,target:null,title:null,translate:null,type:null,typeMustMatch:Pt,useMap:null,value:dr,width:Ee,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:wn,axis:null,background:null,bgColor:null,border:Ee,borderColor:null,bottomMargin:Ee,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Pt,declare:Pt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ee,leftMargin:Ee,link:null,longDesc:null,lowSrc:null,marginHeight:Ee,marginWidth:Ee,noResize:Pt,noHref:Pt,noShade:Pt,noWrap:Pt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ee,rules:null,scheme:null,scrolling:dr,standby:null,summary:null,text:null,topMargin:Ee,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ee,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Pt,disableRemotePlayback:Pt,prefix:null,property:null,results:Ee,security:null,unselectable:null},space:"html",transform:DA}),F4=Wu({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:Os,accentHeight:Ee,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ee,amplitude:Ee,arabicForm:null,ascent:Ee,attributeName:null,attributeType:null,azimuth:Ee,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ee,by:null,calcMode:null,capHeight:Ee,className:wn,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:Ee,diffuseConstant:Ee,direction:null,display:null,dur:null,divisor:Ee,dominantBaseline:null,download:Pt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ee,enableBackground:null,end:null,event:null,exponent:Ee,externalResourcesRequired:null,fill:null,fillOpacity:Ee,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:mu,g2:mu,glyphName:mu,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ee,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ee,horizOriginX:Ee,horizOriginY:Ee,id:null,ideographic:Ee,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ee,k:Ee,k1:Ee,k2:Ee,k3:Ee,k4:Ee,kernelMatrix:Os,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ee,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:Ee,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:Ee,overlineThickness:Ee,paintOrder:null,panose1:null,path:null,pathLength:Ee,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:wn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ee,pointsAtY:Ee,pointsAtZ:Ee,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Os,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Os,rev:Os,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Os,requiredFeatures:Os,requiredFonts:Os,requiredFormats:Os,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:Ee,specularExponent:Ee,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ee,strikethroughThickness:Ee,string:null,stroke:null,strokeDashArray:Os,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ee,strokeOpacity:Ee,strokeWidth:null,style:null,surfaceScale:Ee,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Os,tabIndex:Ee,tableValues:null,target:null,targetX:Ee,targetY:Ee,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Os,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ee,underlineThickness:Ee,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ee,values:null,vAlphabetic:Ee,vMathematical:Ee,vectorEffect:null,vHanging:Ee,vIdeographic:Ee,version:null,vertAdvY:Ee,vertOriginX:Ee,vertOriginY:Ee,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ee,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:$A}),FA=Wu({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()}}),zA=Wu({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:DA}),BA=Wu({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),z4={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},B4=/[A-Z]/g,dN=/-[a-z]/g,H4=/^data[-\w.:]+$/i;function W4(e,t){const n=Gw(t);let r=t,s=Es;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&H4.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(dN,U4);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!dN.test(i)){let a=i.replace(B4,V4);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=Wv}return new s(r,t)}function V4(e){return"-"+e.toLowerCase()}function U4(e){return e.charAt(1).toUpperCase()}const K4=OA([MA,D4,FA,zA,BA],"html"),Vv=OA([MA,F4,FA,zA,BA],"svg");function q4(e){return e.join(" ").trim()}var Uv={},fN=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,Y4=/\n/g,G4=/^\s*/,X4=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,J4=/^:\s*/,Q4=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Z4=/^[;\s]*/,eH=/^\s+|\s+$/g,tH=`
|
|
67
|
-
`,pN="/",hN="*",Wl="",nH="comment",rH="declaration";function sH(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(g){var b=g.match(Y4);b&&(n+=b.length);var v=g.lastIndexOf(tH);r=~v?g.length-v:r+g.length}function i(){var g={line:n,column:r};return function(b){return b.position=new a(g),d(),b}}function a(g){this.start=g,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function l(g){var b=new Error(t.source+":"+n+":"+r+": "+g);if(b.reason=g,b.filename=t.source,b.line=n,b.column=r,b.source=e,!t.silent)throw b}function c(g){var b=g.exec(e);if(b){var v=b[0];return s(v),e=e.slice(v.length),b}}function d(){c(G4)}function f(g){var b;for(g=g||[];b=u();)b!==!1&&g.push(b);return g}function u(){var g=i();if(!(pN!=e.charAt(0)||hN!=e.charAt(1))){for(var b=2;Wl!=e.charAt(b)&&(hN!=e.charAt(b)||pN!=e.charAt(b+1));)++b;if(b+=2,Wl===e.charAt(b-1))return l("End of comment missing");var v=e.slice(2,b-2);return r+=2,s(v),e=e.slice(b),r+=2,g({type:nH,comment:v})}}function p(){var g=i(),b=c(X4);if(b){if(u(),!c(J4))return l("property missing ':'");var v=c(Q4),y=g({type:rH,property:mN(b[0].replace(fN,Wl)),value:v?mN(v[0].replace(fN,Wl)):Wl});return c(Z4),y}}function m(){var g=[];f(g);for(var b;b=p();)b!==!1&&(g.push(b),f(g));return g}return d(),m()}function mN(e){return e?e.replace(eH,Wl):Wl}var iH=sH,oH=af&&af.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Uv,"__esModule",{value:!0});Uv.default=lH;const aH=oH(iH);function lH(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,aH.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 $g={};Object.defineProperty($g,"__esModule",{value:!0});$g.camelCase=void 0;var cH=/^--[a-zA-Z0-9_-]+$/,uH=/-([a-z])/g,dH=/^[^-]+$/,fH=/^-(webkit|moz|ms|o|khtml)-/,pH=/^-(ms)-/,hH=function(e){return!e||dH.test(e)||cH.test(e)},mH=function(e,t){return t.toUpperCase()},gN=function(e,t){return"".concat(t,"-")},gH=function(e,t){return t===void 0&&(t={}),hH(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(pH,gN):e=e.replace(fH,gN),e.replace(uH,mH))};$g.camelCase=gH;var yH=af&&af.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},xH=yH(Uv),wH=$g;function Qw(e,t){var n={};return!e||typeof e!="string"||(0,xH.default)(e,function(r,s){r&&s&&(n[(0,wH.camelCase)(r,t)]=s)}),n}Qw.default=Qw;var bH=Qw;const vH=cl(bH),HA=WA("end"),Kv=WA("start");function WA(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 kH(e){const t=Kv(e),n=HA(e);if(t&&n)return{start:t,end:n}}function ef(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?yN(e.position):"start"in e||"end"in e?yN(e):"line"in e||"column"in e?Zw(e):""}function Zw(e){return xN(e&&e.line)+":"+xN(e&&e.column)}function yN(e){return Zw(e&&e.start)+"-"+Zw(e&&e.end)}function xN(e){return e&&typeof e=="number"?e:1}class Jr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(a=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=ef(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}}Jr.prototype.file="";Jr.prototype.name="";Jr.prototype.reason="";Jr.prototype.message="";Jr.prototype.stack="";Jr.prototype.column=void 0;Jr.prototype.line=void 0;Jr.prototype.ancestors=void 0;Jr.prototype.cause=void 0;Jr.prototype.fatal=void 0;Jr.prototype.place=void 0;Jr.prototype.ruleId=void 0;Jr.prototype.source=void 0;const qv={}.hasOwnProperty,SH=new Map,NH=/[A-Z]/g,jH=new Set(["table","tbody","thead","tfoot","tr"]),CH=new Set(["td","th"]),VA="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function EH(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=OH(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=LH(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"?Vv:K4,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=UA(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function UA(e,t,n){if(t.type==="element")return _H(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return PH(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return IH(e,t,n);if(t.type==="mdxjsEsm")return AH(e,t);if(t.type==="root")return TH(e,t,n);if(t.type==="text")return RH(e,t)}function _H(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Vv,e.schema=s),e.ancestors.push(t);const i=qA(e,t.tagName,!1),a=MH(e,t);let l=Gv(e,t);return jH.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!M4(c):!0})),KA(e,a,i,t),Yv(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function PH(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)}Of(e,t.position)}function AH(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Of(e,t.position)}function IH(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Vv,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:qA(e,t.name,!0),a=$H(e,t),l=Gv(e,t);return KA(e,a,i,t),Yv(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function TH(e,t,n){const r={};return Yv(r,Gv(e,t)),e.create(t,e.Fragment,r,n)}function RH(e,t){return t.value}function KA(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Yv(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function LH(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 OH(e,t){return n;function n(r,s,i,a){const l=Array.isArray(i.children),c=Kv(r);return t(s,i,a,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function MH(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&qv.call(t.properties,s)){const i=DH(e,s,t.properties[s]);if(i){const[a,l]=i;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&CH.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 $H(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 Of(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 Of(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function Gv(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:SH;for(;++r<t.children.length;){const i=t.children[r];let a;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const d=s.get(c)||0;a=c+"-"+d,s.set(c,d+1)}}const l=UA(e,i,a);l!==void 0&&n.push(l)}return n}function DH(e,t,n){const r=W4(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?I4(n):q4(n)),r.property==="style"){let s=typeof n=="object"?n:FH(e,String(n));return e.stylePropertyNameCase==="css"&&(s=zH(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?z4[r.property]||r.property:r.attribute,n]}}function FH(e,t){try{return vH(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Jr("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=VA+"#cannot-parse-style-attribute",s}}function qA(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 qv.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Of(e)}function Of(e,t){const n=new Jr("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=VA+"#cannot-handle-mdx-estrees-without-createevaluater",n}function zH(e){const t={};let n;for(n in e)qv.call(e,n)&&(t[BH(n)]=e[n]);return t}function BH(e){let t=e.replace(NH,HH);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function HH(e){return"-"+e.toLowerCase()}const Zy={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"]},WH={};function VH(e,t){const n=WH,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return YA(e,r,s)}function YA(e,t,n){if(UH(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 wN(e.children,t,n)}return Array.isArray(e)?wN(e,t,n):""}function wN(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=YA(e[s],t,n);return r.join("")}function UH(e){return!!(e&&typeof e=="object")}const bN=document.createElement("i");function Xv(e){const t="&"+e+";";bN.innerHTML=t;const n=bN.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function So(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 li(e,t){return e.length>0?(So(e,e.length,0,t),e):t}const vN={}.hasOwnProperty;function KH(e){const t={};let n=-1;for(;++n<e.length;)qH(t,e[n]);return t}function qH(e,t){let n;for(n in t){const s=(vN.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){vN.call(s,a)||(s[a]=[]);const l=i[a];YH(s[a],Array.isArray(l)?l:l?[l]:[])}}}function YH(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);So(e,0,0,r)}function GA(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function gu(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ho=pl(/[A-Za-z]/),zs=pl(/[\dA-Za-z]/),GH=pl(/[#-'*+\--9=?A-Z^-~]/);function eb(e){return e!==null&&(e<32||e===127)}const tb=pl(/\d/),XH=pl(/[\dA-Fa-f]/),JH=pl(/[!-/:-@[-`{-~]/);function yt(e){return e!==null&&e<-2}function js(e){return e!==null&&(e<0||e===32)}function Qt(e){return e===-2||e===-1||e===32}const QH=pl(new RegExp("\\p{P}|\\p{S}","u")),ZH=pl(/\s/);function pl(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Vu(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&zs(e.charCodeAt(n+1))&&zs(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 vn(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return Qt(c)?(e.enter(n),l(c)):t(c)}function l(c){return Qt(c)&&i++<s?(e.consume(c),l):(e.exit(n),t(c))}}const e6={tokenize:t6};function t6(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"),vn(e,t,"linePrefix")}function s(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,a(l)}function a(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return yt(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),a)}}const n6={tokenize:r6},kN={tokenize:s6};function r6(e){const t=this,n=[];let r=0,s,i,a;return l;function l(w){if(r<n.length){const j=n[r];return t.containerState=j[1],e.attempt(j[0].continuation,c,d)(w)}return d(w)}function c(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&k();const j=t.events.length;let A=j,C;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){C=t.events[A][1].end;break}y(r);let $=j;for(;$<t.events.length;)t.events[$][1].end={...C},$++;return So(t.events,A+1,0,t.events.slice(j)),t.events.length=$,d(w)}return l(w)}function d(w){if(r===n.length){if(!s)return p(w);if(s.currentConstruct&&s.currentConstruct.concrete)return g(w);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(kN,f,u)(w)}function f(w){return s&&k(),y(r),p(w)}function u(w){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,g(w)}function p(w){return t.containerState={},e.attempt(kN,m,g)(w)}function m(w){return r++,n.push([t.currentConstruct,t.containerState]),p(w)}function g(w){if(w===null){s&&k(),y(0),e.consume(w);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),b(w)}function b(w){if(w===null){v(e.exit("chunkFlow"),!0),y(0),e.consume(w);return}return yt(w)?(e.consume(w),v(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(w),b)}function v(w,j){const A=t.sliceStream(w);if(j&&A.push(null),w.previous=i,i&&(i.next=w),i=w,s.defineSkip(w.start),s.write(A),t.parser.lazy[w.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.events.length;let B=$,F,z;for(;B--;)if(t.events[B][0]==="exit"&&t.events[B][1].type==="chunkFlow"){if(F){z=t.events[B][1].end;break}F=!0}for(y(r),C=$;C<t.events.length;)t.events[C][1].end={...z},C++;So(t.events,B+1,0,t.events.slice($)),t.events.length=C}}function y(w){let j=n.length;for(;j-- >w;){const A=n[j];t.containerState=A[1],A[0].exit.call(t,e)}n.length=w}function k(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function s6(e,t,n){return vn(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function SN(e){if(e===null||js(e)||ZH(e))return 1;if(QH(e))return 2}function Jv(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:i6,tokenize:o6};function i6(e,t){let n=-1,r,s,i,a,l,c,d,f;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const u={...e[r][1].end},p={...e[n][1].start};NN(u,-c),NN(p,c),a={type:c>1?"strongSequence":"emphasisSequence",start:u,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[r][1].end={...a.start},e[n][1].start={...l.end},d=[],e[r][1].end.offset-e[r][1].start.offset&&(d=li(d,[["enter",e[r][1],t],["exit",e[r][1],t]])),d=li(d,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",i,t]]),d=li(d,Jv(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),d=li(d,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(f=2,d=li(d,[["enter",e[n][1],t],["exit",e[n][1],t]])):f=0,So(e,r-1,n-r+3,d),n=r+d.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function o6(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=SN(r);let i;return a;function a(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const d=e.exit("attentionSequence"),f=SN(c),u=!f||f===2&&s||n.includes(c),p=!s||s===2&&f||n.includes(r);return d._open=!!(i===42?u:u&&(s||!p)),d._close=!!(i===42?p:p&&(f||!u)),t(c)}}function NN(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const a6={name:"autolink",tokenize:l6};function l6(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 ho(m)?(e.consume(m),a):m===64?n(m):d(m)}function a(m){return m===43||m===45||m===46||zs(m)?(r=1,l(m)):d(m)}function l(m){return m===58?(e.consume(m),r=0,c):(m===43||m===45||m===46||zs(m))&&r++<32?(e.consume(m),l):(r=0,d(m))}function c(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||eb(m)?n(m):(e.consume(m),c)}function d(m){return m===64?(e.consume(m),f):GH(m)?(e.consume(m),d):n(m)}function f(m){return zs(m)?u(m):n(m)}function u(m){return m===46?(e.consume(m),r=0,f):m===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(m),e.exit("autolinkMarker"),e.exit("autolink"),t):p(m)}function p(m){if((m===45||zs(m))&&r++<63){const g=m===45?p:u;return e.consume(m),g}return n(m)}}const Dg={partial:!0,tokenize:c6};function c6(e,t,n){return r;function r(i){return Qt(i)?vn(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||yt(i)?t(i):n(i)}}const XA={continuation:{tokenize:d6},exit:f6,name:"blockQuote",tokenize:u6};function u6(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 Qt(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function d6(e,t,n){const r=this;return s;function s(a){return Qt(a)?vn(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(XA,t,n)(a)}}function f6(e){e.exit("blockQuote")}const JA={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 JH(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const QA={name:"characterReference",tokenize:h6};function h6(e,t,n){const r=this;let s=0,i,a;return l;function l(u){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(u),e.exit("characterReferenceMarker"),c}function c(u){return u===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(u),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),i=31,a=zs,f(u))}function d(u){return u===88||u===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(u),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,a=XH,f):(e.enter("characterReferenceValue"),i=7,a=tb,f(u))}function f(u){if(u===59&&s){const p=e.exit("characterReferenceValue");return a===zs&&!Xv(r.sliceSerialize(p))?n(u):(e.enter("characterReferenceMarker"),e.consume(u),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(u)&&s++<i?(e.consume(u),f):n(u)}}const jN={partial:!0,tokenize:g6},CN={concrete:!0,name:"codeFenced",tokenize:m6};function m6(e,t,n){const r=this,s={partial:!0,tokenize:A};let i=0,a=0,l;return c;function c(C){return d(C)}function d(C){const $=r.events[r.events.length-1];return i=$&&$[1].type==="linePrefix"?$[2].sliceSerialize($[1],!0).length:0,l=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),f(C)}function f(C){return C===l?(a++,e.consume(C),f):a<3?n(C):(e.exit("codeFencedFenceSequence"),Qt(C)?vn(e,u,"whitespace")(C):u(C))}function u(C){return C===null||yt(C)?(e.exit("codeFencedFence"),r.interrupt?t(C):e.check(jN,b,j)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(C))}function p(C){return C===null||yt(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),u(C)):Qt(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),vn(e,m,"whitespace")(C)):C===96&&C===l?n(C):(e.consume(C),p)}function m(C){return C===null||yt(C)?u(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(C))}function g(C){return C===null||yt(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),u(C)):C===96&&C===l?n(C):(e.consume(C),g)}function b(C){return e.attempt(s,j,v)(C)}function v(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),y}function y(C){return i>0&&Qt(C)?vn(e,k,"linePrefix",i+1)(C):k(C)}function k(C){return C===null||yt(C)?e.check(jN,b,j)(C):(e.enter("codeFlowValue"),w(C))}function w(C){return C===null||yt(C)?(e.exit("codeFlowValue"),k(C)):(e.consume(C),w)}function j(C){return e.exit("codeFenced"),t(C)}function A(C,$,B){let F=0;return z;function z(T){return C.enter("lineEnding"),C.consume(T),C.exit("lineEnding"),L}function L(T){return C.enter("codeFencedFence"),Qt(T)?vn(C,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):O(T)}function O(T){return T===l?(C.enter("codeFencedFenceSequence"),W(T)):B(T)}function W(T){return T===l?(F++,C.consume(T),W):F>=a?(C.exit("codeFencedFenceSequence"),Qt(T)?vn(C,M,"whitespace")(T):M(T)):B(T)}function M(T){return T===null||yt(T)?(C.exit("codeFencedFence"),$(T)):B(T)}}}function g6(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 ex={name:"codeIndented",tokenize:x6},y6={partial:!0,tokenize:w6};function x6(e,t,n){const r=this;return s;function s(d){return e.enter("codeIndented"),vn(e,i,"linePrefix",5)(d)}function i(d){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?a(d):n(d)}function a(d){return d===null?c(d):yt(d)?e.attempt(y6,a,c)(d):(e.enter("codeFlowValue"),l(d))}function l(d){return d===null||yt(d)?(e.exit("codeFlowValue"),a(d)):(e.consume(d),l)}function c(d){return e.exit("codeIndented"),t(d)}}function w6(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):yt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):vn(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):yt(a)?s(a):n(a)}}const b6={name:"codeText",previous:k6,resolve:v6,tokenize:S6};function v6(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 k6(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function S6(e,t,n){let r=0,s,i;return a;function a(u){return e.enter("codeText"),e.enter("codeTextSequence"),l(u)}function l(u){return u===96?(e.consume(u),r++,l):(e.exit("codeTextSequence"),c(u))}function c(u){return u===null?n(u):u===32?(e.enter("space"),e.consume(u),e.exit("space"),c):u===96?(i=e.enter("codeTextSequence"),s=0,f(u)):yt(u)?(e.enter("lineEnding"),e.consume(u),e.exit("lineEnding"),c):(e.enter("codeTextData"),d(u))}function d(u){return u===null||u===32||u===96||yt(u)?(e.exit("codeTextData"),c(u)):(e.consume(u),d)}function f(u){return u===96?(e.consume(u),s++,f):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(u)):(i.type="codeTextData",d(u))}}class N6{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&&Nd(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),Nd(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Nd(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);Nd(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Nd(this.left,n.reverse())}}}function Nd(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 ZA(e){const t={};let n=-1,r,s,i,a,l,c,d;const f=new N6(e);for(;++n<f.length;){for(;n in t;)n=t[n];if(r=f.get(n),n&&r[1].type==="chunkFlow"&&f.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,j6(f,n)),n=t[n],d=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(a=f.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(f.get(s)[1].type="lineEndingBlank"),a[1].type="lineEnding",s=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;s&&(r[1].end={...f.get(s)[1].start},l=f.slice(s,n),l.unshift(r),f.splice(s,n-s+1,l))}}return So(e,0,Number.POSITIVE_INFINITY,f.slice(0)),!d}function j6(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const l=a.events,c=[],d={};let f,u,p=-1,m=n,g=0,b=0;const v=[b];for(;m;){for(;e.get(++s)[1]!==m;);i.push(s),m._tokenizer||(f=r.sliceStream(m),m.next||f.push(null),u&&a.defineSkip(m.start),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(f),m._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),u=m,m=m.next}for(m=n;++p<l.length;)l[p][0]==="exit"&&l[p-1][0]==="enter"&&l[p][1].type===l[p-1][1].type&&l[p][1].start.line!==l[p][1].end.line&&(b=p+1,v.push(b),m._tokenizer=void 0,m.previous=void 0,m=m.next);for(a.events=[],m?(m._tokenizer=void 0,m.previous=void 0):v.pop(),p=v.length;p--;){const y=l.slice(v[p],v[p+1]),k=i.pop();c.push([k,k+y.length-1]),e.splice(k,2,y)}for(c.reverse(),p=-1;++p<c.length;)d[g+c[p][0]]=g+c[p][1],g+=c[p][1]-c[p][0]-1;return d}const C6={resolve:_6,tokenize:P6},E6={partial:!0,tokenize:A6};function _6(e){return ZA(e),e}function P6(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):yt(l)?e.check(E6,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 A6(e,t,n){const r=this;return s;function s(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),vn(e,i,"linePrefix")}function i(a){if(a===null||yt(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 eI(e,t,n,r,s,i,a,l,c){const d=c||Number.POSITIVE_INFINITY;let f=0;return u;function u(y){return y===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(y),e.exit(i),p):y===null||y===32||y===41||eb(y)?n(y):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),b(y))}function p(y){return y===62?(e.enter(i),e.consume(y),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),m(y))}function m(y){return y===62?(e.exit("chunkString"),e.exit(l),p(y)):y===null||y===60||yt(y)?n(y):(e.consume(y),y===92?g:m)}function g(y){return y===60||y===62||y===92?(e.consume(y),m):m(y)}function b(y){return!f&&(y===null||y===41||js(y))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(y)):f<d&&y===40?(e.consume(y),f++,b):y===41?(e.consume(y),f--,b):y===null||y===32||y===40||eb(y)?n(y):(e.consume(y),y===92?v:b)}function v(y){return y===40||y===41||y===92?(e.consume(y),b):b(y)}}function tI(e,t,n,r,s,i){const a=this;let l=0,c;return d;function d(m){return e.enter(r),e.enter(s),e.consume(m),e.exit(s),e.enter(i),f}function f(m){return l>999||m===null||m===91||m===93&&!c||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):yt(m)?(e.enter("lineEnding"),e.consume(m),e.exit("lineEnding"),f):(e.enter("chunkString",{contentType:"string"}),u(m))}function u(m){return m===null||m===91||m===93||yt(m)||l++>999?(e.exit("chunkString"),f(m)):(e.consume(m),c||(c=!Qt(m)),m===92?p:u)}function p(m){return m===91||m===92||m===93?(e.consume(m),l++,u):u(m)}}function nI(e,t,n,r,s,i){let a;return l;function l(p){return p===34||p===39||p===40?(e.enter(r),e.enter(s),e.consume(p),e.exit(s),a=p===40?41:p,c):n(p)}function c(p){return p===a?(e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):(e.enter(i),d(p))}function d(p){return p===a?(e.exit(i),c(a)):p===null?n(p):yt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),vn(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===a||p===null||yt(p)?(e.exit("chunkString"),d(p)):(e.consume(p),p===92?u:f)}function u(p){return p===a||p===92?(e.consume(p),f):f(p)}}function tf(e,t){let n;return r;function r(s){return yt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Qt(s)?vn(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const I6={name:"definition",tokenize:R6},T6={partial:!0,tokenize:L6};function R6(e,t,n){const r=this;let s;return i;function i(m){return e.enter("definition"),a(m)}function a(m){return tI.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(m)}function l(m){return s=gu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),c):n(m)}function c(m){return js(m)?tf(e,d)(m):d(m)}function d(m){return eI(e,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(m)}function f(m){return e.attempt(T6,u,u)(m)}function u(m){return Qt(m)?vn(e,p,"whitespace")(m):p(m)}function p(m){return m===null||yt(m)?(e.exit("definition"),r.parser.defined.push(s),t(m)):n(m)}}function L6(e,t,n){return r;function r(l){return js(l)?tf(e,s)(l):n(l)}function s(l){return nI(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Qt(l)?vn(e,a,"whitespace")(l):a(l)}function a(l){return l===null||yt(l)?t(l):n(l)}}const O6={name:"hardBreakEscape",tokenize:M6};function M6(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return yt(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const $6={name:"headingAtx",resolve:D6,tokenize:F6};function D6(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"},So(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function F6(e,t,n){let r=0;return s;function s(f){return e.enter("atxHeading"),i(f)}function i(f){return e.enter("atxHeadingSequence"),a(f)}function a(f){return f===35&&r++<6?(e.consume(f),a):f===null||js(f)?(e.exit("atxHeadingSequence"),l(f)):n(f)}function l(f){return f===35?(e.enter("atxHeadingSequence"),c(f)):f===null||yt(f)?(e.exit("atxHeading"),t(f)):Qt(f)?vn(e,l,"whitespace")(f):(e.enter("atxHeadingText"),d(f))}function c(f){return f===35?(e.consume(f),c):(e.exit("atxHeadingSequence"),l(f))}function d(f){return f===null||f===35||js(f)?(e.exit("atxHeadingText"),l(f)):(e.consume(f),d)}}const z6=["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"],EN=["pre","script","style","textarea"],B6={concrete:!0,name:"htmlFlow",resolveTo:V6,tokenize:U6},H6={partial:!0,tokenize:q6},W6={partial:!0,tokenize:K6};function V6(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 U6(e,t,n){const r=this;let s,i,a,l,c;return d;function d(V){return f(V)}function f(V){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(V),u}function u(V){return V===33?(e.consume(V),p):V===47?(e.consume(V),i=!0,b):V===63?(e.consume(V),s=3,r.interrupt?t:P):ho(V)?(e.consume(V),a=String.fromCharCode(V),v):n(V)}function p(V){return V===45?(e.consume(V),s=2,m):V===91?(e.consume(V),s=5,l=0,g):ho(V)?(e.consume(V),s=4,r.interrupt?t:P):n(V)}function m(V){return V===45?(e.consume(V),r.interrupt?t:P):n(V)}function g(V){const se="CDATA[";return V===se.charCodeAt(l++)?(e.consume(V),l===se.length?r.interrupt?t:O:g):n(V)}function b(V){return ho(V)?(e.consume(V),a=String.fromCharCode(V),v):n(V)}function v(V){if(V===null||V===47||V===62||js(V)){const se=V===47,ue=a.toLowerCase();return!se&&!i&&EN.includes(ue)?(s=1,r.interrupt?t(V):O(V)):z6.includes(a.toLowerCase())?(s=6,se?(e.consume(V),y):r.interrupt?t(V):O(V)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(V):i?k(V):w(V))}return V===45||zs(V)?(e.consume(V),a+=String.fromCharCode(V),v):n(V)}function y(V){return V===62?(e.consume(V),r.interrupt?t:O):n(V)}function k(V){return Qt(V)?(e.consume(V),k):z(V)}function w(V){return V===47?(e.consume(V),z):V===58||V===95||ho(V)?(e.consume(V),j):Qt(V)?(e.consume(V),w):z(V)}function j(V){return V===45||V===46||V===58||V===95||zs(V)?(e.consume(V),j):A(V)}function A(V){return V===61?(e.consume(V),C):Qt(V)?(e.consume(V),A):w(V)}function C(V){return V===null||V===60||V===61||V===62||V===96?n(V):V===34||V===39?(e.consume(V),c=V,$):Qt(V)?(e.consume(V),C):B(V)}function $(V){return V===c?(e.consume(V),c=null,F):V===null||yt(V)?n(V):(e.consume(V),$)}function B(V){return V===null||V===34||V===39||V===47||V===60||V===61||V===62||V===96||js(V)?A(V):(e.consume(V),B)}function F(V){return V===47||V===62||Qt(V)?w(V):n(V)}function z(V){return V===62?(e.consume(V),L):n(V)}function L(V){return V===null||yt(V)?O(V):Qt(V)?(e.consume(V),L):n(V)}function O(V){return V===45&&s===2?(e.consume(V),E):V===60&&s===1?(e.consume(V),D):V===62&&s===4?(e.consume(V),G):V===63&&s===3?(e.consume(V),P):V===93&&s===5?(e.consume(V),R):yt(V)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(H6,Z,W)(V)):V===null||yt(V)?(e.exit("htmlFlowData"),W(V)):(e.consume(V),O)}function W(V){return e.check(W6,M,Z)(V)}function M(V){return e.enter("lineEnding"),e.consume(V),e.exit("lineEnding"),T}function T(V){return V===null||yt(V)?W(V):(e.enter("htmlFlowData"),O(V))}function E(V){return V===45?(e.consume(V),P):O(V)}function D(V){return V===47?(e.consume(V),a="",_):O(V)}function _(V){if(V===62){const se=a.toLowerCase();return EN.includes(se)?(e.consume(V),G):O(V)}return ho(V)&&a.length<8?(e.consume(V),a+=String.fromCharCode(V),_):O(V)}function R(V){return V===93?(e.consume(V),P):O(V)}function P(V){return V===62?(e.consume(V),G):V===45&&s===2?(e.consume(V),P):O(V)}function G(V){return V===null||yt(V)?(e.exit("htmlFlowData"),Z(V)):(e.consume(V),G)}function Z(V){return e.exit("htmlFlow"),t(V)}}function K6(e,t,n){const r=this;return s;function s(a){return yt(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 q6(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Dg,t,n)}}const Y6={name:"htmlText",tokenize:G6};function G6(e,t,n){const r=this;let s,i,a;return l;function l(P){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(P),c}function c(P){return P===33?(e.consume(P),d):P===47?(e.consume(P),A):P===63?(e.consume(P),w):ho(P)?(e.consume(P),B):n(P)}function d(P){return P===45?(e.consume(P),f):P===91?(e.consume(P),i=0,g):ho(P)?(e.consume(P),k):n(P)}function f(P){return P===45?(e.consume(P),m):n(P)}function u(P){return P===null?n(P):P===45?(e.consume(P),p):yt(P)?(a=u,D(P)):(e.consume(P),u)}function p(P){return P===45?(e.consume(P),m):u(P)}function m(P){return P===62?E(P):P===45?p(P):u(P)}function g(P){const G="CDATA[";return P===G.charCodeAt(i++)?(e.consume(P),i===G.length?b:g):n(P)}function b(P){return P===null?n(P):P===93?(e.consume(P),v):yt(P)?(a=b,D(P)):(e.consume(P),b)}function v(P){return P===93?(e.consume(P),y):b(P)}function y(P){return P===62?E(P):P===93?(e.consume(P),y):b(P)}function k(P){return P===null||P===62?E(P):yt(P)?(a=k,D(P)):(e.consume(P),k)}function w(P){return P===null?n(P):P===63?(e.consume(P),j):yt(P)?(a=w,D(P)):(e.consume(P),w)}function j(P){return P===62?E(P):w(P)}function A(P){return ho(P)?(e.consume(P),C):n(P)}function C(P){return P===45||zs(P)?(e.consume(P),C):$(P)}function $(P){return yt(P)?(a=$,D(P)):Qt(P)?(e.consume(P),$):E(P)}function B(P){return P===45||zs(P)?(e.consume(P),B):P===47||P===62||js(P)?F(P):n(P)}function F(P){return P===47?(e.consume(P),E):P===58||P===95||ho(P)?(e.consume(P),z):yt(P)?(a=F,D(P)):Qt(P)?(e.consume(P),F):E(P)}function z(P){return P===45||P===46||P===58||P===95||zs(P)?(e.consume(P),z):L(P)}function L(P){return P===61?(e.consume(P),O):yt(P)?(a=L,D(P)):Qt(P)?(e.consume(P),L):F(P)}function O(P){return P===null||P===60||P===61||P===62||P===96?n(P):P===34||P===39?(e.consume(P),s=P,W):yt(P)?(a=O,D(P)):Qt(P)?(e.consume(P),O):(e.consume(P),M)}function W(P){return P===s?(e.consume(P),s=void 0,T):P===null?n(P):yt(P)?(a=W,D(P)):(e.consume(P),W)}function M(P){return P===null||P===34||P===39||P===60||P===61||P===96?n(P):P===47||P===62||js(P)?F(P):(e.consume(P),M)}function T(P){return P===47||P===62||js(P)?F(P):n(P)}function E(P){return P===62?(e.consume(P),e.exit("htmlTextData"),e.exit("htmlText"),t):n(P)}function D(P){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),_}function _(P){return Qt(P)?vn(e,R,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):R(P)}function R(P){return e.enter("htmlTextData"),a(P)}}const Qv={name:"labelEnd",resolveAll:Z6,resolveTo:e8,tokenize:t8},X6={tokenize:n8},J6={tokenize:r8},Q6={tokenize:s8};function Z6(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&&So(e,0,e.length,n),e}function e8(e,t){let n=e.length,r=0,s,i,a,l;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(a=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[i][1].start},end:{...e[a][1].end}},f={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return l=[["enter",c,t],["enter",d,t]],l=li(l,e.slice(i+1,i+r+3)),l=li(l,[["enter",f,t]]),l=li(l,Jv(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),l=li(l,[["exit",f,t],e[a-2],e[a-1],["exit",d,t]]),l=li(l,e.slice(a+1)),l=li(l,[["exit",c,t]]),So(e,i,e.length,l),e}function t8(e,t,n){const r=this;let s=r.events.length,i,a;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return l;function l(p){return i?i._inactive?u(p):(a=r.parser.defined.includes(gu(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),c):n(p)}function c(p){return p===40?e.attempt(X6,f,a?f:u)(p):p===91?e.attempt(J6,f,a?d:u)(p):a?f(p):u(p)}function d(p){return e.attempt(Q6,f,u)(p)}function f(p){return t(p)}function u(p){return i._balanced=!0,n(p)}}function n8(e,t,n){return r;function r(u){return e.enter("resource"),e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),s}function s(u){return js(u)?tf(e,i)(u):i(u)}function i(u){return u===41?f(u):eI(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(u)}function a(u){return js(u)?tf(e,c)(u):f(u)}function l(u){return n(u)}function c(u){return u===34||u===39||u===40?nI(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(u):f(u)}function d(u){return js(u)?tf(e,f)(u):f(u)}function f(u){return u===41?(e.enter("resourceMarker"),e.consume(u),e.exit("resourceMarker"),e.exit("resource"),t):n(u)}}function r8(e,t,n){const r=this;return s;function s(l){return tI.call(r,e,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(gu(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function s8(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 i8={name:"labelStartImage",resolveAll:Qv.resolveAll,tokenize:o8};function o8(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 a8={name:"labelStartLink",resolveAll:Qv.resolveAll,tokenize:l8};function l8(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 tx={name:"lineEnding",tokenize:c8};function c8(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),vn(e,t,"linePrefix")}}const Kh={name:"thematicBreak",tokenize:u8};function u8(e,t,n){let r=0,s;return i;function i(d){return e.enter("thematicBreak"),a(d)}function a(d){return s=d,l(d)}function l(d){return d===s?(e.enter("thematicBreakSequence"),c(d)):r>=3&&(d===null||yt(d))?(e.exit("thematicBreak"),t(d)):n(d)}function c(d){return d===s?(e.consume(d),r++,c):(e.exit("thematicBreakSequence"),Qt(d)?vn(e,l,"whitespace")(d):l(d))}}const hs={continuation:{tokenize:h8},exit:g8,name:"list",tokenize:p8},d8={partial:!0,tokenize:y8},f8={partial:!0,tokenize:m8};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 g=r.containerState.type||(m===42||m===43||m===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||m===r.containerState.marker:tb(m)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),m===42||m===45?e.check(Kh,n,d)(m):d(m);if(!r.interrupt||m===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(m)}return n(m)}function c(m){return tb(m)&&++a<10?(e.consume(m),c):(!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(Dg,r.interrupt?n:f,e.attempt(d8,p,u))}function f(m){return r.containerState.initialBlankLine=!0,i++,p(m)}function u(m){return Qt(m)?(e.enter("listItemPrefixWhitespace"),e.consume(m),e.exit("listItemPrefixWhitespace"),p):n(m)}function p(m){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(m)}}function h8(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Dg,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,vn(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Qt(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(f8,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,vn(e,e.attempt(hs,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function m8(e,t,n){const r=this;return vn(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 g8(e){e.exit(this.containerState.type)}function y8(e,t,n){const r=this;return vn(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!Qt(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const _N={name:"setextUnderline",resolveTo:x8,tokenize:w8};function x8(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 w8(e,t,n){const r=this;let s;return i;function i(d){let f=r.events.length,u;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){u=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||u)?(e.enter("setextHeadingLine"),s=d,a(d)):n(d)}function a(d){return e.enter("setextHeadingLineSequence"),l(d)}function l(d){return d===s?(e.consume(d),l):(e.exit("setextHeadingLineSequence"),Qt(d)?vn(e,c,"lineSuffix")(d):c(d))}function c(d){return d===null||yt(d)?(e.exit("setextHeadingLine"),t(d)):n(d)}}const b8={tokenize:v8};function v8(e){const t=this,n=e.attempt(Dg,r,e.attempt(this.parser.constructs.flowInitial,s,vn(e,e.attempt(this.parser.constructs.flow,s,e.attempt(C6,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 k8={resolveAll:sI()},S8=rI("string"),N8=rI("text");function rI(e){return{resolveAll:sI(e==="text"?j8:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,a,l);return a;function a(f){return d(f)?i(f):l(f)}function l(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),c}function c(f){return d(f)?(n.exit("data"),i(f)):(n.consume(f),c)}function d(f){if(f===null)return!0;const u=s[f];let p=-1;if(u)for(;++p<u.length;){const m=u[p];if(!m.previous||m.previous.call(r,r.previous))return!0}return!1}}}function sI(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 j8(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let i=s.length,a=-1,l=0,c;for(;i--;){const d=s[i];if(typeof d=="string"){for(a=d.length;d.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(d===-2)c=!0,l++;else if(d!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const d={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:r.start._bufferIndex+a,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...d.start},r.start.offset===r.end.offset?Object.assign(r,d):(e.splice(n,0,["enter",d,t],["exit",d,t]),n+=2)}n++}return e}const C8={42:hs,43:hs,45:hs,48:hs,49:hs,50:hs,51:hs,52:hs,53:hs,54:hs,55:hs,56:hs,57:hs,62:XA},E8={91:I6},_8={[-2]:ex,[-1]:ex,32:ex},P8={35:$6,42:Kh,45:[_N,Kh],60:B6,61:_N,95:Kh,96:CN,126:CN},A8={38:QA,92:JA},I8={[-5]:tx,[-4]:tx,[-3]:tx,33:i8,38:QA,42:nb,60:[a6,Y6],91:a8,92:[O6,JA],93:Qv,95:nb,96:b6},T8={null:[nb,k8]},R8={null:[42,95]},L8={null:[]},O8=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:R8,contentInitial:E8,disable:L8,document:C8,flow:P8,flowInitial:_8,insideSpan:T8,string:A8,text:I8},Symbol.toStringTag,{value:"Module"}));function M8(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let a=[],l=[];const c={attempt:$(A),check:$(C),consume:k,enter:w,exit:j,interrupt:$(C,{interrupt:!0})},d={code:null,containerState:{},defineSkip:b,events:[],now:g,parser:e,previous:null,sliceSerialize:p,sliceStream:m,write:u};let f=t.tokenize.call(d,c);return t.resolveAll&&i.push(t),d;function u(L){return a=li(a,L),v(),a[a.length-1]!==null?[]:(B(t,0),d.events=Jv(i,d.events,d),d.events)}function p(L,O){return D8(m(L),O)}function m(L){return $8(a,L)}function g(){const{_bufferIndex:L,_index:O,line:W,column:M,offset:T}=r;return{_bufferIndex:L,_index:O,line:W,column:M,offset:T}}function b(L){s[L.line]=L.column,z()}function v(){let L;for(;r._index<a.length;){const O=a[r._index];if(typeof O=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<O.length;)y(O.charCodeAt(r._bufferIndex));else y(O)}}function y(L){f=f(L)}function k(L){yt(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,z()):L!==-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=L}function w(L,O){const W=O||{};return W.type=L,W.start=g(),d.events.push(["enter",W,d]),l.push(W),W}function j(L){const O=l.pop();return O.end=g(),d.events.push(["exit",O,d]),O}function A(L,O){B(L,O.from)}function C(L,O){O.restore()}function $(L,O){return W;function W(M,T,E){let D,_,R,P;return Array.isArray(M)?Z(M):"tokenize"in M?Z([M]):G(M);function G(pe){return ge;function ge(ae){const be=ae!==null&&pe[ae],Pe=ae!==null&&pe.null,we=[...Array.isArray(be)?be:be?[be]:[],...Array.isArray(Pe)?Pe:Pe?[Pe]:[]];return Z(we)(ae)}}function Z(pe){return D=pe,_=0,pe.length===0?E:V(pe[_])}function V(pe){return ge;function ge(ae){return P=F(),R=pe,pe.partial||(d.currentConstruct=pe),pe.name&&d.parser.constructs.disable.null.includes(pe.name)?ue():pe.tokenize.call(O?Object.assign(Object.create(d),O):d,c,se,ue)(ae)}}function se(pe){return L(R,P),T}function ue(pe){return P.restore(),++_<D.length?V(D[_]):E}}}function B(L,O){L.resolveAll&&!i.includes(L)&&i.push(L),L.resolve&&So(d.events,O,d.events.length-O,L.resolve(d.events.slice(O),d)),L.resolveTo&&(d.events=L.resolveTo(d.events,d))}function F(){const L=g(),O=d.previous,W=d.currentConstruct,M=d.events.length,T=Array.from(l);return{from:M,restore:E};function E(){r=L,d.previous=O,d.currentConstruct=W,d.events.length=M,l=T,z()}}function z(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function $8(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 D8(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 F8(e){const r={constructs:KH([O8,...(e||{}).extensions||[]]),content:s(e6),defined:[],document:s(n6),flow:s(b8),lazy:{},string:s(S8),text:s(N8)};return r;function s(i){return a;function a(l){return M8(r,i,l)}}}function z8(e){for(;!ZA(e););return e}const PN=/[\0\t\n\r]/g;function B8(){let e=1,t="",n=!0,r;return s;function s(i,a,l){const c=[];let d,f,u,p,m;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),u=0,t="",n&&(i.charCodeAt(0)===65279&&u++,n=void 0);u<i.length;){if(PN.lastIndex=u,d=PN.exec(i),p=d&&d.index!==void 0?d.index:i.length,m=i.charCodeAt(p),!d){t=i.slice(u);break}if(m===10&&u===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),u<p&&(c.push(i.slice(u,p)),e+=p-u),m){case 0:{c.push(65533),e++;break}case 9:{for(f=Math.ceil(e/4)*4,c.push(-2);e++<f;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}u=p+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const H8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function W8(e){return e.replace(H8,V8)}function V8(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return GA(n.slice(i?2:1),i?16:10)}return Xv(n)||e}const iI={}.hasOwnProperty;function U8(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),K8(n)(z8(F8(n).document().write(B8()(e,t,!0))))}function K8(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(St),autolinkProtocol:F,autolinkEmail:F,atxHeading:i(ct),blockQuote:i(Pe),characterEscape:F,characterReference:F,codeFenced:i(we),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(we,a),codeText:i(_e,a),codeTextData:F,data:F,codeFlowValue:F,definition:i(Ie),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(st),hardBreakEscape:i(et),hardBreakTrailing:i(et),htmlFlow:i(Et,a),htmlFlowData:F,htmlText:i(Et,a),htmlTextData:F,image:i(Ue),label:a,link:i(St),listItem:i(gn),listItemValue:p,listOrdered:i(tn,u),listUnordered:i(tn),paragraph:i(Tn),reference:V,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(ct),strong:i(zt),thematicBreak:i(Bn)},exit:{atxHeading:c(),atxHeadingSequence:A,autolink:c(),autolinkEmail:be,autolinkProtocol:ae,blockQuote:c(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:ue,characterReferenceMarkerNumeric:ue,characterReferenceValue:pe,characterReference:ge,codeFenced:c(v),codeFencedFence:b,codeFencedFenceInfo:m,codeFencedFenceMeta:g,codeFlowValue:z,codeIndented:c(y),codeText:c(T),codeTextData:z,data:z,definition:c(),definitionDestinationString:j,definitionLabelString:k,definitionTitleString:w,emphasis:c(),hardBreakEscape:c(O),hardBreakTrailing:c(O),htmlFlow:c(W),htmlFlowData:z,htmlText:c(M),htmlTextData:z,image:c(D),label:R,labelText:_,lineEnding:L,link:c(E),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:se,resourceDestinationString:P,resourceTitleString:G,resource:Z,setextHeading:c(B),setextHeadingLineSequence:$,setextHeadingText:C,strong:c(),thematicBreak:c()}};oI(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(le){let fe={type:"root",children:[]};const ze={stack:[fe],tokenStack:[],config:t,enter:l,exit:d,buffer:a,resume:f,data:n},Ze=[];let ot=-1;for(;++ot<le.length;)if(le[ot][1].type==="listOrdered"||le[ot][1].type==="listUnordered")if(le[ot][0]==="enter")Ze.push(ot);else{const Jt=Ze.pop();ot=s(le,Jt,ot)}for(ot=-1;++ot<le.length;){const Jt=t[le[ot][0]];iI.call(Jt,le[ot][1].type)&&Jt[le[ot][1].type].call(Object.assign({sliceSerialize:le[ot][2].sliceSerialize},ze),le[ot][1])}if(ze.tokenStack.length>0){const Jt=ze.tokenStack[ze.tokenStack.length-1];(Jt[1]||AN).call(ze,void 0,Jt[0])}for(fe.position={start:Ia(le.length>0?le[0][1].start:{line:1,column:1,offset:0}),end:Ia(le.length>0?le[le.length-2][1].end:{line:1,column:1,offset:0})},ot=-1;++ot<t.transforms.length;)fe=t.transforms[ot](fe)||fe;return fe}function s(le,fe,ze){let Ze=fe-1,ot=-1,Jt=!1,nn,Ln,yn,ir;for(;++Ze<=ze;){const rn=le[Ze];switch(rn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{rn[0]==="enter"?ot++:ot--,ir=void 0;break}case"lineEndingBlank":{rn[0]==="enter"&&(nn&&!ir&&!ot&&!yn&&(yn=Ze),ir=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ir=void 0}if(!ot&&rn[0]==="enter"&&rn[1].type==="listItemPrefix"||ot===-1&&rn[0]==="exit"&&(rn[1].type==="listUnordered"||rn[1].type==="listOrdered")){if(nn){let Sn=Ze;for(Ln=void 0;Sn--;){const Zt=le[Sn];if(Zt[1].type==="lineEnding"||Zt[1].type==="lineEndingBlank"){if(Zt[0]==="exit")continue;Ln&&(le[Ln][1].type="lineEndingBlank",Jt=!0),Zt[1].type="lineEnding",Ln=Sn}else if(!(Zt[1].type==="linePrefix"||Zt[1].type==="blockQuotePrefix"||Zt[1].type==="blockQuotePrefixWhitespace"||Zt[1].type==="blockQuoteMarker"||Zt[1].type==="listItemIndent"))break}yn&&(!Ln||yn<Ln)&&(nn._spread=!0),nn.end=Object.assign({},Ln?le[Ln][1].start:rn[1].end),le.splice(Ln||Ze,0,["exit",nn,rn[2]]),Ze++,ze++}if(rn[1].type==="listItemPrefix"){const Sn={type:"listItem",_spread:!1,start:Object.assign({},rn[1].start),end:void 0};nn=Sn,le.splice(Ze,0,["enter",Sn,rn[2]]),Ze++,ze++,yn=void 0,ir=!0}}}return le[fe][1]._spread=Jt,ze}function i(le,fe){return ze;function ze(Ze){l.call(this,le(Ze),Ze),fe&&fe.call(this,Ze)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(le,fe,ze){this.stack[this.stack.length-1].children.push(le),this.stack.push(le),this.tokenStack.push([fe,ze||void 0]),le.position={start:Ia(fe.start),end:void 0}}function c(le){return fe;function fe(ze){le&&le.call(this,ze),d.call(this,ze)}}function d(le,fe){const ze=this.stack.pop(),Ze=this.tokenStack.pop();if(Ze)Ze[0].type!==le.type&&(fe?fe.call(this,le,Ze[0]):(Ze[1]||AN).call(this,le,Ze[0]));else throw new Error("Cannot close `"+le.type+"` ("+ef({start:le.start,end:le.end})+"): it’s not open");ze.position.end=Ia(le.end)}function f(){return VH(this.stack.pop())}function u(){this.data.expectingFirstListItemValue=!0}function p(le){if(this.data.expectingFirstListItemValue){const fe=this.stack[this.stack.length-2];fe.start=Number.parseInt(this.sliceSerialize(le),10),this.data.expectingFirstListItemValue=void 0}}function m(){const le=this.resume(),fe=this.stack[this.stack.length-1];fe.lang=le}function g(){const le=this.resume(),fe=this.stack[this.stack.length-1];fe.meta=le}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function v(){const le=this.resume(),fe=this.stack[this.stack.length-1];fe.value=le.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const le=this.resume(),fe=this.stack[this.stack.length-1];fe.value=le.replace(/(\r?\n|\r)$/g,"")}function k(le){const fe=this.resume(),ze=this.stack[this.stack.length-1];ze.label=fe,ze.identifier=gu(this.sliceSerialize(le)).toLowerCase()}function w(){const le=this.resume(),fe=this.stack[this.stack.length-1];fe.title=le}function j(){const le=this.resume(),fe=this.stack[this.stack.length-1];fe.url=le}function A(le){const fe=this.stack[this.stack.length-1];if(!fe.depth){const ze=this.sliceSerialize(le).length;fe.depth=ze}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function $(le){const fe=this.stack[this.stack.length-1];fe.depth=this.sliceSerialize(le).codePointAt(0)===61?1:2}function B(){this.data.setextHeadingSlurpLineEnding=void 0}function F(le){const ze=this.stack[this.stack.length-1].children;let Ze=ze[ze.length-1];(!Ze||Ze.type!=="text")&&(Ze=Rn(),Ze.position={start:Ia(le.start),end:void 0},ze.push(Ze)),this.stack.push(Ze)}function z(le){const fe=this.stack.pop();fe.value+=this.sliceSerialize(le),fe.position.end=Ia(le.end)}function L(le){const fe=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ze=fe.children[fe.children.length-1];ze.position.end=Ia(le.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(fe.type)&&(F.call(this,le),z.call(this,le))}function O(){this.data.atHardBreak=!0}function W(){const le=this.resume(),fe=this.stack[this.stack.length-1];fe.value=le}function M(){const le=this.resume(),fe=this.stack[this.stack.length-1];fe.value=le}function T(){const le=this.resume(),fe=this.stack[this.stack.length-1];fe.value=le}function E(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=fe,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function D(){const le=this.stack[this.stack.length-1];if(this.data.inReference){const fe=this.data.referenceType||"shortcut";le.type+="Reference",le.referenceType=fe,delete le.url,delete le.title}else delete le.identifier,delete le.label;this.data.referenceType=void 0}function _(le){const fe=this.sliceSerialize(le),ze=this.stack[this.stack.length-2];ze.label=W8(fe),ze.identifier=gu(fe).toLowerCase()}function R(){const le=this.stack[this.stack.length-1],fe=this.resume(),ze=this.stack[this.stack.length-1];if(this.data.inReference=!0,ze.type==="link"){const Ze=le.children;ze.children=Ze}else ze.alt=fe}function P(){const le=this.resume(),fe=this.stack[this.stack.length-1];fe.url=le}function G(){const le=this.resume(),fe=this.stack[this.stack.length-1];fe.title=le}function Z(){this.data.inReference=void 0}function V(){this.data.referenceType="collapsed"}function se(le){const fe=this.resume(),ze=this.stack[this.stack.length-1];ze.label=fe,ze.identifier=gu(this.sliceSerialize(le)).toLowerCase(),this.data.referenceType="full"}function ue(le){this.data.characterReferenceType=le.type}function pe(le){const fe=this.sliceSerialize(le),ze=this.data.characterReferenceType;let Ze;ze?(Ze=GA(fe,ze==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ze=Xv(fe);const ot=this.stack[this.stack.length-1];ot.value+=Ze}function ge(le){const fe=this.stack.pop();fe.position.end=Ia(le.end)}function ae(le){z.call(this,le);const fe=this.stack[this.stack.length-1];fe.url=this.sliceSerialize(le)}function be(le){z.call(this,le);const fe=this.stack[this.stack.length-1];fe.url="mailto:"+this.sliceSerialize(le)}function Pe(){return{type:"blockquote",children:[]}}function we(){return{type:"code",lang:null,meta:null,value:""}}function _e(){return{type:"inlineCode",value:""}}function Ie(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function st(){return{type:"emphasis",children:[]}}function ct(){return{type:"heading",depth:0,children:[]}}function et(){return{type:"break"}}function Et(){return{type:"html",value:""}}function Ue(){return{type:"image",title:null,url:"",alt:null}}function St(){return{type:"link",title:null,url:"",children:[]}}function tn(le){return{type:"list",ordered:le.type==="listOrdered",start:null,spread:le._spread,children:[]}}function gn(le){return{type:"listItem",spread:le._spread,checked:null,children:[]}}function Tn(){return{type:"paragraph",children:[]}}function zt(){return{type:"strong",children:[]}}function Rn(){return{type:"text",value:""}}function Bn(){return{type:"thematicBreak"}}}function Ia(e){return{line:e.line,column:e.column,offset:e.offset}}function oI(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?oI(e,r):q8(e,r)}}function q8(e,t){let n;for(n in t)if(iI.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 AN(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ef({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ef({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ef({start:t.start,end:t.end})+") is still open")}function Y8(e){const t=this;t.parser=n;function n(r){return U8(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function G8(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 X8(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
70
|
-
`}]}function J8(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 Q8(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Z8(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function e9(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Vu(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let a,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=i+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,c);const d={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,d),e.applyData(t,d)}function t9(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 n9(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function aI(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 r9(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return aI(e,t);const s={src:Vu(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 s9(e,t){const n={src:Vu(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 i9(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 o9(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return aI(e,t);const s={href:Vu(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 a9(e,t){const n={href:Vu(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 l9(e,t,n){const r=e.all(t),s=n?c9(n):lI(t),i={},a=[];if(typeof t.checked=="boolean"){const f=r[0];let u;f&&f.type==="element"&&f.tagName==="p"?u=f:(u={type:"element",tagName:"p",properties:{},children:[]},r.unshift(u)),u.children.length>0&&u.children.unshift({type:"text",value:" "}),u.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const f=r[l];(s||l!==0||f.type!=="element"||f.tagName!=="p")&&a.push({type:"text",value:`
|
|
72
|
-
`}),f.type==="element"&&f.tagName==="p"&&!s?a.push(...f.children):a.push(f)}const c=r[r.length-1];c&&(s||c.type!=="element"||c.tagName!=="p")&&a.push({type:"text",value:`
|
|
73
|
-
`});const d={type:"element",tagName:"li",properties:i,children:a};return e.patch(t,d),e.applyData(t,d)}function c9(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=lI(n[r])}return t}function lI(e){const t=e.spread;return t??e.children.length>1}function u9(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 d9(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function f9(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function p9(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function h9(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=Kv(t.children[1]),c=HA(t.children[t.children.length-1]);l&&c&&(a.position={start:l,end:c}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function m9(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:t.children.length;let c=-1;const d=[];for(;++c<l;){const u=t.children[c],p={},m=a?a[c]:void 0;m&&(p.align=m);let g={type:"element",tagName:i,properties:p,children:[]};u&&(g.children=e.all(u),e.patch(u,g),g=e.applyData(u,g)),d.push(g)}const f={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,f),e.applyData(t,f)}function g9(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const IN=9,TN=32;function y9(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(RN(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(RN(t.slice(s),s>0,!1)),i.join("")}function RN(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===IN||i===TN;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===IN||i===TN;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function x9(e,t){const n={type:"text",value:y9(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function w9(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const b9={blockquote:G8,break:X8,code:J8,delete:Q8,emphasis:Z8,footnoteReference:e9,heading:t9,html:n9,imageReference:r9,image:s9,inlineCode:i9,linkReference:o9,link:a9,listItem:l9,list:u9,paragraph:d9,root:f9,strong:p9,table:h9,tableCell:g9,tableRow:m9,text:x9,thematicBreak:w9,toml:ph,yaml:ph,definition:ph,footnoteDefinition:ph};function ph(){}const cI=-1,Fg=0,nf=1,Mm=2,Zv=3,e0=4,t0=5,n0=6,uI=7,dI=8,LN=typeof self=="object"?self:globalThis,v9=(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 Fg:case cI:return n(a,s);case nf:{const l=n([],s);for(const c of a)l.push(r(c));return l}case Mm:{const l=n({},s);for(const[c,d]of a)l[r(c)]=r(d);return l}case Zv:return n(new Date(a),s);case e0:{const{source:l,flags:c}=a;return n(new RegExp(l,c),s)}case t0:{const l=n(new Map,s);for(const[c,d]of a)l.set(r(c),r(d));return l}case n0:{const l=n(new Set,s);for(const c of a)l.add(r(c));return l}case uI:{const{name:l,message:c}=a;return n(new LN[l](c),s)}case dI: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 LN[i](a),s)};return r},ON=e=>v9(new Map,e)(0),Oc="",{toString:k9}={},{keys:S9}=Object,jd=e=>{const t=typeof e;if(t!=="object"||!e)return[Fg,t];const n=k9.call(e).slice(8,-1);switch(n){case"Array":return[nf,Oc];case"Object":return[Mm,Oc];case"Date":return[Zv,Oc];case"RegExp":return[e0,Oc];case"Map":return[t0,Oc];case"Set":return[n0,Oc];case"DataView":return[nf,n]}return n.includes("Array")?[nf,n]:n.includes("Error")?[uI,n]:[Mm,n]},hh=([e,t])=>e===Fg&&(t==="function"||t==="symbol"),N9=(e,t,n,r)=>{const s=(a,l)=>{const c=r.push(a)-1;return n.set(l,c),c},i=a=>{if(n.has(a))return n.get(a);let[l,c]=jd(a);switch(l){case Fg:{let f=a;switch(c){case"bigint":l=dI,f=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);f=null;break;case"undefined":return s([cI],a)}return s([l,f],a)}case nf:{if(c){let p=a;return c==="DataView"?p=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(a)),s([c,[...p]],a)}const f=[],u=s([l,f],a);for(const p of a)f.push(i(p));return u}case Mm:{if(c)switch(c){case"BigInt":return s([c,a.toString()],a);case"Boolean":case"Number":case"String":return s([c,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const f=[],u=s([l,f],a);for(const p of S9(a))(e||!hh(jd(a[p])))&&f.push([i(p),i(a[p])]);return u}case Zv:return s([l,a.toISOString()],a);case e0:{const{source:f,flags:u}=a;return s([l,{source:f,flags:u}],a)}case t0:{const f=[],u=s([l,f],a);for(const[p,m]of a)(e||!(hh(jd(p))||hh(jd(m))))&&f.push([i(p),i(m)]);return u}case n0:{const f=[],u=s([l,f],a);for(const p of a)(e||!hh(jd(p)))&&f.push(i(p));return u}}const{message:d}=a;return s([l,{name:c,message:d}],a)};return i},MN=(e,{json:t,lossy:n}={})=>{const r=[];return N9(!(t||n),!!t,new Map,r)(e),r},$m=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?ON(MN(e,t)):structuredClone(e):(e,t)=>ON(MN(e,t));function j9(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 C9(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function E9(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||j9,r=e.options.footnoteBackLabel||C9,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[c]);if(!d)continue;const f=e.all(d),u=String(d.identifier).toUpperCase(),p=Vu(u.toLowerCase());let m=0;const g=[],b=e.footnoteCounts.get(u);for(;b!==void 0&&++m<=b;){g.length>0&&g.push({type:"text",value:" "});let k=typeof n=="string"?n:n(c,m);typeof k=="string"&&(k={type:"text",value:k}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(m>1?"-"+m:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,m),className:["data-footnote-backref"]},children:Array.isArray(k)?k:[k]})}const v=f[f.length-1];if(v&&v.type==="element"&&v.tagName==="p"){const k=v.children[v.children.length-1];k&&k.type==="text"?k.value+=" ":v.children.push({type:"text",value:" "}),v.children.push(...g)}else f.push(...g);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(f,!0)};e.patch(d,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...$m(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 fI=function(e){if(e==null)return I9;if(typeof e=="function")return zg(e);if(typeof e=="object")return Array.isArray(e)?_9(e):P9(e);if(typeof e=="string")return A9(e);throw new Error("Expected function, string, or object as test")};function _9(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=fI(e[n]);return zg(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function P9(e){const t=e;return zg(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function A9(e){return zg(t);function t(n){return n&&n.type===e}}function zg(e){return t;function t(n,r,s){return!!(T9(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function I9(){return!0}function T9(e){return e!==null&&typeof e=="object"&&"type"in e}const pI=[],R9=!0,$N=!1,L9="skip";function O9(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=fI(s),a=r?-1:1;l(e,void 0,[])();function l(c,d,f){const u=c&&typeof c=="object"?c:{};if(typeof u.type=="string"){const m=typeof u.tagName=="string"?u.tagName:typeof u.name=="string"?u.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(m?"<"+m+">":""))+")"})}return p;function p(){let m=pI,g,b,v;if((!t||i(c,d,f[f.length-1]||void 0))&&(m=M9(n(c,f)),m[0]===$N))return m;if("children"in c&&c.children){const y=c;if(y.children&&m[0]!==L9)for(b=(r?y.children.length:-1)+a,v=f.concat(y);b>-1&&b<y.children.length;){const k=y.children[b];if(g=l(k,b,v)(),g[0]===$N)return g;b=typeof g[1]=="number"?g[1]:b+a}}return m}}}function M9(e){return Array.isArray(e)?e:typeof e=="number"?[R9,e]:e==null?pI:[e]}function hI(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),O9(e,i,l,s);function l(c,d){const f=d[d.length-1],u=f?f.children.indexOf(c):void 0;return a(c,u,f)}}const rb={}.hasOwnProperty,$9={};function D9(e,t){const n=t||$9,r=new Map,s=new Map,i=new Map,a={...b9,...n.handlers},l={all:d,applyData:z9,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:a,one:c,options:n,patch:F9,wrap:H9};return hI(e,function(f){if(f.type==="definition"||f.type==="footnoteDefinition"){const u=f.type==="definition"?r:s,p=String(f.identifier).toUpperCase();u.has(p)||u.set(p,f)}}),l;function c(f,u){const p=f.type,m=l.handlers[p];if(rb.call(l.handlers,p)&&m)return m(l,f,u);if(l.options.passThrough&&l.options.passThrough.includes(p)){if("children"in f){const{children:b,...v}=f,y=$m(v);return y.children=l.all(f),y}return $m(f)}return(l.options.unknownHandler||B9)(l,f,u)}function d(f){const u=[];if("children"in f){const p=f.children;let m=-1;for(;++m<p.length;){const g=l.one(p[m],f);if(g){if(m&&p[m-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=DN(g.value)),!Array.isArray(g)&&g.type==="element")){const b=g.children[0];b&&b.type==="text"&&(b.value=DN(b.value))}Array.isArray(g)?u.push(...g):u.push(g)}}}return u}}function F9(e,t){e.position&&(t.position=kH(e))}function z9(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,$m(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function B9(e,t){const n=t.data||{},r="value"in t&&!(rb.call(n,"hProperties")||rb.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 H9(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 DN(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function FN(e,t){const n=D9(e,t),r=n.one(e,void 0),s=E9(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 W9(e,t){return e&&"run"in e?async function(n,r){const s=FN(n,{file:r,...t});await e.run(s,r)}:function(n,r){return FN(n,{file:r,...e||t})}}function zN(e){if(e)throw e}var qh=Object.prototype.hasOwnProperty,mI=Object.prototype.toString,BN=Object.defineProperty,HN=Object.getOwnPropertyDescriptor,WN=function(t){return typeof Array.isArray=="function"?Array.isArray(t):mI.call(t)==="[object Array]"},VN=function(t){if(!t||mI.call(t)!=="[object Object]")return!1;var n=qh.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&qh.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||qh.call(t,s)},UN=function(t,n){BN&&n.name==="__proto__"?BN(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},KN=function(t,n){if(n==="__proto__")if(qh.call(t,n)){if(HN)return HN(t,n).value}else return;return t[n]},V9=function e(){var t,n,r,s,i,a,l=arguments[0],c=1,d=arguments.length,f=!1;for(typeof l=="boolean"&&(f=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<d;++c)if(t=arguments[c],t!=null)for(n in t)r=KN(l,n),s=KN(t,n),l!==s&&(f&&s&&(VN(s)||(i=WN(s)))?(i?(i=!1,a=r&&WN(r)?r:[]):a=r&&VN(r)?r:{},UN(l,{name:n,newValue:e(f,a,s)})):typeof s<"u"&&UN(l,{name:n,newValue:s}));return l};const nx=cl(V9);function sb(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 U9(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const a=s.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);l(null,...s);function l(c,...d){const f=e[++i];let u=-1;if(c){a(c);return}for(;++u<s.length;)(d[u]===null||d[u]===void 0)&&(d[u]=s[u]);s=d,f?K9(f,l)(...d):a(null,...d)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function K9(e,t){let n;return r;function r(...a){const l=e.length>a.length;let c;l&&a.push(s);try{c=e.apply(this,a)}catch(d){const f=d;if(l&&n)throw f;return s(f)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(a,...l){n||(n=!0,t(a,...l))}function i(a){s(null,a)}}const lo={basename:q9,dirname:Y9,extname:G9,join:X9,sep:"/"};function q9(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');op(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 Y9(e){if(op(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 G9(e){op(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 X9(...e){let t=-1,n;for(;++t<e.length;)op(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":J9(n)}function J9(e){op(e);const t=e.codePointAt(0)===47;let n=Q9(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function Q9(e,t){let n="",r=0,s=-1,i=0,a=-1,l,c;for(;++a<=e.length;){if(a<e.length)l=e.codePointAt(a);else{if(l===47)break;l=47}if(l===47){if(!(s===a-1||i===1))if(s!==a-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),r=a-s-1;s=a,i=0}else l===46&&i>-1?i++:i=-1}return n}function op(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Z9={cwd:eW};function eW(){return"/"}function ib(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function tW(e){if(typeof e=="string")e=new URL(e);else if(!ib(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 nW(e)}function nW(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 rx=["history","path","basename","stem","extname","dirname"];class gI{constructor(t){let n;t?ib(t)?n={path:t}:typeof t=="string"||rW(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Z9.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<rx.length;){const i=rx[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)rx.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?lo.basename(this.path):void 0}set basename(t){ix(t,"basename"),sx(t,"basename"),this.path=lo.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?lo.dirname(this.path):void 0}set dirname(t){qN(this.basename,"dirname"),this.path=lo.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?lo.extname(this.path):void 0}set extname(t){if(sx(t,"extname"),qN(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=lo.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ib(t)&&(t=tW(t)),ix(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?lo.basename(this.path,this.extname):void 0}set stem(t){ix(t,"stem"),sx(t,"stem"),this.path=lo.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 Jr(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 sx(e,t){if(e&&e.includes(lo.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+lo.sep+"`")}function ix(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function qN(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function rW(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const sW=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},iW={}.hasOwnProperty;class r0 extends sW{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=U9()}copy(){const t=new r0;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(nx(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(lx("data",this.frozen),this.namespace[t]=n,this):iW.call(this.namespace,t)&&this.namespace[t]||void 0:t?(lx("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=mh(t),r=this.parser||this.Parser;return ox("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),ox("process",this.parser||this.Parser),ax("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,a){const l=mh(t),c=r.parse(l);r.run(c,l,function(f,u,p){if(f||!u||!p)return d(f);const m=u,g=r.stringify(m,p);lW(g)?p.value=g:p.result=g,d(f,p)});function d(f,u){f||!u?a(f):i?i(u):n(void 0,u)}}}processSync(t){let n=!1,r;return this.freeze(),ox("processSync",this.parser||this.Parser),ax("processSync",this.compiler||this.Compiler),this.process(t,s),GN("processSync","process",n),r;function s(i,a){n=!0,zN(i),r=a}}run(t,n,r){YN(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(a,l){const c=mh(n);s.run(t,c,d);function d(f,u,p){const m=u||t;f?l(f):a?a(m):r(void 0,m,p)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),GN("runSync","run",r),s;function i(a,l){zN(a),s=l,r=!0}}stringify(t,n){this.freeze();const r=mh(n),s=this.compiler||this.Compiler;return ax("stringify",s),YN(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(lx("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(d){if(typeof d=="function")c(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[f,...u]=d;c(f,u)}else a(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function a(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(d.plugins),d.settings&&(s.settings=nx(!0,s.settings,d.settings))}function l(d){let f=-1;if(d!=null)if(Array.isArray(d))for(;++f<d.length;){const u=d[f];i(u)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function c(d,f){let u=-1,p=-1;for(;++u<r.length;)if(r[u][0]===d){p=u;break}if(p===-1)r.push([d,...f]);else if(f.length>0){let[m,...g]=f;const b=r[p][1];sb(b)&&sb(m)&&(m=nx(!0,b,m)),r[p]=[d,m,...g]}}}}const oW=new r0().freeze();function ox(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ax(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function lx(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 YN(e){if(!sb(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function GN(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function mh(e){return aW(e)?e:new gI(e)}function aW(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function lW(e){return typeof e=="string"||cW(e)}function cW(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const uW="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",XN=[],JN={allowDangerousHtml:!0},dW=/^(https?|ircs?|mailto|xmpp)$/i,fW=[{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 Uu(e){const t=pW(e),n=hW(e);return mW(t.runSync(t.parse(n),n),e)}function pW(e){const t=e.rehypePlugins||XN,n=e.remarkPlugins||XN,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...JN}:JN;return oW().use(Y8).use(n).use(W9,r).use(t)}function hW(e){const t=e.children||"",n=new gI;return typeof t=="string"&&(n.value=t),n}function mW(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||gW;for(const f of fW)Object.hasOwn(t,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+uW+f.id,void 0);return hI(e,d),EH(e,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function d(f,u,p){if(f.type==="raw"&&p&&typeof u=="number")return a?p.children.splice(u,1):p.children[u]={type:"text",value:f.value},u;if(f.type==="element"){let m;for(m in Zy)if(Object.hasOwn(Zy,m)&&Object.hasOwn(f.properties,m)){const g=f.properties[m],b=Zy[m];(b===null||b.includes(f.tagName))&&(f.properties[m]=c(String(g||""),m,f))}}if(f.type==="element"){let m=n?!n.includes(f.tagName):i?i.includes(f.tagName):!1;if(!m&&r&&typeof u=="number"&&(m=!r(f,u,p)),m&&p&&typeof u=="number")return l&&f.children?p.children.splice(u,1,...f.children):p.children.splice(u,1),u}}}function gW(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||dW.test(e.slice(0,t))?e:""}function yW(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function Dm(e){if(e==null)return"null";if(typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(r=>Dm(r)).join(",")}]`;const t=e;return`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${Dm(t[r])}`).join(",")}}`}function QN(e){return Dm({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 Mf(e){const t=e.sourceHandle??"",n=e.targetHandle??"";return`${e.source}|${t}|${e.target}|${n}`}function ZN(e){return Dm({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 ej(e,t){return!yW(t)||!("selected"in t)||t.selected===e.selected?e:{...e,selected:!!t.selected}}function tj(e,t=!1){const n=new Map;for(const r of e){const s=Mf(r);if(t&&n.has(s))throw new Error(`存在重复连线键: ${s}`);n.set(s,r)}return n}function xW(e,t,n,r){const s=new Map(e.map(k=>[k.id,k])),i=new Set(n.map(k=>k.id)),a=new Set,l=[],c=[],d=n.map(k=>{const w=s.get(k.id);return w?QN(w)===QN(k)?(a.add(k.id),w):(c.push(k.id),ej(k,w)):(l.push(k.id),k)}),f=tj(t),u=tj(r,!0),p=new Set,m=[],g=[],b=r.map(k=>{const w=Mf(k),j=f.get(w);return j?ZN(j)===ZN(k)?(p.add(w),j):(g.push(w),ej(k,j)):(m.push(w),k)}),v=e.filter(k=>!i.has(k.id)).map(k=>k.id),y=t.map(k=>Mf(k)).filter(k=>!u.has(k));return{nodes:d,edges:b,changes:{addedNodeIds:l,updatedNodeIds:c,removedNodeIds:v,addedEdgeKeys:m,updatedEdgeKeys:g,removedEdgeKeys:y},stats:{nodeAdded:l.length,nodeRemoved:v.length,nodeReused:a.size,edgeAdded:m.length,edgeRemoved:y.length,edgeReused:p.size,nextEdgeCount:u.size}}}/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function yI(e){return typeof e>"u"||e===null}function wW(e){return typeof e=="object"&&e!==null}function bW(e){return Array.isArray(e)?e:yI(e)?[]:[e]}function vW(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 kW(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function SW(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var NW=yI,jW=wW,CW=bW,EW=kW,_W=SW,PW=vW,wr={isNothing:NW,isObject:jW,toArray:CW,repeat:EW,isNegativeZero:_W,extend:PW};function xI(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 $f(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=xI(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}$f.prototype=Object.create(Error.prototype);$f.prototype.constructor=$f;$f.prototype.toString=function(t){return this.name+": "+xI(this,t)};var is=$f;function cx(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 ux(e,t){return wr.repeat(" ",t-e.length)+e}function AW(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var n=/\r?\n|\r|\0/g,r=[0],s=[],i,a=-1;i=n.exec(e.buffer);)s.push(i.index),r.push(i.index+i[0].length),e.position<=i.index&&a<0&&(a=r.length-2);a<0&&(a=r.length-1);var l="",c,d,f=Math.min(e.line+t.linesAfter,s.length).toString().length,u=t.maxLength-(t.indent+f+3);for(c=1;c<=t.linesBefore&&!(a-c<0);c++)d=cx(e.buffer,r[a-c],s[a-c],e.position-(r[a]-r[a-c]),u),l=wr.repeat(" ",t.indent)+ux((e.line-c+1).toString(),f)+" | "+d.str+`
|
|
82
|
-
`+l;for(d=cx(e.buffer,r[a],s[a],e.position,u),l+=wr.repeat(" ",t.indent)+ux((e.line+1).toString(),f)+" | "+d.str+`
|
|
83
|
-
`,l+=wr.repeat("-",t.indent+f+3+d.pos)+`^
|
|
84
|
-
`,c=1;c<=t.linesAfter&&!(a+c>=s.length);c++)d=cx(e.buffer,r[a+c],s[a+c],e.position-(r[a]-r[a+c]),u),l+=wr.repeat(" ",t.indent)+ux((e.line+c+1).toString(),f)+" | "+d.str+`
|
|
85
|
-
`;return l.replace(/\n$/,"")}var IW=AW,TW=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],RW=["scalar","sequence","mapping"];function LW(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function OW(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(TW.indexOf(n)===-1)throw new is('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=LW(t.styleAliases||null),RW.indexOf(this.kind)===-1)throw new is('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var Dr=OW;function nj(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 MW(){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 ob(e){return this.extend(e)}ob.prototype.extend=function(t){var n=[],r=[];if(t instanceof Dr)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 is("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(i){if(!(i instanceof Dr))throw new is("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(i.loadKind&&i.loadKind!=="scalar")throw new is("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 is("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 Dr))throw new is("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var s=Object.create(ob.prototype);return s.implicit=(this.implicit||[]).concat(n),s.explicit=(this.explicit||[]).concat(r),s.compiledImplicit=nj(s,"implicit"),s.compiledExplicit=nj(s,"explicit"),s.compiledTypeMap=MW(s.compiledImplicit,s.compiledExplicit),s};var wI=ob,bI=new Dr("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),vI=new Dr("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),kI=new Dr("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),SI=new wI({explicit:[bI,vI,kI]});function $W(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function DW(){return null}function FW(e){return e===null}var NI=new Dr("tag:yaml.org,2002:null",{kind:"scalar",resolve:$W,construct:DW,predicate:FW,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function zW(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 BW(e){return e==="true"||e==="True"||e==="TRUE"}function HW(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var jI=new Dr("tag:yaml.org,2002:bool",{kind:"scalar",resolve:zW,construct:BW,predicate:HW,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 WW(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function VW(e){return 48<=e&&e<=55}function UW(e){return 48<=e&&e<=57}function KW(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(!WW(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}if(s==="o"){for(n++;n<t;n++)if(s=e[n],s!=="_"){if(!VW(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}}if(s==="_")return!1;for(;n<t;n++)if(s=e[n],s!=="_"){if(!UW(e.charCodeAt(n)))return!1;r=!0}return!(!r||s==="_")}function qW(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 YW(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!wr.isNegativeZero(e)}var CI=new Dr("tag:yaml.org,2002:int",{kind:"scalar",resolve:KW,construct:qW,predicate:YW,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"]}}),GW=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function XW(e){return!(e===null||!GW.test(e)||e[e.length-1]==="_")}function JW(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 QW=/^[-+]?[0-9]+e/;function ZW(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(wr.isNegativeZero(e))return"-0.0";return n=e.toString(10),QW.test(n)?n.replace("e",".e"):n}function eV(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||wr.isNegativeZero(e))}var EI=new Dr("tag:yaml.org,2002:float",{kind:"scalar",resolve:XW,construct:JW,predicate:eV,represent:ZW,defaultStyle:"lowercase"}),_I=SI.extend({implicit:[NI,jI,CI,EI]}),PI=_I,AI=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),II=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 tV(e){return e===null?!1:AI.exec(e)!==null||II.exec(e)!==null}function nV(e){var t,n,r,s,i,a,l,c=0,d=null,f,u,p;if(t=AI.exec(e),t===null&&(t=II.exec(e)),t===null)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,s=+t[3],!t[4])return new Date(Date.UTC(n,r,s));if(i=+t[4],a=+t[5],l=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(f=+t[10],u=+(t[11]||0),d=(f*60+u)*6e4,t[9]==="-"&&(d=-d)),p=new Date(Date.UTC(n,r,s,i,a,l,c)),d&&p.setTime(p.getTime()-d),p}function rV(e){return e.toISOString()}var TI=new Dr("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:tV,construct:nV,instanceOf:Date,represent:rV});function sV(e){return e==="<<"||e===null}var RI=new Dr("tag:yaml.org,2002:merge",{kind:"scalar",resolve:sV}),s0=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
86
|
-
\r`;function iV(e){if(e===null)return!1;var t,n,r=0,s=e.length,i=s0;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 oV(e){var t,n,r=e.replace(/[\r\n=]/g,""),s=r.length,i=s0,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 aV(e){var t="",n=0,r,s,i=e.length,a=s0;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 lV(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var LI=new Dr("tag:yaml.org,2002:binary",{kind:"scalar",resolve:iV,construct:oV,predicate:lV,represent:aV}),cV=Object.prototype.hasOwnProperty,uV=Object.prototype.toString;function dV(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,uV.call(s)!=="[object Object]")return!1;for(i in s)if(cV.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 fV(e){return e!==null?e:[]}var OI=new Dr("tag:yaml.org,2002:omap",{kind:"sequence",resolve:dV,construct:fV}),pV=Object.prototype.toString;function hV(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 mV(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 MI=new Dr("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:hV,construct:mV}),gV=Object.prototype.hasOwnProperty;function yV(e){if(e===null)return!0;var t,n=e;for(t in n)if(gV.call(n,t)&&n[t]!==null)return!1;return!0}function xV(e){return e!==null?e:{}}var $I=new Dr("tag:yaml.org,2002:set",{kind:"mapping",resolve:yV,construct:xV}),i0=PI.extend({implicit:[TI,RI],explicit:[LI,OI,MI,$I]}),il=Object.prototype.hasOwnProperty,Fm=1,DI=2,FI=3,zm=4,dx=1,wV=2,rj=3,bV=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,vV=/[\x85\u2028\u2029]/,kV=/[,\[\]\{\}]/,zI=/^(?:!|!!|![a-z\-]+!)$/i,BI=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function sj(e){return Object.prototype.toString.call(e)}function wo(e){return e===10||e===13}function Ql(e){return e===9||e===32}function xs(e){return e===9||e===32||e===10||e===13}function su(e){return e===44||e===91||e===93||e===123||e===125}function SV(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function NV(e){return e===120?2:e===117?4:e===85?8:0}function jV(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 CV(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function HI(e,t,n){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}var WI=new Array(256),VI=new Array(256);for(var Mc=0;Mc<256;Mc++)WI[Mc]=ij(Mc)?1:0,VI[Mc]=ij(Mc);function EV(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||i0,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 UI(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=IW(n),new is(t,n)}function rt(e,t){throw UI(e,t)}function Bm(e,t){e.onWarning&&e.onWarning.call(null,UI(e,t))}var oj={YAML:function(t,n,r){var s,i,a;t.version!==null&&rt(t,"duplication of %YAML directive"),r.length!==1&&rt(t,"YAML directive accepts exactly one argument"),s=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),s===null&&rt(t,"ill-formed argument of the YAML directive"),i=parseInt(s[1],10),a=parseInt(s[2],10),i!==1&&rt(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=a<2,a!==1&&a!==2&&Bm(t,"unsupported YAML version of the document")},TAG:function(t,n,r){var s,i;r.length!==2&&rt(t,"TAG directive accepts exactly two arguments"),s=r[0],i=r[1],zI.test(s)||rt(t,"ill-formed tag handle (first argument) of the TAG directive"),il.call(t.tagMap,s)&&rt(t,'there is a previously declared suffix for "'+s+'" tag handle'),BI.test(i)||rt(t,"ill-formed tag prefix (second argument) of the TAG directive");try{i=decodeURIComponent(i)}catch{rt(t,"tag prefix is malformed: "+i)}t.tagMap[s]=i}};function el(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||rt(e,"expected valid JSON character");else bV.test(l)&&rt(e,"the stream contains non-printable characters");e.result+=l}}function aj(e,t,n,r){var s,i,a,l;for(wr.isObject(n)||rt(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],il.call(t,i)||(HI(t,i,n[i]),r[i]=!0)}function iu(e,t,n,r,s,i,a,l,c){var d,f;if(Array.isArray(s))for(s=Array.prototype.slice.call(s),d=0,f=s.length;d<f;d+=1)Array.isArray(s[d])&&rt(e,"nested arrays are not supported inside keys"),typeof s=="object"&&sj(s[d])==="[object Object]"&&(s[d]="[object Object]");if(typeof s=="object"&&sj(s)==="[object Object]"&&(s="[object Object]"),s=String(s),t===null&&(t={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(i))for(d=0,f=i.length;d<f;d+=1)aj(e,t,i[d],n);else aj(e,t,i,n);else!e.json&&!il.call(n,s)&&il.call(t,s)&&(e.line=a||e.line,e.lineStart=l||e.lineStart,e.position=c||e.position,rt(e,"duplicated mapping key")),HI(t,s,i),delete n[s];return t}function o0(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++):rt(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function pr(e,t,n){for(var r=0,s=e.input.charCodeAt(e.position);s!==0;){for(;Ql(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(wo(s))for(o0(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&&Bm(e,"deficient indentation"),r}function Bg(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||xs(n)))}function a0(e,t){t===1?e.result+=" ":t>1&&(e.result+=wr.repeat(`
|
|
88
|
-
`,t-1))}function _V(e,t,n){var r,s,i,a,l,c,d,f,u=e.kind,p=e.result,m;if(m=e.input.charCodeAt(e.position),xs(m)||su(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),xs(s)||n&&su(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),xs(s)||n&&su(s))break}else if(m===35){if(r=e.input.charCodeAt(e.position-1),xs(r))break}else{if(e.position===e.lineStart&&Bg(e)||n&&su(m))break;if(wo(m))if(c=e.line,d=e.lineStart,f=e.lineIndent,pr(e,!1,-1),e.lineIndent>=t){l=!0,m=e.input.charCodeAt(e.position);continue}else{e.position=a,e.line=c,e.lineStart=d,e.lineIndent=f;break}}l&&(el(e,i,a,!1),a0(e,e.line-c),i=a=e.position,l=!1),Ql(m)||(a=e.position+1),m=e.input.charCodeAt(++e.position)}return el(e,i,a,!1),e.result?!0:(e.kind=u,e.result=p,!1)}function PV(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(el(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 wo(n)?(el(e,r,s,!0),a0(e,pr(e,!1,t)),r=s=e.position):e.position===e.lineStart&&Bg(e)?rt(e,"unexpected end of the document within a single quoted scalar"):(e.position++,s=e.position);rt(e,"unexpected end of the stream within a single quoted scalar")}function AV(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 el(e,n,e.position,!0),e.position++,!0;if(l===92){if(el(e,n,e.position,!0),l=e.input.charCodeAt(++e.position),wo(l))pr(e,!1,t);else if(l<256&&WI[l])e.result+=VI[l],e.position++;else if((a=NV(l))>0){for(s=a,i=0;s>0;s--)l=e.input.charCodeAt(++e.position),(a=SV(l))>=0?i=(i<<4)+a:rt(e,"expected hexadecimal character");e.result+=CV(i),e.position++}else rt(e,"unknown escape sequence");n=r=e.position}else wo(l)?(el(e,n,r,!0),a0(e,pr(e,!1,t)),n=r=e.position):e.position===e.lineStart&&Bg(e)?rt(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}rt(e,"unexpected end of the stream within a double quoted scalar")}function IV(e,t){var n=!0,r,s,i,a=e.tag,l,c=e.anchor,d,f,u,p,m,g=Object.create(null),b,v,y,k;if(k=e.input.charCodeAt(e.position),k===91)f=93,m=!1,l=[];else if(k===123)f=125,m=!0,l={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),k=e.input.charCodeAt(++e.position);k!==0;){if(pr(e,!0,t),k=e.input.charCodeAt(e.position),k===f)return e.position++,e.tag=a,e.anchor=c,e.kind=m?"mapping":"sequence",e.result=l,!0;n?k===44&&rt(e,"expected the node content, but found ','"):rt(e,"missed comma between flow collection entries"),v=b=y=null,u=p=!1,k===63&&(d=e.input.charCodeAt(e.position+1),xs(d)&&(u=p=!0,e.position++,pr(e,!0,t))),r=e.line,s=e.lineStart,i=e.position,Ou(e,t,Fm,!1,!0),v=e.tag,b=e.result,pr(e,!0,t),k=e.input.charCodeAt(e.position),(p||e.line===r)&&k===58&&(u=!0,k=e.input.charCodeAt(++e.position),pr(e,!0,t),Ou(e,t,Fm,!1,!0),y=e.result),m?iu(e,l,g,v,b,y,r,s,i):u?l.push(iu(e,null,g,v,b,y,r,s,i)):l.push(b),pr(e,!0,t),k=e.input.charCodeAt(e.position),k===44?(n=!0,k=e.input.charCodeAt(++e.position)):n=!1}rt(e,"unexpected end of the stream within a flow collection")}function TV(e,t){var n,r,s=dx,i=!1,a=!1,l=t,c=0,d=!1,f,u;if(u=e.input.charCodeAt(e.position),u===124)r=!1;else if(u===62)r=!0;else return!1;for(e.kind="scalar",e.result="";u!==0;)if(u=e.input.charCodeAt(++e.position),u===43||u===45)dx===s?s=u===43?rj:wV:rt(e,"repeat of a chomping mode identifier");else if((f=jV(u))>=0)f===0?rt(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):a?rt(e,"repeat of an indentation width identifier"):(l=t+f-1,a=!0);else break;if(Ql(u)){do u=e.input.charCodeAt(++e.position);while(Ql(u));if(u===35)do u=e.input.charCodeAt(++e.position);while(!wo(u)&&u!==0)}for(;u!==0;){for(o0(e),e.lineIndent=0,u=e.input.charCodeAt(e.position);(!a||e.lineIndent<l)&&u===32;)e.lineIndent++,u=e.input.charCodeAt(++e.position);if(!a&&e.lineIndent>l&&(l=e.lineIndent),wo(u)){c++;continue}if(e.lineIndent<l){s===rj?e.result+=wr.repeat(`
|
|
89
|
-
`,i?1+c:c):s===dx&&i&&(e.result+=`
|
|
90
|
-
`);break}for(r?Ql(u)?(d=!0,e.result+=wr.repeat(`
|
|
91
|
-
`,i?1+c:c)):d?(d=!1,e.result+=wr.repeat(`
|
|
92
|
-
`,c+1)):c===0?i&&(e.result+=" "):e.result+=wr.repeat(`
|
|
93
|
-
`,c):e.result+=wr.repeat(`
|
|
94
|
-
`,i?1+c:c),i=!0,a=!0,c=0,n=e.position;!wo(u)&&u!==0;)u=e.input.charCodeAt(++e.position);el(e,n,e.position,!1)}return!0}function lj(e,t){var n,r=e.tag,s=e.anchor,i=[],a,l=!1,c;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=i),c=e.input.charCodeAt(e.position);c!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,rt(e,"tab characters must not be used in indentation")),!(c!==45||(a=e.input.charCodeAt(e.position+1),!xs(a))));){if(l=!0,e.position++,pr(e,!0,-1)&&e.lineIndent<=t){i.push(null),c=e.input.charCodeAt(e.position);continue}if(n=e.line,Ou(e,t,FI,!1,!0),i.push(e.result),pr(e,!0,-1),c=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&c!==0)rt(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 RV(e,t,n){var r,s,i,a,l,c,d=e.tag,f=e.anchor,u={},p=Object.create(null),m=null,g=null,b=null,v=!1,y=!1,k;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=u),k=e.input.charCodeAt(e.position);k!==0;){if(!v&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,rt(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),i=e.line,(k===63||k===58)&&xs(r))k===63?(v&&(iu(e,u,p,m,g,null,a,l,c),m=g=b=null),y=!0,v=!0,s=!0):v?(v=!1,s=!0):rt(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,k=r;else{if(a=e.line,l=e.lineStart,c=e.position,!Ou(e,n,DI,!1,!0))break;if(e.line===i){for(k=e.input.charCodeAt(e.position);Ql(k);)k=e.input.charCodeAt(++e.position);if(k===58)k=e.input.charCodeAt(++e.position),xs(k)||rt(e,"a whitespace character is expected after the key-value separator within a block mapping"),v&&(iu(e,u,p,m,g,null,a,l,c),m=g=b=null),y=!0,v=!1,s=!1,m=e.tag,g=e.result;else if(y)rt(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=d,e.anchor=f,!0}else if(y)rt(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=d,e.anchor=f,!0}if((e.line===i||e.lineIndent>t)&&(v&&(a=e.line,l=e.lineStart,c=e.position),Ou(e,t,zm,!0,s)&&(v?g=e.result:b=e.result),v||(iu(e,u,p,m,g,b,a,l,c),m=g=b=null),pr(e,!0,-1),k=e.input.charCodeAt(e.position)),(e.line===i||e.lineIndent>t)&&k!==0)rt(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return v&&iu(e,u,p,m,g,null,a,l,c),y&&(e.tag=d,e.anchor=f,e.kind="mapping",e.result=u),y}function LV(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&&rt(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)):rt(e,"unexpected end of the stream within a verbatim tag")}else{for(;a!==0&&!xs(a);)a===33&&(r?rt(e,"tag suffix cannot contain exclamation marks"):(s=e.input.slice(t-1,e.position+1),zI.test(s)||rt(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),kV.test(i)&&rt(e,"tag suffix cannot contain flow indicator characters")}i&&!BI.test(i)&&rt(e,"tag name cannot contain such characters: "+i);try{i=decodeURIComponent(i)}catch{rt(e,"tag name is malformed: "+i)}return n?e.tag=i:il.call(e.tagMap,s)?e.tag=e.tagMap[s]+i:s==="!"?e.tag="!"+i:s==="!!"?e.tag="tag:yaml.org,2002:"+i:rt(e,'undeclared tag handle "'+s+'"'),!0}function OV(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&rt(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!xs(n)&&!su(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&rt(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function MV(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&&!xs(r)&&!su(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&rt(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),il.call(e.anchorMap,n)||rt(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],pr(e,!0,-1),!0}function Ou(e,t,n,r,s){var i,a,l,c=1,d=!1,f=!1,u,p,m,g,b,v;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,i=a=l=zm===n||FI===n,r&&pr(e,!0,-1)&&(d=!0,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)),c===1)for(;LV(e)||OV(e);)pr(e,!0,-1)?(d=!0,l=i,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)):l=!1;if(l&&(l=d||s),(c===1||zm===n)&&(Fm===n||DI===n?b=t:b=t+1,v=e.position-e.lineStart,c===1?l&&(lj(e,v)||RV(e,v,b))||IV(e,b)?f=!0:(a&&TV(e,b)||PV(e,b)||AV(e,b)?f=!0:MV(e)?(f=!0,(e.tag!==null||e.anchor!==null)&&rt(e,"alias node should not have any properties")):_V(e,b,Fm===n)&&(f=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):c===0&&(f=l&&lj(e,v))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&rt(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),u=0,p=e.implicitTypes.length;u<p;u+=1)if(g=e.implicitTypes[u],g.resolve(e.result)){e.result=g.construct(e.result),e.tag=g.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(il.call(e.typeMap[e.kind||"fallback"],e.tag))g=e.typeMap[e.kind||"fallback"][e.tag];else for(g=null,m=e.typeMap.multi[e.kind||"fallback"],u=0,p=m.length;u<p;u+=1)if(e.tag.slice(0,m[u].tag.length)===m[u].tag){g=m[u];break}g||rt(e,"unknown tag !<"+e.tag+">"),e.result!==null&&g.kind!==e.kind&&rt(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+g.kind+'", not "'+e.kind+'"'),g.resolve(e.result,e.tag)?(e.result=g.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):rt(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||f}function $V(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&&(pr(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&&!xs(a);)a=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),s=[],r.length<1&&rt(e,"directive name must not be less than one character in length");a!==0;){for(;Ql(a);)a=e.input.charCodeAt(++e.position);if(a===35){do a=e.input.charCodeAt(++e.position);while(a!==0&&!wo(a));break}if(wo(a))break;for(n=e.position;a!==0&&!xs(a);)a=e.input.charCodeAt(++e.position);s.push(e.input.slice(n,e.position))}a!==0&&o0(e),il.call(oj,r)?oj[r](e,r,s):Bm(e,'unknown document directive "'+r+'"')}if(pr(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,pr(e,!0,-1)):i&&rt(e,"directives end mark is expected"),Ou(e,e.lineIndent-1,zm,!1,!0),pr(e,!0,-1),e.checkLineBreaks&&vV.test(e.input.slice(t,e.position))&&Bm(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&Bg(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,pr(e,!0,-1));return}if(e.position<e.length-1)rt(e,"end of the stream or a document separator is expected");else return}function KI(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 EV(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,rt(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;)$V(n);return n.documents}function DV(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var r=KI(e,n);if(typeof t!="function")return r;for(var s=0,i=r.length;s<i;s+=1)t(r[s])}function FV(e,t){var n=KI(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new is("expected a single document in the stream, but found more")}}var zV=DV,BV=FV,qI={loadAll:zV,load:BV},YI=Object.prototype.toString,GI=Object.prototype.hasOwnProperty,l0=65279,HV=9,Df=10,WV=13,VV=32,UV=33,KV=34,ab=35,qV=37,YV=38,GV=39,XV=42,XI=44,JV=45,Hm=58,QV=61,ZV=62,eU=63,tU=64,JI=91,QI=93,nU=96,ZI=123,rU=124,eT=125,Qr={};Qr[0]="\\0";Qr[7]="\\a";Qr[8]="\\b";Qr[9]="\\t";Qr[10]="\\n";Qr[11]="\\v";Qr[12]="\\f";Qr[13]="\\r";Qr[27]="\\e";Qr[34]='\\"';Qr[92]="\\\\";Qr[133]="\\N";Qr[160]="\\_";Qr[8232]="\\L";Qr[8233]="\\P";var sU=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],iU=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function oU(e,t){var n,r,s,i,a,l,c;if(t===null)return{};for(n={},r=Object.keys(t),s=0,i=r.length;s<i;s+=1)a=r[s],l=String(t[a]),a.slice(0,2)==="!!"&&(a="tag:yaml.org,2002:"+a.slice(2)),c=e.compiledTypeMap.fallback[a],c&&GI.call(c.styleAliases,l)&&(l=c.styleAliases[l]),n[a]=l;return n}function aU(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 is("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+wr.repeat("0",r-t.length)+t}var lU=1,Ff=2;function cU(e){this.schema=e.schema||i0,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=wr.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=oU(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==='"'?Ff:lU,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 cj(e,t){for(var n=wr.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 lb(e,t){return`
|
|
98
|
-
`+wr.repeat(" ",e.indent*t)}function uU(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 Wm(e){return e===VV||e===HV}function zf(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==l0||65536<=e&&e<=1114111}function uj(e){return zf(e)&&e!==l0&&e!==WV&&e!==Df}function dj(e,t,n){var r=uj(e),s=r&&!Wm(e);return(n?r:r&&e!==XI&&e!==JI&&e!==QI&&e!==ZI&&e!==eT)&&e!==ab&&!(t===Hm&&!s)||uj(t)&&!Wm(t)&&e===ab||t===Hm&&s}function dU(e){return zf(e)&&e!==l0&&!Wm(e)&&e!==JV&&e!==eU&&e!==Hm&&e!==XI&&e!==JI&&e!==QI&&e!==ZI&&e!==eT&&e!==ab&&e!==YV&&e!==XV&&e!==UV&&e!==rU&&e!==QV&&e!==ZV&&e!==GV&&e!==KV&&e!==qV&&e!==tU&&e!==nU}function fU(e){return!Wm(e)&&e!==Hm}function $d(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 tT(e){var t=/^\n* /;return t.test(e)}var nT=1,cb=2,rT=3,sT=4,zc=5;function pU(e,t,n,r,s,i,a,l){var c,d=0,f=null,u=!1,p=!1,m=r!==-1,g=-1,b=dU($d(e,0))&&fU($d(e,e.length-1));if(t||a)for(c=0;c<e.length;d>=65536?c+=2:c++){if(d=$d(e,c),!zf(d))return zc;b=b&&dj(d,f,l),f=d}else{for(c=0;c<e.length;d>=65536?c+=2:c++){if(d=$d(e,c),d===Df)u=!0,m&&(p=p||c-g-1>r&&e[g+1]!==" ",g=c);else if(!zf(d))return zc;b=b&&dj(d,f,l),f=d}p=p||m&&c-g-1>r&&e[g+1]!==" "}return!u&&!p?b&&!a&&!s(e)?nT:i===Ff?zc:cb:n>9&&tT(e)?zc:a?i===Ff?zc:cb:p?sT:rT}function hU(e,t,n,r,s){e.dump=function(){if(t.length===0)return e.quotingType===Ff?'""':"''";if(!e.noCompatMode&&(sU.indexOf(t)!==-1||iU.test(t)))return e.quotingType===Ff?'"'+t+'"':"'"+t+"'";var i=e.indent*Math.max(1,n),a=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-i),l=r||e.flowLevel>-1&&n>=e.flowLevel;function c(d){return uU(e,d)}switch(pU(t,l,e.indent,a,c,e.quotingType,e.forceQuotes&&!r,s)){case nT:return t;case cb:return"'"+t.replace(/'/g,"''")+"'";case rT:return"|"+fj(t,e.indent)+pj(cj(t,i));case sT:return">"+fj(t,e.indent)+pj(cj(mU(t,a),i));case zc:return'"'+gU(t)+'"';default:throw new is("impossible error: invalid scalar style")}}()}function fj(e,t){var n=tT(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 pj(e){return e[e.length-1]===`
|
|
103
|
-
`?e.slice(0,-1):e}function mU(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,hj(e.slice(0,d),t)}(),s=e[0]===`
|
|
105
|
-
`||e[0]===" ",i,a;a=n.exec(e);){var l=a[1],c=a[2];i=c[0]===" ",r+=l+(!s&&!i&&c!==""?`
|
|
106
|
-
`:"")+hj(c,t),s=i}return r}function hj(e,t){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,r,s=0,i,a=0,l=0,c="";r=n.exec(e);)l=r.index,l-s>t&&(i=a>s?a:l,c+=`
|
|
107
|
-
`+e.slice(s,i),s=i+1),a=l;return c+=`
|
|
108
|
-
`,e.length-s>t&&a>s?c+=e.slice(s,a)+`
|
|
109
|
-
`+e.slice(a+1):c+=e.slice(s),c.slice(1)}function gU(e){for(var t="",n=0,r,s=0;s<e.length;n>=65536?s+=2:s++)n=$d(e,s),r=Qr[n],!r&&zf(n)?(t+=e[s],n>=65536&&(t+=e[s+1])):t+=r||aU(n);return t}function yU(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)),(sa(e,t,l,!1,!1)||typeof l>"u"&&sa(e,t,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=s,e.dump="["+r+"]"}function mj(e,t,n,r){var s="",i=e.tag,a,l,c;for(a=0,l=n.length;a<l;a+=1)c=n[a],e.replacer&&(c=e.replacer.call(n,String(a),c)),(sa(e,t+1,c,!0,!0,!1,!0)||typeof c>"u"&&sa(e,t+1,null,!0,!0,!1,!0))&&((!r||s!=="")&&(s+=lb(e,t)),e.dump&&Df===e.dump.charCodeAt(0)?s+="-":s+="- ",s+=e.dump);e.tag=i,e.dump=s||"[]"}function xU(e,t,n){var r="",s=e.tag,i=Object.keys(n),a,l,c,d,f;for(a=0,l=i.length;a<l;a+=1)f="",r!==""&&(f+=", "),e.condenseFlow&&(f+='"'),c=i[a],d=n[c],e.replacer&&(d=e.replacer.call(n,c,d)),sa(e,t,c,!1,!1)&&(e.dump.length>1024&&(f+="? "),f+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),sa(e,t,d,!1,!1)&&(f+=e.dump,r+=f));e.tag=s,e.dump="{"+r+"}"}function wU(e,t,n,r){var s="",i=e.tag,a=Object.keys(n),l,c,d,f,u,p;if(e.sortKeys===!0)a.sort();else if(typeof e.sortKeys=="function")a.sort(e.sortKeys);else if(e.sortKeys)throw new is("sortKeys must be a boolean or a function");for(l=0,c=a.length;l<c;l+=1)p="",(!r||s!=="")&&(p+=lb(e,t)),d=a[l],f=n[d],e.replacer&&(f=e.replacer.call(n,d,f)),sa(e,t+1,d,!0,!0,!0)&&(u=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,u&&(e.dump&&Df===e.dump.charCodeAt(0)?p+="?":p+="? "),p+=e.dump,u&&(p+=lb(e,t)),sa(e,t+1,f,!0,u)&&(e.dump&&Df===e.dump.charCodeAt(0)?p+=":":p+=": ",p+=e.dump,s+=p));e.tag=i,e.dump=s||"{}"}function gj(e,t,n){var r,s,i,a,l,c;for(s=n?e.explicitTypes:e.implicitTypes,i=0,a=s.length;i<a;i+=1)if(l=s[i],(l.instanceOf||l.predicate)&&(!l.instanceOf||typeof t=="object"&&t instanceof l.instanceOf)&&(!l.predicate||l.predicate(t))){if(n?l.multi&&l.representName?e.tag=l.representName(t):e.tag=l.tag:e.tag="?",l.represent){if(c=e.styleMap[l.tag]||l.defaultStyle,YI.call(l.represent)==="[object Function]")r=l.represent(t,c);else if(GI.call(l.represent,c))r=l.represent[c](t,c);else throw new is("!<"+l.tag+'> tag resolver accepts not "'+c+'" style');e.dump=r}return!0}return!1}function sa(e,t,n,r,s,i,a){e.tag=null,e.dump=n,gj(e,n,!1)||gj(e,n,!0);var l=YI.call(e.dump),c=r,d;r&&(r=e.flowLevel<0||e.flowLevel>t);var f=l==="[object Object]"||l==="[object Array]",u,p;if(f&&(u=e.duplicates.indexOf(n),p=u!==-1),(e.tag!==null&&e.tag!=="?"||p||e.indent!==2&&t>0)&&(s=!1),p&&e.usedDuplicates[u])e.dump="*ref_"+u;else{if(f&&p&&!e.usedDuplicates[u]&&(e.usedDuplicates[u]=!0),l==="[object Object]")r&&Object.keys(e.dump).length!==0?(wU(e,t,e.dump,s),p&&(e.dump="&ref_"+u+e.dump)):(xU(e,t,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if(l==="[object Array]")r&&e.dump.length!==0?(e.noArrayIndent&&!a&&t>0?mj(e,t-1,e.dump,s):mj(e,t,e.dump,s),p&&(e.dump="&ref_"+u+e.dump)):(yU(e,t,e.dump),p&&(e.dump="&ref_"+u+" "+e.dump));else if(l==="[object String]")e.tag!=="?"&&hU(e,e.dump,t,i,c);else{if(l==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new is("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 bU(e,t){var n=[],r=[],s,i;for(ub(e,n,r),s=0,i=r.length;s<i;s+=1)t.duplicates.push(n[r[s]]);t.usedDuplicates=new Array(i)}function ub(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)ub(e[s],t,n);else for(r=Object.keys(e),s=0,i=r.length;s<i;s+=1)ub(e[r[s]],t,n)}function vU(e,t){t=t||{};var n=new cU(t);n.noRefs||bU(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),sa(n,0,r,!0,!0)?n.dump+`
|
|
110
|
-
`:""}var kU=vU,SU={dump:kU};function c0(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 NU=Dr,jU=wI,CU=SI,EU=_I,_U=PI,PU=i0,AU=qI.load,IU=qI.loadAll,TU=SU.dump,RU=is,LU={binary:LI,float:EI,map:kI,null:NI,pairs:MI,set:$I,timestamp:TI,bool:jI,int:CI,merge:RI,omap:OI,seq:vI,str:bI},OU=c0("safeLoad","load"),MU=c0("safeLoadAll","loadAll"),$U=c0("safeDump","dump"),iT={Type:NU,Schema:jU,FAILSAFE_SCHEMA:CU,JSON_SCHEMA:EU,CORE_SCHEMA:_U,DEFAULT_SCHEMA:PU,load:AU,loadAll:IU,dump:TU,YAMLException:RU,types:LU,safeLoad:OU,safeLoadAll:MU,safeDump:$U};const ol=["requirement","planning","code","test","normal"],db={普通:"normal",技术规划:"planning",代码执行:"code",测试回归:"test",需求拆解:"requirement"},DU=["agent","control","provide","condition","jump","condition_jump","start","end"];function FU(e){return DU.includes(e)?e:"agent"}function zU(e){const t=(e||"").toLowerCase();return t.startsWith("control_")?"control":t.startsWith("agent_")?"agent":t.startsWith("provide_")?"provide":(t.startsWith("tool_"),"agent")}function BU(e){var t;if(!(e!=null&&e.trim()))return{nodes:[],edges:[],instances:{}};try{const n=iT.load(e);if(!n||typeof n!="object")return{error:"flow.yaml 格式无效:根内容不是对象"};const r=n,s=r.instances&&typeof r.instances=="object"?r.instances:{},i=Array.isArray(r.edges)?r.edges:Array.isArray((t=r.flow)==null?void 0:t.edges)?r.flow.edges:[],a=r.ui&&typeof r.ui=="object"?r.ui:{},l=a.nodePositions&&typeof a.nodePositions=="object"?a.nodePositions:{},c=a.nodeSizes&&typeof a.nodeSizes=="object"?a.nodeSizes:{},d=a.viewport&&typeof a.viewport=="object"?a.viewport:null,f=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,u=typeof a.description=="string"&&a.description.trim()?a.description.trim():void 0,p=new Set(Object.keys(s));for(const b of i)b!=null&&b.source&&p.add(String(b.source)),b!=null&&b.target&&p.add(String(b.target));const m=Array.from(p).map(b=>{const v=s[b],y=l[b]&&typeof l[b].x=="number"&&typeof l[b].y=="number"?{x:l[b].x,y:l[b].y}:{x:0,y:0},k=c[b]&&typeof c[b].width=="number"&&typeof c[b].height=="number"?{width:c[b].width,height:c[b].height}:null,w=(v==null?void 0:v.definitionId)??b,j=zU(w),A=(v==null?void 0:v.label)!=null?String(v.label):b,C=(v==null?void 0:v.role)!=null?String(v.role).trim():"",$=db[C]||C,B=ol.includes($)?$:"normal",F=(v==null?void 0:v.model)!=null?String(v.model).trim():void 0,z=(v==null?void 0:v.body)!=null?String(v.body):"",L=(v==null?void 0:v.script)!=null?String(v.script):"",O=Array.isArray(v==null?void 0:v.images)?v.images:[];return{id:b,type:FU(j),position:y,...k?{width:k.width,height:k.height}:{},data:{label:A,definitionId:w,schemaType:j,role:B,model:F||void 0,body:z,images:O,...k?{displaySize:k}:{},...L.trim()!==""?{script:L}:{}}}}),g=i.filter(b=>(b==null?void 0:b.source)&&(b==null?void 0:b.target)).map((b,v)=>({id:`e-${b.source}-${b.target}-${v}`,source:String(b.source),target:String(b.target),sourceHandle:b.sourceHandle??void 0,targetHandle:b.targetHandle??void 0,markerEnd:{type:Ns.ArrowClosed}}));return{nodes:m,edges:g,instances:s,description:u,...f?{viewport:f}:{}}}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 ap(e,t){var s,i,a,l,c,d,f,u,p,m,g,b;const n=v=>{const y={type:(v==null?void 0:v.type)??"node",name:(v==null?void 0:v.name)??"",value:(v==null?void 0:v.value)??(v==null?void 0:v.default)??""};return(v==null?void 0:v.required)===!0&&(y.required=!0),(v==null?void 0:v.showOnNode)!=null&&(y.showOnNode=!!v.showOnNode),y},r={};for(const v of e){const y=t[v.id]&&typeof t[v.id]=="object"?{...t[v.id]}:{},k=((s=v.data)==null?void 0:s.definitionId)||v.id,w=((i=v.data)==null?void 0:i.inputs)??[],j=((a=v.data)==null?void 0:a.outputs)??[],A=((l=v.data)==null?void 0:l.role)!=null?String(v.data.role).trim():"",C=y.role!=null?String(y.role).trim():"",$=db[A]||A,B=db[C]||C,F=ol.includes($)?$:ol.includes(B)?B:"normal",z=Array.isArray(w)?w.map(n):Array.isArray(y.input)?y.input.map(V=>n(V)):[],L=Array.isArray(j)?j.map(n):Array.isArray(y.output)?y.output.map(V=>n(V)):[],O=((c=v.data)==null?void 0:c.label)!=null?String(v.data.label):y.label!=null?String(y.label):v.id,W=(d=v.data)==null?void 0:d.body,M=W!=null?String(W):y.body!=null?String(y.body):"";let T=((f=v.data)==null?void 0:f.model)!=null&&String(v.data.model).trim()!==""?String(v.data.model).trim():y.model!=null&&String(y.model).trim()!==""?String(y.model).trim():void 0;(T===""||T==="default")&&(T=void 0);const E={...y,definitionId:k,label:O,role:F,model:T,input:z,output:L},D=((u=v.data)==null?void 0:u.marketplaceRef)||y.marketplaceRef;D?E.marketplaceRef=String(D):delete E.marketplaceRef;const _=((p=v.data)==null?void 0:p.marketplacePackageId)||y.marketplacePackageId;_?E.marketplacePackageId=String(_):delete E.marketplacePackageId;const R=((m=v.data)==null?void 0:m.marketplaceVersion)||y.marketplaceVersion;R?E.marketplaceVersion=String(R):delete E.marketplaceVersion,k.startsWith("provide_")||M.trim()===""?delete E.body:E.body=M;const P=Array.isArray((g=v.data)==null?void 0:g.images)?v.data.images:Array.isArray(y.images)?y.images:[];P.length>0?E.images=P:delete E.images;const G=(b=v.data)==null?void 0:b.script,Z=G!=null?String(G):y.script!=null?String(y.script):"";Z.trim()===""?delete E.script:E.script=Z,delete E.temperature,delete E.maxTokens,delete E.description,r[v.id]=E}return r}function rf(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function HU(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 oT(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=>rf(a)),edges:i.map(a=>rf(a)),instances:ap(r,n||{})}}function aT(e,t,n,r,s={}){var u;if(!e||!Array.isArray(e.nodes)||e.nodes.length===0)return null;const i=s.offset||{x:48,y:48},a=new Set((t||[]).map(p=>p.id)),l=new Map;for(const p of e.nodes)l.set(p.id,HU(p.id,a));const c=e.nodes.map(p=>{var g,b;const m=l.get(p.id);return{...rf(p),id:m,selected:!0,dragging:!1,position:{x:Number(((g=p.position)==null?void 0:g.x)||0)+i.x,y:Number(((b=p.position)==null?void 0:b.y)||0)+i.y}}}),d=(e.edges||[]).filter(p=>l.has(p.source)&&l.has(p.target)).map((p,m)=>{const g=l.get(p.source),b=l.get(p.target);return{...rf(p),id:`e-${g}-${b}-${Date.now()}-${m}`,source:g,target:b,selected:!1}}),f={...r||{}};for(const[p,m]of l.entries()){const g=(u=e.instances)==null?void 0:u[p];g&&(f[m]={...rf(g),label:g.label!=null?String(g.label):m})}return{nodes:[...(t||[]).map(p=>({...p,selected:!1})),...c],edges:[...(n||[]).map(p=>({...p,selected:!1})),...d],instances:f,pastedNodeIds:c.map(p=>p.id)}}function yj(e,t,n,r){var f,u,p,m;const s=ap(e,n),i=t.map(g=>({source:g.source,target:g.target,sourceHandle:g.sourceHandle??null,targetHandle:g.targetHandle??null})),a={},l={};for(const g of e){const b=g.position??{x:0,y:0};a[g.id]={x:b.x,y:b.y};const v=Number(((u=(f=g.data)==null?void 0:f.displaySize)==null?void 0:u.width)||g.width||0),y=Number(((m=(p=g.data)==null?void 0:p.displaySize)==null?void 0:m.height)||g.height||0);v>0&&y>0&&(l[g.id]={width:Math.round(v),height:Math.round(y)})}const c={nodePositions:a};Object.keys(l).length>0&&(c.nodeSizes=l),r!=null&&r.viewport&&Number.isFinite(Number(r.viewport.x))&&Number.isFinite(Number(r.viewport.y))&&Number.isFinite(Number(r.viewport.zoom))&&(c.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()!==""&&(c.description=String(r.description).trim());const d={instances:s,edges:i,ui:c};return iT.dump(d,{lineWidth:-1})}function WU(e){var s,i;const t={inputNames:[],outputNames:[]},n=Array.isArray((s=e.data)==null?void 0:s.inputs)?e.data.inputs:[],r=Array.isArray((i=e.data)==null?void 0:i.outputs)?e.data.outputs:[];for(let a=0;a<n.length;a++){const l=n[a],c=(l&&l.name!=null?String(l.name).trim():"")||`input-${a}`;t.inputNames.push(c)}for(let a=0;a<r.length;a++){const l=r[a],c=(l&&l.name!=null?String(l.name).trim():"")||`output-${a}`;t.outputNames.push(c)}return t}function VU(e,t,n){var c,d,f;const r=new Set(e.map(u=>u.id)),s={};for(const u of e)s[u.id]=WU(u);const i=new Map,a=new Map;for(const u of t)u.target&&r.has(u.target)&&(i.has(u.target)||i.set(u.target,new Set),u.targetHandle&&i.get(u.target).add(u.targetHandle)),u.source&&r.has(u.source)&&(a.has(u.source)||a.set(u.source,new Set),u.sourceHandle&&a.get(u.source).add(u.sourceHandle));const l=[];for(const u of e){const p=((c=u.data)==null?void 0:c.definitionId)!=null?String(u.data.definitionId):"",m=s[u.id]||{inputNames:[],outputNames:[]},g=m.inputNames.length,b=m.outputNames.length;if(!(p==="control_start"||p.startsWith("provide_"))&&g>0)for(let k=0;k<g;k++){const w=`input-${k}`;if(!((d=i.get(u.id))==null?void 0:d.has(w))){const A=m.inputNames[k]||w;l.push({nodeId:u.id,suffix:n("flow:validation.inputSlotNoEdge",{slotName:A,handle:w}),key:`${u.id}-${w}-in`})}}if(!(p==="control_end")&&b>0)for(let k=0;k<b;k++){const w=`output-${k}`;if(!((f=a.get(u.id))==null?void 0:f.has(w))){const A=m.outputNames[k]||w;l.push({nodeId:u.id,suffix:n("flow:validation.outputSlotNoEdge",{slotName:A,handle:w}),key:`${u.id}-${w}-out`})}}}return l}const Vm=/\[image\s+(\d+)\]/gi;function ws(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 UU(e){return`image ${ws(e).length+1}`}function KU(e,t){const n=String(e||""),r=`[${t}]`;return n.trim()?`${n.replace(/[ \t]+$/u,"")} ${r}`:r}function qU(e,t){const n=ws(e),r=String(t||""),s=new Set;Vm.lastIndex=0;let i;for(;i=Vm.exec(r);)s.add(`image ${i[1]}`.toLowerCase());return s.size===0?[]:n.filter(a=>s.has(String(a.label||"").toLowerCase()))}function YU(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 lT(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 Um(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 cT({files:e,body:t,images:n}){const r=Array.from(e||[]);if(r.length===0)return null;let s=String(t||"");const i=ws(n);for(const a of r){const l=await YU(a),c=UU(i);i.push({id:`${Date.now().toString(36)}-${i.length+1}`,label:c,...l}),s=KU(s,c)}return{body:s,images:i}}function fb(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 GU={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 XU(e,t,n){const r=String((n==null?void 0:n.displayName)||"").trim(),s=String(t||"").trim();return!r||!s||r===s?s:(GU[e]||[]).includes(s)?r:s}const JU={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"])},QU={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"])},ZU=new Set(["display_markdown","display_mermaid","display_ascii","display_html","display_image","display_chart","display_table"]);function eK(e,t){if(!ZU.has(String(e||"")))return!1;const n=String((t==null?void 0:t.name)||"");return n==="content"||n==="src"}function tK(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function nK(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 xj(e,t,n){return!Array.isArray(t)||!Array.isArray(n)||n.length===0?t:t.map((r,s)=>{var d,f;const i=n[s],l=n.find(u=>(u==null?void 0:u.name)&&u.name===r.name)||i;if(!l)return r;const c=r.showOnNode===!1&&l.showOnNode==null&&((d=JU[e])==null?void 0:d.has(r.name));return{...r,...r.required==null&&l.required!=null?{required:!!l.required}:{},...c?{showOnNode:!0}:{},...!r._showOnNodeExplicit&&l.showOnNode!=null?{showOnNode:!!l.showOnNode}:{},...!r._showOnNodeExplicit&&l.showOnNode==null?{showOnNode:!!r.required||String(r.type||"").trim().toLowerCase()==="node"}:{},...!r._showOnNodeExplicit&&eK(e,r)?{showOnNode:!0}:{},...(f=QU[e])!=null&&f.has(r.name)?{showOnNode:!1}:{}}})}function uT(e){var s,i;const t=Array.isArray((s=e==null?void 0:e.data)==null?void 0:s.inputs)?e.data.inputs:[],n=Array.isArray((i=e==null?void 0:e.data)==null?void 0:i.outputs)?e.data.outputs:[],r=a=>a.map(l=>{const c=fb(l);return{type:String(c.type||"node"),name:String(c.name??""),default:String(c.default??""),required:!!c.required,showOnNode:c.showOnNode!=null?c.showOnNode!==!1:!!c.required||String(c.type||"").trim().toLowerCase()==="node"}});return{inputs:r(t),outputs:r(n)}}function Bf(e,t,n,r,s){var D,_,R,P,G,Z,V,se,ue,pe,ge,ae,be,Pe,we,_e,Ie,st,ct,et,Et;const i=((D=e.data)==null?void 0:D.definitionId)||String(e.id).replace(/-\d+$/,""),a=n.find(Ue=>Ue.id===i),l=t[e.id];let c=[],d=[],f=((_=e.data)==null?void 0:_.label)??e.id,u,p,m,g,b;const v=!!l;l&&(Array.isArray(l.input)&&(c=l.input.map(fb)),Array.isArray(l.output)&&(d=l.output.map(fb)),l.label&&(f=String(l.label)),l.role&&typeof l.role=="string"&&(u=l.role),l.model!=null&&(p=String(l.model).trim()),l.body!=null&&(m=String(l.body)),Array.isArray(l.images)&&(g=l.images),l.script!=null&&(b=String(l.script)));const y=u??(typeof((R=e.data)==null?void 0:R.role)=="string"?e.data.role:"普通"),k=p??((P=e.data)==null?void 0:P.model)??void 0,w=(a==null?void 0:a.description)!=null?String(a.description).trim():"",j=w!==""?w:void 0,A=m??((G=e.data)==null?void 0:G.body)??"",C=Array.isArray(g)?g:Array.isArray((Z=e.data)==null?void 0:Z.images)?e.data.images:[],$=b!==void 0?b:((V=e.data)==null?void 0:V.script)!=null?String(e.data.script):"",B=String(e.id),F=(se=r==null?void 0:r[s])==null?void 0:se[B],z=(ue=F==null?void 0:F.label)==null?void 0:ue.label,L=F==null?void 0:F.body,O=F==null?void 0:F.description;v||(c.length===0&&((pe=a==null?void 0:a.inputs)!=null&&pe.length)&&(c=a.inputs.map(Ue=>({...Ue}))),d.length===0&&((ge=a==null?void 0:a.outputs)!=null&&ge.length)&&(d=a.outputs.map(Ue=>({...Ue}))));const W=nK(a,(a==null?void 0:a.id)??i),M=(l==null?void 0:l.marketplaceRef)||((ae=e.data)==null?void 0:ae.marketplaceRef)||tK(a);if(W==="agent_subAgent"&&!d.some(Ue=>(Ue==null?void 0:Ue.name)==="result")){const Ue=(be=a==null?void 0:a.outputs)==null?void 0:be.find(St=>(St==null?void 0:St.name)==="result");d=[...d,Ue?{...Ue}:{type:"text",name:"result",default:""}]}if((W==="display_markdown"||W==="display_mermaid"||W==="display_ascii"||W==="display_chart"||W==="display_table")&&!d.some(Ue=>(Ue==null?void 0:Ue.name)==="next")){const Ue=(Pe=a==null?void 0:a.outputs)==null?void 0:Pe.find(St=>(St==null?void 0:St.name)==="next");d=[...d,Ue?{...Ue}:{type:"node",name:"next",default:""}]}if(W==="workspace_run"){if(!c.some(Ue=>(Ue==null?void 0:Ue.name)==="prev")){const Ue=(we=a==null?void 0:a.inputs)==null?void 0:we.find(St=>(St==null?void 0:St.name)==="prev");c=[Ue?{...Ue}:{type:"node",name:"prev",default:""},...c]}if(!d.some(Ue=>(Ue==null?void 0:Ue.name)==="next")){const Ue=(_e=a==null?void 0:a.outputs)==null?void 0:_e.find(St=>(St==null?void 0:St.name)==="next");d=[...d,Ue?{...Ue}:{type:"node",name:"next",default:""}]}}c=xj(W,c,a==null?void 0:a.inputs),d=xj(W,d,a==null?void 0:a.outputs),W.startsWith("provide_")&&d[0]&&String(d[0].default??d[0].value??"").trim()===""&&String(A).trim()!==""&&(d=d.map((Ue,St)=>St===0?{...Ue,default:A,value:A}:Ue));const T=XU(W,z||f,a),E=W==="tool_nodejs"||String($).trim()!=="";return{...e,type:"flowNode",data:{...e.data,label:z||f,displayLabel:T,definitionDisplayName:a==null?void 0:a.displayName,definitionId:W,...M?{marketplaceRef:M}:{},...l!=null&&l.marketplacePackageId||(Ie=e.data)!=null&&Ie.marketplacePackageId||a!=null&&a.packageId?{marketplacePackageId:(l==null?void 0:l.marketplacePackageId)||((st=e.data)==null?void 0:st.marketplacePackageId)||(a==null?void 0:a.packageId)}:{},...l!=null&&l.marketplaceVersion||(ct=e.data)!=null&&ct.marketplaceVersion||a!=null&&a.version?{marketplaceVersion:(l==null?void 0:l.marketplaceVersion)||((et=e.data)==null?void 0:et.marketplaceVersion)||(a==null?void 0:a.version)}:{},schemaType:((Et=e.data)==null?void 0:Et.schemaType)??e.type??"agent",role:y,model:k,body:L||A,images:C,script:$,inputs:c,outputs:d,description:O||j,originalLabel:f,originalBody:A,...E?{script:$}:{}}}}function dT(e,t){const n=new Map(t.map(r=>[r.id,r]));return e.filter(r=>{var f,u,p,m;const s=n.get(r.source),i=n.get(r.target),a=((u=(f=s==null?void 0:s.data)==null?void 0:f.outputs)==null?void 0:u.length)??0,l=((m=(p=i==null?void 0:i.data)==null?void 0:p.inputs)==null?void 0:m.length)??0,c=r.sourceHandle?parseInt(String(r.sourceHandle).replace("output-",""),10):0,d=r.targetHandle?parseInt(String(r.targetHandle).replace("input-",""),10):0;return s&&i&&c>=0&&c<a&&d>=0&&d<l})}function wj(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 bj(e,t){return!Array.isArray(e)||!e[t]||e[t].showOnNode===!0?e:e.map((n,r)=>r===t?{...n,showOnNode:!0}:n)}function Km(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=wj(t==null?void 0:t.sourceHandle,"output"),i=wj(t==null?void 0:t.targetHandle,"input");let a=!1;const l=(e||[]).map(c=>{var d,f,u,p;if(c.id===n){const m=bj((d=c.data)==null?void 0:d.outputs,s);if(m!==((f=c.data)==null?void 0:f.outputs))return a=!0,{...c,data:{...c.data,outputs:m}}}if(c.id===r){const m=bj((u=c.data)==null?void 0:u.inputs,i);if(m!==((p=c.data)==null?void 0:p.inputs))return a=!0,{...c,data:{...c.data,inputs:m}}}return c});return a?l:e}const vj=80,rK=220;function sK(e){if(!e||typeof e!="object")return e;const{selected:t,dragging:n,resizing:r,className:s,positionAbsolute:i,measured:a,internals:l,...c}=e;return c}function iK(e){if(!e||typeof e!="object")return e;const{selected:t,className:n,...r}=e;return r}function gh(e,t,n){const r={nodes:Array.isArray(e)?e.map(sK):[],edges:Array.isArray(t)?t.map(iK):[],extra:n&&typeof n=="object"?n:{}},s=JSON.stringify(r);return{value:JSON.parse(s),signature:s}}function fx(e,t){const n=[...e,t];return n.length>vj?n.slice(n.length-vj):n}function fT({nodes:e,edges:t,extra:n,enabled:r=!0,onRestore:s}){const[i,a]=h.useState(0),l=h.useRef([]),c=h.useRef([]),d=h.useRef(null),f=h.useRef(null),u=h.useRef(null),p=h.useRef(null),m=h.useRef(!1),g=h.useCallback(()=>a(A=>A+1),[]),b=h.useCallback(()=>{p.current&&(window.clearTimeout(p.current),p.current=null)},[]),v=h.useCallback(()=>{b();const A=f.current,C=u.current;return f.current=null,u.current=null,!A||!C||A.signature===C.signature?(C&&(d.current=C),!1):(l.current=fx(l.current,A),c.current=[],d.current=C,g(),!0)},[g,b]),y=h.useCallback((A=[],C=[],$={})=>{b(),l.current=[],c.current=[],f.current=null,u.current=null,d.current=gh(A,C,$),m.current=!1,g()},[g,b]),k=h.useCallback(A=>{m.current=!0,d.current=A,f.current=null,u.current=null,b(),s==null||s(A.value),g()},[g,b,s]),w=h.useCallback(()=>{v();const A=d.current||gh(e,t,n),C=l.current.pop();return C?(c.current=fx(c.current,A),k(C),!0):(g(),!1)},[g,t,n,v,e,k]),j=h.useCallback(()=>{v();const A=d.current||gh(e,t,n),C=c.current.pop();return C?(l.current=fx(l.current,A),k(C),!0):(g(),!1)},[g,t,n,v,e,k]);return h.useEffect(()=>()=>b(),[b]),h.useEffect(()=>{if(!r)return;const A=gh(e,t,n);if(!d.current){d.current=A;return}if(m.current){m.current=!1,d.current=A;return}A.signature!==d.current.signature&&(f.current||(f.current=d.current),u.current=A,b(),p.current=window.setTimeout(()=>{v()},rK))},[b,t,r,n,v,e]),{canUndo:l.current.length>0||!!f.current,canRedo:c.current.length>0,resetHistory:y,undo:w,redo:j,version:i}}function Zn(e){switch(qm(e)){case"text":return"#2196f3";case"file":return"#4caf50";case"node":return"#ff9800";case"bool":return"#9c27b0";default:return"#9e9e9e"}}function qm(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 oK(e,t){const n=qm(e),r=qm(t);return!n||!r?!1:n==="any"||r==="any"?!0:n===r}const aK=new Set(["workspaceContext","skillsContext","mcpContext"]);function pb(e){const t=qm(e==null?void 0:e.type),n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim();return t==="text"&&aK.has(n)?`${t}+${n}`:t}function pT(e){return pb(e)}function Mu(e,t){if(!e||!t||!oK(e.type,t.type))return!1;const n=pb(e),r=pb(t),s=n.includes("+"),i=r.includes("+");return s||i?n===r:!0}function lK(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 $u(e,t,n){var l;const r=n==="source"?"outputs":"inputs",i=lK(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 Ho(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function cK(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 uK(e){const t=String(e||"").trim();return t?t.match(/^marketplace:/i)?"MARKETPLACE":t:""}function dK(e){return["true","1","yes","on"].includes(String((e==null?void 0:e.value)??(e==null?void 0:e.default)??"").trim().toLowerCase())}function ur(e){e.stopPropagation()}function fK(e){return String(e||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function pK(e,t){const n=`\\[${fK(t)}\\]`;return String(e||"").replace(new RegExp(`[ \\t]*${n}`,"gi"),"").replace(/[ \t]+\n/g,`
|
|
124
|
-
`).replace(/\n{3,}/g,`
|
|
125
|
-
|
|
126
|
-
`).trimEnd()}function px(e){return String(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function hK(e){const t=String(e||"");let n="",r=0;Vm.lastIndex=0;let s;for(;s=Vm.exec(t);)n+=px(t.slice(r,s.index)),n+=`<span class="af-flow-node__image-token">${px(s[0])}</span>`,r=s.index+s[0].length;return n+=px(t.slice(r)),n||" "}function mK(e,t){const n=window.getComputedStyle(e),r=Number.parseFloat(n.lineHeight)||18,s=Number.parseFloat(n.paddingTop)||0,i=Number.parseFloat(n.paddingBottom)||0,a=Number.parseFloat(n.borderTopWidth)||0,l=Number.parseFloat(n.borderBottomWidth)||0,c=String(t||"").split(/\r\n|\r|\n/).length,d=Math.min(Math.max(c,2),8);return Math.ceil(d*r+s+i+a+l)}function hT({data:e,selected:t,id:n,deleteNode:r,onProvideExpand:s,onProvideValueChange:i,onNodeBodyChange:a,onNodeImagesChange:l,modelLists:c,onModelChange:d}){var Zt,Nn;const{t:f}=kn(),u=(e==null?void 0:e.inputs)??[],p=(e==null?void 0:e.outputs)??[],m=((e==null?void 0:e.schemaType)??"agent").toLowerCase(),g=cK(e),b=uK(g),v=(e==null?void 0:e.isRunMode)??!1,y=!!(e!=null&&e.readOnly),k=(e==null?void 0:e.isExecuting)??!1,w=(e==null?void 0:e.isDim)??!1,j=(e==null?void 0:e.nodeStatus)??null,A=(e==null?void 0:e.nodeElapsed)??null,C=(e==null?void 0:e.definitionId)||"",$=C.startsWith("provide_"),B=C==="provide_bool",F=C==="provide_str",z=C==="provide_file",L=C==="agent_subAgent",O=L&&!v,W=B?dK(p[0]):!1,M=$?String(((Zt=p[0])==null?void 0:Zt.value)??((Nn=p[0])==null?void 0:Nn.default)??(e==null?void 0:e.body)??""):"",T=String((e==null?void 0:e.body)||""),E=(e==null?void 0:e.displayLabel)||(e==null?void 0:e.label)||f("flow:node.fallbackLabel"),D=!$&&!O&&(e!=null&&e.showBodyPreview)?String((e==null?void 0:e.body)||"").trim():"",_=ws(e==null?void 0:e.images),R=h.useRef(!1),P=h.useRef(!1),G=h.useRef(null),Z=h.useRef(null),V=h.useRef(null),[se,ue]=h.useState(M),[pe,ge]=h.useState(T);h.useEffect(()=>{R.current||ue(M)},[n,M]),h.useEffect(()=>{P.current||ge(T)},[n,T]),h.useEffect(()=>{const xe=Z.current;if(!xe)return;const Re=mK(xe,pe);xe.style.minHeight=`${Re}px`,xe.style.height="",V.current&&(V.current.style.minHeight=`${Re}px`,V.current.style.height="")},[pe]),h.useEffect(()=>{const xe=G.current,Re=e==null?void 0:e.onNodeContentResize;if(!O||!xe||!Re||typeof ResizeObserver>"u")return;let it=0;const re=()=>{window.cancelAnimationFrame(it),it=window.requestAnimationFrame(()=>Re(n))},Ce=new ResizeObserver(re);return Ce.observe(xe),re(),()=>{window.cancelAnimationFrame(it),Ce.disconnect()}},[e==null?void 0:e.onNodeContentResize,O,n]);const ae=Array.isArray(c==null?void 0:c.cursor)?c.cursor:[],be=Array.isArray(c==null?void 0:c.opencode)?c.opencode:[],Pe=Array.isArray(c==null?void 0:c.claudeCode)?c.claudeCode:[],we=((e==null?void 0:e.model)??"").trim(),_e=m==="agent"&&!C.startsWith("tool_nodejs"),Ie=new Set(ae.map(Ho)),st=new Set(be.map(Ho)),ct=new Set(Pe.map(Ho)),et=we?we.startsWith("cursor:")||we.startsWith("opencode:")||we.startsWith("claude-code:")?we:ct.has(we)?`claude-code:${we}`:st.has(we)?`opencode:${we}`:Ie.has(we)?`cursor:${we}`:we:"",Et=we&&!et.startsWith("cursor:")&&!et.startsWith("opencode:")&&!et.startsWith("claude-code:")&&!Ie.has(we)&&!st.has(we)&&!ct.has(we),Ue=we.startsWith("cursor:")?we.slice(7):we.startsWith("opencode:")?we.slice(9):we.startsWith("claude-code:")?we.slice(12):we,St=xe=>{if(y)return;const Re=xe.target.value;d&&d(n,Re)},tn=xe=>{xe.stopPropagation(),!y&&r&&r(n)},gn=xe=>{xe.stopPropagation(),s&&s()},Tn=xe=>{xe.stopPropagation(),!y&&(i==null||i(n,xe.target.value==="true"?"true":"false"))},zt=xe=>{if(xe.stopPropagation(),y)return;const Re=xe.target.value;ue(Re),R.current||i==null||i(n,Re)},Rn=xe=>{xe.stopPropagation(),R.current=!0},Bn=xe=>{if(xe.stopPropagation(),y)return;R.current=!1;const Re=xe.currentTarget.value;ue(Re),i==null||i(n,Re)},le=()=>{y||i==null||i(n,se)},fe=xe=>{if(xe.stopPropagation(),y)return;const Re=window.prompt("文件路径",se);Re!=null&&(ue(Re),i==null||i(n,Re))},ze=xe=>{if(ge(xe),a==null||a(n,xe),l){const Re=qU(_,xe);(Re.length!==_.length||Re.some((it,re)=>{var Ce;return it.id!==((Ce=_[re])==null?void 0:Ce.id)}))&&l(n,Re)}},Ze=xe=>{if(xe.stopPropagation(),y)return;const Re=xe.target.value;P.current?ge(Re):ze(Re)},ot=xe=>{xe.stopPropagation(),!y&&(P.current=!0)},Jt=xe=>{if(xe.stopPropagation(),y)return;P.current=!1;const Re=xe.currentTarget.value;ze(Re)},nn=()=>{y||ze(pe)},Ln=async xe=>{if(y)return;const Re=await cT({files:xe,body:pe,images:_});Re&&(ge(Re.body),a==null||a(n,Re.body),l==null||l(n,Re.images))},yn=(xe,Re)=>{if(xe.stopPropagation(),y)return;const it=_.filter(Ce=>Ce.id!==Re.id),re=pK(pe,Re.label);ge(re),a==null||a(n,re),l==null||l(n,it)},ir=xe=>{if(y)return;const Re=lT(xe);Re.length!==0&&(xe.preventDefault(),xe.stopPropagation(),Ln(Re).catch(()=>{}))},rn=xe=>{if(y)return;const Re=Um(xe);Re.length!==0&&(xe.preventDefault(),xe.stopPropagation(),Ln(Re).catch(()=>{}))},Sn=()=>{const xe=Z.current,Re=V.current;!xe||!Re||(Re.scrollTop=xe.scrollTop,Re.scrollLeft=xe.scrollLeft)};return o.jsxs("div",{className:"af-flow-node"+(t?" af-flow-node--selected":"")+(k?" af-flow-node--executing":"")+(j==="success"?" af-flow-node--done":"")+(j==="failed"?" af-flow-node--failed":"")+(j==="running"&&!k?" af-flow-node--running-disk":"")+(w?" af-flow-node--dim":"")+(O?" af-flow-node--inline-body-editor":"")+" 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:g,children:b}),!v&&_e&&o.jsxs("div",{className:"af-flow-node__model-wrap nodrag",onPointerDown:ur,onMouseDown:ur,onClick:ur,children:[o.jsxs("select",{className:"af-flow-node__model nodrag",value:et,onChange:St,onPointerDown:ur,onMouseDown:ur,onClick:ur,"aria-label":f("flow:node.model"),title:Ue||f("flow:node.defaultModel"),disabled:y,children:[o.jsx("option",{value:"",children:f("flow:node.defaultModel")}),Et&&o.jsx("option",{value:we,children:we}),ae.length>0&&o.jsx("optgroup",{label:"Cursor",children:ae.map(xe=>o.jsx("option",{value:`cursor:${Ho(xe)}`,children:Ho(xe)},`c-${xe}`))}),be.length>0&&o.jsx("optgroup",{label:"OpenCode",children:be.map(xe=>o.jsx("option",{value:`opencode:${Ho(xe)}`,children:Ho(xe)},`o-${xe}`))}),Pe.length>0&&o.jsx("optgroup",{label:"Claude Code",children:Pe.map(xe=>o.jsx("option",{value:`claude-code:${Ho(xe)}`,children:Ho(xe)},`cc-${xe}`))})]}),o.jsx("span",{className:"af-flow-node__model-arrow material-symbols-outlined",children:"expand_more"})]}),k&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--executing",children:"EXECUTING"}),j==="running"&&!k&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--running-disk",title:f("flow:node.diskRunning"),children:"RUNNING"}),j==="success"&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--done",children:A!=null&&String(A).trim()!==""?A:"--"}),j==="failed"&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--failed",children:"FAILED"}),!v&&$&&!B&&!F&&!z&&o.jsx("button",{type:"button",className:"af-flow-node__expand",onClick:gn,"aria-label":f("flow:node.expandProvide"),title:f("flow:node.expandProvide"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),!v&&o.jsx("button",{type:"button",className:"af-flow-node__delete",disabled:y,onClick:tn,"aria-label":f("flow:node.deleteNode"),title:f("flow:node.deleteNode"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-flow-node__body",children:[o.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--in",children:u.map((xe,Re)=>{if(xe.showOnNode===!1)return null;const it=f("flow:node.inputTooltip",{name:xe.name||`#${Re}`,type:xe.type})+(xe.default!=null&&xe.default!==""?f("flow:node.defaultSuffix",{value:xe.default}):""),re=xe.name||`#${Re+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:it,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--in",children:[re,xe.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(Cs,{type:"target",position:Ye.Left,id:`input-${Re}`,className:"af-flow-node__handle",style:{background:Zn(xe.type)},title:it})]},`in-${Re}`)})}),o.jsxs("div",{className:"af-flow-node__title-wrap",children:[o.jsx("span",{className:"af-flow-node__title",children:E}),n?o.jsx("span",{className:"af-flow-node__subtitle",title:n,children:n}):null,B?o.jsxs("select",{className:"af-flow-node__bool-select nodrag"+(W?" af-flow-node__bool-select--true":""),value:W?"true":"false",onChange:Tn,onPointerDown:ur,onMouseDown:ur,onClick:ur,"aria-label":"Boolean value",title:W?"true":"false",disabled:y,children:[o.jsx("option",{value:"false",children:"false"}),o.jsx("option",{value:"true",children:"true"})]}):F?o.jsx("textarea",{className:"af-flow-node__inline-text nodrag",value:se,onChange:zt,onCompositionStart:Rn,onCompositionEnd:Bn,onBlur:le,onPointerDown:ur,onMouseDown:ur,onClick:ur,placeholder:"输入文本",rows:2,readOnly:y}):z?o.jsxs("div",{className:"af-flow-node__file-value nodrag",onPointerDown:ur,onMouseDown:ur,onClick:ur,children:[o.jsx("input",{className:"af-flow-node__file-input nodrag",value:se,onChange:zt,onCompositionStart:Rn,onCompositionEnd:Bn,onBlur:le,placeholder:"选择或输入文件路径",title:se||"选择或输入文件路径",readOnly:y}),o.jsx("button",{type:"button",className:"af-flow-node__file-picker nodrag",disabled:y,onClick:fe,"aria-label":"选择文件",title:"选择文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"folder_open"})})]}):L&&!v?o.jsxs("div",{ref:G,className:"af-flow-node__prompt-stack nodrag",onPointerDown:ur,onMouseDown:ur,onClick:ur,children:[o.jsx("pre",{ref:V,className:"af-flow-node__prompt-backdrop","aria-hidden":"true",dangerouslySetInnerHTML:{__html:hK(pe)+`
|
|
127
|
-
`}}),o.jsx("textarea",{ref:Z,className:"af-flow-node__prompt-editor nodrag",value:pe,onChange:Ze,onCompositionStart:ot,onCompositionEnd:Jt,onBlur:nn,onPaste:ir,onDrop:rn,onScroll:Sn,onDragOver:xe=>{Um(xe).length>0&&xe.preventDefault()},placeholder:"输入 prompt",rows:2,readOnly:y})]}):null,L&&_.length>0?o.jsx("div",{className:"af-flow-node__image-chips",children:_.map((xe,Re)=>o.jsxs("span",{className:"af-flow-node__image-chip",title:xe.name,children:[o.jsx("img",{src:xe.dataUrl,alt:""}),o.jsxs("span",{children:["[",xe.label||`image ${Re+1}`,"]"]}),o.jsx("button",{type:"button",className:"af-flow-node__image-remove nodrag",disabled:y,onClick:it=>yn(it,xe),onPointerDown:ur,onMouseDown:ur,"aria-label":`删除 ${xe.label||`image ${Re+1}`}`,title:"删除图片",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},xe.id||Re))}):null,D?o.jsx("span",{className:"af-flow-node__prompt-preview",title:D,children:D}):null]}),o.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--out",children:p.map((xe,Re)=>{if(xe.showOnNode===!1)return null;const it=f("flow:node.outputTooltip",{name:xe.name||`#${Re}`,type:xe.type})+(xe.default!=null&&xe.default!==""?f("flow:node.defaultSuffix",{value:xe.default}):""),re=xe.name||`#${Re+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:it,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--out",children:[re,xe.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(Cs,{type:"source",position:Ye.Right,id:`output-${Re}`,className:"af-flow-node__handle",style:{background:Zn(xe.type)},title:it})]},`out-${Re}`)})})]})]})}const lp="flowNode";function mT(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 Ym(e){return e.key==="?"||e.key==="/"&&e.shiftKey}function gK(){return typeof navigator>"u"?!1:/Mac|iPhone|iPod|iPad/i.test(navigator.platform||navigator.userAgent||"")}function yK({open:e,onClose:t,flowId:n,flowSource:r,onArchived:s}){const{t:i}=kn(),a=h.useId(),l=h.useRef(null),[c,d]=h.useState(""),[f,u]=h.useState(!1),[p,m]=h.useState("");if(h.useEffect(()=>{if(!e)return;d(""),m(""),u(!1);const y=requestAnimationFrame(()=>{var k;return(k=l.current)==null?void 0:k.focus()});return()=>cancelAnimationFrame(y)},[e,n]),!e)return null;const g=c.trim(),b=g===n;async function v(y){if(y.preventDefault(),!(!b||f)){u(!0),m("");try{const k=await fetch("/api/flow/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:g})}),w=await k.json().catch(()=>({}));if(!k.ok){m(typeof w.error=="string"?w.error:i("project:archiveModal.archiveFailed"));return}s()}catch(k){m(String((k==null?void 0:k.message)||k))}finally{u(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&t()},children:o.jsxs("div",{ref:l,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":a,tabIndex:-1,onMouseDown:y=>y.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:a,className:"af-shortcuts-panel__title",children:i("project:archiveModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":i("project:archiveModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:v,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:i("project:archiveModal.lead",{flowId:n})}),o.jsxs("label",{className:"af-new-pipeline-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:i("project:archiveModal.confirmLabel")}),o.jsx("input",{type:"text",className:"af-new-pipeline-input",value:c,onChange:y=>d(y.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":g.length>0&&!b})]}),p?o.jsx("p",{className:"af-err af-new-pipeline-err",children:p}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:f,children:i("project:archiveModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!b||f,children:i(f?"project:archiveModal.archiving":"project:archiveModal.confirmArchive")})]})]})]})})}function kj({open:e,title:t,message:n,confirmLabel:r,cancelLabel:s,destructive:i=!1,secondaryLabel:a,secondaryDestructive:l=!1,onSecondary:c,onConfirm:d,onCancel:f}){const{t:u}=kn(),p=h.useId(),m=h.useRef(null);if(h.useEffect(()=>{if(!e)return;const y=requestAnimationFrame(()=>{var w;return(w=m.current)==null?void 0:w.focus()});function k(w){w.key==="Escape"&&f(),w.key==="Enter"&&d()}return window.addEventListener("keydown",k),()=>{cancelAnimationFrame(y),window.removeEventListener("keydown",k)}},[e,f,d]),!e)return null;const g=r??u("common:common.confirm","确定"),b=s??u("common:common.cancel","取消"),v=t??u("common:common.confirmTitle","请确认");return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&f()},children:o.jsxs("div",{ref:m,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":p,tabIndex:-1,onMouseDown:y=>y.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:p,className:"af-shortcuts-panel__title",children:v}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:f,"aria-label":b,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-shortcuts-panel__body af-new-pipeline-form",children:[o.jsx("p",{className:"af-new-pipeline-lead",children:n}),o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:f,children:b}),a&&c?o.jsx("button",{type:"button",className:l?"af-btn-secondary af-btn-destructive":"af-btn-secondary",onClick:c,children:a}):null,o.jsx("button",{type:"button",className:i?"af-btn-primary af-btn-destructive":"af-btn-primary",onClick:d,autoFocus:!0,children:g})]})]})]})})}function xK({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,onDeleted:i}){const{t:a}=kn(),l=h.useId(),c=h.useRef(null),[d,f]=h.useState(""),[u,p]=h.useState(!1),[m,g]=h.useState("");if(h.useEffect(()=>{if(!e)return;f(""),g(""),p(!1);const k=requestAnimationFrame(()=>{var w;return(w=c.current)==null?void 0:w.focus()});return()=>cancelAnimationFrame(k)},[e,n]),!e)return null;const b=d.trim(),v=b===n;async function y(k){if(k.preventDefault(),!v||u)return;p(!0),g("");let w=null;try{const j=new AbortController;w=setTimeout(()=>j.abort(),15e3);const A=await fetch("/api/flow/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:b,flowArchived:s}),signal:j.signal}),C=await A.json().catch(()=>({}));if(!A.ok){g(typeof C.error=="string"?C.error:a("project:deleteModal.deleteFailed"));return}try{for(let $=localStorage.length-1;$>=0;$--){const B=localStorage.key($);B&&(B.startsWith(`af:composer-sessions:${n}:${r}`)||B.startsWith(`af:composer-active-session:${n}:${r}`)||B.startsWith(`af:workspace-composer:${n}:${r}`))&&localStorage.removeItem(B)}}catch{}await i()}catch(j){if((j==null?void 0:j.name)==="AbortError"){g(a("project:deleteModal.deleteTimeout"));return}g(String((j==null?void 0:j.message)||j))}finally{w&&clearTimeout(w),p(!1)}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:k=>{k.target===k.currentTarget&&t()},children:o.jsxs("div",{ref:c,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":l,tabIndex:-1,onMouseDown:k=>k.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:l,className:"af-shortcuts-panel__title",children:a("project:deleteModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":a("project:deleteModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:y,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:a("project:deleteModal.lead",{flowId:n})}),o.jsxs("label",{className:"af-new-pipeline-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:a("project:deleteModal.confirmLabel")}),o.jsx("input",{type:"text",className:"af-new-pipeline-input",value:d,onChange:k=>f(k.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":b.length>0&&!v})]}),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:u,children:a("project:deleteModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary af-btn-destructive",disabled:!v||u,children:a(u?"project:deleteModal.deleting":"project:deleteModal.confirmDelete")})]})]})]})})}function wK({children:e}){return o.jsx("kbd",{className:"af-kbd",children:e})}function Ti({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(wK,{children:t})]},n))})}function gT({open:e,onClose:t}){const{t:n}=kn(),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=gK()?"⌘":"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(Ti,{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(Ti,{keys:["?"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.jumpToNode")}),o.jsx(Ti,{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(Ti,{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(Ti,{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(Ti,{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(Ti,{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(Ti,{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(Ti,{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(Ti,{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(Ti,{keys:[i,"Shift","Z"]})]})]})]})]})]})})}function bK(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 yT({open:e,onClose:t,onJump:n,nodes:r}){const{t:s}=kn(),[i,a]=h.useState(""),[l,c]=h.useState(0),d=h.useRef(null),f=h.useRef(null);h.useEffect(()=>{if(!e)return;a(""),c(0);const g=requestAnimationFrame(()=>{var b;return(b=d.current)==null?void 0:b.focus()});return()=>cancelAnimationFrame(g)},[e]);const u=h.useMemo(()=>{const g=(r||[]).map(y=>{var k,w,j;return{id:y.id,label:((k=y.data)==null?void 0:k.label)||"",definitionId:((w=y.data)==null?void 0:w.definitionId)||"",schemaType:((j=y.data)==null?void 0:j.schemaType)||""}}),b=i.trim(),v=g.map(y=>({e:y,s:bK(y,b)})).filter(y=>y.s>0);return v.sort((y,k)=>k.s-y.s||y.e.id.localeCompare(k.e.id)),v.slice(0,50).map(y=>y.e)},[r,i]);if(h.useEffect(()=>{l>=u.length&&c(0)},[u.length,l]),h.useEffect(()=>{var b;const g=(b=f.current)==null?void 0:b.querySelector(`[data-idx="${l}"]`);g&&g.scrollIntoView({block:"nearest"})},[l]),!e)return null;const p=g=>{const b=u[g];b&&(n(b.id),t())},m=g=>{if(g.key==="Escape"){g.preventDefault(),t();return}if(g.key==="ArrowDown"){g.preventDefault(),c(b=>Math.min(u.length-1,b+1));return}if(g.key==="ArrowUp"){g.preventDefault(),c(b=>Math.max(0,b-1));return}g.key==="Enter"&&(g.preventDefault(),p(l))};return o.jsx("div",{className:"af-jump-overlay",role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&t()},children:o.jsxs("div",{className:"af-jump-panel",role:"dialog","aria-modal":"true","aria-label":s("flow:jumpPalette.title"),onMouseDown:g=>g.stopPropagation(),children:[o.jsxs("div",{className:"af-jump-panel__input-wrap",children:[o.jsx("span",{className:"af-jump-panel__icon material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{ref:d,type:"text",className:"af-jump-panel__input",placeholder:s("flow:jumpPalette.placeholder"),value:i,onChange:g=>{a(g.target.value),c(0)},onKeyDown:m,spellCheck:!1,autoComplete:"off"}),o.jsx("span",{className:"af-jump-panel__count",children:u.length})]}),u.length===0?o.jsx("div",{className:"af-jump-panel__empty",children:s("flow:jumpPalette.empty")}):o.jsx("ul",{ref:f,className:"af-jump-panel__list",role:"listbox",children:u.map((g,b)=>o.jsxs("li",{"data-idx":b,role:"option","aria-selected":b===l,className:"af-jump-panel__item"+(b===l?" af-jump-panel__item--active":""),onMouseEnter:()=>c(b),onMouseDown:v=>{v.preventDefault(),p(b)},children:[o.jsx("span",{className:"af-jump-panel__id",children:g.id}),g.label&&g.label!==g.id&&o.jsx("span",{className:"af-jump-panel__label",children:g.label}),g.definitionId&&o.jsx("span",{className:"af-jump-panel__tag",children:g.definitionId})]},g.id))}),o.jsxs("div",{className:"af-jump-panel__hint",children:[o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"↑"}),o.jsx("kbd",{className:"af-kbd",children:"↓"})," ",s("flow:jumpPalette.hintNavigate")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"Enter"})," ",s("flow:jumpPalette.hintJump")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"Esc"})," ",s("flow:jumpPalette.hintClose")]})]})]})})}function vK({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,filePath:i,fileName:a,onSaved:l,onAiEdit:c}){const{t:d}=kn(),f=h.useId(),u=h.useRef(null),p=h.useRef(null),[m,g]=h.useState(""),[b,v]=h.useState(""),[y,k]=h.useState(!1),[w,j]=h.useState(!1),[A,C]=h.useState(!1),[$,B]=h.useState(""),[F,z]=h.useState("");if(h.useEffect(()=>{if(!e||!i)return;g(""),v(""),B(""),z(""),k(!0),j(!1),C(!1);const E=new URLSearchParams({flowId:n,flowSource:r,archived:s?"1":"0",path:i});(async()=>{try{const _=await fetch(`/api/pipeline-file-content?${E}`),R=await _.json();if(!_.ok)throw new Error(R.error||"HTTP "+_.status);g(R.content||""),v(R.content||"")}catch(_){B(_.message||String(_))}finally{k(!1)}})();const D=requestAnimationFrame(()=>{var _;return(_=u.current)==null?void 0:_.focus()});return()=>cancelAnimationFrame(D)},[e,i,n,r,s]),!e)return null;const L=m!==b;async function O(E){if(E.preventDefault(),!w){j(!0),B(""),z("");try{const D=new URLSearchParams({flowId:n,flowSource:r,archived:s?"1":"0",path:i}),_=await fetch(`/api/pipeline-file-save?${D}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:m})}),R=await _.json();if(!_.ok)throw new Error(R.error||"HTTP "+_.status);v(m),z(d("flow:fileEdit.saved")),l&&l()}catch(D){B(D.message||String(D))}finally{j(!1)}}}async function W(){if(!(!c||A||!m)){C(!0),B("");try{const E=await c(m);typeof E=="string"&&E&&g(E)}catch(E){B(E.message||String(E))}finally{C(!1)}}}function M(){g(b),B(""),z("")}const T=m.length>1e5;return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:E=>{E.target===E.currentTarget&&t()},children:o.jsxs("div",{ref:u,className:"af-shortcuts-panel af-file-edit-panel",role:"dialog","aria-modal":"true","aria-labelledby":f,tabIndex:-1,onMouseDown:E=>E.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:f,className:"af-shortcuts-panel__title",children:a||i}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":d("flow:fileEdit.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("div",{className:"af-file-edit-body",children:y?o.jsx("div",{className:"af-file-edit-loading",children:d("flow:fileEdit.loading")}):$&&!m?o.jsx("div",{className:"af-file-edit-error",children:$}):o.jsxs(o.Fragment,{children:[T&&o.jsx("div",{className:"af-file-edit-warning",children:d("flow:fileEdit.largeFileWarning")}),o.jsx("textarea",{ref:p,className:"af-file-edit-textarea",value:m,onChange:E=>g(E.target.value),spellCheck:!1,placeholder:d("flow:fileEdit.placeholder")})]})}),($||F)&&!y&&o.jsx("div",{className:`af-file-edit-status${F?" af-file-edit-status--success":""}`,children:F||$}),o.jsxs("div",{className:"af-file-edit-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:M,disabled:!L||w||A,children:d("flow:fileEdit.reset")}),c&&o.jsx("button",{type:"button",className:"af-btn-secondary af-btn-ai",onClick:W,disabled:A||w||!m,children:d(A?"flow:fileEdit.aiRunning":"flow:fileEdit.aiEdit")}),o.jsx("button",{type:"button",className:"af-btn-primary",onClick:O,disabled:!L||w||A,children:d(w?"flow:fileEdit.saving":"flow:fileEdit.save")})]})]})})}const xT=new Set(["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"]),kK=["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"];function SK(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 NK(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 Sj(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 wT(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(xT.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 bT(e){return{inputNames:Sj(e==null?void 0:e.inputs),outputNames:Sj(e==null?void 0:e.outputs)}}function jK(e,t,n){const r=bT(t),s=NK(e),i=[];for(const a of s)if(!wT(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 CK(e,t){const n=bT(t),r=/\$\{([^}]*)\}/g,s=[];let i=0,a;for(;(a=r.exec(e))!==null;){a.index>i&&s.push({kind:"plain",text:e.slice(i,a.index)});const l=a[0],c=wT(a[1],n);s.push({kind:c?"ph-valid":"ph-invalid",text:l}),i=a.index+l.length}return i<e.length&&s.push({kind:"plain",text:e.slice(i)}),s}function EK(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function _K(e){return e.map(t=>{const n=EK(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 PK(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 kK)xT.has(r)&&n.push({section:"runtime",insert:r,label:r,subtitle:t("flow:placeholder.runtimeConst")});return n}function AK(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 IK(e,t){if(!e||t<0)return null;const n=Math.min(t,e.value.length),r=getComputedStyle(e),s=document.createElement("div");s.setAttribute("aria-hidden","true"),s.style.visibility="hidden",s.style.position="fixed",s.style.top="0",s.style.left="-99999px",s.style.whiteSpace="pre-wrap",s.style.wordWrap="break-word",s.style.overflow="hidden";const i=e.clientWidth;if(i<=0)return null;s.style.width=`${i}px`,s.style.font=r.font,s.style.lineHeight=r.lineHeight,s.style.padding=r.padding,s.style.border=r.border,s.style.boxSizing=r.boxSizing,s.style.letterSpacing=r.letterSpacing,s.style.textIndent=r.textIndent,s.style.tabSize=r.tabSize||"8",s.textContent=e.value.slice(0,n);const a=document.createElement("span");a.textContent="",s.appendChild(a),document.body.appendChild(s);const l=a.getBoundingClientRect(),c=parseFloat(r.lineHeight),d=Number.isFinite(c)&&c>0?c:l.height||16;return document.body.removeChild(s),{top:l.top,left:l.left,bottom:l.bottom,height:d}}function yh({value:e,onChange:t,disabled:n,placeholder:r,rows:s=8,textareaClassName:i,ioSlots:a,variant:l="drawer",images:c,onImagesChange:d}){const{t:f}=kn(),u=h.useId(),p=h.useRef(null),m=h.useRef(null),[g,b]=h.useState(0),[v,y]=h.useState(0),[k,w]=h.useState(null),j=h.useMemo(()=>ws(c),[c]),A=h.useMemo(()=>jK(e,a,f),[e,a,f]),C=A.length>0,$=h.useMemo(()=>CK(e,a),[e,a]),B=h.useMemo(()=>_K($),[$]),F=h.useMemo(()=>n?null:SK(e,g),[e,g,n]),z=h.useMemo(()=>{if(!F)return[];const E=PK(a,f);return AK(E,F.query)},[F,a,f]);h.useEffect(()=>{y(E=>{const D=Math.max(0,z.length-1);return Math.min(Math.max(0,E),D)})},[z.length]);const L=h.useCallback(()=>{const E=p.current;if(!E||!F||z.length===0){w(null);return}const D=IK(E,g);if(!D){w(null);return}const _=4,R=44,P=13.5*16,G=Math.min(z.length*R+8,P);let Z=D.bottom+_;Z+G>window.innerHeight-8&&(Z=Math.max(8,D.top-G-_));const V=288;let se=D.left;se=Math.max(8,Math.min(se,window.innerWidth-V-8)),w({top:Z,left:se})},[F,z.length,g]);h.useLayoutEffect(()=>{if(!F||z.length===0){w(null);return}const E=requestAnimationFrame(()=>L());return()=>cancelAnimationFrame(E)},[F,z.length,g,e,L]),h.useEffect(()=>{if(!F||z.length===0)return;const E=()=>L();return window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[F,z.length,L]);const O=h.useCallback(E=>{if(!F)return;const{atIndex:D}=F,_=e.slice(0,D)+"${"+E+"}"+e.slice(g);t(_);const R=D+E.length+3;queueMicrotask(()=>{const P=p.current;P&&(P.focus(),P.setSelectionRange(R,R)),b(R)})},[F,e,g,t]),W=h.useCallback(()=>{const E=p.current,D=m.current;!E||!D||(D.scrollTop=E.scrollTop,D.scrollLeft=E.scrollLeft,F&&z.length>0&&queueMicrotask(()=>L()))},[F,z.length,L]),M=h.useCallback(E=>{if(!n&&F&&z.length>0&&(E.key==="ArrowDown"||E.key==="ArrowUp"||E.key==="Enter")){if(E.key==="ArrowDown")E.preventDefault(),y(D=>(D+1)%z.length);else if(E.key==="ArrowUp")E.preventDefault(),y(D=>(D-1+z.length)%z.length);else if(E.key==="Enter"&&!E.shiftKey){E.preventDefault();const D=z[v];D&&O(D.insert)}}},[n,F,z,v,O]),T=h.useCallback(async E=>{if(n||typeof d!="function")return!1;const D=await cT({files:E,body:e,images:j});return D?(t(D.body),d(D.images),queueMicrotask(()=>{const _=p.current;if(!_)return;_.focus();const R=D.body.length;_.setSelectionRange(R,R),b(R)}),!0):!1},[n,j,t,d,e]);return o.jsxs("div",{className:"af-body-prompt-editor"+(l==="expand"?" af-body-prompt-editor--expand":""),children:[j.length>0?o.jsx("div",{className:"af-body-image-list","aria-label":"image attachments",children:j.map((E,D)=>o.jsxs("span",{className:"af-body-image-chip",title:E.name,children:[o.jsx("img",{src:E.dataUrl,alt:""}),o.jsxs("span",{children:["[",E.label||`image ${D+1}`,"]"]})]},E.id||D))}):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:B+`
|
|
128
|
-
`}}),o.jsx("textarea",{ref:p,className:"af-body-prompt-textarea "+i,rows:s,value:e,disabled:n,placeholder:r,spellCheck:!1,"aria-invalid":C,"aria-describedby":C?u:void 0,onChange:E=>{t(E.target.value),b(E.target.selectionStart??E.target.value.length)},onSelect:E=>{const D=E.target;D instanceof HTMLTextAreaElement&&b(D.selectionStart??0)},onClick:E=>{const D=E.target;D instanceof HTMLTextAreaElement&&b(D.selectionStart??0)},onKeyUp:E=>{const D=E.target;D instanceof HTMLTextAreaElement&&b(D.selectionStart??D.value.length)},onKeyDown:M,onPaste:E=>{const D=lT(E);D.length!==0&&(E.preventDefault(),T(D).catch(()=>{}))},onDragOver:E=>{Um(E).length>0&&E.preventDefault()},onDrop:E=>{const D=Um(E);D.length!==0&&(E.preventDefault(),T(D).catch(()=>{}))},onScroll:W})]}),F&&z.length>0&&k?Mr.createPortal(o.jsx("ul",{className:"af-body-ph-menu af-body-ph-menu--pop af-composer-mention-menu",role:"listbox","aria-label":f("flow:nodeProps.placeholderSlots"),style:{position:"fixed",top:k.top,left:k.left,right:"auto",bottom:"auto",margin:0,zIndex:2e4},children:z.map((E,D)=>o.jsx("li",{role:"option","aria-selected":D===v,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(D===v?" af-composer-mention-item--active":""),onMouseDown:_=>_.preventDefault(),onMouseEnter:()=>y(D),onClick:()=>O(E.insert),children:[o.jsx("span",{className:"af-composer-mention-id",children:`\${${E.insert}}`}),E.subtitle?o.jsx("span",{className:"af-composer-mention-sub",children:E.subtitle}):null]})},`${E.section}-${E.insert}`))}),document.body):null,C?o.jsx("p",{id:u,className:"af-body-ph-issues",role:"status",children:A.map(E=>E.message).join(" · ")}):null]})}const vT=/^[a-zA-Z_][a-zA-Z0-9_-]*$/;function xh(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function Nj({kind:e,label:t,slots:n,onSlotsChange:r,disabled:s,requiredReadonly:i=!0}){const{t:a}=kn(),l=()=>r([...n,{type:"text",name:"",default:"",required:!1,showOnNode:!1}]),c=u=>r(n.filter((p,m)=>m!==u)),d=(u,p,m)=>{const g=n.map((b,v)=>{if(v!==u)return b;const y={...b,[p]:m};return p==="required"&&m===!0&&(y.showOnNode=!0),y});r(g)},f=e==="input"?"input":"output";return o.jsxs("div",{className:"af-node-props-field af-node-props-field--io",children:[o.jsxs("div",{className:"af-node-props-io-head",children:[o.jsx("span",{className:"af-node-props-label",children:t}),o.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-io-add",onClick:l,disabled:s,"aria-label":a("flow:nodeProps.addPinAriaLabel",{label:t}),children:a("flow:nodeProps.addPin")})]}),o.jsx("p",{className:"af-node-props-io-hint",children:a("flow:nodeProps.handleHint",{prefix:f})}),n.length===0?o.jsx("p",{className:"af-node-props-io-empty",children:a(e==="input"?"flow:nodeProps.noInputPins":"flow:nodeProps.noOutputPins")}):null,n.length>0?o.jsxs("div",{className:"af-node-props-io-table",role:"group","aria-label":t,children:[o.jsxs("div",{className:"af-node-props-io-table-head","aria-hidden":!0,children:[o.jsx("span",{children:a("flow:nodeProps.handle")}),o.jsx("span",{children:a("flow:nodeProps.type")}),o.jsx("span",{children:a("flow:nodeProps.name")}),o.jsx("span",{children:a("flow:nodeProps.defaultValue")}),o.jsx("span",{children:a("flow:nodeProps.required")}),o.jsx("span",{children:a("flow:nodeProps.showOnNode")}),o.jsx("span",{})]}),n.map((u,p)=>o.jsxs("div",{className:"af-node-props-io-row",children:[o.jsxs("span",{className:"af-node-props-io-handle",title:`${f}-${p}`,children:[f,"-",p]}),o.jsx("select",{className:"af-node-props-input af-node-props-io-cell",value:u.type,onChange:m=>d(p,"type",m.target.value),disabled:s,"aria-label":a("flow:nodeProps.pinTypeAriaLabel",{label:t,index:p}),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:u.name,onChange:m=>d(p,"name",m.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinNameAriaLabel",{label:t,index:p})}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:u.default,onChange:m=>d(p,"default",m.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinDefaultAriaLabel",{label:t,index:p})}),o.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.requiredHint"),children:o.jsx("input",{type:"checkbox",checked:!!u.required,onChange:m=>{i||d(p,"required",m.target.checked)},disabled:s||i,"aria-label":a("flow:nodeProps.pinRequiredAriaLabel",{label:t,index:p})})}),o.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.showOnNodeHint"),children:o.jsx("input",{type:"checkbox",checked:u.showOnNode!==!1,onChange:m=>d(p,"showOnNode",m.target.checked),disabled:s,"aria-label":a("flow:nodeProps.pinShowOnNodeAriaLabel",{label:t,index:p})})}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-io-remove",onClick:()=>c(p),disabled:s,"aria-label":a("flow:nodeProps.deletePinAriaLabel",{label:t,index:p}),title:a("flow:nodeProps.deletePin"),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},`${f}-${p}`))]}):null]})}function kT({draft:e,setDraft:t,definitionId:n,systemPromptReadonly:r,modelLists:s,disabled:i,onIdBlur:a,onClose:l,onPublishToMarketplace:c,allowEditRequiredPins:d=!1,error:f,ioSlots:u}){const{t:p}=kn(),[m,g]=h.useState(!1),[b,v]=h.useState(!1),[y,k]=h.useState({status:"idle",message:""}),w=h.useCallback(O=>{t(W=>W&&{...W,...O})},[t]),{cursorList:j,opencodeList:A,claudeCodeList:C,currentNotInLists:$}=h.useMemo(()=>{const O=Array.isArray(s==null?void 0:s.cursor)?s.cursor:[],W=Array.isArray(s==null?void 0:s.opencode)?s.opencode:[],M=Array.isArray(s==null?void 0:s.claudeCode)?s.claudeCode:[],T=new Set([...O,...W,...M].map(xh)),E=((e==null?void 0:e.model)??"").trim(),D=E.startsWith("cursor:")?E.slice(7):E.startsWith("opencode:")?E.slice(9):E.startsWith("claude-code:")?E.slice(12):E,_=E&&!T.has(D)?E:"";return{cursorList:O,opencodeList:W,claudeCodeList:M,currentNotInLists:_}},[s,e==null?void 0:e.model]);if(!e)return null;const B=String(e.script??""),F=n==="tool_nodejs"||B.trim()!=="",z=typeof c=="function"&&!i&&(e==null?void 0:e.newId),L=async()=>{if(z){k({status:"running",message:p("flow:nodeProps.publishRunning")});try{const O=await c(e,n);k({status:"success",message:O!=null&&O.definitionId?p("flow:nodeProps.publishSuccessWithId",{id:O.definitionId}):p("flow:nodeProps.publishSuccess")})}catch(O){k({status:"error",message:String((O==null?void 0:O.message)||O)})}}};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-pipeline-drawer-head af-node-props-head",children:[o.jsx("h2",{className:"af-pipeline-drawer-title",children:p("flow:nodeProps.title")}),o.jsxs("div",{className:"af-node-props-head-actions",children:[o.jsxs("button",{type:"button",className:"af-btn-ghost af-node-props-market-btn",onClick:L,disabled:!z||y.status==="running",title:p("flow:nodeProps.publishToMarketplaceHint"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"inventory_2"}),y.status==="running"?p("flow:nodeProps.publishing"):p("flow:nodeProps.publishToMarketplace")]}),o.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-close-secondary",onClick:l,children:p("common:common.close")})]})]}),o.jsxs("div",{className:"af-pipeline-drawer-body af-node-props-body",children:[f?o.jsx("p",{className:"af-err af-node-props-err",children:f}):null,y.message?o.jsx("p",{className:`af-node-props-market-status af-node-props-market-status--${y.status}`,children:y.message}):null,o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:p("flow:node.nodeType")}),o.jsx("div",{className:"af-pipeline-drawer-readonly af-node-props-readonly-mono",children:n})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:nodeProps.instanceId"),o.jsx("span",{className:"af-node-props-hint",children:p("flow:node.displayNameHint")})]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.newId,onChange:O=>w({newId:O.target.value}),onBlur:a,disabled:i,spellCheck:!1,autoComplete:"off","aria-label":p("flow:nodeProps.instanceId")})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.displayName"),"(LABEL)"]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.label,onChange:O=>w({label:O.target.value}),disabled:i,spellCheck:!1})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.role"),"(ROLE)"]}),o.jsx("select",{className:"af-node-props-select",value:ol.includes(e.role)?e.role:p("flow:roles.normal"),onChange:O=>w({role:O.target.value}),disabled:i,children:ol.map(O=>o.jsx("option",{value:O,children:O},O))})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.model"),"(MODEL)"]}),o.jsx("span",{className:"af-node-props-sublabel",children:p("flow:node.modelHint")}),o.jsxs("select",{className:"af-node-props-select",value:(()=>{const O=(e.model||"").trim();return O?$||O:""})(),onChange:O=>w({model:O.target.value}),disabled:i,"aria-label":p("flow:nodeProps.modelAriaLabel"),children:[o.jsx("option",{value:"",children:p("flow:node.defaultModel")}),$?o.jsxs("option",{value:$,children:[$,p("flow:nodeProps.yamlValueNotInList")]}):null,j.length>0?o.jsx("optgroup",{label:"Cursor",children:j.map(O=>o.jsx("option",{value:xh(O),children:O},`c-${O}`))}):null,A.length>0?o.jsx("optgroup",{label:"OpenCode",children:A.map(O=>o.jsx("option",{value:xh(O),children:O},`o-${O}`))}):null,C.length>0?o.jsx("optgroup",{label:"Claude Code",children:C.map(O=>o.jsx("option",{value:`claude-code:${xh(O)}`,children:O},`cc-${O}`))}):null]})]}),o.jsx(Nj,{kind:"input",label:p("flow:nodeProps.inputPins"),slots:Array.isArray(e.inputs)?e.inputs:[],onSlotsChange:O=>w({inputs:O}),disabled:i,requiredReadonly:!d}),o.jsx(Nj,{kind:"output",label:p("flow:nodeProps.outputPins"),slots:Array.isArray(e.outputs)?e.outputs:[],onSlotsChange:O=>w({outputs:O}),disabled:i,requiredReadonly:!d}),F?o.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[o.jsxs("div",{className:"af-node-props-prompt-head",children:[o.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.directCommand"),"(script)",o.jsx("span",{className:"af-node-props-hint",children:p("flow:node.scriptHint")})]}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>v(!0),"aria-label":p("flow:nodeProps.expandEditScript"),title:p("flow:nodeProps.expand"),disabled:i,children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(yh,{value:B,onChange:O=>w({script:O}),disabled:i,placeholder:p("flow:nodeProps.scriptPlaceholder"),rows:6,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea af-node-props-script-textarea",ioSlots:u,variant:"drawer"})]}):null,o.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[o.jsxs("div",{className:"af-node-props-prompt-head",children:[o.jsx("span",{className:"af-node-props-label",children:p("flow:node.userPrompt")}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>g(!0),"aria-label":p("flow:nodeProps.expandEdit"),title:p("flow:nodeProps.expand"),disabled:i,children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(yh,{value:e.body,onChange:O=>w({body:O}),images:e.images,onImagesChange:O=>w({images:O}),disabled:i,placeholder:p("flow:nodeProps.bodyPlaceholder"),rows:8,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea",ioSlots:u,variant:"drawer"})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:p("flow:node.systemDescription")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea af-node-props-system-readonly",rows:4,readOnly:!0,value:r||p("flow:nodeProps.noDescription"),spellCheck:!1})]})]}),b?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":p("flow:nodeProps.editScript"),onMouseDown:O=>{O.target===O.currentTarget&&v(!1)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:p("flow:node.directCommand")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>v(!1),"aria-label":p("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx(yh,{value:B,onChange:O=>w({script:O}),disabled:i,placeholder:p("flow:nodeProps.scriptPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:u,variant:"expand"})]})}):null,m?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":p("flow:nodeProps.editUserPrompt"),onMouseDown:O=>{O.target===O.currentTarget&&g(!1)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:p("flow:node.body")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>g(!1),"aria-label":p("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx(yh,{value:e.body,onChange:O=>w({body:O}),images:e.images,onImagesChange:O=>w({images:O}),disabled:i,placeholder:p("flow:nodeProps.bodyPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:u,variant:"expand"})]})}):null]})}function u0(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 TK(e){const t=u0(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 ST(e){try{return JSON.stringify(JSON.parse(e.trim()),null,2)}catch{return e}}function jj({text:e}){const{t}=kn(),n=e||"";return n.trim()?o.jsx("div",{className:"af-run-ctx-md",children:o.jsx(Uu,{children:n})}):o.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.empty")})}function Cj({o:e}){var r;const{t}=kn(),n=u0(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:ST(e.content||"")});if(n==="markdown"){const s=e.content||"";return s.trim()?o.jsx("div",{className:"af-run-ctx-md",children:o.jsx(Uu,{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 Ej(e){return TK(e)}function _j(e){var r;if(!e)return null;const t=u0(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"?ST(String(n)):String(n)}function Pj({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 Aj=2e4,NT="af:run-node-ctx-width";function Yh(){return typeof window>"u"?416:Math.min(26*16,window.innerWidth-32)}function Ha(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):Ha(Yh())}function RK(){try{const e=localStorage.getItem(NT);if(e==null)return Ha(Yh());const t=parseInt(e,10);return Number.isFinite(t)?Ha(t):Ha(Yh())}catch{return Ha(Yh())}}async function Ij(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 LK(e,t){const n=`flow:runContext.${t}`,r=e(n);return r!==n?r:t}function OK({instanceId:e,flowId:t,runId:n,nodeStatus:r,onClose:s}){const{t:i}=kn(),[a,l]=h.useState(()=>typeof window<"u"&&window.matchMedia("(max-width: 960px)").matches),[c,d]=h.useState(RK),f=h.useRef({active:!1,pointerId:-1,startX:0,startW:416}),[u,p]=h.useState(!0),[m,g]=h.useState(""),[b,v]=h.useState([]),[y,k]=h.useState(null),[w,j]=h.useState(null),A=h.useRef(null),C=h.useRef(null),$=h.useRef(0),B=h.useRef(0);h.useLayoutEffect(()=>{const _=window.matchMedia("(max-width: 960px)"),R=()=>l(_.matches);return _.addEventListener("change",R),()=>_.removeEventListener("change",R)},[]),h.useEffect(()=>{function _(){d(R=>Ha(R))}return window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)},[]);const F=h.useCallback(()=>{d(_=>{const R=Ha(_);try{localStorage.setItem(NT,String(R))}catch{}return R})},[]),z=h.useCallback(_=>{if(a||_.button!==0)return;_.preventDefault();const R=_.currentTarget;f.current={active:!0,pointerId:_.pointerId,startX:_.clientX,startW:c},R.setPointerCapture(_.pointerId)},[a,c]),L=h.useCallback(_=>{const R=f.current;if(!R.active||_.pointerId!==R.pointerId)return;const P=R.startX-_.clientX;d(Ha(R.startW+P))},[]),O=h.useCallback(_=>{const R=f.current;if(!(!R.active||_.pointerId!==R.pointerId)){R.active=!1;try{_.currentTarget.releasePointerCapture(_.pointerId)}catch{}F()}},[F]),W=h.useCallback(()=>{const _=f.current;_.active&&(_.active=!1,F())},[F]),M=h.useCallback(_=>{const R=Array.isArray(_)?_:[];v(R),k(P=>P&&R.some(G=>G.execId===P)?P:R.length>0?R[R.length-1].execId:null)},[]),T=h.useCallback(()=>{if(!e||!t)return;const _=++$.current,R=new AbortController,P=window.setTimeout(()=>R.abort(),Aj);(async()=>{try{const G=await Ij(t,e,n,R.signal);if(_!==$.current)return;M(Array.isArray(G.rounds)?G.rounds:[])}catch{}finally{window.clearTimeout(P)}})()},[e,t,n,M]);h.useEffect(()=>{if(!e||!t){p(!1),g(""),v([]);return}const _=++B.current;p(!0),g(""),v([]),k(null);const R=new AbortController,P=window.setTimeout(()=>R.abort(),Aj);return(async()=>{try{const G=await Ij(t,e,n,R.signal);if(_!==B.current)return;M(Array.isArray(G.rounds)?G.rounds:[])}catch(G){if(_!==B.current)return;const Z=(G==null?void 0:G.name)==="AbortError"?"requestTimeout":G.message||String(G);g(Z)}finally{window.clearTimeout(P),_===B.current&&p(!1)}})(),()=>{R.abort(),B.current++,$.current++}},[e,t,n,M]),h.useEffect(()=>{r&&T()},[r,T]),h.useEffect(()=>{clearInterval(C.current);const _=b.length>0?b[b.length-1]:null;return(r==="running"&&b.length===0||!!(_&&_.status==="running"))&&e&&t&&(C.current=setInterval(()=>T(),2e3)),()=>clearInterval(C.current)},[b,e,t,n,r,T]),h.useEffect(()=>{A.current&&(A.current.scrollTop=0)},[y]);const E=b.find(_=>_.execId===y),D=a?void 0:{width:`${c}px`};return o.jsxs("aside",{className:"af-run-ctx-panel",style:D,"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:z,onPointerMove:L,onPointerUp:O,onPointerCancel:O,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"})})]}),u&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i("common:common.loading")}),m&&o.jsx("div",{className:"af-run-ctx-error",children:LK(i,m)}),!u&&!m&&b.length===0&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i(r==="running"?"flow:runContext.executingNoArtifacts":"flow:runContext.noData")}),b.length>0&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-run-ctx-rounds af-run-ctx-rounds--select af-run-ctx-round--"+$K((E==null?void 0:E.status)||""),children:[o.jsx("span",{className:"af-run-ctx-round-dot","aria-hidden":!0}),o.jsx("select",{className:"af-run-ctx-round-select",value:String(y??""),onChange:_=>{const R=_.target.value;k(R==="latest"?"latest":Number(R))},children:[...b].reverse().map(_=>{const R=_.execId==="latest"?i("flow:runContext.latest"):`#${_.execId}`,P=DK(i,_.status),G=_.finishedAt?` · ${MK(_.finishedAt)}`:"";return o.jsx("option",{value:String(_.execId),children:`${R} · ${P}${G}`},_.execId)})})]}),E&&o.jsxs("div",{className:"af-run-ctx-body",ref:A,children:[E.inputs&&E.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"]}),E.inputs.map((_,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:_.slot})}),o.jsx("pre",{className:"af-run-ctx-slot-text",children:_.value})]},`${_.slot}-${R}`))]}),E.prompt!=null&&o.jsxs("section",{className:"af-run-ctx-section",children:[o.jsxs("h3",{className:"af-run-ctx-section-title",children:[o.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"description"}),"Prompt",o.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-section-expand",onClick:()=>j("prompt"),title:i("flow:nodeProps.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(jj,{text:E.prompt})]}),E.outputs&&E.outputs.length>0&&o.jsxs("section",{className:"af-run-ctx-section",children:[o.jsxs("h3",{className:"af-run-ctx-section-title",children:[o.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"output"}),"Outputs",o.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-section-expand",onClick:()=>j("output"),title:i("flow:nodeProps.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),E.outputs.map((_,R)=>{const P=Ej(_),G=_j(_);return o.jsxs("div",{className:"af-run-ctx-output-slot",children:[o.jsxs("div",{className:"af-run-ctx-slot-head",children:[o.jsx("div",{className:"af-run-ctx-slot-name",children:_.slot}),P?o.jsx("span",{className:"af-run-ctx-format-badge",title:i("flow:runContext.detectedContentType"),children:P}):null,o.jsx(Pj,{text:G,title:i("common:common.copy"),copiedLabel:i("common:common.copied")})]}),o.jsx(Cj,{o:_})]},`${_.slot}-${R}`)})]}),!E.prompt&&(!E.outputs||E.outputs.length===0)&&o.jsx("div",{className:"af-run-ctx-placeholder",children:i("flow:runContext.roundNoContent")})]})]})]}),w&&E&&o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true",onClick:_=>{_.target===_.currentTarget&&j(null)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:w==="prompt"?"Prompt":"Outputs"}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>j(null),"aria-label":i("common:common.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-node-props-expand-body af-run-ctx-expand-body",children:[w==="prompt"&&E.prompt!=null&&o.jsx(jj,{text:E.prompt}),w==="output"&&E.outputs&&E.outputs.map((_,R)=>{const P=Ej(_),G=_j(_);return o.jsxs("div",{className:"af-run-ctx-output-slot",style:{marginBottom:"1rem"},children:[o.jsxs("div",{className:"af-run-ctx-slot-head",children:[o.jsx("div",{className:"af-run-ctx-slot-name",children:_.slot}),P?o.jsx("span",{className:"af-run-ctx-format-badge",children:P}):null,o.jsx(Pj,{text:G,title:i("common:common.copy"),copiedLabel:i("common:common.copied")})]}),o.jsx(Cj,{o:_})]},`${_.slot}-${R}`)})]})]})})]})}function MK(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 $K(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 DK(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 FK({flowId:e,flowSource:t,flowArchived:n,provideNodes:r,edges:s,nodes:i,onCliInputsChange:a,onBackToEdit:l}){const{t:c}=kn(),[d,f]=h.useState({}),[u,p]=h.useState(null),[m,g]=h.useState({}),[b,v]=h.useState(!0),[y,k]=h.useState(!1),[w,j]=h.useState(""),[A,C]=h.useState(!1),[$,B]=h.useState(null),F=h.useRef(null),z=h.useRef(!0),L=h.useRef({});h.useMemo(()=>{var P,G,Z;const R={};for(const V of r){const se=(Z=(G=(P=V.data)==null?void 0:P.outputs)==null?void 0:G[0])==null?void 0:Z.default;se!=null&&se!==""&&(R[V.id]=String(se))}return L.current=R,R},[r]);const O=h.useMemo(()=>{var P;const R={};for(const G of i){if(!((P=G.data)!=null&&P.inputs))continue;const Z=G.data.inputs;for(let V=0;V<Z.length;V++){const se=Z[V];if(!(se!=null&&se.name))continue;const ue=s.find(ge=>ge.target===G.id&&ge.targetHandle===`input-${V}`);if(!(ue!=null&&ue.source))continue;r.find(ge=>ge.id===ue.source)&&(R[ue.source]=se.name)}}return R},[i,s,r]);h.useEffect(()=>(z.current=!0,()=>{z.current=!1}),[]),h.useEffect(()=>{if(!e){v(!1);return}v(!0);const R=new URLSearchParams({flowId:e,flowSource:t||"user"});n&&R.set("archived","1"),fetch(`/api/flow/run-config?${R.toString()}`).then(P=>{if(!P.ok)throw new Error(`HTTP ${P.status}`);return P.json()}).then(P=>{var Z;if(!z.current)return;f(P.presets||{}),p(P.activePreset||null);const G=P.activePreset&&((Z=P.presets)!=null&&Z[P.activePreset])?P.presets[P.activePreset]:{};g({...L.current,...G}),v(!1)}).catch(()=>{z.current&&(g(L.current),v(!1))})},[e,t,n]),h.useEffect(()=>{var P;if(!a)return;const R={};for(const[G,Z]of Object.entries(m)){const V=O[G];if(!V)continue;const se=r.find(pe=>pe.id===G);if(!se)continue;(((P=se.data)==null?void 0:P.definitionId)||"").startsWith("provide_file")?R[V]={type:"file",path:Z}:R[V]={type:"str",value:Z}}a(R)},[m,O,r,a]);const W=h.useCallback((R,P)=>{g(G=>({...G,[R]:P}))},[]),M=h.useCallback(R=>{R!==u&&(p(R),R&&d[R]?g({...L.current,...d[R]}):g(L.current))},[u,d]),T=h.useCallback(async()=>{if(w.trim()){k(!0);try{const R={...d,[w.trim()]:m},P={flowId:e,flowSource:t,archived:n,presets:R,activePreset:w.trim()};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)})).ok&&(f(R),p(w.trim()),j(""),C(!1))}finally{k(!1)}}},[e,t,n,d,m,w]),E=h.useCallback(async()=>{if(u){k(!0);try{const R={...d};delete R[u];const P=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:P})})).ok&&(f(R),p(P),P&&R[P]?g({...L.current,...R[P]}):g(L.current))}finally{k(!1)}}},[e,t,n,d,u]),D=h.useCallback(async()=>{if(u){k(!0);try{const R={...d,[u]: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:u})})).ok&&f(R)}finally{k(!1)}}},[e,t,n,d,u,m]),_=Object.keys(d);return _.length>0,b?o.jsx("aside",{className:"af-run-config-panel",children:o.jsx("div",{className:"af-run-config-loading",children:c("common.loading")})}):o.jsxs("aside",{className:"af-run-config-panel",children:[o.jsxs("div",{className:"af-run-config-preset",children:[o.jsx("label",{className:"af-run-config-preset-label",children:c("flow:runConfig.preset")}),o.jsxs("div",{className:"af-run-config-preset-row",children:[o.jsxs("select",{className:"af-run-config-preset-select",value:u||"",onChange:R=>M(R.target.value||null),disabled:y,children:[o.jsx("option",{value:"",children:c("flow:runConfig.default")}),_.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:y,title:c("flow:runConfig.newPreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),u&&o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--save",onClick:D,disabled:y,title:c("flow:runConfig.savePreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"})}),u&&o.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--delete",onClick:E,disabled:y,title:c("flow:runConfig.deletePreset"),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"})})]})]}),A&&o.jsxs("div",{className:"af-run-config-save-dialog",children:[o.jsx("input",{type:"text",className:"af-run-config-save-input",placeholder:c("flow:runConfig.presetNamePlaceholder"),value:w,onChange:R=>j(R.target.value),disabled:y}),o.jsxs("div",{className:"af-run-config-save-actions",children:[o.jsx("button",{type:"button",className:"af-btn-primary",onClick:T,disabled:y||!w.trim(),children:c(y?"common.saving":"common.save")}),o.jsx("button",{type:"button",className:"af-btn-outline",onClick:()=>{C(!1),j("")},disabled:y,children:c("common.cancel")})]})]}),o.jsxs("div",{className:"af-run-config-inputs",children:[o.jsx("div",{className:"af-run-config-inputs-header",children:c("flow:runConfig.inputParams")}),r.length===0?o.jsx("div",{className:"af-run-config-empty",children:c("flow:runConfig.noProvideNodes")}):o.jsx("div",{className:"af-run-config-input-list",children:r.map(R=>{var ge,ae;const P=((ge=R.data)==null?void 0:ge.definitionId)||"",G=P.startsWith("provide_file"),Z=P==="provide_bool",V=((ae=R.data)==null?void 0:ae.label)||R.id,se=R.id,ue=m[se]||"",pe=["true","1","yes","on"].includes(String(ue).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"+(G?" af-run-config-input-icon--file":""),"aria-hidden":!0,children:G?"description":Z?"toggle_on":"text_fields"}),o.jsx("span",{className:"af-run-config-input-label",children:V}),Z?null:o.jsx("button",{type:"button",className:"af-run-config-input-expand",onClick:()=>B({instanceId:se,label:V,content:ue}),"aria-label":c("flow:runConfig.expandInput"),title:c("flow:runConfig.expandInput"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx("div",{className:"af-run-config-input-id",children:se}),Z?o.jsx("button",{type:"button",className:"af-run-config-bool-toggle"+(pe?" af-run-config-bool-toggle--true":""),onClick:()=>W(se,pe?"false":"true"),"aria-pressed":pe,children:pe?"true":"false"}):o.jsx("input",{type:"text",className:"af-run-config-input-field",value:ue,onChange:be=>W(se,be.target.value),placeholder:c(G?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},se)})})]}),$&&Mr.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:$.label}),o.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>B(null),"aria-label":c("common:close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("div",{className:"af-provide-edit-modal__body",children:o.jsx("textarea",{ref:F,className:"af-provide-edit-modal__textarea",defaultValue:$.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:()=>{!$||!F.current||(W($.instanceId,F.current.value),B(null))},children:[o.jsx("span",{className:"material-symbols-outlined",children:"save"}),c("flow:provideEdit.save")]}),o.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn",onClick:()=>B(null),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),c("flow:provideEdit.cancel")]})]})]})}),document.body)]})}const jT={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"]},zK={"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 BK(e){return!e||e<1024?`${e||0} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function HK(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 WK(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 Tj(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(jT))if(r.includes(e))return n;return"other"}function VK({event:e,defaultExpanded:t}){const[n,r]=h.useState(!!t),s=zK[e.tag]||"#a8a8a8",i=e.payload,a=i&&typeof i=="object",l=a?typeof i.text=="string"?i.text:"":String(i||""),c=a?i.meta:null,d=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 g=i[m];return g==null?`${m}:null`:typeof g=="object"?`${m}:{…}`:`${m}:${String(g).slice(0,30)}`}).join(" "):"",[i,l,a]),f=h.useCallback(u=>{u.stopPropagation();const p=a?JSON.stringify(i,null,2):String(i);try{navigator.clipboard.writeText(p)}catch{}},[i,a]);return o.jsxs("div",{style:{borderLeft:`3px solid ${s}`,background:n?"#1c1b1b":"#131313",marginBottom:4,borderRadius:4,cursor:"pointer",transition:"background 120ms"},onClick:()=>r(u=>!u),children:[o.jsxs("div",{style:{padding:"6px 10px",display:"flex",alignItems:"center",gap:10,fontSize:12},children:[o.jsx("span",{style:{color:"#9a9a9a",fontFamily:"monospace",flexShrink:0},children:HK(e.ts)}),o.jsx("span",{style:{color:s,fontWeight:600,fontFamily:"monospace",flexShrink:0,padding:"1px 6px",background:"rgba(255,255,255,0.04)",borderRadius:3},children:e.tag}),o.jsx("span",{style:{color:"#c5c2c1",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"monospace"},children:d}),n&&o.jsx("button",{type:"button",onClick:f,style:{background:"rgba(124,77,255,0.15)",color:"#e8deff",border:"none",borderRadius:3,padding:"2px 8px",fontSize:11,cursor:"pointer"},children:"Copy"})]}),n&&o.jsxs("div",{style:{padding:"0 10px 10px 10px",borderTop:"1px solid rgba(255,255,255,0.04)"},children:[c&&Object.keys(c).length>0&&o.jsx("div",{style:{marginTop:8,padding:8,background:"#0e0e0e",borderRadius:4,fontSize:11,fontFamily:"monospace",color:"#9ecaff",whiteSpace:"pre-wrap",wordBreak:"break-all"},children:JSON.stringify(c,null,2)}),l?o.jsx("pre",{style:{marginTop:8,padding:10,background:"#0e0e0e",borderRadius:4,fontSize:12,color:"#e5e2e1",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:600,overflowY:"auto",margin:"8px 0 0 0",fontFamily:"ui-monospace, SF Mono, Menlo, monospace"},children:l}):a?o.jsx("pre",{style:{marginTop:8,padding:10,background:"#0e0e0e",borderRadius:4,fontSize:12,color:"#e5e2e1",whiteSpace:"pre-wrap",wordBreak:"break-all",maxHeight:400,overflowY:"auto",margin:"8px 0 0 0",fontFamily:"ui-monospace, SF Mono, Menlo, monospace"},children:JSON.stringify(i,null,2)}):null]})]})}function UK({open:e,onClose:t,flowId:n}){var B;const[r,s]=h.useState([]),[i,a]=h.useState(!1),[l,c]=h.useState(null),[d,f]=h.useState(null),[u,p]=h.useState(!1),[m,g]=h.useState(!0),[b,v]=h.useState({ai:!0,flow:!0,step:!0,output:!0,error:!0}),[y,k]=h.useState(""),w=h.useRef(null),j=h.useCallback(async()=>{a(!0);try{const F=m&&n?`?flowId=${encodeURIComponent(n)}`:"",L=await(await fetch(`/api/composer-logs${F}`)).json();s(Array.isArray(L.sessions)?L.sessions:[])}catch{s([])}finally{a(!1)}},[n,m]),A=h.useCallback(async F=>{if(!F){f(null);return}p(!0);try{const L=await(await fetch(`/api/composer-logs/${encodeURIComponent(F)}`)).json();f(L)}catch{f(null)}finally{p(!1)}},[]);h.useEffect(()=>{e&&j()},[e,j]),h.useEffect(()=>{if(!(!e||!l))return A(l),w.current=setInterval(()=>A(l),2e3),()=>{w.current&&clearInterval(w.current),w.current=null}},[e,l,A]);const C=h.useMemo(()=>{const F=(d==null?void 0:d.events)||[],z=y.trim().toLowerCase();return F.filter(L=>{const O=Tj(L.tag,L.payload);return!b[O]&&O!=="other"?!1:z?[L.tag,JSON.stringify(L.payload||"")].join(" ").toLowerCase().includes(z):!0})},[d,b,y]),$=h.useMemo(()=>{const F=(d==null?void 0:d.events)||[],z={};for(const L of F){const O=Tj(L.tag,L.payload);z[O]=(z[O]||0)+1}return z},[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:F=>g(F.target.checked),disabled:!n}),"仅显示当前 flow"]}),o.jsx("button",{type:"button",onClick:j,style:{background:"rgba(124,77,255,0.15)",color:"#e8deff",border:"none",borderRadius:4,padding:"4px 10px",fontSize:12,cursor:"pointer"},children:"Refresh"}),o.jsx("span",{style:{flex:1}}),o.jsx("button",{type:"button",onClick:t,style:{background:"transparent",color:"#e5e2e1",border:"1px solid rgba(255,255,255,0.12)",borderRadius:4,padding:"4px 12px",fontSize:12,cursor:"pointer"},children:"Close"})]}),o.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden",minHeight:0},children:[o.jsxs("div",{style:{width:280,borderRight:"1px solid rgba(255,255,255,0.06)",overflowY:"auto",background:"#0e0e0e",flexShrink:0},children:[i&&o.jsx("div",{style:{padding:12,fontSize:12,color:"#9a9a9a"},children:"Loading…"}),!i&&r.length===0&&o.jsx("div",{style:{padding:12,fontSize:12,color:"#9a9a9a"},children:m&&n?"no sessions for this flow":"no sessions"}),r.map(F=>{const z=l===F.sessionId;return o.jsxs("div",{onClick:()=>c(F.sessionId),style:{padding:"10px 12px",borderBottom:"1px solid rgba(255,255,255,0.04)",cursor:"pointer",background:z?"rgba(124,77,255,0.18)":"transparent",borderLeft:z?"3px solid #7c4dff":"3px solid transparent"},children:[o.jsx("div",{style:{fontSize:12,fontWeight:600,color:"#e5e2e1"},children:WK(F.mtime)}),o.jsx("div",{style:{fontSize:11,color:"#9ecaff",marginTop:2,fontFamily:"monospace"},children:F.flowId||"(no flow)"}),F.promptPreview&&o.jsx("div",{style:{fontSize:11,color:"#9a9a9a",marginTop:4,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:F.promptPreview}),o.jsxs("div",{style:{fontSize:10,color:"#6a6a6a",marginTop:4},children:[BK(F.size)," · ",F.model||"default"]})]},F.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(jT).map(F=>o.jsxs("button",{type:"button",onClick:()=>v(z=>({...z,[F]:!z[F]})),style:{background:b[F]?"rgba(124,77,255,0.25)":"transparent",color:b[F]?"#e8deff":"#6a6a6a",border:`1px solid ${b[F]?"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:[F," ",$[F]!=null?`(${$[F]})`:""]},F)),o.jsx("input",{type:"text",placeholder:"search…",value:y,onChange:F=>k(F.target.value),style:{marginLeft:8,flex:1,minWidth:120,background:"#0e0e0e",border:"1px solid rgba(255,255,255,0.08)",borderRadius:4,color:"#e5e2e1",padding:"4px 8px",fontSize:12}})]}),o.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12,minHeight:0},children:[!l&&o.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20,textAlign:"center"},children:"Select a session on the left to view events"}),u&&!d&&o.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:"Loading…"}),d&&C.length===0&&o.jsxs("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:["No events match current filter (",((B=d.events)==null?void 0:B.length)||0," total)"]}),C.map((F,z)=>o.jsx(VK,{event:F,defaultExpanded:F.tag==="error"},`${F.ts}_${z}`))]})]})]})]}):null}const KK="0.1.50";function Rj(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 hx(e,t){return t==="running"?Rj(e):e==null||!Number.isFinite(e)||e<=0?"--":Rj(e)}const CT=h.createContext({modelLists:{cursor:[],opencode:[]},onModelChange:()=>{}});function qK(e){var k,w,j,A,C,$,B,F,z,L,O;const{setNodes:t}=hc(),n=Bv(),{modelLists:r,onModelChange:s}=h.useContext(CT),i=h.useRef(null),a=!!((k=e.data)!=null&&k.readOnly),l=(w=e.data)!=null&&w.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,c=((j=e.data)==null?void 0:j.definitionId)==="agent_subAgent"&&!((A=e.data)!=null&&A.isRunMode)&&!a,d=h.useCallback(W=>{const M=()=>n(W);window.requestAnimationFrame(M),window.setTimeout(M,80)},[n]),f=h.useCallback((W,M)=>{const T=Bj(M);T&&(t(E=>E.map(D=>{var P,G,Z,V,se,ue;if(D.id!==W)return D;const _=Number(((G=(P=D.data)==null?void 0:P.displaySize)==null?void 0:G.width)||D.width||((Z=D.measured)==null?void 0:Z.width)||0),R=Number(((se=(V=D.data)==null?void 0:V.displaySize)==null?void 0:se.height)||D.height||((ue=D.measured)==null?void 0:ue.height)||0);return Math.abs(_-T.width)<2&&Math.abs(R-T.height)<2?D:{...D,width:T.width,height:T.height,data:{...D.data,displaySize:T}}})),d(W))},[d,t]),u=h.useCallback(W=>{if(a)return;const M=i.current;if(!M)return;const T=M.getBoundingClientRect();f(W,{width:Math.max(T.width,M.scrollWidth),height:Math.max(T.height,M.scrollHeight)})},[f,a]),p=h.useCallback(W=>{var se,ue,pe,ge,ae,be;if(!c)return;W.preventDefault(),W.stopPropagation();const M=i.current,T=M==null?void 0:M.getBoundingClientRect(),E=Number(((ue=(se=e.data)==null?void 0:se.displaySize)==null?void 0:ue.width)||e.width||((pe=e.measured)==null?void 0:pe.width)||(T==null?void 0:T.width)||AT),D=Number(((ae=(ge=e.data)==null?void 0:ge.displaySize)==null?void 0:ae.height)||e.height||((be=e.measured)==null?void 0:be.height)||(T==null?void 0:T.height)||hb),_=W.clientX,R=W.clientY,P=e.id;let G=0;const Z=Pe=>{const we=Bj({width:E+Pe.clientX-_,height:D+Pe.clientY-R});we&&(window.cancelAnimationFrame(G),G=window.requestAnimationFrame(()=>f(P,we)))},V=()=>{window.cancelAnimationFrame(G),window.removeEventListener("pointermove",Z),window.removeEventListener("pointerup",V),window.removeEventListener("pointercancel",V),d(P)};window.addEventListener("pointermove",Z),window.addEventListener("pointerup",V,{once:!0}),window.addEventListener("pointercancel",V,{once:!0})},[f,($=(C=e.data)==null?void 0:C.displaySize)==null?void 0:$.height,(F=(B=e.data)==null?void 0:B.displaySize)==null?void 0:F.width,e.height,e.id,(z=e.measured)==null?void 0:z.height,(L=e.measured)==null?void 0:L.width,e.width,d,c]),m=h.useCallback(W=>{t(M=>M.filter(T=>T.id!==W))},[t]),g=h.useCallback(()=>{var E,D,_,R,P,G,Z,V;const W=((E=e.data)==null?void 0:E.definitionId)||"",M=((D=e.data)==null?void 0:D.label)||e.id,T=((P=(R=(_=e.data)==null?void 0:_.outputs)==null?void 0:R[0])==null?void 0:P.value)||((V=(Z=(G=e.data)==null?void 0:G.outputs)==null?void 0:Z[0])==null?void 0:V.default)||"";window.__provideEditContent={instanceId:e.id,label:M,definitionId:W,content:T},window.dispatchEvent(new CustomEvent("provide-expand"))},[e.id,e.data]),b=h.useCallback((W,M)=>{t(T=>T.map(E=>{var _;if(E.id!==W)return E;const D=Array.isArray((_=E.data)==null?void 0:_.outputs)&&E.data.outputs.length?E.data.outputs.map((R,P)=>P===0?{...R,default:M,value:M}:R):[{type:"bool",name:"value",default:M,value:M}];return{...E,data:{...E.data,body:"",outputs:D}}}))},[t]),v=h.useCallback((W,M)=>{t(T=>T.map(E=>E.id===W?{...E,data:{...E.data,body:M}}:E))},[t]),y=h.useCallback((W,M)=>{t(T=>T.map(E=>E.id===W?{...E,data:{...E.data,images:ws(M)}}:E))},[t]);return o.jsxs("div",{ref:i,className:"af-flow-node-shell"+(c?" af-flow-node-shell--resizable":""),style:l?{width:l.width,height:l.height}:void 0,children:[o.jsx(hT,{...e,data:{...e.data,onNodeContentResize:u},deleteNode:m,onProvideExpand:g,onProvideValueChange:b,onNodeBodyChange:v,onNodeImagesChange:y,modelLists:r,onModelChange:s}),c?o.jsx("span",{className:"af-flow-node-shell__resize-grip nodrag","aria-label":((O=e.data)==null?void 0:O.resizeLabel)||"Resize node",role:"separator",onPointerDown:p}):null]})}const YK={[lp]:qK},Dd=["CONTROL","TOOL","PROVIDE","AGENT"],GK=1200,Lj="af-flow-node--sync-flash",Oj="af-flow-edge--sync-flash";function Mj(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).includes(t)?n:`${n} ${t}`:t}function $j(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).filter(r=>r&&r!==t).join(" "):""}function d0(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 XK(e){const t=d0(e);return t==="CONTROL"?"control":t==="PROVIDE"?"provide":t==="TOOL"?"tool":"agent"}function wh(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 ET(e){return String((e==null?void 0:e.label)||"").trim()||String((e==null?void 0:e.id)||"").trim()}function _T(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function mx(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 Dj(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 Fj(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 JK(e){return e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function QK(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 PT(e,t,n,r,s){const i=XK(e),a={id:t,type:lp,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 Bf(a,r,s)}const AT=320,ZK=220,e7=1600,hb=104,t7=900;function zj(e,t,n){const r=Number(e);return!Number.isFinite(r)||r<=0?0:Math.min(n,Math.max(t,Math.round(r)))}function Bj(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:zj(t,ZK,e7)||AT,height:zj(n,hb,t7)||hb}}function n7(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 Hj(e,t){const n=String((e==null?void 0:e.source)||""),r=String((e==null?void 0:e.target)||"");if(!n||!r)return!1;const s=new Map(t.map(d=>[d.id,d])),i=s.get(n),a=s.get(r),l=$u(i,e.sourceHandle||"output-0","source"),c=$u(a,e.targetHandle||"input-0","target");return!l||!c?!1:Mu(l,c)}function r7(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=$u(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:pT(a)}:null}function s7(e,t,n){var a;const r=PT(e,`__candidate_${e.id}`,{x:0,y:0},{},t),s=n.handleType==="source"?"inputs":"outputs",i=Array.isArray((a=r.data)==null?void 0:a[s])?r.data[s]:[];for(let l=0;l<i.length;l+=1){const c=i[l];if(n.handleType==="source"?Mu(n.slot,c):Mu(c,n.slot))return{slot:c,slotIndex:l,hydrated:r}}return null}function i7(e,t){return t?e.map((n,r)=>{const s=s7(n,e,t);if(!s)return null;const i=d0(n);return{def:n,order:r,category:i,categoryRank:Dd.indexOf(i),slot:s.slot,slotIndex:s.slotIndex,displayLabel:ET(s.hydrated.data||n),description:_T(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 o7=/@([a-zA-Z_][a-zA-Z0-9_]*)/g;function a7(e){const t=new Set,n=[];let r;const s=new RegExp(o7.source,"g");for(;(r=s.exec(e))!==null;){const i=r[1];t.has(i)||(t.add(i),n.push(i))}return n}function Wj(e,t){const n=e.slice(0,t),r=n.lastIndexOf("@");if(r<0)return null;const s=n.slice(r+1);return/[\s\n]/.test(s)?null:{atIndex:r,query:s}}function Uo(e){const t=String(e||"").indexOf(" - ");return t>=0?e.slice(0,t).trim():String(e||"").trim()}function bh(e,t,n,r){const s=(e||"").trim();if(!s)return"";if(s.startsWith("opencode:")||s.startsWith("claude-code:"))return s;const i=Array.isArray(t)?t:[],a=Array.isArray(n)?n:[],l=Array.isArray(r)?r:[],c=i.map(Uo),d=a.map(Uo);return l.map(Uo).includes(s)&&!c.includes(s)&&!d.includes(s)?`claude-code:${s}`:d.includes(s)&&!c.includes(s)?`opencode:${s}`:s}function l7(e){if(e==null)return"";const t=String(e).trim();return t?t.length<=26?t:`${t.slice(0,12)}…${t.slice(-10)}`:""}function gx(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 c7({steps:e}){const{t}=kn();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:l7(s)}):null]}):null})]},n.index)})})}function u7(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 d7(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 f7(e,t){return e==="thinking"?t("flow:composer.thinking"):e==="result"?t("flow:composer.result"):e==="assistant"?t("flow:composer.reply"):e==="error"?t("flow:composer.error"):String(e)}function p7(e){return e==="thinking"?"af-composer-ai-block af-composer-ai-block--thinking":e==="result"?"af-composer-ai-block af-composer-ai-block--result":e==="assistant"?"af-composer-ai-block af-composer-ai-block--reply":e==="error"?"af-composer-ai-block af-composer-ai-block--error":"af-composer-ai-block af-composer-ai-block--reply"}function Vj({thread:e,liveSegments:t,running:n,className:r="",autoScroll:s=!0}){const{t:i}=kn(),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 c=a.current;requestAnimationFrame(()=>{c.scrollTop=c.scrollHeight})},[e,t,s]),o.jsxs("div",{ref:a,className:l,children:[e.map((c,d)=>c.type==="user"?o.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--user-msg",children:[o.jsx("div",{className:"af-composer-ai-block-label",children:i("flow:composer.yourQuestion")}),o.jsx("div",{className:"af-composer-ai-block-body",children:c.text})]},`composer-u-${d}-${c.text.slice(0,48)}`):o.jsx("div",{className:"af-composer-thread-assistant",children:o.jsx(Uj,{segments:c.segments,running:!1})},`composer-a-${d}`)),o.jsx("div",{className:"af-composer-thread-assistant",children:o.jsx(Uj,{segments:t,running:n})})]})}function Uj({segments:e,running:t=!1}){const{t:n}=kn(),r=e.filter(u=>u.kind==="assistant").map(u=>u.text).join(""),s=e.filter(u=>u.kind==="result").map(u=>u.text).join(""),i=u7(r,s),a=e.filter(u=>u.kind==="error").map(u=>u.text).join(`
|
|
131
|
-
`),l=e.filter(u=>u.kind!=="error"),c=i?l.filter(u=>u.kind!=="result"):l,d=d7(c),f=!!(d.length>0||a);return o.jsxs(o.Fragment,{children:[d.map((u,p)=>o.jsxs("section",{className:p7(u.kind),children:[o.jsx("div",{className:"af-composer-ai-block-label",children:f7(u.kind,n)}),o.jsx("div",{className:"af-composer-ai-block-body",children:u.text})]},`${u.kind}-${p}`)),t&&!f?o.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--reply af-composer-ai-block--pending",children:[o.jsx("div",{className:"af-composer-ai-block-label",children:n("flow:composer.reply")}),o.jsx("div",{className:"af-composer-ai-block-body",children:n("flow:composer.waiting")})]}):null,a?o.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--error",children:[o.jsx("div",{className:"af-composer-ai-block-label",children:n("flow:composer.error")}),o.jsx("div",{className:"af-composer-ai-block-body",children:a})]}):null]})}function h7({fitViewEpoch:e}){const{fitView:t}=hc(),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 m7({onReady:e}){const t=Bv();return h.useEffect(()=>(e(t),()=>e(null)),[e,t]),null}function Kj(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}function qj(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 Gh=1500,Yj=500,g7=262144,y7=2e3;function yx(e){return typeof e!="string"?"":e.length<=y7?e:`[log line truncated, ${e.length} chars]`}const x7=Gh;function w7(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:yx(s)}}catch{return{ts:n,type:"info",text:yx(s)}}return{ts:n,type:"log",text:yx(`[${r}] ${s}`)}}function Gj(e){if(!e)return[];const t=[],n=e.split(`
|
|
132
|
-
`);for(let r=n.length-1;r>=0&&t.length<x7;r--){const s=n[r];if(!s)continue;const i=w7(s);i&&t.push(i)}return t.reverse(),t}function b7(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 v7(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 k7({fitViewEpoch:e,canvasTool:t,nodes:n,edges:r,onNodesChange:s,onEdgesChange:i,onConnect:a,onConnectStart:l,onConnectEnd:c,isValidConnection:d,onNodesDelete:f,onNodeClick:u,onNodeDoubleClick:p,onEdgeClick:m,onFlowInit:g,onDrop:b,onDragOver:v,hideMinimapAndControls:y,bottomSlot:k}){const{t:w}=kn(),j=!s,A=j||t==="pan"?!0:[1,2],C=j?!1:t==="select",$="af-flow-canvas"+(j?" af-flow-canvas--run-mode":"")+(t==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select"),B=h.useCallback(()=>{},[]),F=h.useMemo(()=>{const z=new Map(n.map(T=>[T.id,T])),L=new Set(n.filter(T=>T.selected).map(T=>T.id)),O=L.size>0,W=(T,E)=>{const D=/^#([0-9a-f]{6})$/i.exec(T);if(!D)return T;const _=parseInt(D[1],16);return`rgba(${_>>16&255}, ${_>>8&255}, ${_&255}, ${E})`},M="#ff5169";return r.map(T=>{var we,_e,Ie,st;const E=z.get(T.source),D=z.get(T.target),_=/^output-(\d+)$/.exec(T.sourceHandle||""),R=/^input-(\d+)$/.exec(T.targetHandle||""),P=E&&_?(_e=(we=E.data)==null?void 0:we.outputs)==null?void 0:_e[parseInt(_[1],10)]:null,G=D&&R?(st=(Ie=D.data)==null?void 0:Ie.inputs)==null?void 0:st[parseInt(R[1],10)]:null,Z=P!=null&&P.type?Zn(P.type):null,V=G!=null&&G.type?Zn(G.type):null,se=Z&&V&&Z!==V,ue=O&&(L.has(T.source)||L.has(T.target)),pe=T.style||{};if(se){const ct=T.selected?.95:ue?.85:.78,et=W(M,ct);return{...T,className:((T.className||"")+" af-flow-edge--type-mismatch"+(ue?" af-flow-edge--adjacent":"")).trim(),style:{...pe,stroke:et,strokeWidth:ue?2.75:2.5,strokeDasharray:"6 4"},markerEnd:T.markerEnd&&typeof T.markerEnd=="object"?{...T.markerEnd,color:et}:{type:Ns.ArrowClosed,color:et}}}const ge=Z||V;if(!ge)return ue?{...T,className:((T.className||"")+" af-flow-edge--adjacent").trim(),style:{...pe,strokeWidth:2.5}}:T;const ae=ue||T.selected?.7:.38,be=W(ge,ae),Pe=ue?2.5:pe.strokeWidth??2;return{...T,className:((T.className||"")+(ue?" af-flow-edge--adjacent":"")).trim(),style:{...pe,stroke:be,strokeWidth:Pe},markerEnd:T.markerEnd&&typeof T.markerEnd=="object"?{...T.markerEnd,color:be}:{type:Ns.ArrowClosed,color:be}}})},[n,r]);return o.jsxs(zv,{className:$,nodes:n,edges:F,onNodesChange:s||B,onEdgesChange:i||B,onConnect:j?void 0:a,onConnectStart:j?void 0:l,onConnectEnd:j?void 0:c,isValidConnection:j?void 0:d,onNodesDelete:j?void 0:f,onNodeClick:u,onNodeDoubleClick:j?void 0:p,onEdgeClick:j?void 0:m,onInit:g,onDrop:j?void 0:b,onDragOver:j?void 0:v,nodeTypes:YK,selectionOnDrag:C,panOnDrag:A,nodesDraggable:!j,nodesConnectable:!j,elementsSelectable:!j,edgesFocusable:!j,panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,defaultEdgeOptions:{style:{stroke:"rgba(205, 189, 255, 0.45)",strokeWidth:2}},connectionLineStyle:{stroke:"rgba(205, 189, 255, 0.65)",strokeWidth:2},children:[o.jsx(Hv,{gap:20,size:1,color:"rgba(28, 27, 27, 0.9)"}),o.jsx(Lu,{position:"bottom-center",className:"af-flow-bottom-unified-panel"+(y?" af-flow-bottom-unified-panel--solo":""),children:o.jsxs("div",{className:"af-flow-bottom-unified-row"+(y?" af-flow-bottom-unified-row--solo":""),children:[y?null:o.jsx("div",{className:"af-flow-bottom-unified__side af-flow-bottom-unified__side--minimap",children:o.jsx(E4,{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:z=>{var O;const L=(((O=z.data)==null?void 0:O.schemaType)??"agent").toLowerCase();return L==="control"?"rgba(237, 108, 2, 0.85)":L==="provide"?"rgba(0, 228, 117, 0.35)":L==="tool"?"rgba(124, 77, 255, 0.75)":"rgba(158, 202, 255, 0.5)"}})}),o.jsx("div",{className:"af-flow-bottom-unified__center",children:k}),y?null:o.jsx("div",{className:"af-flow-bottom-unified__side af-flow-bottom-unified__side--zoom",children:o.jsx(h4,{position:"bottom-right",showInteractive:!1,className:"af-flow-bottom-controls"})})]})}),!y&&o.jsx(Lu,{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:z,color:L})=>o.jsxs("span",{className:"af-pin-legend__item",children:[o.jsx("span",{className:"af-pin-legend__dot",style:{background:L}}),o.jsx("span",{className:"af-pin-legend__label",children:z})]},z))}),o.jsx(h7,{fitViewEpoch:e}),!j&&n.length===0?o.jsxs("div",{className:"af-flow-empty-hint",children:[o.jsx("span",{className:"af-flow-empty-hint-icon material-symbols-outlined",children:"account_tree"}),o.jsx("p",{className:"af-flow-empty-hint-text",children:w("flow:emptyCanvas.composerHint")}),o.jsx("p",{className:"af-flow-empty-hint-sub",dangerouslySetInnerHTML:{__html:w("flow:emptyCanvas.composerSub")}})]}):null]})}function Xj(e){if(!window.location.pathname.startsWith("/flow"))return;if(!e){window.history.replaceState({},"","/flow");return}const t=new URLSearchParams({flowId:e.id,flowSource:e.source??"user"});e.archived&&t.set("flowArchived","1"),window.history.replaceState({},"","/flow?"+t.toString())}function S7(e){return e==="builtin"||e==="admin"?"workspace":e??"user"}function si(e){return e==="builtin"||e==="admin"}function $c(e,t){return t(e==="builtin"||e==="admin"?"flow:settings.builtin":e==="workspace"?"flow:palette.workspace":"flow:palette.userDir")}function N7(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 IT="af:run-console-height",sf=230,Cd={enabled:!1,cron:"",timezone:"Asia/Shanghai",preset:"",overlapPolicy:"skip",misfirePolicy:"skip",nextRunAt:null},vh={};function Xh(e){if(!Number.isFinite(e))return sf;const t=Math.max(240,Math.floor(window.innerHeight*.88));return Math.min(Math.max(Math.round(e),96),t)}function j7(){try{const e=localStorage.getItem(IT);if(e==null)return sf;const t=parseInt(e,10);return Number.isFinite(t)?Xh(t):sf}catch{return sf}}function C7(){var F0,z0;const{t:e,i18n:t}=kn(),{navigate:n,path:r}=No(),s=h.useRef(null),i=h.useRef(new Map),a=h.useCallback(x=>{s.current=typeof x=="function"?x:null},[]),[l,c]=h.useState([]),[d,f]=h.useState(""),[u,p]=h.useState(null),[m,g]=h.useState(0),[b,v]=h.useState(""),[y,k]=h.useState(""),[w,j]=h.useState(""),[A,C]=h.useState(""),[$,B]=h.useState(!1),[F,z]=h.useState(""),[L,O]=h.useState(!1),[W,M]=h.useState(""),[T,E]=h.useState(!1),[D,_]=h.useState(!1),[R,P]=h.useState(!1),[G,Z]=h.useState(null),[V,se]=h.useState(!1),[ue,pe]=h.useState(!1),ge=h.useRef(!1),[ae,be]=h.useState([]),[Pe,we]=h.useState(""),[_e,Ie]=h.useState("nodes"),st=h.useRef(null),[ct,et]=h.useState([]),[Et,Ue]=h.useState(!1),[St,tn]=h.useState(""),[gn,Tn]=h.useState(!1),[zt,Rn]=h.useState({name:"",id:"",description:""}),[Bn,le]=h.useState(!1),[fe,ze]=h.useState(""),[Ze,ot]=h.useState(""),Jt=h.useRef(null),[nn,Ln]=h.useState([]),[yn,ir]=h.useState(!1),[rn,Sn]=h.useState(""),[Zt,Nn]=h.useState(""),[xe,Re]=h.useState(null),[it,re]=h.useState(null),[Ce,Ge]=h.useState([]),[Ct,Ke]=h.useState(""),[jn,hi]=h.useState(!1),Eo=h.useCallback(x=>{Jt.current&&window.clearTimeout(Jt.current),ot(x),Jt.current=window.setTimeout(()=>{ot(""),Jt.current=null},3800)},[]),vr=h.useCallback(x=>{const N=String(x||"").trim();if(!N)return;const H=()=>{var q;return(q=s.current)==null?void 0:q.call(s,N)};window.requestAnimationFrame(H),window.setTimeout(H,80)},[]);h.useEffect(()=>()=>{Jt.current&&window.clearTimeout(Jt.current)},[]);const[kr,_o]=h.useState(!1),[or,qs]=h.useState({files:[]}),[Me,ca]=h.useState(!1),[mi,Yn]=h.useState(!0);h.useEffect(()=>{let x=!1;const N=()=>{fetch("/api/flows",{method:"HEAD"}).then(q=>{x||Yn(q.ok)}).catch(()=>{x||Yn(!1)})};N();const H=window.setInterval(N,5e3);return()=>{x=!0,window.clearInterval(H)}},[]),h.useEffect(()=>{let x=!1;return fetch("/api/dev-info").then(N=>N.json()).then(N=>{x||gi(!!(N!=null&&N.isDev))}).catch(()=>{}),()=>{x=!0}},[]),h.useEffect(()=>{u!=null&&u.id&&R_(u.id,u.source??"user","pipeline",!!u.archived)},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived]);const[Oe,Bt]=h.useState("edit"),[Sr,mt]=h.useState([]),Yi=h.useRef(0),[er,Hn]=h.useState(new Set),[Nr,lt]=h.useState({}),[Ht,qt]=h.useState(null),[On,Je]=h.useState(0),[ar,_s]=h.useState(!1),[jr,gi]=h.useState(!1),[Ps,Po]=h.useState(!1),[Gi,Ao]=h.useState(j7),Ys=h.useRef({active:!1,pointerId:-1,startY:0,startH:sf}),[cn,As]=h.useState(null),[Is,Ts]=h.useState(null),[Gs,K]=h.useState({}),me=h.useRef(Gs);h.useEffect(()=>{me.current=Gs},[Gs]);const[Te,Ae]=h.useState(!1),[Xe,Wt]=h.useState(!1),[Ot,tr]=h.useState({}),[Cr,Xs]=h.useState({}),[Io,Br]=h.useState(null),[lr,ua]=h.useState(Cd),[hl,Qu]=h.useState(!1),[nr,gc]=h.useState(!1),[Xi,To]=h.useState(""),[Ro,yc]=h.useState(""),[Yt,xc]=h.useState(vh),[Mn,Ji]=h.useState(null),yi=h.useRef(0),Js=h.useRef(null),da=h.useRef(null),ml=h.useRef(!0),Qi=h.useRef(!1),[cr,gl]=h.useState(null),[Lo,yl]=h.useState(null),[Hr,fa]=h.useState(!1),[xi,pa]=h.useState(""),[Zi,cs]=h.useState(!1),hp=h.useRef(null),[Er,xl]=h.useState(null),[eo,wl]=h.useState(!1),[Le,Qs]=h.useState(null),[bl,Zu]=h.useState(!1),[Gn,Oo]=h.useState(null),Cn=h.useRef(null),[us,vl]=h.useState(""),[wc,ha]=h.useState(0),[ma,ga]=h.useState(0),[ya,ed]=h.useState("pan"),[kl,xa]=h.useState(!1),[bc,Sl]=h.useState(!1),wa=h.useRef(null),vc=h.useRef(null),ba=h.useRef(null),[mp,gp]=h.useState(0),[gt,va]=h.useState(null),[yp,Nl]=h.useState(""),[xt,xp]=h.useState({cursor:[],opencode:[],claudeCode:[]}),[to,ds]=h.useState(""),[kc,Sc]=h.useState(""),[Wr,dt]=h.useState([]),[Mt,Mo]=h.useState([]),[wp,td]=h.useState(!1),[Nc,Gg]=h.useState([]),[bp,Xg]=h.useState(!1),[Jg,vp]=h.useState(()=>new Set),[ka,$o]=h.useState(!1),Do=h.useRef(null),kp=h.useRef(null),[Qg,nd]=h.useState({}),wi=h.useCallback(x=>{if(!x)return null;const N=x.id,H=x.source??"user",q=x.archived?"archived":"";return{sessionsKey:`af:composer-sessions:${N}:${H}${q?":"+q:""}`,activeKey:`af:composer-active-session:${N}:${H}${q?":"+q:""}`}},[]),Xn=h.useCallback(x=>{if(!x)return"";const N=x.id,H=x.source??"user",q=x.archived?"archived":"";return`af:composer-skills:pipeline:${N}:${H}${q?":"+q:""}`},[]),jl=h.useCallback(x=>{const N=wi(x);if(!N)return{sessions:[],activeSessionId:null};try{const H=localStorage.getItem(N.sessionsKey);if(!H)return{sessions:[],activeSessionId:null};const q=JSON.parse(H);if(!Array.isArray(q))return{sessions:[],activeSessionId:null};const Y=q.filter(ee=>ee&&typeof ee.id=="string").map(ee=>({...ee,running:!1,statusLine:ee.running?e("flow:composer.pageRefreshReset"):ee.statusLine,steps:[]}));let J=null;try{J=localStorage.getItem(N.activeKey),J&&!Y.some(ee=>ee.id===J)&&(J=null)}catch{J=null}return{sessions:Y,activeSessionId:J}}catch{return{sessions:[],activeSessionId:null}}},[wi]),Fo=h.useCallback((x,N,H)=>{const q=wi(x);if(q)try{localStorage.setItem(q.sessionsKey,JSON.stringify(N)),H?localStorage.setItem(q.activeKey,H):localStorage.removeItem(q.activeKey)}catch{}},[wi]),bi=h.useRef(0),jc=h.useRef({sessions:[],activeSessionId:null,flowKey:null}),[Zr,es]=h.useState([]),[mr,vi]=h.useState(null),ki=h.useMemo(()=>Xn(u),[Xn,u]),[rd,Cl]=h.useState(""),El=h.useMemo(()=>{if(!u)return null;const x=u.id,N=u.source??"user",H=u.archived?"archived":"";return`${x}:${N}${H?":"+H:""}`},[u]),sd=h.useRef(!1);h.useEffect(()=>{if(!El){es([]),vi(null),jc.current={sessions:[],activeSessionId:null,flowKey:null};return}const x=jc.current;if(x.flowKey===El)return;x.flowKey=El,sd.current&&x.sessions.length>0&&Fo(u,x.sessions,x.activeSessionId);const{sessions:N,activeSessionId:H}=jl(u);if(N.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};x.sessions=[Y],x.activeSessionId=q,es([Y]),vi(q)}else{const q=N[N.length-1];if(q&&(!q.thread||q.thread.length===0))bi.current=gx(N),x.sessions=N,x.activeSessionId=q.id,es(N),vi(q.id);else{const J=gx(N)+1;bi.current=J;const ee=`session-${J}-${Date.now()}`,ne={id:ee,label:e("flow:composer.conversationLabel",{n:J}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null},he=[...N,ne];x.sessions=he,x.activeSessionId=ee,es(he),vi(ee)}}sd.current=!0},[El,u,jl,Fo]);const $n=h.useMemo(()=>Zr.find(x=>x.id===mr)||null,[Zr,mr]),En=($n==null?void 0:$n.running)??!1,Si=($n==null?void 0:$n.statusLine)??"",_l=($n==null?void 0:$n.segments)??[],Pl=($n==null?void 0:$n.thread)??[],Sp=($n==null?void 0:$n.steps)??[];$n==null||$n.outputDismissed;const jt=($n==null?void 0:$n.phaseContext)??null,id=h.useRef([]),[od,Ni]=h.useState(!1),Cc=h.useRef(null),Np=h.useRef(null);h.useEffect(()=>{const x=Np.current;x&&requestAnimationFrame(()=>{x.scrollTop=x.scrollHeight})},[Pl,_l]);const no=h.useRef(null),Sa=h.useRef(!1),ji=h.useRef(null),jp=h.useCallback(x=>{const N=++bi.current,H=`session-${N}-${Date.now()}`,q={id:H,label:x||e("flow:composer.conversationLabel",{n:N}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};return es(Y=>[...Y,q]),vi(H),H},[]);h.useEffect(()=>{!u||!sd.current||(jc.current.sessions=Zr,jc.current.activeSessionId=mr,Fo(u,Zr,mr))},[Zr,mr,u,Fo]),h.useEffect(()=>{bi.current=Math.max(bi.current,gx(Zr))},[Zr]);const Cp=h.useCallback(x=>{var N;no.current===x&&((N=Cc.current)==null||N.abort()),es(H=>{const q=H.filter(J=>J.id!==x);if(H.some((J,ee)=>J.id===x&&H.findIndex(ne=>ne.id===mr)===ee)||mr===x){const J=q;J.length>0?vi(J[J.length-1].id):setTimeout(()=>{bi.current=0;const ee=++bi.current,ne=`session-${ee}-${Date.now()}`,he={id:ne,label:e("flow:composer.conversationLabel",{n:ee}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};es(ye=>[...ye,he]),vi(ne)},0)}return q})},[mr]),Vr=h.useCallback(x=>{es(N=>{const H=N.findIndex(J=>J.id===mr);if(H<0)return N;const q={...N[H]};x(q);const Y=[...N];return Y[H]=q,Y})},[mr]),Ep=h.useCallback(x=>{Vr(N=>{N.running=x})},[Vr]),Zs=h.useCallback(x=>{Vr(N=>{N.statusLine=x})},[Vr]),Rs=h.useCallback(x=>{Vr(N=>{typeof x=="function"?N.segments=x(N.segments):N.segments=x})},[Vr]),ad=h.useCallback(x=>{Vr(N=>{typeof x=="function"?N.thread=x(N.thread):N.thread=x})},[Vr]),Al=h.useCallback(x=>{Vr(N=>{typeof x=="function"?N.steps=x(N.steps):N.steps=x})},[Vr]),_p=h.useCallback(x=>{Vr(N=>{N.outputDismissed=x})},[Vr]),Il=h.useCallback(x=>{Vr(N=>{N.phaseContext=typeof x=="function"?x(N.phaseContext):x})},[Vr]),Tl=h.useCallback(x=>{vi(x),es(N=>{const H=N.findIndex(Y=>Y.id===x);if(H<0||!N[H].outputDismissed)return N;const q=[...N];return q[H]={...N[H],outputDismissed:!1},q})},[]);h.useEffect(()=>{id.current=_l},[_l]);const gr=h.useRef({}),Pp=h.useRef(!1),Ci=h.useRef(null),Rl=h.useRef(null),Ei=h.useRef(null),Na=h.useRef(!1),Ec=h.useRef(0),yr=h.useRef(""),[It,wt,Zg]=PA([]),[un,en,S]=AA([]),I=h.useRef(It),U=h.useRef(un),X=h.useRef(null),Q=h.useRef(null),ie=h.useRef(null),te=h.useRef(null),[oe,de]=h.useState(null),Se=h.useCallback(x=>{var N;gr.current=(N=x==null?void 0:x.extra)!=null&&N.instances&&typeof x.extra.instances=="object"?x.extra.instances:{},wt(Array.isArray(x==null?void 0:x.nodes)?x.nodes:[]),en(Array.isArray(x==null?void 0:x.edges)?x.edges:[]),de(null)},[en,wt]),Qe=h.useMemo(()=>({instances:gr.current}),[un,It]),{resetHistory:qe,undo:ft,redo:tt}=fT({nodes:It,edges:un,extra:Qe,enabled:!!u&&Na.current&&Oe==="edit",onRestore:Se}),bt=h.useMemo(()=>It.filter(x=>{var N;return(((N=x.data)==null?void 0:N.definitionId)||"").startsWith("provide_")}),[It]),dn=h.useMemo(()=>{var N;const x={};for(const H of It){if(!((N=H.data)!=null&&N.inputs))continue;const q=H.data.inputs;for(let Y=0;Y<q.length;Y++){const J=q[Y];if(!(J!=null&&J.name))continue;const ee=un.find(he=>he.target===H.id&&he.targetHandle===`input-${Y}`);if(!(ee!=null&&ee.source))continue;bt.find(he=>he.id===ee.source)&&(x[ee.source]=J.name)}}return x},[It,un,bt]),Ur=h.useMemo(()=>{if(Oe==="edit"||er.size===0)return null;const x=new Set(er);for(const N of un)er.has(N.source)&&x.add(N.target),er.has(N.target)&&x.add(N.source);return x},[Oe,er,un]),Dt=h.useMemo(()=>Oe==="edit"?It:It.map(x=>{var N,H;return{...x,draggable:!1,connectable:!1,data:{...x.data,isRunMode:!0,isExecuting:er.has(x.id),nodeStatus:((N=Nr[x.id])==null?void 0:N.status)??null,nodeElapsed:((H=Nr[x.id])==null?void 0:H.elapsed)??null,isDim:Ur?!Ur.has(x.id):!1}}}),[Oe,It,er,Nr,Ur]),Tr=h.useMemo(()=>Ur?un.map(x=>{const N=er.has(x.source)||er.has(x.target),H=x.className?x.className.replace(/\s?af-flow-edge--(dim|focus)\b/g,""):"",q=N?"af-flow-edge--focus":"af-flow-edge--dim";return{...x,className:(H?H+" ":"")+q}}):un,[un,er,Ur]);h.useEffect(()=>{if(!u){Xs({}),Br(null),ua(Cd),xc(vh),Ji(null),To(""),yc("");return}const x=new URLSearchParams({flowId:u.id,flowSource:u.source||"user"});u.archived&&x.set("archived","1"),fetch(`/api/flow/run-config?${x.toString()}`).then(N=>N.json()).then(N=>{Xs(N.presets||{}),Br(N.activePreset||null)}).catch(()=>{Xs({}),Br(null)})},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived]);const Rr=h.useCallback(x=>{yi.current+=1,ua(x)},[]),Wn=h.useCallback(async(x,N={})=>{if(!x)return;const H=!!N.quiet,q=!!N.force,Y=yi.current;H||(Qu(!0),To(""),yc(""));const J=new URLSearchParams({flowId:x.id,flowSource:x.source||"user"});x.archived&&J.set("archived","1");try{const ee=await fetch(`/api/flow/schedule?${J.toString()}`),ne=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(ne.error||`HTTP ${ee.status}`);if(!q&&yi.current!==Y)return;ua({...Cd,...ne.schedule||{}}),xc(ne.state&&typeof ne.state=="object"?ne.state:vh),Ji(ne.status||null)}catch(ee){if(!q&&yi.current!==Y)return;ua(Cd),xc(vh),Ji(null),To(String(ee.message||ee))}finally{Qu(!1)}},[]);h.useEffect(()=>{if(!u)return;let x=!1;return(async()=>{await Wn(u)})(),()=>{x=!0}},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,Wn]),h.useEffect(()=>{var H,q,Y,J;if(!Io||!Cr[Io]||bt.length===0)return;const x=Cr[Io],N={};for(const ee of bt){const ne=dn[ee.id];if(!ne)continue;const he=((H=ee.data)==null?void 0:H.definitionId)||"",ye=x[ee.id]??((J=(Y=(q=ee.data)==null?void 0:q.outputs)==null?void 0:Y[0])==null?void 0:J.default)??"";he.startsWith("provide_file")?N[ne]={type:"file",path:ye}:N[ne]={type:"str",value:ye}}Object.keys(N).length>0&&K(N)},[Io,Cr,bt,dn]);const ei=h.useCallback(()=>{if(!Gn||!Cn.current)return;const x=Cn.current.value;wt(N=>N.map(H=>{var q,Y;return H.id!==Gn.instanceId?H:{...H,data:{...H.data,outputs:((Y=(q=H.data)==null?void 0:q.outputs)==null?void 0:Y.map((J,ee)=>ee===0?{...J,default:x}:J))||[{type:"text",name:"value",default:x}]}}})),Oo(null)},[Gn,wt]),Ne=h.useMemo(()=>{const x=It.filter(N=>N.selected);return x.length===1?x[0]:null},[It]),Ft=h.useMemo(()=>u?VU(It,un,e):[],[u,It,un,e]),ti=h.useMemo(()=>Ft.map(x=>x.key).join("|"),[Ft]),Ll=h.useMemo(()=>Ft.some(x=>String((x==null?void 0:x.level)||"warning").toLowerCase()==="error"),[Ft]);h.useLayoutEffect(()=>{se(Ft.length>0&&!Ll)},[ti,u==null?void 0:u.id,u==null?void 0:u.source,Ft.length,Ll]),ba.current=Ne,h.useEffect(()=>{I.current=It},[It]),h.useEffect(()=>{const x=i.current,N=new Map,H=[];for(const ee of It){const ne=n7(ee);N.set(ee.id,ne),x.get(ee.id)!==ne&&H.push(ee.id)}if(i.current=N,H.length===0)return;const q=()=>H.forEach(ee=>{var ne;return(ne=s.current)==null?void 0:ne.call(s,ee)}),Y=window.requestAnimationFrame(q),J=window.setTimeout(q,80);return()=>{window.cancelAnimationFrame(Y),window.clearTimeout(J)}},[It]),h.useEffect(()=>{U.current=un},[un]),h.useEffect(()=>{ie.current=oe},[oe]),h.useEffect(()=>{if(!oe)return;const x=H=>{H.key==="Escape"&&de(null)},N=H=>{var q,Y;(Y=(q=H.target)==null?void 0:q.closest)!=null&&Y.call(q,".af-connect-node-menu")||de(null)};return document.addEventListener("keydown",x),document.addEventListener("pointerdown",N),()=>{document.removeEventListener("keydown",x),document.removeEventListener("pointerdown",N)}},[oe]),h.useEffect(()=>()=>{Ei.current!=null&&(clearTimeout(Ei.current),Ei.current=null)},[]);const ja=h.useMemo(()=>{var N;if(!Ne)return null;const x=(N=Ne.data)==null?void 0:N.definitionId;return ae.find(H=>H.id===x)??null},[Ne,ae]),ve=h.useMemo(()=>{const x={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const N of ae){const H=d0(N);x[H].push(N)}for(const N of Dd)x[N].sort((H,q)=>H.id.localeCompare(q.id));return x},[ae]),ut=h.useMemo(()=>{const x=Pe.trim().toLowerCase();if(!x)return ve;const N={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const H of Dd)N[H]=ve[H].filter(q=>QK(q,x));return N},[ve,Pe]),pt=h.useMemo(()=>Dd.reduce((x,N)=>x+ut[N].length,0),[ut]),nt=h.useMemo(()=>ae.filter(x=>{const N=String(x.id??""),H=String(x.source??"");return N.startsWith("marketplace:")||H==="marketplace"||H==="collection"}),[ae]),De=h.useMemo(()=>{const x=new Set;for(const N of nt){const H=String(N.id??"");if(H&&(x.add(H),H.startsWith("marketplace:"))){const q=H.slice(12),[Y]=q.split("@");Y&&x.add(`marketplace:${Y}`)}}return x},[nt]),Tt=h.useCallback(async()=>{f("");try{const x=await fetch("/api/flows");if(!x.ok)throw new Error("HTTP "+x.status);c(await x.json())}catch(x){f(String(x.message||x))}},[]);h.useEffect(()=>{Tt()},[Tt]),h.useEffect(()=>{if(r!=="/flow")return;const x=new URLSearchParams(window.location.search);x.get("new")==="1"&&!x.get("flowId")&&n("/projects?new=1")},[r,n]),h.useEffect(()=>{let x=!1;const N=()=>{fetch("/api/model-lists").then(q=>q.json()).then(q=>{x||xp({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(()=>{})};N();const H=setTimeout(N,4e3);return()=>{x=!0,clearTimeout(H)}},[]),h.useEffect(()=>{let x=!1;return fetch("/api/skills").then(N=>N.json()).then(N=>{if(x)return;const H=Array.isArray(N.skills)?N.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):""})):[];dt(H),td(!0)}).catch(()=>{}),()=>{x=!0}},[]),h.useEffect(()=>{let x=!1;return fetch("/api/skill-collections").then(N=>N.json()).then(N=>{x||(Gg(Qa(N)),Xg(!0))}).catch(()=>{}),()=>{x=!0}},[]),h.useEffect(()=>{if(Cl(""),!(!wp||!bp)){if(!ki){Mo([]);return}Mo($_(ki,"pipeline",Wr,Nc)),Cl(ki)}},[Nc,bp,Wr,wp,ki]),h.useEffect(()=>{if(!(rd!==ki||!ki))try{localStorage.setItem(ki,JSON.stringify(Mt))}catch{}},[Mt,ki,rd]);const Gt=h.useCallback(async x=>{const N=x.source??"user",H=!!x.archived,q=new URLSearchParams({flowId:x.id,flowSource:N});H&&q.set("archived","1");const Y=new URLSearchParams({flowId:x.id,flowSource:N});H&&Y.set("archived","1"),Y.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const[J,ee]=await Promise.all([fetch("/api/flow?"+q.toString()),fetch("/api/nodes?"+Y.toString())]),ne=await J.json();if(!J.ok||ne.error)throw new Error(ne.error||e("flow:nodePropsError.loadFlowFailed"));const he=await ee.json();if(!ee.ok)throw new Error(e("flow:nodePropsError.loadNodesFailed"));const ye=Array.isArray(he)?he:Array.isArray(he==null?void 0:he.nodes)?he.nodes:[],Fe=!Array.isArray(he)&&(he==null?void 0:he.pipelineTranslations)||{},ce=BU(ne.flowYaml||"");if(ce.error)throw new Error(ce.error);const $e={...ce.instances||{}},ke=ce.nodes.map(fn=>Bf(fn,$e,ye,Fe,x.id)),ht=dT(ce.edges,ke);return{flowSource:N,paletteList:ye,instances:$e,flowDescriptionText:ce.description??"",viewport:qj(ce.viewport),nodes:ke,edges:ht}},[t.language,e]),Nt=h.useCallback(async(x,N={})=>{const H=!!N.preserveComposer,q=H&&!!N.incrementalSync;Na.current=!1,Ec.current+=1,p(x),k(""),H||(j(""),we(""),re(null),v(""),z(""),M(""),vl(""),ad([]),Rs([]),Al([]),_p(!1),Il(null),ed("pan")),q||(gr.current={},wt([]),en([])),Xj(x);try{const Y=await Gt(x);if(be(Y.paletteList),gr.current=Y.instances,v(Y.flowDescriptionText),z(x.id||""),q){const J=I.current,ee=U.current;try{const ne=xW(J,ee,Y.nodes,Y.edges),he=new Set([...ne.changes.addedNodeIds,...ne.changes.updatedNodeIds]),ye=new Set([...ne.changes.addedEdgeKeys,...ne.changes.updatedEdgeKeys]),Fe=he.size>0?ne.nodes.map($e=>he.has($e.id)?{...$e,className:Mj($e.className,Lj)}:$e):ne.nodes,ce=ye.size>0?ne.edges.map($e=>ye.has(Mf($e))?{...$e,className:Mj($e.className,Oj)}:$e):ne.edges;wt(Fe),en(ce),Ei.current!=null&&(clearTimeout(Ei.current),Ei.current=null),(he.size>0||ye.size>0)&&(Ei.current=window.setTimeout(()=>{Ei.current=null,he.size>0&&wt($e=>$e.map(ke=>{if(!he.has(ke.id))return ke;const ht=$j(ke.className,Lj);return ht===String(ke.className||"")?ke:{...ke,className:ht}})),ye.size>0&&en($e=>$e.map(ke=>{if(!ye.has(Mf(ke)))return ke;const ht=$j(ke.className,Oj);return ht===String(ke.className||"")?ke:{...ke,className:ht}}))},GK))}catch{wt(Y.nodes),en(Y.edges)}}else if(wt(Y.nodes),en(Y.edges),Rl.current=Y.viewport||null,Y.viewport){const J=()=>{var ee;try{(ee=Ci.current)==null||ee.setViewport(Y.viewport,{duration:0})}catch{}};requestAnimationFrame(()=>requestAnimationFrame(J))}else g(J=>J+1);th(x.id,Y.flowSource),gp(J=>J+1),qe(Y.nodes,Y.edges,{instances:Y.instances});try{yr.current=yj(Y.nodes,Y.edges,Y.instances,{description:Y.flowDescriptionText,viewport:Rl.current})}catch{yr.current=""}Na.current=!0}catch(Y){k(String(Y.message||Y))}},[Gt,qe,wt,en]),sn=h.useCallback(async()=>{if(!(u!=null&&u.id))return;const x=u.source??"user",N=new URLSearchParams({flowId:u.id,flowSource:x});u.archived&&N.set("archived","1"),N.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const H=await fetch("/api/nodes?"+N.toString()),q=await H.json();if(!H.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:[];be(Y)},[u,e,t.language]),on=h.useCallback(async()=>{ir(!0),Sn("");try{const x=await fetch("/api/marketplace/nodes"),N=await x.json().catch(()=>({}));if(!x.ok)throw new Error((N==null?void 0:N.error)||"Failed to load marketplace nodes");Ln(Array.isArray(N==null?void 0:N.nodes)?N.nodes:[])}catch(x){Sn(String(x.message||x)),Ln([])}finally{ir(!1)}},[]),_t=h.useCallback(async()=>{Ue(!0),tn("");try{const x=await fetch("/api/marketplace/flow-snippets"),N=await x.json().catch(()=>({}));if(!x.ok)throw new Error((N==null?void 0:N.error)||"Failed to load flow snippets");et(Array.isArray(N==null?void 0:N.snippets)?N.snippets:[])}catch(x){tn(String(x.message||x)),et([])}finally{Ue(!1)}},[]);h.useEffect(()=>{u&&(on(),_t())},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,on,_t]);const an=h.useCallback(async x=>{if(!u||!x)return;const N=x.definitionId||`marketplace:${x.id}${x.version?`@${x.version}`:""}`;if(N){Nn(N),Sn("");try{const H=await fetch("/api/marketplace/install-node",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user",archived:!!u.archived,nodeSpec:N})}),q=await H.json().catch(()=>({}));if(!H.ok||(q==null?void 0:q.ok)===!1)throw new Error((q==null?void 0:q.error)||"Failed to install marketplace node");await sn()}catch(H){Sn(String(H.message||H))}finally{Nn("")}}},[u,sn]),ts=h.useCallback(async(x,N)=>{const H={packageId:(x==null?void 0:x.newId)||(x==null?void 0:x.id)||(x==null?void 0:x.label),label:(x==null?void 0:x.label)||(x==null?void 0:x.newId)||(x==null?void 0:x.id),version:"1.0.0",definitionId:N,body:(x==null?void 0:x.body)||"",script:(x==null?void 0:x.script)||"",inputs:Array.isArray(x==null?void 0:x.inputs)?x.inputs:[],outputs:Array.isArray(x==null?void 0:x.outputs)?x.outputs:[],flowId:u==null?void 0:u.id,flowSource:(u==null?void 0:u.source)||"user"},q=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(H)}),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 sn(),Y},[sn,u]),ni=h.useCallback(async()=>{var q;if(!u||ge.current)return;const x=u.id,N=u.source??"user",H=((q=ba.current)==null?void 0:q.id)??null;ge.current=!0,pe(!0);try{await Nt({id:x,source:N,archived:u.archived},{preserveComposer:!0,incrementalSync:!0}),H&&wt(Y=>Y.map(J=>({...J,selected:J.id===H})))}finally{ge.current=!1,pe(!1)}},[u,u==null?void 0:u.archived,Nt,wt]);h.useEffect(()=>{if(Pp.current||l.length===0)return;const x=new URLSearchParams(window.location.search),N=x.get("flowId");if(!N)return;const H=x.get("flowSource")??"user",q=x.get("flowArchived")==="1",Y=l.find(J=>J.id===N&&(J.source??"user")===H&&!!J.archived===q);Y&&(Pp.current=!0,Nt(Y))},[l,Nt]);const Ls=h.useRef(0);h.useEffect(()=>{if(!u)return;const x=u.id,N=u.source??"user",H=!!u.archived;Ls.current=0;let q=!1;const Y=async()=>{var ne;if(q)return;const ee=new URLSearchParams({flowId:x,flowSource:N,v:String(Ls.current)});H&&ee.set("archived","1");try{const he=await fetch("/api/flow-editor-sync-poll?"+ee.toString());if(!he.ok||q)return;const ye=await he.json();if(q)return;if(ye.changed){Ls.current=ye.version;const Fe=((ne=ba.current)==null?void 0:ne.id)??null;await Nt({id:x,source:N,archived:H},{preserveComposer:!0,incrementalSync:!0}),await Wn({id:x,source:N,archived:H},{quiet:!0,force:!0}),Fe&&wt(ce=>ce.map($e=>({...$e,selected:$e.id===Fe})))}else Ls.current=ye.version}catch{}},J=window.setInterval(Y,2e3);return Y(),()=>{q=!0,window.clearInterval(J)}},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,Nt,Wn,wt]);const zo=h.useMemo(()=>w?w.startsWith(e("flow:status.saveFailed"))?" af-palette-tip--error":w===e("flow:status.saved")?" af-palette-tip--success":" af-palette-tip--info":"",[w]);h.useEffect(()=>{if(!w)return;w===e("flow:status.saved")||w.startsWith(e("flow:status.runInTerminal"));const x=w.startsWith(e("flow:status.runInTerminal"))?5200:2800,N=window.setTimeout(()=>j(""),x);return()=>clearTimeout(N)},[w,e]),h.useEffect(()=>{C("")},[u==null?void 0:u.id,u==null?void 0:u.source]),h.useEffect(()=>{const x=()=>{window.__provideEditContent&&(Oo(window.__provideEditContent),window.__provideEditContent=null)};return window.addEventListener("provide-expand",x),()=>window.removeEventListener("provide-expand",x)},[]),h.useEffect(()=>{var ne,he,ye,Fe,ce,$e,ke;if(!Ne){va(null);return}const x=gr.current[Ne.id]||{},{inputs:N,outputs:H}=uT(Ne),q=String(((ne=Ne.data)==null?void 0:ne.definitionId)??Ne.id??""),Y=((he=Ne.data)==null?void 0:he.script)!=null?String(Ne.data.script):void 0,J=x.script!=null?String(x.script):void 0,ee=q==="tool_nodejs"||Y&&Y.trim()!==""||J&&J.trim()!==""?String(Y??J??""):"";va({id:Ne.id,newId:Ne.id,label:String(((ye=Ne.data)==null?void 0:ye.label)??Ne.id),role:((Fe=Ne.data)==null?void 0:Fe.role)??"普通",model:String(((ce=Ne.data)==null?void 0:ce.model)??x.model??""),body:String((($e=Ne.data)==null?void 0:$e.body)??x.body??""),images:ws(((ke=Ne.data)==null?void 0:ke.images)??x.images),script:ee,inputs:N,outputs:H})},[Ne==null?void 0:Ne.id,mp]),h.useEffect(()=>{u&&(Ne||(vc.current=null,re(x=>x==="node"?null:x)))},[u,Ne==null?void 0:Ne.id]);const _c=h.useCallback(()=>{vc.current=null,re(x=>x==="settings"||x==="history"?x:"node")},[]),ey=h.useCallback((x,N)=>{x.metaKey||x.ctrlKey||x.shiftKey||Oe!=="edit"&&Ts((N==null?void 0:N.id)??null)},[Oe]),F2=h.useCallback((x,N)=>{Oe==="edit"&&(x.preventDefault(),wt(H=>H.map(q=>({...q,selected:q.id===N.id}))),en(H=>H.map(q=>({...q,selected:!1}))),_c())},[_c,Oe,en,wt]),z2=h.useCallback((x,N)=>{if(Oe!=="edit")return;const H=x.metaKey||x.ctrlKey||x.shiftKey;en(q=>q.map(Y=>Y.id===N.id?{...Y,selected:!Y.selected||!H}:H?Y:{...Y,selected:!1})),H||wt(q=>q.map(Y=>({...Y,selected:!1})))},[Oe,en,wt]),B2=h.useCallback(x=>Hj(x,I.current),[]),H2=h.useCallback(x=>{if(!Hj(x,I.current)){j("端口类型不匹配,已取消连线");return}de(null),wt(N=>Km(N,x)),en(N=>{const H=N.filter(q=>!(q.target===x.target&&q.targetHandle===x.targetHandle));return Rf({...x,markerEnd:{type:Ns.ArrowClosed}},H)})},[en,wt]),W2=h.useCallback((x,N)=>{Q.current=r7(N,I.current),de(null)},[]),V2=h.useCallback((x,N)=>{var ke,ht,fn,pn;const H=Q.current;if(Q.current=null,!u||!H||N!=null&&N.toNode)return;const q=i7(ae,H);if(q.length===0){j(`没有匹配 ${H.slotType} 端口的节点`);return}const Y=((ht=(ke=x==null?void 0:x.changedTouches)==null?void 0:ke[0])==null?void 0:ht.clientX)??(x==null?void 0:x.clientX),J=((pn=(fn=x==null?void 0:x.changedTouches)==null?void 0:fn[0])==null?void 0:pn.clientY)??(x==null?void 0:x.clientY);if(!Number.isFinite(Y)||!Number.isFinite(J))return;const ee=Ci.current,ne=document.querySelector(".af-pipeline-flow .react-flow");if(!ee||!ne)return;const he=ne.getBoundingClientRect(),ye=320,Fe=Math.min(440,104+q.length*58),ce=Math.max(12,Math.min(Y-he.left,he.width-ye-12)),$e=Math.max(12,Math.min(J-he.top,he.height-Fe-12));de({left:ce,top:$e,flowPosition:ee.screenToFlowPosition({x:Y,y:J}),draft:H,candidates:q,query:""})},[ae,u]),U2=h.useCallback(x=>{for(const N of x)delete gr.current[N.id]},[]),K2=h.useCallback(x=>{Ci.current=x},[]),q2=h.useCallback(x=>{wt(H=>H.map(q=>({...q,selected:q.id===x}))),en(H=>H.map(q=>({...q,selected:!1}))),_c();const N=()=>{var he,ye,Fe;const H=Ci.current;if(!(H!=null&&H.getNode))return;const q=H.getNode(x);if(!q)return;const Y=(he=H.getInternalNode)==null?void 0:he.call(H,x),J=((ye=Y==null?void 0:Y.measured)==null?void 0:ye.width)??(Y==null?void 0:Y.width)??q.width??200,ee=((Fe=Y==null?void 0:Y.measured)==null?void 0:Fe.height)??(Y==null?void 0:Y.height)??q.height??88,{zoom:ne}=H.getViewport();H.setCenter(q.position.x+J/2,q.position.y+ee/2,{zoom:Kj(ne),duration:220})};requestAnimationFrame(()=>requestAnimationFrame(N))},[wt,en,_c]),Y2=h.useCallback(x=>{wt(H=>H.map(q=>({...q,selected:q.id===x}))),en(H=>H.map(q=>({...q,selected:!1})));const N=()=>{var ye,Fe,ce;const H=Ci.current;if(!(H!=null&&H.getNode))return;const q=H.getNode(x);if(!q)return;const Y=(ye=H.getInternalNode)==null?void 0:ye.call(H,x),J=((Fe=Y==null?void 0:Y.measured)==null?void 0:Fe.width)??(Y==null?void 0:Y.width)??q.width??200,ee=((ce=Y==null?void 0:Y.measured)==null?void 0:ce.height)??(Y==null?void 0:Y.height)??q.height??88,{zoom:ne}=H.getViewport(),he=Kj(ne);H.setCenter(q.position.x+J/2,q.position.y+ee/2,{zoom:he,duration:260})};requestAnimationFrame(()=>requestAnimationFrame(N))},[wt,en]),Pc=h.useCallback((x,N)=>{const H=`node-${Date.now()}`;return PT(x,H,N,gr.current,ae)},[ae]),C0=h.useCallback(x=>{if(!u||!x)return;let N={x:180,y:160};const H=Ci.current,q=document.querySelector(".af-pipeline-flow .react-flow");if(H&&q){const Y=q.getBoundingClientRect();N=H.screenToFlowPosition({x:Y.left+Y.width*.45,y:Y.top+Y.height*.38})}wt(Y=>[...Y,Pc(x,N)])},[u,wt,Pc]),G2=h.useCallback(x=>{const N=ie.current;if(!u||!N||!(x!=null&&x.def))return;const H=Pc(x.def,N.flowPosition),q=N.draft.handleType==="source"?{source:N.draft.nodeId,sourceHandle:N.draft.handleId,target:H.id,targetHandle:`input-${x.slotIndex}`}:{source:H.id,sourceHandle:`output-${x.slotIndex}`,target:N.draft.nodeId,targetHandle:N.draft.handleId};wt(Y=>Km([...Y,H],q)),en(Y=>{const J=Y.filter(ee=>!(ee.target===q.target&&ee.targetHandle===q.targetHandle));return Rf({...q,markerEnd:{type:Ns.ArrowClosed}},J)}),de(null)},[u,Pc,wt,en]),X2=h.useCallback(x=>{x.preventDefault(),x.dataTransfer.dropEffect="move"},[]),J2=h.useCallback(x=>{var ee;if(x.preventDefault(),!u)return;const N=Ci.current;if(!N)return;const H=N.screenToFlowPosition({x:x.clientX,y:x.clientY}),q=x.dataTransfer.getData("application/agentflow-snippet");if(q){const ne=ct.find(he=>`${he.id}@${he.version}`===q);ne&&((ee=te.current)==null||ee.call(te,ne,H));return}const Y=x.dataTransfer.getData("application/agentflow-node");if(!Y)return;const J=ae.find(ne=>ne.id===Y);J&&wt(ne=>[...ne,Pc(J,H)])},[u,ae,ct,wt,Pc]),ri=h.useCallback(async(x,N)=>{if(!u)return;const H=yj(x,N,gr.current,{description:b,viewport:Rl.current});if(H!==yr.current){j(e("flow:status.saving"));try{const q=S7(u.source),Y=await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:q,flowYaml:H,...u.archived?{flowArchived:!0}:{}})}),J=await Y.json();if(!Y.ok||!J.success)throw new Error(J.error||e("flow:status.saveFailed"));if(yr.current=H,j(e("flow:status.saved")),si(u.source)&&q==="workspace"){const ee={id:u.id,source:"workspace",path:void 0};p(ee),Xj(ee),th(u.id,"workspace")}}catch(q){j(e("flow:status.saveFailed")+": "+(q.message||q))}}},[u,b]);h.useEffect(()=>{if(!u||!Na.current||Oe!=="edit"||u.archived)return;const x=Ec.current,N=setTimeout(()=>{x===Ec.current&&Na.current&&ri(I.current,U.current)},400);return()=>clearTimeout(N)},[It,un,b,Oe,u,ri]);const Ap=h.useCallback(async x=>{if(!u||u.archived)return;const N=u.source??"user";if(!(N!=="user"&&N!=="workspace")&&N!==x){B(!0),C("");try{const H=await fetch("/api/flow/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,fromSource:N,toSource:x})}),q=await H.json().catch(()=>({}));if(!H.ok)throw new Error(typeof q.error=="string"?q.error:e("flow:composer.requestFailed"));const Y=q.flowSource==="workspace"||q.flowSource==="user"?q.flowSource:x;let J={id:u.id,source:Y,archived:u.archived};try{const ee=await fetch("/api/flows");if(ee.ok){const ne=await ee.json(),he=Array.isArray(ne)?ne.find(ye=>ye.id===u.id&&(ye.source??"user")===Y&&!!ye.archived==!!u.archived):null;he&&(J=he)}}catch{}await Nt(J,{preserveComposer:!0}),th(u.id,Y)}catch(H){C(String(H.message||H))}finally{B(!1)}}},[u,Nt]),ty=h.useCallback(async()=>{if(u){gc(!0),To(""),yc("");try{const x=await fetch("/api/flow/schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user",archived:!!u.archived,schedule:lr})}),N=await x.json().catch(()=>({}));if(!x.ok||!N.success)throw new Error(N.error||"Failed to save schedule");ua({...Cd,...N.schedule||{}}),yc(e("flow:schedule.saved")),await Wn(u,{quiet:!0,force:!0})}catch(x){To(String(x.message||x))}finally{gc(!1)}}},[u,lr,Wn,e]),Q2=h.useCallback(async()=>{u&&(await ri(I.current,U.current),!u.archived&&u.source!=="builtin"&&await ty())},[u,ri,ty]),Ip=h.useCallback(async()=>{if(!u||!F.trim())return;const x=F.trim();if(x===u.id){M("");return}O(!0),M("");try{const N=await fetch("/api/flow/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",newFlowId:x})}),H=await N.json().catch(()=>({}));if(!N.ok)throw new Error(typeof H.error=="string"?H.error:e("flow:composer.requestFailed"));let q={id:H.flowId,source:H.flowSource??u.source,archived:u.archived};try{const Y=await fetch("/api/flows");if(Y.ok){const J=await Y.json(),ee=Array.isArray(J)?J.find(ne=>ne.id===H.flowId&&(ne.source??"user")===(H.flowSource??u.source)):null;ee&&(q=ee)}}catch{}await Nt(q,{preserveComposer:!0}),th(H.flowId,H.flowSource??u.source)}catch(N){M(String(N.message||N))}finally{O(!1)}},[u,F,Nt]),E0=h.useCallback(x=>{navigator.clipboard.writeText(x).then(()=>{E(!0),setTimeout(()=>E(!1),2e3)}).catch(()=>{})},[]),ny=h.useCallback(()=>{ri(It,un)},[ri,It,un]),_0=h.useCallback(()=>{var N,H;if(!u)return;const x=qj((H=(N=Ci.current)==null?void 0:N.getViewport)==null?void 0:H.call(N));x&&(Rl.current=x,j("已固定 Pipeline 进入视角"),ri(I.current,U.current))},[ri,u]),Z2=h.useCallback((x,N)=>{const H=N.trim()===""||N==="default"?void 0:N.trim(),q=It.map(Y=>Y.id===x?{...Y,data:{...Y.data,model:H}}:Y);wt(q),ri(q,un)},[It,un,wt,ri]),Tp=h.useCallback(()=>{var ht,fn;if(!gt||!u||!Ne)return!1;const x=Ne.id,N=gt.newId.trim();if(Nl(""),!vT.test(N))return Nl(e("flow:nodePropsError.invalidInstanceId")),!1;if(It.some(pn=>pn.id===N&&pn.id!==x))return Nl(e("flow:nodePropsError.duplicateInstanceId")),!1;const H=gt.role.trim(),q=ol.includes(H)?H:"普通",Y=gt.model.trim(),J=pn=>(Array.isArray(pn)?pn:[]).map(Vt=>({type:String((Vt==null?void 0:Vt.type)??"节点").trim()||"节点",name:String((Vt==null?void 0:Vt.name)??""),default:String((Vt==null?void 0:Vt.default)??""),required:!!(Vt!=null&&Vt.required),showOnNode:(Vt==null?void 0:Vt.showOnNode)!=null?Vt.showOnNode!==!1:!!(Vt!=null&&Vt.required)||String((Vt==null?void 0:Vt.type)??"节点").trim().toLowerCase()==="node"})),ee=J(gt.inputs),ne=J(gt.outputs),he=String(((ht=Ne.data)==null?void 0:ht.definitionId)??N),ye=he.startsWith("provide_"),Fe={...Ne.data,label:gt.label.trim()||N,role:q,model:Y===""||Y==="default"?void 0:Y,body:ye?"":gt.body,images:ye?[]:ws(gt.images),inputs:ee,outputs:ye&&Array.isArray((fn=Ne.data)==null?void 0:fn.outputs)?Ne.data.outputs:ne},ce=String(gt.script??"").trim();he==="tool_nodejs"||ce!==""?Fe.script=String(gt.script??""):delete Fe.script;let $e,ke=un;if(N!==x){const pn={...gr.current},Vt={...pn[x]||{}};delete pn[x],pn[N]=Vt,gr.current=pn,$e=It.map(vt=>vt.id!==x?vt:{...vt,id:N,selected:!0,data:Fe}),ke=un.map((vt,Xt)=>({...vt,source:vt.source===x?N:vt.source,target:vt.target===x?N:vt.target,id:`e-${vt.source===x?N:vt.source}-${vt.target===x?N:vt.target}-${Xt}`}))}else $e=It.map(pn=>pn.id===x?{...pn,data:Fe}:pn);return wt($e),en(ke),vr(N),ri($e,ke),!0},[gt,u,Ne,It,un,wt,en,vr,ri]),ry=h.useCallback(()=>{var fn,pn;if(!gt||!u||!Ne)return!1;const x=Ne.id,N=gt.role.trim(),H=ol.includes(N)?N:"普通",q=gt.model.trim(),Y=Vt=>(Array.isArray(Vt)?Vt:[]).map(vt=>({type:String((vt==null?void 0:vt.type)??"节点").trim()||"节点",name:String((vt==null?void 0:vt.name)??""),default:String((vt==null?void 0:vt.default)??""),required:!!(vt!=null&&vt.required),showOnNode:(vt==null?void 0:vt.showOnNode)!=null?vt.showOnNode!==!1:!!(vt!=null&&vt.required)||String((vt==null?void 0:vt.type)??"节点").trim().toLowerCase()==="node"})),J=Y(gt.inputs),ee=Y(gt.outputs),ne=String(((fn=Ne.data)==null?void 0:fn.definitionId)??x),he=ne.startsWith("provide_"),ye=gt.label.trim()||x,Fe=q===""||q==="default"?void 0:q,ce={...Ne.data,label:ye,role:H,model:Fe,body:he?"":gt.body,images:he?[]:ws(gt.images),inputs:J,outputs:he&&Array.isArray((pn=Ne.data)==null?void 0:pn.outputs)?Ne.data.outputs:ee},$e=String(gt.script??"").trim();ne==="tool_nodejs"||$e!==""?ce.script=String(gt.script??""):delete ce.script;const ke=Ne.data||{};return(ke.label!==ce.label||ke.role!==ce.role||ke.model!==ce.model||ke.body!==ce.body||JSON.stringify(ws(ke.images))!==JSON.stringify(ce.images)||(ke.script??void 0)!==(ce.script??void 0)||JSON.stringify(ke.inputs||[])!==JSON.stringify(J)||JSON.stringify(ke.outputs||[])!==JSON.stringify(ee))&&(wt(Vt=>Vt.map(vt=>vt.id===x?{...vt,data:ce}:vt)),vr(x)),!0},[gt,u,Ne,wt,vr]),P0=h.useRef(ry);h.useEffect(()=>{P0.current=ry},[ry]),h.useEffect(()=>{if(!gt||!u||!Na.current||Oe!=="edit")return;const x=setTimeout(()=>{P0.current()},400);return()=>clearTimeout(x)},[gt,u,Oe]);const eR=h.useCallback(()=>{if(!(!gt||!Ne)){if(gt.newId.trim()===Ne.id){Nl("");return}Tp()}},[gt,Ne,Tp]);h.useEffect(()=>{const x=N=>{var ee,ne,he;if(Oe!=="edit")return;const H=mT(N.target);if((N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="s"){if(it==="node"&&Ne&>){N.preventDefault(),N.stopPropagation(),Tp()||ny();return}if(H)return;N.preventDefault(),N.stopPropagation(),ny();return}if((N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="k"){N.preventDefault(),N.stopPropagation(),Sl(ye=>!ye);return}if(bc)return;if(kl){if(N.key==="Escape"){N.preventDefault(),xa(!1);return}if(Ym(N)&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),xa(!1);return}(N.key==="v"||N.key==="V"||N.key==="h"||N.key==="H")&&!N.metaKey&&!N.ctrlKey&&!N.altKey&&N.preventDefault();return}if(H)return;const q=N.key.toLowerCase(),Y=(N.metaKey||N.ctrlKey)&&!N.shiftKey&&q==="z",J=(N.metaKey||N.ctrlKey)&&(N.shiftKey&&q==="z"||q==="y");if(Y||J){N.preventDefault(),N.stopPropagation();const ye=Y?ft():tt();j(ye?Y?"Undo canvas change":"Redo canvas change":Y?"Nothing to undo":"Nothing to redo");return}if((N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="c"){const ye=oT(I.current,U.current,gr.current);ye&&(N.preventDefault(),N.stopPropagation(),X.current=ye,j(`Copied ${ye.nodes.length} node${ye.nodes.length>1?"s":""}`));return}if((N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="v"){const ye=aT(X.current,I.current,U.current,gr.current);ye&&(N.preventDefault(),N.stopPropagation(),gr.current=ye.instances,wt(ye.nodes),en(ye.edges),j(`Pasted ${ye.pastedNodeIds.length} node${ye.pastedNodeIds.length>1?"s":""}`));return}if((N.key==="a"||N.key==="A")&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),N.stopPropagation(),(ee=st.current)==null||ee.focus(),(he=(ne=st.current)==null?void 0:ne.select)==null||he.call(ne);return}if((N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="a"){N.preventDefault(),N.stopPropagation(),wt(ye=>ye.map(Fe=>({...Fe,selected:!0}))),en(ye=>ye.map(Fe=>({...Fe,selected:!1})));return}if(Ym(N)&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),xa(ye=>!ye);return}if((N.key==="v"||N.key==="V")&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),ed("select");return}if((N.key==="h"||N.key==="H")&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),ed("pan");return}if((N.key==="f"||N.key==="F")&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),_0();return}};return window.addEventListener("keydown",x,!0),()=>window.removeEventListener("keydown",x,!0)},[ny,_0,kl,bc,it,Ne,gt,Tp,Oe,ft,tt]),h.useEffect(()=>{if(Oe!=="running"||Ht==null)return;let x=Math.floor((Date.now()-Ht)/1e3);const N=setInterval(()=>{const H=Date.now()-Ht,q=Math.floor(H/1e3);q!==x&&(x=q,Je(H))},500);return()=>clearInterval(N)},[Oe,Ht]),h.useEffect(()=>{const x=da.current;!x||!x.parentElement||ml.current&&(Qi.current=!0,x.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{Qi.current=!1}))},[Sr]),h.useEffect(()=>{const x=da.current;if(!x)return;const N=x.parentElement;if(!N)return;const H=()=>{if(Qi.current)return;const q=N.scrollHeight-N.scrollTop-N.clientHeight;ml.current=q<40};return N.addEventListener("scroll",H,{passive:!0}),()=>N.removeEventListener("scroll",H)},[ar,Oe]),h.useEffect(()=>{if(Oe==="edit"||!ar)return;ml.current=!0;const x=da.current;x&&(Qi.current=!0,x.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{Qi.current=!1}))},[Oe,ar]),h.useEffect(()=>{Sr.length>Gh+Yj&&mt(x=>x.length>Gh+Yj?x.slice(-Gh):x)},[Sr]);const tR=h.useCallback(x=>{if(x.button!==0)return;x.preventDefault();const N=x.currentTarget;Ys.current={active:!0,pointerId:x.pointerId,startY:x.clientY,startH:Gi},N.setPointerCapture(x.pointerId)},[Gi]),nR=h.useCallback(x=>{const N=Ys.current;if(!N.active||x.pointerId!==N.pointerId)return;const H=N.startY-x.clientY;Ao(Xh(N.startH+H))},[]),Rp=h.useCallback(()=>{Ao(x=>{const N=Xh(x);try{localStorage.setItem(IT,String(N))}catch{}return N})},[]),A0=h.useCallback(x=>{const N=Ys.current;if(!(!N.active||x.pointerId!==N.pointerId)){N.active=!1;try{x.currentTarget.releasePointerCapture(x.pointerId)}catch{}Rp()}},[Rp]),rR=h.useCallback(()=>{const x=Ys.current;x.active&&(x.active=!1,Rp())},[Rp]);h.useEffect(()=>{function x(){Ao(N=>Xh(N))}return window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]);const ro=h.useCallback(async(x={})=>{if(!u)return;const N=x.runUuid!=null&&String(x.runUuid).trim()?String(x.runUuid).trim():null,H=x.cliInputsOverride??me.current,q=!!x.prepareOnly;if(Bt(q?"ready":"running"),mt(q?[]:[{ts:new Date().toISOString(),type:"info",text:N?e("flow:run.connectingApiResume",{uuid:N}):e("flow:run.connectingApi")}]),Hn(new Set),lt({}),_s(!q),re(null),N||As(null),q)return;if(!N){const J=Date.now();qt(J),Je(0)}const Y=new AbortController;Js.current=Y;try{const J=await fetch("/api/flow/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user",...N?{uuid:N}:{},cliInputs:H}),signal:Y.signal});if(!J.ok){const ce=await J.json().catch(()=>({error:e("flow:composer.requestFailed")}));mt($e=>[...$e,{ts:new Date().toISOString(),type:"error",text:ce.error||e("flow:composer.requestFailed")}]),Bt("error");return}if(mt(ce=>[...ce,{ts:new Date().toISOString(),type:"info",text:e("flow:run.connectedReceiving")}]),!J.body){mt(ce=>[...ce,{ts:new Date().toISOString(),type:"error",text:e("flow:run.noBody")}]),Bt("error");return}const ee=J.body.getReader(),ne=new TextDecoder;let he="";const ye=ce=>{const $e=ce.ts||new Date().toISOString();if(ce.type==="event")if(ce.event==="node-start")Hn(ke=>new Set(ke).add(ce.instanceId)),lt(ke=>({...ke,[ce.instanceId]:{status:"running",startMs:Date.now()}})),mt(ke=>[...ke,{ts:$e,type:"node-start",text:ce.label?e("flow:run.nodeStartWithLabel",{instanceId:ce.instanceId,label:ce.label}):e("flow:run.nodeStart",{instanceId:ce.instanceId})}]);else if(ce.event==="node-done"){Hn(ht=>{const fn=new Set(ht);return fn.delete(ce.instanceId),fn});const ke=ce.elapsed??null;lt(ht=>({...ht,[ce.instanceId]:{status:"success",elapsed:ke}})),mt(ht=>[...ht,{ts:$e,type:"node-done",text:ke?e("flow:run.nodeDoneWithElapsed",{instanceId:ce.instanceId,elapsed:ke}):e("flow:run.nodeDone",{instanceId:ce.instanceId})}])}else if(ce.event==="node-failed")Hn(ke=>{const ht=new Set(ke);return ht.delete(ce.instanceId),ht}),lt(ke=>({...ke,[ce.instanceId]:{status:"failed",elapsed:ce.elapsed??null}})),mt(ke=>[...ke,{ts:$e,type:"node-failed",text:e("flow:run.nodeFailed",{instanceId:ce.instanceId})}]);else if(ce.event==="apply-start"){if(ce.uuid&&As(String(ce.uuid)),typeof ce.runStartTime=="number"&&ce.runStartTime>0)qt(ce.runStartTime),Je(Math.max(0,Date.now()-ce.runStartTime));else if(typeof ce.totalExecutedMs=="number"&&ce.totalExecutedMs>0){const ke=Date.now()-ce.totalExecutedMs;qt(ke),Je(ce.totalExecutedMs)}mt(ke=>[...ke,{ts:$e,type:"info",text:e("flow:run.pipelineStart",{uuid:ce.uuid||"?"})}])}else ce.event==="apply-done"?mt(ke=>[...ke,{ts:$e,type:"info",text:ce.totalElapsed?e("flow:run.pipelineDoneWithElapsed",{elapsed:ce.totalElapsed}):e("flow:run.pipelineDone")}]):ce.event==="apply-paused"?mt(ke=>[...ke,{ts:$e,type:"warn",text:e("flow:run.pipelinePaused",{nodes:(ce.pendingNodes||[]).join(", ")})}]):mt(ke=>[...ke,{ts:$e,type:"event",text:`[${ce.event}] ${JSON.stringify(ce)}`}]);else ce.type==="user-check-content"?(gl({instanceId:ce.instanceId,execId:ce.execId??1,inputPath:ce.inputPath,outputPath:ce.outputPath,content:ce.content||""}),yl(ce.content||""),fa(!1),pa(""),cs(!1),mt(ke=>[...ke,{ts:$e,type:"user-check",text:e("flow:run.userCheckContent",{instanceId:ce.instanceId})}])):ce.type==="user-ask-prompt"?(xl({instanceId:ce.instanceId,execId:ce.execId??1,question:ce.question||"",options:Array.isArray(ce.options)?ce.options:[]}),wl(!1),mt(ke=>[...ke,{ts:$e,type:"user-ask",text:e("flow:run.userAskPrompt",{instanceId:ce.instanceId,defaultValue:`等待用户选择 (${ce.instanceId})`})}])):ce.type==="tool-print-content"?(Qs({instanceId:ce.instanceId,execId:ce.execId??1,content:ce.content||"",createdAt:Date.now()}),Zu(!1)):ce.type==="log"?mt(ke=>[...ke,{ts:$e,type:"log",text:ce.text!=null?String(ce.text):""}]):ce.type==="error"?mt(ke=>[...ke,{ts:$e,type:"error",text:ce.message||e("flow:run.unknownError")}]):ce.type==="done"?mt(ke=>[...ke,{ts:$e,type:"done",text:e("flow:run.executionEnd",{exitCode:ce.exitCode??"?"})}]):mt(ke=>[...ke,{ts:$e,type:"log",text:JSON.stringify(ce)}])},Fe=ce=>{if(ce.trim())try{ye(JSON.parse(ce))}catch{mt($e=>[...$e,{ts:new Date().toISOString(),type:"log",text:ce}])}};for(;;){const{done:ce,value:$e}=await ee.read();he+=ne.decode($e??new Uint8Array,{stream:!ce});const ke=he.split(`
|
|
133
|
-
`);he=ke.pop()??"";for(const ht of ke)Fe(ht);if(ce)break}he.trim()&&Fe(he),Bt("done")}catch(J){J.name==="AbortError"?(mt(ee=>[...ee,{ts:new Date().toISOString(),type:"warn",text:e("flow:run.executionStopped")}]),Bt("stopped")):(mt(ee=>[...ee,{ts:new Date().toISOString(),type:"error",text:J.message||e("flow:run.unknownError")}]),Bt("error"))}finally{Js.current=null,Hn(new Set)}},[u]),[sR,sy]=h.useState(!1),iR=h.useCallback(()=>{sy(!0)},[]),oR=h.useCallback(async()=>{if(sy(!1),Js.current&&(Js.current.abort(),Js.current=null),u)try{await fetch("/api/flow/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user"})})}catch{}Bt("stopped"),Hn(new Set)},[u]),Ol=h.useCallback(()=>{Bt("edit"),Hn(new Set),lt({}),Ts(null),As(null)},[]),[aR,Lp]=h.useState(!1),lR=h.useCallback(async()=>{if(Lp(!1),Js.current&&(Js.current.abort(),Js.current=null),u)try{await fetch("/api/flow/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user"})})}catch{}Ol()},[u,Ol]),cR=h.useCallback(()=>{Lp(!1),n("/projects")},[n]),uR=h.useCallback(x=>{const N=x.runId!=null&&String(x.runId).trim()?String(x.runId).trim():null,H=x.flowId!=null&&String(x.flowId).trim()?String(x.flowId).trim():(u==null?void 0:u.id)!=null?String(u.id):null;As(N);const q=x.status||"unknown";let Y="stopped";q==="success"?Y="done":q==="failed"?Y="error":q==="running"?Y="running":Y="stopped",Bt(Y);const J=typeof x.at=="number"?x.at:null;if(Y==="running"&&J!=null?(qt(J),Je(Math.max(0,Date.now()-J))):J!=null&&typeof x.endedAt=="number"&&x.endedAt>J?(qt(null),Je(x.endedAt-J)):(qt(null),Je(Math.max(0,x.durationMs??0))),mt([]),Hn(new Set),lt({}),Ts(null),re(null),_s(!1),N&&H){const ee=new URLSearchParams({flowId:H,runId:N});fetch(`/api/run-node-statuses?${ee}`).then(ne=>ne.json()).then(ne=>{const he=ne.statuses&&typeof ne.statuses=="object"?ne.statuses:{},ye={};for(const[Fe,ce]of Object.entries(he))ce&&typeof ce=="object"&&typeof ce.status=="string"&&(ye[Fe]={status:ce.status,...ce.elapsed!=null&&String(ce.elapsed).trim()!==""?{elapsed:String(ce.elapsed)}:{}});lt(ye)}).catch(()=>{})}},[u==null?void 0:u.id]);h.useEffect(()=>{if(!(u!=null&&u.id)||Oe!=="edit")return;let x=!1;return(async()=>{try{const N=await fetch("/api/pipeline-recent-runs"),H=await N.json();if(x||!N.ok)return;const Y=(Array.isArray(H.runs)?H.runs:[]).find(ne=>ne.flowId===u.id&&ne.status==="running");if(!Y||x)return;const J=Y.runId||null;As(J),Bt("running"),_s(!0),qt(Y.at||Date.now()),Yi.current=0;const ee=[{ts:new Date().toISOString(),type:"info",text:`[resume] 检测到活跃 run ${J},已恢复运行视图`}];if(J){const ne=new URLSearchParams({flowId:u.id,runId:J}),ye=await(await fetch(`/api/run-node-statuses?${ne}`)).json();if(x)return;const Fe=ye.statuses&&typeof ye.statuses=="object"?ye.statuses:{},ce={},$e=new Set;for(const[ke,ht]of Object.entries(Fe))ht&&typeof ht=="object"&&typeof ht.status=="string"&&(ce[ke]={status:ht.status,...ht.elapsed!=null&&String(ht.elapsed).trim()!==""?{elapsed:String(ht.elapsed)}:{}},ht.status==="running"&&$e.add(ke));lt(ce),Hn($e);try{const ke=new URLSearchParams({flowId:u.id,runId:J,sinceBytes:"0",tailBytes:"262144"}),ht=await fetch(`/api/run-log?${ke}`);if(ht.ok){const fn=await ht.json();if(!x){Yi.current=Number(fn.bytes||0);const pn=Gj(typeof fn.text=="string"?fn.text:"");mt([...pn,...ee]);return}}}catch{}}mt(ee)}catch{}})(),()=>{x=!0}},[u==null?void 0:u.id]),h.useEffect(()=>{if(Oe==="edit"||!(u!=null&&u.id)||!cn)return;let x=!1,N=null;const H=async()=>{try{const q=new URLSearchParams({flowId:u.id,runId:cn}),Y=await fetch(`/api/run-node-statuses?${q}`);if(!Y.ok)return;const J=await Y.json();if(x)return;const ee=J.statuses&&typeof J.statuses=="object"?J.statuses:{},ne={},he=new Set;for(const[ye,Fe]of Object.entries(ee))Fe&&typeof Fe=="object"&&typeof Fe.status=="string"&&(ne[ye]={status:Fe.status,...Fe.elapsed!=null&&String(Fe.elapsed).trim()!==""?{elapsed:String(Fe.elapsed)}:{}},Fe.status==="running"&&he.add(ye));lt(ye=>b7(ye,ne)?ye:ne),Hn(ye=>v7(ye,he)?ye:he);try{const ye=new URLSearchParams({flowId:u.id,runId:cn,sinceBytes:String(Yi.current||0),tailBytes:String(g7)}),Fe=await fetch(`/api/run-log?${ye}`);if(Fe.ok){const ce=await Fe.json();if(x)return;const $e=Number(ce.bytes||0),ke=typeof ce.text=="string"?ce.text:"";if(ke){const ht=Gj(ke);ht.length>0&&mt(fn=>[...fn,...ht])}Yi.current=$e}}catch{}try{const ye=await fetch("/api/pipeline-recent-runs");if(!ye.ok)return;const Fe=await ye.json();if(x)return;const $e=(Array.isArray(Fe.runs)?Fe.runs:[]).find(ke=>ke.flowId===u.id&&ke.runId===cn);if($e&&$e.status){const ke=$e.status;ke==="running"?Bt(ht=>ht==="running"?ht:"running"):ke==="success"?Bt("done"):ke==="failed"?Bt("error"):(ke==="stopped"||ke==="interrupted")&&Bt("stopped")}}catch{}}catch{}};return H(),N=window.setInterval(H,2500),()=>{x=!0,N&&window.clearInterval(N)}},[Oe,u==null?void 0:u.id,cn]),h.useEffect(()=>{if(it!=="history"||!u)return;let x=!1;return(async()=>{hi(!0),Ke("");try{const N=await fetch("/api/pipeline-recent-runs"),H=await N.json();if(!N.ok)throw new Error(H.error||"HTTP "+N.status);x||Ge(Array.isArray(H.runs)?H.runs:[])}catch(N){x||(Ke(String(N.message||N)),Ge([]))}finally{x||hi(!1)}})(),()=>{x=!0}},[it,u]),h.useEffect(()=>{if(!u){qs({files:[]});return}let x=!1;return(async()=>{ca(!0);try{const N=new URLSearchParams({flowId:u.id,flowSource:u.source||"user",archived:u.archived?"1":"0"}),H=await fetch(`/api/pipeline-files?${N}`),q=await H.json();if(!H.ok)throw new Error(q.error||"HTTP "+H.status);x||qs({files:Array.isArray(q.files)?q.files:[],path:q.path,error:q.error})}catch(N){x||qs({files:[],error:N.message||String(N)})}finally{x||ca(!1)}})(),()=>{x=!0}},[u]);const ld=h.useMemo(()=>u?Ce.filter(x=>x&&x.flowId===u.id).sort((x,N)=>N.at-x.at):[],[Ce,u]),ns=h.useMemo(()=>{let x=0,N=0,H=0,q=0,Y=0;for(const J of ld){const ee=J.status||"unknown";ee==="success"?x+=1:ee==="failed"?N+=1:ee==="running"?H+=1:ee==="stopped"?q+=1:ee==="interrupted"&&(Y+=1)}return{success:x,failed:N,running:H,stopped:q,interrupted:Y}},[ld]),cd=h.useMemo(()=>u?Wj(us,wc):null,[u,us,wc]),_i=h.useMemo(()=>{if(!cd||!u)return[];const x=cd.query.toLowerCase(),N=Y=>x?Y.some(J=>J&&String(J).toLowerCase().includes(x)):!0,H=It.map(Y=>{var ye,Fe;const J=Y.id,ee=String(((ye=Y.data)==null?void 0:ye.label)??J),ne=(Fe=Y.data)!=null&&Fe.definitionId?String(Y.data.definitionId):"",he=[ee!==J?ee:"",ne&&ne!==J?ne:""].filter(Boolean);return{id:J,label:ee,defId:ne,subs:he}}).filter(({id:Y,label:J,defId:ee})=>N([Y,J,ee])).sort((Y,J)=>Y.id.localeCompare(J.id)).slice(0,18).map(({id:Y,label:J,defId:ee})=>{const ne=[J!==Y?J:null,ee||null].filter(Boolean).join(" · ")||void 0;return{kind:"instance",id:Y,title:Y,subtitle:ne}}),q=ae.filter(Y=>Y&&Y.id&&N([Y.id,Y.label,Y.description])).sort((Y,J)=>Y.id.localeCompare(J.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[...H,...q]},[cd,It,ae,u]),ud=h.useMemo(()=>{const x=_i.filter(H=>H.kind==="instance"),N=_i.filter(H=>H.kind==="definition");return{instances:x,definitions:N}},[_i]);h.useEffect(()=>{ga(x=>{const N=Math.max(0,_i.length-1);return Math.min(Math.max(0,x),N)})},[_i]);const I0=h.useMemo(()=>a7(us),[us]),Lr=h.useMemo(()=>It.filter(x=>x.selected),[It]),iy=h.useMemo(()=>new Set(Lr.map(x=>x.id)),[Lr]),Op=h.useMemo(()=>un.filter(x=>iy.has(x.source)&&iy.has(x.target)),[un,iy]),T0=h.useMemo(()=>{const x=Pe.trim().toLowerCase();return x?ct.filter(N=>[N.id,N.version,N.displayName,N.name,N.description,...Array.isArray(N.tags)?N.tags:[]].filter(Boolean).some(H=>String(H).toLowerCase().includes(x))):ct},[ct,Pe]),R0=h.useCallback((x,N)=>{const H=String(x||"snippet-node").trim().replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"snippet-node",q=Date.now().toString(36);let Y=`${H}-${q}`,J=2;for(;N.has(Y);)Y=`${H}-${q}-${J}`,J+=1;return N.add(Y),Y},[]),L0=h.useCallback((x,N)=>{var Xt,rs;if(!u||!x)return;const H=x.snippet&&typeof x.snippet=="object"?x.snippet:{},q=H.instances&&typeof H.instances=="object"?H.instances:{},Y=Object.keys(q);if(Y.length===0)return;const J=new Set(I.current.map(We=>We.id)),ee={};for(const We of Y)ee[We]=R0(We,J);const ne=(Xt=H.ui)!=null&&Xt.nodePositions&&typeof H.ui.nodePositions=="object"?H.ui.nodePositions:{},he=(rs=H.ui)!=null&&rs.nodeSizes&&typeof H.ui.nodeSizes=="object"?H.ui.nodeSizes:{},ye=Y.map(We=>{const hn=ne[We];return{id:We,x:typeof(hn==null?void 0:hn.x)=="number"?hn.x:0,y:typeof(hn==null?void 0:hn.y)=="number"?hn.y:0}}),Fe=Math.min(...ye.map(We=>We.x)),ce=Math.min(...ye.map(We=>We.y));let $e=N||{x:180,y:160};const ke=Ci.current,ht=document.querySelector(".af-pipeline-flow .react-flow");if(!N&&ke&&ht){const We=ht.getBoundingClientRect();$e=ke.screenToFlowPosition({x:We.left+We.width*.48,y:We.top+We.height*.32})}const fn={};for(const We of Y)fn[ee[We]]={...q[We]||{}};gr.current={...gr.current,...fn};const pn=Y.map(We=>{const hn=q[We]||{},so=ye.find(fd=>fd.id===We)||{x:0,y:0},Pi=he[We]&&typeof he[We].width=="number"&&typeof he[We].height=="number"?{width:he[We].width,height:he[We].height}:null,$l={id:ee[We],type:"flowNode",selected:!0,position:{x:$e.x+(so.x-Fe),y:$e.y+(so.y-ce)},...Pi?{width:Pi.width,height:Pi.height}:{},data:{label:hn.label||ee[We],definitionId:hn.definitionId||We,role:hn.role||"normal",body:hn.body||"",script:hn.script||"",...Pi?{displaySize:Pi}:{}}};return Bf($l,gr.current,ae,{},u.id)}),Vt=new Set(Y),vt=(Array.isArray(H.edges)?H.edges:[]).filter(We=>Vt.has(We==null?void 0:We.source)&&Vt.has(We==null?void 0:We.target)).map((We,hn)=>({id:`e-${ee[We.source]}-${ee[We.target]}-${Date.now()}-${hn}`,source:ee[We.source],target:ee[We.target],sourceHandle:We.sourceHandle??void 0,targetHandle:We.targetHandle??void 0,markerEnd:{type:Ns.ArrowClosed}}));wt(We=>[...We.map(hn=>({...hn,selected:!1})),...pn]),en(We=>[...We.map(hn=>({...hn,selected:!1})),...vt]),j(`已添加流程片段:${x.displayName||x.id}`)},[R0,ae,u,en,wt]);te.current=L0;const dR=h.useCallback(()=>{var H,q;if(Lr.length<2){tn("请先在画布上选择至少两个节点。"),Ie("flows");return}const x=Lr[0],N=Lr.length===2?`${((H=x.data)==null?void 0:H.label)||x.id} 片段`:`${((q=x.data)==null?void 0:q.label)||x.id} 等 ${Lr.length} 个节点`;Rn({name:N,id:N.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),ze(""),Tn(!0),Ie("flows")},[Lr]),fR=h.useCallback(async()=>{var J,ee;if(!u||Lr.length<2)return;const x=zt.name.trim();if(!x){ze("请填写片段名称。");return}const N=ap(Lr,gr.current),H={},q={};for(const ne of Lr){H[ne.id]={x:((J=ne.position)==null?void 0:J.x)||0,y:((ee=ne.position)==null?void 0:ee.y)||0};const he=N7(ne);he&&(q[ne.id]=he)}const Y=Op.map(ne=>({source:ne.source,target:ne.target,sourceHandle:ne.sourceHandle??null,targetHandle:ne.targetHandle??null}));le(!0),ze("");try{const ne=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:zt.id,name:x,displayName:x,version:"1.0.0",description:zt.description,snippet:{instances:N,edges:Y,ui:{nodePositions:H,nodeSizes:q}}})}),he=await ne.json().catch(()=>({}));if(!ne.ok||(he==null?void 0:he.ok)===!1)throw new Error((he==null?void 0:he.error)||"Publish failed");Tn(!1),j(`流程片段已发布:${he.id||x}`),Eo(`流程片段已发布:${he.id||x}`),await _t(),Ie("flows")}catch(ne){ze(String(ne.message||ne))}finally{le(!1)}},[u,Lr,Op,zt,_t,Eo]),Mp=h.useMemo(()=>{const x=[],N=new Set;for(const Y of Lr)N.add(Y.id),x.push({node:Y,kind:"canvas"});const H=new Map(It.map(Y=>[Y.id,Y])),q=new Map(ae.map(Y=>[Y.id,Y]));for(const Y of I0){if(N.has(Y))continue;const J=H.get(Y);if(J){N.add(Y),x.push({node:J,kind:"mention"});continue}const ee=q.get(Y);ee&&(N.add(Y),x.push({definition:ee,kind:"definition"}))}return x},[Lr,I0,It,ae]),fs=h.useMemo(()=>{const x=Array.isArray(xt==null?void 0:xt.cursor)?xt.cursor:[],N=Array.isArray(xt==null?void 0:xt.opencode)?xt.opencode:[],H=Array.isArray(xt==null?void 0:xt.claudeCode)?xt.claudeCode:[],q=N.map(ye=>`opencode:${Uo(ye)}`),Y=H.map(ye=>`claude-code:${Uo(ye)}`),J=new Set([...x,...N,...H].map(Uo).concat(q).concat(Y)),ee=(to||"").trim(),ne=bh(to,x,N,H),he=ne&&!J.has(ne)&&!J.has(ee)?ee:"";return{cursorList:x,opencodeList:N,claudeCodeList:H,currentNotInLists:he}},[xt,to]),oy=h.useMemo(()=>new Set(Mt),[Mt]),ay=Mt.length,$p=h.useMemo(()=>{const x=new Map(Wr.map(J=>[J.key,J])),N=new Set,H=new Set,q=Nc.map(J=>{const ee=sl(J,Wr).map(ne=>x.get(ne)).filter(Boolean);for(const ne of ee)N.add(ne.key),H.add(String(ne.name||ne.id||ne.key||"").trim());return{...J,skills:ee}}).filter(J=>J.skills.length>0),Y=Wr.filter(J=>{const ee=String(J.name||J.id||J.key||"").trim();return!N.has(J.key)&&!H.has(ee)});return{groups:q,ungrouped:Y}},[Nc,Wr]),Ac=h.useCallback(()=>{const x=Do.current;if(!x)return;const N=x.getBoundingClientRect(),H=Math.min(400,Math.max(300,window.innerWidth-24)),q=Math.min(Math.max(12,N.right-H),window.innerWidth-H-12),Y=Math.max(140,N.top-22),J=Math.min(360,Y);nd({position:"fixed",left:`${q}px`,top:`${Math.max(12,N.top-J-10)}px`,width:`${H}px`,maxHeight:`${J}px`})},[]);h.useEffect(()=>{const x=Array.isArray(xt==null?void 0:xt.cursor)?xt.cursor:[],N=Array.isArray(xt==null?void 0:xt.opencode)?xt.opencode:[],H=Array.isArray(xt==null?void 0:xt.claudeCode)?xt.claudeCode:[];ds(q=>{const Y=bh(q,x,N,H);return Y===q?q:Y})},[xt.cursor,xt.opencode,xt.claudeCode]),h.useEffect(()=>{if(!ka)return;Ac();const x=H=>{var Y,J;const q=H.target;(Y=Do.current)!=null&&Y.contains(q)||(J=kp.current)!=null&&J.contains(q)||$o(!1)},N=H=>{H.key==="Escape"&&$o(!1)};return window.addEventListener("resize",Ac),window.addEventListener("scroll",Ac,!0),document.addEventListener("pointerdown",x),document.addEventListener("keydown",N),()=>{window.removeEventListener("resize",Ac),window.removeEventListener("scroll",Ac,!0),document.removeEventListener("pointerdown",x),document.removeEventListener("keydown",N)}},[ka,Ac]);const Ml=h.useCallback(async(x,N={})=>{var vt;if(!u||Sa.current)return;const H=N.phaseContextSnapshot,q=(typeof x=="string"?x:us).trim();if(!q)return;const Y=id.current;Sa.current=!0,Ep(!0),Zs(e("flow:composer.connecting")),re(Xt=>Xt!=="composer"?"composer":Xt);const J=[...Pl];if(Y.length>0&&J.push({type:"assistant",segments:[...Y]}),ad([...J,{type:"user",text:q}]),J.filter(Xt=>Xt.type==="user").length===0){const Xt=q.replace(/\s+/g," ").slice(0,30)+(q.length>30?"…":"");es(rs=>rs.map(We=>We.id===mr?{...We,label:Xt}:We))}const ee=J.map(Xt=>Xt.type==="user"?{role:"user",text:Xt.text}:{role:"assistant",text:(Xt.segments||[]).filter(We=>We.kind==="assistant"||We.kind==="result").map(We=>We.text).join(`
|
|
134
|
-
`)}).filter(Xt=>Xt.text),ne=H??jt;vl(""),Rs([]),Al([]),_p(!1);const he=new AbortController;Cc.current=he,no.current=mr;let ye=null;const Fe=Array.isArray(xt==null?void 0:xt.cursor)?xt.cursor:[],ce=Array.isArray(xt==null?void 0:xt.opencode)?xt.opencode:[],$e=Array.isArray(xt==null?void 0:xt.claudeCode)?xt.claudeCode:[],ke=bh(to,Fe,ce,$e),ht=Mp.filter(Xt=>Xt.kind!=="definition"&&Xt.node).map(Xt=>Xt.node.id),fn=u;let pn=!1,Vt=!1;try{ye=setTimeout(()=>he.abort(),12e4);const Xt={prompt:q,model:ke,flowId:u.id,flowSource:u.source??"user",...u.archived?{flowArchived:!0}:{},contextInstanceIds:ht,thread:ee,selectedSkills:Mt};ne&&ne.nextPhase&&!ne.isLastPhase&&(Xt.phaseContext={phaseIndex:ne.nextPhase.index,phases:ne.phases,userPromptOriginal:ne.userPromptOriginal||q}),kc&&(Xt.phaseRole=kc);const rs=await fetch("/api/composer-agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Xt),signal:he.signal});if(ye&&(clearTimeout(ye),ye=null),!rs.ok){let Pi=rs.statusText||e("flow:composer.requestFailed");try{const $l=await rs.json();$l&&$l.error&&(Pi=String($l.error))}catch{}Zs(Pi),Rs([{kind:"error",text:Pi}]);return}const We=(vt=rs.body)==null?void 0:vt.getReader();if(!We){Zs(e("flow:composer.cannotReadStream"));return}const hn=new TextDecoder;let so="";for(;;){const{done:Pi,value:$l}=await We.read();if(Pi)break;for(so+=hn.decode($l,{stream:!0});;){const fd=so.indexOf(`
|
|
135
|
-
`);if(fd<0)break;const B0=so.slice(0,fd).trim();if(so=so.slice(fd+1),!B0)continue;let Ve;try{Ve=JSON.parse(B0)}catch{continue}if(Ve.type==="status"&&typeof Ve.line=="string"&&Zs(Ve.line),Ve.type==="natural"&&typeof Ve.text=="string"&&Ve.text){const xn=typeof Ve.kind=="string"&&Ve.kind?Ve.kind:"assistant";Rs(mn=>[...mn,{kind:xn,text:Ve.text}])}if(Ve.type==="error"&&Ve.message){Vt=!0;const xn=Ve.code?` [${Ve.code}]`:"",mn=String(Ve.message)+xn;Zs(mn),Rs(ps=>[...ps,{kind:"error",text:mn}])}if(Ve.type==="plan"&&Array.isArray(Ve.steps)){Al(Ve.steps.map(mn=>({...mn,status:"pending"})));const xn=Ve.steps.map((mn,ps)=>`${ps+1}. ${mn.description||mn.type}`).join(`
|
|
136
|
-
`);Rs(mn=>[...mn,{kind:"assistant",text:e("flow:composer.taskPlan",{count:Ve.steps.length,summary:xn})}])}if(Ve.type==="step-start"){const xn=Ve.index??0,mn=Ve.total??0,ps=Ve.tier?` [${Ve.tier}]`:"",xR=Ve.model?` (${Ve.model})`:"";Zs(e("flow:composer.step",{current:xn+1,total:mn,description:(Ve.description||"")+ps+xR})),Al(wR=>wR.map(Ic=>Ic.index===xn?{...Ic,status:"running",model:Ve.model,tier:Ve.tier,nodeRole:Ve.nodeRole??Ic.nodeRole,instanceId:Ve.instanceId??Ic.instanceId,instanceLabel:Ve.instanceLabel??Ic.instanceLabel}:Ic))}if(Ve.type==="step-progress"){const xn=Ve.index??0,mn=Ve.total??0;Zs(e("flow:composer.step",{current:xn+1,total:mn,description:Ve.description||""}))}if(Ve.type==="step-done"){const xn=Ve.index??0;Al(mn=>mn.map(ps=>ps.index===xn?{...ps,status:Ve.success?"done":"error"}:ps))}if(Ve.type==="phase-plan"&&Array.isArray(Ve.phases)){Il(mn=>({...mn||{},phases:Ve.phases,currentPhase:Ve.currentPhase??0,phaseTotal:Ve.phaseTotal??Ve.phases.length,phaseName:Ve.phaseName||"",isLastPhase:!1,nextPhase:null,userPromptOriginal:(mn==null?void 0:mn.userPromptOriginal)||q}));const xn=Ve.phases.map((mn,ps)=>`${ps+1}. ${mn.label}`).join(" → ");Rs(mn=>[...mn,{kind:"assistant",text:e("flow:composer.phaseGeneration",{count:Ve.phases.length,labels:xn,current:Ve.phaseName||""})}])}Ve.type==="phase-complete"&&(Il(xn=>{var ps;return{...xn||{},phases:Ve.phases||(xn==null?void 0:xn.phases)||[],currentPhase:Ve.phaseIndex??0,phaseTotal:Ve.phaseTotal??((ps=Ve.phases)==null?void 0:ps.length)??0,phaseName:Ve.phaseName||"",isLastPhase:!!Ve.isLastPhase,nextPhase:Ve.nextPhase||null,userPromptOriginal:Ve.userPromptOriginal||(xn==null?void 0:xn.userPromptOriginal)||q}}),!Ve.isLastPhase&&Ve.nextPhase&&Rs(xn=>[...xn,{kind:"assistant",text:e("flow:composer.phaseComplete",{phaseName:Ve.phaseName||e("flow:composer.nextPhase"),nextPhase:Ve.nextPhase.label})}])),Ve.type==="done"&&(pn=!0,Zs(xn=>xn||e("flow:composer.done")))}}}catch(Xt){const rs=Xt;if(rs.name==="AbortError"){const We=e(ye?"flow:composer.connectTimeout":"flow:composer.aborted");Zs(We),Rs(hn=>[...hn,{kind:"error",text:We}])}else{const We=rs.code||rs.name||"UNKNOWN",hn=`${rs.message||String(Xt)} [${We}]`;Zs(hn),Rs(so=>[...so,{kind:"error",text:hn}])}}finally{if(Sa.current=!1,Ep(!1),Cc.current=null,no.current=null,ye&&clearTimeout(ye),pn&&fn){const Xt={id:fn.id,source:fn.source??"user",archived:fn.archived};(async()=>(await Nt(Xt,{preserveComposer:!0,incrementalSync:!0}),await Wn(Xt,{quiet:!0,force:!0})))()}}},[u,us,to,xt,Mp,Nt,Wn,Pl,mr,jt,kc,Mt]);ji.current=Ml;const O0=h.useCallback(()=>{!jt||jt.isLastPhase||(Il(null),Ml(e("flow:composer.skipRemainingPhases")))},[jt,Ml]),M0=h.useCallback(()=>{if(!jt||jt.isLastPhase||!jt.nextPhase)return;const x=String(jt.nextPhase.label||"").trim()||e("flow:composer.nextPhase");Ml(e("flow:composer.continuePhase",{label:x}),{phaseContextSnapshot:jt})},[jt,Ml]);h.useEffect(()=>{if(!od)return;const x=N=>{N.key==="Escape"&&Ni(!1)};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[od]),h.useEffect(()=>{Oe!=="edit"&&Ni(!1)},[Oe]),h.useLayoutEffect(()=>{const x=wa.current;if(!x)return;if(!u){x.style.height="";return}x.style.height="0px";const N=getComputedStyle(x),H=parseFloat(N.lineHeight),q=(parseFloat(N.paddingTop)||0)+(parseFloat(N.paddingBottom)||0),Y=Number.isFinite(H)&&H>0?H:13*1.45,J=q+Y*2,ee=q+Y*10,ne=Math.min(Math.max(x.scrollHeight,J),ee);x.style.height=`${ne}px`},[us,u]);const ly=h.useCallback(x=>{const N=us,H=wc,q=Wj(N,H);if(!q)return;const Y=N.slice(0,q.atIndex)+`@${x} `+N.slice(H);vl(Y);const J=q.atIndex+x.length+2;queueMicrotask(()=>{const ee=wa.current;ee&&(ee.focus(),ee.setSelectionRange(J,J)),ha(J)})},[us,wc]),cy=h.useCallback(x=>{vl(N=>{const H=`@${x}`,q=N.indexOf(H);return q<0?N:N.slice(0,q)+N.slice(q+H.length)})},[]),$0=h.useCallback(x=>{x.kind==="canvas"?wt(N=>N.map(H=>H.id===x.node.id?{...H,selected:!1}:H)):x.kind==="mention"?cy(x.node.id):cy(x.definition.id)},[wt,cy]),pR=h.useCallback(()=>{re(x=>x==="history"?null:"history")},[]),hR=h.useCallback(()=>{re(x=>x==="settings"?null:"settings")},[]),mR=h.useCallback(()=>{re(x=>x==="composer"?null:"composer")},[]),dd=h.useCallback(()=>{re(x=>(x==="node"&&ba.current&&(vc.current=ba.current.id),null))},[]),D0=h.useCallback(()=>{xa(x=>!x)},[]),gR=()=>{if(!u)return null;const x=nr||u.archived||si(u.source),N=Mn!=null&&Mn.running?e("flow:schedule.running"):lr.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled"),H=Mn!=null&&Mn.running?"running":lr.enabled?"waiting":"disabled",q=nn.slice(0,12),Y=u.archived||si(u.source);return o.jsxs("section",{className:"af-pipeline-settings-page","aria-label":e("flow:settings.title"),children:[o.jsxs("aside",{className:"af-pipeline-settings-nav","aria-label":e("flow:settings.sectionNav"),children:[o.jsx("div",{className:"af-pipeline-settings-nav-title",children:e("flow:settings.title")}),o.jsxs("a",{href:"#pipeline-basic",className:"af-pipeline-settings-nav-item af-pipeline-settings-nav-item--active",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"badge"}),e("flow:settings.basicInfo")]}),o.jsxs("a",{href:"#pipeline-storage",className:"af-pipeline-settings-nav-item",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder_open"}),e("flow:settings.storageAndPath")]}),o.jsxs("a",{href:"#pipeline-marketplace",className:"af-pipeline-settings-nav-item",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"deployed_code"}),e("flow:settings.nodeMarketplace")]}),o.jsxs("a",{href:"#pipeline-schedule",className:"af-pipeline-settings-nav-item",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"schedule"}),e("flow:schedule.title")]}),o.jsxs("a",{href:"#pipeline-metadata",className:"af-pipeline-settings-nav-item",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"dataset"}),e("flow:pipeline.metadata")]}),o.jsxs("button",{type:"button",className:"af-pipeline-settings-nav-link",onClick:()=>n("/settings"),children:[e("flow:settings.globalSettings"),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"})]})]}),o.jsxs("main",{className:"af-pipeline-settings-main",children:[o.jsxs("div",{className:"af-pipeline-settings-main-head",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"af-pipeline-settings-title",children:e("flow:settings.title")}),o.jsx("p",{className:"af-pipeline-settings-subtitle",children:e("flow:settings.subtitle")})]}),o.jsxs("button",{type:"button",className:"af-btn-secondary",onClick:dd,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),e("flow:settings.backToCanvas")]})]}),o.jsxs("section",{id:"pipeline-basic",className:"af-pipeline-settings-section",children:[o.jsxs("div",{className:"af-pipeline-settings-section-head",children:[o.jsx("span",{className:"af-pipeline-settings-section-index",children:"1."}),o.jsx("h2",{children:e("flow:settings.basicInfo")})]}),o.jsxs("div",{className:"af-pipeline-settings-grid af-pipeline-settings-grid--two",children:[o.jsxs("div",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.pipelineId")}),(u.source==="user"||u.source==="workspace")&&!u.archived?o.jsxs("div",{className:"af-pipeline-rename-row",children:[o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:F,onChange:J=>{z(J.target.value),M("")},onKeyDown:J=>{J.key==="Enter"&&(J.preventDefault(),Ip())},onBlur:()=>{F.trim()&&F.trim()!==u.id&&Ip()},placeholder:u.id,disabled:L,spellCheck:!1}),o.jsx("span",{className:"af-pipeline-drawer-badge",children:$c(u.source??"user",e)})]}):o.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[u.id,o.jsx("span",{className:"af-pipeline-drawer-badge",children:$c(u.source??"user",e)}),u.archived?o.jsx("span",{className:"af-pipeline-drawer-badge af-pipeline-drawer-badge--muted",children:e("flow:settings.archived")}):null]}),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"}),u.owner||"bigo"]})]})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.introduction")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea af-pipeline-settings-textarea",value:b,onChange:J=>v(J.target.value),placeholder:e("flow:pipeline.introductionPlaceholder"),rows:4,spellCheck:!1})]})]}),o.jsxs("section",{id:"pipeline-storage",className:"af-pipeline-settings-section",children:[o.jsxs("div",{className:"af-pipeline-settings-section-head",children:[o.jsx("span",{className:"af-pipeline-settings-section-index",children:"2."}),o.jsx("h2",{children:e("flow:settings.storageAndPath")})]}),typeof u.path=="string"&&u.path?o.jsxs("div",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.diskPath")}),o.jsxs("div",{className:"af-pipeline-drawer-readonly af-pipeline-drawer-readonly--mono af-pipeline-path-row",children:[o.jsx("span",{className:"af-pipeline-path-text",children:u.path}),o.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-copy-btn",onClick:()=>E0(u.path),title:e("flow:settings.copyPath"),children:o.jsx("span",{className:"material-symbols-outlined",children:T?"check":"content_copy"})})]})]}):null,u.source==="user"||u.source==="workspace"?u.archived?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.archivedNote")}):o.jsxs("div",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.storageLocation")}),o.jsx("div",{className:"af-pipeline-move-actions",children:u.source==="user"?o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:$,onClick:()=>Ap("workspace"),children:e($?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:$,onClick:()=>Ap("user"),children:e($?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),A?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:A}):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:[nn.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:on,disabled:yn,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),e(yn?"common:common.loading":"common:common.refresh")]})]}),rn?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:rn}):null,yn?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(J=>{const ee=J.definitionId||`marketplace:${J.id}${J.version?`@${J.version}`:""}`,ne=De.has(ee)||De.has(`marketplace:${J.id}`),he=nt.find($e=>String($e.id)===ee||String($e.id)===`marketplace:${J.id}`),ye=Zt===ee,Fe=wh(J.inputs||J.input),ce=wh(J.outputs||J.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:J.displayName||J.label||J.id}),o.jsx("span",{children:J.version?`v${J.version}`:ee})]}),o.jsx("p",{className:"af-pipeline-market-purpose",children:J.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:Fe.length>0?Fe.map($e=>o.jsx("span",{className:"af-pipeline-market-chip",children:$e},`in-${ee}-${$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:ce.length>0?ce.map($e=>o.jsx("span",{className:"af-pipeline-market-chip",children:$e},`out-${ee}-${$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:()=>Re(J),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||ye,onClick:()=>{ne&&he?(C0(he),re(null)):an(J)},children:e(ye?"flow:settings.installingNode":ne?"flow:settings.addInstalledNode":"flow:settings.installNode")})]})]},ee)})}):o.jsx("div",{className:"af-pipeline-settings-empty",children:e("flow:settings.marketplaceEmpty")})]}),o.jsxs("section",{id:"pipeline-schedule",className:"af-pipeline-settings-section",children:[o.jsxs("div",{className:"af-pipeline-settings-section-head",children:[o.jsx("span",{className:"af-pipeline-settings-section-index",children:"4."}),o.jsx("h2",{children:e("flow:schedule.title")})]}),hl?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:!!lr.enabled,disabled:x,onChange:J=>Rr(ee=>({...ee,enabled:J.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:lr.cron||"",disabled:x,onChange:J=>Rr(ee=>({...ee,cron:J.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:lr.timezone||"",disabled:x,onChange:J=>Rr(ee=>({...ee,timezone:J.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:lr.preset||"",disabled:x,onChange:J=>Rr(ee=>({...ee,preset:J.target.value})),children:[o.jsx("option",{value:"",children:e("flow:schedule.defaultPreset")}),Object.keys(Cr).map(J=>o.jsx("option",{value:J,children:J},J))]})]})]}),o.jsxs("div",{className:"af-pipeline-settings-schedule-status",children:[o.jsx("span",{className:`af-pipeline-settings-status-dot af-pipeline-settings-status-dot--${H}`}),o.jsx("span",{children:lr.nextRunAt?e("flow:schedule.nextRun",{time:new Date(lr.nextRunAt).toLocaleString()}):e("flow:schedule.noNextRun")}),o.jsxs("span",{children:[e("flow:schedule.runtime"),":",N]})]}),o.jsxs("dl",{className:"af-pipeline-meta-dl af-pipeline-settings-dl",children:[Yt.lastTriggeredAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),o.jsx("dd",{children:new Date(Yt.lastTriggeredAt).toLocaleString()})]}):null,Yt.lastSkippedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),o.jsxs("dd",{children:[new Date(Yt.lastSkippedAt).toLocaleString(),Yt.lastSkipReason?` · ${Yt.lastSkipReason}`:""]})]}):null,Yt.lastRunUuid?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastRun")}),o.jsx("dd",{children:Yt.lastRunUuid})]}):null,Yt.lastExitCode!=null?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastExit")}),o.jsx("dd",{children:String(Yt.lastExitCode)})]}):null,Yt.lastFinishedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),o.jsx("dd",{children:new Date(Yt.lastFinishedAt).toLocaleString()})]}):null]}),Mn!=null&&Mn.lastError||Yt.lastError?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(Mn==null?void 0:Mn.lastError)||Yt.lastError}):null,u.archived||si(u.source)?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,Xi?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Xi}):null,Ro?o.jsx("p",{className:"af-pipeline-drawer-muted",children:Ro}):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:[It.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:nt.length})]}),o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:settings.source")}),o.jsx("dd",{children:$c(u.source??"user",e)})]})]})]})]}),o.jsxs("aside",{className:"af-pipeline-settings-side","aria-label":e("flow:settings.overview"),children:[o.jsxs("section",{className:"af-pipeline-settings-side-card",children:[o.jsxs("div",{className:"af-pipeline-settings-overview-head",children:[o.jsx("span",{className:"af-pipeline-settings-overview-icon material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),o.jsxs("div",{children:[o.jsx("h2",{children:u.id}),o.jsx("span",{className:`af-pipeline-settings-status af-pipeline-settings-status--${H}`,children:N})]})]}),o.jsxs("dl",{className:"af-pipeline-settings-side-dl",children:[o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:pipeline.nodeCount")}),o.jsx("dd",{children:It.length})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.owner")}),o.jsx("dd",{children:u.owner||"bigo"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.source")}),o.jsx("dd",{children:$c(u.source??"user",e)})]})]})]}),o.jsxs("section",{className:"af-pipeline-settings-side-card",children:[o.jsx("h2",{children:e("flow:settings.quickActions")}),o.jsxs("button",{type:"button",className:"af-btn-primary af-pipeline-settings-side-action",onClick:()=>void Q2(),disabled:nr,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"}),e(nr?"flow:settings.savingChanges":"flow:settings.saveChanges")]}),o.jsxs("button",{type:"button",className:"af-btn-secondary af-pipeline-settings-side-action",onClick:dd,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")})]})]})]})},yR=()=>{const x=xe;if(!x)return null;const N=x.definitionId||`marketplace:${x.id}${x.version?`@${x.version}`:""}`,H=x.displayName||x.label||x.id,q=wh(x.inputs||x.input),Y=wh(x.outputs||x.output);return Mr.createPortal(o.jsx("div",{className:"af-market-preview-overlay",role:"dialog","aria-modal":"true","aria-label":e("flow:settings.nodePreviewTitle"),onMouseDown:J=>{J.target===J.currentTarget&&Re(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:H})]}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Re(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((J,ee)=>o.jsx("span",{title:J},`preview-in-${ee}`))}),o.jsxs("div",{className:"af-market-preview-node-main",children:[o.jsx("span",{className:"af-market-preview-node-icon material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("strong",{children:H}),o.jsx("span",{children:N})]}),o.jsx("div",{className:"af-market-preview-node-ports af-market-preview-node-ports--right",children:(Y.length>0?Y:[""]).slice(0,4).map((J,ee)=>o.jsx("span",{title:J},`preview-out-${ee}`))})]})}),o.jsxs("section",{className:"af-market-preview-section",children:[o.jsx("h3",{children:e("flow:settings.nodeFunction")}),o.jsx("p",{children:x.description||e("flow:settings.marketplaceNoDescription")})]}),o.jsxs("div",{className:"af-market-preview-io-grid",children:[o.jsxs("section",{className:"af-market-preview-section",children:[o.jsx("h3",{children:"Inputs"}),o.jsx("div",{className:"af-pipeline-market-chips af-market-preview-chips",children:q.length>0?q.map(J=>o.jsx("span",{className:"af-pipeline-market-chip",children:J},`preview-input-${J}`)):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(J=>o.jsx("span",{className:"af-pipeline-market-chip",children:J},`preview-output-${J}`)):o.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noOutputs")})})]})]}),o.jsxs("section",{className:"af-market-preview-section",children:[o.jsx("h3",{children:e("flow:settings.nodePackageInfo")}),o.jsxs("dl",{className:"af-market-preview-dl",children:[o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.definitionId")}),o.jsx("dd",{children:N})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.version")}),o.jsx("dd",{children:x.version||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.packagePath")}),o.jsx("dd",{children:x.packageDir||"-"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:e("flow:settings.packagedFiles")}),o.jsx("dd",{children:Array.isArray(x.packagedFiles)&&x.packagedFiles.length>0?x.packagedFiles.map(J=>J.to||J).join(", "):"-"})]})]})]})]})]})}),document.body)};return o.jsxs(Mg,{children:[o.jsx(m7,{onReady:a}),o.jsxs(CT.Provider,{value:{modelLists:xt,onModelChange:Z2},children:[o.jsxs("div",{className:"af-pipeline-page"+(Oe!=="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:()=>{Oe==="running"?Lp(!0):Oe!=="edit"?Ol():n("/projects")},"aria-label":e(Oe!=="edit"?"flow:topbar.backToEdit":"flow:topbar.backToProjects"),title:e(Oe!=="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",KK,"-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(Nm(u,"workspace")),children:"Workspace"}),o.jsx("button",{type:"button",onClick:()=>n(Nm(u,"display")),children:"Display"})]})]}),o.jsxs("div",{className:"af-pipeline-top-right af-flow-toolbar-actions",children:[jr&&o.jsx("button",{type:"button",className:"af-icon-btn"+(Ps?" af-icon-btn--active":""),"aria-label":"Composer Logs (dev)",title:"Composer Logs (dev)",onClick:()=>Po(x=>!x),children:o.jsx("span",{className:"material-symbols-outlined",children:"description"})}),Oe==="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:hx(On,"running")})]}),Oe==="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:hx(On,"stopped")})]}),(Oe==="done"||Oe==="error")&&o.jsxs("div",{className:"af-run-timer"+(Oe==="error"?" af-run-timer--error":" af-run-timer--done"),children:[o.jsx("span",{className:"af-run-timer__label",children:Oe==="error"?"FAILED":"COMPLETED"}),o.jsx("span",{className:"af-run-timer__value",children:hx(On,Oe)})]}),Oe!=="edit"&&o.jsx("button",{type:"button",className:"af-icon-btn"+(ar?" af-icon-btn--active":""),"aria-label":e("flow:topbar.executionLog"),title:e("flow:topbar.executionLog"),onClick:()=>_s(x=>!x),children:o.jsx("span",{className:"material-symbols-outlined",children:"terminal"})}),Oe==="edit"&&o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-icon-btn"+(it==="history"?" af-icon-btn--active":""),"aria-label":e("flow:topbar.history"),title:e("flow:topbar.history"),disabled:!u,onClick:pR,children:o.jsx("span",{className:"material-symbols-outlined",children:"history"})}),o.jsx("button",{type:"button",className:"af-icon-btn"+(it==="settings"?" af-icon-btn--active":""),onClick:hR,"aria-label":e("flow:topbar.pipelineSettings"),title:e("flow:topbar.pipelineSettings"),disabled:!u,children:o.jsx("span",{className:"material-symbols-outlined",children:"settings"})}),o.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(it==="composer"?" af-composer-topbar-btn--active":"")+(En?" af-composer-topbar-btn--running":""),onClick:mR,"aria-label":"AI Composer",title:"AI Composer",disabled:!u,children:"AI"}),o.jsx("button",{type:"button",className:"af-icon-btn af-shortcuts-trigger"+(kl?" af-icon-btn--active":""),onClick:D0,"aria-label":e("flow:topbar.shortcutsLabel"),title:e("flow:topbar.shortcutsTitle"),disabled:!u,children:o.jsx("span",{className:"af-shortcuts-trigger__mark","aria-hidden":!0,children:"?"})}),o.jsx("button",{type:"button",className:"af-icon-btn af-icon-btn--danger","aria-label":e("flow:topbar.deletePipeline"),title:e("flow:topbar.deletePipeline"),disabled:!u||si(u.source)||u.source!=="user"&&u.source!=="workspace",onClick:()=>P(!0),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_forever"})}),o.jsx("button",{type:"button",className:"af-btn-pipeline-archive",disabled:!u||si(u.source)||u.archived||u.source!=="user"&&u.source!=="workspace",onClick:()=>_(!0),children:"Archive"})]}),Oe==="running"?o.jsxs("button",{type:"button",className:"af-btn-run-stop",onClick:iR,title:e("flow:run.pauseRun"),children:[o.jsx("span",{className:"material-symbols-outlined",children:"pause"}),"Pause"]}):Oe==="ready"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void ro(),title:e("flow:topbar.startRun"),children:e("flow:topbar.startRun")}),o.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:Ol,children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):Oe==="stopped"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void ro({runUuid:cn}),title:cn?e("flow:topbar.resumeTitle",{uuid:cn}):e("flow:topbar.resumeTitleNoUuid"),children:"Resume"}),o.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:Ol,children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):Oe==="done"||Oe==="error"?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void ro(),title:e("flow:topbar.rerunTitle"),children:"Run"}),o.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:Ol,children:[o.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):o.jsxs("div",{className:"af-run-btn-group",children:[o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg af-run-btn-main",disabled:!u,onClick:()=>void ro(),children:"Run"}),o.jsx("button",{type:"button",className:"af-run-btn-dropdown",disabled:!u,onClick:()=>Ae(x=>!x),"aria-label":e("flow:topbar.runOptions"),"aria-expanded":Te,children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_drop_down"})}),Te&&u&&o.jsxs("div",{className:"af-run-dropdown-menu",children:[o.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var N,H,q,Y,J;Ae(!1);const x={};for(const ee of bt){const ne=dn[ee.id];ne&&(x[ne]=((N=Gs[ne])==null?void 0:N.value)??((H=Gs[ne])==null?void 0:H.path)??((J=(Y=(q=ee.data)==null?void 0:q.outputs)==null?void 0:Y[0])==null?void 0:J.default)??"")}tr(x),Wt(!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:()=>{Ae(!1),ro({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:()=>{Ae(!1),ro()},children:[o.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:runPreset.default")]}),Object.keys(Cr).map(x=>o.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var q;Ae(!1);const N=Cr[x]||{},H={};for(const Y of bt){const J=dn[Y.id];if(!J)continue;const ee=((q=Y.data)==null?void 0:q.definitionId)||"",ne=N[Y.id]??"";ee.startsWith("provide_file")?H[J]={type:"file",path:ne}:H[J]={type:"str",value:ne}}ro({cliInputsOverride:H})},children:[o.jsx("span",{className:"material-symbols-outlined",children:"bookmark"}),x]},x))]})]})]})]})]}),Ze?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:Ze}),o.jsx("button",{type:"button",onClick:()=>ot(""),"aria-label":"关闭发布提示",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,o.jsxs("div",{className:"af-pipeline-body"+(Oe!=="edit"?" af-pipeline-body--run-mode":""),children:[Oe==="edit"&&it!=="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${kr?" af-palette-workspace--expanded":""}`,children:[o.jsxs("button",{type:"button",className:"af-palette-workspace-head",onClick:()=>_o(x=>!x),"aria-expanded":kr,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:kr?"expand_less":"expand_more"})]}),o.jsx("div",{className:"af-palette-workspace-path",title:u&&(u.path||or.path)||"",children:u?u.id:e("flow:palette2.noPipelineSelected")}),kr&&o.jsx("div",{className:"af-palette-workspace-tree",children:Me?o.jsx("div",{className:"af-palette-workspace-loading",children:e("flow:palette.loading")}):or.error?o.jsx("div",{className:"af-palette-workspace-empty",children:or.error}):u?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-palette-workspace-group",children:[o.jsxs("div",{className:"af-palette-workspace-group-head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder"}),o.jsx("span",{children:u.id}),o.jsxs("span",{className:"af-palette-workspace-count",children:["(",or.files.length,")"]})]}),or.files.length>0?o.jsx("ul",{className:"af-palette-workspace-list",children:or.files.filter(x=>x.type==="file").map(x=>o.jsxs("li",{className:"af-palette-workspace-item af-palette-workspace-item--clickable",title:x.path,onClick:()=>Z({filePath:x.path,fileName:x.name}),children:[o.jsx("span",{className:"material-symbols-outlined af-palette-workspace-item-icon","aria-hidden":!0,children:x.icon}),o.jsx("span",{className:"af-palette-workspace-item-label",children:x.name}),x.size!=null&&o.jsx("span",{className:"af-palette-workspace-item-size",children:x.size<1024?`${x.size}B`:x.size<1024*1024?`${(x.size/1024).toFixed(1)}KB`:`${(x.size/1024/1024).toFixed(1)}MB`})]},x.path))}):or.files.filter(x=>x.type==="directory").length===0?o.jsx("div",{className:"af-palette-workspace-empty",children:"暂无文件"}):null]}),or.files.filter(x=>{var N;return x.type==="directory"&&((N=x.children)==null?void 0:N.length)>0}).map(x=>o.jsxs("div",{className:"af-palette-workspace-group af-palette-workspace-group--sub",children:[o.jsxs("div",{className:"af-palette-workspace-group-head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:x.icon}),o.jsxs("span",{children:[x.name,"/"]}),o.jsxs("span",{className:"af-palette-workspace-count",children:["(",x.children.length,")"]})]}),o.jsx("ul",{className:"af-palette-workspace-list",children:x.children.map(N=>o.jsxs("li",{className:`af-palette-workspace-item${N.type==="file"?" af-palette-workspace-item--clickable":""}`,title:N.path,onClick:N.type==="file"?()=>Z({filePath:N.path,fileName:N.name}):void 0,children:[o.jsx("span",{className:"material-symbols-outlined af-palette-workspace-item-icon","aria-hidden":!0,children:N.icon}),o.jsx("span",{className:"af-palette-workspace-item-label",children:N.name}),N.type==="file"&&N.size!=null&&o.jsx("span",{className:"af-palette-workspace-item-size",children:N.size<1024?`${N.size}B`:N.size<1024*1024?`${(N.size/1024).toFixed(1)}KB`:`${(N.size/1024/1024).toFixed(1)}MB`})]},N.path))})]},x.path))]}):o.jsx("div",{className:"af-palette-workspace-empty",children:e("flow:palette2.noPipelineSelected")})})]}),o.jsxs("div",{className:"af-node-palette-head",children:[o.jsxs("h2",{className:"af-node-palette-title",children:[o.jsx("span",{children:"Palette"}),o.jsx("span",{className:"af-node-palette-title-kbd","aria-label":"快捷键 A",children:"A"})]}),o.jsxs("label",{className:"af-palette-search-wrap",children:[o.jsx("span",{className:"af-visually-hidden",children:_e==="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:st,type:"search",className:"af-palette-search-input",value:Pe,onChange:x=>we(x.target.value),placeholder:(_e==="flows"?"搜索流程片段":e("flow:palette.searchNodes"))+"…","aria-label":_e==="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":_e==="nodes",className:"af-palette-tab"+(_e==="nodes"?" af-palette-tab--active":""),onClick:()=>Ie("nodes"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),o.jsxs("button",{type:"button",role:"tab","aria-selected":_e==="flows",className:"af-palette-tab"+(_e==="flows"?" af-palette-tab--active":""),onClick:()=>Ie("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:_e==="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:dR,disabled:!u||Lr.length<2,title:Lr.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:["已选 ",Lr.length," 节点 / ",Op.length," 连线"]})]})}),St?o.jsx("p",{className:"af-err af-palette-list-err",children:St}):null,Et?o.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段…"}):T0.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:T0.map(x=>{const N=`${x.id}@${x.version}`,H=x.displayName||x.name||x.id,q=x.description||`${x.nodeCount||0} 个节点,${x.edgeCount||0} 条连线`;return o.jsxs("button",{type:"button",className:"af-palette-card af-flow-snippet-card",onClick:()=>L0(x),draggable:!!u,onDragStart:Y=>{Y.dataTransfer.setData("application/agentflow-snippet",N),Y.dataTransfer.effectAllowed="move"},disabled:!u,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:H}),o.jsxs("span",{className:"af-palette-card-id",children:[x.id,"@",x.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:[x.nodeCount||0," nodes"]}),o.jsxs("span",{children:[x.edgeCount||0," edges"]})]})]},N)})})]}):o.jsx("p",{className:"af-palette-empty",children:Pe.trim()?"无匹配流程片段":"暂无流程片段。选择多个节点后发布。"})]}):o.jsxs(o.Fragment,{children:[Dd.filter(x=>ut[x].length>0).map(x=>o.jsxs("section",{className:`af-palette-section af-flow-palette-section--${x}`,children:[o.jsx("h3",{className:"af-palette-cat",children:x}),o.jsx("div",{className:"af-palette-cards",children:ut[x].map(N=>{const H=Fj(N.inputs,"input"),q=Fj(N.outputs,"output"),J=N.id==="control_load_skills"?"从当前 Skills collection 或上游上下文自动注入 Skills,通常无需手填参数。":_T(N),ee=ET(N);return o.jsxs("button",{type:"button",className:"af-palette-card",onClick:()=>C0(N),draggable:!!u,onDragStart:ne=>{ne.dataTransfer.setData("application/agentflow-node",N.id),ne.dataTransfer.effectAllowed="move"},disabled:!u,title:J||N.id,children:[o.jsxs("span",{className:"af-palette-card-head",children:[o.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:JK(x)})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:ee}),ee!==N.id?o.jsx("span",{className:"af-palette-card-id",children:N.id}):null]})]}),J?o.jsx("span",{className:"af-palette-card-desc",children:J}):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:[H.list.length," IN"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[H.shown.map((ne,he)=>o.jsxs("span",{className:"af-palette-card-port",title:Dj("input",ne,he),children:[o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Zn(ne==null?void 0:ne.type)}}),o.jsx("span",{className:"af-palette-card-port-name",children:mx(ne,he)})]},`in-${he}`)),H.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",H.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,he)=>o.jsxs("span",{className:"af-palette-card-port",title:Dj("output",ne,he),children:[o.jsx("span",{className:"af-palette-card-port-name",children:mx(ne,he)}),o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Zn(ne==null?void 0:ne.type)}})]},`out-${he}`)),q.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",q.hidden]}):null]})]})]})]},N.id)})})]},x)),u&&ae.length===0?o.jsx("p",{className:"af-palette-empty",children:e("flow:palette.noComponents")}):null,u&&ae.length>0&&Pe.trim()&&pt===0?o.jsx("p",{className:"af-palette-empty",children:e("flow:palette.noMatch")}):null,u?null:o.jsx("p",{className:"af-palette-empty",children:e("flow:palette.selectPipeline")})]})}),o.jsxs("footer",{className:"af-palette-engine",children:[o.jsxs("div",{className:"af-palette-engine-head",children:[o.jsx("span",{className:"af-palette-engine-dot"+(mi?"":" af-palette-engine-dot--offline"),"aria-hidden":!0}),o.jsx("span",{className:"af-palette-engine-label",children:e(mi?"common:engine.online":"common:engine.offline")})]}),w?o.jsx("div",{className:"af-palette-tip"+zo,role:"status","aria-live":"polite",children:w}):null]})]}):Oe!=="edit"&&u?o.jsx(FK,{flowId:u.id,flowSource:u.source||"user",flowArchived:u.archived,provideNodes:bt,edges:un,nodes:It,onCliInputsChange:K,onBackToEdit:Ol}):null,o.jsxs("div",{className:"af-pipeline-main-stack",children:[o.jsxs("div",{className:"af-pipeline-canvas-col",children:[y?o.jsx("div",{className:"af-banner af-banner--err af-pipeline-banner",children:y}):null,u&&Ft.length>0&&!V?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:ue,"aria-label":e("flow:validation.reloadFromServer"),title:e("flow:validation.reloadFromServerShort"),onClick:()=>void ni(),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:Ft.map(x=>o.jsxs("li",{children:[e("flow:validation.nodePrefix"),' "',o.jsx("a",{href:"#",className:"af-flow-slot-warning-node-link","aria-label":e("flow:validation.focusNodeAriaLabel",{nodeId:x.nodeId}),onClick:N=>{N.preventDefault(),q2(x.nodeId)},children:x.nodeId}),'"',x.suffix]},x.key))})]}):null,u&&Ft.length>0&&V?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:Ft.length})}),o.jsxs("button",{type:"button",className:"af-flow-slot-warnings-kbd-hint",onClick:D0,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:ue,onClick:()=>void ni(),children:e("common:common.refresh")})]})]}):null,it==="settings"&&u&&Oe==="edit"?gR():o.jsx("div",{className:"af-react-flow-wrap af-pipeline-flow",children:u?o.jsxs(o.Fragment,{children:[o.jsx(k7,{fitViewEpoch:m,canvasTool:ya,nodes:Dt,edges:Tr,onNodesChange:Oe!=="edit"?void 0:Zg,onEdgesChange:Oe!=="edit"?void 0:S,onConnect:Oe!=="edit"?void 0:H2,onConnectStart:Oe!=="edit"?void 0:W2,onConnectEnd:Oe!=="edit"?void 0:V2,isValidConnection:Oe!=="edit"?void 0:B2,onNodesDelete:Oe!=="edit"?void 0:U2,onNodeClick:ey,onNodeDoubleClick:F2,onEdgeClick:z2,onFlowInit:K2,onDrop:J2,onDragOver:X2,hideMinimapAndControls:!!(u&&it),bottomSlot:Oe==="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:Mp.length===0?o.jsx("span",{className:"af-composer-selected-empty",children:e("flow:composer.selectedNodesEmpty")}):Mp.map((x,N)=>{var he,ye;if(x.kind==="definition"){const Fe=x.definition,ce=String(Fe.label??Fe.id),$e=[Fe.id,Fe.description?String(Fe.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:ce}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>$0(x),"aria-label":e("flow:composer.removeFromInput",{id:Fe.id}),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},`def-${Fe.id}`)}const H=x.node,q=x.kind,Y=String(((he=H.data)==null?void 0:he.label)??H.id),J=(ye=H.data)!=null&&ye.definitionId?String(H.data.definitionId):"",ee=J&&J!==Y?`${Y} · ${H.id} · ${J}`:`${Y} · ${H.id}`,ne=q==="canvas"?e("flow:composer.deselectNode",{id:H.id}):e("flow:composer.removeFromInput",{id:H.id});return o.jsxs("div",{className:"af-composer-node-chip"+(q==="mention"?" af-composer-node-chip--mention":""),title:ee,children:[o.jsx("span",{className:"af-composer-node-chip-label",children:Y}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>$0(x),"aria-label":ne,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},H.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:wa,className:"af-composer-textarea",placeholder:e("flow:composer.inputPlaceholder"),disabled:!u,value:us,rows:2,onChange:x=>{vl(x.target.value),ha(x.target.selectionStart??x.target.value.length)},onSelect:x=>{const N=x.target;N instanceof HTMLTextAreaElement&&ha(N.selectionStart??0)},onKeyDown:x=>{if((x.metaKey||x.ctrlKey)&&x.key==="Enter"){x.preventDefault(),Ml();return}if(cd&&_i.length>0&&(x.key==="ArrowDown"||x.key==="ArrowUp"||x.key==="Enter")){if(x.key==="ArrowDown")x.preventDefault(),ga(N=>(N+1)%_i.length);else if(x.key==="ArrowUp")x.preventDefault(),ga(N=>(N-1+_i.length)%_i.length);else if(x.key==="Enter"){x.preventDefault();const N=_i[ma];N&&ly(N.id)}}},onKeyUp:x=>{const N=x.target;N instanceof HTMLTextAreaElement&&ha(N.selectionStart??N.value.length)},onClick:x=>{const N=x.target;N instanceof HTMLTextAreaElement&&ha(N.selectionStart??0)},"aria-label":e("flow:composer.inputAriaLabel"),autoComplete:"off",spellCheck:!1}),cd&&u&&_i.length>0?o.jsxs("ul",{className:"af-composer-mention-menu",role:"listbox","aria-label":e("flow:composer.mentionAriaLabel"),children:[ud.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,ud.instances.map((x,N)=>{const H=N;return o.jsx("li",{role:"option","aria-selected":H===ma,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(H===ma?" af-composer-mention-item--active":""),onMouseDown:q=>q.preventDefault(),onMouseEnter:()=>ga(H),onClick:()=>ly(x.id),children:[o.jsx("span",{className:"af-composer-mention-id",children:x.title}),x.subtitle?o.jsx("span",{className:"af-composer-mention-sub",children:x.subtitle}):null]})},`i-${x.id}`)}),ud.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,ud.definitions.map((x,N)=>{const H=ud.instances.length+N;return o.jsx("li",{role:"option","aria-selected":H===ma,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(H===ma?" af-composer-mention-item--active":""),onMouseDown:q=>q.preventDefault(),onMouseEnter:()=>ga(H),onClick:()=>ly(x.id),children:[o.jsx("span",{className:"af-composer-mention-id",children:x.title}),x.subtitle?o.jsx("span",{className:"af-composer-mention-sub",children:x.subtitle}):null]})},`d-${x.id}`)})]}):null]}),o.jsxs("div",{className:"af-composer-toolbar",children:[Zr.length>0&&o.jsx("label",{className:"af-composer-session-field",children:o.jsxs("select",{className:"af-composer-session-select",value:mr||"",onChange:x=>{x.target.value==="__new__"?jp():Tl(x.target.value)},disabled:En,"aria-label":e("flow:composer.switchConversation"),children:[Zr.map(x=>o.jsxs("option",{value:x.id,children:[x.label,x.running?" ⏳":""]},x.id)),o.jsxs("option",{value:"__new__",children:["+ ",e("flow:composer.newConversation")]})]})}),o.jsxs("div",{className:"af-composer-skills-field",children:[o.jsxs("button",{ref:Do,type:"button",className:"af-composer-skills-button"+(ay>0?" af-composer-skills-button--active":""),disabled:!u||En,"aria-haspopup":"listbox","aria-expanded":ka,onClick:()=>$o(x=>!x),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("span",{children:ay>0?`Skills ${ay}`:"Skills"})]}),ka&&!En?Mr.createPortal(o.jsx("div",{ref:kp,className:"af-composer-skills-menu",role:"listbox","aria-label":"Composer skills",style:Qg,children:Wr.length===0?o.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):o.jsxs(o.Fragment,{children:[$p.groups.map(x=>{const N=sl(x,Wr),H=M_(x,oy,Wr),q=Jg.has(x.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:H==="all",disabled:N.length===0,onChange:Y=>{const J=Y.target.checked;Mo(ee=>J?L_(ee,N):O_(ee,N))}}),o.jsxs("span",{className:"af-composer-skill-group-title-main",children:[o.jsx("span",{children:x.name}),x.builtin?o.jsx("em",{children:"built-in"}):null,H==="partial"?o.jsx("em",{children:"partial"}):null]})]}),o.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":q?`展开 ${x.name}`:`收起 ${x.name}`,onClick:()=>{vp(Y=>{const J=new Set(Y);return J.has(x.id)?J.delete(x.id):J.add(x.id),J})},children:[o.jsx("span",{children:x.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:x.skills.map(Y=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:oy.has(Y.key),onChange:J=>{const ee=J.target.checked;Mo(ne=>ee?ne.includes(Y.key)?ne:[...ne,Y.key]:ne.filter(he=>he!==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]})]},`${x.id}:${Y.key}`))})]},x.id)}),$p.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:$p.ungrouped.length})]}),$p.ungrouped.map(x=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:oy.has(x.key),onChange:N=>{const H=N.target.checked;Mo(q=>H?q.includes(x.key)?q:[...q,x.key]:q.filter(Y=>Y!==x.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:x.name}),x.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:x.description}):null]})]},`ungrouped:${x.key}`))]}):null]})}),document.body):null]}),o.jsxs("label",{className:"af-composer-model-field",children:[o.jsx("span",{className:"af-visually-hidden",children:e("flow:composer.modelLabel")}),o.jsxs("select",{className:"af-composer-model-select",value:(to||"").trim()?fs.currentNotInLists?fs.currentNotInLists:bh(to,fs.cursorList,fs.opencodeList,fs.claudeCodeList):"",onChange:x=>ds(x.target.value),disabled:!u||En,"aria-label":e("flow:composer.modelAriaLabel"),children:[o.jsx("option",{value:"",children:e("flow:composer.modelDefault")}),fs.currentNotInLists?o.jsxs("option",{value:fs.currentNotInLists,children:[fs.currentNotInLists,e("flow:composer.modelNotInList")]}):null,fs.cursorList.length>0?o.jsx("optgroup",{label:"Cursor",children:fs.cursorList.map(x=>o.jsx("option",{value:Uo(x),children:x},`composer-c-${x}`))}):null,fs.opencodeList.length>0?o.jsx("optgroup",{label:"OpenCode",children:fs.opencodeList.map(x=>o.jsx("option",{value:`opencode:${Uo(x)}`,children:x},`composer-o-${x}`))}):null,fs.claudeCodeList.length>0?o.jsx("optgroup",{label:"Claude Code",children:fs.claudeCodeList.map(x=>o.jsx("option",{value:`claude-code:${Uo(x)}`,children:x},`composer-cc-${x}`))}):null]})]}),o.jsx("button",{type:"button",className:"af-composer-send"+(u&&us.trim()&&!En?" af-composer-send--active":"")+(En?" af-composer-send--stop":""),disabled:!u||!En&&!us.trim(),"aria-label":e(En?"flow:composer.stopGeneration":"flow:composer.send"),title:En?e("flow:composer.stopGeneration"):void 0,onClick:()=>{var x;if(En){(x=Cc.current)==null||x.abort();return}Ml()},children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:En?"stop":"arrow_upward"})})]})]}),od?Mr.createPortal(o.jsx("div",{className:"af-node-props-expand-overlay af-composer-thread-dialog-overlay",role:"dialog","aria-modal":"true","aria-label":e("flow:composer.conversationOutput"),onMouseDown:x=>{x.target===x.currentTarget&&Ni(!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"+(En?" af-composer-thread-dialog-status--running":""),role:"status","aria-live":"polite",title:Si||void 0,children:En&&!Si?e("flow:composer.executing"):Si||e("flow:composer.ready")})]}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Ni(!1),"aria-label":e("flow:composer.collapseAriaLabel"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),Sp.length>1&&!(jt&&Array.isArray(jt.phases)&&jt.phases.length>1)?o.jsx("div",{className:"af-composer-steps-track-wrap",children:o.jsx(c7,{steps:Sp})}):null,jt&&Array.isArray(jt.phases)&&jt.phases.length>1?o.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:jt.phases.map((x,N)=>{const H=x.status||(N<(jt.currentPhase??0)?"done":N===(jt.currentPhase??0)?En?"running":jt.nextPhase||jt.isLastPhase?"done":"running":"pending");return o.jsxs("div",{className:"af-composer-phase-item"+(H==="done"?" af-composer-phase-item--done":"")+(H==="running"?" af-composer-phase-item--running":"")+(H==="pending"?" af-composer-phase-item--pending":""),title:`${x.label}${x.description?":"+x.description:""}`,children:[o.jsx("span",{className:"af-composer-phase-dot","aria-hidden":!0,children:H==="done"?o.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.85rem"},children:"check"}):o.jsx("span",{children:N+1})}),o.jsx("span",{className:"af-composer-phase-label",children:x.label})]},x.name||N)})}):null,o.jsx("div",{className:"af-composer-thread-dialog-scroll",children:o.jsx(Vj,{thread:Pl,liveSegments:_l,running:En})}),jt&&!jt.isLastPhase&&jt.nextPhase&&!En?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:jt.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:M0,children:e("flow:composer.phaseReviewContinue",{label:jt.nextPhase.label})}),o.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:O0,children:e("flow:composer.phaseReviewSkip")})]})]}):null]})}),document.body):null]})}):null}),oe&&Oe==="edit"?(()=>{var q;const x=String(oe.query||"").trim().toLowerCase(),N=x?oe.candidates.filter(Y=>{var J,ee,ne;return[(J=Y.def)==null?void 0:J.id,Y.displayLabel,Y.description,(ee=Y.slot)==null?void 0:ee.name,(ne=Y.slot)==null?void 0:ne.type].filter(Boolean).some(he=>String(he).toLowerCase().includes(x))}):oe.candidates,H=oe.draft.handleType==="source"?"IN":"OUT";return o.jsxs("div",{className:"af-connect-node-menu",style:{left:oe.left,top:oe.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:Zn((q=oe.draft.slot)==null?void 0:q.type)},"aria-hidden":!0}),o.jsxs("span",{children:["匹配 ",oe.draft.slotType," 节点"]})]}),o.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>de(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:oe.query,onChange:Y=>de(J=>J&&{...J,query:Y.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),o.jsxs("div",{className:"af-connect-node-menu__list",children:[N.map(Y=>{var ne,he;const J=Y.displayLabel||((ne=Y.def)==null?void 0:ne.id),ee=mx(Y.slot,Y.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>G2(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:J}),J!==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:H}),o.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:Zn((he=Y.slot)==null?void 0:he.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:ee})]})]},`${Y.def.id}-${Y.slotIndex}`)}),N.length===0?o.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null]}):o.jsx("div",{className:"af-placeholder af-pipeline-placeholder",children:e("flow:pipeline.selectPipeline")})})]}),Oe!=="edit"&&ar&&o.jsxs("div",{className:"af-run-console",style:{height:Gi},children:[o.jsx("div",{className:"af-run-console__resize",role:"separator","aria-orientation":"horizontal","aria-label":e("flow:run.resizeConsole"),onPointerDown:tR,onPointerMove:nR,onPointerUp:A0,onPointerCancel:A0,onLostPointerCapture:rR}),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:[Oe==="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:()=>_s(!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:[Sr.map((x,N)=>o.jsxs("div",{className:"af-run-console__line"+(x.type==="error"?" af-run-console__line--error":"")+(x.type==="warn"?" af-run-console__line--warn":"")+(x.type==="node-start"?" af-run-console__line--start":"")+(x.type==="node-done"?" af-run-console__line--done":"")+(x.type==="node-failed"?" af-run-console__line--error":"")+(x.type==="done"?" af-run-console__line--done":""),children:[o.jsxs("span",{className:"af-run-console__ts",children:["[",x.ts?new Date(x.ts).toLocaleTimeString():"--:--:--","]"]}),o.jsx("span",{className:"af-run-console__text",children:x.text!=null?String(x.text):""})]},N)),o.jsx("div",{ref:da})]})]})]}),Oe!=="edit"&&Is&&u?o.jsx(OK,{instanceId:Is,flowId:u.id,runId:cn,nodeStatus:((F0=Nr[Is])==null?void 0:F0.status)??null,onClose:()=>Ts(null)}):null,it&&it!=="settings"&&u&&Oe==="edit"?o.jsx("aside",{className:"af-pipeline-drawer"+(it==="node"?" af-pipeline-drawer--wide":"")+(it==="composer"?" af-pipeline-drawer--wide":""),"aria-label":it==="settings"?e("flow:settings.title"):it==="history"?e("flow:history.title"):it==="composer"?"AI Composer":e("flow:nodeProps.title"),children:it==="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:dd,"aria-label":e("flow:composer.closeSidebar"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),Zr.length>0&&o.jsxs("div",{className:"af-composer-session-tabs",children:[Zr.map(x=>o.jsxs("button",{type:"button",ref:N=>{N&&x.id===mr&&N.scrollIntoView({block:"nearest",inline:"nearest"})},className:["af-composer-session-tab",x.id===mr?"af-composer-session-tab--active":"",x.running?"af-composer-session-tab--running":""].filter(Boolean).join(" "),onClick:()=>Tl(x.id),title:x.label,children:[o.jsx("span",{className:"af-composer-session-label",children:x.label}),o.jsx("span",{className:"af-composer-session-close",role:"button",tabIndex:0,onClick:N=>{N.stopPropagation(),Cp(x.id)},onKeyDown:N=>{N.key!=="Enter"&&N.key!==" "||(N.preventDefault(),N.stopPropagation(),Cp(x.id))},title:x.running?e("flow:composer.endConversation"):e("flow:composer.closeConversation"),children:o.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.75rem"},children:"close"})})]},x.id)),o.jsx("button",{type:"button",className:"af-composer-session-add",onClick:()=>jp(),title:e("flow:composer.newConversation"),children:o.jsx("span",{className:"material-symbols-outlined",children:"add"})})]}),o.jsx("div",{className:"af-composer-sidebar-status"+(En?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:En&&!Si?e("flow:composer.executing"):Si||e("flow:composer.ready")}),jt&&Array.isArray(jt.phases)&&jt.phases.length>1?o.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:jt.phases.map((x,N)=>{const H=x.status||(N<(jt.currentPhase??0)?"done":N===(jt.currentPhase??0)?En?"running":jt.isLastPhase&&N===jt.phases.length-1||jt.nextPhase?"done":"running":"pending");return o.jsxs("div",{className:"af-composer-phase-item"+(H==="done"?" af-composer-phase-item--done":"")+(H==="running"?" af-composer-phase-item--running":"")+(H==="pending"?" af-composer-phase-item--pending":""),title:`${x.label}${x.description?":"+x.description:""}`,children:[o.jsx("span",{className:"af-composer-phase-dot","aria-hidden":!0,children:H==="done"?o.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.85rem"},children:"check"}):o.jsx("span",{children:N+1})}),o.jsx("span",{className:"af-composer-phase-label",children:x.label})]},x.name||N)})}):null,o.jsx("div",{className:"af-composer-sidebar-thread",ref:Np,children:o.jsx(Vj,{thread:Pl,liveSegments:_l,running:En})}),jt&&!jt.isLastPhase&&jt.nextPhase&&!En?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:jt.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:M0,children:e("flow:composer.phaseReviewContinue",{label:jt.nextPhase.label})}),o.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:O0,children:e("flow:composer.phaseReviewSkip")})]})]}):null]}):it==="node"&&Ne?gt?o.jsx(kT,{draft:gt,setDraft:va,definitionId:String(((z0=Ne.data)==null?void 0:z0.definitionId)??Ne.id),systemPromptReadonly:String((ja==null?void 0:ja.description)??""),modelLists:xt,disabled:!u,onIdBlur:eR,onClose:dd,onPublishToMarketplace:ts,error:yp,ioSlots:{inputs:Array.isArray(gt==null?void 0:gt.inputs)?gt.inputs:[],outputs:Array.isArray(gt==null?void 0:gt.outputs)?gt.outputs:[]}}):o.jsx("div",{className:"af-pipeline-drawer-body",children:o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:pipeline.loadingProps")})}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-pipeline-drawer-head",children:[o.jsx("h2",{className:"af-pipeline-drawer-title",children:e(it==="settings"?"flow:settings.title":"flow:history.title")}),o.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:dd,"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:it==="settings"?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.pipelineId")}),(u.source==="user"||u.source==="workspace")&&!u.archived?o.jsxs("div",{className:"af-pipeline-rename-row",children:[o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:F,onChange:x=>{z(x.target.value),M("")},onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),Ip())},onBlur:()=>{F.trim()&&F.trim()!==u.id&&Ip()},placeholder:u.id,disabled:L,spellCheck:!1}),o.jsx("span",{className:"af-pipeline-drawer-badge",children:$c(u.source??"user",e)})]}):o.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[u.id,o.jsx("span",{className:"af-pipeline-drawer-badge",children:$c(u.source??"user",e)}),u.archived?o.jsx("span",{className:"af-pipeline-drawer-badge af-pipeline-drawer-badge--muted",children:e("flow:settings.archived")}):null]}),W?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:W}):null]}),typeof u.path=="string"&&u.path?o.jsxs("div",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.diskPath")}),o.jsxs("div",{className:"af-pipeline-drawer-readonly af-pipeline-drawer-readonly--mono af-pipeline-path-row",children:[o.jsx("span",{className:"af-pipeline-path-text",children:u.path}),o.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-copy-btn",onClick:()=>E0(u.path),title:e("flow:settings.copyPath"),children:o.jsx("span",{className:"material-symbols-outlined",children:T?"check":"content_copy"})})]})]}):null,u.source==="user"||u.source==="workspace"?u.archived?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.archivedNote")}):o.jsxs("div",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.storageLocation")}),o.jsx("div",{className:"af-pipeline-move-actions",children:u.source==="user"?o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:$,onClick:()=>Ap("workspace"),children:e($?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:$,onClick:()=>Ap("user"),children:e($?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),A?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:A}):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:b,onChange:x=>v(x.target.value),placeholder:e("flow:pipeline.introductionPlaceholder"),rows:5,spellCheck:!1})]}),o.jsxs("div",{className:"af-pipeline-meta-card",children:[o.jsx("h3",{className:"af-pipeline-meta-title",children:e("flow:schedule.title")}),hl?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:!!lr.enabled,disabled:nr||u.archived||si(u.source),onChange:x=>Rr(N=>({...N,enabled:x.target.checked}))}),o.jsx("span",{children:e("flow:schedule.enabled")})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.cron")}),o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:lr.cron||"",disabled:nr||u.archived||si(u.source),onChange:x=>Rr(N=>({...N,cron:x.target.value})),placeholder:"0 9 * * *",spellCheck:!1})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.timezone")}),o.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:lr.timezone||"",disabled:nr||u.archived||si(u.source),onChange:x=>Rr(N=>({...N,timezone:x.target.value})),placeholder:"Asia/Shanghai",spellCheck:!1})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.preset")}),o.jsxs("select",{className:"af-pipeline-flow-select",value:lr.preset||"",disabled:nr||u.archived||si(u.source),onChange:x=>Rr(N=>({...N,preset:x.target.value})),children:[o.jsx("option",{value:"",children:e("flow:schedule.defaultPreset")}),Object.keys(Cr).map(x=>o.jsx("option",{value:x,children:x},x))]})]}),o.jsx("div",{className:"af-pipeline-drawer-readonly",children:o.jsx("span",{children:e("flow:schedule.overlapSkip")})}),lr.nextRunAt?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.nextRun",{time:new Date(lr.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:Mn!=null&&Mn.running?e("flow:schedule.running"):lr.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled")})]}),Yt.lastTriggeredAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),o.jsx("dd",{children:new Date(Yt.lastTriggeredAt).toLocaleString()})]}):null,Yt.lastSkippedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),o.jsxs("dd",{children:[new Date(Yt.lastSkippedAt).toLocaleString(),Yt.lastSkipReason?` · ${Yt.lastSkipReason}`:""]})]}):null,Yt.lastRunUuid?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastRun")}),o.jsx("dd",{children:Yt.lastRunUuid})]}):null,Yt.lastExitCode!=null?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastExit")}),o.jsx("dd",{children:String(Yt.lastExitCode)})]}):null,Yt.lastFinishedAt?o.jsxs("div",{className:"af-pipeline-meta-row",children:[o.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),o.jsx("dd",{children:new Date(Yt.lastFinishedAt).toLocaleString()})]}):null]}),Mn!=null&&Mn.lastError||Yt.lastError?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(Mn==null?void 0:Mn.lastError)||Yt.lastError}):null,u.archived||si(u.source)?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,Xi?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Xi}):null,Ro?o.jsx("p",{className:"af-pipeline-drawer-muted",children:Ro}):null,o.jsx("button",{type:"button",className:"af-btn-secondary",disabled:nr||u.archived||si(u.source),onClick:ty,children:e(nr?"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:[It.length," ",e("flow:pipeline.nodesUnit")]})]})})]}),o.jsx("button",{type:"button",className:"af-pipeline-drawer-link",onClick:()=>n("/settings"),children:e("flow:settings.globalSettings")})]}):o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"af-pipeline-drawer-lead",children:[e("flow:settings.currentPipeline"),o.jsx("strong",{children:u.id})]}),jn?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):Ct?o.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Ct}):ld.length===0?o.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:pipeline.noRuns")}):o.jsxs(o.Fragment,{children:[ns.success+ns.failed+ns.running+ns.stopped+ns.interrupted>0?o.jsxs("div",{className:"af-exec-history-summary","aria-label":e("flow:history.summary"),children:[ns.success>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--success",children:e("flow:history.successCount",{count:ns.success})}):null,ns.failed>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--failed",children:e("flow:history.failedCount",{count:ns.failed})}):null,ns.stopped>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--stopped",children:e("flow:history.stoppedCount",{count:ns.stopped})}):null,ns.interrupted>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--interrupted",children:e("flow:history.interruptedCount",{count:ns.interrupted})}):null,ns.running>0?o.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--running",children:e("flow:history.runningCount",{count:ns.running})}):null]}):null,o.jsx("ul",{className:"af-exec-history-list",children:ld.map((x,N)=>{const H=x.status||"unknown",q=H==="success"?"af-exec-history-card--success":H==="failed"?"af-exec-history-card--failed":H==="stopped"?"af-exec-history-card--stopped":H==="interrupted"?"af-exec-history-card--interrupted":H==="running"?"af-exec-history-card--running":"af-exec-history-card--unknown",Y=e(H==="success"?"flow:history.success":H==="failed"?"flow:history.failed":H==="stopped"?"flow:history.stopped":H==="interrupted"?"flow:history.interrupted":H==="running"?"flow:history.running":"flow:history.unknown"),J=H==="success"?"check_circle":H==="failed"?"error":H==="stopped"?"stop_circle":H==="interrupted"?"sync_disabled":H==="running"?"progress_activity":"help",ee=x.runId||`${x.at}-${N}`,ne=x.runId!=null&&x.runId.length>=6?e("flow:history.runLabel",{id:x.runId.length>8?x.runId.slice(-8):x.runId}):e("flow:history.runLabel",{id:ld.length-N});return o.jsx("li",{className:"af-exec-history-list-item",children:o.jsxs("button",{type:"button",className:`af-exec-history-card ${q}`,onClick:()=>uR(x),title:e("flow:history.enterRunView"),children:[o.jsxs("div",{className:"af-exec-history-card-top",children:[o.jsx("span",{className:"af-exec-history-card-title",children:ne}),o.jsx("span",{className:"af-exec-history-card-time",children:Ew(x.at,e)})]}),o.jsxs("div",{className:"af-exec-history-card-bottom",children:[o.jsxs("span",{className:"af-exec-history-card-status",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:J}),Y]}),o.jsxs("span",{className:"af-exec-history-card-duration",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"timer"}),xM(x.durationMs,e)]})]})]})},`${u.id}-${ee}`)})})]})]})})]})}):null]}),o.jsx(kj,{open:sR,title:e("flow:run.pauseTitle",{defaultValue:"暂停运行"}),message:e("flow:run.pauseConfirm"),confirmLabel:e("flow:run.pauseConfirmOk",{defaultValue:"暂停"}),onConfirm:oR,onCancel:()=>sy(!1)}),o.jsx(kj,{open:aR,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:cR,onSecondary:lR,onCancel:()=>Lp(!1)}),o.jsx(gT,{open:kl,onClose:()=>xa(!1)}),yR(),o.jsx(yT,{open:bc,onClose:()=>Sl(!1),onJump:Y2,nodes:It}),o.jsx(UK,{open:Ps,onClose:()=>Po(!1),flowId:(u==null?void 0:u.id)??""}),o.jsx(yK,{open:D,onClose:()=>_(!1),flowId:(u==null?void 0:u.id)??"",flowSource:(u==null?void 0:u.source)??"user",onArchived:async()=>{_(!1),await Tt(),n("/projects?tab=archived")}}),o.jsx(xK,{open:R&&!!(u!=null&&u.id),onClose:()=>P(!1),flowId:(u==null?void 0:u.id)??"",flowSource:(u==null?void 0:u.source)??"user",flowArchived:!!(u!=null&&u.archived),onDeleted:async()=>{P(!1),p(null),wt([]),en([]),Il(null),await Tt(),n("/projects")}}),gn&&Mr.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:()=>Tn(!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:zt.name,onChange:x=>{const N=x.target.value;Rn(H=>({...H,name:N,id:H.id?H.id:N.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")}))},placeholder:"例如:PR 检查片段",autoFocus:!0})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"ID"}),o.jsx("input",{type:"text",value:zt.id,onChange:x=>Rn(N=>({...N,id:x.target.value})),placeholder:"pr-check-snippet"})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"说明"}),o.jsx("textarea",{value:zt.description,onChange:x=>Rn(N=>({...N,description:x.target.value})),placeholder:"这段流程适合什么场景、需要接哪些上下游。",rows:4})]}),o.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",Lr.length," 个节点和 ",Op.length," 条内部连线。"]}),fe?o.jsx("div",{className:"af-flow-snippet-error",children:fe}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>Tn(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:Bn||!zt.name.trim(),onClick:()=>void fR(),children:Bn?"发布中…":"发布"})]})]})}),document.body),o.jsx(vK,{open:!!G,onClose:()=>Z(null),flowId:(u==null?void 0:u.id)??"",flowSource:(u==null?void 0:u.source)??"user",flowArchived:!!(u!=null&&u.archived),filePath:(G==null?void 0:G.filePath)??"",fileName:(G==null?void 0:G.fileName)??"",onSaved:()=>{qs(x=>({...x}))}})]}),cr&&Oe!=="edit"&&Mr.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:cr.instanceId})]}),o.jsx("div",{className:"af-user-check-modal__actions",children:Hr?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(!cr||!u||!cn)return;const x=Lo||cr.content;try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",action:"save-user-check-content",runUuid:cn,instanceId:cr.instanceId,content:x})})).ok?(gl(H=>H&&{...H,content:x}),fa(!1),mt(H=>[...H,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.contentSaved")}])):mt(H=>[...H,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{mt(N=>[...N,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}},children:[o.jsx("span",{className:"material-symbols-outlined",children:"save"}),e("flow:userCheck.save")]}),o.jsxs("button",{type:"button",className:"af-user-check-modal__btn",onClick:()=>{yl(cr.content),fa(!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:()=>fa(!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:()=>gl(null),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})})]}),o.jsx("div",{className:"af-user-check-modal__body",children:Hr?o.jsx("textarea",{ref:hp,className:"af-user-check-modal__textarea",value:Lo||cr.content,onChange:x=>yl(x.target.value)}):o.jsx("div",{className:"af-user-check-modal__preview",children:o.jsx("pre",{children:Lo||cr.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:xi,onChange:x=>pa(x.target.value),disabled:Zi}),o.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--ai",disabled:Zi||!xi.trim(),onClick:()=>{!cr||!u||!cn||!xi.trim()||(cs(!0),mt(x=>[...x,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.aiEditStarted")}]),fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",action:"ai-edit-user-check-content",runUuid:cn,instanceId:cr.instanceId,content:Lo||cr.content,prompt:xi})}).then(x=>x.json()).then(x=>{cs(!1),x.ok&&x.content?(yl(x.content),fa(!0),pa(""),mt(N=>[...N,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.aiEditDone")}])):mt(N=>[...N,{ts:new Date().toISOString(),type:"error",text:x.error||e("flow:userCheck.aiEditFailed")}])}).catch(()=>{cs(!1),mt(x=>[...x,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.aiEditFailed")}])}))},children:[Zi?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(!cr||!u||!cn)return;const x=Lo||cr.content;try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",action:"save-user-check-content",runUuid:cn,instanceId:cr.instanceId,content:x})})).ok?(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",action:"confirm-user-check",runUuid:cn,instanceId:cr.instanceId,execId:cr.execId})}),gl(null),pa(""),ro({runUuid:cn})):mt(H=>[...H,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{mt(N=>[...N,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}},children:[o.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:userCheck.continue")]})]})]})}),document.body),Er&&Oe!=="edit"&&Mr.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:Er.instanceId})]}),o.jsx("div",{className:"af-user-ask-modal__actions",children:o.jsx("button",{type:"button",className:"af-user-ask-modal__btn",onClick:()=>xl(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:[Er.question.trim()?o.jsx("div",{className:"af-user-ask-modal__question",children:o.jsx("pre",{children:Er.question})}):null,Er.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:Er.options.map(x=>o.jsxs("button",{type:"button",className:"af-user-ask-option",disabled:eo,onClick:async()=>{if(!(!Er||!u||!cn)){wl(!0);try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",action:"confirm-user-ask",runUuid:cn,instanceId:Er.instanceId,execId:Er.execId,branch:x.name,selectedIndex:x.index,selectedLabel:x.label})})).ok?(xl(null),wl(!1),ro({runUuid:cn})):(wl(!1),mt(H=>[...H,{ts:new Date().toISOString(),type:"error",text:e("flow:userAsk.submitFailed")}]))}catch{wl(!1),mt(N=>[...N,{ts:new Date().toISOString(),type:"error",text:e("flow:userAsk.submitFailed")}])}}},children:[o.jsxs("span",{className:"af-user-ask-option__index",children:["[",x.index,"]"]}),o.jsx("span",{className:"af-user-ask-option__label",children:x.label})]},x.name))})]}),o.jsx("div",{className:"af-user-ask-modal__foot",children:o.jsx("span",{className:"af-user-ask-modal__hint",children:e(eo?"flow:userAsk.submitting":"flow:userAsk.hint")})})]})}),document.body),Le&&Oe!=="edit"&&o.jsxs("div",{className:"af-tool-print-toast"+(bl?" 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:Le.instanceId})}),o.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>Zu(x=>!x),"aria-label":e(bl?"flow:toolPrint.restore":"flow:toolPrint.expand"),title:e(bl?"flow:toolPrint.restore":"flow:toolPrint.expand"),children:o.jsx("span",{className:"material-symbols-outlined",children:bl?"close_fullscreen":"open_in_full"})}),o.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>Qs(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(Uu,{children:Le.content})})})]}),Gn&&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:Gn.label}),o.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>Oo(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:Cn,className:"af-provide-edit-modal__textarea",defaultValue:Gn.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:ei,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:()=>Oo(null),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:provideEdit.cancel")]})]})]})}),Xe&&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:()=>Wt(!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:bt.length===0?o.jsx("div",{className:"af-run-params-empty",children:e("flow:runParams.noParams")}):o.jsx("div",{className:"af-run-params-list",children:bt.map(x=>{var he,ye;const N=dn[x.id];if(!N)return null;const H=((he=x.data)==null?void 0:he.definitionId)||"",q=H.startsWith("provide_file"),Y=H==="provide_bool",J=((ye=x.data)==null?void 0:ye.label)||x.id,ee=Ot[N]??"",ne=["true","1","yes","on"].includes(String(ee).trim().toLowerCase());return o.jsxs("div",{className:"af-run-params-item",children:[o.jsxs("div",{className:"af-run-params-item__head",children:[o.jsx("span",{className:"af-run-params-item__icon material-symbols-outlined"+(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:J}),o.jsx("span",{className:"af-run-params-item__slot",children:N})]}),Y?o.jsx("button",{type:"button",className:"af-run-config-bool-toggle"+(ne?" af-run-config-bool-toggle--true":""),onClick:()=>tr(Fe=>({...Fe,[N]:ne?"false":"true"})),"aria-pressed":ne,children:ne?"true":"false"}):o.jsx("input",{type:"text",className:"af-run-params-item__input",value:ee,onChange:Fe=>tr(ce=>({...ce,[N]:Fe.target.value})),placeholder:e(q?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},x.id)})})}),o.jsxs("div",{className:"af-run-params-modal__foot",children:[o.jsxs("button",{type:"button",className:"af-run-params-modal__btn af-run-params-modal__btn--run",onClick:()=>{var N;const x={};for(const H of bt){const q=dn[H.id];if(!q)continue;const Y=((N=H.data)==null?void 0:N.definitionId)||"",J=Ot[q]??"";Y.startsWith("provide_file")?x[q]={type:"file",path:J}:x[q]={type:"str",value:J}}Wt(!1),Ae(!1),ro({cliInputsOverride:x})},children:[o.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:runParams.run")]}),o.jsxs("button",{type:"button",className:"af-run-params-modal__btn",onClick:()=>Wt(!1),children:[o.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:runParams.cancel")]})]})]})})]})]})}const E7="modulepreload",_7=function(e){return"/"+e},Jj={},TT=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),l=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=_7(c),c in Jj)return;Jj[c]=!0;const d=c.endsWith(".css"),f=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const u=document.createElement("link");if(u.rel=d?"stylesheet":E7,d||(u.as="script"),u.crossOrigin="",u.href=c,l&&u.setAttribute("nonce",l),document.head.appendChild(u),d)return new Promise((p,m)=>{u.addEventListener("load",p),u.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return s.then(a=>{for(const l of a||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},P7=new Set(["echarts"]),A7=new Set(["line","bar","pie","scatter","radar","heatmap","tree","treemap","sunburst","sankey","graph","gauge","funnel"]),I7=new Set(["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","oncontextmenu","onkeydown","onkeyup","onkeypress","onload","onerror"]),T7=["#7c9cff","#a8e66f","#ffcf5c","#68d8d6","#ff8fb3","#b79cff","#f59e73","#8bd17c"];function tl(e){return e&&typeof e=="object"&&!Array.isArray(e)}function uc(e,t){if(!tl(e))return{...t};const n={...e};for(const[r,s]of Object.entries(t))n[r]==null?n[r]=s:tl(n[r])&&tl(s)&&(n[r]=uc(n[r],s));return n}function Hg(e,t){return e==null?e:Array.isArray(e)?e.map(n=>tl(n)?uc(n,t):n):tl(e)?uc(e,t):e}function R7(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 mb(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)=>mb(n,`${t}[${r}]`));return}if(typeof e=="object")for(const[n,r]of Object.entries(e)){if(/^on[A-Z]/.test(n)||I7.has(n.toLowerCase()))throw new Error(`${t}.${n} is not allowed`);mb(r,`${t}.${n}`)}}}function L7(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(!A7.has(r))throw new Error(`series.type "${r||"(empty)"}" is not allowed`)}return t}function O7(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:uc(e,t)}function M7(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(!tl(r))return r;const i=s===0&&t&&r.text==null?{...r,text:t}:r;return uc(i,n)}):tl(e)?uc(t&&e.text==null?{...e,text:t}:e,n):t?{...n,text:t}:e}function $7(e,t){const n={top:t?42:14,textStyle:{color:"rgba(255, 255, 255, 0.72)"},itemGap:14};return e==null?e:Hg(e,n)}function Qj(e,t="rgba(255, 255, 255, 0.62)"){return Hg(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 D7(e,t){const n={left:52,right:42,top:t?78:42,bottom:42,containLabel:!0};return e==null?n:Hg(e,n)}function F7(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:Hg(e,t)}function z7(e,t,n){const r=M7(e.title,n),s=!!(Array.isArray(r)?r:[r]).filter(Boolean).some(a=>tl(a)&&a.text),i=e.legend!=null&&e.legend!==!1;return{...e,backgroundColor:e.backgroundColor??"transparent",color:e.color??T7,textStyle:uc(e.textStyle,{color:"rgba(255, 255, 255, 0.78)"}),title:r,tooltip:O7(e.tooltip),legend:$7(e.legend,s),grid:e.xAxis!=null||e.yAxis!=null?D7(e.grid,s||i):e.grid,xAxis:Qj(e.xAxis),yAxis:Qj(e.yAxis),radar:F7(e.radar),series:t}}function RT(e){const t=R7(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(!P7.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");mb(n);const r=L7(n.option.series),s=n.title==null?"":String(n.title),i=z7(n.option,r,s);return{ok:!0,spec:{...n,title:s,option:i}}}catch(n){return{ok:!1,error:String((n==null?void 0:n.message)||n)}}}const B7="af:workspace-graph:v2",Bc=["DISPLAY","CONTROL","TOOL","PROVIDE","AGENT"],H7=new Set(["control_start","control_end","control_load_skills","control_load_mcp"]),W7={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:""}]},V7={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}]},U7={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}]},K7=new Set(["png","jpg","jpeg","gif","webp","svg"]),q7=320,LT=180,OT=960,gb=96,MT=900,yb="display-ref:",Y7="0.1.50";function G7(){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 Oa(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 Gm(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 K7.has(n)}function f0(e,t){const n=String(e||"").trim();if(!n)return"";if(/^(?:https?:|data:|blob:|file:)/i.test(n)||n.startsWith("/"))return n;const r=Oa(t||{});return r.set("path",n),`/api/workspace/file/raw?${r.toString()}`}function X7(e,t){const n=String(e||"").trim();if(!n)return"";const r=Oa(t||{});return r.set("path",n),r.set("download","1"),`/api/workspace/file/raw?${r.toString()}`}function J7(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 Q7(e){return!e||typeof e.closest!="function"?!1:!!e.closest("input, textarea, select, [contenteditable='true']")}function Z7(e){const t=String(e||"").trim();if(!t)return"";if(/^思考中/.test(t))return"模型正在思考";if(/^生成回复中/.test(t))return"模型正在生成回复";if(/^Timing\s+(.+?):\s+(\d+)ms/i.test(t)){const n=t.match(/^Timing\s+(.+?):\s+(\d+)ms/i);return`耗时:${(n==null?void 0:n[1])||"step"} ${(n==null?void 0:n[2])||"0"}ms`}if(/^工具\s+(.+?)(?:\s+\((started|completed)\))?$/i.test(t)){const n=t.match(/^工具\s+(.+?)(?:\s+\((started|completed)\))?$/i),r=String((n==null?void 0:n[1])||"tool").trim(),s=String((n==null?void 0:n[2])||"").toLowerCase();if(r==="thinking")return"模型正在思考";const i=r==="readToolCall"?"读取文件/上下文":r==="grepToolCall"?"搜索代码":r==="editToolCall"?"编辑文件":r;return s==="completed"?`完成:${i}`:`执行:${i}`}return/^\[stderr\]/.test(t)?t:""}function Zj(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 $T(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 DT(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function p0(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 Fd(e){const t=String(p0(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 e1(e){return e==="DISPLAY"?"preview":e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function Xm(e){return String((e==null?void 0:e.displayName)||(e==null?void 0:e.label)||(e==null?void 0:e.id)||"Node")}function zd(e){return Xm(e)}function xb(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function xx(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 t1(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 n1(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 r1(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=$u(s.get(n),e.sourceHandle||"output-0","source"),a=$u(s.get(r),e.targetHandle||"input-0","target");return!!(i&&a&&Mu(i,a))}function eq(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=$u(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:pT(a)}:null}function tq(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"?Mu(t.slot,a):Mu(a,t.slot)))continue;const c=Fd(n);return{def:n,order:r,category:c,categoryRank:Bc.indexOf(c),slot:a,slotIndex:i,displayLabel:zd(n),description:xb(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 Bd(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 nq(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 rq(e){return(e==null?void 0:e.default)!=null?String(e.default):(e==null?void 0:e.value)!=null?String(e.value):""}function kh(e){return(Array.isArray(e)?e:[]).map(t=>({type:(t==null?void 0:t.type)||"node",name:(t==null?void 0:t.name)||"",default:rq(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 FT(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 sq(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[FT(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 wx(e,t){var u,p;const n=e!=null&&e.instances&&typeof e.instances=="object"?e.instances:{},r=BT(n),s=Array.isArray(e==null?void 0:e.edges)?e.edges:[],i=(u=e==null?void 0:e.ui)!=null&&u.nodePositions&&typeof e.ui.nodePositions=="object"?e.ui.nodePositions:{},a=(p=e==null?void 0:e.ui)!=null&&p.nodeSizes&&typeof e.ui.nodeSizes=="object"?e.ui.nodeSizes:{},l=new Set(Object.keys(r));for(const 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 g=r[m]||{},b=g.definitionId||m,v=t.find(B=>B.id===b),y=p0(v)||b,k=t.find(B=>B.id===y)||v,w=g.marketplaceRef||DT(v),j=i[m]&&typeof i[m].x=="number"&&typeof i[m].y=="number"?i[m]:{x:320+l.size*20,y:180+l.size*12},A=!!Vn(y),C=a[m]&&typeof a[m].width=="number"&&typeof a[m].height=="number"?{width:a[m].width,height:a[m].height}:null,$=yu(C,{display:A});return{id:m,type:lp,position:j,...$?{width:$.width,height:$.height}:{},data:{label:g.label||Xm(v)||Xm(k)||m,definitionId:y,...w?{marketplaceRef:w}:{},...v!=null&&v.packageId?{marketplacePackageId:v.packageId}:{},...v!=null&&v.version?{marketplaceVersion:v.version}:{},schemaType:$T(y,k||v),role:g.role||"normal",model:g.model||void 0,body:g.body||"",script:g.script||"",...$?{nodeSize:$}:{},...A&&$?{displaySize:$}:{}}}}).map(m=>Bf(m,r,t)),f=s.filter(m=>(m==null?void 0:m.source)&&(m==null?void 0:m.target)).map((m,g)=>({id:m.id||`we-${m.source}-${m.target}-${g}`,source:String(m.source),target:String(m.target),sourceHandle:m.sourceHandle??void 0,targetHandle:m.targetHandle??void 0,markerEnd:{type:Ns.ArrowClosed}}));return{nodes:d,edges:dT(f,d),instances:r}}function s1(e){return`${yb}${e}`}function bx(e){const t=String(e||"");return t.startsWith(yb)?t.slice(yb.length):t}function zT(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 wb(e,t=[]){const n=new Map((Array.isArray(t)?t:[]).filter(u=>{var p;return Vn((p=u==null?void 0:u.data)==null?void 0:p.definitionId)}).map(u=>[u.id,u])),r=Array.isArray(e==null?void 0:e.nodeIds)?e.nodeIds:[],s=[],i=new Set;for(const u of r){const p=String(u||"").trim();!p||i.has(p)||!n.has(p)||(i.add(p),s.push(p))}const a={},l=e!=null&&e.nodePositions&&typeof e.nodePositions=="object"?e.nodePositions:{};s.forEach((u,p)=>{const m=l[u];a[u]=m&&typeof m.x=="number"&&typeof m.y=="number"?{x:m.x,y:m.y}:{x:180+p*36,y:120+p*28}});const c={},d=e!=null&&e.nodeSizes&&typeof e.nodeSizes=="object"?e.nodeSizes:{};s.forEach(u=>{const p=yu(d[u],{display:!0});p&&(c[u]=p)});const f=zT(e==null?void 0:e.viewport);return{nodeIds:s,nodePositions:a,nodeSizes:c,...f?{viewport:f}:{}}}function iq(e,t=[]){return wb(e,t)}function oq(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}function i1(e,t,n){const r=Number(e);return!Number.isFinite(r)||r<=0?0:Math.min(n,Math.max(t,Math.round(r)))}function yu(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:i1(n,LT,OT)||q7,height:i1(r,gb,MT)||gb}}function Hc(e){var s,i,a,l,c,d,f,u,p,m,g;const t=!!Vn((s=e==null?void 0:e.data)==null?void 0:s.definitionId),n=Number(((a=(i=e==null?void 0:e.data)==null?void 0:i.displaySize)==null?void 0:a.width)||((c=(l=e==null?void 0:e.data)==null?void 0:l.nodeSize)==null?void 0:c.width)||(e==null?void 0:e.width)||(t?(d=e==null?void 0:e.measured)==null?void 0:d.width:0)||0),r=Number(((u=(f=e==null?void 0:e.data)==null?void 0:f.displaySize)==null?void 0:u.height)||((m=(p=e==null?void 0:e.data)==null?void 0:p.nodeSize)==null?void 0:m.height)||(e==null?void 0:e.height)||(t?(g=e==null?void 0:e.measured)==null?void 0:g.height:0)||0);return yu({width:n,height:r},{display:t})}function Sh(e,t,n){var l,c;const r=BT(ap(e,n||{})),s=t.map(d=>({source:d.source,target:d.target,sourceHandle:d.sourceHandle??null,targetHandle:d.targetHandle??null})),i={},a={};for(const d of e){i[d.id]={x:((l=d.position)==null?void 0:l.x)||0,y:((c=d.position)==null?void 0:c.y)||0};const f=Hc(d);f&&(a[d.id]=f)}return{version:1,instances:r,edges:s,ui:{nodePositions:i,nodeSizes:a}}}function BT(e){const t={};for(const[n,r]of Object.entries(e||{})){const s=String((r==null?void 0:r.definitionId)||n);if(!!Vn(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 Vn(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 Zl(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],r=Vn(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 Ku(e){let t=String(e||"").trim();if(!t)return"";const n=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*?)```/);if(n&&n[1])t=n[1].trim();else{const i=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*)$/);i&&i[1]&&(t=i[1].trim())}t=t.replace(/^html\s*\n/i,"").replace(/```\s*$/g,"").trim();const s=[/<!doctype\b/i,/<html\b/i,/<head\b/i,/<body\b/i,/<style\b/i,/<script\b/i,/<main\b/i,/<section\b/i,/<article\b/i,/<div\b/i,/<svg\b/i,/<canvas\b/i].reduce((i,a)=>{const l=a.exec(t);return l?i<0?l.index:Math.min(i,l.index):i},-1);return s>0&&(t=t.slice(s).trim()),t}function HT(e){const t=Ku(e);if(!t.trim())return"";if(/<base\s+[^>]*target\s*=/i.test(t))return t;const n='<base target="_blank">';return/<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 aq(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 lq(e,t){const n=document.createElement("a");n.href=e,n.download=t,document.body.appendChild(n),n.click(),n.remove()}function o1(e,t){const n=URL.createObjectURL(e);try{lq(n,t)}finally{window.setTimeout(()=>URL.revokeObjectURL(n),1e3)}}function cq(e){const t=Ku(e),n=new DOMParser().parseFromString(t||"<body></body>","text/html"),r=new XMLSerializer,s=Array.from(n.querySelectorAll("style")).map(a=>r.serializeToString(a)).join(`
|
|
137
|
-
`),i=n.body?Array.from(n.body.childNodes).map(a=>r.serializeToString(a)).join(""):t;return`
|
|
138
|
-
<style>
|
|
139
|
-
* { box-sizing: border-box; }
|
|
140
|
-
html, body { margin: 0; min-height: 100%; background: transparent; }
|
|
141
|
-
.af-html-snapshot-root { width: 100%; min-height: 100%; overflow: hidden; }
|
|
142
|
-
</style>
|
|
143
|
-
${s}
|
|
144
|
-
<div xmlns="http://www.w3.org/1999/xhtml" class="af-html-snapshot-root">${i}</div>
|
|
145
|
-
`}async function uq({content:e,width:t,height:n,filename:r}){const s=Math.max(1,Math.round(Number(t)||960)),i=Math.max(1,Math.round(Number(n)||640)),a=`<?xml version="1.0" encoding="UTF-8"?>
|
|
146
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="${s}" height="${i}" viewBox="0 0 ${s} ${i}">
|
|
147
|
-
<foreignObject width="100%" height="100%">
|
|
148
|
-
<div xmlns="http://www.w3.org/1999/xhtml" style="width:${s}px;height:${i}px;overflow:hidden;background:#ffffff;">
|
|
149
|
-
${cq(e)}
|
|
150
|
-
</div>
|
|
151
|
-
</foreignObject>
|
|
152
|
-
</svg>`,l=new Blob([a],{type:"image/svg+xml;charset=utf-8"}),c=URL.createObjectURL(l);try{const d=new Image;d.decoding="async",d.src=c,await d.decode();const f=document.createElement("canvas");f.width=s,f.height=i;const u=f.getContext("2d");if(!u)throw new Error("Canvas is unavailable");u.drawImage(d,0,0,s,i);const p=await new Promise(m=>f.toBlob(m,"image/png"));if(!p)throw new Error("Could not encode PNG");o1(p,r)}catch(d){throw o1(l,r.replace(/\.png$/i,".svg")),d}finally{URL.revokeObjectURL(c)}}function dq(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 fq(e){return e==="mermaid"?"account_tree":e==="ascii"?"notes":e==="html"?"html":e==="image"?"image":e==="chart"?"bar_chart":e==="table"?"table":"article"}function Xo(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 WT(e){const t=Xo(e);return t.length>1&&t.every(n=>/^:?-{3,}:?$/.test(n))}function VT(e){return Xo(e).map(t=>t.startsWith(":")&&t.endsWith(":")?"center":t.endsWith(":")?"right":"left")}function pq(e){const t=String(e||"").replace(/\r\n/g,`
|
|
153
|
-
`).split(`
|
|
154
|
-
`),n=[];let r=[],s=!1;const i=()=>{r.length&&(n.push({type:"markdown",text:r.join(`
|
|
155
|
-
`)}),r=[])};for(let a=0;a<t.length;){const l=t[a]||"";if(/^\s*```/.test(l)){s=!s,r.push(l),a++;continue}if(!s&&a+1<t.length&&Xo(l).length>1&&WT(t[a+1])){i();const c=Xo(l),d=VT(t[a+1]),f=[];for(a+=2;a<t.length&&t[a].trim()&&Xo(t[a]).length>1;)f.push(Xo(t[a])),a++;n.push({type:"table",headers:c,align:d,rows:f});continue}r.push(l),a++}return i(),n}function UT(e,t=!1){return{...t?{p:({children:n})=>o.jsx(o.Fragment,{children:n})}:{},img:({src:n,alt:r})=>o.jsx("img",{src:f0(n,e),alt:r||"",loading:"lazy"}),a:({href:n,children:r})=>o.jsx("a",{href:n||"",target:"_blank",rel:"noopener noreferrer",children:r})}}function a1({children:e,flowParams:t}){return o.jsx(Uu,{components:UT(t,!0),children:String(e||"")})}function KT({content:e,flowParams:t}){const n=h.useMemo(()=>pq(e),[e]),r=h.useMemo(()=>UT(t),[t]);return o.jsx(o.Fragment,{children:n.map((s,i)=>s.type!=="table"?o.jsx(Uu,{components:r,children:s.text},`md-${i}`):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:s.headers.map((a,l)=>o.jsx("th",{style:{textAlign:s.align[l]||"left"},children:o.jsx(a1,{flowParams:t,children:a})},l))})}),o.jsx("tbody",{children:s.rows.map((a,l)=>o.jsx("tr",{children:s.headers.map((c,d)=>o.jsx("td",{style:{textAlign:s.align[d]||"left"},children:o.jsx(a1,{flowParams:t,children:a[d]||""})},d))},l))})]})},`table-${i}`))})}function hq(e,t=","){const n=[];let r=[],s="",i=!1;const a=String(e||"").replace(/\r\n/g,`
|
|
156
|
-
`);for(let l=0;l<a.length;l+=1){const c=a[l],d=a[l+1];if(i){c==='"'&&d==='"'?(s+='"',l+=1):c==='"'?i=!1:s+=c;continue}c==='"'?i=!0:c===t?(r.push(s.trim()),s=""):c===`
|
|
157
|
-
`?(r.push(s.trim()),n.push(r),r=[],s=""):s+=c}return(s||r.length)&&(r.push(s.trim()),n.push(r)),n.filter(l=>l.some(c=>String(c||"").trim()))}function oo(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 mq(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=>oo(i[a])))}}if(e.every(Array.isArray)&&e.length>0){const s=e[0].map((i,a)=>oo(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)=>oo(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:oo(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:oo(s)||`Column ${i+1}`,align:"left"})),{columns:r,rows:n.slice(1).map(s=>r.map((i,a)=>oo(s[a])))}):{columns:r,rows:n.map(s=>Array.isArray(s)?r.map((i,a)=>oo(s[a])):s&&typeof s=="object"?r.map(i=>oo(s[i.key])):r.map((i,a)=>a===0?oo(s):""))}}function gq(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=mq(JSON.parse(r));if(l&&l.columns.length)return{...l,error:""}}catch{}const s=r.replace(/\r\n/g,`
|
|
158
|
-
`).split(`
|
|
159
|
-
`).filter(l=>l.trim());if(s.length>=2&&Xo(s[0]).length>1&&WT(s[1])){const l=Xo(s[0]),c=VT(s[1]);return{columns:l.map((d,f)=>({key:String(f),label:d,align:c[f]||"left"})),rows:s.slice(2).map(d=>Xo(d)),error:""}}const i=r.includes(" ")?" ":",",a=hq(r,i);return a.length>0&&a[0].length>1?{columns:a[0].map((c,d)=>c||`Column ${d+1}`).map((c,d)=>({key:String(d),label:c,align:"left"})),rows:a.slice(1),error:""}:{columns:[],rows:[],error:"No table data detected"}}function qT({content:e}){const t=h.useMemo(()=>gq(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:oo(n[i])},`${s.key}-${i}`))},r))})]})})}function yq(e){const t=String(e||"").split(/\r?\n/).map(l=>l.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[];let s="TD";const i=(l,c="")=>{const d=String(l||"").replace(/[^A-Za-z0-9_]/g,"_")||`N${n.size+1}`;return n.has(d)?c&&(n.get(d).label=c):n.set(d,{id:d,label:c||d}),d},a=l=>{const c=String(l||"").trim().replace(/[;,]+$/,""),d=c.match(/^([A-Za-z][A-Za-z0-9_]*)(?:\[(.+?)\]|\((.+?)\)|\{(.+?)\})?$/);return d?i(d[1],d[2]||d[3]||d[4]||d[1]):i(c.replace(/[^A-Za-z0-9_]/g,"_"),c)};for(const l of t){const c=l.match(/^(graph|flowchart)\s+(TD|TB|BT|LR|RL)\b/i);if(c){s=c[2].toUpperCase();continue}const d=l.match(/^(.+?)\s*-{1,2}>+\s*(.+)$/);if(d){r.push({from:a(d[1]),to:a(d[2])});continue}a(l)}return{nodes:Array.from(n.values()),edges:r,direction:s}}function YT({code:e}){const t=h.useMemo(()=>yq(e),[e]);if(!String(e||"").trim())return null;const n=t.direction==="LR"||t.direction==="RL",r=142,s=44,i=n?96:32,a=n?30:68,l=new Map;t.nodes.forEach((f,u)=>{l.set(f.id,{x:24+(n?u*(r+i):u%3*(r+i)),y:24+(n?u%3*(s+a):u*(s+a))})});const c=Math.max(360,...Array.from(l.values()).map(f=>f.x+r+24)),d=Math.max(180,...Array.from(l.values()).map(f=>f.y+s+24));return o.jsx("div",{className:"af-work-node__mermaid-preview",children:o.jsxs("svg",{viewBox:`0 0 ${c} ${d}`,role:"img","aria-label":"Mermaid preview",children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-work-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),t.edges.map((f,u)=>{const p=l.get(f.from),m=l.get(f.to);if(!p||!m)return null;const g=n?`M ${p.x+r} ${p.y+s/2} C ${(p.x+m.x+r)/2} ${p.y+s/2}, ${(p.x+m.x+r)/2} ${m.y+s/2}, ${m.x} ${m.y+s/2}`:`M ${p.x+r/2} ${p.y+s} C ${p.x+r/2} ${p.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:g,markerEnd:"url(#af-work-arrow)"},`${f.from}-${f.to}-${u}`)}),t.nodes.map(f=>{const u=l.get(f.id);return o.jsxs("g",{children:[o.jsx("rect",{className:"af-work-node__mermaid-box",x:u.x,y:u.y,width:r,height:s,rx:"8"}),o.jsx("text",{className:"af-work-node__mermaid-text",x:u.x+r/2,y:u.y+s/2+5,textAnchor:"middle",children:f.label.slice(0,22)})]},f.id)})]})})}function Ta({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 f=n.current;if(!f)return;const u=Math.max(1,f.scrollHeight),p=Math.max(1,f.clientHeight),m=u>p+1,g=m?Math.max(12,p/u*100):100,b=Math.max(0,100-g),v=m?Math.min(b,f.scrollTop/Math.max(1,u-p)*b):0;i({visible:m,top:v,height:g})},[]);h.useEffect(()=>{const f=requestAnimationFrame(a),u=n.current;if(!u||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(f);const p=new ResizeObserver(a);p.observe(u);for(const m of Array.from(u.children))p.observe(m);return()=>{cancelAnimationFrame(f),p.disconnect()}},[t,a]);const l=h.useCallback(f=>{const u=n.current;if(!u)return;const p=Math.max(0,u.scrollHeight-u.clientHeight);u.scrollTop=Math.min(1,Math.max(0,f))*p,a()},[a]),c=h.useCallback((f,u=0)=>{const p=r.current;if(!p)return 0;const m=p.getBoundingClientRect(),g=s.height/100*m.height,b=Math.max(1,m.height-g);return(f-m.top-u)/b},[s.height]),d=h.useCallback(f=>{var j,A;if(!s.visible)return;f.preventDefault(),f.stopPropagation();const u=r.current;if(!u)return;const p=u.getBoundingClientRect(),m=s.top/100*p.height,g=s.height/100*p.height,v=f.clientY>=p.top+m&&f.clientY<=p.top+m+g?f.clientY-p.top-m:g/2;l(c(f.clientY,v));const y=f.pointerId;(A=(j=f.currentTarget).setPointerCapture)==null||A.call(j,y);const k=C=>{C.preventDefault(),l(c(C.clientY,v))},w=()=>{window.removeEventListener("pointermove",k),window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w)};window.addEventListener("pointermove",k),window.addEventListener("pointerup",w),window.addEventListener("pointercancel",w)},[c,l,s.height,s.top,s.visible]);return o.jsxs("div",{className:`af-visible-scroll-frame ${e}`,children:[o.jsx("div",{ref:n,className:`af-visible-scroll-frame__scroller ${e}`,onScroll:a,children:t}),o.jsx("div",{ref:r,className:"af-visible-scrollbar"+(s.visible?" af-visible-scrollbar--visible":""),onPointerDown:d,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${s.height}%`,top:`${s.top}%`}})})]})}function GT({content:e}){const t=h.useRef(null),n=h.useMemo(()=>RT(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,c=null;return s({loading:!0,error:""}),TT(()=>import("./index-DgQRkS4v.js"),[]).then(d=>{i||!t.current||(a=d.init(t.current,"dark",{renderer:"canvas"}),a.setOption(n.spec.option,!0),c=()=>a==null?void 0:a.resize(),typeof ResizeObserver<"u"&&(l=new ResizeObserver(c),l.observe(t.current)),window.addEventListener("resize",c),window.requestAnimationFrame(c),i||s({loading:!1,error:""}))}).catch(d=>{i||s({loading:!1,error:String((d==null?void 0:d.message)||d)})}),()=>{var d,f;i=!0,c&&window.removeEventListener("resize",c),(d=l==null?void 0:l.disconnect)==null||d.call(l),(f=a==null?void 0:a.dispose)==null||f.call(a)}},[n]),!n.ok||r.error?o.jsxs("div",{className:"af-work-display-chart-error",children:[o.jsx("strong",{children:"Chart configuration error"}),o.jsx("span",{children:r.error||n.error})]}):o.jsxs("div",{className:"af-work-display-chart",children:[o.jsx("div",{ref:t,className:"af-work-display-chart__canvas"}),r.loading?o.jsx("div",{className:"af-work-display-chart__loading",children:"Loading chart..."}):null]})}function xq({data:e,flowParams:t,htmlFrameRef:n,htmlFrameVersion:r=0}){const s=Vn(e==null?void 0:e.definitionId);if(!s)return null;const i=Zl(e),a=s==="html"?Ku(i):i;if(!a.trim())return o.jsx(Ta,{className:"af-work-display-empty",children:"No display content"});if(s==="html")return o.jsx(Ta,{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 allow-popups allow-popups-to-escape-sandbox",srcDoc:HT(a)},r)});if(s==="image"){const l=f0(a,t);return o.jsx(Ta,{className:"af-work-display-body af-work-display-body--image",children:o.jsx("img",{className:"af-work-display-image",src:l,alt:dq(e),loading:"lazy"})})}return s==="markdown"?o.jsx(Ta,{className:"af-work-display-body af-work-display-body--markdown",children:o.jsx(KT,{content:a,flowParams:t})}):s==="chart"?o.jsx(Ta,{className:"af-work-display-body af-work-display-body--chart",children:o.jsx(GT,{content:a})}):s==="table"?o.jsx(Ta,{className:"af-work-display-body af-work-display-body--table",children:o.jsx(qT,{content:a})}):s==="mermaid"?o.jsxs(Ta,{className:"af-work-display-body",children:[o.jsx(YT,{code:a}),o.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--mermaid",children:a})]}):o.jsx(Ta,{className:"af-work-display-body af-work-display-body--ascii",children:o.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--ascii",children:a})})}function wq({node:e}){var s,i,a,l,c;const t=Vn((s=e==null?void 0:e.data)==null?void 0:s.definitionId),n=Zl(e==null?void 0:e.data),r=t==="html"?Ku(n):n;return r.trim()?t==="html"?o.jsx("iframe",{title:((i=e==null?void 0:e.data)==null?void 0:i.label)||(e==null?void 0:e.id),sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox",srcDoc:HT(r)}):t==="image"?o.jsx("img",{src:f0(r,(a=e==null?void 0:e.data)==null?void 0:a.flowParams),alt:((l=e==null?void 0:e.data)==null?void 0:l.label)||(e==null?void 0:e.id),loading:"lazy"}):t==="markdown"?o.jsx("div",{className:"af-display-picker-preview__markdown",children:o.jsx(KT,{content:r,flowParams:(c=e==null?void 0:e.data)==null?void 0:c.flowParams})}):t==="chart"?o.jsx(GT,{content:r}):t==="table"?o.jsx(qT,{content:r}):t==="mermaid"?o.jsxs("div",{className:"af-display-picker-preview__diagram",children:[o.jsx(YT,{code:r}),o.jsx("pre",{children:r})]}):o.jsx("pre",{className:"af-display-picker-preview__pre",children:r}):o.jsx("div",{className:"af-display-picker-preview__empty",children:"No content"})}function bq({value:e,onChange:t,onUploadImage:n,readOnly:r=!1}){const s=h.useRef(null),i=h.useRef(null),[a,l]=h.useState(!1),c=h.useCallback(f=>{const u=String(e||""),p=s.current,m=Number((p==null?void 0:p.selectionStart)??u.length),g=Number((p==null?void 0:p.selectionEnd)??m),b=u.slice(0,m),v=u.slice(g),y=b&&!b.endsWith(`
|
|
160
|
-
`)?`
|
|
161
|
-
`:"",k=v&&!v.startsWith(`
|
|
162
|
-
`)?`
|
|
163
|
-
`:"",w=`${b}${y}${f}${k}${v}`;t==null||t(w),window.requestAnimationFrame(()=>{var A,C;const j=b.length+y.length+f.length;(A=s.current)==null||A.focus(),(C=s.current)==null||C.setSelectionRange(j,j)})},[t,e]),d=h.useCallback(async f=>{if(!r&&!(!f||a)){l(!0);try{const u=await(n==null?void 0:n(f)),p=String(u||"").trim();if(p){const m=String(f.name||"image").replace(/\.[^.]+$/g,"").trim()||"image";c(``)}}finally{l(!1)}}},[c,n,r,a]);return o.jsxs("div",{className:"af-work-display-editor nodrag nopan",onClick:f=>f.stopPropagation(),onDragOver:f=>{var p;Array.from(((p=f.dataTransfer)==null?void 0:p.items)||[]).some(m=>String((m==null?void 0:m.type)||"").startsWith("image/"))&&(f.preventDefault(),f.dataTransfer.dropEffect="copy")},onDrop:f=>{var p;const u=Array.from(((p=f.dataTransfer)==null?void 0:p.files)||[]).find(Gm);u&&(f.preventDefault(),d(u))},children:[o.jsxs("div",{className:"af-work-display-editor__toolbar",children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:a||r,onClick:()=>{var f;return(f=i.current)==null?void 0:f.click()},"aria-label":"上传图片",title:"上传图片",children:o.jsx("span",{className:"material-symbols-outlined",children:a?"hourglass_top":"add_photo_alternate"})}),o.jsx("input",{ref:i,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:f=>{var p;const u=(p=f.target.files)==null?void 0:p[0];f.target.value="",u&&d(u)}})]}),o.jsx("textarea",{ref:s,className:"af-work-display-editor__textarea",value:e,onChange:f=>t==null?void 0:t(f.target.value),onKeyDown:f=>{f.key==="Escape"&&f.stopPropagation()},placeholder:"输入 Markdown 内容",spellCheck:!1,readOnly:r})]})}function vq({nodeId:e,data:t}){const n=t==null?void 0:t.nodeChatActive,r=!!(t!=null&&t.selected),s=(t==null?void 0:t.nodeChat)||{},i=Array.isArray(s.messages)?s.messages:[],a=String(s.draft||""),[l,c]=h.useState(a),d=h.useRef(!1),f=String(s.candidateContent||""),u=!!s.running,p=!!(t!=null&&t.readOnly),m=String(s.error||"");return h.useEffect(()=>{d.current||c(a)},[a]),!n&&!r?null:n?o.jsxs("div",{className:"af-work-node-chat nodrag nopan",onClick:g=>g.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 g;return(g=t==null?void 0:t.onCloseNodeChat)==null?void 0:g.call(t)},"aria-label":"关闭节点微调",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),i.length>0||u||m||f.trim()?o.jsxs("div",{className:"af-work-node-chat__messages",children:[i.slice(-4).map((g,b)=>o.jsxs("div",{className:`af-work-node-chat__msg af-work-node-chat__msg--${g.role==="assistant"?"assistant":"user"}`,children:[o.jsx("span",{children:g.role==="assistant"?"AI":"你"}),o.jsx("p",{children:g.text})]},`${g.at||b}-${b}`)),u?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:u||p,"aria-label":"添加上下文",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),o.jsx("textarea",{className:"af-work-node-chat__input",rows:2,value:l,disabled:u||p,placeholder:"描述你想怎么调整这个展示",onCompositionStart:()=>{d.current=!0},onCompositionEnd:g=>{var v;d.current=!1;const b=g.currentTarget.value;c(b),(v=t==null?void 0:t.onUpdateNodeChatDraft)==null||v.call(t,e,b)},onChange:g=>{var v;const b=g.target.value;c(b),d.current||(v=t==null?void 0:t.onUpdateNodeChatDraft)==null||v.call(t,e,b)},onKeyDown:g=>{var b,v;g.isComposing||(b=g.nativeEvent)!=null&&b.isComposing||g.keyCode===229||(g.metaKey||g.ctrlKey)&&g.key==="Enter"&&(g.preventDefault(),(v=t==null?void 0:t.onSendNodeChat)==null||v.call(t,e,l))}}),o.jsx("button",{type:"button",className:"af-work-node-chat__send",disabled:u||p||!l.trim(),onClick:()=>{var g;return(g=t==null?void 0:t.onSendNodeChat)==null?void 0:g.call(t,e,l)},"aria-label":"发送",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_upward"})})]}),o.jsxs("div",{className:"af-work-node-chat__actions",children:[o.jsx("button",{type:"button",disabled:u||p||!f.trim(),onClick:()=>{var g;return(g=t==null?void 0:t.onApplyNodeChatCandidate)==null?void 0:g.call(t,e,"replace")},children:"替换当前内容"}),o.jsx("button",{type:"button",disabled:u||p||!f.trim(),onClick:()=>{var g;return(g=t==null?void 0:t.onApplyNodeChatCandidate)==null?void 0:g.call(t,e,"append")},children:"追加"})]})]}):o.jsxs("button",{type:"button",className:"af-work-node-chat-anchor nodrag nopan",onClick:g=>{var b;g.stopPropagation(),(b=t==null?void 0:t.onToggleNodeChat)==null||b.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 kq(e){return e==="mermaid"?"mmd":e==="ascii"?"txt":e==="html"?"html":e==="image"?"txt":e==="chart"||e==="table"?"json":"md"}function Sq(e){return String(e).trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)||"display"}function Nq(e,t){const n=Vn(t==null?void 0:t.definitionId)||"markdown";return`outputs/${Sq((t==null?void 0:t.label)||e||n)}.${kq(n)}`}function jq({id:e,data:t,selected:n,deleteNode:r}){const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],a=(Array.isArray(t==null?void 0:t.outputs)?t.outputs:[]).map((E,D)=>({slot:E,idx:D})).sort((E,D)=>{var Z,V,se,ue;const _=String(((Z=E.slot)==null?void 0:Z.name)||"").trim(),R=String(((V=D.slot)==null?void 0:V.name)||"").trim();if(_==="next"&&R!=="next")return-1;if(R==="next"&&_!=="next")return 1;const P=String(((se=E.slot)==null?void 0:se.type)||"").trim(),G=String(((ue=D.slot)==null?void 0:ue.type)||"").trim();return P==="node"&&G!=="node"?-1:G==="node"&&P!=="node"?1:E.idx-D.idx}),l=Vn(t==null?void 0:t.definitionId),c=h.useRef(null),[d,f]=h.useState(0),[u,p]=h.useState(!1),[m,g]=h.useState(!1),[b,v]=h.useState(!1),[y,k]=h.useState(""),[w,j]=h.useState(!1),A=h.useRef(null),C=l==="markdown"?Zl(t):"",$=!!(t!=null&&t.readOnly),B=!!(t!=null&&t.displayPageMode);h.useEffect(()=>{if(!m)return;const E=()=>g(!1);return window.addEventListener("pointerup",E,!0),window.addEventListener("pointercancel",E,!0),window.addEventListener("mouseup",E,!0),window.addEventListener("blur",E),()=>{window.removeEventListener("pointerup",E,!0),window.removeEventListener("pointercancel",E,!0),window.removeEventListener("mouseup",E,!0),window.removeEventListener("blur",E)}},[m]),h.useEffect(()=>{b||k(String(C||""))},[C,b]);const F=(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"),z=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,L=h.useCallback(async()=>{var P,G;if(l!=="html"||u)return;const E=Ku(Zl(t));if(!E.trim())return;const D=(G=(P=c.current)==null?void 0:P.getBoundingClientRect)==null?void 0:G.call(P),_=Math.round((D==null?void 0:D.width)||Math.max(320,Number((z==null?void 0:z.width)||960)-2)),R=Math.round((D==null?void 0:D.height)||Math.max(180,Number((z==null?void 0:z.height)||640)-46));p(!0);try{await uq({content:E,width:_,height:R,filename:aq((t==null?void 0:t.label)||e||"html-render","png")})}catch(Z){console.warn("Failed to save HTML display as PNG; downloaded SVG fallback.",Z)}finally{p(!1)}},[t,z==null?void 0:z.height,z==null?void 0:z.width,e,l,u]),O=h.useCallback(E=>{var D;$||!E||l!=="image"||(D=t==null?void 0:t.onUploadImageToDisplayNode)==null||D.call(t,e,E)},[t,e,l,$]),W=h.useCallback(E=>{var R,P;$||l!=="image"||!(Array.from(((R=E.dataTransfer)==null?void 0:R.files)||[]).some(Gm)||Array.from(((P=E.dataTransfer)==null?void 0:P.items)||[]).some(G=>String((G==null?void 0:G.type)||"").startsWith("image/")))||(E.preventDefault(),E.stopPropagation(),E.dataTransfer.dropEffect="copy",j(!0))},[l,$]),M=h.useCallback(E=>{l==="image"&&(E.currentTarget.contains(E.relatedTarget)||j(!1))},[l]),T=h.useCallback(E=>{var _;if(l!=="image")return;const D=Array.from(((_=E.dataTransfer)==null?void 0:_.files)||[]).find(Gm);D&&(E.preventDefault(),E.stopPropagation(),j(!1),O(D))},[l,O]);return o.jsxs("div",{className:"af-work-display-card"+(z?" af-work-display-card--sized":"")+(n?" af-work-display-card--selected":"")+(m?" af-work-display-card--resizing":"")+(w?" af-work-display-card--image-drop":"")+(B?" 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:z?{width:z.width,height:z.height}:void 0,onDragOver:W,onDragLeave:M,onDrop:T,children:[o.jsx(LA,{className:"af-work-display-resize nodrag",position:"bottom-right",minWidth:320,minHeight:180,onResizeStart:()=>g(!0),onResizeEnd:()=>g(!1),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),s.map((E,D)=>{if(E.showOnNode===!1)return null;const _=`${4.15+D*1.75}rem`,R=E.name||`#${D+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:_},children:R}),o.jsx(Cs,{type:"target",position:Ye.Left,id:`input-${D}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:_,background:Zn(E.type)},title:`${R} · ${E.type}`})]},`in-${D}`)}),a.map(({slot:E,idx:D},_)=>{if(E.showOnNode===!1)return null;const R=`${4.15+_*1.75}rem`,P=E.name||`#${D+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:R},children:P}),o.jsx(Cs,{type:"source",position:Ye.Right,id:`output-${D}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:R,background:Zn(E.type)},title:`${P} · ${E.type}`})]},`out-${D}`)}),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:fq(l)}),o.jsx("strong",{children:F}),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:E=>E.stopPropagation(),children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var E,D,_,R;try{(R=(_=(D=(E=c.current)==null?void 0:E.contentWindow)==null?void 0:D.history)==null?void 0:_.back)==null||R.call(_)}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 E,D,_,R;try{(R=(_=(D=(E=c.current)==null?void 0:E.contentWindow)==null?void 0:D.history)==null?void 0:_.forward)==null||R.call(_)}catch{}},"aria-label":"前进",title:"前进",children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_forward"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>f(E=>E+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:u,onClick:L,"aria-label":"截图另存为图片",title:"截图另存为图片",children:o.jsx("span",{className:"material-symbols-outlined",children:u?"hourglass_empty":"photo_camera"})})]}):null,l==="markdown"?b?o.jsxs("div",{className:"af-work-display-card__html-controls nodrag",onClick:E=>E.stopPropagation(),children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:$,onClick:()=>{var E;(E=t==null?void 0:t.onSetDisplayNodeContent)==null||E.call(t,e,y,"replace",{logChat:!1,statusMessage:"已更新 Markdown 内容"}),v(!1)},"aria-label":"保存并预览",title:"保存并预览",children:o.jsx("span",{className:"material-symbols-outlined",children:"done"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{k(String(C||"")),v(!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:$,onClick:E=>{E.stopPropagation(),k(String(C||"")),v(!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:A,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:E=>{var _;const D=(_=E.target.files)==null?void 0:_[0];E.target.value="",D&&O(D)}}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:$,onClick:E=>{var D;E.stopPropagation(),(D=A.current)==null||D.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:$,onClick:()=>{var E;return(E=t==null?void 0:t.onSaveDisplayNodeToFile)==null?void 0:E.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:$,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l==="markdown"&&b?o.jsx(bq,{value:y,onChange:k,onUploadImage:t==null?void 0:t.onUploadWorkspaceImage,readOnly:$}):o.jsx(xq,{data:t,flowParams:t==null?void 0:t.flowParams,htmlFrameRef:c,htmlFrameVersion:d}),o.jsx(vq,{nodeId:e,data:t})]})}function Cq({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",c=!!(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,f)=>{if(d.showOnNode===!1)return null;const u=`${2.25+f*1.75}rem`,p=d.name||`#${f+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:u},children:p}),o.jsx(Cs,{type:"target",position:Ye.Left,id:`input-${f}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:u,background:Zn(d.type)},title:`${p} · ${d.type}`})]},`in-${f}`)}),i.map((d,f)=>{if(d.showOnNode===!1)return null;const u=`${2.25+f*1.75}rem`,p=d.name||`#${f+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:u},children:p}),o.jsx(Cs,{type:"source",position:Ye.Right,id:`output-${f}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:u,background:Zn(d.type)},title:`${p} · ${d.type}`})]},`out-${f}`)}),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:c,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:c,onClick:d=>{var f,u;d.stopPropagation(),a?(f=t==null?void 0:t.onStopWorkspaceNode)==null||f.call(t,e):(u=t==null?void 0:t.onRunWorkspaceNode)==null||u.call(t,e)},children:[o.jsx("span",{className:"material-symbols-outlined",children:a?"stop_circle":"play_arrow"}),o.jsx("span",{children:a?"Stop":"Run line"})]})]})}function Eq(e){var m,g,b,v,y,k,w,j,A,C,$,B,F;const{setEdges:t,setNodes:n}=hc(),r=(m=e.data)==null?void 0:m.onSyncNodePropDraft,s=!!((g=e.data)!=null&&g.readOnly),[i,a]=h.useState(!1),l=(b=e.data)!=null&&b.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,c=h.useCallback(z=>{s||(n(L=>L.filter(O=>O.id!==z)),t(L=>L.filter(O=>O.source!==z&&O.target!==z)))},[s,t,n]),d=h.useCallback((z,L)=>{s||(n(O=>O.map(W=>W.id===z?{...W,data:{...W.data,model:L}}:W)),r==null||r(z,{model:L}))},[s,n,r]),f=h.useCallback((z,L)=>{s||(n(O=>O.map(W=>{var T;if(W.id!==z)return W;const M=Array.isArray((T=W.data)==null?void 0:T.outputs)&&W.data.outputs.length?W.data.outputs.map((E,D)=>D===0?{...E,default:L,value:L}:E):[{type:"bool",name:"value",default:L,value:L}];return{...W,data:{...W.data,body:"",outputs:M}}})),r==null||r(z,O=>({body:"",outputs:Array.isArray(O==null?void 0:O.outputs)&&O.outputs.length?O.outputs.map((M,T)=>T===0?{...M,default:L,value:L}:M):[{type:"bool",name:"value",default:L,value:L}]})))},[s,n,r]),u=h.useCallback((z,L)=>{s||(n(O=>O.map(W=>W.id===z?{...W,data:{...W.data,body:L}}:W)),r==null||r(z,{body:L}))},[s,n,r]),p=h.useCallback((z,L)=>{if(s)return;const O=ws(L);n(W=>W.map(M=>M.id===z?{...M,data:{...M.data,images:O}}:M)),r==null||r(z,{images:O})},[s,n,r]);return Vn((v=e.data)==null?void 0:v.definitionId)?o.jsx(jq,{...e,deleteNode:c}):((y=e.data)==null?void 0:y.definitionId)==="workspace_run"?o.jsx(Cq,{...e,deleteNode:c}):((k=e.data)==null?void 0:k.definitionId)==="control_load_skills"?o.jsx(Fq,{...e,deleteNode:c,skills:(w=e.data)==null?void 0:w.skills,skillCollections:(j=e.data)==null?void 0:j.skillCollections,onChangeSkillKeys:(A=e.data)==null?void 0:A.onChangeLoadSkillKeys}):((C=e.data)==null?void 0:C.definitionId)==="control_load_mcp"?o.jsx(zq,{...e,deleteNode:c,servers:($=e.data)==null?void 0:$.mcpServers,onChangeMcpNames:(B=e.data)==null?void 0:B.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(LA,{className:"af-work-display-resize af-work-flow-resize nodrag",position:"bottom-right",minWidth:LT,minHeight:gb,maxWidth:OT,maxHeight:MT,onResizeStart:()=>a(!0),onResizeEnd:()=>a(!1),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),o.jsx(hT,{...e,deleteNode:c,modelLists:(F=e.data)==null?void 0:F.modelLists,onModelChange:d,onProvideValueChange:f,onNodeBodyChange:u,onNodeImagesChange:p})]})}const _q={[lp]:Eq};function XT(e,t=[]){for(const n of e||[])n.type==="file"&&t.push(n),Array.isArray(n.children)&&XT(n.children,t);return t}function JT(e,t=[]){for(const n of e||[])n.type==="directory"&&(t.push(n.path),Array.isArray(n.children)&&JT(n.children,t));return t}function Nh(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 Pq(e){return[...e||[]].sort((t,n)=>t.type!==n.type?t.type==="directory"?-1:1:String(t.name||"").localeCompare(String(n.name||"")))}function Aq(e,t,n=0){const r=String(t||"").replace(/\\/g,"/").split("/").filter(Boolean);if(r.length===0)return e;const s=(i,a,l)=>{const c=r[a],d=l?`${l}/${c}`:c,f=a===r.length-1;let u=!1;const p=(Array.isArray(i)?i:[]).map(m=>m.name!==c?m:(u=!0,f?{...m,type:"file",name:c,path:d,icon:Bd(c),size:n}:{...m,type:"directory",name:c,path:d,icon:Bd(c,!0),children:s(m.children||[],a+1,d)}));return u||p.push(f?{type:"file",name:c,path:d,icon:Bd(c),size:n}:{type:"directory",name:c,path:d,icon:Bd(c,!0),children:s([],a+1,d)}),Pq(p)};return s(e||[],0,"")}function QT({items:e,flowParams:t,onOpen:n,collapsedDirs:r,onToggleDir:s,onCreateFile:i,onCreateFolder:a,onDelete:l,onFileDragStart:c}){return o.jsx("ul",{className:"af-work-files",children:(e||[]).map(d=>{var p;const f=d.type==="directory",u=f&&(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:!f,onDragStart:m=>{f||c==null||c(m,d)},onClick:()=>f?s==null?void 0:s(d.path):n(d),title:d.path,children:[f?o.jsx("span",{className:"material-symbols-outlined af-work-file__chevron",children:u?"chevron_right":"expand_more"}):null,o.jsx("span",{className:"material-symbols-outlined",children:d.icon||Bd(d.name,f)}),o.jsx("span",{children:d.name})]}),f?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,f?null:o.jsx("a",{className:"af-work-file-action",href:X7(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"})})]}),f&&!u&&((p=d.children)!=null&&p.length)?o.jsx(QT,{items:d.children,flowParams:t,onOpen:n,collapsedDirs:r,onToggleDir:s,onCreateFile:i,onCreateFolder:a,onDelete:l,onFileDragStart:c}):null]},d.path)})})}function Iq({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 Jm(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 Tq(e){const t=Jm((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 Jm((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function Rq(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function Lq(e){const t=Jm((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 Jm((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function Oq(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function l1(e){var r,s,i,a,l,c;if(!e)return null;const{inputs:t,outputs:n}=uT(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:ws((l=e.data)==null?void 0:l.images),script:String(((c=e.data)==null?void 0:c.script)??""),inputs:t,outputs:n}}function c1(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 Mq(e,t,n){var f,u;const r=String(((f=e==null?void 0:e.data)==null?void 0:f.definitionId)??n),s=r.startsWith("provide_"),i=String((t==null?void 0:t.role)||"").trim(),a=ol.includes(i)?i:"normal",l=String((t==null?void 0:t.model)||"").trim(),c={...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?[]:ws(t==null?void 0:t.images),inputs:c1(t==null?void 0:t.inputs),outputs:s&&Array.isArray((u=e.data)==null?void 0:u.outputs)?e.data.outputs:c1(t==null?void 0:t.outputs)},d=String((t==null?void 0:t.script)??"").trim();return r==="tool_nodejs"||d!==""?c.script=String((t==null?void 0:t.script)??""):delete c.script,c}function u1({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(),c=i?l:a;if(i){if(!vT.test(c))return{ok:!1,error:"Invalid instance id"};if(e.some(b=>b.id===c&&b.id!==a))return{ok:!1,error:"Duplicate instance id"}}const d=Mq(r,s,c),f=r.data||{};if(!(c!==a||f.label!==d.label||f.role!==d.role||f.model!==d.model||f.body!==d.body||JSON.stringify(ws(f.images))!==JSON.stringify(d.images)||(f.script??void 0)!==(d.script??void 0)||JSON.stringify(f.inputs||[])!==JSON.stringify(d.inputs||[])||JSON.stringify(f.outputs||[])!==JSON.stringify(d.outputs||[])))return{ok:!0,changed:!1,nextId:c,nodes:e,edges:t,instances:n};const p=e.map(b=>b.id===a?{...b,id:c,selected:!0,data:d}:b);let m=t,g=n;if(c!==a){g={...n||{}};const b={...g[a]||{}};delete g[a],g[c]=b,m=t.map((v,y)=>({...v,source:v.source===a?c:v.source,target:v.target===a?c:v.target,id:`we-${v.source===a?c:v.source}-${v.target===a?c:v.target}-${y}`}))}return{ok:!0,changed:!0,nextId:c,nodes:p,edges:m,instances:g}}function $q(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function Dq(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"])$q(e[s],t[s])&&(r[s]=n[s]);return r}function Fq({id:e,data:t,selected:n,deleteNode:r,skills:s,skillCollections:i,onChangeSkillKeys:a}){const l=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],c=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],d=Array.isArray(s)?s:[],f=Array.isArray(i)?i:[],[u,p]=h.useState(!1),[m,g]=h.useState(""),[b,v]=h.useState(()=>new Set),y=h.useRef(null),k=h.useRef(null),[w,j]=h.useState({visible:!1,top:0,height:100}),A=h.useMemo(()=>new Set(Tq(t)),[t]),C=h.useMemo(()=>new Map(d.map(T=>[T.key,T])),[d]),$=h.useMemo(()=>{const T=new Set,E=f.map(_=>{const R=sl(_,d).map(P=>C.get(P)).filter(Boolean);for(const P of R)T.add(P.key);return{..._,skills:R}}).filter(_=>_.skills.length>0),D=d.filter(_=>!T.has(_.key));return{collectionGroups:E,ungrouped:D}},[C,f,d]);h.useEffect(()=>{v(T=>{let E=!1;const D=new Set(T);for(const _ of $.collectionGroups)D.has(_.id)||(D.add(_.id),E=!0);return E?D:T})},[$.collectionGroups]);const B=h.useMemo(()=>{const T=m.trim().toLowerCase();if(!T)return $;const E=_=>[_==null?void 0:_.key,_==null?void 0:_.name,_==null?void 0:_.description].map(P=>String(P||"").toLowerCase()).join(" ").includes(T);return{collectionGroups:$.collectionGroups.map(_=>{const P=[_==null?void 0:_.id,_==null?void 0:_.name,_==null?void 0:_.description].map(G=>String(G||"").toLowerCase()).join(" ").includes(T)?_.skills:_.skills.filter(E);return{..._,skills:P}}).filter(_=>_.skills.length>0),ungrouped:$.ungrouped.filter(E)}},[$,m]),F=h.useCallback((T,E)=>{const D=new Set(A);for(const _ of T)E?D.add(_):D.delete(_);a==null||a(e,Array.from(D))},[e,A,a]),z=h.useCallback(T=>{v(E=>{const D=new Set(E);return D.has(T)?D.delete(T):D.add(T),D})},[]),L=h.useCallback(()=>{const T=y.current;if(!T)return;const E=Math.max(1,T.scrollHeight),D=Math.max(1,T.clientHeight),_=E>D+1,R=_?Math.max(12,D/E*100):100,P=Math.max(0,100-R),G=_?Math.min(P,T.scrollTop/Math.max(1,E-D)*P):0;j({visible:_,top:G,height:R})},[]);h.useEffect(()=>{if(!u)return;const T=requestAnimationFrame(L);return()=>cancelAnimationFrame(T)},[b,B,A.size,u,L]);const O=h.useCallback(T=>{const E=y.current;if(!E)return;const D=Math.max(0,E.scrollHeight-E.clientHeight);E.scrollTop=Math.min(1,Math.max(0,T))*D,L()},[L]),W=h.useCallback((T,E=0)=>{const D=k.current;if(!D)return 0;const _=D.getBoundingClientRect(),R=w.height/100*_.height,P=Math.max(1,_.height-R);return(T-_.top-E)/P},[w.height]),M=h.useCallback(T=>{var ue,pe;if(!w.visible)return;T.preventDefault(),T.stopPropagation();const E=k.current;if(!E)return;const D=E.getBoundingClientRect(),_=w.top/100*D.height,R=w.height/100*D.height,G=T.clientY>=D.top+_&&T.clientY<=D.top+_+R?T.clientY-D.top-_:R/2;O(W(T.clientY,G));const Z=T.pointerId;(pe=(ue=T.currentTarget).setPointerCapture)==null||pe.call(ue,Z);const V=ge=>{ge.preventDefault(),O(W(ge.clientY,G))},se=()=>{window.removeEventListener("pointermove",V),window.removeEventListener("pointerup",se),window.removeEventListener("pointercancel",se)};window.addEventListener("pointermove",V),window.addEventListener("pointerup",se),window.addEventListener("pointercancel",se)},[W,O,w.height,w.top,w.visible]);return o.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":""),children:[l.map((T,E)=>{if(T.showOnNode===!1)return null;const D=`${2.6+E*1.7}rem`,_=T.name||`#${E+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:D},children:_}),o.jsx(Cs,{type:"target",position:Ye.Left,id:`input-${E}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:D,background:Zn(T.type)},title:`${_} · ${T.type}`})]},`in-${E}`)}),c.map((T,E)=>{if(T.showOnNode===!1)return null;const D=`${2.6+E*1.7}rem`,_=T.name||`#${E+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:D},children:_}),o.jsx(Cs,{type:"source",position:Ye.Right,id:`output-${E}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:D,background:Zn(T.type)},title:`${_} · ${T.type}`})]},`out-${E}`)}),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:T=>{var E;T.stopPropagation(),u||(E=t==null?void 0:t.onRefreshSkills)==null||E.call(t),p(D=>!D)},children:[o.jsx("span",{children:A.size>0?`${A.size} skills selected`:"选择 Skills"}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:u?"expand_less":"expand_more"})]}),u?o.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick:T=>T.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:T=>g(T.target.value),placeholder:"搜索 Skills...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Skills"}),m?o.jsx("button",{type:"button",onClick:()=>g(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{ref:y,className:"af-work-load-skills-menu",onScroll:L,children:[B.collectionGroups.map(T=>{const E=T.skills.map(P=>P.key),D=E.filter(P=>A.has(P)).length,_=E.length>0&&D===E.length,R=b.has(T.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:_,onChange:P=>F(E,P.target.checked),"aria-label":`选择 ${T.name}`}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-toggle",onClick:()=>z(T.id),"aria-expanded":!R,children:o.jsxs("span",{className:"af-work-load-skills-menu__group-main",children:[o.jsx("span",{children:T.name}),T.description?o.jsx("em",{children:T.description}):null]})}),o.jsxs("small",{children:[D,"/",E.length]}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-arrow",onClick:()=>z(T.id),"aria-label":R?`展开 ${T.name}`:`收起 ${T.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:T.skills.map(P=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:A.has(P.key),onChange:G=>F([P.key],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:P.name}),P.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:P.description}):null]})]},`${T.id}:${P.key}`))})]},T.id)}),B.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:B.ungrouped.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:B.ungrouped.map(T=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:A.has(T.key),onChange:E=>F([T.key],E.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:T.name}),T.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:T.description}):null]})]},`ungrouped:${T.key}`))})]}):null,B.collectionGroups.length===0&&B.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:k,className:"af-work-load-skills-scrollbar"+(w.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:M,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${w.height}%`,top:`${w.top}%`}})})]}):null]})]})}function zq({id:e,data:t,selected:n,deleteNode:r,servers:s=[],onChangeMcpNames:i}){const a=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],l=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],[c,d]=h.useState(!1),[f,u]=h.useState(""),p=h.useMemo(()=>new Set(Lq(t)),[t]),m=h.useMemo(()=>(Array.isArray(s)?s:[]).map(v=>({name:String((v==null?void 0:v.name)||""),description:String((v==null?void 0:v.description)||""),detail:String((v==null?void 0:v.url)||[v==null?void 0:v.command,...Array.isArray(v==null?void 0:v.args)?v.args:[]].filter(Boolean).join(" ")||""),type:String((v==null?void 0:v.type)||"")})).filter(v=>v.name),[s]),g=h.useMemo(()=>{const v=f.trim().toLowerCase();return v?m.filter(y=>[y.name,y.description,y.detail,y.type].join(" ").toLowerCase().includes(v)):m},[f,m]),b=h.useCallback((v,y)=>{const k=new Set(p);for(const w of v)y?k.add(w):k.delete(w);i==null||i(e,Array.from(k))},[e,p,i]);return o.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":""),children:[a.map((v,y)=>{if(v.showOnNode===!1)return null;const k=`${2.6+y*1.7}rem`,w=v.name||`#${y+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:k},children:w}),o.jsx(Cs,{type:"target",position:Ye.Left,id:`input-${y}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:k,background:Zn(v.type)},title:`${w} · ${v.type}`})]},`in-${y}`)}),l.map((v,y)=>{if(v.showOnNode===!1)return null;const k=`${2.6+y*1.7}rem`,w=v.name||`#${y+1}`;return o.jsxs(h.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:k},children:w}),o.jsx(Cs,{type:"source",position:Ye.Right,id:`output-${y}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:k,background:Zn(v.type)},title:`${w} · ${v.type}`})]},`out-${y}`)}),o.jsxs("div",{className:"af-work-load-skills-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"hub"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"Load MCP"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"control_load_mcp"}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-load-skills-card__body nodrag",children:[o.jsxs("button",{type:"button",className:"af-work-load-skills-card__select",onClick:v=>{var y;v.stopPropagation(),c||(y=t==null?void 0:t.onRefreshMcps)==null||y.call(t),d(k=>!k)},children:[o.jsx("span",{children:p.size>0?`${p.size} MCP selected`:"选择 MCP"}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:c?"expand_less":"expand_more"})]}),c?o.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick:v=>v.stopPropagation(),children:[o.jsxs("div",{className:"af-work-load-skills-search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:f,onChange:v=>u(v.target.value),placeholder:"搜索 MCP...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 MCP"}),f?o.jsx("button",{type:"button",onClick:()=>u(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{className:"af-work-load-skills-menu",children:[o.jsxs("section",{className:"af-work-load-skills-menu__group",children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[o.jsx("span",{children:"MCP Servers"}),o.jsx("small",{children:g.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:g.map(v=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:p.has(v.name),onChange:y=>b([v.name],y.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:v.name}),v.description||v.detail?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:v.description||v.detail}):null]})]},v.name))})]}),g.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 MCP"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>i==null?void 0:i(e,[]),children:"清空"})]})]}):null]})]})}function Bq(){var un,en;const{i18n:e}=kn(),{navigate:t}=No(),n=hc(),r=Bv(),s=h.useMemo(G7,[]),[i,a]=h.useState(()=>new URLSearchParams(window.location.search).get("view")==="display"?"display":"workspace"),[l,c]=PA([]),[d,f,u]=AA([]),p=h.useRef([]),m=h.useRef([]),[g,b]=h.useState(()=>wb(null,[])),v=h.useRef(g),[y,k]=h.useState(null),w=h.useRef(null),[j,A]=h.useState([]),C=h.useRef(new Map),$=h.useRef(new Map),B=h.useRef(null),F=h.useRef(null),z=h.useRef(null),[L,O]=h.useState(null),[W,M]=h.useState({}),T=h.useRef({}),E=h.useRef(!1),D=h.useRef(null),[_,R]=h.useState([]),[P,G]=h.useState(""),[Z,V]=h.useState("nodes"),[se,ue]=h.useState([]),[pe,ge]=h.useState(!1),[ae,be]=h.useState(""),[Pe,we]=h.useState(!1),[_e,Ie]=h.useState({name:"",id:"",description:""}),[st,ct]=h.useState(!1),[et,Et]=h.useState(""),[Ue,St]=h.useState(""),tn=h.useRef(null),[gn,Tn]=h.useState(!1),[zt,Rn]=h.useState(!1),[Bn,le]=h.useState(""),[fe,ze]=h.useState(null),[Ze,ot]=h.useState({title:"",layout:"gallery",nodeIds:[]}),[Jt,nn]=h.useState(!1),[Ln,yn]=h.useState(!1),[ir,rn]=h.useState(""),[Sn,Zt]=h.useState(!1),[Nn,xe]=h.useState("nodes"),[Re,it]=h.useState(""),[re,Ce]=h.useState(0),[Ge,Ct]=h.useState(""),[Ke,jn]=h.useState(null),hi=h.useRef(null),[Eo,vr]=h.useState(""),[kr,_o]=h.useState([]),[or,qs]=h.useState(""),[Me,ca]=h.useState(!0),[mi,Yn]=h.useState(""),[Oe,Bt]=h.useState(()=>new Set),Sr=h.useRef(null),[mt,Yi]=h.useState(()=>{try{const S=Number(window.localStorage.getItem("agentflow.workspace.filesPaneHeight")||0);if(Number.isFinite(S)&&S>=160)return S}catch{}return 360}),[er,Hn]=h.useState(!1),[Nr,lt]=h.useState({cursor:[],opencode:[],claudeCode:[]}),[Ht,qt]=h.useState(""),[On,Je]=h.useState([]),[ar,_s]=h.useState(!1),[jr,gi]=h.useState([]),[Ps,Po]=h.useState([]),[Gi,Ao]=h.useState(!1),[Ys,cn]=h.useState([]),As=h.useCallback(S=>{tn.current&&window.clearTimeout(tn.current),St(S),tn.current=window.setTimeout(()=>{St(""),tn.current=null},3800)},[]),Is=h.useCallback(S=>{const I=String(S||"").trim();if(!I)return;const U=()=>r(I);window.requestAnimationFrame(U),window.setTimeout(U,80)},[r]);h.useEffect(()=>{try{window.localStorage.setItem("agentflow.workspace.filesPaneHeight",String(Math.round(mt)))}catch{}},[mt]);const Ts=h.useCallback(S=>{const I=Sr.current;if(!I)return;const U=I.getBoundingClientRect(),X=16,Q=150,ie=230,te=U.top+X,oe=U.bottom-X,de=Math.max(Q,oe-te-ie),Se=Math.min(Math.max(S-te,Q),de);Yi(Se)},[]),Gs=h.useCallback(S=>{S.preventDefault(),S.stopPropagation(),Hn(!0),Ts(S.clientY);const I=X=>{X.preventDefault(),Ts(X.clientY)},U=()=>{Hn(!1),window.removeEventListener("pointermove",I,!0),window.removeEventListener("pointerup",U,!0),window.removeEventListener("pointercancel",U,!0)};window.addEventListener("pointermove",I,!0),window.addEventListener("pointerup",U,!0),window.addEventListener("pointercancel",U,!0)},[Ts]);h.useEffect(()=>()=>{tn.current&&window.clearTimeout(tn.current)},[]);const[K,me]=h.useState(()=>new Set),[Te,Ae]=h.useState(!1),Xe=h.useRef(null),Wt=h.useRef(null),Ot=h.useRef(null),[tr,Cr]=h.useState({}),[Xs,Io]=h.useState(""),[Br,lr]=h.useState(!1),[ua,hl]=h.useState([]),[Qu,nr]=h.useState([]),[gc,Xi]=h.useState("workspace"),[To,Ro]=h.useState(!1),[yc,Yt]=h.useState(!0),[xc,Mn]=h.useState(""),[Ji,yi]=h.useState({}),[Js,da]=h.useState(!1),[ml,Qi]=h.useState(!1),[cr,gl]=h.useState(!1),[Lo,yl]=h.useState("pan"),[Hr,fa]=h.useState(null),[xi,pa]=h.useState(""),Zi=h.useRef(null),cs=h.useRef(!1),[hp,Er]=h.useState(()=>new Set),[xl,eo]=h.useState({}),[wl,Le]=h.useState(""),Qs=h.useMemo(()=>J7(s),[s]),[bl,Zu]=h.useState("");h.useEffect(()=>{s.flowId&&R_(s.flowId,s.flowSource||"user","workspace",!!s.archived)},[s]),h.useEffect(()=>{const S=()=>{a(new URLSearchParams(window.location.search).get("view")==="display"?"display":"workspace")};return window.addEventListener("popstate",S),()=>window.removeEventListener("popstate",S)},[]),h.useEffect(()=>{hl([]),nr([]),Xi("workspace"),Yt(!0)},[s]);const Gn=h.useCallback(async()=>{const S=Oa(s),I=await fetch(`/api/workspace/files?${S.toString()}`),U=await I.json();if(!I.ok)throw new Error(U.error||"读取 workspace 失败");const X=U.files||[];_o(X),Bt(new Set(JT(X))),qs(U.root||"")},[s]),Oo=h.useCallback(async()=>{ge(!0),be("");try{const S=await fetch("/api/marketplace/flow-snippets"),I=await S.json().catch(()=>({}));if(!S.ok)throw new Error(I.error||"读取流程片段失败");ue(Array.isArray(I.snippets)?I.snippets:[])}catch(S){be(String(S.message||S)),ue([])}finally{ge(!1)}},[]),Cn=h.useCallback(async(S=l,I=d)=>{var ie;if(!E.current)return;if(!Me)throw Le("Readonly workspace"),new Error("Readonly workspace");const U=Sh(S,I,T.current);U.ui={...U.ui||{},...w.current?{viewport:w.current}:{},displayPage:iq(v.current,S)};const X=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,graph:U})}),Q=await X.json();if(!X.ok)throw new Error(Q.error||"保存 workspace graph 失败");T.current=((ie=Q.graph)==null?void 0:ie.instances)||U.instances,M(T.current),Le("Workspace graph saved")},[d,s,l,Me]),us=h.useCallback(S=>{var U;const I=(U=S==null?void 0:S.extra)!=null&&U.instances&&typeof S.extra.instances=="object"?S.extra.instances:{};T.current=I,M(I),c(Array.isArray(S==null?void 0:S.nodes)?S.nodes:[]),f(Array.isArray(S==null?void 0:S.edges)?S.edges:[]),Ct(""),O(null)},[f,c]),vl=h.useMemo(()=>({instances:W}),[W]),wc=fT({nodes:l,edges:d,extra:vl,enabled:E.current,onRestore:us}),{resetHistory:ha,undo:ma,redo:ga}=wc,ya=h.useCallback(async()=>{var ft,tt;E.current=!1;const S=Oa(s),I=Oa(s);I.set("lang",String(e.language||"zh").startsWith("zh")?"zh":"en");const[U,X]=await Promise.all([fetch(`/api/nodes?${I.toString()}`),fetch(`/api/workspace/graph?${S.toString()}`),Gn()]),Q=await U.json(),ie=await X.json();if(!U.ok)throw new Error(Q.error||"读取节点定义失败");if(!X.ok)throw new Error(ie.error||"读取 workspace graph 失败");const te=[...(Array.isArray(Q)?Q:Q.nodes||[]).filter(bt=>!H7.has(bt.id)),V7,U7,W7];R(te);const oe=ie.graph||JSON.parse(localStorage.getItem(B7)||"null")||{},de=wx(oe,te),Se=wb((ft=oe==null?void 0:oe.ui)==null?void 0:ft.displayPage,de.nodes),Qe=zT((tt=oe==null?void 0:oe.ui)==null?void 0:tt.viewport);T.current=de.instances,M(de.instances),c(de.nodes),f(de.edges),b(Se),v.current=Se,k(Qe),w.current=Qe,A([]),ha(de.nodes,de.edges,{instances:de.instances});const qe=ie.writable!==!1;ca(qe),Le(qe?"Workspace ready":"Readonly workspace"),E.current=!0},[s,e.language,Gn,ha,f,c]),ed=h.useCallback(async(S,I)=>{const U={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:I,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:s.flowId,flowSource:s.flowSource||"user",archived:!!s.archived},X=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(U)}),Q=await X.json().catch(()=>({}));if(!X.ok||(Q==null?void 0:Q.ok)===!1)throw new Error((Q==null?void 0:Q.error)||"Publish failed");return await ya(),Le(`Published node ${Q.definitionId||Q.id||U.packageId}`),Q},[s,ya]),kl=h.useCallback((S="workspace")=>{Ro(!0),jn(null),Xi(S||"workspace")},[]),xa=h.useCallback(async(S="")=>{const I=String(S||xi||"").trim();if(I){cs.current=!0,Zi.current&&(Zi.current.abort(),Zi.current=null),pa(""),Er(new Set),eo(U=>{const X={...U};for(const[Q,ie]of Object.entries(X))(ie==null?void 0:ie.status)==="running"&&(X[Q]={status:"stopped"});return X[I]={status:"stopped"},X}),Le(`Workspace run stopped: ${I}`),nr(U=>U.map(X=>X.runNodeId===I&&X.status==="running"?{...X,status:"stopped",endedAt:Date.now(),messages:[...Array.isArray(X.messages)?X.messages:[],{role:"assistant",kind:"status",text:"Workspace run stopped.",at:Date.now()}].slice(-160)}:X));try{await fetch("/api/workspace/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,runNodeId:I})})}catch{}}},[s,xi]),bc=h.useCallback(async S=>{if(!Me){Le("Readonly workspace");return}if(!S||xi)return;let I=l,U=d,X=T.current;const Q=hi.current;if(Q!=null&&Q.id){const Se=I.find(qe=>qe.id===Q.id),Qe=u1({nodes:I,edges:U,instances:X,selectedNode:Se,draft:Q,allowRename:!1});if(Qe!=null&&Qe.error){vr(Qe.error),Le(Qe.error);return}Qe!=null&&Qe.ok&&Qe.changed&&(I=Qe.nodes,U=Qe.edges,X=Qe.instances,T.current=X,M(X),c(I),f(U),Is(Qe.nextId||Q.id))}const ie=Sh(I,U,X),te=`run-${Date.now()}-${String(S).replace(/[^a-z0-9_-]+/gi,"_")}`,oe=`Run ${S}`,de=new AbortController;Zi.current=de,cs.current=!1,pa(S),Er(new Set([S])),eo({[S]:{status:"running"}}),Le(`Running ${S}...`),Xi(te),nr(Se=>[...Se.slice(-7),{id:te,label:oe,runNodeId:S,status:"running",startedAt:Date.now(),steps:[],messages:[{role:"assistant",kind:"run-summary",text:"准备运行...",at:Date.now()}]}]);try{await Cn(I,U);const Se=await fetch("/api/workspace/run",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},signal:de.signal,body:JSON.stringify({...s,graph:ie,runNodeId:S,model:Ht,selectedSkills:jr,stream:!0})});if(!Se.ok){const ve=await Se.json().catch(()=>({}));throw new Error(ve.error||"Workspace run failed")}if(!Se.body)throw new Error("Workspace run stream unavailable");const Qe=Se.body.getReader(),qe=new TextDecoder;let ft="",tt=[],bt=[],dn=S;const Ur=(ve,ut)=>{var Tt,Gt;const pt=l.find(Nt=>Nt.id===ve),nt=String(((Tt=pt==null?void 0:pt.data)==null?void 0:Tt.label)||ve||"").trim(),De=String(ut||((Gt=pt==null?void 0:pt.data)==null?void 0:Gt.definitionId)||"").trim();return De&&De!==nt?`${nt} (${De})`:nt},Dt=(ve,ut,pt)=>{const nt=String(ve||"").trim();nt&&nr(De=>De.map(Tt=>{if(Tt.id!==te)return Tt;const Nt=[...Array.isArray(Tt.steps)?Tt.steps:[]],sn=Nt.findIndex(zo=>zo.id===nt),on={id:nt,label:Ur(nt,ut),status:pt};sn>=0?Nt[sn]={...Nt[sn],...on}:Nt.push(on);const _t=Nt.map((zo,_c)=>{const ey=zo.status==="done"?"[done]":zo.status==="failed"?"[failed]":"[running]";return`${_c+1}. ${ey} ${zo.label}`}).join(`
|
|
164
|
-
`),an=Array.isArray(Tt.messages)?Tt.messages:[],ts=an.findIndex(zo=>zo.kind==="run-summary"),ni={role:"assistant",kind:"run-summary",text:_t||"准备运行...",at:Date.now()},Ls=[...an];return ts>=0?Ls[ts]=ni:Ls.unshift(ni),{...Tt,steps:Nt,messages:Ls.slice(-160)}}))},Tr=ve=>{const ut=String(ve||"").trim();if(!ut)return;const pt=dn;dn=ut,Er(new Set([ut])),eo(nt=>{var De;return{...nt,...pt&&pt!==ut&&((De=nt[pt])==null?void 0:De.status)==="running"?{[pt]:{status:"success"}}:{},[ut]:{status:"running"}}})},Rr=ve=>{const ut=String(ve||"").trim();ut&&(Er(pt=>{const nt=new Set(pt);return nt.delete(ut),nt}),eo(pt=>({...pt,[ut]:{status:"success"}})))},Wn=(ve,ut)=>{const pt=String(ut||"");if(!pt.trim())return;const nt=["assistant","thinking","result","error","prompt"].includes(ve)?ve:"assistant";nr(De=>De.map(Tt=>{if(Tt.id!==te)return Tt;let Gt=Array.isArray(Tt.messages)?Tt.messages:[];if(nt==="result"){const on=[...Gt].reverse().find(_t=>_t.kind==="assistant");if(String((on==null?void 0:on.text)||"").trim()===pt.trim())return Tt}if(nt==="assistant"){const on=Gt.findIndex(_t=>_t.kind==="result"&&String(_t.text||"").trim()===pt.trim());on>=0&&(Gt=Gt.filter((_t,an)=>an!==on))}const Nt=[...Gt],sn=Nt[Nt.length-1];return sn&&sn.kind===nt&&!sn.error?Nt[Nt.length-1]={...sn,text:`${sn.text||""}${sn.text?`
|
|
165
|
-
`:""}${pt}`}:Nt.push({role:"assistant",kind:nt,text:pt,...nt==="error"?{error:!0}:{},at:Date.now()}),{...Tt,messages:Nt.slice(-160)}}))},ei=ve=>{const ut=String(ve||"");ut.trim()&&nr(pt=>pt.map(nt=>{var Nt;if(nt.id!==te)return nt;const De=Array.isArray(nt.messages)?nt.messages:[],Tt=De.findIndex(sn=>sn.kind==="thinking"),Gt=[...De];if(Tt>=0){const sn=String(((Nt=Gt[Tt])==null?void 0:Nt.text)||"");Gt[Tt]={...Gt[Tt],text:`${sn}${sn&&!sn.endsWith(`
|
|
166
|
-
`),""}${ut}`,at:Date.now()}}else{const sn=Gt.findIndex(on=>on.kind==="activity");Gt.splice(sn>=0?sn+1:Gt.length,0,{role:"assistant",kind:"thinking",text:ut,at:Date.now()})}return{...nt,messages:Gt.slice(-160)}}))},Ne=ve=>{const ut=Z7(ve);ut&&nr(pt=>pt.map(nt=>{if(nt.id!==te)return nt;const De=Array.isArray(nt.activities)?nt.activities:[],Tt=De[De.length-1]===ut?De:[...De,ut].slice(-8),Gt=Array.isArray(nt.messages)?nt.messages:[],Nt=Gt.findIndex(_t=>_t.kind==="activity"),sn={role:"assistant",kind:"activity",text:Tt.map((_t,an)=>`${an+1}. ${_t}`).join(`
|
|
167
|
-
`),at:Date.now()},on=[...Gt];if(Nt>=0)on[Nt]=sn;else{const _t=on.findIndex(an=>an.kind==="run-summary");on.splice(_t>=0?_t+1:0,0,sn)}return{...nt,activities:Tt,messages:on.slice(-160)}}))},Ft=ve=>{const ut=String((ve==null?void 0:ve.source)||"runner"),pt=String((ve==null?void 0:ve.stream)||""),nt=String((ve==null?void 0:ve.eventType)||"event"),De=String((ve==null?void 0:ve.text)||"").trim();if(!De)return;const Tt=`[${ut}${pt?`:${pt}`:""}] ${nt}
|
|
168
|
-
${De}`;nr(Gt=>Gt.map(Nt=>{if(Nt.id!==te)return Nt;const on=[...Array.isArray(Nt.rawTrace)?Nt.rawTrace:[],Tt].slice(-80),_t=Array.isArray(Nt.messages)?Nt.messages:[],an=_t.findIndex(Ls=>Ls.kind==="raw"),ts={role:"assistant",kind:"raw",text:on.join(`
|
|
169
|
-
|
|
170
|
-
---
|
|
171
|
-
|
|
172
|
-
`),at:Date.now()},ni=[..._t];return an>=0?ni[an]=ts:ni.push(ts),{...Nt,rawTrace:on,messages:ni.slice(-160)}}))},ti=ve=>{nr(ut=>ut.map(pt=>pt.id===te?{...pt,status:ve,endedAt:Date.now()}:pt))},Ll=ve=>{const ut=new Set,pt=String((ve==null?void 0:ve.nodeId)||"").trim();pt&&ut.add(pt);for(const nt of Array.isArray(ve==null?void 0:ve.displayNodeIds)?ve.displayNodeIds:[]){const De=String(nt||"").trim();De&&ut.add(De)}for(const nt of Array.isArray(ve==null?void 0:ve.touchedNodeIds)?ve.touchedNodeIds:[]){const De=String(nt||"").trim();De&&ut.add(De)}if(ut.size===0)for(const nt of Array.isArray(ve==null?void 0:ve.order)?ve.order:[]){const De=String(nt||"").trim();De&&ut.add(De)}return ut},ja=(ve,ut=null)=>{const pt=wx(ve||ie,_),nt=new Map(pt.nodes.map(Gt=>[Gt.id,Gt])),De=pt.instances||{},Tt=ut instanceof Set?ut:null;c(Gt=>{const Nt=new Set(Gt.map(_t=>_t.id)),on={...Sh(Gt,m.current,T.current).instances||{}};for(const[_t,an]of Object.entries(De)){if(Tt&&!Tt.has(_t)||!Nt.has(_t))continue;const ts=on[_t];Vn((an==null?void 0:an.definitionId)||(ts==null?void 0:ts.definitionId))?on[_t]=an:Array.isArray(an==null?void 0:an.output)&&(on[_t]={...ts||an,output:an.output})}return T.current=on,M(on),Gt.map(_t=>{var ts,ni,Ls;if(Tt&&!Tt.has(_t.id))return _t;const an=nt.get(_t.id);return an?Vn(((ts=an.data)==null?void 0:ts.definitionId)||((ni=_t.data)==null?void 0:ni.definitionId))?{..._t,data:{..._t.data,...an.data}}:Array.isArray((Ls=an.data)==null?void 0:Ls.outputs)?{..._t,data:{..._t.data,outputs:an.data.outputs}}:_t:_t})})};for(;;){const{value:ve,done:ut}=await Qe.read();if(ut)break;ft+=qe.decode(ve,{stream:!0});const pt=ft.split(`
|
|
173
|
-
`);ft=pt.pop()||"";for(const nt of pt){if(!nt.trim())continue;const De=JSON.parse(nt);if(De.type==="error")throw new Error(De.error||"Workspace run failed");if(De.type==="stopped"){cs.current=!0,tt=Array.isArray(De.order)?De.order:tt;continue}if(De.type==="node-start"&&(Le(`Running ${De.nodeId}...`),Tr(De.nodeId),Dt(De.nodeId,De.definitionId,"running")),De.type==="node-done"&&(Rr(De.nodeId),Dt(De.nodeId,De.definitionId,"done")),De.type==="status"&&Ne(De.line||De.message||""),De.type==="paused"&&(bt=Array.isArray(De.nodeIds)?De.nodeIds:[]),De.type==="natural"&&(De.kind==="thinking"?ei(De.text||""):Wn(De.kind,De.text||"")),De.type==="raw"){const Tt=Zj(De);Tt&&ei(Tt),Ft(De)}De.type==="graph"&&De.graph&&ja(De.graph,Ll(De)),De.type==="done"&&(De.graph&&ja(De.graph,Ll(De)),tt=Array.isArray(De.order)?De.order:[],bt=Array.isArray(De.pauseNodeIds)?De.pauseNodeIds:bt)}}if(ft.trim()){const ve=JSON.parse(ft);if(ve.type==="error")throw new Error(ve.error||"Workspace run failed");if(ve.type==="stopped"&&(cs.current=!0),ve.type==="node-start"&&(Le(`Running ${ve.nodeId}...`),Tr(ve.nodeId),Dt(ve.nodeId,ve.definitionId,"running")),ve.type==="node-done"&&(Rr(ve.nodeId),Dt(ve.nodeId,ve.definitionId,"done")),ve.type==="status"&&Ne(ve.line||ve.message||""),ve.type==="paused"&&(bt=Array.isArray(ve.nodeIds)?ve.nodeIds:[]),ve.type==="natural"&&(ve.kind==="thinking"?ei(ve.text||""):Wn(ve.kind,ve.text||"")),ve.type==="raw"){const ut=Zj(ve);ut&&ei(ut),Ft(ve)}ve.type==="graph"&&ve.graph&&ja(ve.graph,Ll(ve)),ve.type==="done"&&(ve.graph&&ja(ve.graph,Ll(ve)),tt=Array.isArray(ve.order)?ve.order:[],bt=Array.isArray(ve.pauseNodeIds)?ve.pauseNodeIds:bt)}cs.current&&(Er(new Set),eo(ve=>{var pt;const ut=((pt=Object.entries(ve).find(([,nt])=>(nt==null?void 0:nt.status)==="running"))==null?void 0:pt[0])||S;return ut?{...ve,[ut]:{status:"stopped"}}:ve})),Le(cs.current?`Workspace run stopped: ${S}`:bt.length?`Workspace run paused at ${bt.join(", ")}`:`Workspace run done: ${tt.length?tt.join(" -> "):S}`),ti(cs.current?"stopped":bt.length?"paused":"done"),cs.current||await Gn()}catch(Se){if(cs.current||(Se==null?void 0:Se.name)==="AbortError"){Er(new Set),eo(Qe=>{var ft;const qe=((ft=Object.entries(Qe).find(([,tt])=>(tt==null?void 0:tt.status)==="running"))==null?void 0:ft[0])||S;return qe?{...Qe,[qe]:{status:"stopped"}}:Qe}),Le(`Workspace run stopped: ${S}`),nr(Qe=>Qe.map(qe=>qe.id===te?{...qe,status:"stopped",endedAt:Date.now()}:qe));return}Er(new Set),eo(Qe=>{var ft;const qe=(ft=Object.entries(Qe).find(([,tt])=>(tt==null?void 0:tt.status)==="running"))==null?void 0:ft[0];return qe?{...Qe,[qe]:{status:"failed"}}:Qe}),Le(String(Se.message||Se)),nr(Qe=>Qe.map(qe=>qe.id===te?{...qe,status:"failed",endedAt:Date.now(),messages:[...Array.isArray(qe.messages)?qe.messages:[],{role:"assistant",error:!0,text:String(Se.message||Se),at:Date.now()}].slice(-160)}:qe))}finally{Zi.current===de&&(Zi.current=null),pa(""),Er(new Set)}},[Ht,d,s,Gn,l,_,Is,xi,Cn,jr,f,c,Me]),Sl=h.useCallback(async()=>{try{const I=await(await fetch("/api/skills")).json().catch(()=>({})),U=Array.isArray(I.skills)?I.skills.map(X=>({key:String(X.key),name:String(X.name||X.id||X.key),description:X.description?String(X.description):"",sourceLabel:X.sourceLabel?String(X.sourceLabel):""})):[];Je(U),_s(!0)}catch{_s(!0)}},[]),wa=h.useCallback(async()=>{try{const I=await(await fetch("/api/mcps")).json().catch(()=>({})),U=Array.isArray(I.servers)?I.servers.map(X=>({name:String((X==null?void 0:X.name)||""),type:String((X==null?void 0:X.type)||""),url:String((X==null?void 0:X.url)||""),command:String((X==null?void 0:X.command)||""),args:Array.isArray(X==null?void 0:X.args)?X.args.map(String):[],description:String((X==null?void 0:X.description)||"")})).filter(X=>X.name):[];cn(U)}catch{cn([])}},[]);h.useEffect(()=>{ya().catch(S=>Le(String(S.message||S))),Oo(),fetch("/api/model-lists").then(S=>S.json()).then(S=>lt({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(()=>{}),Sl(),wa(),fetch("/api/skill-collections").then(S=>S.json()).then(S=>{Po(Qa(S)),Ao(!0)}).catch(()=>{}),fetch("/api/auth/me").then(S=>S.json()).then(S=>fa(S.user||null)).catch(()=>fa(null))},[ya,Oo,wa,Sl,Qs]),h.useEffect(()=>{if(Zu(""),!(!ar||!Gi)){if(!Qs){gi([]);return}gi($_(Qs,"workspace",On,Ps)),Zu(Qs)}},[Ps,Gi,On,ar,Qs]),h.useEffect(()=>{if(!(bl!==Qs||!Qs))try{localStorage.setItem(Qs,JSON.stringify(jr))}catch{}},[jr,Qs,bl]),h.useEffect(()=>{T.current=W},[W]),h.useEffect(()=>{p.current=l},[l]),h.useEffect(()=>{const S=C.current,I=new Map,U=[];for(const te of l){const oe=FT(te);I.set(te.id,oe),S.get(te.id)!==oe&&U.push(te.id)}if(C.current=I,U.length===0)return;const X=()=>U.forEach(te=>r(te)),Q=window.requestAnimationFrame(X),ie=window.setTimeout(X,80);return()=>{window.cancelAnimationFrame(Q),window.clearTimeout(ie)}},[l,r]),h.useEffect(()=>{m.current=d},[d]),h.useEffect(()=>{v.current=g},[g]),h.useEffect(()=>{w.current=y},[y]),h.useEffect(()=>{hi.current=Ke},[Ke]),h.useEffect(()=>{z.current=L},[L]),h.useEffect(()=>{if(!L)return;const S=U=>{U.key==="Escape"&&O(null)},I=U=>{var X,Q;(Q=(X=U.target)==null?void 0:X.closest)!=null&&Q.call(X,".af-connect-node-menu")||O(null)};return document.addEventListener("keydown",S),document.addEventListener("pointerdown",I),()=>{document.removeEventListener("keydown",S),document.removeEventListener("pointerdown",I)}},[L]),h.useEffect(()=>{if(E.current&&Me)return D.current&&window.clearTimeout(D.current),D.current=window.setTimeout(()=>{Cn().catch(S=>Le(String(S.message||S)))},650),()=>{D.current&&window.clearTimeout(D.current)}},[l,d,g,Cn,Me]);const vc=h.useCallback((S,I)=>{if(!Me){Le("Readonly workspace");return}const U=Rq(I),X=de=>Array.isArray(de)?de.map(Se=>(Se==null?void 0:Se.name)!=="skillKeys"&&(Se==null?void 0:Se.name)!=="skillsContext"&&(Se==null?void 0:Se.type)!=="text"?Se:{...Se,default:U,value:U}):[],Q=l.map(de=>{var Se;return de.id!==S?de:{...de,data:{...de.data,body:U,inputs:X((Se=de.data)==null?void 0:Se.inputs)}}}),ie=T.current||{},te=ie[S]&&typeof ie[S]=="object"?ie[S]:{},oe={...ie,[S]:{...te,body:U,input:X(te.input)}};T.current=oe,c(Q),M(oe),jn(de=>!de||de.id!==S?de:{...de,body:U,inputs:X(de.inputs)}),Cn(Q,d).catch(de=>Le(String(de.message||de)))},[d,l,Cn,c,Me]),ba=h.useCallback((S,I)=>{if(!Me){Le("Readonly workspace");return}const U=Oq(I),X=de=>Array.isArray(de)?de.map(Se=>(Se==null?void 0:Se.name)!=="serverNames"&&(Se==null?void 0:Se.name)!=="mcpContext"&&(Se==null?void 0:Se.type)!=="text"?Se:{...Se,default:U,value:U}):[],Q=l.map(de=>{var Se;return de.id!==S?de:{...de,data:{...de.data,body:U,inputs:X((Se=de.data)==null?void 0:Se.inputs)}}}),ie=T.current||{},te=ie[S]&&typeof ie[S]=="object"?ie[S]:{},oe={...ie,[S]:{...te,body:U,input:X(te.input)}};T.current=oe,c(Q),M(oe),jn(de=>!de||de.id!==S?de:{...de,body:U,inputs:X(de.inputs)}),Cn(Q,d).catch(de=>Le(String(de.message||de)))},[d,l,Cn,c,Me]),mp=h.useCallback(S=>{const I=String(S||"").trim();I&&(Mn(U=>U===I?"":I),yi(U=>({...U,[I]:U[I]||{sessionId:`nodechat_${Date.now()}_${I.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[],draft:"",candidateContent:"",running:!1,error:""}})))},[]),gp=h.useCallback((S,I)=>{const U=String(S||"").trim();U&&yi(X=>({...X,[U]:{...X[U]||{sessionId:`nodechat_${Date.now()}_${U.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[]},draft:String(I||""),error:""}}))},[]),gt=h.useCallback((S,I,U="replace",X={})=>{var Ur;if(!Me){Le("Readonly workspace");return}const Q=String(S||"").trim();if(!Q)return;const ie=p.current.find(Dt=>Dt.id===Q),te=Vn((Ur=ie==null?void 0:ie.data)==null?void 0:Ur.definitionId),oe=te==="html"?Ku(I):String(I||""),de=ie?Zl(ie.data):"",Se=U==="append"&&String(de||"").trim()?`${String(de).replace(/\s+$/g,"")}
|
|
174
|
-
|
|
175
|
-
${oe.trim()}`:oe,Qe=te==="image"?"src":"content",qe=Dt=>{let Tr=!1;return(Array.isArray(Dt)?Dt:[]).map(Wn=>{const ei=String((Wn==null?void 0:Wn.name)||""),Ne=String((Wn==null?void 0:Wn.type)||"");return!Tr&&(ei===Qe||ei==="filePath"||Ne==="text")?(Tr=!0,{...Wn,default:Se,value:Se}):Wn})},ft=p.current.map(Dt=>{var Tr,Rr;return Dt.id!==Q?Dt:{...Dt,data:{...Dt.data,body:Se,inputs:qe((Tr=Dt.data)==null?void 0:Tr.inputs),outputs:qe((Rr=Dt.data)==null?void 0:Rr.outputs)}}}),tt=T.current||{},bt=tt[Q]&&typeof tt[Q]=="object"?tt[Q]:{},dn={...tt,[Q]:{...bt,body:Se,input:qe(bt.input),output:qe(bt.output)}};T.current=dn,c(ft),M(dn),jn(Dt=>(Dt==null?void 0:Dt.id)===Q?{...Dt,body:Se}:Dt),(X==null?void 0:X.logChat)!==!1&&yi(Dt=>{var Tr;return{...Dt,[Q]:{...Dt[Q]||{},candidateContent:"",messages:[...(Tr=Dt[Q])!=null&&Tr.messages&&Array.isArray(Dt[Q].messages)?Dt[Q].messages:[],{role:"assistant",text:U==="append"?"已追加到当前节点内容。":"已替换当前节点内容。",at:Date.now()}]}}}),Cn(ft,m.current).catch(Dt=>Le(String(Dt.message||Dt))),Le(String((X==null?void 0:X.statusMessage)||"")||(U==="append"?"已追加节点内容":"已替换节点内容"))},[Cn,c,Me]),va=h.useCallback(async S=>{if(!Me)return Le("Readonly workspace"),"";if(!Gm(S))return Le("请选择图片文件"),"";try{const I=new FormData;I.set("file",S),I.set("dir","img"),s.flowId&&I.set("flowId",s.flowId),s.flowSource&&I.set("flowSource",s.flowSource),s.archived&&I.set("archived","1");const U=await fetch("/api/workspace/upload",{method:"POST",body:I}),X=await U.json().catch(()=>({}));if(!U.ok)throw new Error(X.error||"上传图片失败");const Q=String(X.path||"").trim();if(!Q)throw new Error("上传图片失败:未返回路径");return await Gn(),Bt(ie=>{const te=new Set(ie);for(const oe of Nh(Q))te.delete(oe);return te}),Le(`已上传图片 ${Q}`),Q}catch(I){return Le(String(I.message||I)),""}},[s,Gn,Me]),yp=h.useCallback(async(S,I)=>{const U=String(S||"").trim();if(!U)return;const X=await va(I);X&>(U,X,"replace",{logChat:!1,statusMessage:`已上传图片 ${X}`})},[gt,va]),Nl=h.useCallback((S,I="replace")=>{var Q;const U=String(S||"").trim(),X=String(((Q=Ji[U])==null?void 0:Q.candidateContent)||"").trim();!U||!X||gt(U,X,I)},[Ji,gt]),xt=h.useCallback(async(S,I=void 0)=>{var Se,Qe,qe;if(!Me){Le("Readonly workspace");return}const U=String(S||"").trim();if(!U)return;const X=Ji[U]||{},Q=String(I!==void 0?I:X.draft||"").trim();if(!Q||X.running)return;const ie=p.current.find(ft=>ft.id===U);if(!ie)return;const te={role:"user",text:Q,at:Date.now()},oe=Array.isArray(X.messages)?X.messages:[],de=X.sessionId||`nodechat_${Date.now()}_${U.replace(/[^a-z0-9_-]+/gi,"_")}`;yi(ft=>({...ft,[U]:{...X,sessionId:de,messages:[...oe,te],draft:"",running:!0,error:""}}));try{const ft=await fetch("/api/workspace/node-chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,sessionId:de,node:{id:U,label:((Se=ie.data)==null?void 0:Se.label)||U,definitionId:((Qe=ie.data)==null?void 0:Qe.definitionId)||""},nodeKind:Vn((qe=ie.data)==null?void 0:qe.definitionId)||"markdown",currentContent:Zl(ie.data),messages:oe,message:Q,model:Ht})}),tt=await ft.json().catch(()=>({}));if(!ft.ok)throw new Error(tt.error||"节点微调失败");const bt=String(tt.candidateContent||tt.reply||"").trim();yi(dn=>{var Ur;return{...dn,[U]:{...dn[U]||{},sessionId:String(tt.sessionId||de),running:!1,candidateContent:bt,messages:[...(Ur=dn[U])!=null&&Ur.messages&&Array.isArray(dn[U].messages)?dn[U].messages:[...oe,te],{role:"assistant",text:bt||"已生成候选内容。",at:Date.now()}]}}})}catch(ft){const tt=String(ft.message||ft);yi(bt=>({...bt,[U]:{...bt[U]||{},running:!1,error:tt}})),Le(tt)}},[Ht,s,Ji,Me]),xp=h.useCallback(async(S,I)=>{if(!Me){Le("Readonly workspace");return}const U=Zl(I);if(!String(U||"").trim()){Le("展示节点没有可保存内容");return}const X=Nq(S,I),Q=window.prompt("保存到 workspace 相对路径",X);if(Q)try{const ie=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,path:Q,content:U})}),te=await ie.json().catch(()=>({}));if(!ie.ok)throw new Error(te.error||"保存文件失败");const oe=te.path||Q,de=Oa(s);de.set("path",oe);const Se=await fetch(`/api/workspace/file?${de.toString()}`);if(!Se.ok){const Qe=await Se.json().catch(()=>({}));throw new Error(Qe.error||`保存后读取失败:${oe}`)}await Gn(),_o(Qe=>Aq(Qe,oe,String(U||"").length)),Bt(Qe=>{const qe=new Set(Qe);for(const ft of Nh(oe))qe.delete(ft);return qe}),Le(`已保存 ${oe}`)}catch(ie){Le(String(ie.message||ie))}},[s,Gn,Me]),to=h.useCallback((S,I)=>{const U=String(S||"");U&&jn(X=>{if(!X||X.id!==U)return X;const Q=typeof I=="function"?I(X):I;return!Q||typeof Q!="object"?X:{...X,...Q}})},[]),ds=h.useMemo(()=>l.map(S=>{var I,U;return{...S,data:{...S.data,selected:S.selected===!0,modelLists:Nr,showBodyPreview:!0,isExecuting:hp.has(S.id),nodeStatus:((I=xl[S.id])==null?void 0:I.status)??null,nodeElapsed:((U=xl[S.id])==null?void 0:U.elapsed)??null,flowParams:s,readOnly:!Me,onRunWorkspaceNode:bc,onStopWorkspaceNode:xa,runningRunNodeId:xi,skills:On,skillCollections:Ps,onChangeLoadSkillKeys:vc,onRefreshSkills:Sl,mcpServers:Ys,onChangeLoadMcpNames:ba,onRefreshMcps:wa,onSaveDisplayNodeToFile:xp,onUploadWorkspaceImage:va,onUploadImageToDisplayNode:yp,nodeChatActive:xc===S.id,nodeChat:Ji[S.id]||null,onSetDisplayNodeContent:gt,onToggleNodeChat:mp,onCloseNodeChat:()=>Mn(""),onUpdateNodeChatDraft:gp,onSendNodeChat:xt,onApplyNodeChatCandidate:Nl,onSyncNodePropDraft:to}}}),[xc,Nl,ba,vc,s,Ys,Nr,Ji,l,wa,Sl,bc,xi,xp,xt,gt,Ps,On,xa,to,mp,gp,yp,va,hp,xl,Me]),kc=h.useMemo(()=>new Map(ds.map(S=>[S.id,S])),[ds]),Sc=h.useMemo(()=>{const S=new Set(j);return g.nodeIds.map((I,U)=>{var oe;const X=kc.get(I);if(!X||!Vn((oe=X.data)==null?void 0:oe.definitionId))return null;const Q=Hc(X)||{width:520,height:320},ie=yu(g.nodeSizes[I]||Q,{display:!0})||Q,te=g.nodePositions[I]||{x:180+U*36,y:120+U*28};return{...X,id:s1(I),position:te,selected:S.has(I),width:ie.width,height:ie.height,data:{...X.data,sourceNodeId:I,displayPageMode:!0,readOnly:!0,selected:S.has(I),displaySize:ie,nodeSize:ie}}}).filter(Boolean)},[g,kc,j]),Wr=h.useMemo(()=>ds.filter(S=>{var I;return Vn((I=S==null?void 0:S.data)==null?void 0:I.definitionId)}),[ds]),dt=i==="display";h.useEffect(()=>{if(!dt||!g.viewport)return;const S=g.viewport,I=()=>{try{n.setViewport(S,{duration:0})}catch{}},U=window.requestAnimationFrame(()=>window.requestAnimationFrame(I));return()=>window.cancelAnimationFrame(U)},[g.viewport,dt,n]),h.useEffect(()=>{if(dt||!y)return;const S=y,I=()=>{try{n.setViewport(S,{duration:0})}catch{}},U=window.requestAnimationFrame(()=>window.requestAnimationFrame(I));return()=>window.cancelAnimationFrame(U)},[dt,n,y]),h.useEffect(()=>{const S=$.current,I=new Map,U=[];for(const te of[...ds,...Sc]){const oe=sq(te);I.set(te.id,oe),S.get(te.id)!==oe&&U.push(te.id)}if($.current=I,U.length===0)return;const X=()=>U.forEach(te=>r(te)),Q=window.requestAnimationFrame(X),ie=window.setTimeout(X,80);return()=>{window.cancelAnimationFrame(Q),window.clearTimeout(ie)}},[Sc,ds,r]);const Mt=h.useMemo(()=>l.find(S=>S.id===Ge)||null,[l,Ge]),Mo=h.useRef({id:"",draft:null}),wp=h.useMemo(()=>{const S=l1(Mt);return S?JSON.stringify(S):""},[Mt]);h.useEffect(()=>{if(!Mt){Mo.current={id:"",draft:null},jn(null),vr("");return}const S=l1(Mt),I=Mo.current;Mo.current={id:Mt.id,draft:S},jn(U=>!U||U.id!==Mt.id||I.id!==Mt.id||!I.draft?S:Dq(U,I.draft,S)),vr("")},[Mt==null?void 0:Mt.id,wp]);const td=h.useCallback((S=!1)=>{if(!Ke||!Mt)return!1;if(!Me)return vr("Readonly workspace"),Le("Readonly workspace"),!1;vr("");const I=u1({nodes:l,edges:d,instances:T.current,selectedNode:Mt,draft:Ke,allowRename:S});return I!=null&&I.error?(vr(I.error),!1):(!(I!=null&&I.ok)||!I.changed||(T.current=I.instances,M(I.instances),c(I.nodes),f(I.edges),I.nextId!==Mt.id&&Ct(I.nextId),Is(I.nextId)),!0)},[d,Ke,l,Mt,f,c,Is,Me]);h.useEffect(()=>{if(!Me||!Ke||!Mt)return;const S=window.setTimeout(()=>{td(!1)},350);return()=>window.clearTimeout(S)},[Ke==null?void 0:Ke.label,Ke==null?void 0:Ke.role,Ke==null?void 0:Ke.model,Ke==null?void 0:Ke.body,JSON.stringify((Ke==null?void 0:Ke.images)||[]),Ke==null?void 0:Ke.script,JSON.stringify((Ke==null?void 0:Ke.inputs)||[]),JSON.stringify((Ke==null?void 0:Ke.outputs)||[]),td,Mt==null?void 0:Mt.id,Me]);const Nc=h.useMemo(()=>{const S=new Map(ds.map(I=>[I.id,I]));return d.map(I=>{var Se,Qe,qe,ft;const U=S.get(I.source),X=S.get(I.target),Q=/^output-(\d+)$/.exec(I.sourceHandle||""),ie=/^input-(\d+)$/.exec(I.targetHandle||""),te=U&&Q?(Qe=(Se=U.data)==null?void 0:Se.outputs)==null?void 0:Qe[parseInt(Q[1],10)]:null,oe=X&&ie?(ft=(qe=X.data)==null?void 0:qe.inputs)==null?void 0:ft[parseInt(ie[1],10)]:null,de=te!=null&&te.type?Zn(te.type):oe!=null&&oe.type?Zn(oe.type):"";return de?{...I,style:{...I.style||{},stroke:de,strokeWidth:2},markerEnd:{type:Ns.ArrowClosed,color:de}}:I})},[d,ds]),Gg=dt?Sc:ds,bp=dt?[]:Nc,Xg=h.useMemo(()=>dt?Sc.map(S=>({...S,id:bx(S.id)})):ds,[Sc,ds,dt]),Jg=h.useCallback(S=>{const I=String(S||"").trim();if(!I)return;const U=dt?s1(I):I;dt?A([I]):(c(Q=>Q.map(ie=>({...ie,selected:ie.id===U}))),f(Q=>Q.map(ie=>({...ie,selected:!1}))),Ct(U));const X=()=>{var Se,Qe,qe;const Q=n.getNode(U);if(!Q)return;const ie=(Se=n.getInternalNode)==null?void 0:Se.call(n,U),te=((Qe=ie==null?void 0:ie.measured)==null?void 0:Qe.width)??(ie==null?void 0:ie.width)??Q.width??260,oe=((qe=ie==null?void 0:ie.measured)==null?void 0:qe.height)??(ie==null?void 0:ie.height)??Q.height??120,{zoom:de}=n.getViewport();n.setCenter(Q.position.x+te/2,Q.position.y+oe/2,{zoom:oq(de),duration:240})};window.requestAnimationFrame(()=>window.requestAnimationFrame(X))},[dt,n,f,c]),vp=h.useCallback(()=>{const S=n.getViewport(),I={x:Number(S.x)||0,y:Number(S.y)||0,zoom:Math.min(Math.max(Number(S.zoom)||1,.1),4)};if(dt){const U={...v.current,viewport:I};v.current=U,b(U),Le("已固定 Display 进入视角")}else w.current=I,k(I),Le("已固定 Workspace 进入视角");Cn(p.current,m.current).catch(U=>Le(String(U.message||U)))},[dt,n,Cn]),ka=h.useMemo(()=>{const S=P.trim().toLowerCase(),I={DISPLAY:[],CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const U of _)S&&![U.id,U.label,U.displayName,U.description].some(X=>String(X||"").toLowerCase().includes(S))||I[Fd(U)].push(U);for(const U of Bc)I[U].sort((X,Q)=>X.id.localeCompare(Q.id));return I},[_,P]),$o=h.useMemo(()=>{const S=Re.trim().toLowerCase();return _.filter(I=>!S||[I.id,I.label,I.displayName,I.description].some(U=>String(U||"").toLowerCase().includes(S))).sort((I,U)=>{const X=Bc.indexOf(Fd(I)),Q=Bc.indexOf(Fd(U));return X!==Q?X-Q:zd(I).localeCompare(zd(U))}).slice(0,30)},[_,Re]),Do=h.useMemo(()=>{const S=Re.trim().toLowerCase();return se.filter(I=>!S||[I.id,I.version,I.displayName,I.name,I.description,...Array.isArray(I.tags)?I.tags:[]].some(U=>String(U||"").toLowerCase().includes(S))).sort((I,U)=>String(I.displayName||I.name||I.id).localeCompare(String(U.displayName||U.name||U.id))).slice(0,30)},[se,Re]);h.useEffect(()=>{Ce(0)},[Re,Sn,Nn]),h.useEffect(()=>{if(!Sn)return;const S=window.setTimeout(()=>{var I;return(I=Ot.current)==null?void 0:I.focus()},0);return()=>window.clearTimeout(S)},[Sn]);const kp=h.useMemo(()=>{const S=mi.trim().toLowerCase();return S?XT(kr).filter(I=>I.path.toLowerCase().includes(S)):kr},[mi,kr]),Qg=[...(Nr.cursor||[]).map(S=>({label:`Cursor · ${S.split(" - ")[0]}`,value:`cursor:${S.split(" - ")[0]}`})),...(Nr.opencode||[]).map(S=>({label:`OpenCode · ${S.split(" - ")[0]}`,value:`opencode:${S.split(" - ")[0]}`})),...(Nr.claudeCode||[]).map(S=>({label:`Claude · ${S.split(" - ")[0]}`,value:`claude-code:${S.split(" - ")[0]}`}))],nd=h.useMemo(()=>new Set(jr),[jr]),wi=h.useMemo(()=>{const S=new Map(On.map(ie=>[ie.key,ie])),I=new Set,U=new Set,X=Ps.map(ie=>{const te=sl(ie,On).map(oe=>S.get(oe)).filter(Boolean);for(const oe of te)I.add(oe.key),U.add(String(oe.name||oe.id||oe.key||"").trim());return{...ie,skills:te}}).filter(ie=>ie.skills.length>0),Q=On.filter(ie=>{const te=String(ie.name||ie.id||ie.key||"").trim();return!I.has(ie.key)&&!U.has(te)});return{groups:X,ungrouped:Q}},[Ps,On]);h.useEffect(()=>{me(S=>{let I=!1;const U=new Set(S);for(const X of wi.groups)U.has(X.id)||(U.add(X.id),I=!0);return I?U:S})},[wi.groups]);const Xn=h.useMemo(()=>{const S=l.filter(I=>I.selected);return S.length>0?S:Ge?l.filter(I=>I.id===Ge):[]},[l,Ge]),jl=h.useMemo(()=>Xn.map(S=>S.id),[Xn]),Fo=h.useMemo(()=>l.filter(S=>{var I;return Vn((I=S==null?void 0:S.data)==null?void 0:I.definitionId)}),[l]),bi=h.useMemo(()=>Xn.filter(S=>{var I;return Vn((I=S==null?void 0:S.data)==null?void 0:I.definitionId)}).map(S=>S.id),[Xn]),jc=h.useMemo(()=>{const S=String((Hr==null?void 0:Hr.username)||(Hr==null?void 0:Hr.userId)||"").trim();return S?S.slice(0,1).toUpperCase():"?"},[Hr]),Zr=h.useMemo(()=>new Set(jl),[jl]),es=h.useMemo(()=>d.filter(S=>Zr.has(S.source)&&Zr.has(S.target)),[d,Zr]),mr=h.useCallback(S=>{const I=S==="display"?"display":"workspace";a(I),Ct(""),A([]),O(null),Zt(!1),yn(!1);const U=Oa(s);I==="display"&&U.set("view","display");const X=`/workspace${U.toString()?`?${U.toString()}`:""}`;window.history.pushState({},"",X)},[s]),vi=h.useCallback(S=>{var X;const I=String(S||"").trim();if(!I)return;const U=p.current.find(Q=>Q.id===I);if(!U||!Vn((X=U.data)==null?void 0:X.definitionId)){Le("展示节点不可用");return}b(Q=>{if(Q.nodeIds.includes(I))return Q;const ie=Q.nodeIds.length,te=Hc(U);return{nodeIds:[...Q.nodeIds,I],nodePositions:{...Q.nodePositions,[I]:{x:180+ie*36,y:120+ie*28}},nodeSizes:{...Q.nodeSizes,...te?{[I]:te}:{}}}}),A([I])},[]),ki=h.useCallback(S=>{const I=String(S||"").trim();I&&(b(U=>{const X=U.nodeIds.filter(te=>te!==I),Q={...U.nodePositions},ie={...U.nodeSizes};return delete Q[I],delete ie[I],{nodeIds:X,nodePositions:Q,nodeSizes:ie}}),A(U=>U.filter(X=>X!==I)))},[]),rd=h.useCallback(S=>{const I=String(S||"").trim();I&&(v.current.nodeIds.includes(I)?ki(I):vi(I))},[vi,ki]),Cl=h.useMemo(()=>{const S=ir.trim().toLowerCase();return S?Wr.filter(I=>{var U,X;return[I.id,(U=I.data)==null?void 0:U.label,(X=I.data)==null?void 0:X.definitionId].filter(Boolean).some(Q=>String(Q).toLowerCase().includes(S))}):Wr},[Wr,ir]),El=h.useMemo(()=>{const S=Cl.length,I=S<=1?1:S<=4?2:3,U=Array.from({length:I},()=>({height:0,nodes:[]}));for(const X of Cl){const Q=Hc(X)||{width:420,height:260},ie=Math.max(1,Number(Q.width)||420),te=Math.max(1,Number(Q.height)||260),oe=Math.min(26,Math.max(5.5,te/ie*16))+3.2;let de=U[0];for(const Se of U)Se.height<de.height&&(de=Se);de.nodes.push(X),de.height+=oe}return U.map(X=>X.nodes)},[Cl]),sd=h.useCallback(S=>{var ie,te;const I=g.nodeIds.includes(S.id),U=Hc(S)||{width:420,height:260},X=Math.max(1,Math.round(Number(U.width)||420)),Q=Math.max(1,Math.round(Number(U.height)||260));return o.jsxs("button",{type:"button",className:"af-display-picker-card"+(I?" af-display-picker-card--selected":""),style:{"--af-display-picker-card-ratio":`${X} / ${Q}`},onClick:()=>rd(S.id),children:[o.jsx("span",{className:"af-display-picker-card__check","aria-hidden":!0,children:o.jsx("input",{type:"checkbox",checked:I,readOnly:!0,tabIndex:-1})}),o.jsx("span",{className:"af-display-picker-card__preview",children:o.jsx(wq,{node:S})}),o.jsxs("span",{className:"af-display-picker-card__meta",children:[o.jsx("strong",{children:((ie=S.data)==null?void 0:ie.label)||S.id}),o.jsxs("small",{children:[Vn((te=S.data)==null?void 0:te.definitionId)," · ",S.id]})]})]},S.id)},[g.nodeIds,rd]),$n=h.useMemo(()=>{const S=P.trim().toLowerCase();return S?se.filter(I=>[I.id,I.version,I.displayName,I.name,I.description,...Array.isArray(I.tags)?I.tags:[]].filter(Boolean).some(U=>String(U).toLowerCase().includes(S))):se},[se,P]),En=h.useCallback((S,I)=>{const U=String(S||"snippet_node").trim().replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"snippet_node";let X=`${U}_${Date.now().toString(36)}`,Q=2;for(;I.has(X);)X=`${U}_${Date.now().toString(36)}_${Q}`,Q+=1;return I.add(X),X},[]),Si=h.useCallback((S,I)=>{var Wn,ei;if(!Me){Le("Readonly workspace");return}const U=S!=null&&S.snippet&&typeof S.snippet=="object"?S.snippet:{},X=U.instances&&typeof U.instances=="object"?U.instances:{},Q=Object.keys(X);if(Q.length===0)return;const ie=new Set(p.current.map(Ne=>Ne.id)),te={};for(const Ne of Q)te[Ne]=En(Ne,ie);const oe=(Wn=U.ui)!=null&&Wn.nodePositions&&typeof U.ui.nodePositions=="object"?U.ui.nodePositions:{},de=(ei=U.ui)!=null&&ei.nodeSizes&&typeof U.ui.nodeSizes=="object"?U.ui.nodeSizes:{},Se=Q.map(Ne=>{const Ft=oe[Ne];return{id:Ne,x:typeof(Ft==null?void 0:Ft.x)=="number"?Ft.x:0,y:typeof(Ft==null?void 0:Ft.y)=="number"?Ft.y:0}}),Qe=Math.min(...Se.map(Ne=>Ne.x)),qe=Math.min(...Se.map(Ne=>Ne.y));let ft=I||{x:360+p.current.length*24,y:180+p.current.length*18};if(!I){const Ne=document.querySelector(".af-workspace-canvas .react-flow");if(Ne){const Ft=Ne.getBoundingClientRect();ft=n.screenToFlowPosition({x:Ft.left+Ft.width*.48,y:Ft.top+Ft.height*.32})}}const tt={},bt={},dn={};for(const Ne of Se){const Ft=te[Ne.id];tt[Ft]={...X[Ne.id]||{}},bt[Ft]={x:ft.x+(Ne.x-Qe),y:ft.y+(Ne.y-qe)};const ti=de[Ne.id];typeof(ti==null?void 0:ti.width)=="number"&&typeof(ti==null?void 0:ti.height)=="number"&&(dn[Ft]={width:ti.width,height:ti.height})}const Ur=new Set(Q),Dt=(Array.isArray(U.edges)?U.edges:[]).filter(Ne=>Ur.has(Ne==null?void 0:Ne.source)&&Ur.has(Ne==null?void 0:Ne.target)).map(Ne=>({source:te[Ne.source],target:te[Ne.target],sourceHandle:Ne.sourceHandle??null,targetHandle:Ne.targetHandle??null})),Tr=wx({instances:tt,edges:Dt,ui:{nodePositions:bt,nodeSizes:dn}},_),Rr=Tr.nodes.map(Ne=>({...Ne,selected:!0}));T.current={...T.current,...Tr.instances},M(T.current),c(Ne=>[...Ne.map(Ft=>({...Ft,selected:!1})),...Rr]),f(Ne=>[...Ne.map(Ft=>({...Ft,selected:!1})),...Tr.edges]),Le(`已添加流程片段:${S.displayName||S.id}`)},[En,_,n,f,c,Me]),_l=h.useCallback(()=>{var U,X;if(Xn.length<2){be("请先在 workspace 画布上选择至少两个节点。"),V("flows");return}const S=Xn[0],I=Xn.length===2?`${((U=S.data)==null?void 0:U.label)||S.id} 片段`:`${((X=S.data)==null?void 0:X.label)||S.id} 等 ${Xn.length} 个节点`;Ie({name:I,id:I.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),Et(""),we(!0),V("flows")},[Xn]),Pl=h.useCallback(async()=>{var Q,ie;if(Xn.length<2)return;const S=_e.name.trim();if(!S){Et("请填写片段名称。");return}const I={},U={};for(const te of Xn){I[te.id]={x:((Q=te.position)==null?void 0:Q.x)||0,y:((ie=te.position)==null?void 0:ie.y)||0};const oe=Hc(te);oe&&(U[te.id]=oe)}const X=es.map(te=>({source:te.source,target:te.target,sourceHandle:te.sourceHandle??null,targetHandle:te.targetHandle??null}));ct(!0),Et("");try{const te=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:_e.id,name:S,displayName:S,version:"1.0.0",description:_e.description,snippet:{instances:ap(Xn,T.current),edges:X,ui:{nodePositions:I,nodeSizes:U}}})}),oe=await te.json().catch(()=>({}));if(!te.ok||oe.ok===!1)throw new Error(oe.error||"发布流程片段失败");we(!1),Le(`流程片段已发布:${oe.id||S}`),As(`流程片段已发布:${oe.id||S}`),await Oo(),V("flows")}catch(te){Et(String(te.message||te))}finally{ct(!1)}},[Oo,_e,es,Xn,As]);h.useCallback(()=>{if(Fo.length===0){Le("当前 workspace 没有 display 节点");return}const S=bi.length>0?bi:Fo.map(U=>U.id),I=s.flowId?`${s.flowId} 展示页`:"AgentFlow Display";ot({title:I,layout:"gallery",nodeIds:S}),le(""),ze(null),Tn(!0)},[s.flowId,bi,Fo]);const Sp=h.useCallback(S=>{ot(I=>{const U=Array.isArray(I.nodeIds)?I.nodeIds:[];return U.includes(S)?{...I,nodeIds:U.filter(X=>X!==S)}:{...I,nodeIds:[...U,S]}})},[]),jt=h.useCallback(async()=>{var U;const S=Ze.title.trim(),I=Array.isArray(Ze.nodeIds)?Ze.nodeIds:[];if(I.length===0){le("请选择至少一个 display 节点。");return}Rn(!0),le(""),ze(null);try{await Cn(l,d);const X=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,title:S,layout:Ze.layout,nodeIds:I})}),Q=await X.json().catch(()=>({}));if(!X.ok||Q.ok===!1)throw new Error(Q.error||"发布展示页失败");const ie=new URL(Q.url||`/display/${((U=Q.share)==null?void 0:U.id)||""}`,window.location.origin).href;ze({...Q,absoluteUrl:ie}),Le("展示页已生成")}catch(X){le(String(X.message||X))}finally{Rn(!1)}},[Ze,d,s,l,Cn]),id=h.useCallback(async()=>{var I;const S=Array.isArray(g.nodeIds)?g.nodeIds:[];if(S.length===0){le("请先添加至少一个展示节点。"),Le("请先添加至少一个展示节点"),yn(!0);return}Rn(!0),le("");try{await Cn(l,d);const U=s.flowId?`${s.flowId} 展示页`:"AgentFlow Display",X=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,title:U,layout:"canvas",nodeIds:S})}),Q=await X.json().catch(()=>({}));if(!X.ok||Q.ok===!1)throw new Error(Q.error||"生成展示链接失败");const ie=new URL(Q.url||`/display/${((I=Q.share)==null?void 0:I.id)||""}`,window.location.origin).href;ze({...Q,absoluteUrl:ie}),nn(!0),Le("展示链接已生成")}catch(U){const X=String(U.message||U);le(X),Le(X)}finally{Rn(!1)}},[g.nodeIds,d,s,l,Cn]),od=h.useCallback(S=>{c(I=>I.map(U=>U.id===S?{...U,selected:!1}:U)),Ct(I=>I===S?"":I)},[c]),Ni=h.useCallback(()=>{const S=Xe.current;if(!S)return;const I=S.getBoundingClientRect(),U=Math.min(420,Math.max(320,I.width+160)),X=12,Q=Math.max(180,I.top-X*2),ie=Math.min(560,Q);Cr({position:"fixed",left:Math.max(12,Math.min(window.innerWidth-U-12,I.left)),top:Math.max(X,I.top-ie-X),width:U,maxHeight:ie,zIndex:1e4})},[]);h.useEffect(()=>{if(!Te)return;Ni();const S=U=>{var Q,ie;const X=U.target;(Q=Xe.current)!=null&&Q.contains(X)||(ie=Wt.current)!=null&&ie.contains(X)||Ae(!1)},I=U=>{U.key==="Escape"&&Ae(!1)};return window.addEventListener("pointerdown",S),window.addEventListener("keydown",I),window.addEventListener("resize",Ni),window.addEventListener("scroll",Ni,!0),()=>{window.removeEventListener("pointerdown",S),window.removeEventListener("keydown",I),window.removeEventListener("resize",Ni),window.removeEventListener("scroll",Ni,!0)}},[Te,Ni]);const Cc=h.useCallback(S=>{var X,Q,ie;if(i==="display"){const te=[];let oe=!1;b(de=>{var qe,ft;const Se={...de.nodePositions},Qe={...de.nodeSizes};for(const tt of S||[]){const bt=bx(tt==null?void 0:tt.id);if(!(!bt||!de.nodeIds.includes(bt))){if(tt.type==="select"){tt.selected&&te.push(bt);continue}if(tt.type==="position"&&tt.position){Se[bt]={x:tt.position.x,y:tt.position.y},oe=!0;continue}if(tt.type==="dimensions"&&((qe=tt.dimensions)!=null&&qe.width)&&((ft=tt.dimensions)!=null&&ft.height)){const dn=yu({width:Math.round(Number(tt.dimensions.width)),height:Math.round(Number(tt.dimensions.height))},{display:!0});dn&&(Qe[bt]=dn,oe=!0)}}}return oe?{...de,nodePositions:Se,nodeSizes:Qe}:de}),(S||[]).some(de=>(de==null?void 0:de.type)==="select")&&A(te);return}if(!Me){const te=(S||[]).filter(oe=>(oe==null?void 0:oe.type)==="select");te.length>0&&c(oe=>Lm(te,oe));return}const I=new Map;for(const te of S||[])if((te==null?void 0:te.type)==="dimensions"&&((X=te.dimensions)!=null&&X.width)&&((Q=te.dimensions)!=null&&Q.height)){const oe=l.find(Qe=>Qe.id===te.id),de=!!Vn((ie=oe==null?void 0:oe.data)==null?void 0:ie.definitionId),Se=yu({width:Math.round(Number(te.dimensions.width)),height:Math.round(Number(te.dimensions.height))},{display:de});Se&&I.set(te.id,Se)}const U=Array.from(I.keys());if(c(te=>Lm(S,te).map(oe=>{var Se;const de=I.get(oe.id);return de?Vn((Se=oe.data)==null?void 0:Se.definitionId)?{...oe,width:de.width,height:de.height,data:{...oe.data,nodeSize:de,displaySize:de}}:{...oe,width:de.width,height:de.height,data:{...oe.data,nodeSize:de}}:oe})),U.length>0){const te=()=>U.forEach(oe=>r(oe));window.requestAnimationFrame(te),window.setTimeout(te,80)}},[l,c,r,i,Me]),Np=h.useCallback(S=>{if(i!=="display"){if(!Me){const I=(S||[]).filter(U=>(U==null?void 0:U.type)==="select");I.length>0&&f(U=>Dv(I,U));return}u(S)}},[u,f,i,Me]),no=h.useCallback(()=>{const S=document.querySelector(".af-workspace-canvas .react-flow");if(S){const I=S.getBoundingClientRect();return n.screenToFlowPosition({x:I.left+I.width*.48,y:I.top+I.height*.32})}return{x:360+l.length*36,y:180+l.length*28}},[l.length,n]),Sa=h.useCallback(()=>{var S,I,U;if(Mt){const X=Number(((S=Mt.measured)==null?void 0:S.width)||Mt.width||260);return{x:Number(((I=Mt.position)==null?void 0:I.x)||0)+X+140,y:Number(((U=Mt.position)==null?void 0:U.y)||0)}}return no()},[no,Mt]),ji=h.useCallback((S,I={})=>{if(!Me)return Le("Readonly workspace"),null;if(!S)return null;const U=p0(S)||S.id,X=DT(S),Q=I.id||nq(U,l),ie=kh(S.inputs),te=kh(S.outputs),oe={definitionId:U,...X?{marketplaceRef:X}:{},...S.packageId?{marketplacePackageId:S.packageId}:{},...S.version?{marketplaceVersion:S.version}:{},label:I.label||Xm(S),role:"normal",body:I.body||"",input:I.inputs||ie,output:I.outputs||te},de={id:Q,type:lp,position:I.position||no(),data:{label:oe.label,definitionId:U,...X?{marketplaceRef:X}:{},...S.packageId?{marketplacePackageId:S.packageId}:{},...S.version?{marketplaceVersion:S.version}:{},schemaType:$T(U,S),role:"normal",body:oe.body,inputs:oe.input,outputs:oe.output}},Se={...Bf(de,{...T.current,[Q]:oe},_),selected:!0};return c(Qe=>[...Qe.map(qe=>({...qe,selected:!1})),Se]),I.openProperties&&Ct(Q),Q},[no,l,_,c,Me]),jp=h.useCallback(S=>r1(S,p.current),[]),Cp=h.useCallback(S=>{if(!Me){Le("Readonly workspace");return}if(!r1(S,p.current)){Le("端口类型不匹配,已取消连线");return}O(null),c(I=>Km(I,S)),f(I=>{const U=I.filter(X=>!(X.target===S.target&&X.targetHandle===S.targetHandle));return Rf({...S,markerEnd:{type:Ns.ArrowClosed}},U)})},[f,c,Me]),Vr=h.useCallback((S,I)=>{Me&&(F.current=eq(I,p.current),O(null))},[Me]),Ep=h.useCallback((S,I)=>{var ft,tt,bt,dn;if(!Me)return;const U=F.current;if(F.current=null,!U||I!=null&&I.toNode)return;const X=tq(_,U);if(X.length===0){Le(`没有匹配 ${U.slotType} 端口的节点`);return}const Q=((tt=(ft=S==null?void 0:S.changedTouches)==null?void 0:ft[0])==null?void 0:tt.clientX)??(S==null?void 0:S.clientX),ie=((dn=(bt=S==null?void 0:S.changedTouches)==null?void 0:bt[0])==null?void 0:dn.clientY)??(S==null?void 0:S.clientY);if(!Number.isFinite(Q)||!Number.isFinite(ie))return;const te=document.querySelector(".af-workspace-canvas .react-flow");if(!te)return;const oe=te.getBoundingClientRect(),de=320,Se=Math.min(440,104+X.length*58),Qe=Math.max(12,Math.min(Q-oe.left,oe.width-de-12)),qe=Math.max(12,Math.min(ie-oe.top,oe.height-Se-12));O({left:Qe,top:qe,flowPosition:n.screenToFlowPosition({x:Q,y:ie}),draft:U,candidates:X,query:""})},[_,n,Me]),Zs=h.useCallback(S=>{if(!Me){Le("Readonly workspace"),O(null);return}const I=z.current;if(!I||!(S!=null&&S.def))return;const U=ji(S.def,{position:I.flowPosition});if(!U)return;const X=I.draft.handleType==="source"?{source:I.draft.nodeId,sourceHandle:I.draft.handleId,target:U,targetHandle:`input-${S.slotIndex}`}:{source:U,sourceHandle:`output-${S.slotIndex}`,target:I.draft.nodeId,targetHandle:I.draft.handleId};c(Q=>Km(Q,X)),f(Q=>{const ie=Q.filter(te=>!(te.target===X.target&&te.targetHandle===X.targetHandle));return Rf({...X,markerEnd:{type:Ns.ArrowClosed}},ie)}),O(null)},[ji,f,Me]),Rs=h.useCallback(S=>{S&&(ji(S,{position:Sa()}),Zt(!1),it(""))},[ji,Sa]),ad=h.useCallback(S=>{S&&(Si(S,Sa()),Zt(!1),it(""))},[Si,Sa]);h.useEffect(()=>{const S=I=>{if(I.defaultPrevented)return;const U=mT(I.target)||Q7(I.target);if((I.metaKey||I.ctrlKey)&&I.key.toLowerCase()==="s"){I.preventDefault(),Cn().catch(te=>Le(String(te.message||te)));return}if((I.metaKey||I.ctrlKey)&&I.key.toLowerCase()==="k"){I.preventDefault(),I.stopPropagation(),gl(te=>!te);return}if(cr)return;if(ml){(I.key==="Escape"||Ym(I))&&(I.preventDefault(),Qi(!1));return}if(U)return;const X=I.key.toLowerCase(),Q=(I.metaKey||I.ctrlKey)&&!I.shiftKey&&X==="z",ie=(I.metaKey||I.ctrlKey)&&(I.shiftKey&&X==="z"||X==="y");if(Q||ie){if(dt){I.preventDefault(),I.stopPropagation(),Le("展示页布局会自动保存");return}if(!Me){I.preventDefault(),Le("Readonly workspace");return}I.preventDefault(),I.stopPropagation();const te=Q?ma():ga();Le(te?Q?"Undo canvas change":"Redo canvas change":Q?"Nothing to undo":"Nothing to redo");return}if((I.metaKey||I.ctrlKey)&&I.key.toLowerCase()==="c"){if(dt)return;const te=oT(p.current,m.current,T.current);te&&(I.preventDefault(),I.stopPropagation(),B.current=te,Le(`Copied ${te.nodes.length} node${te.nodes.length>1?"s":""}`));return}if((I.metaKey||I.ctrlKey)&&I.key.toLowerCase()==="v"){if(dt){I.preventDefault(),I.stopPropagation();return}if(!Me){I.preventDefault(),Le("Readonly workspace");return}const te=aT(B.current,p.current,m.current,T.current);te&&(I.preventDefault(),I.stopPropagation(),T.current=te.instances,M(te.instances),c(te.nodes),f(te.edges),Le(`Pasted ${te.pastedNodeIds.length} node${te.pastedNodeIds.length>1?"s":""}`));return}if(Ym(I)&&!I.metaKey&&!I.ctrlKey&&!I.altKey){I.preventDefault(),Qi(!0);return}if(I.key==="a"||I.key==="A"){if(I.metaKey||I.ctrlKey){I.preventDefault(),dt?A(v.current.nodeIds):(c(te=>te.map(oe=>({...oe,selected:!0}))),f(te=>te.map(oe=>({...oe,selected:!1}))));return}if(I.altKey)return;if(dt){I.preventDefault(),yn(!0);return}if(!Me){I.preventDefault(),Le("Readonly workspace");return}I.preventDefault(),Zt(!0);return}if((I.key==="v"||I.key==="V")&&!I.metaKey&&!I.ctrlKey&&!I.altKey){I.preventDefault(),yl("select");return}if((I.key==="h"||I.key==="H")&&!I.metaKey&&!I.ctrlKey&&!I.altKey){I.preventDefault(),yl("pan");return}(I.key==="f"||I.key==="F")&&!I.metaKey&&!I.ctrlKey&&!I.altKey&&(I.preventDefault(),vp())};return window.addEventListener("keydown",S,!0),()=>window.removeEventListener("keydown",S,!0)},[dt,cr,vp,ga,Cn,ml,f,c,ma,Me]);const Al=h.useCallback(S=>{Bt(I=>{const U=new Set(I);return U.has(S)?U.delete(S):U.add(S),U})},[]),_p=h.useCallback((S,I)=>{S.dataTransfer.effectAllowed="copy",S.dataTransfer.setData("application/x-agentflow-workspace-file",JSON.stringify({path:I.path,name:I.name,type:I.type})),S.dataTransfer.setData("text/plain",I.path)},[]),Il=h.useCallback((S,I)=>{S.dataTransfer.effectAllowed="move",S.dataTransfer.setData("application/agentflow-node",I.id),S.dataTransfer.setData("text/plain",I.id)},[]),Tl=h.useCallback(async(S,I)=>{const U=String((S==null?void 0:S.name)||(S==null?void 0:S.path)||"").toLowerCase(),X=U.split(".").pop(),Q=X==="html"?"display_html":X==="csv"||X==="tsv"||X==="json"&&/\b(table|data|rows|report)\b/i.test(U)?"display_table":["png","jpg","jpeg","gif","webp","svg"].includes(X)?"display_image":"display_markdown",ie=_.find(qe=>qe.id===Q);if(!ie){Le("展示节点不可用");return}const te=Q==="display_image";let oe=String(S.path||"");if(!te){const qe=Oa(s);qe.set("path",S.path);const ft=await fetch(`/api/workspace/file?${qe.toString()}`),tt=await ft.json();if(!ft.ok)throw new Error(tt.error||"读取文件失败");oe=String(tt.content||"")}const de=Q==="display_image"?"src":"content",Se=kh(ie.inputs).map(qe=>qe.name===de?{...qe,default:oe,value:oe}:qe),Qe=kh(ie.outputs).map(qe=>qe.name===de?{...qe,default:oe,value:oe}:qe);ji(ie,{label:S.name||"Display",body:oe,inputs:Se,outputs:Qe,position:I}),Le(`已创建展示:${S.path}`)},[ji,s,_]),gr=h.useCallback(S=>{if(!Me){Le("Readonly workspace");return}Tl(S,no()).catch(I=>Le(String(I.message||I)))},[Tl,no,Me]),Pp=h.useCallback(S=>{if(!Me){S.preventDefault(),Le("Readonly workspace");return}const I=S.dataTransfer.getData("application/x-agentflow-workspace-file");if(I){S.preventDefault();let te;try{te=JSON.parse(I)}catch{return}if(!(te!=null&&te.path))return;const oe=n.screenToFlowPosition({x:S.clientX,y:S.clientY});Tl(te,oe).catch(de=>Le(String(de.message||de)));return}const U=S.dataTransfer.getData("application/agentflow-snippet");if(U){const te=se.find(de=>`${de.id}@${de.version}`===U);if(!te)return;S.preventDefault();const oe=n.screenToFlowPosition({x:S.clientX,y:S.clientY});Si(te,oe);return}const X=S.dataTransfer.getData("application/agentflow-node");if(!X)return;const Q=_.find(te=>te.id===X);if(!Q)return;S.preventDefault();const ie=n.screenToFlowPosition({x:S.clientX,y:S.clientY});ji(Q,{position:ie})},[Tl,ji,se,Si,_,n,Me]),Ci=h.useCallback(S=>{if(!Me)return;const I=Array.from(S.dataTransfer.types||[]);!I.includes("application/x-agentflow-workspace-file")&&!I.includes("application/agentflow-node")&&!I.includes("application/agentflow-snippet")||(S.preventDefault(),S.dataTransfer.dropEffect=I.includes("application/agentflow-node")||I.includes("application/agentflow-snippet")?"move":"copy")},[Me]),Rl=h.useCallback(async(S="")=>{if(!Me){Le("Readonly workspace");return}const I=window.prompt("新文件名",S?`${S}/notes.md`:"notes.md");if(!I)return;const U=S&&!I.includes("/")?`${S}/${I}`:I;try{const X=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,path:U,content:""})}),Q=await X.json();if(!X.ok)throw new Error(Q.error||"创建文件失败");await Gn(),Bt(ie=>{const te=new Set(ie);for(const oe of Nh(Q.path||U))te.delete(oe);return te}),Le(`已创建 ${Q.path}`)}catch(X){Le(String(X.message||X))}},[s,Gn,Me]),Ei=h.useCallback(async(S="")=>{if(!Me){Le("Readonly workspace");return}const I=window.prompt("新文件夹名",S?`${S}/docs`:"docs");if(!I)return;const U=S&&!I.includes("/")?`${S}/${I}`:I;try{const X=await fetch("/api/workspace/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,path:U})}),Q=await X.json();if(!X.ok)throw new Error(Q.error||"创建文件夹失败");await Gn(),Bt(ie=>{const te=new Set(ie);for(const oe of Nh(Q.path||U))te.delete(oe);return Q.path&&te.delete(Q.path),te}),Le(`已创建 ${Q.path}`)}catch(X){Le(String(X.message||X))}},[s,Gn,Me]),Na=h.useCallback(async S=>{if(!Me){Le("Readonly workspace");return}if(!(!(S!=null&&S.path)||!window.confirm(`删除 ${S.path}?`)))try{const I=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,path:S.path})}),U=await I.json();if(!I.ok)throw new Error(U.error||"删除失败");Le(`已删除 ${U.path}`),await Gn()}catch(I){Le(String(I.message||I))}},[s,Gn,Me]),Ec=h.useCallback(async()=>{if(!Me){Le("Readonly workspace");return}const S=Xs.trim();if(!S||Br)return;const I=Sh(l,d,T.current);Io(""),lr(!0),kl("workspace"),hl(U=>[...U,{role:"user",text:S,at:Date.now()}]);try{await Cn(l,d);const U=await fetch("/api/workspace/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,prompt:S,outputKind:"markdown",workspaceGraph:I,allowFlowYaml:!1,model:Ht,selectedSkills:jr,selectedNodeIds:jl})}),X=await U.json();if(!U.ok)throw new Error(X.error||"生成失败");const Q=String(X.content||"").trim();hl(ie=>[...ie,{role:"assistant",text:Q,at:Date.now()}]),await ya(),Le("AI 生成完成")}catch(U){const X=String(U.message||U);hl(Q=>[...Q,{role:"assistant",text:X,error:!0,at:Date.now()}]),Le(X)}finally{lr(!1)}},[Ht,Br,Xs,d,s,ya,l,kl,Cn,jl,jr,Me]),yr=Qu.find(S=>S.id===gc)||null,It=yr?Array.isArray(yr.messages)?yr.messages:[]:ua,wt=yr?yr.status==="running":Br,Zg=yr?yr.status==="running"?`${yr.label} running`:yr.status==="paused"?`${yr.label} paused`:yr.status==="failed"?`${yr.label} failed`:`${yr.label} done`:Br?"Workspace agent running":ua.length>0?"Workspace conversation":"Ready";return o.jsxs("div",{className:"af-workspace-page",children:[o.jsxs("header",{className:"af-pipeline-top af-workspace-top",children:[o.jsxs("div",{className:"af-pipeline-top-left",children:[o.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-back",onClick:()=>t("/projects"),"aria-label":"返回",children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),o.jsxs("div",{className:"af-pipeline-brand",title:s.flowId?`${s.flowId} · ${or}`:or||"PROJECT",children:[o.jsx("span",{className:"af-pipeline-brand-name",children:"WORKSPACE"}),o.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",Y7,"-STABLE"]})]}),o.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[o.jsx("button",{type:"button",onClick:()=>{t(Nm({id:s.flowId,source:s.flowSource||"user",archived:!!s.archived},"pipeline"))},children:"Pipeline"}),o.jsx("button",{type:"button",className:i==="workspace"?"af-view-switch__active":"",onClick:()=>mr("workspace"),children:"Workspace"}),o.jsx("button",{type:"button",className:i==="display"?"af-view-switch__active":"",onClick:()=>mr("display"),children:"Display"})]})]}),o.jsxs("div",{className:"af-pipeline-top-right af-workspace-actions",children:[o.jsx("span",{className:"af-workspace-save-status",children:wl}),dt?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:zt||!(fe!=null&&fe.absoluteUrl)&&g.nodeIds.length===0,onClick:()=>{fe!=null&&fe.absoluteUrl?nn(!0):id()},title:fe!=null&&fe.absoluteUrl?"查看展示链接":g.nodeIds.length===0?"先添加展示节点":"生成展示链接",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:zt?"hourglass_empty":"ios_share"}),zt?"生成中":fe!=null&&fe.absoluteUrl?"展示链接":"生成链接"]}),o.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:Wr.length===0,onClick:()=>yn(!0),title:Wr.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:()=>Qi(!0),"aria-label":"快捷键",title:"快捷键 (?)",children:o.jsx("span",{className:"material-symbols-outlined",children:"help"})}),o.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(To?" af-composer-topbar-btn--active":"")+(Br?" af-composer-topbar-btn--running":""),disabled:dt,onClick:()=>Ro(S=>!S),children:"AI"}),o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!Me,onClick:()=>Cn().catch(S=>Le(String(S.message||S))),children:"Save"})]})]}),Ue?o.jsxs("div",{className:"af-flow-snippet-toast",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"check_circle"}),o.jsx("span",{children:Ue}),o.jsx("button",{type:"button",onClick:()=>St(""),"aria-label":"关闭发布提示",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,o.jsxs("div",{className:"af-workspace-body"+(!dt&&(To||Ke)?" af-workspace-body--drawer":"")+(!dt&&Js?" af-workspace-body--sidebar-collapsed":"")+(dt?" af-workspace-body--display-mode":""),children:[!dt&&Js?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:()=>Zt(!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:()=>da(!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:()=>da(!1),"aria-label":"展开侧边栏",title:(Hr==null?void 0:Hr.username)||(Hr==null?void 0:Hr.userId)||"展开侧边栏",children:jc})]})}):null,dt?null:o.jsxs("aside",{ref:Sr,className:"af-workspace-sidebar"+(er?" af-workspace-sidebar--resizing":""),"aria-hidden":Js,style:{"--af-work-files-pane-height":`${Math.round(mt)}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:()=>da(!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:!Me,onClick:()=>Rl(""),"aria-label":"新增文件",title:"新增文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),o.jsx("button",{type:"button",className:"af-icon-btn",disabled:!Me,onClick:()=>Ei(""),"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:mi,onChange:S=>Yn(S.target.value),placeholder:"搜索文件..."}),o.jsx("div",{className:"af-workspace-files-scroll",children:o.jsx(QT,{items:kp,flowParams:s,onOpen:gr,collapsedDirs:Oe,onToggleDir:Al,onCreateFile:Rl,onCreateFolder:Ei,onDelete:Na,onFileDragStart:_p})})]}),o.jsx("button",{type:"button",className:"af-workspace-sidebar-resizer",onPointerDown:Gs,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:Z==="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:P,onChange:S=>G(S.target.value),placeholder:Z==="flows"?"搜索流程片段...":"搜索节点...","aria-label":Z==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsxs("div",{className:"af-palette-tabs",role:"tablist","aria-label":"Palette 类型",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":Z==="nodes",className:"af-palette-tab"+(Z==="nodes"?" af-palette-tab--active":""),onClick:()=>V("nodes"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),o.jsxs("button",{type:"button",role:"tab","aria-selected":Z==="flows",className:"af-palette-tab"+(Z==="flows"?" af-palette-tab--active":""),onClick:()=>V("flows"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),"流程"]})]})]}),o.jsx("div",{className:"af-node-palette-scroll af-workspace-node-palette-scroll",children:Z==="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:_l,disabled:Xn.length<2,title:Xn.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:["已选 ",Xn.length," 节点 / ",es.length," 连线"]})]})}),ae?o.jsx("p",{className:"af-err af-palette-list-err",children:ae}):null,pe?o.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段..."}):$n.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:$n.map(S=>{const I=`${S.id}@${S.version}`,U=S.displayName||S.name||S.id,X=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",I),Q.dataTransfer.setData("text/plain",I)},onClick:()=>Si(S),title:X,children:[o.jsxs("span",{className:"af-palette-card-head",children:[o.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:"account_tree"})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:U}),o.jsxs("span",{className:"af-palette-card-id",children:[S.id,"@",S.version]})]})]}),X?o.jsx("span",{className:"af-palette-card-desc",children:X}):null,o.jsxs("span",{className:"af-flow-snippet-meta","aria-hidden":!0,children:[o.jsxs("span",{children:[S.nodeCount||0," nodes"]}),o.jsxs("span",{children:[S.edgeCount||0," edges"]})]})]},I)})})]}):o.jsx("p",{className:"af-palette-empty",children:P.trim()?"没有匹配的流程片段":"暂无流程片段。选择多个节点后发布。"})]}):o.jsxs(o.Fragment,{children:[Bc.map(S=>{var I;return(I=ka[S])!=null&&I.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:ka[S].map(U=>{const X=n1(U.inputs,"input"),Q=n1(U.outputs,"output"),ie=xb(U),te=zd(U);return o.jsxs("button",{type:"button",className:"af-palette-card",draggable:!0,onDragStart:oe=>Il(oe,U),onClick:()=>ji(U),title:ie||U.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:e1(S)})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:te}),te!==U.id?o.jsx("span",{className:"af-palette-card-id",children:U.id}):null]})]}),ie?o.jsx("span",{className:"af-palette-card-desc",children:ie}):null,o.jsxs("span",{className:"af-palette-card-ports","aria-hidden":!0,children:[o.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--in",children:[o.jsxs("span",{className:"af-palette-card-port-count",children:[X.list.length," IN"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[X.shown.map((oe,de)=>o.jsxs("span",{className:"af-palette-card-port",title:t1("input",oe,de),children:[o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Zn(oe==null?void 0:oe.type)}}),o.jsx("span",{className:"af-palette-card-port-name",children:xx(oe,de)})]},`in-${de}`)),X.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",X.hidden]}):null]})]}),o.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--out",children:[o.jsxs("span",{className:"af-palette-card-port-count",children:[Q.list.length," OUT"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[Q.shown.map((oe,de)=>o.jsxs("span",{className:"af-palette-card-port",title:t1("output",oe,de),children:[o.jsx("span",{className:"af-palette-card-port-name",children:xx(oe,de)}),o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Zn(oe==null?void 0:oe.type)}})]},`out-${de}`)),Q.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",Q.hidden]}):null]})]})]})]},U.id)})})]},S):null}),_.length>0&&P.trim()&&Bc.every(S=>{var I;return!((I=ka[S])!=null&&I.length)})?o.jsx("p",{className:"af-palette-empty",children:"没有匹配的节点"}):null]})})]})]}),o.jsxs("main",{className:"af-workspace-canvas",children:[o.jsx(zv,{className:"af-flow-canvas af-workspace-flow"+(Lo==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select")+(dt?" af-workspace-flow--display-mode":""),nodes:Gg,edges:bp,nodeTypes:_q,onNodesChange:Cc,onEdgesChange:Np,onConnect:dt?void 0:Cp,onConnectStart:dt?void 0:Vr,onConnectEnd:dt?void 0:Ep,isValidConnection:dt?void 0:jp,onNodeClick:(S,I)=>{if(dt){A([bx(I.id)]);return}Ge&&Ct(I.id)},onNodeDoubleClick:(S,I)=>{S.preventDefault(),!dt&&(Ro(!1),c(U=>U.map(X=>({...X,selected:X.id===I.id}))),f(U=>U.map(X=>({...X,selected:!1}))),Ct(I.id))},onPaneClick:()=>{dt?A([]):Ct("")},onDrop:dt?void 0:Pp,onDragOver:dt?void 0:Ci,nodesDraggable:dt?!0:Me,nodesConnectable:dt?!1:Me,edgesReconnectable:dt?!1:Me,deleteKeyCode:dt?null:Me?["Backspace","Delete"]:null,selectionOnDrag:Lo==="select",panOnDrag:Lo==="pan"?!0:[1,2],panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,children:o.jsx(Hv,{color:"rgba(255,255,255,0.12)",gap:22,size:1})}),!dt&&L?(()=>{var X;const S=String(L.query||"").trim().toLowerCase(),I=S?L.candidates.filter(Q=>{var ie,te,oe;return[(ie=Q.def)==null?void 0:ie.id,Q.displayLabel,Q.description,(te=Q.slot)==null?void 0:te.name,(oe=Q.slot)==null?void 0:oe.type].filter(Boolean).some(de=>String(de).toLowerCase().includes(S))}):L.candidates,U=L.draft.handleType==="source"?"IN":"OUT";return o.jsxs("div",{className:"af-connect-node-menu",style:{left:L.left,top:L.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:Zn((X=L.draft.slot)==null?void 0:X.type)},"aria-hidden":!0}),o.jsxs("span",{children:["匹配 ",L.draft.slotType," 节点"]})]}),o.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>O(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:L.query,onChange:Q=>O(ie=>ie&&{...ie,query:Q.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),o.jsxs("div",{className:"af-connect-node-menu__list",children:[I.map(Q=>{var oe,de;const ie=Q.displayLabel||((oe=Q.def)==null?void 0:oe.id),te=xx(Q.slot,Q.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>Zs(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:ie}),ie!==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:U}),o.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:Zn((de=Q.slot)==null?void 0:de.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:te})]})]},`${Q.def.id}-${Q.slotIndex}`)}),I.length===0?o.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null,!dt&&!yc?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:()=>Yt(!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:Xn.length===0?o.jsx("span",{className:"af-composer-selected-empty",children:"选择画布节点后,可作为本次 Workspace AI 的上下文。"}):Xn.map(S=>{var Q,ie;const I=String(((Q=S.data)==null?void 0:Q.label)??S.id),U=(ie=S.data)!=null&&ie.definitionId?String(S.data.definitionId):"",X=U&&U!==I?`${I} · ${S.id} · ${U}`:`${I} · ${S.id}`;return o.jsxs("div",{className:"af-composer-node-chip",title:X,children:[o.jsx("span",{className:"af-composer-node-chip-kind",children:U||"node"}),o.jsx("span",{className:"af-composer-node-chip-label",children:I}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>od(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:Xs,rows:2,onChange:S=>Io(S.target.value),onKeyDown:S=>{(S.metaKey||S.ctrlKey)&&S.key==="Enter"&&(S.preventDefault(),Ec())},placeholder:"描述你想在 workspace 中生成、分析或展示的内容",autoComplete:"off",spellCheck:!1,disabled:!Me})}),o.jsxs("div",{className:"af-composer-toolbar",children:[o.jsxs("div",{className:"af-composer-skills-field",children:[o.jsxs("button",{ref:Xe,type:"button",className:"af-composer-skills-button"+(jr.length>0?" af-composer-skills-button--active":""),disabled:Br||!Me,"aria-haspopup":"listbox","aria-expanded":Te,onClick:()=>Ae(S=>!S),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("span",{children:jr.length>0?`Skills ${jr.length}`:"Skills"})]}),Te&&!Br?Mr.createPortal(o.jsx("div",{ref:Wt,className:"af-composer-skills-menu",role:"listbox","aria-label":"Skills",style:tr,children:On.length===0?o.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):o.jsxs(o.Fragment,{children:[wi.groups.map(S=>{const I=sl(S,On),U=M_(S,nd,On),X=K.has(S.id);return o.jsxs("div",{className:"af-composer-skill-group af-composer-skill-group--framed"+(X?" af-composer-skill-group--collapsed":""),children:[o.jsxs("div",{className:"af-composer-skill-group-title af-composer-skill-group-title--selectable",children:[o.jsxs("label",{className:"af-composer-skill-group-check",children:[o.jsx("input",{type:"checkbox",checked:U==="all",disabled:I.length===0,onChange:Q=>{const ie=Q.target.checked;gi(te=>ie?L_(te,I):O_(te,I))}}),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,U==="partial"?o.jsx("em",{children:"partial"}):null]})]}),o.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":X?`展开 ${S.name}`:`收起 ${S.name}`,onClick:()=>{me(Q=>{const ie=new Set(Q);return ie.has(S.id)?ie.delete(S.id):ie.add(S.id),ie})},children:[o.jsx("span",{children:S.skills.length}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:X?"expand_more":"expand_less"})]})]}),X?null:o.jsx("div",{className:"af-composer-skill-group-items",children:S.skills.map(Q=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:nd.has(Q.key),onChange:ie=>{const te=ie.target.checked;gi(oe=>te?oe.includes(Q.key)?oe:[...oe,Q.key]:oe.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)}),wi.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:wi.ungrouped.length})]}),wi.ungrouped.map(S=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:nd.has(S.key),onChange:I=>{const U=I.target.checked;gi(X=>U?X.includes(S.key)?X:[...X,S.key]:X.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:Ht,onChange:S=>qt(S.target.value),"aria-label":"模型",children:[o.jsx("option",{value:"",children:"默认模型"}),Qg.map(S=>o.jsx("option",{value:S.value,children:S.label},S.value))]})}),o.jsx("button",{type:"button",className:"af-composer-send"+(Xs.trim()&&!Br?" af-composer-send--active":"")+(Br?" af-composer-send--stop":""),disabled:Br||!Xs.trim()||!Me,"aria-label":Br?"Running":"Send",onClick:()=>void Ec(),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Br?"sync":"arrow_upward"})})]})]})]})}):dt?null:o.jsx("button",{type:"button",className:"af-workspace-composer-fab",onClick:()=>Yt(!1),"aria-label":"展开 AI 输入框",title:"展开 AI 输入框",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"auto_awesome"})})]}),!dt&&To?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:()=>Ro(!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"+(gc==="workspace"?" af-composer-session-tab--active":""),onClick:()=>Xi("workspace"),children:o.jsx("span",{className:"af-composer-session-label",children:"Workspace"})}),Qu.map(S=>o.jsx("button",{type:"button",className:"af-composer-session-tab"+(gc===S.id?" af-composer-session-tab--active":"")+(S.status==="running"?" af-composer-session-tab--running":""),onClick:()=>Xi(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"+(wt?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:Zg}),o.jsx("div",{className:"af-composer-sidebar-thread",children:o.jsx(Iq,{messages:It,running:wt,showRunningIndicator:!yr})})]})}):!dt&&Ke&&Mt?o.jsx("aside",{className:"af-pipeline-drawer af-workspace-node-drawer","aria-label":"Workspace Node Properties",children:o.jsx(kT,{draft:Ke,setDraft:jn,definitionId:String(((un=Mt.data)==null?void 0:un.definitionId)||Mt.id),systemPromptReadonly:String(((en=Mt.data)==null?void 0:en.description)||""),modelLists:Nr,disabled:!Me,onIdBlur:()=>td(!0),onClose:()=>Ct(""),onPublishToMarketplace:ed,error:Eo,ioSlots:{inputs:Array.isArray(Ke==null?void 0:Ke.inputs)?Ke.inputs:[],outputs:Array.isArray(Ke==null?void 0:Ke.outputs)?Ke.outputs:[]}})}):null,o.jsx(gT,{open:ml,onClose:()=>Qi(!1)}),o.jsx(yT,{open:cr,onClose:()=>gl(!1),onJump:Jg,nodes:Xg}),Pe?Mr.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:_e.name,onChange:S=>{const I=S.target.value;Ie(U=>({...U,name:I,id:U.id?U.id:I.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")}))},placeholder:"例如:内容整理片段",autoFocus:!0})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"ID"}),o.jsx("input",{type:"text",value:_e.id,onChange:S=>Ie(I=>({...I,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:_e.description,onChange:S=>Ie(I=>({...I,description:S.target.value})),placeholder:"这段流程适合什么 workspace 场景、需要接哪些上下游。",rows:4})]}),o.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",Xn.length," 个节点和 ",es.length," 条内部连线。"]}),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:()=>we(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:st||!_e.name.trim(),onClick:()=>void Pl(),children:st?"发布中...":"发布"})]})]})}),document.body):null,gn?Mr.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:()=>Tn(!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:Ze.title,onChange:S=>ot(I=>({...I,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:Ze.layout,onChange:S=>ot(I=>({...I,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 U,X;const I=Array.isArray(Ze.nodeIds)&&Ze.nodeIds.includes(S.id);return o.jsxs("label",{className:"af-display-share-node-row",children:[o.jsx("input",{type:"checkbox",checked:I,onChange:()=>Sp(S.id)}),o.jsxs("span",{className:"af-display-share-node-row__main",children:[o.jsx("strong",{children:((U=S.data)==null?void 0:U.label)||S.id}),o.jsxs("small",{children:[Vn((X=S.data)==null?void 0:X.definitionId)," · ",S.id]})]})]},S.id)})}),fe!=null&&fe.absoluteUrl?o.jsxs("div",{className:"af-display-share-result",children:[o.jsx("input",{type:"text",readOnly:!0,value:fe.absoluteUrl,onFocus:S=>S.target.select()}),o.jsx("button",{type:"button",onClick:()=>window.open(fe.absoluteUrl,"_blank","noopener,noreferrer"),children:"打开"}),o.jsx("button",{type:"button",onClick:()=>{var S;return(S=navigator.clipboard)==null?void 0:S.writeText(fe.absoluteUrl).catch(()=>{})},children:"复制"})]}):null,Bn?o.jsx("div",{className:"af-flow-snippet-error",children:Bn}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>Tn(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:zt||!Array.isArray(Ze.nodeIds)||Ze.nodeIds.length===0,onClick:()=>void jt(),children:zt?"生成中...":"生成链接"})]})]})}),document.body):null,Jt?Mr.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:()=>nn(!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:[fe!=null&&fe.absoluteUrl?o.jsxs("div",{className:"af-display-link-modal__url",children:[o.jsx("input",{type:"text",readOnly:!0,value:fe.absoluteUrl,onFocus:S=>S.target.select(),autoFocus:!0}),o.jsxs("button",{type:"button",onClick:()=>window.open(fe.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:()=>{var S;return(S=navigator.clipboard)==null?void 0:S.writeText(fe.absoluteUrl).catch(()=>{})},children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"content_copy"}),"复制"]})]}):o.jsx("div",{className:"af-display-link-modal__empty",children:"还没有生成展示链接"}),Bn?o.jsx("div",{className:"af-flow-snippet-error",children:Bn}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>nn(!1),children:"关闭"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:zt||g.nodeIds.length===0,onClick:()=>void id(),children:zt?"生成中...":fe!=null&&fe.absoluteUrl?"更新链接":"生成链接"})]})]})}),document.body):null,Ln?Mr.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:()=>yn(!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:ir,onChange:S=>rn(S.target.value),placeholder:"搜索展示节点...",autoFocus:!0})]}),o.jsx("div",{className:"af-display-picker-grid",role:"group","aria-label":"选择展示节点",style:{"--af-display-picker-columns":El.length||1},children:Cl.length>0?El.map((S,I)=>o.jsx("div",{className:"af-display-picker-column",children:S.map(sd)},`display-picker-column-${I}`)):o.jsx("div",{className:"af-display-picker-empty",children:Wr.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:()=>yn(!1),children:"完成"})})]})}),document.body):null,!dt&&Sn?Mr.createPortal(o.jsx("div",{className:"af-workspace-quick-add-backdrop",onMouseDown:()=>Zt(!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":Nn==="nodes",className:"af-workspace-quick-add__tab"+(Nn==="nodes"?" af-workspace-quick-add__tab--active":""),onClick:()=>xe("nodes"),children:"节点"}),o.jsx("button",{type:"button",role:"tab","aria-selected":Nn==="flows",className:"af-workspace-quick-add__tab"+(Nn==="flows"?" af-workspace-quick-add__tab--active":""),onClick:()=>xe("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:Ot,value:Re,onChange:S=>it(S.target.value),onKeyDown:S=>{if(S.key==="Escape")S.preventDefault(),Zt(!1);else if(S.key==="ArrowDown"){S.preventDefault();const I=Nn==="flows"?Do.length:$o.length;Ce(U=>Math.min(Math.max(0,I-1),U+1))}else S.key==="ArrowUp"?(S.preventDefault(),Ce(I=>Math.max(0,I-1))):S.key==="Tab"?(S.preventDefault(),xe(I=>I==="nodes"?"flows":"nodes")):S.key==="Enter"&&(S.preventDefault(),Nn==="flows"?ad(Do[re]||Do[0]):Rs($o[re]||$o[0]))},placeholder:Nn==="flows"?"搜索流程片段...":"搜索节点...","aria-label":Nn==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsx("div",{className:"af-workspace-quick-add__list",children:Nn==="flows"?Do.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:pe?"正在加载流程片段...":ae||"没有匹配的流程片段"}):Do.map((S,I)=>{const U=S.displayName||S.name||S.id,X=S.snippet&&typeof S.snippet=="object"?S.snippet.instances:null,Q=S.snippet&&typeof S.snippet=="object"?S.snippet.edges:null,ie=Number.isFinite(Number(S.nodeCount))?Number(S.nodeCount):Object.keys(X||{}).length,te=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"+(I===re?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>Ce(I),onClick:()=>ad(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:U}),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||`${ie} 节点 / ${te} 连线`})]}),o.jsx("span",{className:"af-workspace-quick-add__cat",children:"FLOW"})]},`${S.id}@${S.version}`)}):$o.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:"没有匹配的节点"}):$o.map((S,I)=>{const U=Fd(S),X=zd(S),Q=xb(S);return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(I===re?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>Ce(I),onClick:()=>Rs(S),children:[o.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:e1(U)}),o.jsxs("span",{className:"af-workspace-quick-add__main",children:[o.jsx("span",{className:"af-workspace-quick-add__label",children:X}),o.jsx("span",{className:"af-workspace-quick-add__meta",children: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:U})]},S.id)})})]})}),document.body):null]})]})}function Hq(){return o.jsx(Mg,{children:o.jsx(Bq,{})})}function Wq(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 Vq(e){return e==="mermaid"?"account_tree":e==="ascii"?"notes":e==="html"?"html":e==="image"?"image":e==="chart"?"bar_chart":e==="table"?"table":"article"}function ZT(e){let t=String(e||"").trim();if(!t)return"";const n=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*?)```/);if(n&&n[1])t=n[1].trim();else{const i=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*)$/);i&&i[1]&&(t=i[1].trim())}t=t.replace(/^html\s*\n/i,"").replace(/```\s*$/g,"").trim();const s=[/<!doctype\b/i,/<html\b/i,/<head\b/i,/<body\b/i,/<style\b/i,/<script\b/i,/<main\b/i,/<section\b/i,/<article\b/i,/<div\b/i,/<svg\b/i,/<canvas\b/i].reduce((i,a)=>{const l=a.exec(t);return l?i<0?l.index:Math.min(i,l.index):i},-1);return s>0&&(t=t.slice(s).trim()),t}function Uq(e){const t=ZT(e);if(!t.trim())return"";if(/<base\s+[^>]*target\s*=/i.test(t))return t;const n='<base target="_blank">';return/<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){const n=String(e||"").trim();if(!n)return"";if(/^(?:https?:|data:|blob:|file:)/i.test(n)||n.startsWith("/"))return n;const r=new URLSearchParams;return r.set("id",t),r.set("path",n),`/api/display/file/raw?${r.toString()}`}function Kq(e,t){const n=String(e||"").trim();return n?e2(n,t):""}function qq({content:e,shareId:t}){return o.jsx("div",{className:"af-public-display-markdown",children:o.jsx(Uu,{components:{img({src:n="",alt:r=""}){return o.jsx("img",{src:Kq(n,t),alt:r,loading:"lazy"})},a({href:n="",children:r}){return o.jsx("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:r})}},children:e})})}function Yq(e){const t=String(e||"").trim();if(!t)return[];try{const n=JSON.parse(t);if(Array.isArray(n)&&n.every(r=>r&&typeof r=="object"&&!Array.isArray(r))){const r=Array.from(new Set(n.flatMap(s=>Object.keys(s))));return[r,...n.map(s=>r.map(i=>s[i]??""))]}if(Array.isArray(n)&&n.every(Array.isArray))return n}catch{}return t.split(/\r?\n/).map(n=>n.trim()).filter(Boolean).filter(n=>!/^\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)+\|?$/.test(n)).map(n=>n.replace(/^\||\|$/g,"").split("|").map(r=>r.trim()))}function Gq({content:e}){const t=Yq(e);if(!t.length)return o.jsx("pre",{children:e});const[n,...r]=t;return o.jsx("div",{className:"af-public-display-table-wrap",children:o.jsxs("table",{className:"af-public-display-table",children:[o.jsx("thead",{children:o.jsx("tr",{children:n.map((s,i)=>o.jsx("th",{children:String(s)},i))})}),o.jsx("tbody",{children:r.map((s,i)=>o.jsx("tr",{children:n.map((a,l)=>o.jsx("td",{children:String(s[l]??"")},l))},i))})]})})}function Xq({content:e}){const t=h.useRef(null),n=h.useMemo(()=>RT(e),[e]),[r,s]=h.useState("");return h.useEffect(()=>{let i=!1,a=null,l=null;if(!(!n.ok||!t.current))return s(""),TT(()=>import("./index-DgQRkS4v.js"),[]).then(c=>{if(i||!t.current)return;a=c.init(t.current,null,{renderer:"canvas"}),a.setOption(n.option,!0);const d=()=>a==null?void 0:a.resize();l=new ResizeObserver(d),l.observe(t.current),window.addEventListener("resize",d),window.requestAnimationFrame(d)}).catch(c=>{i||s(String((c==null?void 0:c.message)||c))}),()=>{var c,d;i=!0,(c=l==null?void 0:l.disconnect)==null||c.call(l),(d=a==null?void 0:a.dispose)==null||d.call(a)}},[n]),!n.ok||r?o.jsxs("div",{className:"af-public-display-error",children:[o.jsx("strong",{children:"Chart configuration error"}),o.jsx("span",{children:r||n.error})]}):o.jsx("div",{ref:t,className:"af-public-display-chart"})}function Jq({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 f=n.current;if(!f)return;const u=Math.max(1,f.scrollHeight),p=Math.max(1,f.clientHeight),m=u>p+1,g=m?Math.max(12,p/u*100):100,b=Math.max(0,100-g),v=m?Math.min(b,f.scrollTop/Math.max(1,u-p)*b):0;i({visible:m,top:v,height:g})},[]);h.useEffect(()=>{const f=requestAnimationFrame(a),u=n.current;if(!u||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(f);const p=new ResizeObserver(a);p.observe(u);for(const m of Array.from(u.children))p.observe(m);return()=>{cancelAnimationFrame(f),p.disconnect()}},[t,a]);const l=h.useCallback(f=>{const u=n.current;if(!u)return;const p=Math.max(0,u.scrollHeight-u.clientHeight);u.scrollTop=Math.min(1,Math.max(0,f))*p,a()},[a]),c=h.useCallback((f,u=0)=>{const p=r.current;if(!p)return 0;const m=p.getBoundingClientRect(),g=s.height/100*m.height,b=Math.max(1,m.height-g);return(f-m.top-u)/b},[s.height]),d=h.useCallback(f=>{if(!s.visible)return;f.preventDefault(),f.stopPropagation();const u=r.current;if(!u)return;const p=u.getBoundingClientRect(),m=s.top/100*p.height,g=s.height/100*p.height,v=f.clientY>=p.top+m&&f.clientY<=p.top+m+g?f.clientY-p.top-m:g/2;l(c(f.clientY,v));const y=w=>{w.preventDefault(),l(c(w.clientY,v))},k=()=>{window.removeEventListener("pointermove",y),window.removeEventListener("pointerup",k),window.removeEventListener("pointercancel",k)};window.addEventListener("pointermove",y),window.addEventListener("pointerup",k),window.addEventListener("pointercancel",k)},[c,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 Qq({node:e,shareId:t,style:n}){const r=Wq(e),s=e.kind==="html"?ZT(r):r,i=`af-public-display-node__body--${e.kind||"unknown"}`;return o.jsxs("section",{className:`af-public-display-node af-public-display-node--${e.kind||"unknown"}`,style:n,children:[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:Vq(e.kind)}),o.jsx("strong",{children:e.label||e.id}),o.jsx("em",{children:e.definitionId||e.kind||"display"})]})}),o.jsx(Jq,{className:i,children:s.trim()?o.jsxs(o.Fragment,{children:[e.kind==="html"?o.jsx("iframe",{title:e.label||e.id,sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox",srcDoc:Uq(s)}):null,e.kind==="image"?o.jsx("img",{src:e2(s,t),alt:e.label||e.id,loading:"lazy"}):null,e.kind==="markdown"?o.jsx(qq,{content:s,shareId:t}):null,e.kind==="chart"?o.jsx(Xq,{content:s}):null,e.kind==="table"?o.jsx(Gq,{content:s}):null,e.kind==="mermaid"||e.kind==="ascii"?o.jsx("pre",{children:s}):null]}):o.jsx("div",{className:"af-public-display-empty",children:"No display content"})})]})}function Zq({data:e}){return o.jsx(Qq,{node:e==null?void 0:e.node,shareId:e==null?void 0:e.shareId})}const eY={publicDisplay:Zq};function tY(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 t2(){var a;const{path:e}=No(),t=h.useMemo(()=>tY(e),[e]),[n,r]=h.useState({loading:!0,error:"",share:null,nodes:[]});h.useEffect(()=>{let l=!1;async function c(){if(!t){r({loading:!1,error:"Missing display share id",share:null,nodes:[]});return}r(d=>({...d,loading:!0,error:""}));try{const d=await fetch(`/api/display/share?id=${encodeURIComponent(t)}`),f=await d.json().catch(()=>({}));if(!d.ok)throw new Error(f.error||"展示页不存在");l||r({loading:!1,error:"",share:f.share||null,nodes:Array.isArray(f.nodes)?f.nodes:[]})}catch(d){l||r({loading:!1,error:String((d==null?void 0:d.message)||d),share:null,nodes:[]})}}return c(),()=>{l=!0}},[t]);const s=h.useMemo(()=>(Array.isArray(n.nodes)?n.nodes:[]).map((c,d)=>{const f=c.position&&typeof c.position.x=="number"&&typeof c.position.y=="number"?c.position:{x:120+d*40,y:100+d*32},u=c.size&&typeof c.size.width=="number"&&typeof c.size.height=="number"?c.size:{width:520,height:320};return{id:c.id,type:"publicDisplay",position:f,data:{node:c,shareId:t},selectable:!1,draggable:!1,style:{width:Math.max(1,Number(u.width)||520),height:Math.max(1,Number(u.height)||320)}}}),[t,n.nodes]),i=h.useMemo(()=>{var u;const l=(u=n.share)==null?void 0:u.viewport;if(!l||typeof l!="object")return null;const c=Number(l.x),d=Number(l.y),f=Number(l.zoom);return!Number.isFinite(c)||!Number.isFinite(d)||!Number.isFinite(f)?null:{x:c,y:d,zoom:Math.min(Math.max(f,.1),4)}},[(a=n.share)==null?void 0:a.viewport]);return n.loading?o.jsx("main",{className:"af-public-display-page",children:o.jsx("div",{className:"af-public-display-status",children:"Loading..."})}):n.error?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})]})}):o.jsx("main",{className:"af-public-display-page af-public-display-page--canvas",children:o.jsx(Mg,{children:o.jsx(zv,{className:"af-public-display-flow",nodes:s,edges:[],nodeTypes:eY,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(Hv,{color:"rgba(255,255,255,0.12)",gap:22,size:1})})})})}const kt=e=>typeof e=="string",Ed=()=>{let e,t;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n},d1=e=>e==null?"":""+e,nY=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},rY=/###/g,f1=e=>e&&e.indexOf("###")>-1?e.replace(rY,"."):e,p1=e=>!e||kt(e),of=(e,t,n)=>{const r=kt(t)?t.split("."):t;let s=0;for(;s<r.length-1;){if(p1(e))return{};const i=f1(r[s]);!e[i]&&n&&(e[i]=new n),Object.prototype.hasOwnProperty.call(e,i)?e=e[i]:e={},++s}return p1(e)?{}:{obj:e,k:f1(r[s])}},h1=(e,t,n)=>{const{obj:r,k:s}=of(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=of(e,a,Object);for(;l.obj===void 0&&a.length;)i=`${a[a.length-1]}.${i}`,a=a.slice(0,a.length-1),l=of(e,a,Object),l&&l.obj&&typeof l.obj[`${l.k}.${i}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${i}`]=n},sY=(e,t,n,r)=>{const{obj:s,k:i}=of(e,t,Object);s[i]=s[i]||[],s[i].push(n)},Qm=(e,t)=>{const{obj:n,k:r}=of(e,t);if(n)return n[r]},iY=(e,t,n)=>{const r=Qm(e,n);return r!==void 0?r:Qm(t,n)},n2=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?kt(e[r])||e[r]instanceof String||kt(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):n2(e[r],t[r],n):e[r]=t[r]);return e},Dc=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var oY={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const aY=e=>kt(e)?e.replace(/[&<>"'\/]/g,t=>oY[t]):e;class lY{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 cY=[" ",",","?","!",";"],uY=new lY(20),dY=(e,t,n)=>{t=t||"",n=n||"";const r=cY.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const s=uY.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},bb=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let s=e;for(let i=0;i<r.length;){if(!s||typeof s!="object")return;let a,l="";for(let c=i;c<r.length;++c)if(c!==i&&(l+=n),l+=r[c],a=s[l],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&c<r.length-1)continue;i+=c-i+1;break}s=a}return s},Zm=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 eg{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:(kt(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new eg(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new eg(this.logger,t)}}var mo=new eg;class Wg{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const s=this.observers[r].get(n)||0;this.observers[r].set(n,s+1)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t].delete(n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];this.observers[t]&&Array.from(this.observers[t].entries()).forEach(a=>{let[l,c]=a;for(let d=0;d<c;d++)l(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(a=>{let[l,c]=a;for(let d=0;d<c;d++)l.apply(l,[t,...r])})}}class m1 extends Wg{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):kt(r)&&i?l.push(...r.split(i)):l.push(r)));const c=Qm(this.data,l);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=l[0],n=l[1],r=l.slice(2).join(".")),c||!a||!kt(r)?c:bb(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),h1(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)(kt(r[i])||Array.isArray(r[i]))&&this.addResource(t,n,i,r[i],{silent:!0});s.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,s,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},l=[t,n];t.indexOf(".")>-1&&(l=t.split("."),s=r,r=n,n=l[1]),this.addNamespaces(n);let c=Qm(this.data,l)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?n2(c,r,i):c={...c,...r},h1(this.data,l,c),a.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(s=>n[s]&&Object.keys(n[s]).length>0)}toJSON(){return this.data}}var r2={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 g1={};class tg extends Wg{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),nY(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=mo.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 c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:kt(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:kt(i)?[i]:i}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const s=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(t[t.length-1],n),c=l[l.length-1],d=n.lng||this.language,f=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&d.toLowerCase()==="cimode"){if(f){const j=n.nsSeparator||this.options.nsSeparator;return s?{res:`${c}${j}${a}`,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${j}${a}`}return s?{res:a,usedKey:a,exactUsedKey:a,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:a}const u=this.resolve(t,n);let p=u&&u.res;const m=u&&u.usedKey||a,g=u&&u.exactUsedKey||a,b=Object.prototype.toString.apply(p),v=["[object Number]","[object Function]","[object RegExp]"],y=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,k=!this.i18nFormat||this.i18nFormat.handleAsObject,w=!kt(p)&&typeof p!="boolean"&&typeof p!="number";if(k&&p&&w&&v.indexOf(b)<0&&!(kt(y)&&Array.isArray(p))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const j=this.options.returnedObjectHandler?this.options.returnedObjectHandler(m,p,{...n,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return s?(u.res=j,u.usedParams=this.getUsedParamsDetails(n),u):j}if(i){const j=Array.isArray(p),A=j?[]:{},C=j?g:m;for(const $ in p)if(Object.prototype.hasOwnProperty.call(p,$)){const B=`${C}${i}${$}`;A[$]=this.translate(B,{...n,joinArrays:!1,ns:l}),A[$]===B&&(A[$]=p[$])}p=A}}else if(k&&kt(y)&&Array.isArray(p))p=p.join(y),p&&(p=this.extendTranslation(p,t,n,r));else{let j=!1,A=!1;const C=n.count!==void 0&&!kt(n.count),$=tg.hasDefaultValue(n),B=C?this.pluralResolver.getSuffix(d,n.count,n):"",F=n.ordinal&&C?this.pluralResolver.getSuffix(d,n.count,{ordinal:!1}):"",z=C&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),L=z&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${B}`]||n[`defaultValue${F}`]||n.defaultValue;!this.isValidLookup(p)&&$&&(j=!0,p=L),this.isValidLookup(p)||(A=!0,p=a);const W=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&A?void 0:p,M=$&&L!==p&&this.options.updateMissing;if(A||j||M){if(this.logger.log(M?"updateKey":"missingKey",d,c,a,M?L:p),i){const _=this.resolve(a,{...n,keySeparator:!1});_&&_.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let T=[];const E=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&E&&E[0])for(let _=0;_<E.length;_++)T.push(E[_]);else this.options.saveMissingTo==="all"?T=this.languageUtils.toResolveHierarchy(n.lng||this.language):T.push(n.lng||this.language);const D=(_,R,P)=>{const G=$&&P!==p?P:W;this.options.missingKeyHandler?this.options.missingKeyHandler(_,c,R,G,M,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(_,c,R,G,M,n),this.emit("missingKey",_,c,R,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&C?T.forEach(_=>{const R=this.pluralResolver.getSuffixes(_,n);z&&n[`defaultValue${this.options.pluralSeparator}zero`]&&R.indexOf(`${this.options.pluralSeparator}zero`)<0&&R.push(`${this.options.pluralSeparator}zero`),R.forEach(P=>{D([_],a+P,n[`defaultValue${P}`]||L)})}):D(T,a,L))}p=this.extendTranslation(p,t,n,u,r),A&&p===a&&this.options.appendNamespaceToMissingKey&&(p=`${c}:${a}`),(A||j)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?p=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}:${a}`:a,j?p:void 0):p=this.options.parseMissingKeyHandler(p))}return s?(u.res=p,u.usedParams=this.getUsedParamsDetails(n),u):p}extendTranslation(t,n,r,s,i){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const d=kt(t)&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let f;if(d){const p=t.match(this.interpolator.nestingRegexp);f=p&&p.length}let u=r.replace&&!kt(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(u={...this.options.interpolation.defaultVariables,...u}),t=this.interpolator.interpolate(t,u,r.lng||this.language||s.usedLng,r),d){const p=t.match(this.interpolator.nestingRegexp),m=p&&p.length;f<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 p=arguments.length,m=new Array(p),g=0;g<p;g++)m[g]=arguments[g];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,c=kt(l)?[l]:l;return t!=null&&c&&c.length&&r.applyPostProcessor!==!1&&(t=r2.handle(c,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,s,i,a,l;return kt(t)&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(c,n),f=d.key;s=f;let u=d.namespaces;this.options.fallbackNS&&(u=u.concat(this.options.fallbackNS));const p=n.count!==void 0&&!kt(n.count),m=p&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),g=n.context!==void 0&&(kt(n.context)||typeof n.context=="number")&&n.context!=="",b=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);u.forEach(v=>{this.isValidLookup(r)||(l=v,!g1[`${b[0]}-${v}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&(g1[`${b[0]}-${v}`]=!0,this.logger.warn(`key "${s}" for languages "${b.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!!!")),b.forEach(y=>{if(this.isValidLookup(r))return;a=y;const k=[f];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(k,f,y,v,n);else{let j;p&&(j=this.pluralResolver.getSuffix(y,n.count,n));const A=`${this.options.pluralSeparator}zero`,C=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(p&&(k.push(f+j),n.ordinal&&j.indexOf(C)===0&&k.push(f+j.replace(C,this.options.pluralSeparator)),m&&k.push(f+A)),g){const $=`${f}${this.options.contextSeparator}${n.context}`;k.push($),p&&(k.push($+j),n.ordinal&&j.indexOf(C)===0&&k.push($+j.replace(C,this.options.pluralSeparator)),m&&k.push($+A))}}let w;for(;w=k.pop();)this.isValidLookup(r)||(i=w,r=this.getResource(y,v,w,n))}))})}),{res:r,usedKey:s,exactUsedKey:i,usedLng:a,usedNS:l}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,s):this.resourceStore.getResource(t,n,r,s)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!kt(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 vx=e=>e.charAt(0).toUpperCase()+e.slice(1);class y1{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=mo.create("languageUtils")}getScriptPartFromCode(t){if(t=Zm(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=Zm(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(kt(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]=vx(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]=vx(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=vx(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)),kt(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 kt(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))):kt(t)&&i(this.formatLanguageCode(t)),r.forEach(a=>{s.indexOf(a)<0&&i(this.formatLanguageCode(a))}),s}}let pY=[{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 mY=["v1","v2","v3"],gY=["v4"],x1={zero:0,one:1,two:2,few:3,many:4,other:5},yY=()=>{const e={};return pY.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:hY[t.fc]}})}),e};class xY{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=mo.create("pluralResolver"),(!this.options.compatibilityJSON||gY.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=yY(),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=Zm(t==="dev"?"en":t),s=n.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:r,type:s});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(r,{type:s})}catch{if(!t.match(/-|_/))return;const c=this.languageUtils.getLanguagePartFromCode(t);a=this.getRule(c,n)}return this.pluralRulesCache[i]=a,a}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(s=>`${n}${s}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((s,i)=>x1[s]-x1[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!mY.includes(this.options.compatibilityJSON)}}const w1=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=iY(e,t,n);return!i&&s&&kt(n)&&(i=bb(e,n,r),i===void 0&&(i=bb(t,n,r))),i},kx=e=>e.replace(/\$/g,"$$$$");class wY{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=mo.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:s,prefix:i,prefixEscaped:a,suffix:l,suffixEscaped:c,formatSeparator:d,unescapeSuffix:f,unescapePrefix:u,nestingPrefix:p,nestingPrefixEscaped:m,nestingSuffix:g,nestingSuffixEscaped:b,nestingOptionsSeparator:v,maxReplaces:y,alwaysFormat:k}=t.interpolation;this.escape=n!==void 0?n:aY,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=i?Dc(i):a||"{{",this.suffix=l?Dc(l):c||"}}",this.formatSeparator=d||",",this.unescapePrefix=f?"":u||"-",this.unescapeSuffix=this.unescapePrefix?"":f||"",this.nestingPrefix=p?Dc(p):m||Dc("$t("),this.nestingSuffix=g?Dc(g):b||Dc(")"),this.nestingOptionsSeparator=v||",",this.maxReplaces=y||1e3,this.alwaysFormat=k!==void 0?k:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,s){let i,a,l;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=m=>{if(m.indexOf(this.formatSeparator)<0){const y=w1(n,c,m,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...s,...n,interpolationkey:m}):y}const g=m.split(this.formatSeparator),b=g.shift().trim(),v=g.join(this.formatSeparator).trim();return this.format(w1(n,c,b,this.options.keySeparator,this.options.ignoreJSONStructure),v,r,{...s,...n,interpolationkey:b})};this.resetRegExp();const f=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,u=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:m=>kx(m)},{regex:this.regexp,safeValue:m=>this.escapeValue?kx(this.escape(m)):kx(m)}].forEach(m=>{for(l=0;i=m.regex.exec(t);){const g=i[1].trim();if(a=d(g),a===void 0)if(typeof f=="function"){const v=f(t,i,s);a=kt(v)?v:""}else if(s&&Object.prototype.hasOwnProperty.call(s,g))a="";else if(u){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${t}`),a="";else!kt(a)&&!this.useRawValueToEscape&&(a=d1(a));const b=m.safeValue(a);if(t=t.replace(i[0],b),u?(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=(c,d)=>{const f=this.nestingOptionsSeparator;if(c.indexOf(f)<0)return c;const u=c.split(new RegExp(`${f}[ ]*{`));let p=`{${u[1]}`;c=u[0],p=this.interpolate(p,a);const m=p.match(/'/g),g=p.match(/"/g);(m&&m.length%2===0&&!g||g.length%2!==0)&&(p=p.replace(/'/g,'"'));try{a=JSON.parse(p),d&&(a={...d,...a})}catch(b){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,b),`${c}${f}${p}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,c};for(;s=this.nestingRegexp.exec(t);){let c=[];a={...r},a=a.replace&&!kt(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let d=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){const f=s[1].split(this.formatSeparator).map(u=>u.trim());s[1]=f.shift(),c=f,d=!0}if(i=n(l.call(this,s[1].trim(),a),a),i&&s[0]===t&&!kt(i))return i;kt(i)||(i=d1(i)),i||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),i=""),d&&(i=c.reduce((f,u)=>this.format(f,u,r.lng,{...r,interpolationkey:s[1].trim()}),i.trim())),t=t.replace(s[0],i),this.regexp.lastIndex=0}return t}}const bY=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const s=r[1].substring(0,r[1].length-1);t==="currency"&&s.indexOf(":")<0?n.currency||(n.currency=s.trim()):t==="relativetime"&&s.indexOf(":")<0?n.range||(n.range=s.trim()):s.split(";").forEach(a=>{if(a){const[l,...c]=a.split(":"),d=c.join(":").trim().replace(/^'+|'+$/g,""),f=l.trim();n[f]||(n[f]=d),d==="false"&&(n[f]=!1),d==="true"&&(n[f]=!0),isNaN(d)||(n[f]=parseInt(d,10))}})}return{formatName:t,formatOptions:n}},Fc=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(Zm(r),s),t[a]=l),l(n)}};class vY{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=mo.create("formatter"),this.options=t,this.formats={number:Fc((n,r)=>{const s=new Intl.NumberFormat(n,{...r});return i=>s.format(i)}),currency:Fc((n,r)=>{const s=new Intl.NumberFormat(n,{...r,style:"currency"});return i=>s.format(i)}),datetime:Fc((n,r)=>{const s=new Intl.DateTimeFormat(n,{...r});return i=>s.format(i)}),relativetime:Fc((n,r)=>{const s=new Intl.RelativeTimeFormat(n,{...r});return i=>s.format(i,r.range||"day")}),list:Fc((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()]=Fc(n)}format(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=n.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&i[0].indexOf(")")<0&&i.find(l=>l.indexOf(")")>-1)){const l=i.findIndex(c=>c.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,l)].join(this.formatSeparator)}return i.reduce((l,c)=>{const{formatName:d,formatOptions:f}=bY(c);if(this.formats[d]){let u=l;try{const p=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},m=p.locale||p.lng||s.locale||s.lng||r;u=this.formats[d](l,m,{...f,...s,...p})}catch(p){this.logger.warn(p)}return u}else this.logger.warn(`there was no format function for ${d}`);return l},t)}}const kY=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class SY extends Wg{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=mo.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,s.backend,s)}queueLoad(t,n,r,s){const i={},a={},l={},c={};return t.forEach(d=>{let f=!0;n.forEach(u=>{const p=`${d}|${u}`;!r.reload&&this.store.hasResourceBundle(d,u)?this.state[p]=2:this.state[p]<0||(this.state[p]===1?a[p]===void 0&&(a[p]=!0):(this.state[p]=1,f=!1,a[p]===void 0&&(a[p]=!0),i[p]===void 0&&(i[p]=!0),c[u]===void 0&&(c[u]=!0)))}),f||(l[d]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(c)}}loaded(t,n,r){const s=t.split("|"),i=s[0],a=s[1];n&&this.emit("failedLoading",i,a,n),!n&&r&&this.store.addResourceBundle(i,a,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const l={};this.queue.forEach(c=>{sY(c.loaded,[i],a),kY(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(d=>{l[d]||(l[d]={});const f=c.loaded[d];f.length&&f.forEach(u=>{l[d][u]===void 0&&(l[d][u]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!t.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:s,wait:i,callback:a});return}this.readingCalls++;const l=(d,f)=>{if(this.readingCalls--,this.waitingReads.length>0){const u=this.waitingReads.shift();this.read(u.lng,u.ns,u.fcName,u.tried,u.wait,u.callback)}if(d&&f&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,s+1,i*2,a)},i);return}a(d,f)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const d=c(t,n);d&&typeof d.then=="function"?d.then(f=>l(null,f)).catch(l):l(null,d)}catch(d){l(d)}return}return c(t,n,l)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();kt(t)&&(t=this.languageUtils.toResolveHierarchy(t)),kt(n)&&(n=[n]);const i=this.queueLoad(t,n,r,s);if(!i.toLoad.length)return i.pending.length||s(),null;i.toLoad.forEach(a=>{this.loadOne(a)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),s=r[0],i=r[1];this.read(s,i,"read",void 0,void 0,(a,l)=>{a&&this.logger.warn(`${n}loading namespace ${i} for language ${s} failed`,a),!a&&l&&this.logger.log(`${n}loaded namespace ${i} for language ${s}`,l),this.loaded(t,a,l)})}saveMissing(t,n,r,s,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},l=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const c={...a,isUpdate:i},d=this.backend.create.bind(this.backend);if(d.length<6)try{let f;d.length===5?f=d(t,n,r,s,c):f=d(t,n,r,s),f&&typeof f.then=="function"?f.then(u=>l(null,u)).catch(l):l(null,f)}catch(f){l(f)}else d(t,n,r,s,l,c)}!t||!t[0]||this.store.addResource(t[0],n,r,s)}}}const b1=()=>({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]),kt(e[1])&&(t.defaultValue=e[1]),kt(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}}),v1=e=>(kt(e.ns)&&(e.ns=[e.ns]),kt(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),kt(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),jh=()=>{},NY=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Hf extends Wg{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=v1(t),this.services={},this.logger=mo,this.modules={external:[]},NY(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&&(kt(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const s=b1();this.options={...s,...this.options,...v1(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...s.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const i=f=>f?typeof f=="function"?new f:f:null;if(!this.options.isClone){this.modules.logger?mo.init(i(this.modules.logger),this.options):mo.init(null,this.options);let f;this.modules.formatter?f=this.modules.formatter:typeof Intl<"u"&&(f=vY);const u=new y1(this.options);this.store=new m1(this.options.resources,this.options);const p=this.services;p.logger=mo,p.resourceStore=this.store,p.languageUtils=u,p.pluralResolver=new xY(u,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),f&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(p.formatter=i(f),p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new wY(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new SY(i(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",function(m){for(var g=arguments.length,b=new Array(g>1?g-1:0),v=1;v<g;v++)b[v-1]=arguments[v];t.emit(m,...b)}),this.modules.languageDetector&&(p.languageDetector=i(this.modules.languageDetector),p.languageDetector.init&&p.languageDetector.init(p,this.options.detection,this.options)),this.modules.i18nFormat&&(p.i18nFormat=i(this.modules.i18nFormat),p.i18nFormat.init&&p.i18nFormat.init(this)),this.translator=new tg(this.services,this.options),this.translator.on("*",function(m){for(var g=arguments.length,b=new Array(g>1?g-1:0),v=1;v<g;v++)b[v-1]=arguments[v];t.emit(m,...b)}),this.modules.external.forEach(m=>{m.init&&m.init(this)})}if(this.format=this.options.interpolation.format,r||(r=jh),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const f=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);f.length>0&&f[0]!=="dev"&&(this.options.lng=f[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(f=>{this[f]=function(){return t.store[f](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(f=>{this[f]=function(){return t.store[f](...arguments),t}});const c=Ed(),d=()=>{const f=(u,p)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(p),r(u,p)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return f(null,this.t.bind(this));this.changeLanguage(this.options.lng,f)};return this.options.resources||!this.options.initImmediate?d():setTimeout(d,0),c}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jh;const s=kt(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(s&&s.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const i=[],a=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(d=>{d!=="cimode"&&i.indexOf(d)<0&&i.push(d)})};s?a(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>a(c)),this.options.preload&&this.options.preload.forEach(l=>a(l)),this.services.backendConnector.load(i,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(l)})}else r(null)}reloadResources(t,n,r){const s=Ed();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=jh),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"&&r2.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=Ed();this.emit("languageChanging",t);const i=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},a=(c,d)=>{d?(i(d),this.translator.changeLanguage(d),this.isLanguageChangingTo=void 0,this.emit("languageChanged",d),this.logger.log("languageChanged",d)):this.isLanguageChangingTo=void 0,s.resolve(function(){return r.t(...arguments)}),n&&n(c,function(){return r.t(...arguments)})},l=c=>{!t&&!c&&this.services.languageDetector&&(c=[]);const d=kt(c)?c:this.services.languageUtils.getBestMatchFromCodes(c);d&&(this.language||i(d),this.translator.language||this.translator.changeLanguage(d),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(d)),this.loadResources(d,f=>{a(f,d)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?l(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(l):this.services.languageDetector.detect(l):l(t),s}getFixedT(t,n,r){var s=this;const i=function(a,l){let c;if(typeof l!="object"){for(var d=arguments.length,f=new Array(d>2?d-2:0),u=2;u<d;u++)f[u-2]=arguments[u];c=s.options.overloadTranslationOptionHandler([a,l].concat(f))}else c={...l};c.lng=c.lng||i.lng,c.lngs=c.lngs||i.lngs,c.ns=c.ns||i.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||r||i.keyPrefix);const p=s.options.keySeparator||".";let m;return c.keyPrefix&&Array.isArray(a)?m=a.map(g=>`${c.keyPrefix}${p}${g}`):m=c.keyPrefix?`${c.keyPrefix}${p}${a}`:a,s.t(m,c)};return kt(t)?i.lng=t:i.lngs=t,i.ns=n,i.keyPrefix=r,i}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(l,c)=>{const d=this.services.backendConnector.state[`${l}|${c}`];return d===-1||d===0||d===2};if(n.precheck){const l=n.precheck(this,a);if(l!==void 0)return l}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,t)&&(!s||a(i,t)))}loadNamespaces(t,n){const r=Ed();return this.options.ns?(kt(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=Ed();kt(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 y1(b1());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 Hf(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jh;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},i=new Hf(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 m1(this.store.data,s),i.services.resourceStore=i.store),i.translator=new tg(i.services,s),i.translator.on("*",function(l){for(var c=arguments.length,d=new Array(c>1?c-1:0),f=1;f<c;f++)d[f-1]=arguments[f];i.emit(l,...d)}),i.init(s,n),i.translator.options=s,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const zr=Hf.createInstance();zr.createInstance=Hf.createInstance;zr.createInstance;zr.dir;zr.init;zr.loadResources;zr.reloadResources;zr.use;zr.changeLanguage;zr.getFixedT;zr.t;zr.exists;zr.setDefaultNamespace;zr.hasLoadedNamespace;zr.loadNamespaces;zr.loadLanguages;function jY(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Wf(e){"@babel/helpers - typeof";return Wf=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},Wf(e)}function CY(e,t){if(Wf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Wf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function EY(e){var t=CY(e,"string");return Wf(t)=="symbol"?t:t+""}function _Y(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,EY(r.key),r)}}function PY(e,t,n){return t&&_Y(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var s2=[],AY=s2.forEach,IY=s2.slice;function TY(e){return AY.call(IY.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var k1=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,RY=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(!k1.test(s.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(s.domain)}if(s.path){if(!k1.test(s.path))throw new TypeError("option path is invalid");a+="; Path=".concat(s.path)}if(s.expires){if(typeof s.expires.toUTCString!="function")throw new TypeError("option expires is invalid");a+="; Expires=".concat(s.expires.toUTCString())}if(s.httpOnly&&(a+="; HttpOnly"),s.secure&&(a+="; Secure"),s.sameSite){var c=typeof s.sameSite=="string"?s.sameSite.toLowerCase():s.sameSite;switch(c){case!0:a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return a},S1={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=RY(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)}},LY={name:"cookie",lookup:function(t){var n;if(t.lookupCookie&&typeof document<"u"){var r=S1.read(t.lookupCookie);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupCookie&&typeof document<"u"&&S1.create(n.lookupCookie,t,n.cookieMinutes,n.cookieDomain,n.cookieOptions)}},OY={name:"querystring",lookup:function(t){var n;if(typeof window<"u"){var r=window.location.search;!window.location.search&&window.location.hash&&window.location.hash.indexOf("?")>-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var s=r.substring(1),i=s.split("&"),a=0;a<i.length;a++){var l=i[a].indexOf("=");if(l>0){var c=i[a].substring(0,l);c===t.lookupQuerystring&&(n=i[a].substring(l+1))}}}return n}},_d=null,N1=function(){if(_d!==null)return _d;try{_d=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{_d=!1}return _d},MY={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&N1()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&N1()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},Pd=null,j1=function(){if(Pd!==null)return Pd;try{Pd=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Pd=!1}return Pd},$Y={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&j1()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&j1()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},DY={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}},FY={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}},zY={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}},BY={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]}},i2=!1;try{document.cookie,i2=!0}catch{}var o2=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];i2||o2.splice(1,1);function HY(){return{order:o2,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var a2=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};jY(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return PY(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=TY(r,this.options||{},HY()),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(LY),this.addDetector(OY),this.addDetector(MY),this.addDetector($Y),this.addDetector(DY),this.addDetector(FY),this.addDetector(zY),this.addDetector(BY)}},{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)}))}}])}();a2.type="languageDetector";const WY={name:"AgentFlow",tagline:"AI Workflow Orchestration"},VY={projects:"Projects",nodes:"Nodes",myNodes:"My Nodes",myFlows:"My Flows",skills:"Skills",mcps:"MCP",feedback:"Feedback",flowEditor:"Flow Editor",settings:"Settings",back:"Back"},UY={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"},KY={success:"Success",failed:"Failed",pending:"Pending",running:"Running",skipped:"Skipped"},qY={agent:"Agent",control:"Control",tool:"Tool",start:"Start",end:"End"},YY={online:"Engine Online",offline:"Engine Offline",connecting:"Connecting…"},GY={hub:"AgentFlow Hub",docs:"Documentation",github:"GitHub Repository"},XY={app:WY,nav:VY,common:UY,status:KY,nodeTypes:qY,engine:YY,links:GY},JY="Flow Editor",QY="Nodes",ZY="Edges",eG="Properties",tG={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"},nG={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}}"},rG={run:"Run Flow",stop:"Stop",resume:"Resume",validate:"Validate",export:"Export",import:"Import"},sG={nodeList:"Node List",runHistory:"Run History",validation:"Validation Results"},iG={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"},oG={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)"},aG={saving:"Saving...",saved:"Saved",saveFailed:"Save failed",runInTerminal:"Please use terminal to run"},lG={requirement:"Requirement Analysis",planning:"Technical Planning",code:"Code Execution",test:"Test Regression",normal:"Normal"},cG={phase:"Phase",allPhasesComplete:"All phases completed",currentPhaseComplete:"Current phase completed, waiting for confirmation..."},uG={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"},pG={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."},mG={mainNav:"Main Navigation"},gG={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'},yG={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):
|
|
176
|
-
{{summary}}`,step:"Step {{current}}/{{total}}: {{description}}",phaseGeneration:`Phased generation ({{count}} phases): {{labels}}
|
|
177
|
-
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}}"},xG={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"},wG={nodePalette:"Node Palette",noPipelineSelected:"No pipeline selected",moreRuns:"+{{count}} more",moreFlows:"+{{count}} more flows",runId:"Run ID: {{id}}"},bG={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}}"},vG={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"},kG={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"},SG={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"},NG={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"},jG={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"},CG={invalidPlaceholder:"Invalid placeholder: {{hint}}",empty:"(empty)",inputSubtitle:"Input · {{type}}",inputSubtitleNoType:"Input",outputSubtitle:"Output · {{type}}",outputSubtitleNoType:"Output",runtimeConst:"Runtime constant"},EG={justNow:"Just now",minutesAgo:"{{n}} min ago",hoursAgo:"{{n}} hr ago",yesterday:"Yesterday",daysAgo:"{{n}} days ago",milliseconds:"{{n}} ms",seconds:"{{n}} s"},_G={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"},PG={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."},AG={title:"Print Output: {{instanceId}}",expand:"Expand",restore:"Restore"},IG={save:"Save",cancel:"Cancel"},TG={title:"Run with Params",noParams:"No input params in this flow",run:"Run",cancel:"Cancel"},RG={title:"Run with Preset",noPresets:"No presets available",default:"Default run",run:"Run",cancel:"Cancel"},LG={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"},OG={title:JY,nodes:QY,edges:ZY,properties:eG,node:tG,nodeProps:nG,actions:rG,panel:sG,palette:iG,pipeline:oG,status:aG,roles:lG,phases:cG,types:uG,runContext:dG,shortcuts:fG,jumpPalette:pG,emptyCanvas:hG,sidebar:mG,validation:gG,composer:yG,topbar:xG,palette2:wG,run:bG,fileEdit:vG,settings:kG,schedule:SG,history:NG,nodePropsError:jG,placeholder:CG,time:EG,userCheck:_G,userAsk:PG,toolPrint:AG,provideEdit:IG,runParams:TG,runPreset:RG,runConfig:LG},MG="Settings",$G={engine:"Engine Settings",preferences:"Global Preferences"},DG={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)."},FG={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..."}},zG={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."},BG={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."},HG={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)"},WG={title:"System Status",normal:"Service normal",abnormal:"Some interfaces abnormal",cursorModels:"Cursor Models",opencodeModels:"OpenCode Models",claudeCodeModels:"Claude Code Models"},VG={title:"Shortcuts",projects:"Projects & Pipelines",flowEditor:"Node Canvas"},UG={title:"Language",description:"Select your preferred language for the interface",options:{zh:"中文",en:"English",ja:"日本語"}},KG={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."},qG={title:MG,crumb:$G,workspace:DG,cursor:FG,opencode:zG,claudeCode:BG,env:HG,system:WG,shortcuts:VG,language:UG,onboarding:KG},YG={thinking:"Thinking",result:"Result",reply:"Reply",error:"Error"},GG={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)"},XG={send:"Send",stop:"Stop",expand:"Expand",collapse:"Collapse",clear:"Clear"},JG={conversation:"Chat",conversationWithNumber:"Chat {{num}}",default:"Default"},QG={endSession:"End chat (will stop generation)",closeSession:"Close chat",newSession:"New chat",expandComposer:"Expand chat and output"},ZG={hint:"Use the bottom input box for AI chat, with @node mentions, model selection, and more"},eX={aiLabels:YG,placeholders:GG,actions:XG,labels:JG,tooltips:QG,rightPanel:ZG},tX="Projects",nX="All",rX="Archived",sX="Nodes",iX="My Nodes",oX="My Flows",aX="Skills",lX="Active Projects",cX="Archived Pipelines",uX="Global Nodes",dX="Manage node versions published to the current workspace marketplace, {{count}} total.",fX="Manage flow snippets published to the current workspace marketplace, {{count}} total.",pX="Global Skills",hX="Create New Project",mX="New Pipeline",gX="SEARCH PIPELINES...",yX="SEARCH NODES...",xX="SEARCH FLOW SNIPPETS...",wX="SEARCH SKILLS...",bX="Refresh Resources",vX="Loading pipelines...",kX="Loading global resources...",SX="Filter result: {{count}} items (matching title, description, path and tags)",NX="Archived pipelines can still be opened and edited; files are located in the _archived subdirectory of each pipelines directory.",jX="Manage your distributed node architectures and monitoring pipelines. Drag flow.yaml or .zip into this page to import shared flows.",CX="Review all globally available node definitions, {{count}} total, including built-in, workspace, and marketplace nodes.",EX="Review Composer-selectable skills, {{count}} total, including AgentFlow built-ins and workspace skills.",_X="Executable building blocks for pipeline runtime",PX="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.",AX="Published local node packages",IX="Only node versions published to this workspace marketplace appear here. Inspect details and delete versions that no flow uses.",TX="Published flow snippets",RX="Flow snippets published from Pipeline or Workspace canvases appear here. Search and inspect them, then load them from the canvas flow palette.",LX="Operating guides for Composer and agents",OX="Skills tell AI which rules to follow for a task, how to change flows, and how to reuse project conventions.",MX="No archived projects.",$X="No active pipelines; archived items are in the Archived tab.",DX="No global nodes available.",FX="No marketplace nodes have been published.",zX="No flow snippets have been published. Select multiple canvas nodes and publish them first.",BX="No skills available.",HX="No description.",WX='No node matches "{{query}}".',VX='No flow snippet matches "{{query}}".',UX='No skill matches "{{query}}".',KX="{{inputs}} in / {{outputs}} out",qX="Flow Snippet",YX="{{nodes}} nodes / {{edges}} edges",GX="Skill",XX="Node detail",JX="Flow snippet detail",QX="Skill detail",ZX="Type",eJ="Source",tJ="Package",nJ="Version",rJ="Path",sJ="Editable",iJ="Read only",oJ="Editable",aJ="Schema",lJ="Inputs",cJ="Outputs",uJ="Runtime",dJ="Node Body",fJ="Files",pJ="Usage",hJ="No runtime manifest.",mJ="No node body or README.",gJ="No previewable files.",yJ="Select a file to preview.",xJ="Binary file preview is not supported.",wJ="Large file; showing the first 256KB only.",bJ="No pipelines using this node were found.",vJ="Node Management",kJ="Delete Node Version",SJ="Deleting...",NJ="AgentFlow checks all flow references before deleting; installed or used versions are kept.",jJ="Delete {{id}}@{{version}}? This cannot be undone.",CJ="Deleted {{id}}@{{version}}.",EJ="{{count}} flow(s) still use it.",_J="Flow Snippet Management",PJ="Delete Flow Snippet",AJ="Deleting...",IJ="Deleting it only removes this reusable marketplace snippet. Nodes already loaded onto canvases are not changed.",TJ="Delete {{id}}@{{version}}? This cannot be undone.",RJ="Deleted {{id}}@{{version}}.",LJ="No slots",OJ="Purpose",MJ="This node is an execution unit in a pipeline. Its schema affects canvas wiring, parameter input, and runtime scheduling.",$J="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.",DJ="Scale",FJ="Flow Preview",zJ="Edges",BJ="Snippet JSON",HJ="{{count}} more edge(s)",WJ="No previewable nodes.",VJ="This skill is injected into Composer as context for AI, constraining its decisions, edit strategy, and output format.",UJ="SKILL.md Preview",KJ="No preview content available.",qJ="Select a resource to inspect details.",YJ="Failed to load pipeline list.",GJ="No pipelines in current workspace.",XJ="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.",JJ='No pipelines found matching "{{query}}". Try different keywords or clear the search.',QJ="Recent Activity",ZJ="No recent activity",eQ="No recent activity matching the keyword",tQ="Recent Run",nQ="Recent Open",rQ={builtin:"Built-in",workspace:"Workspace",user:"User"},sQ={flow:"Flow",global:"Global",marketplace:"Marketplace"},iQ={all:"All",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},oQ={overview:"Overview",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},aQ="Open to edit this pipeline in the node canvas.",lQ={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>"},cQ={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"},uQ={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"},dQ={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"},fQ={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"},pQ={title:tX,all:nX,archived:rX,nodes:sX,myNodes:iX,myFlows:oX,skills:aX,activeProjects:lX,archivedPipelines:cX,globalNodes:uX,myNodesHint:dX,myFlowsHint:fX,globalSkills:pX,createNew:hX,newPipeline:mX,searchPipelines:gX,searchNodes:yX,searchFlows:xX,searchSkills:wX,refreshResources:bX,loadingPipelines:vX,loadingResources:kX,filterResult:SX,archivedHint:NX,activeHint:jX,nodesHint:CX,skillsHint:EX,nodesPurposeTitle:_X,nodesPurposeDesc:PX,myNodesPurposeTitle:AX,myNodesPurposeDesc:IX,myFlowsPurposeTitle:TX,myFlowsPurposeDesc:RX,skillsPurposeTitle:LX,skillsPurposeDesc:OX,noArchived:MX,noActive:$X,noNodes:DX,noMyNodes:FX,noMyFlows:zX,noSkills:BX,noDescription:HX,noNodeMatch:WX,noFlowSnippetMatch:VX,noSkillMatch:UX,nodeSlots:KX,flowSnippet:qX,flowSnippetNodes:YX,skill:GX,nodeDetail:XX,flowDetail:JX,skillDetail:QX,detailType:ZX,detailSource:eJ,detailPackage:tJ,detailVersion:nJ,detailPath:rJ,detailEditable:sJ,readOnly:iJ,editable:oJ,nodeSchema:aJ,nodeInputs:lJ,nodeOutputs:cJ,nodeRuntime:uJ,nodeBody:dJ,nodeFiles:fJ,nodeUsage:pJ,noRuntimeManifest:hJ,noNodeBody:mJ,noNodeFiles:gJ,selectNodeFile:yJ,binaryFile:xJ,fileTruncated:wJ,noNodeUsage:bJ,myNodeManagement:vJ,deleteMyNode:kJ,deletingMyNode:SJ,deleteMyNodeHint:NJ,deleteMyNodeConfirm:jJ,deleteMyNodeSuccess:CJ,deleteMyNodeUsedBy:EJ,myFlowManagement:_J,deleteMyFlow:PJ,deletingMyFlow:AJ,deleteMyFlowHint:IJ,deleteMyFlowConfirm:TJ,deleteMyFlowSuccess:RJ,noSlots:LJ,resourceMeaning:OJ,nodesMeaning:MJ,myFlowsMeaning:$J,flowSnippetScale:DJ,flowSnippetPreview:FJ,flowSnippetEdges:zJ,flowSnippetJson:BJ,flowSnippetMoreEdges:HJ,noFlowSnippetPreview:WJ,skillsMeaning:VJ,skillPreview:UJ,skillPreviewEmpty:KJ,selectResource:qJ,loadFailed:YJ,noPipelines:GJ,emptyHint:XJ,noMatch:JJ,recentActivity:QJ,noRecentActivity:ZJ,noMatchRecent:eQ,recentRun:tQ,recentOpen:nQ,sourceBadge:rQ,resourceSource:sQ,resourceFilter:iQ,nodeDetailTabs:oQ,defaultCardDesc:aQ,hubCard:lQ,newPipelineModal:cQ,importModal:uQ,deleteModal:dQ,archiveModal:fQ},hQ="Back",mQ="Next",gQ="Skip",yQ="Done",xQ="Start Creating",wQ={intro:`Welcome to AgentFlow! This is a visual workflow orchestration tool.
|
|
178
|
-
|
|
179
|
-
Click the button below to create your first pipeline.`,hubIntro:`Don't want to start from scratch?
|
|
180
|
-
|
|
181
|
-
Browse ready-made pipelines on AgentFlow Hub — community-shared flows you can install and run in one click.`},bQ={intro:`Now you're in the flow editor.
|
|
182
|
-
|
|
183
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
184
|
-
|
|
185
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`,introEmpty:`The canvas is empty. Start creating your flow!
|
|
186
|
-
|
|
187
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
188
|
-
|
|
189
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`},vQ={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"},kQ={back:hQ,next:mQ,skip:gQ,done:yQ,startCreate:xQ,projects:wQ,flow:bQ,newPipeline:vQ},SQ={name:"AgentFlow",tagline:"AI 工作流编排"},NQ={projects:"项目",nodes:"Nodes",myNodes:"我的 Nodes",myFlows:"我的流程",skills:"Skills",mcps:"MCP",feedback:"意见反馈",flowEditor:"流程编辑器",settings:"设置",back:"返回"},jQ={loading:"加载中…",saving:"保存中…",save:"保存",cancel:"取消",delete:"删除",edit:"编辑",create:"创建",close:"关闭",confirm:"确认",copy:"复制",copied:"已复制!",refresh:"刷新",search:"搜索",filter:"筛选",success:"成功",error:"错误",warning:"警告",info:"信息",done:"完成",pending:"待处理",running:"运行中",notFound:"未找到",required:"必填",optional:"可选"},CQ={success:"成功",failed:"失败",pending:"等待",running:"运行中",skipped:"跳过"},EQ={agent:"Agent 节点",control:"控制节点",tool:"工具节点",start:"开始",end:"结束"},_Q={online:"引擎在线",offline:"引擎离线",connecting:"连接中…"},PQ={hub:"AgentFlow Hub",docs:"文档",github:"GitHub 仓库"},AQ={app:SQ,nav:NQ,common:jQ,status:CQ,nodeTypes:EQ,engine:_Q,links:PQ},IQ="流程编辑器",TQ="节点",RQ="连线",LQ="属性",OQ={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:"编辑内容"},MQ={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}}"},$Q={run:"运行流程",stop:"停止",resume:"继续",validate:"校验",export:"导出",import:"导入"},DQ={nodeList:"节点列表",runHistory:"运行历史",validation:"校验结果"},FQ={workspace:"工作区",loading:"加载中…",archived:"已归档",noPipelines:"暂无流水线",more:"更多",moreFlows:"更多流程",noRuns:"暂无运行记录",searchNodes:"搜索节点",noComponents:"暂无可用组件(检查节点库目录)",noMatch:"无匹配节点,请调整搜索词",selectPipeline:"从上方选择一条流水线以加载组件与画布",validationWarnings:"校验警告(与 agentflow validate 槽位检查一致)",output:"输出",model:"模型",userDir:"用户目录",toggleRecentActivity:"展开或收起最近打开或最近运行"},zQ={selectPipeline:"请从顶部下拉选择一条流水线",loadingProps:"加载节点属性…",pipelineId:"流水线 ID",diskPath:"磁盘路径",storageLocation:"存储位置",introduction:"介绍",introductionPlaceholder:"简要描述这条流水线的用途(写入 flow.yaml 的 ui.description)",metadata:"元数据",nodeCount:"节点数",nodesUnit:"个节点",loading:"加载中…",noRuns:"暂无运行记录(终端执行后会在工作区生成运行目录)"},BQ={saving:"保存中…",saved:"已保存",saveFailed:"保存失败",runInTerminal:"运行请使用终端"},HQ={requirement:"需求拆解",planning:"技术规划",code:"代码执行",test:"测试回归",normal:"普通"},WQ={phase:"阶段",allPhasesComplete:"所有阶段完成",currentPhaseComplete:"当前阶段完成,等待确认继续…"},VQ={node:"节点",text:"文本",file:"文件",bool:"布尔"},UQ={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:"等待"},KQ={title:"快捷键",general:"常规",saveDesc:"保存;节点属性侧栏打开时先提交节点再保存 flow",shortcutsLabel:"快捷键",jumpToNode:"按 ID 跳转到节点",openNodePalette:"打开节点面板",canvas:"画布",selectTool:"选择工具",panTool:"平移工具",holdSpacePan:"按住空格临时平移",saveViewport:"保存当前进入视角",selectAll:"全选所有节点",undo:"撤销画布修改",redo:"重做画布修改"},qQ={title:"跳转到节点",placeholder:"输入节点 ID 或名称…",empty:"未匹配到节点",hintNavigate:"切换",hintJump:"跳转",hintClose:"关闭"},YQ={title:"开始构建你的流程",text:"在下方 AI 输入框中描述你的流程,或从左侧面板拖拽节点到画布",composerHint:"使用 AI Composer 构建 AgentFlow",composerSub:"从左侧拖入节点,或在<strong>下方输入框</strong>中用自然语言描述工作流。<br/>按 <kbd>?</kbd> 查看快捷键。"},GQ={mainNav:"主导航"},XQ={flowWarningAriaLabel:"流程校验警告",reloadFromServer:"从服务器重新加载流程并刷新校验",reloadFromServerShort:"从服务器重新加载",closeBanner:"关闭校验警告横幅",nodePrefix:"节点",focusNodeAriaLabel:"在画布中选中并定位节点 {{nodeId}}",slotWarningCount:"槽位校验 {{count}} 条(已隐藏)",show:"显示",shortcutHint:"按 ? 查看快捷键",shortcutHintLabel:"快捷键",inputSlotNoEdge:' 的 input 槽位 "{{slotName}}"({{handle}})无对应 edge 连接',outputSlotNoEdge:' 的 output 槽位 "{{slotName}}"({{handle}})无对应 edge 连接'},JQ={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}} 步):
|
|
190
|
-
{{summary}}`,step:"步骤 {{current}}/{{total}}: {{description}}",phaseGeneration:`分阶段生成({{count}} 阶段):{{labels}}
|
|
191
|
-
当前:{{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}}"},QQ={currentPipeline:"当前流水线",backToEdit:"返回编辑",backToProjects:"返回项目",executionLog:"执行日志",history:"历史",pipelineSettings:"流水线设置",shortcutsLabel:"快捷键",shortcutsTitle:"快捷键 (?)",deletePipeline:"删除流水线",resumeTitle:"在同一 run 目录继续执行(uuid={{uuid}})",resumeTitleNoUuid:"尚未收到 apply-start,将发起新的 run",rerunTitle:"从头开始新的运行",runOptions:"运行选项",runWithParams:"带参数运行",runWithPreset:"指定预设运行",editRun:"编辑运行参数",startRun:"开始执行",stopRun:"停止后台运行"},ZQ={nodePalette:"节点调色板",noPipelineSelected:"未选择流水线",moreRuns:"+{{count}} 更多",moreFlows:"+{{count}} 更多流程",runId:"运行 ID: {{id}}"},eZ={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}} 的分支"},tZ={close:"关闭",loading:"加载中…",placeholder:"文件内容",largeFileWarning:"文件较大,编辑器性能可能受影响",reset:"重置",aiEdit:"AI 修改",aiRunning:"AI 处理中…",save:"保存",saving:"保存中…",saved:"已保存"},nZ={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:"已复制"},rZ={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:"定时配置已保存"},sZ={title:"执行历史",summary:"执行结果汇总",successCount:"{{count}} 成功",failedCount:"{{count}} 失败",stoppedCount:"{{count}} 已停止",interruptedCount:"{{count}} 已中断",runningCount:"{{count}} 进行中",success:"成功",failed:"失败",stopped:"已停止",interrupted:"已中断",running:"进行中",unknown:"未知",runLabel:"运行 #{{id}}",enterRunView:"进入该次运行的画布与日志态"},iZ={invalidInstanceId:"实例 ID 格式无效:仅允许英文字母、数字、下划线、短横线,且不能以数字开头。",duplicateInstanceId:"该实例 ID 已存在,请换一个。",loadFlowFailed:"读取 flow 失败",loadNodesFailed:"读取节点库失败"},oZ={invalidPlaceholder:"无效占位符: {{hint}}",empty:"(空)",inputSubtitle:"输入 · {{type}}",inputSubtitleNoType:"输入",outputSubtitle:"输出 · {{type}}",outputSubtitleNoType:"输出",runtimeConst:"运行时常量"},aZ={justNow:"刚刚",minutesAgo:"{{n}} 分钟前",hoursAgo:"{{n}} 小时前",yesterday:"昨天",daysAgo:"{{n}} 天前",milliseconds:"{{n}} 毫秒",seconds:"{{n}} 秒"},lZ={title:"用户确认 ({{instanceId}})",edit:"编辑",save:"保存",cancel:"取消",aiEditPlaceholder:"输入 AI 修改指令,如:删除第二项、合并前两项…",aiEditBtn:"AI 修改",aiEditStarted:"AI 正在修改内容…",aiEditDone:"AI 修改完成",aiEditFailed:"AI 修改失败",contentSaved:"内容已保存",saveFailed:"保存失败",close:"关闭",continue:"继续执行",hint:"编辑或使用 AI 修改后点击保存,然后点击「继续执行」恢复流程"},cZ={title:"用户选择 ({{instanceId}})",hint:"请从下方选项中选择一项以继续流程",submitting:"提交中…",submitFailed:"提交失败",close:"关闭",noOptions:"该节点未配置选项,请先在编辑器中为 output 槽位添加条目。"},uZ={title:"Print 输出: {{instanceId}}",expand:"放大",restore:"还原"},dZ={save:"保存",cancel:"取消"},fZ={title:"带参数运行",noParams:"此流程无输入参数",run:"运行",cancel:"取消"},pZ={title:"指定预设运行",noPresets:"无可用预设",default:"默认运行",run:"运行",cancel:"取消"},hZ={preset:"预设",default:"默认",newPreset:"新建预设",deletePreset:"删除预设",presetNamePlaceholder:"预设名称",inputParams:"输入参数",noProvideNodes:"此流程无 provide 节点",filePathPlaceholder:"文件路径…",stringValuePlaceholder:"值…",presetSaved:"预设已保存",presetDeleted:"预设已删除",savePreset:"保存当前预设",expandInput:"编辑内容"},mZ={title:IQ,nodes:TQ,edges:RQ,properties:LQ,node:OQ,nodeProps:MQ,actions:$Q,panel:DQ,palette:FQ,pipeline:zQ,status:BQ,roles:HQ,phases:WQ,types:VQ,runContext:UQ,shortcuts:KQ,jumpPalette:qQ,emptyCanvas:YQ,sidebar:GQ,validation:XQ,composer:JQ,topbar:QQ,palette2:ZQ,run:eZ,fileEdit:tZ,settings:nZ,schedule:rZ,history:sZ,nodePropsError:iZ,placeholder:oZ,time:aZ,userCheck:lZ,userAsk:cZ,toolPrint:uZ,provideEdit:dZ,runParams:fZ,runPreset:pZ,runConfig:hZ},gZ="设置",yZ={engine:"引擎设置",preferences:"全局首选项"},xZ={title:"工作区",currentPath:"当前工作区根目录",placeholder:"加载中…",copyPath:"复制路径",description:"流水线与节点清单将相对于此目录解析(由启动 UI 时传入)。"},wZ={title:"Cursor CLI",status:{cached:"已缓存",notCached:"未缓存"},modelPreviewLabel:"Cursor 模型名称列表",modelList:{cached:"模型清单已缓存",empty:"暂无模型列表",count:"{{count}} 条",fetchedAt:"更新 {{time}}",never:"尚未拉取",refresh:"刷新清单",fetching:"拉取中…"}},bZ={modelPreviewLabel:"OpenCode 模型名称列表",title:"OpenCode CLI",status:{ready:"就绪",notFound:"未找到"},provider:"方案 / Provider 标识",providerPlaceholder:"例如 bailian-coding-plan",saving:"正在保存并更新清单…",description:"对应 CLI opencode models <provider> 的参数;停止输入后会写入用户目录 config 并刷新 model-lists.json。"},vZ={title:"Claude Code CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Claude Code 模型名称列表",description:"内置模型列表(Claude Code CLI 无 models 子命令);刷新将探测 claude 二进制是否在 PATH 中。首次使用请先执行 claude /login。"},kZ={title:"环境变量",note:"当前登录用户私有,运行时优先于服务全局环境变量",noteAdmin:"可配置个人或全局环境变量;个人同名变量优先于全局",saving:"正在保存...",key:"键",value:"值",scope:"范围",personal:"个人",global:"全局",add:"添加",delete:"删除 {{key}}",invalidKey:"环境变量名必须以字母或下划线开头,且只能包含字母、数字和下划线。",newKey:"新环境变量键",newValue:"值(密钥请谨慎)"},SZ={title:"系统状态",normal:"服务正常",abnormal:"部分接口异常",cursorModels:"Cursor 模型",opencodeModels:"OpenCode 模型",claudeCodeModels:"Claude Code 模型"},NZ={title:"快捷入口",projects:"项目与流水线",flowEditor:"节点画布"},jZ={title:"语言",description:"选择界面显示语言",options:{zh:"中文",en:"English",ja:"日本語"}},CZ={title:"新手引导",description:"重新启动产品引导流程,了解 AgentFlow 的核心功能。",reset:"重置引导",resetSuccess:"已重置,下次访问将自动启动引导"},EZ={title:gZ,crumb:yZ,workspace:xZ,cursor:wZ,opencode:bZ,claudeCode:vZ,env:kZ,system:SZ,shortcuts:NZ,language:jZ,onboarding:CZ},_Z={thinking:"思考",result:"结果",reply:"回复",error:"错误"},PZ={input:"让 AI 协助编辑此节点…",waiting:"等待响应…",selectedEmpty:"在画布上选择节点,或在输入框用 @ 选择实例(Instances)或节点类型(Node)",textarea:"描述你的流程或让 AI 协助编辑(⌘/Ctrl+Enter 发送)"},AZ={send:"发送",stop:"停止",expand:"展开",collapse:"收起",clear:"清空"},IZ={conversation:"对话",conversationWithNumber:"对话 {{num}}",default:"默认"},TZ={endSession:"结束对话(将停止生成)",closeSession:"关闭对话",newSession:"新建对话",expandComposer:"展开对话与输出"},RZ={hint:"使用底部输入框进行 AI 对话,支持 @节点、选择模型等功能"},LZ={aiLabels:_Z,placeholders:PZ,actions:AZ,labels:IZ,tooltips:TZ,rightPanel:RZ},OZ="项目",MZ="全部",$Z="已归档",DZ="Nodes",FZ="我的 Nodes",zZ="我的流程",BZ="Skills",HZ="活跃项目",WZ="已归档流水线",VZ="全局 Nodes",UZ="管理当前工作区已发布到本地 Marketplace 的节点,共 {{count}} 个。",KZ="管理当前工作区已发布到本地 Marketplace 的流程片段,共 {{count}} 个。",qZ="全局 Skills",YZ="创建新项目",GZ="新建流水线",XZ="搜索流水线…",JZ="搜索 nodes…",QZ="搜索流程片段…",ZZ="搜索 skills…",eee="刷新资源",tee="加载流水线列表…",nee="加载全局资源…",ree="筛选结果:{{count}} 条(匹配标题、描述、路径与标签)",see="已归档的流水线仍可打开与编辑;文件位于各 pipelines 目录下的 _archived。",iee="管理分布式节点架构与监控流水线。可将 flow.yaml 或 .zip 拖入本页导入分享流程。",oee="查看当前可用的全局节点定义,共 {{count}} 个;包含内置、工作区与 marketplace 节点。",aee="查看当前 Composer 可选择的 skills,共 {{count}} 个;包含 AgentFlow 内置与工作区 skills。",lee="流程运行时的可执行积木",cee="Nodes 决定画布上能拖什么、节点有哪些输入输出,以及运行时走 agent、control、provide 或 marketplace 哪类逻辑。",uee="已发布的本地节点包",dee="这里仅显示你发布到当前 Workspace Marketplace 的节点版本;可查看详情并删除未被 Flow 使用的版本。",fee="已发布的流程片段",pee="这里显示从 Pipeline 或 Workspace 画布发布的流程片段,可搜索、检查内容,并从画布的流程面板中加载复用。",hee="Composer/Agent 的操作指南",mee="Skills 告诉 AI 在特定任务里应遵守什么规则、如何修改 flow、如何复用项目约定。",gee="暂无归档项目。",yee="暂无未归档流水线;已归档项在 Archived 标签中查看。",xee="暂无可用全局 nodes。",wee="暂无已发布的 marketplace nodes。",bee="暂无已发布的流程片段。可在画布中选中多个节点后发布。",vee="暂无可用 skills。",kee="暂无描述。",See="未找到与「{{query}}」匹配的 node。",Nee="未找到与「{{query}}」匹配的流程片段。",jee="未找到与「{{query}}」匹配的 skill。",Cee="{{inputs}} in / {{outputs}} out",Eee="流程片段",_ee="{{nodes}} 节点 / {{edges}} 连线",Pee="Skill",Aee="Node 详情",Iee="流程片段详情",Tee="Skill 详情",Ree="类型",Lee="来源",Oee="包",Mee="版本",$ee="路径",Dee="可编辑",Fee="只读",zee="可编辑",Bee="Schema",Hee="输入",Wee="输出",Vee="Runtime",Uee="节点内容",Kee="Files",qee="Usage",Yee="暂无 runtime manifest。",Gee="暂无节点正文或 README。",Xee="暂无可预览文件。",Jee="请选择文件查看内容。",Qee="二进制文件暂不支持预览。",Zee="文件较大,仅显示前 256KB。",ete="暂未发现使用此 node 的流水线。",tte="节点管理",nte="删除节点版本",rte="删除中…",ste="删除前会检查所有 Flow 引用;仍被安装或使用的版本不会被删除。",ite="确定删除 {{id}}@{{version}}?此操作不可撤销。",ote="已删除 {{id}}@{{version}}。",ate="仍有 {{count}} 个 Flow 使用它。",lte="流程片段管理",cte="删除流程片段",ute="删除中…",dte="删除后不会影响已经加载到画布里的节点,只会移除 Marketplace 中这个可复用片段。",fte="确定删除 {{id}}@{{version}}?此操作不可撤销。",pte="已删除 {{id}}@{{version}}。",hte="无槽位",mte="作用",gte="这个 node 是 pipeline 的执行单元。它的 schema 会影响画布连线、参数输入和运行时调度。",yte="流程片段是固定化流程的一部分。加载时会复制这组节点、连线和布局到当前画布,不覆盖已有内容。",xte="规模",wte="流程预览",bte="连线",vte="片段 JSON",kte="还有 {{count}} 条连线",Ste="暂无可预览节点。",Nte="这个 skill 会作为 Composer 的上下文注入给 AI,用于约束 AI 的判断、修改方式和输出口径。",jte="SKILL.md 预览",Cte="暂无可预览内容。",Ete="请选择一个资源查看详情。",_te="未能加载流水线列表。",Pte="当前工作区暂无流水线。",Ate="在仓库根目录执行 {{code1}} 并确认工作区包含 {{code2}} 或用户目录下的流水线;亦可点击 New Pipeline 新建。",Ite="未找到与「{{query}}」匹配的流水线。可尝试其他关键词,或点击清除搜索。",Tte="最近打开或最近运行",Rte="暂无打开或运行记录",Lte="暂无与关键词匹配的最近记录",Ote="最近运行",Mte="最近打开",$te={builtin:"内置",workspace:"工作区",user:"用户"},Dte={flow:"Flow",global:"Global",marketplace:"Marketplace"},Fte={all:"全部",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},zte={overview:"概览",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},Bte="打开以在节点画布中编辑此流水线。",Hte={eyebrow:"AgentFlow Hub",title:"浏览社区流程",desc:"发现并一键安装社区分享的现成流水线。",cta:"前往 Hub",cliHint:"或通过 CLI 安装:agentflow download <slug>"},Wte={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:"关闭"},Vte={title:"导入流水线",lead:"已选择文件「{{filename}}」。请确认流水线名称与保存位置;ZIP 将保留目录内脚本等文件。",nameLabel:"名称(必填)",namePlaceholder:"例如 my_shared_flow",nameHint:"须以英文字母开头,仅可使用字母、数字、下划线 _ 与连字符 -",locationLabel:"保存位置",userDir:"用户目录(~/agentflow/pipelines)",workspaceDir:"当前工作区(.workspace/agentflow/pipelines)",changeFile:"更换文件…",importFailed:"导入失败",importing:"导入中…",importAndOpen:"导入并打开",cancel:"取消",close:"关闭"},Ute={title:"删除流水线",lead:"将永久删除磁盘上的流水线目录(含 flow.yaml、脚本等),无法撤销。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",deleteFailed:"删除失败",deleteTimeout:"删除请求超时,请重试(可先检查终端中的 UI 服务日志)",delete:"删除",deleting:"删除中…",confirmDelete:"确认删除",cancel:"取消",close:"关闭"},Kte={title:"归档流水线",lead:"归档后流水线将移入「Archived」列表,仍可从该列表打开与编辑。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",archiveFailed:"归档失败",archive:"归档",archiving:"归档中…",confirmArchive:"确认归档",cancel:"取消",close:"关闭"},qte={title:OZ,all:MZ,archived:$Z,nodes:DZ,myNodes:FZ,myFlows:zZ,skills:BZ,activeProjects:HZ,archivedPipelines:WZ,globalNodes:VZ,myNodesHint:UZ,myFlowsHint:KZ,globalSkills:qZ,createNew:YZ,newPipeline:GZ,searchPipelines:XZ,searchNodes:JZ,searchFlows:QZ,searchSkills:ZZ,refreshResources:eee,loadingPipelines:tee,loadingResources:nee,filterResult:ree,archivedHint:see,activeHint:iee,nodesHint:oee,skillsHint:aee,nodesPurposeTitle:lee,nodesPurposeDesc:cee,myNodesPurposeTitle:uee,myNodesPurposeDesc:dee,myFlowsPurposeTitle:fee,myFlowsPurposeDesc:pee,skillsPurposeTitle:hee,skillsPurposeDesc:mee,noArchived:gee,noActive:yee,noNodes:xee,noMyNodes:wee,noMyFlows:bee,noSkills:vee,noDescription:kee,noNodeMatch:See,noFlowSnippetMatch:Nee,noSkillMatch:jee,nodeSlots:Cee,flowSnippet:Eee,flowSnippetNodes:_ee,skill:Pee,nodeDetail:Aee,flowDetail:Iee,skillDetail:Tee,detailType:Ree,detailSource:Lee,detailPackage:Oee,detailVersion:Mee,detailPath:$ee,detailEditable:Dee,readOnly:Fee,editable:zee,nodeSchema:Bee,nodeInputs:Hee,nodeOutputs:Wee,nodeRuntime:Vee,nodeBody:Uee,nodeFiles:Kee,nodeUsage:qee,noRuntimeManifest:Yee,noNodeBody:Gee,noNodeFiles:Xee,selectNodeFile:Jee,binaryFile:Qee,fileTruncated:Zee,noNodeUsage:ete,myNodeManagement:tte,deleteMyNode:nte,deletingMyNode:rte,deleteMyNodeHint:ste,deleteMyNodeConfirm:ite,deleteMyNodeSuccess:ote,deleteMyNodeUsedBy:ate,myFlowManagement:lte,deleteMyFlow:cte,deletingMyFlow:ute,deleteMyFlowHint:dte,deleteMyFlowConfirm:fte,deleteMyFlowSuccess:pte,noSlots:hte,resourceMeaning:mte,nodesMeaning:gte,myFlowsMeaning:yte,flowSnippetScale:xte,flowSnippetPreview:wte,flowSnippetEdges:bte,flowSnippetJson:vte,flowSnippetMoreEdges:kte,noFlowSnippetPreview:Ste,skillsMeaning:Nte,skillPreview:jte,skillPreviewEmpty:Cte,selectResource:Ete,loadFailed:_te,noPipelines:Pte,emptyHint:Ate,noMatch:Ite,recentActivity:Tte,noRecentActivity:Rte,noMatchRecent:Lte,recentRun:Ote,recentOpen:Mte,sourceBadge:$te,resourceSource:Dte,resourceFilter:Fte,nodeDetailTabs:zte,defaultCardDesc:Bte,hubCard:Hte,newPipelineModal:Wte,importModal:Vte,deleteModal:Ute,archiveModal:Kte},Yte="返回",Gte="下一步",Xte="跳过",Jte="完成",Qte="开始创建",Zte={intro:`欢迎使用 AgentFlow!这是一个可视化流程编排工具。
|
|
192
|
-
|
|
193
|
-
点击下方按钮开始创建你的第一个流水线。`,hubIntro:`不想从零开始?
|
|
194
|
-
|
|
195
|
-
在 AgentFlow Hub 浏览社区分享的现成流水线,一键安装即可运行。`},ene={intro:`现在进入流程编辑器。
|
|
196
|
-
|
|
197
|
-
在下方输入框用自然语言描述你的需求,AI 会自动生成流程图。
|
|
198
|
-
|
|
199
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`,introEmpty:`画布为空,开始创建你的流程吧!
|
|
200
|
-
|
|
201
|
-
在下方输入框用自然语言描述需求,AI 会自动生成流程图。
|
|
202
|
-
|
|
203
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`},tne={guideTitle:"首次创建提示",guideDesc:"输入名称和描述后,AI 会自动生成流程图。你可以在编辑器中自由调整节点和连接。",nameHintGuide:"例如:MyFirstFlow(字母开头,支持数字和下划线)",descPlaceholderGuide:"例如:实现用户登录功能,包含注册、验证、授权",descHintGuide:"描述越详细,AI 生成的流程越准确",createGuide:"创建并开始编辑",typeNode:"节点引用类型",typeStr:"字符串类型",typeFile:"文件路径类型",typeBool:"布尔值类型"},nne={back:Yte,next:Gte,skip:Xte,done:Jte,startCreate:Qte,projects:Zte,flow:ene,newPipeline:tne},rne={en:{common:XY,flow:OG,settings:qG,composer:eX,project:pQ,onboarding:kQ},zh:{common:AQ,flow:mZ,settings:EZ,composer:LZ,project:qte,onboarding:nne}};zr.use(a2).use(oM).init({resources:rne,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 sne=[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"en",name:"English",flag:"🇬🇧"}];function ine(e){return zr.changeLanguage(e)}const vb="agentflow-settings-opencode-plan-v1";function Sx(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 l2(){return`e_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function one(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function Hl(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()||l2(),c=String(r.scope??t).trim()==="global"?"global":"user";!s&&!i||n.push({id:a,key:s,value:i,scope:c})}return n}function C1(e){return Hl(e).map(({key:t,value:n})=>({key:t,value:n}))}function E1(){try{return localStorage.getItem(vb)??""}catch{return""}}function ane(e){return e?e.length<=6?"•".repeat(e.length):`${"•".repeat(Math.min(20,e.length-4))}${e.slice(-4)}`:""}function _1(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 lne({authUser:e}){const{t,i18n:n}=kn(["common","settings"]),r=n.language||"zh",[s,i]=h.useState(""),[a,l]=h.useState(""),[c,d]=h.useState({cursor:[],opencode:[],claudeCode:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null}),[f,u]=h.useState(""),[p,m]=h.useState(!1),[g,b]=h.useState(!1),[v,y]=h.useState(""),[k,w]=h.useState([]),[j,A]=h.useState(""),[C,$]=h.useState(!1),[B,F]=h.useState(""),[z,L]=h.useState(""),[O,W]=h.useState(!1),[M,T]=h.useState(()=>new Set),[E,D]=h.useState(""),[_,R]=h.useState([]),[P,G]=h.useState(!1),[Z,V]=h.useState(""),[se,ue]=h.useState([]),[pe,ge]=h.useState([]),[ae,be]=h.useState(""),[Pe,we]=h.useState(""),[_e,Ie]=h.useState(!1),[st,ct]=h.useState(!1),[et,Et]=h.useState(""),Ue=h.useRef(null),St=h.useRef(!1),tn=h.useRef(!1),gn=h.useRef(""),Tn=h.useCallback(async()=>{l("");try{const re=await fetch("/api/ui-context");if(!re.ok)throw new Error("HTTP "+re.status);const Ce=await re.json();i(typeof Ce.workspaceRoot=="string"?Ce.workspaceRoot:"")}catch(re){l(String(re.message||re)),i("")}},[]),zt=h.useCallback(async()=>{u(""),m(!0);try{const re=await fetch("/api/model-lists");if(!re.ok)throw new Error("HTTP "+re.status);const Ce=await re.json();d(Sx(Ce))}catch(re){u(String(re.message||re))}finally{m(!1)}},[]),Rn=h.useCallback(async()=>{A("");try{const re=await fetch("/api/user-env"),Ce=await re.json().catch(()=>({}));if(!re.ok)throw new Error(typeof Ce.error=="string"?Ce.error:"HTTP "+re.status);const Ge=Hl(Array.isArray(Ce.env)?Ce.env:[],"user").map(jn=>({...jn,scope:"user"})),Ke=[...e!=null&&e.isAdmin?Hl(Array.isArray(Ce.globalEnv)?Ce.globalEnv:[],"global").map(jn=>({...jn,scope:"global"})):[],...Ge];gn.current=JSON.stringify(Ke),w(Ke)}catch(re){w([]),A(String(re.message||re))}finally{tn.current=!0}},[e==null?void 0:e.isAdmin]),Bn=h.useCallback(async()=>{if(e!=null&&e.isAdmin){G(!0),V("");try{const re=await fetch("/api/feedback"),Ce=await re.json().catch(()=>({}));if(!re.ok)throw new Error(typeof Ce.error=="string"?Ce.error:"HTTP "+re.status);R(Array.isArray(Ce.feedback)?Ce.feedback:[])}catch(re){V(String(re.message||re))}finally{G(!1)}}},[e==null?void 0:e.isAdmin]),le=h.useCallback(async()=>{if(e!=null&&e.isAdmin){Ie(!0),Et("");try{const re=await fetch("/api/admin/user-allowlist"),Ce=await re.json().catch(()=>({}));if(!re.ok)throw new Error(typeof Ce.error=="string"?Ce.error:"HTTP "+re.status);const Ge=Ce.allowlist&&typeof Ce.allowlist=="object"?Ce.allowlist:{};ue(Array.isArray(Ge.fileUsers)?Ge.fileUsers.map(String):[]),ge(Array.isArray(Ge.envUsers)?Ge.envUsers.map(String):[]),be(typeof Ge.path=="string"?Ge.path:"")}catch(re){Et(String(re.message||re))}finally{Ie(!1)}}},[e==null?void 0:e.isAdmin]),fe=h.useCallback(async re=>{if(e!=null&&e.isAdmin){ct(!0),Et("");try{const Ce=await fetch("/api/admin/user-allowlist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({users:re})}),Ge=await Ce.json().catch(()=>({}));if(!Ce.ok)throw new Error(typeof Ge.error=="string"?Ge.error:"HTTP "+Ce.status);const Ct=Ge.allowlist&&typeof Ge.allowlist=="object"?Ge.allowlist:{};ue(Array.isArray(Ct.fileUsers)?Ct.fileUsers.map(String):[]),ge(Array.isArray(Ct.envUsers)?Ct.envUsers.map(String):[]),be(typeof Ct.path=="string"?Ct.path:"")}catch(Ce){Et(String(Ce.message||Ce))}finally{ct(!1)}}},[e==null?void 0:e.isAdmin]),ze=h.useCallback(async re=>{const Ce=Hl(re),Ge=Ce.filter(Ke=>Ke.scope!=="global"),Ct=Ce.filter(Ke=>Ke.scope==="global");$(!0),A("");try{const Ke=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:C1(Ge),...e!=null&&e.isAdmin?{globalEnv:C1(Ct)}:{}})}),jn=await Ke.json().catch(()=>({}));if(!Ke.ok)throw new Error(typeof jn.error=="string"?jn.error:"HTTP "+Ke.status);const hi=Hl(Array.isArray(jn.env)?jn.env:[],"user").map(kr=>({...kr,scope:"user"})),vr=[...e!=null&&e.isAdmin?Hl(Array.isArray(jn.globalEnv)?jn.globalEnv:[],"global").map(kr=>({...kr,scope:"global"})):[],...hi];gn.current=JSON.stringify(vr),w(vr)}catch(Ke){A(String(Ke.message||Ke))}finally{$(!1)}},[e==null?void 0:e.isAdmin]),Ze=h.useCallback(async()=>{u(""),m(!0);try{const re=await fetch("/api/update-model-lists",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:E.trim()})}),Ce=await re.json().catch(()=>({}));if(!re.ok)throw new Error(typeof Ce.error=="string"?Ce.error:"HTTP "+re.status);d(Sx(Ce.modelLists))}catch(re){u(String(re.message||re))}finally{m(!1)}},[E]);h.useEffect(()=>{Tn(),zt(),Rn(),e!=null&&e.isAdmin&&(Bn(),le()),(async()=>{try{const re=await fetch("/api/agentflow-config");if(re.ok){const Ce=await re.json(),Ge=typeof Ce.opencodeProvider=="string"?Ce.opencodeProvider:"";D(Ge),Ue.current=Ge;try{localStorage.setItem(vb,Ge)}catch{}}else{const Ce=E1();D(Ce),Ue.current=Ce}}catch{const re=E1();D(re),Ue.current=re}finally{St.current=!0}})()},[e==null?void 0:e.isAdmin,Tn,Bn,zt,le,Rn]),h.useEffect(()=>{if(!tn.current||JSON.stringify(Hl(k))===gn.current)return;const Ce=setTimeout(()=>{ze(k)},350);return()=>clearTimeout(Ce)},[k,ze]),h.useEffect(()=>{if(!St.current)return;const re=E.trim();if(re===Ue.current)return;const Ce=setTimeout(()=>{(async()=>{b(!0),y("");try{const Ge=await fetch("/api/agentflow-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:re})}),Ct=await Ge.json().catch(()=>({}));if(!Ge.ok)throw new Error(typeof Ct.error=="string"?Ct.error:"HTTP "+Ge.status);Ue.current=re;try{localStorage.setItem(vb,re)}catch{}Ct.modelLists&&d(Sx(Ct.modelLists))}catch(Ge){y(String(Ge.message||Ge))}finally{b(!1)}})()},450);return()=>clearTimeout(Ce)},[E]);const ot=c.cursor.length>0,Jt=c.opencode.length>0,nn=c.claudeCode.length>0,Ln=h.useCallback(()=>{var re;s&&((re=navigator.clipboard)==null||re.writeText(s))},[s]),yn=h.useCallback(()=>{const re=B.trim(),Ce=z;if(re){if(!one(re)){A(t("settings:env.invalidKey"));return}w(Ge=>[...Ge,{id:l2(),key:re,value:Ce,scope:e!=null&&e.isAdmin&&O?"global":"user"}]),F(""),L("")}},[e==null?void 0:e.isAdmin,O,B,z,t]),ir=h.useCallback(re=>{w(Ce=>Ce.filter(Ge=>Ge.id!==re))},[]),rn=h.useCallback((re,Ce)=>{w(Ge=>Ge.map(Ct=>Ct.id===re?{...Ct,...Ce}:Ct))},[]),Sn=h.useCallback(re=>{T(Ce=>{const Ge=new Set(Ce);return Ge.has(re)?Ge.delete(re):Ge.add(re),Ge})},[]),Zt=h.useCallback(()=>{const re=Pe.trim();if(!re)return;if(!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(re)){Et("用户名须以字母开头,仅可使用字母、数字、下划线与连字符,最多 64 字符");return}if(new Set(se.map(Ge=>String(Ge||"").trim().toLowerCase())).has(re.toLowerCase())){we("");return}we(""),fe([...se,re])},[Pe,se,fe]),Nn=h.useCallback(re=>{const Ce=String(re||"").trim().toLowerCase();Ce&&fe(se.filter(Ge=>String(Ge||"").trim().toLowerCase()!==Ce))},[se,fe]),xe=h.useCallback(re=>{const Ce=re.target.value;ine(Ce)},[]),Re=re=>{const Ce=_1(re,r);return Ce?t("settings:cursor.modelList.fetchedAt",{time:Ce}):t("settings:cursor.modelList.never")},it=re=>_1(re,r)||String(re||"");return o.jsxs("div",{className:"af-settings-page",children:[o.jsx("header",{className:"af-settings-top",children:o.jsxs("div",{className:"af-settings-crumb","aria-label":t("settings:title"),children:[o.jsx("span",{className:"af-settings-crumb-muted",children:t("settings:crumb.engine")}),o.jsx("span",{className:"af-settings-crumb-sep","aria-hidden":!0,children:"/"}),o.jsx("span",{className:"af-settings-crumb-active",children:t("settings:crumb.preferences")})]})}),o.jsx("div",{className:"af-settings-body",children:o.jsxs("div",{className:"af-settings-inner",children:[o.jsxs("header",{className:"af-settings-hero",children:[o.jsxs("h1",{className:"af-settings-h1",children:[t("common:app.name")," ",t("settings:title")]}),o.jsx("p",{className:"af-settings-lead",children:t("settings:workspace.description")}),a?o.jsx("p",{className:"af-err af-settings-api-hint",children:a}):null,f?o.jsx("p",{className:"af-err af-settings-api-hint",children:f}):null,j?o.jsx("p",{className:"af-err af-settings-api-hint",children:j}):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:Ln,"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"+(ot?" af-set-badge--ok":" af-set-badge--muted"),children:t(ot?"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:ot?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(ot?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:ot?t("settings:cursor.modelList.count",{count:c.cursor.length})+" · "+Re(c.cursorFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),ot?o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:cursor.modelPreviewLabel"),children:c.cursor.join(`
|
|
204
|
-
`)}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Ze(),disabled:p,children:t(p?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),o.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:"OpenCode"}),o.jsx("span",{className:"af-set-badge"+(Jt?" af-set-badge--ok":" af-set-badge--err"),children:t(Jt?"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:E,onChange:re=>D(re.target.value),placeholder:t("settings:opencode.providerPlaceholder"),autoComplete:"off"}),g?o.jsx("p",{className:"af-set-hint af-set-hint--inline","aria-live":"polite",children:t("settings:opencode.saving")}):null,v?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",role:"alert",children:v}):null]}),Jt?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"af-set-cli-mono af-set-cli-mono--block",children:t("settings:cursor.modelList.count",{count:c.opencode.length})+" · "+Re(c.opencodeFetchedAt)}),o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:opencode.modelPreviewLabel"),children:c.opencode.join(`
|
|
205
|
-
`)})]}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Ze(),disabled:p,children:t(p?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),o.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:t("settings:claudeCode.title")}),o.jsx("span",{className:"af-set-badge"+(nn?" af-set-badge--ok":" af-set-badge--err"),children:t(nn?"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:nn?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(nn?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:nn?t("settings:cursor.modelList.count",{count:c.claudeCode.length})+" · "+Re(c.claudeCodeFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),o.jsx("p",{className:"af-set-p",children:t("settings:claudeCode.description")}),nn?o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:claudeCode.modelPreviewLabel"),children:c.claudeCode.join(`
|
|
206
|
-
`)}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Ze(),disabled:p,children:t(p?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low af-set-env",children:[o.jsxs("div",{className:"af-set-env-head",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("div",{className:"af-set-env-icon-wrap",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"variables"})}),o.jsx("h2",{className:"af-set-h2",children:t("settings:env.title")})]}),o.jsx("span",{className:"af-set-env-note",children: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",{})]}),k.map(re=>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:re.key,onChange:Ce=>rn(re.id,{key:Ce.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:re.scope!=="global"?"is-active":"",onClick:()=>rn(re.id,{scope:"user"}),children:t("settings:env.personal")}),o.jsx("button",{type:"button",className:re.scope==="global"?"is-active":"",onClick:()=>rn(re.id,{scope:"global"}),children:t("settings:env.global")})]})}):null,o.jsxs("div",{className:"af-set-env-cell af-set-env-cell--grow af-set-env-cell--value",children:[o.jsx("input",{className:"af-set-env-inline af-set-env-inline--value",type:M.has(re.id)?"text":"password",value:re.value,onChange:Ce=>rn(re.id,{value:Ce.target.value}),placeholder:ane(re.value)||t("settings:env.newValue"),"aria-label":t("settings:env.value")}),o.jsx("button",{type:"button",className:"af-set-env-value-toggle",onClick:()=>Sn(re.id),"aria-label":M.has(re.id)?"Hide value":"Show value",children:o.jsx("span",{className:"material-symbols-outlined",children:M.has(re.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:re.key}),onClick:()=>ir(re.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})})]},re.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:B,onChange:re=>F(re.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:O?"":"is-active",onClick:()=>W(!1),children:t("settings:env.personal")}),o.jsx("button",{type:"button",className:O?"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:z,onChange:re=>L(re.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:yn,disabled:!B.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:"用户白名单"}),o.jsx("p",{className:"af-set-card-subtitle",children:"只控制 username 是否允许注册或登录,密码由用户首次登录时自行设置。"})]})]}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void le(),disabled:_e,children:_e?"刷新中...":"刷新"})]}),et?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:et}):null,ae?o.jsxs("p",{className:"af-set-hint af-set-hint--inline",children:["文件:",o.jsx("code",{children:ae})]}):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:"文件白名单"}),o.jsx("span",{children:st?"保存中...":`${se.length} 个用户`})]}),o.jsx("div",{className:"af-allowlist-list",children:se.length>0?se.map(re=>o.jsxs("div",{className:"af-allowlist-row",children:[o.jsx("span",{className:"af-allowlist-name",children:re}),o.jsx("button",{type:"button",className:"af-set-env-del",onClick:()=>Nn(re),"aria-label":`删除 ${re}`,disabled:st,children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})]},re)):o.jsx("div",{className:"af-allowlist-empty",children:"未配置文件白名单;如果环境变量也为空,则所有用户可注册。"})}),o.jsxs("div",{className:"af-allowlist-add",children:[o.jsx("input",{className:"af-set-input af-set-input--sm af-set-input--mono",value:Pe,onChange:re=>we(re.target.value),onKeyDown:re=>{re.key==="Enter"&&Zt()},placeholder:"username",autoComplete:"off"}),o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:Zt,disabled:st||!Pe.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"添加"]})]})]}),o.jsxs("div",{className:"af-allowlist-side",children:[o.jsxs("div",{className:"af-allowlist-head",children:[o.jsx("span",{children:"环境变量白名单"}),o.jsx("span",{children:"只读"})]}),o.jsx("div",{className:"af-allowlist-env-list",children:pe.length>0?pe.map(re=>o.jsx("code",{children:re},re)):o.jsx("span",{children:"未配置 AGENTFLOW_USER_WHITELIST / AGENTFLOW_ALLOWED_USERS"})})]})]})]}):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 Bn(),disabled:P,children:P?"刷新中...":"刷新"})]}),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:_.length>0?_.map(re=>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:re.title||"未命名反馈"}),o.jsxs("p",{children:[o.jsx("span",{children:re.username||re.userId||"unknown"}),o.jsx("span",{children:it(re.createdAt)})]})]}),re.contact?o.jsx("span",{className:"af-feedback-item__contact",children:re.contact}):null]}),o.jsx("p",{className:"af-feedback-item__content",children:re.content}),re.pageUrl?o.jsx("code",{className:"af-feedback-item__url",children:re.pageUrl}):null]},re.id)):o.jsx("div",{className:"af-feedback-empty",children:P?"正在加载反馈...":"暂无反馈"})})]}):null]}),o.jsxs("aside",{className:"af-settings-rail","aria-label":t("settings:title"),children:[o.jsxs("div",{className:"af-set-rail-card af-set-rail-card--accent",children:[o.jsxs("div",{className:"af-set-rail-inner",children:[o.jsx("h3",{className:"af-set-rail-h3",children:t("settings:system.title")}),o.jsxs("div",{className:"af-set-health-line",children:[o.jsx("span",{className:"af-set-pulse-dot","aria-hidden":!0}),o.jsx("span",{className:"af-set-health-label",children:t(!a&&!f?"settings:system.normal":"settings:system.abnormal")})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.cursorModels")}),o.jsx("span",{children:c.cursor.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.cursor.length>0?12+c.cursor.length*3:4)}%`}})})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.opencodeModels")}),o.jsx("span",{children:c.opencode.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.opencode.length>0?12+c.opencode.length*3:4)}%`}})})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.claudeCodeModels")}),o.jsx("span",{children:c.claudeCode.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.claudeCode.length>0?12+c.claudeCode.length*3:4)}%`}})})]})]}),o.jsx("div",{className:"af-set-rail-watermark","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:"vital_signs"})})]}),o.jsxs("div",{className:"af-set-rail-card",children:[o.jsx("h3",{className:"af-set-rail-h3 af-set-rail-h3--sm",children:t("settings:language.title")}),o.jsxs("div",{className:"af-set-language-selector",children:[o.jsx("select",{className:"af-set-input af-set-input--sm",value:r,onChange:xe,"aria-label":t("settings:language.description"),children:sne.map(re=>o.jsxs("option",{value:re.code,children:[re.flag," ",re.name]},re.code))}),o.jsx("p",{className:"af-set-hint",children:t("settings:language.description")})]})]})]})]})]})})]})}function cne(){const{navigate:e}=No(),[t,n]=h.useState(""),[r,s]=h.useState(""),[i,a]=h.useState(!1),[l,c]=h.useState(""),[d,f]=h.useState(!1),u=async p=>{if(p.preventDefault(),!i){a(!0),c("");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})}),g=await m.json().catch(()=>({}));if(!m.ok)throw new Error(g.error||"提交失败");f(!0),n(""),s("")}catch(m){c(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:u,children:[o.jsxs("label",{className:"af-feedback-field",children:[o.jsx("span",{children:"标题"}),o.jsx("input",{value:t,onChange:p=>n(p.target.value),placeholder:"一句话说明问题或建议",maxLength:120,required:!0})]}),o.jsxs("label",{className:"af-feedback-field",children:[o.jsx("span",{children:"反馈内容"}),o.jsx("textarea",{value:r,onChange:p=>s(p.target.value),placeholder:"描述具体场景、期望表现、实际表现或复现步骤",maxLength:5e3,rows:9,required:!0})]}),l?o.jsx("p",{className:"af-err af-feedback-error",children:l}):null,o.jsx("div",{className:"af-feedback-actions",children:o.jsxs("button",{type:"submit",className:"af-feedback-submit",disabled:i||!t.trim()||!r.trim(),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:i?"hourglass_empty":"send"}),i?"提交中...":"提交反馈"]})})]})]})})}function c2(){return`m_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function P1(e,t=[]){const n=new Set((Array.isArray(t)?t:[]).map(String));return Object.entries(e&&typeof e=="object"?e:{}).map(([r,s])=>({id:c2(),key:r,value:String(s??""),private:n.has(r)}))}function A1(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 Jh(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(`
|
|
207
|
-
`),description:String((e==null?void 0:e.description)||t.description||""),envRows:P1(t.env||(e==null?void 0:e.env),e==null?void 0:e.privateEnvKeys),headerRows:P1(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 Nx(){return Jh({name:"",raw:{command:""}})}function une(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=A1(e.envRows),s=A1(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 I1(e){return e?e.ok?`${e.toolCount||0} tools enabled`:`Error - ${e.error||"Show Output"}`:"未检测"}function T1(e){return e?e.ok?"ok":"error":"unknown"}function R1({title:e,rows:t,onChange:n,placeholderKey:r="KEY",placeholderValue:s="value"}){const i=(a,l,c)=>n(t.map(d=>d.id===a?{...d,[l]:c}:d));return o.jsxs("div",{className:"af-mcp-field",children:[o.jsxs("div",{className:"af-mcp-field-head",children:[o.jsx("span",{children:e}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>n([...t,{id:c2(),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 dne(){var O;const[e,t]=h.useState(""),[n,r]=h.useState([]),[s,i]=h.useState(Nx),[a,l]=h.useState(""),[c,d]=h.useState(!1),[f,u]=h.useState(!1),[p,m]=h.useState(!1),[g,b]=h.useState({}),[v,y]=h.useState(""),[k,w]=h.useState(""),j=h.useMemo(()=>n.find(W=>W.name===a)||null,[a,n]),A=j&&g[j.name]||null,C=h.useCallback(async()=>{d(!0),y("");try{const W=await fetch("/api/mcps"),M=await W.json().catch(()=>({}));if(!W.ok)throw new Error(M.error||"MCP HTTP "+W.status);const T=Array.isArray(M.servers)?M.servers:[];t(String(M.path||"")),r(T),a&&T.some(E=>E.name===a)&&i(Jh(T.find(E=>E.name===a)))}catch(W){y(String(W.message||W))}finally{d(!1)}},[a]);h.useEffect(()=>{C()},[C]);const $=()=>{l(""),i(Nx()),w(""),y("")},B=W=>{l(W.name),i(Jh(W)),w(""),y("")},F=async(W="")=>{m(!0),y(""),w("");try{const M=await fetch("/api/mcps/check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(W?{name:W}:{})}),T=await M.json().catch(()=>({}));if(!M.ok)throw new Error(T.error||"检测 MCP 失败");const E=Array.isArray(T.results)?T.results:[];b(D=>{const _={...D};for(const R of E)R!=null&&R.name&&(_[R.name]=R);return _}),w(W?`已检测 ${W}。`:"已检测所有 MCP。")}catch(M){y(String(M.message||M))}finally{m(!1)}},z=async()=>{u(!0),y(""),w("");try{const W=une(s);if(!W.nextName)throw new Error("请填写 MCP 名称");const M=await fetch("/api/mcps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(W)}),T=await M.json().catch(()=>({}));if(!M.ok)throw new Error(T.error||"保存 MCP 失败");const E=Array.isArray(T.servers)?T.servers:[];r(E),t(String(T.path||e)),l(W.nextName),i(Jh(E.find(D=>D.name===W.nextName)||null)),b(D=>{const _={...D};return s.originalName&&s.originalName!==W.nextName&&delete _[s.originalName],delete _[W.nextName],_}),w("已保存。Cursor CLI 下次启动时会读取新配置。")}catch(W){y(String(W.message||W))}finally{u(!1)}},L=async W=>{if(W!=null&&W.name&&window.confirm(`删除 MCP "${W.name}"?`)){u(!0),y(""),w("");try{const M=await fetch("/api/mcps/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:W.name})}),T=await M.json().catch(()=>({}));if(!M.ok)throw new Error(T.error||"删除 MCP 失败");r(Array.isArray(T.servers)?T.servers:[]),l(""),i(Nx()),b(E=>{const D={...E};return delete D[W.name],D}),w("已删除。")}catch(M){y(String(M.message||M))}finally{u(!1)}}};return o.jsxs("main",{className:"af-settings-page",children:[o.jsxs("header",{className:"af-settings-top",children:[o.jsxs("div",{className:"af-settings-crumb",children:[o.jsx("span",{className:"af-settings-crumb-muted",children:"AgentFlow"}),o.jsx("span",{className:"af-settings-crumb-sep",children:"/"}),o.jsx("span",{className:"af-settings-crumb-active",children:"MCP"})]}),o.jsxs("div",{className:"af-settings-top-right",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:C,disabled:c||f,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>F(),disabled:p||c||f||n.length===0,children:p?"检测中...":"检测状态"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:$,disabled:f,children:"新增 MCP"})]})]}),o.jsx("div",{className:"af-settings-body",children:o.jsxs("div",{className:"af-settings-inner",children:[o.jsxs("section",{className:"af-settings-hero",children:[o.jsx("h1",{className:"af-settings-h1",children:"MCP 管理"}),o.jsxs("p",{className:"af-settings-lead",children:["新增、编辑和删除 Cursor MCP server。当前配置文件:",o.jsx("span",{className:"af-settings-code",children:e||"~/.cursor/mcp.json"})]})]}),o.jsxs("div",{className:"af-mcp-layout",children:[o.jsxs("section",{className:"af-set-card af-mcp-list-card",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2",children:"Servers"}),o.jsxs("div",{className:"af-mcp-list-head-actions",children:[o.jsx("span",{className:"af-set-badge af-set-badge--muted",children:n.length}),o.jsxs("button",{type:"button",className:"af-set-btn-mini",onClick:$,disabled:f,children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新增"]})]})]}),c?o.jsx("p",{className:"af-set-p",children:"加载中..."}):null,n.length===0&&!c?o.jsxs("div",{className:"af-mcp-empty",children:[o.jsx("p",{className:"af-set-p",children:"暂无 MCP server。"}),o.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:$,disabled:f,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:()=>B(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--${T1(g[W.name])}`,children:I1(g[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:j?"编辑 MCP":"新增 MCP"}),o.jsx("p",{className:"af-set-p af-set-p--tight",children:"保存后会写入 Cursor MCP 配置。已运行的 agent 进程不会热更新,下一次启动会读取新配置。"})]}),j?o.jsxs("div",{className:"af-mcp-editor-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>F(j.name),disabled:p||f,children:p?"检测中...":"检测"}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>L(j),disabled:f,children:"删除"})]}):null]}),v?o.jsx("p",{className:"af-mcp-error",children:v}):null,k?o.jsx("p",{className:"af-mcp-status",children:k}):null,A?o.jsxs("div",{className:`af-mcp-check af-mcp-check--${T1(A)}`,children:[o.jsxs("div",{className:"af-mcp-check-head",children:[o.jsx("strong",{children:I1(A)}),o.jsxs("span",{children:[A.elapsedMs||0,"ms"]})]}),A.error?o.jsx("p",{children:A.error}):null,(O=A.tools)!=null&&O.length?o.jsx("div",{className:"af-mcp-tools-list",children:A.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(M=>({...M,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(M=>({...M,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(M=>({...M,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(M=>({...M,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(M=>({...M,argsText:W.target.value})),placeholder:`mcp-server-example
|
|
208
|
-
--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(M=>({...M,description:W.target.value})),placeholder:"这个 MCP 提供什么能力"})]}),o.jsx(R1,{title:"Headers",rows:s.headerRows,onChange:W=>i(M=>({...M,headerRows:W})),placeholderKey:"Authorization",placeholderValue:"Bearer ..."}),o.jsx(R1,{title:"Env",rows:s.envRows,onChange:W=>i(M=>({...M,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(M=>({...M,extraJson:W.target.value}))})]})]}),o.jsxs("div",{className:"af-mcp-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:$,disabled:f,children:"清空"}),o.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:z,disabled:f,children:f?"保存中...":"保存 MCP"})]})]})]})]})})]})}function u2(e){return t=>typeof t===e}var fne=u2("function"),pne=e=>e===null,L1=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",O1=e=>!hne(e)&&!pne(e)&&(fne(e)||typeof e=="object"),hne=u2("undefined");function mne(e,t,n){return kne(n,e,t)?!0:(Sne(n,e,t),e.constructor!==t.constructor?!1:Array.isArray(e)&&Array.isArray(t)?gne(e,t,n):e instanceof Map&&t instanceof Map?wne(e,t,n):e instanceof Set&&t instanceof Set?vne(e,t):e instanceof WeakMap||e instanceof WeakSet?!1:ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)?yne(e,t):L1(e)&&L1(t)?e.source===t.source&&e.flags===t.flags:e instanceof Error&&t instanceof Error?xne(e,t,n):e.valueOf!==Object.prototype.valueOf?e.valueOf()===t.valueOf():e.toString!==Object.prototype.toString?e.toString()===t.toString():bne(e,t,n))}function cp(e,t,n){return e===t||Number.isNaN(e)&&Number.isNaN(t)?!0:!e||!O1(e)||!t||!O1(t)?!1:mne(e,t,n)}function gne(e,t,n){const{length:r}=e;if(r!==t.length)return!1;for(let s=r;s--!==0;)if(!cp(e[s],t[s],n))return!1;return!0}function yne(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 xne(e,t,n){return e.message===t.message&&e.name===t.name&&cp(e.cause,t.cause,n)}function wne(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(!cp(r[1],t.get(r[0]),n))return!1;return!0}function bne(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)&&!cp(e[i],t[i],n))return!1}return!0}function vne(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 kne(e,t,n){var r;return((r=e.get(t))==null?void 0:r.has(n))??!1}function Sne(e,t,n){let r=e.get(t);r||(r=new WeakSet,e.set(t,r)),r.add(n)}function h0(e,t){return cp(e,t,new WeakMap)}function jx(){var e;return!!(typeof window<"u"&&((e=window==null?void 0:window.document)!=null&&e.createElement))}function Nne(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}function jne(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function Cne(){const e=h.useRef(!0);return e.current?(e.current=!1,!0):e.current}function Ene(e,t){const n=Cne();h.useEffect(()=>{if(!n)return e()},t)}function d2(e){const t=h.useRef(void 0);return h.useEffect(()=>{t.current=e}),t.current}function _ne(e,t){const n=h.useRef(t);return h0(t,n.current)||(n.current=t),h.useMemo(e,n.current)}function Pne(e){h.useEffect(()=>{e()},[])}function Ane(e=0){const[t,n]=h.useState({height:jx()?window.innerHeight:0,width:jx()?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(!jx())return()=>{};const i=s.current;return n({height:window.innerHeight,width:window.innerWidth}),jne(window,"resize",i),()=>{Nne(window,"resize",i)}},[]),t}var Ine=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","URL","WeakMap","WeakSet"],Tne=["bigint","boolean","null","number","string","symbol","undefined"];function up(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(Rne(t))return t}function qi(e){return t=>up(t)===e}function Rne(e){return Ine.includes(e)}function qu(e){return t=>typeof t===e}function Lne(e){return Tne.includes(e)}var One=["innerHTML","ownerDocument","style","attributes","nodeValue"],dp=e=>Array.isArray(e),Mne=e=>up(e)==="AsyncGeneratorFunction",$ne=qi("AsyncFunction"),Dne=qu("bigint"),Fne=e=>e===!0||e===!1,zne=qi("Date"),Bne=qi("Error"),al=qu("function"),Hne=qi("GeneratorFunction"),Wne=e=>typeof e=="number"&&Number.isInteger(e),kb=qi("Map"),f2=e=>Number.isNaN(e),m0=e=>e===null,p2=qi("Function"),Vne=qi("Promise"),Une=qi("RegExp"),Sb=qi("Set"),fp=qu("string"),Kne=qu("symbol"),g0=qu("undefined"),qne=qi("WeakMap"),Yne=qi("WeakSet"),y0=e=>m0(e)||g0(e),h2=e=>!g0(e),Gne=e=>qu("number")(e)&&!f2(e),Xne=e=>fp(e)&&e.trim().length>0,Jne=e=>{if(!fp(e)||e.length===0)return!1;const t=e.trim();return t.length>0&&Number.isFinite(Number(t))},Vg=e=>!y0(e)&&(al(e)||typeof e=="object"),m2=e=>{if(up(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})},Qne=e=>m0(e)||Lne(typeof e),Zne=e=>up(e)==="URL",g2=e=>!y0(e)&&al(e[Symbol.iterator]),ere=e=>g2(e)&&al(e.next)&&al(e.throw),tre=e=>al(e)&&/^class\s/.test(e.toString()),nre=(e,t)=>!dp(e)||!al(t)?!1:e.every(n=>t(n)),rre=e=>Vg(e)&&!m2(e)&&e.nodeType===1&&fp(e.nodeName)&&One.every(t=>t in e),sre=e=>fp(e)&&e.length===0||dp(e)&&e.length===0||Vg(e)&&!kb(e)&&!Sb(e)&&Object.keys(e).length===0||Sb(e)&&e.size===0||kb(e)&&e.size===0,ire=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype,ore=(e,t)=>dp(e)?e.indexOf(t)>-1:!1,are=(e,t,n)=>{if(!Vg(e)||!t)return!1;const r=e[t];return al(n)?n(r):h2(r)};function At(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(dp(e))return"Array";if(p2(e))return"Function";const t=up(e);return t||"Object"}At.array=dp;At.arrayOf=nre;At.asyncGeneratorFunction=Mne;At.asyncFunction=$ne;At.bigint=Dne;At.boolean=Fne;At.class=tre;At.date=zne;At.defined=h2;At.domElement=rre;At.empty=sre;At.error=Bne;At.function=al;At.generator=ere;At.generatorFunction=Hne;At.instanceOf=ire;At.integer=Wne;At.iterable=g2;At.map=kb;At.nan=f2;At.null=m0;At.nullOrUndefined=y0;At.nonEmptyString=Xne;At.number=Gne;At.numericString=Jne;At.object=Vg;At.oneOf=ore;At.plainFunction=p2;At.plainObject=m2;At.primitive=Qne;At.promise=Vne;At.propertyOf=are;At.regexp=Une;At.set=Sb;At.string=fp;At.symbol=Kne;At.undefined=g0;At.url=Zne;At.weakMap=qne;At.weakSet=Yne;var Gr=At;/* v8 ignore next -- @preserve */var lre=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},cre=function(e,t){return e+Vf(t)},Vf=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(cre,""):lre(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?Vf(e.props.children):""};Vf.default=Vf;var ure=Vf;const Cx=cl(ure);var y2={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(A){return A!=="constructor"&&A!=="prototype"&&A!=="__proto__"}function a(A){let C=0;const $=A.length,B=new Array($);for(C;C<$;++C)B[C]=y(A[C]);return B}function l(A){const C={};if(p&&Object.getPrototypeOf(A)!==t)return p(A);const $=u(A);let B,F,z;for(B=0,F=$.length;B<F;++B)i(z=$[B])&&(C[z]=y(A[z]));return C}function c(A,C){const $=A.length,B=C.length;let F=0;const z=new Array($+B);for(F;F<$;++F)z[F]=y(A[F]);for(F=0;F<B;++F)z[F+$]=y(C[F]);return z}const d=Object.prototype.propertyIsEnumerable;function f(A){const C=Object.keys(A),$=Object.getOwnPropertySymbols(A);for(let B=0,F=$.length;B<F;++B)d.call(A,$[B])&&C.push($[B]);return C}const u=s!=null&&s.symbols?f:Object.keys,p=typeof(s==null?void 0:s.cloneProtoObject)=="function"?s.cloneProtoObject:void 0,m=typeof(s==null?void 0:s.isMergeableObject)=="function"?s.isMergeableObject:n(),g=(s==null?void 0:s.onlyDefinedProperties)===!0;function b(A){return typeof A!="object"||A===null}const v=s&&typeof s.mergeArray=="function"?s.mergeArray({clone:y,deepmerge:w,getKeys:u,isMergeableObject:m}):c;function y(A){return m(A)?Array.isArray(A)?a(A):l(A):A}function k(A,C){const $={},B=u(A),F=u(C);let z,L,O;for(z=0,L=B.length;z<L;++z)i(O=B[z])&&F.indexOf(O)===-1&&($[O]=y(A[O]));for(z=0,L=F.length;z<L;++z)if(i(O=F[z]))if(O in A)B.indexOf(O)!==-1&&(p&&m(C[O])&&Object.getPrototypeOf(C[O])!==t?$[O]=p(C[O]):$[O]=w(A[O],C[O]));else{if(g&&typeof C[O]>"u")continue;$[O]=y(C[O])}return $}function w(A,C){if(g&&typeof C>"u")return y(A);const $=Array.isArray(C),B=Array.isArray(A);return b(C)?C:m(A)?$&&B?v(A,C):$!==B?y(C):k(A,C):y(C)}function j(){switch(arguments.length){case 0:return{};case 1:return y(arguments[0]);case 2:return w(arguments[0],arguments[1])}let A;for(let C=0,$=arguments.length;C<$;++C)A=w(A,arguments[C]);return A}return s!=null&&s.all?j:w}e.exports=r,e.exports.default=r,e.exports.deepmerge=r,Object.defineProperty(e.exports,"isMergeableObject",{get:n})})(y2);var dre=y2.exports;const fre=cl(dre);var pre=new Error("Element already at target scroll position"),hre=new Error("Scroll cancelled"),mre=Math.min,M1=Date.now,gre={left:$1("scrollLeft"),top:$1("scrollTop")};function $1(e){return function(n,r,s,i){s=s||{},typeof s=="function"&&(i=s,s={}),typeof i!="function"&&(i=xre);var a=M1(),l=n[e],c=s.ease||yre,d=isNaN(s.duration)?350:+s.duration,f=!1;return l===r?i(pre,n[e]):requestAnimationFrame(p),u;function u(){f=!0}function p(m){if(f)return i(hre,n[e]);var g=M1(),b=mre(1,(g-a)/d),v=c(b);n[e]=v*(r-l)+l,b<1?requestAnimationFrame(p):requestAnimationFrame(function(){i(null,n[e])})}}}function yre(e){return .5*(1-Math.cos(Math.PI*e))}function xre(){}const wre=cl(gre);var x2={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(af,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})})(x2);var bre=x2.exports;const w2=cl(bre),vre=["top","right","bottom","left"],D1=["start","end"],F1=vre.reduce((e,t)=>e.concat(t,t+"-"+D1[0],t+"-"+D1[1]),[]),Du=Math.min,ec=Math.max,ng=Math.round,Ch=Math.floor,bo=e=>({x:e,y:e}),kre={left:"right",right:"left",bottom:"top",top:"bottom"};function Nb(e,t,n){return ec(e,Du(t,n))}function Yu(e,t){return typeof e=="function"?e(t):e}function ia(e){return e.split("-")[0]}function vo(e){return e.split("-")[1]}function b2(e){return e==="x"?"y":"x"}function x0(e){return e==="y"?"height":"width"}function Wa(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function w0(e){return b2(Wa(e))}function v2(e,t,n){n===void 0&&(n=!1);const r=vo(e),s=w0(e),i=x0(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=sg(a)),[a,sg(a)]}function Sre(e){const t=sg(e);return[rg(e),t,rg(t)]}function rg(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const z1=["left","right"],B1=["right","left"],Nre=["top","bottom"],jre=["bottom","top"];function Cre(e,t,n){switch(e){case"top":case"bottom":return n?t?B1:z1:t?z1:B1;case"left":case"right":return t?Nre:jre;default:return[]}}function Ere(e,t,n,r){const s=vo(e);let i=Cre(ia(e),n==="start",r);return s&&(i=i.map(a=>a+"-"+s),t&&(i=i.concat(i.map(rg)))),i}function sg(e){const t=ia(e);return kre[t]+e.slice(t.length)}function _re(e){return{top:0,right:0,bottom:0,left:0,...e}}function k2(e){return typeof e!="number"?_re(e):{top:e,right:e,bottom:e,left:e}}function ig(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 H1(e,t,n){let{reference:r,floating:s}=e;const i=Wa(t),a=w0(t),l=x0(a),c=ia(t),d=i==="y",f=r.x+r.width/2-s.width/2,u=r.y+r.height/2-s.height/2,p=r[l]/2-s[l]/2;let m;switch(c){case"top":m={x:f,y:r.y-s.height};break;case"bottom":m={x:f,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:u};break;case"left":m={x:r.x-s.width,y:u};break;default:m={x:r.x,y:r.y}}switch(vo(t)){case"start":m[a]-=p*(n&&d?-1:1);break;case"end":m[a]+=p*(n&&d?-1:1);break}return m}async function Pre(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:a,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:p=!1,padding:m=0}=Yu(t,e),g=k2(m),v=l[p?u==="floating"?"reference":"floating":u],y=ig(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:d,rootBoundary:f,strategy:c})),k=u==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),j=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},A=ig(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:k,offsetParent:w,strategy:c}):k);return{top:(y.top-A.top+g.top)/j.y,bottom:(A.bottom-y.bottom+g.bottom)/j.y,left:(y.left-A.left+g.left)/j.x,right:(A.right-y.right+g.right)/j.x}}const Are=50,Ire=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:Pre},c=await(a.isRTL==null?void 0:a.isRTL(t));let d=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:f,y:u}=H1(d,r,c),p=r,m=0;const g={};for(let b=0;b<i.length;b++){const v=i[b];if(!v)continue;const{name:y,fn:k}=v,{x:w,y:j,data:A,reset:C}=await k({x:f,y:u,initialPlacement:r,placement:p,strategy:s,middlewareData:g,rects:d,platform:l,elements:{reference:e,floating:t}});f=w??f,u=j??u,g[y]={...g[y],...A},C&&m<Are&&(m++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(d=C.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):C.rects),{x:f,y:u}=H1(d,p,c)),b=-1)}return{x:f,y:u,placement:p,strategy:s,middlewareData:g}},Tre=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:a,elements:l,middlewareData:c}=t,{element:d,padding:f=0}=Yu(e,t)||{};if(d==null)return{};const u=k2(f),p={x:n,y:r},m=w0(s),g=x0(m),b=await a.getDimensions(d),v=m==="y",y=v?"top":"left",k=v?"bottom":"right",w=v?"clientHeight":"clientWidth",j=i.reference[g]+i.reference[m]-p[m]-i.floating[g],A=p[m]-i.reference[m],C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let $=C?C[w]:0;(!$||!await(a.isElement==null?void 0:a.isElement(C)))&&($=l.floating[w]||i.floating[g]);const B=j/2-A/2,F=$/2-b[g]/2-1,z=Du(u[y],F),L=Du(u[k],F),O=z,W=$-b[g]-L,M=$/2-b[g]/2+B,T=Nb(O,M,W),E=!c.arrow&&vo(s)!=null&&M!==T&&i.reference[g]/2-(M<O?z:L)-b[g]/2<0,D=E?M<O?M-O:M-W:0;return{[m]:p[m]+D,data:{[m]:T,centerOffset:M-T-D,...E&&{alignmentOffset:D}},reset:E}}});function Rre(e,t,n){return(e?[...n.filter(s=>vo(s)===e),...n.filter(s=>vo(s)!==e)]:n.filter(s=>ia(s)===s)).filter(s=>e?vo(s)===e||(t?rg(s)!==s:!1):!0)}const Lre=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,s;const{rects:i,middlewareData:a,placement:l,platform:c,elements:d}=t,{crossAxis:f=!1,alignment:u,allowedPlacements:p=F1,autoAlignment:m=!0,...g}=Yu(e,t),b=u!==void 0||p===F1?Rre(u||null,m,p):p,v=await c.detectOverflow(t,g),y=((n=a.autoPlacement)==null?void 0:n.index)||0,k=b[y];if(k==null)return{};const w=v2(k,i,await(c.isRTL==null?void 0:c.isRTL(d.floating)));if(l!==k)return{reset:{placement:b[0]}};const j=[v[ia(k)],v[w[0]],v[w[1]]],A=[...((r=a.autoPlacement)==null?void 0:r.overflows)||[],{placement:k,overflows:j}],C=b[y+1];if(C)return{data:{index:y+1,overflows:A},reset:{placement:C}};const $=A.map(z=>{const L=vo(z.placement);return[z.placement,L&&f?z.overflows.slice(0,2).reduce((O,W)=>O+W,0):z.overflows[0],z.overflows]}).sort((z,L)=>z[1]-L[1]),F=((s=$.filter(z=>z[2].slice(0,vo(z[0])?2:3).every(L=>L<=0))[0])==null?void 0:s[0])||$[0][0];return F!==l?{data:{index:y+1,overflows:A},reset:{placement:F}}:{}}}},Ore=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:a,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...v}=Yu(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=ia(s),k=Wa(l),w=ia(l)===l,j=await(c.isRTL==null?void 0:c.isRTL(d.floating)),A=p||(w||!b?[sg(l)]:Sre(l)),C=g!=="none";!p&&C&&A.push(...Ere(l,b,g,j));const $=[l,...A],B=await c.detectOverflow(t,v),F=[];let z=((r=i.flip)==null?void 0:r.overflows)||[];if(f&&F.push(B[y]),u){const M=v2(s,a,j);F.push(B[M[0]],B[M[1]])}if(z=[...z,{placement:s,overflows:F}],!F.every(M=>M<=0)){var L,O;const M=(((L=i.flip)==null?void 0:L.index)||0)+1,T=$[M];if(T&&(!(u==="alignment"?k!==Wa(T):!1)||z.every(_=>Wa(_.placement)===k?_.overflows[0]>0:!0)))return{data:{index:M,overflows:z},reset:{placement:T}};let E=(O=z.filter(D=>D.overflows[0]<=0).sort((D,_)=>D.overflows[1]-_.overflows[1])[0])==null?void 0:O.placement;if(!E)switch(m){case"bestFit":{var W;const D=(W=z.filter(_=>{if(C){const R=Wa(_.placement);return R===k||R==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(R=>R>0).reduce((R,P)=>R+P,0)]).sort((_,R)=>_[1]-R[1])[0])==null?void 0:W[0];D&&(E=D);break}case"initialPlacement":E=l;break}if(s!==E)return{reset:{placement:E}}}return{}}}},Mre=new Set(["left","top"]);async function $re(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=ia(n),l=vo(n),c=Wa(n)==="y",d=Mre.has(a)?-1:1,f=i&&c?-1:1,u=Yu(t,e);let{mainAxis:p,crossAxis:m,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return l&&typeof g=="number"&&(m=l==="end"?g*-1:g),c?{x:m*f,y:p*d}:{x:p*d,y:m*f}}const Dre=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:a,middlewareData:l}=t,c=await $re(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:a}}}}},Fre=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:y=>{let{x:k,y:w}=y;return{x:k,y:w}}},...d}=Yu(e,t),f={x:n,y:r},u=await i.detectOverflow(t,d),p=Wa(ia(s)),m=b2(p);let g=f[m],b=f[p];if(a){const y=m==="y"?"top":"left",k=m==="y"?"bottom":"right",w=g+u[y],j=g-u[k];g=Nb(w,g,j)}if(l){const y=p==="y"?"top":"left",k=p==="y"?"bottom":"right",w=b+u[y],j=b-u[k];b=Nb(w,b,j)}const v=c.fn({...t,[m]:g,[p]:b});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[m]:a,[p]:l}}}}}};function Ug(){return typeof window<"u"}function Gu(e){return S2(e)?(e.nodeName||"").toLowerCase():"#document"}function Hs(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Co(e){var t;return(t=(S2(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function S2(e){return Ug()?e instanceof Node||e instanceof Hs(e).Node:!1}function Vi(e){return Ug()?e instanceof Element||e instanceof Hs(e).Element:!1}function la(e){return Ug()?e instanceof HTMLElement||e instanceof Hs(e).HTMLElement:!1}function W1(e){return!Ug()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Hs(e).ShadowRoot}function pp(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Ui(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function zre(e){return/^(table|td|th)$/.test(Gu(e))}function Kg(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Bre=/transform|translate|scale|rotate|perspective|filter/,Hre=/paint|layout|strict|content/,Dl=e=>!!e&&e!=="none";let Ex;function b0(e){const t=Vi(e)?Ui(e):e;return Dl(t.transform)||Dl(t.translate)||Dl(t.scale)||Dl(t.rotate)||Dl(t.perspective)||!v0()&&(Dl(t.backdropFilter)||Dl(t.filter))||Bre.test(t.willChange||"")||Hre.test(t.contain||"")}function Wre(e){let t=ll(e);for(;la(t)&&!Fu(t);){if(b0(t))return t;if(Kg(t))return null;t=ll(t)}return null}function v0(){return Ex==null&&(Ex=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ex}function Fu(e){return/^(html|body|#document)$/.test(Gu(e))}function Ui(e){return Hs(e).getComputedStyle(e)}function qg(e){return Vi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ll(e){if(Gu(e)==="html")return e;const t=e.assignedSlot||e.parentNode||W1(e)&&e.host||Co(e);return W1(t)?t.host:t}function N2(e){const t=ll(e);return Fu(t)?e.ownerDocument?e.ownerDocument.body:e.body:la(t)&&pp(t)?t:N2(t)}function Uf(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=N2(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),a=Hs(s);if(i){const l=jb(a);return t.concat(a,a.visualViewport||[],pp(s)?s:[],l&&n?Uf(l):[])}else return t.concat(s,Uf(s,[],n))}function jb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function j2(e){const t=Ui(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=la(e),i=s?e.offsetWidth:n,a=s?e.offsetHeight:r,l=ng(n)!==i||ng(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function k0(e){return Vi(e)?e:e.contextElement}function xu(e){const t=k0(e);if(!la(t))return bo(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=j2(t);let a=(i?ng(n.width):n.width)/r,l=(i?ng(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const Vre=bo(0);function C2(e){const t=Hs(e);return!v0()||!t.visualViewport?Vre:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ure(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Hs(e)?!1:t}function dc(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=k0(e);let a=bo(1);t&&(r?Vi(r)&&(a=xu(r)):a=xu(e));const l=Ure(i,n,r)?C2(i):bo(0);let c=(s.left+l.x)/a.x,d=(s.top+l.y)/a.y,f=s.width/a.x,u=s.height/a.y;if(i){const p=Hs(i),m=r&&Vi(r)?Hs(r):r;let g=p,b=jb(g);for(;b&&r&&m!==g;){const v=xu(b),y=b.getBoundingClientRect(),k=Ui(b),w=y.left+(b.clientLeft+parseFloat(k.paddingLeft))*v.x,j=y.top+(b.clientTop+parseFloat(k.paddingTop))*v.y;c*=v.x,d*=v.y,f*=v.x,u*=v.y,c+=w,d+=j,g=Hs(b),b=jb(g)}}return ig({width:f,height:u,x:c,y:d})}function Yg(e,t){const n=qg(e).scrollLeft;return t?t.left+n:dc(Co(e)).left+n}function E2(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Yg(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Kre(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",a=Co(r),l=t?Kg(t.floating):!1;if(r===a||l&&i)return n;let c={scrollLeft:0,scrollTop:0},d=bo(1);const f=bo(0),u=la(r);if((u||!u&&!i)&&((Gu(r)!=="body"||pp(a))&&(c=qg(r)),u)){const m=dc(r);d=xu(r),f.x=m.x+r.clientLeft,f.y=m.y+r.clientTop}const p=a&&!u&&!i?E2(a,c):bo(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+f.x+p.x,y:n.y*d.y-c.scrollTop*d.y+f.y+p.y}}function qre(e){return Array.from(e.getClientRects())}function Yre(e){const t=Co(e),n=qg(e),r=e.ownerDocument.body,s=ec(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ec(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+Yg(e);const l=-n.scrollTop;return Ui(r).direction==="rtl"&&(a+=ec(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:a,y:l}}const V1=25;function Gre(e,t){const n=Hs(e),r=Co(e),s=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,c=0;if(s){i=s.width,a=s.height;const f=v0();(!f||f&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const d=Yg(r);if(d<=0){const f=r.ownerDocument,u=f.body,p=getComputedStyle(u),m=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(r.clientWidth-u.clientWidth-m);g<=V1&&(i-=g)}else d<=V1&&(i+=d);return{width:i,height:a,x:l,y:c}}function Xre(e,t){const n=dc(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=la(e)?xu(e):bo(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,c=s*i.x,d=r*i.y;return{width:a,height:l,x:c,y:d}}function U1(e,t,n){let r;if(t==="viewport")r=Gre(e,n);else if(t==="document")r=Yre(Co(e));else if(Vi(t))r=Xre(t,n);else{const s=C2(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return ig(r)}function _2(e,t){const n=ll(e);return n===t||!Vi(n)||Fu(n)?!1:Ui(n).position==="fixed"||_2(n,t)}function Jre(e,t){const n=t.get(e);if(n)return n;let r=Uf(e,[],!1).filter(l=>Vi(l)&&Gu(l)!=="body"),s=null;const i=Ui(e).position==="fixed";let a=i?ll(e):e;for(;Vi(a)&&!Fu(a);){const l=Ui(a),c=b0(a);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||pp(a)&&!c&&_2(e,a))?r=r.filter(f=>f!==a):s=l,a=ll(a)}return t.set(e,r),r}function Qre(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?Kg(t)?[]:Jre(t,this._c):[].concat(n),r],l=U1(t,a[0],s);let c=l.top,d=l.right,f=l.bottom,u=l.left;for(let p=1;p<a.length;p++){const m=U1(t,a[p],s);c=ec(m.top,c),d=Du(m.right,d),f=Du(m.bottom,f),u=ec(m.left,u)}return{width:d-u,height:f-c,x:u,y:c}}function Zre(e){const{width:t,height:n}=j2(e);return{width:t,height:n}}function ese(e,t,n){const r=la(t),s=Co(t),i=n==="fixed",a=dc(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=bo(0);function d(){c.x=Yg(s)}if(r||!r&&!i)if((Gu(t)!=="body"||pp(s))&&(l=qg(t)),r){const m=dc(t,!0,i,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else s&&d();i&&!r&&s&&d();const f=s&&!r&&!i?E2(s,l):bo(0),u=a.left+l.scrollLeft-c.x-f.x,p=a.top+l.scrollTop-c.y-f.y;return{x:u,y:p,width:a.width,height:a.height}}function _x(e){return Ui(e).position==="static"}function K1(e,t){if(!la(e)||Ui(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Co(e)===n&&(n=n.ownerDocument.body),n}function P2(e,t){const n=Hs(e);if(Kg(e))return n;if(!la(e)){let s=ll(e);for(;s&&!Fu(s);){if(Vi(s)&&!_x(s))return s;s=ll(s)}return n}let r=K1(e,t);for(;r&&zre(r)&&_x(r);)r=K1(r,t);return r&&Fu(r)&&_x(r)&&!b0(r)?n:r||Wre(e)||n}const tse=async function(e){const t=this.getOffsetParent||P2,n=this.getDimensions,r=await n(e.floating);return{reference:ese(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function nse(e){return Ui(e).direction==="rtl"}const rse={convertOffsetParentRelativeRectToViewportRelativeRect:Kre,getDocumentElement:Co,getClippingRect:Qre,getOffsetParent:P2,getElementRects:tse,getClientRects:qre,getDimensions:Zre,getScale:xu,isElement:Vi,isRTL:nse};function A2(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function sse(e,t){let n=null,r;const s=Co(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const d=e.getBoundingClientRect(),{left:f,top:u,width:p,height:m}=d;if(l||t(),!p||!m)return;const g=Ch(u),b=Ch(s.clientWidth-(f+p)),v=Ch(s.clientHeight-(u+m)),y=Ch(f),w={rootMargin:-g+"px "+-b+"px "+-v+"px "+-y+"px",threshold:ec(0,Du(1,c))||1};let j=!0;function A(C){const $=C[0].intersectionRatio;if($!==c){if(!j)return a();$?a(!1,$):r=setTimeout(()=>{a(!1,1e-7)},1e3)}$===1&&!A2(d,e.getBoundingClientRect())&&a(),j=!1}try{n=new IntersectionObserver(A,{...w,root:s.ownerDocument})}catch{n=new IntersectionObserver(A,w)}n.observe(e)}return a(!0),i}function q1(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=k0(e),f=s||i?[...d?Uf(d):[],...t?Uf(t):[]]:[];f.forEach(y=>{s&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const u=d&&l?sse(d,n):null;let p=-1,m=null;a&&(m=new ResizeObserver(y=>{let[k]=y;k&&k.target===d&&m&&t&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=m)==null||w.observe(t)})),n()}),d&&!c&&m.observe(d),t&&m.observe(t));let g,b=c?dc(e):null;c&&v();function v(){const y=dc(e);b&&!A2(b,y)&&n(),b=y,g=requestAnimationFrame(v)}return n(),()=>{var y;f.forEach(k=>{s&&k.removeEventListener("scroll",n),i&&k.removeEventListener("resize",n)}),u==null||u(),(y=m)==null||y.disconnect(),m=null,c&&cancelAnimationFrame(g)}}const ise=Dre,ose=Lre,ase=Fre,lse=Ore,Y1=Tre,cse=(e,t,n)=>{const r=new Map,s={platform:rse,...n},i={...s.platform,_c:r};return Ire(e,t,{...s,platform:i})};var use=typeof document<"u",dse=function(){},Qh=use?h.useLayoutEffect:dse;function og(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(!og(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)&&!og(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function I2(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function G1(e,t){const n=I2(e);return Math.round(t*n)/n}function Px(e){const t=h.useRef(e);return Qh(()=>{t.current=e}),t}function X1(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:a}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[f,u]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=h.useState(r);og(p,r)||m(r);const[g,b]=h.useState(null),[v,y]=h.useState(null),k=h.useCallback(_=>{_!==C.current&&(C.current=_,b(_))},[]),w=h.useCallback(_=>{_!==$.current&&($.current=_,y(_))},[]),j=i||g,A=a||v,C=h.useRef(null),$=h.useRef(null),B=h.useRef(f),F=c!=null,z=Px(c),L=Px(s),O=Px(d),W=h.useCallback(()=>{if(!C.current||!$.current)return;const _={placement:t,strategy:n,middleware:p};L.current&&(_.platform=L.current),cse(C.current,$.current,_).then(R=>{const P={...R,isPositioned:O.current!==!1};M.current&&!og(B.current,P)&&(B.current=P,Mr.flushSync(()=>{u(P)}))})},[p,t,n,L,O]);Qh(()=>{d===!1&&B.current.isPositioned&&(B.current.isPositioned=!1,u(_=>({..._,isPositioned:!1})))},[d]);const M=h.useRef(!1);Qh(()=>(M.current=!0,()=>{M.current=!1}),[]),Qh(()=>{if(j&&(C.current=j),A&&($.current=A),j&&A){if(z.current)return z.current(j,A,W);W()}},[j,A,W,z,F]);const T=h.useMemo(()=>({reference:C,floating:$,setReference:k,setFloating:w}),[k,w]),E=h.useMemo(()=>({reference:j,floating:A}),[j,A]),D=h.useMemo(()=>{const _={position:n,left:0,top:0};if(!E.floating)return _;const R=G1(E.floating,f.x),P=G1(E.floating,f.y);return l?{..._,transform:"translate("+R+"px, "+P+"px)",...I2(E.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:R,top:P}},[n,l,E.floating,f.x,f.y]);return h.useMemo(()=>({...f,update:W,refs:T,elements:E,floatingStyles:D}),[f,W,T,E,D])}const fse=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?Y1({element:r.current,padding:s}).fn(n):{}:r?Y1({element:r,padding:s}).fn(n):{}}}},J1=(e,t)=>{const n=ise(e);return{name:n.name,fn:n.fn,options:[e,t]}},pse=(e,t)=>{const n=ase(e);return{name:n.name,fn:n.fn,options:[e,t]}},hse=(e,t)=>{const n=lse(e);return{name:n.name,fn:n.fn,options:[e,t]}},mse=(e,t)=>{const n=ose(e);return{name:n.name,fn:n.fn,options:[e,t]}},gse=(e,t)=>{const n=fse(e);return{name:n.name,fn:n.fn,options:[e,t]}},yse={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},xse={beaconOptions:{offset:-18}},T2={back:"Back",close:"Close",last:"Last",next:"Next",nextWithProgress:"Next ({current} of {total})",open:"Open the dialog",skip:"Skip"},wse={isFixed:!1,locale:T2,placement:"bottom"},bse={continuous:!1,debug:!1,run:!1,scrollToFirstStep:!1,steps:[]},$t={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update",COMPLETE:"complete"},_r={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"},Be={INIT:"init",READY:"ready",BEACON_BEFORE:"beacon_before",BEACON:"beacon",TOOLTIP_BEFORE:"tooltip_before",TOOLTIP:"tooltip",COMPLETE:"complete"},uo={BUTTON_BACK:"button_back",BUTTON_CLOSE:"button_close",BUTTON_PRIMARY:"button_primary",BUTTON_SKIP:"button_skip",KEYBOARD:"keyboard",OVERLAY:"overlay"},Rt={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"},vse="react-joyride-portal";function kse(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function ou(...e){return fre({all:!0,isMergeableObject:t=>!(!Gr.plainObject(t)||h.isValidElement(t))})(...e)}function R2(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function Ko(e,t={}){const{defaultValue:n,step:r,steps:s}=t;let i=Cx(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&&R2(e.type)==="function")try{i=Ko(e.type({}),t)}catch{i=Cx(n)}else i=Cx(n);return i}function Ar(e,t,n,...r){if(!e)return;const s=new Date,i=`${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}:${String(s.getSeconds()).padStart(2,"0")}.${String(s.getMilliseconds()).padStart(3,"0")}`;console.log(`${t} %c${n}%c ${i}`,"font-weight: bold","color: gray; font-weight: normal",...r)}function Sse(e,t){const n=kse(t);return{...e,...n}}function Kf(){}function Nse(e){return Object.keys(e)}function ag(e,...t){if(!Gr.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 Q1(e,...t){if(!Gr.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 Cb(e,t,n){const r=i=>i.replace("{current}",String(t)).replace("{total}",String(n));if(R2(e)==="string")return r(e);if(!h.isValidElement(e))return e;const{children:s}=e.props;if(Gr.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):Cb(i,t,n))});if(Gr.function(e.type)&&!Object.values(e.props).length)try{return Cb(e.type({}),t,n)}catch{return e}return e}function Z1(e){return Nse(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})}function S0(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function eC(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 N0(e){return e?e.getBoundingClientRect():null}function jse(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 ci(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 Cse(e,t,n){const r=N0(e),s=Xu(e),i=s?!s.isSameNode(bs()):!1,a=n??Ju(e);let l=0,c=(r==null?void 0:r.top)??0;return i&&a?c=(r==null?void 0:r.top)??0:s instanceof HTMLElement&&(l=s.scrollTop,!i&&!a&&(c+=l),s.isSameNode(bs())||(c+=bs().scrollTop)),Math.floor(c-t)}function Xu(e,t){if(!e)return bs();const n=w2(e);if(n){if(n.isSameNode(bs()))return t?document:bs();if(!(n.scrollHeight>n.offsetHeight))return bs()}return n}function Ese(e){const t=e.getBoundingClientRect(),n=bs(),r=t.top+t.height/2,s=window.innerHeight/2;return Math.max(0,n.scrollTop+r-s)}function _se(e,t){if(!e)return 0;const n=w2(e)??bs(),r=parseFloat(getComputedStyle(e).scrollMarginTop)||0,s=N0(n),i=n.scrollTop??0,{offsetTop:a=0,scrollTop:l=0}=n;let c=e.getBoundingClientRect().top+l;if(a&&(L2(e)||Pse(e))){const f=e.getBoundingClientRect(),u=f.top-((s==null?void 0:s.top)??0),p=u+f.height,m=n.clientHeight,g=m*.2;u>=g&&p<=m-g?c=i:c=u+i}const d=Math.floor(c-t-r);return d<0?0:d}function Pse(e){return e.offsetParent!==document.body}function L2(e){if(!e)return!1;const t=Xu(e);return t?!t.isSameNode(bs()):!1}function Ju(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?Ju(e.parentNode,t):!1}function Eh(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 tC(e){const{isFirstStep:t,scrollToFirstStep:n,step:r,target:s,targetLifecycle:i}=e;if(r.skipScroll||t&&!n&&i!==Be.TOOLTIP||r.placement==="center")return!1;const a=s!=null&&s.isConnected?Xu(s):bs(),l=a?!a.isSameNode(bs()):!1;return(r.isFixed||Ju(s))&&!l?!1:a.scrollHeight>a.clientHeight}function bs(){return document.scrollingElement??document.documentElement}function nC(e,t){const{duration:n,element:r}=t;let s=()=>{};const i=new Promise(a=>{const{scrollTop:l}=r,c=e>l?e-l:l-e;s=wre.top(r,e,{duration:c<100?50:n},()=>{a()})});return{cancel:s,promise:i}}function Ase(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 O2={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555555",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,WebkitAppearance:"none"},_h={...O2,borderRadius:4,padding:8};function Ise(e,t){const{styles:n}=e,r=ou(n??{},t.styles??{});let{width:s}=t;S0()&&(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 ou({arrow:{alignItems:"center",color:t.arrowColor,display:"inline-flex",justifyContent:"center",position:"absolute"},beaconWrapper:{...O2,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(${Ase(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:{..._h,color:t.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{..._h,color:t.textColor,height:12,padding:8,position:"absolute",right:0,top:0,width:12},buttonPrimary:{..._h,backgroundColor:t.primaryColor,color:t.backgroundColor},buttonSkip:{..._h,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 Tse=["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 j0(e,t){if(!t)return null;const n=ou(wse,Q1(e,"arrowComponent","beaconComponent","floatingOptions","loaderComponent","locale","styles","tooltipComponent"),t),r=ou(yse,e.options??{},Q1(t,...Tse)),s=Ise(e,{...n,...r}),i=ou(xse,e.floatingOptions??{},n.floatingOptions??{});return{...n,...r,locale:ou(T2,e.locale??{},n.locale||{}),floatingOptions:i,spotlightPadding:Rse(r.spotlightPadding),styles:s}}function Rse(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 Lse(e,t,n){const{action:r}=t,s=n&&[$t.PREV,$t.NEXT].includes(r);return e.skipBeacon||e.placement==="center"||s}function M2(e,t=!1){return Gr.plainObject(e)?e.target?!0:(Ar(t,"tour","target is missing from the step"),!1):(Ar(t,"tour","step must be an object"),!1)}function $2(e,t=!1){return Gr.array(e)?e.every(n=>M2(n,t)):(Ar(t,"tour","steps must be an array"),!1)}var Ose=class{constructor(e){Jn(this,"beaconPosition",null);Jn(this,"debug");Jn(this,"eventListeners",new Map);Jn(this,"listeners",new Set);Jn(this,"props");Jn(this,"snapshot");Jn(this,"state");Jn(this,"steps");Jn(this,"tooltipPosition",null);Jn(this,"cleanupPositionData",()=>{this.beaconPosition=null,this.tooltipPosition=null});Jn(this,"getPositionData",e=>e==="beacon"?this.beaconPosition:this.tooltipPosition);Jn(this,"getServerSnapshot",()=>this.snapshot);Jn(this,"getSnapshot",()=>this.snapshot);Jn(this,"getEventState",()=>ag(this.snapshot,"positioned"));Jn(this,"getState",()=>ag(this.snapshot,"positioned"));Jn(this,"setPositionData",(e,t)=>{var r,s,i;((r=e==="beacon"?this.beaconPosition:this.tooltipPosition)==null?void 0:r.placement)!==t.placement&&Ar(this.debug,`step:${this.state.index}`,"positioned",`${e} ${t.placement}`),e==="beacon"?this.beaconPosition=t:this.tooltipPosition=t,(this.state.lifecycle===Be.BEACON_BEFORE||this.state.lifecycle===Be.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)});Jn(this,"setSteps",e=>{this.steps=e,this.updateState({size:e.length})});Jn(this,"dispatch",(e,t)=>{const n=this.eventListeners.get(e.type);if(n)for(const r of n)try{r(e,t)}catch{}});Jn(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)}});Jn(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));Jn(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 c of this.listeners)c(this.snapshot)}});const{initialStepIndex:t,stepIndex:n,steps:r=[]}=e??{},s=Gr.number(n);let i=0;this.debug=(e==null?void 0:e.debug)??!1,s?(i=n,Gr.number(t)&&Ar(this.debug,"tour","initialStepIndex is ignored in controlled mode")):Gr.number(t)&&(t>=0&&t<r.length?i=t:r.length>0&&Ar(this.debug,"tour","initialStepIndex is out of bounds")),this.props=e??{steps:[]},this.steps=r,this.state={action:$t.INIT,controlled:s,index:i,lifecycle:Be.INIT,origin:null,positioned:!1,scrolling:!1,size:r.length,status:r.length?Rt.READY:Rt.IDLE,waiting:!1},this.snapshot=Object.freeze({...this.state})}applyTransitions(e){return e.status===Rt.WAITING&&e.size>0?{...e,status:Rt.RUNNING}:e}getStep(e){return j0(this.props,this.steps[e??this.state.index])}};function Mse(e){return new Ose(e)}function rC(e,t){return Math.min(Math.max(e,0),t)}function $se(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:(v=null)=>{const{index:y,status:k}=i();k===Rt.RUNNING&&e.current.updateState({action:$t.CLOSE,index:y+1,origin:v,lifecycle:Be.COMPLETE,positioned:!1,scrolling:!1,waiting:!1})},go:v=>{const{controlled:y,size:k,status:w}=i();if(y){Ar(r.current,"tour","go() is not supported in controlled mode");return}w===Rt.RUNNING&&e.current.updateState({action:$t.GO,index:v,lifecycle:Be.COMPLETE,positioned:!1,scrolling:!1,status:v<k?w:Rt.FINISHED,waiting:!1})},info:()=>ag(e.current.getSnapshot(),"positioned"),next:v=>{const{index:y,size:k,status:w}=i();w===Rt.RUNNING&&e.current.updateState({action:$t.NEXT,index:rC(y+1,k),lifecycle:Be.COMPLETE,origin:v,positioned:!1,scrolling:!1,waiting:!1})},open:()=>{const{status:v}=i();v===Rt.RUNNING&&e.current.updateState({action:$t.UPDATE,lifecycle:Be.TOOLTIP_BEFORE,positioned:!1,scrolling:!1,waiting:!1})},prev:v=>{const{index:y,size:k,status:w}=i();w===Rt.RUNNING&&e.current.updateState({action:$t.PREV,index:rC(y-1,k),lifecycle:Be.COMPLETE,origin:v,positioned:!1,scrolling:!1,waiting:!1})},reset:(v=!1)=>{const{controlled:y}=i();if(y){Ar(r.current,"tour","reset() is not supported in controlled mode");return}s.current(),e.current.updateState({action:$t.RESET,index:0,lifecycle:Be.INIT,positioned:!1,scrolling:!1,status:v?Rt.RUNNING:Rt.READY,waiting:!1})},skip:v=>{const{status:y}=i();y===Rt.RUNNING&&e.current.updateState({action:$t.SKIP,lifecycle:Be.COMPLETE,origin:v,positioned:!1,scrolling:!1,status:Rt.SKIPPED,waiting:!1})},start:v=>{const{index:y,size:k}=i();s.current(),e.current.updateState({action:$t.START,index:Gr.number(v)?v:y,lifecycle:Be.INIT,positioned:!1,scrolling:!1,status:k?Rt.RUNNING:Rt.WAITING,waiting:!1},!0)},stop:(v=!1)=>{const{index:y,status:k}=i();[Rt.FINISHED,Rt.SKIPPED].includes(k)||e.current.updateState({action:$t.STOP,index:y+(v?1:0),lifecycle:Be.COMPLETE,positioned:!1,scrolling:!1,status:Rt.PAUSED,waiting:!1})}}},[e])}const Dse=new Set(["origin","positioned"]);function Fse(e,t){const n=h.useRef(null);h.useEffect(()=>{if(!t)return;const r=e.current.getSnapshot();return Ar(!0,"tour","init",r),n.current=r,e.current.subscribe(s=>{const i=n.current;if(n.current=s,!i)return;const a={};let l=!1;for(const c of Object.keys(s))s[c]!==i[c]&&!Dse.has(c)&&(a[c]={from:i[c],to:s[c]},(c==="status"||c==="size")&&(l=!0));Object.keys(a).length&&(!l&&s.index>=s.size||Ar(!0,l?"tour":`step:${s.index}`,"state",a))})},[t,e])}function zse(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 c={...n.current.getEventState(),error:null,scroll:null,step:a,type:i,...l};(d=r.current)==null||d.call(r,c,s.current),n.current.dispatch(c,s.current)},[n])}function Ma(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 Bse(e){const{addFailure:t,controls:n,emitEvent:r,previousState:s,props:i,state:a,step:l,store:c}=e,{action:d,index:f,lifecycle:u,positioned:p,scrolling:m,size:g,status:b}=a,v=d2(l)??null,y=h.useRef(null),k=h.useRef(i),w=h.useRef(a),j=h.useRef(s),A=h.useRef(l),C=h.useRef(v),$=h.useRef(n),B=h.useRef(null),F=h.useRef(null),z=h.useRef(null);k.current=i,w.current=a,j.current=s,A.current=l,C.current=v,$.current=n;const L=()=>{B.current&&(clearInterval(B.current),B.current=null),F.current=null,z.current&&(z.current.cancel(),z.current=null)};h.useEffect(()=>{if(!j.current)return;const{hasChangedTo:O}=Ma(w.current,j.current);(O("action",[$t.NEXT,$t.PREV,$t.SKIP,$t.CLOSE])||y.current===$t.CLOSE&&d===$t.START)&&(y.current=d)},[d]),h.useEffect(()=>{if(!j.current)return()=>{L()};const{hasChanged:O}=Ma(w.current,j.current),W=A.current;if(O("index")&&L(),b!==Rt.RUNNING||!W||u!==Be.INIT)return()=>{L()};const{hasChangedTo:M}=Ma(w.current,j.current);M("status",Rt.RUNNING)&&[Rt.IDLE,Rt.READY,Rt.PAUSED].includes(j.current.status)&&r(_r.TOUR_START,W),c.current.cleanupPositionData();const{debug:T}=k.current;if(W.before&&!z.current){Ar(T,`step:${f}`,"before()",W),z.current={cancel:()=>{}},c.current.updateState({waiting:!0}),r(_r.STEP_BEFORE_HOOK,W,{action:y.current??w.current.action});const E=()=>{z.current=null,c.current.updateState({action:y.current??w.current.action,waiting:!1,lifecycle:Be.READY})},D=new AbortController,_=W.beforeTimeout;z.current={cancel:()=>D.abort()};const R=_?setTimeout(()=>{D.signal.aborted||(Ar(T,`step:${f}`,"before()","timed out",`${_}ms`),D.abort(),t(W,"before_hook"),r(_r.ERROR,W,{error:new Error("Step before hook timed out")}),E())},_):null;W.before({...c.current.getState(),action:y.current??c.current.getState().action,step:W}).then(()=>{D.signal.aborted||(R&&clearTimeout(R),E())}).catch(P=>{D.signal.aborted||(R&&clearTimeout(R),t(W,"before_hook"),r(_r.ERROR,W,{error:P instanceof Error?P:new Error(String(P))}),E())})}else if(!z.current){B.current&&F.current!==W.target&&L();const E=ci(W.target);if(E&&Eh(E))L(),c.current.updateState({action:y.current??$t.UPDATE,lifecycle:Be.READY,waiting:!1});else if(W.targetWaitTimeout===0)c.current.updateState({action:y.current??$t.UPDATE,lifecycle:Be.READY,waiting:!1});else if(!B.current){const{targetWaitTimeout:D}=W,_=Date.now();F.current=W.target,Ar(T,`step:${f}`,"polling","started",`${D}ms`),c.current.updateState({waiting:!0}),B.current=setInterval(()=>{const R=ci(W.target),P=Date.now()-_,G=P>=D;(R&&Eh(R)||G)&&(Ar(T,`step:${f}`,"polling",R&&Eh(R)?"found":"timed out",`${P}ms`),L(),c.current.updateState({action:y.current??$t.UPDATE,lifecycle:Be.READY,waiting:!1}))},100)}}return()=>{L()}},[t,r,f,u,b,c]),h.useEffect(()=>{if(!j.current)return;const{hasChanged:O,hasChangedTo:W,previous:M}=Ma(w.current,j.current),T=A.current;if(!T)return;const E=ci(T.target),D=!!E;if(D&&Eh(E)){if(W("lifecycle",Be.READY)&&M.lifecycle===Be.INIT&&r(_r.STEP_BEFORE,T,{action:y.current??w.current.action}),W("lifecycle",Be.READY)){const _=w.current,R=Lse(T,_,k.current.continuous)?Be.TOOLTIP:Be.BEACON,P=ci(T.scrollTarget??T.spotlightTarget??T.target),G=tC({isFirstStep:_.index===0,scrollToFirstStep:k.current.scrollToFirstStep,step:T,target:P,targetLifecycle:R}),Z=R===Be.TOOLTIP?Be.TOOLTIP_BEFORE:Be.BEACON_BEFORE;Ar(k.current.debug,`step:${f}`,"scroll",G?"needed":"skipped"),c.current.updateState({action:$t.UPDATE,lifecycle:Z,scrolling:G})}}else if(w.current.status===Rt.RUNNING&&u!==Be.INIT&&u!==Be.COMPLETE&&O("lifecycle")){Ar(k.current.debug,`step:${f}`,D?"Target not visible":"Target not mounted",T),t(T,"target_not_found"),r(_r.TARGET_NOT_FOUND,T);const _=w.current;_.controlled||c.current.updateState({action:$t.UPDATE,index:_.index+(_.action===$t.PREV?-1:1),lifecycle:Be.INIT})}},[t,r,f,u,c]),h.useEffect(()=>{if(!j.current)return;const{hasChangedTo:O,previous:W}=Ma(w.current,j.current),M=A.current,T=C.current;if(M&&O("lifecycle",Be.TOOLTIP_BEFORE)&&W.lifecycle===Be.BEACON){const _=ci(M.scrollTarget??M.spotlightTarget??M.target);if(tC({isFirstStep:w.current.index===0,scrollToFirstStep:k.current.scrollToFirstStep,step:M,target:_,targetLifecycle:Be.TOOLTIP})){c.current.updateState({scrolling:!0,positioned:!1});return}}const E=u===Be.BEACON_BEFORE||u===Be.TOOLTIP_BEFORE;if(M&&E&&!m){const _=u===Be.TOOLTIP_BEFORE?Be.TOOLTIP:Be.BEACON;c.current.updateState({action:$t.UPDATE,lifecycle:_})}M&&O("lifecycle",Be.BEACON)&&r(_r.BEACON,M),M&&O("lifecycle",Be.TOOLTIP)&&r(_r.TOOLTIP,M);const D=w.current;if((D.status===Rt.RUNNING||D.controlled&&D.status===Rt.PAUSED&&M)&&T&&O("lifecycle",Be.COMPLETE)&&W.lifecycle===Be.TOOLTIP&&(r(_r.STEP_AFTER,T,{action:y.current??$t.UPDATE,index:W.index??D.index,lifecycle:D.lifecycle}),T.after)){r(_r.STEP_AFTER_HOOK,T,{action:y.current??$t.UPDATE,index:W.index??D.index,lifecycle:D.lifecycle});try{T.after({...c.current.getState(),action:y.current??$t.UPDATE,index:W.index??D.index,lifecycle:D.lifecycle,step:T})}catch{}}},[r,u,p,m,c]),h.useEffect(()=>{if(!j.current)return;const{hasChangedTo:O,previous:W}=Ma(w.current,j.current),M=A.current,T=C.current;g&&!M&&u===Be.INIT&&c.current.updateState({action:$t.UPDATE,lifecycle:Be.COMPLETE,status:Rt.FINISHED}),!w.current.controlled&&b===Rt.RUNNING&&O("lifecycle",Be.COMPLETE)&&f<g&&c.current.updateState({action:$t.UPDATE,lifecycle:Be.INIT}),O("lifecycle",Be.COMPLETE)&&f>=g&&c.current.updateState({action:$t.UPDATE,lifecycle:Be.COMPLETE,status:Rt.FINISHED});const E=M??T??j0(k.current,k.current.steps[f-1]);if(E&&O("status",[Rt.FINISHED,Rt.SKIPPED])){let D;M?D=f:T?D=W.index??f:D=f-1,r(_r.TOUR_END,E,{index:D}),w.current.controlled||$.current.reset(),y.current=null}M&&O("action",$t.STOP)&&(y.current=null,r(_r.TOUR_STATUS,M)),M&&O("action",$t.RESET)&&(r(_r.TOUR_STATUS,M),y.current=null)},[d,r,f,u,g,b,c])}function Hse({controls:e,emitEvent:t,props:n,state:r,store:s}){const{debug:i,initialStepIndex:a,run:l,stepIndex:c,steps:d}=n,f=h.useRef(void 0),u=h.useRef(r),p=h.useRef(e);u.current=r,p.current=e,h.useEffect(()=>{const m=f.current;if(f.current=n,!m||n===m)return;const{hasChanged:g}=Ma(n,m);if(h0(m.steps,d)||($2(d,i)?s.current.setSteps(d):(Ar(i,"tour","Steps are not valid",d),t(_r.ERROR,d[0]??{target:"",content:""},{error:new Error("Steps are not valid")}))),g("run"))l?s.current.getState().size&&p.current.start(c??a):p.current.stop();else if(Gr.number(c)&&g("stepIndex")){const b=Gr.number(m.stepIndex)&&m.stepIndex<c?$t.NEXT:$t.PREV;[Rt.FINISHED,Rt.SKIPPED].includes(u.current.status)||s.current.updateState({action:b,index:c,lifecycle:Be.INIT,positioned:!1},!0)}},[i,t,a,n,l,c,d,s])}function Wse(e,t){var l,c,d,f;const{beaconPosition:n,lifecycle:r,scrollOffset:s,step:i}=t;if(i.scrollTarget||i.spotlightTarget)return Math.max(0,e);let a=e-i.spotlightPadding.top;if(r===Be.BEACON_BEFORE&&(n!=null&&n.placement)){const u=Vse(n);["bottom"].includes(n.placement)||(a+=Math.floor(u-s))}else if(r===Be.TOOLTIP_BEFORE){const{placement:u}=i;if(u==="top"){const p=((l=document.querySelector(".react-joyride__floater"))==null?void 0:l.getBoundingClientRect().height)??0,m=(c=i.floatingOptions)!=null&&c.hideArrow?0:i.arrowSize,g=i.offset+i.spotlightPadding.top+m;a-=p+g}else if(u==="left"||u==="right"){const p=((d=document.querySelector(".react-joyride__floater"))==null?void 0:d.getBoundingClientRect().height)??0,m=((f=ci(i.target))==null?void 0:f.getBoundingClientRect().height)??0,g=s+i.spotlightPadding.top+m/2-p/2;g<s&&(a-=s-g)}}return Math.max(0,a)}function Vse(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 Use({emitEvent:e,previousState:t,props:n,state:r,step:s,store:i}){const{index:a,lifecycle:l,positioned:c,scrolling:d,status:f}=r,u=h.useRef(null),p=h.useRef(r),m=h.useRef(t),g=h.useRef(n),b=h.useRef(s);p.current=r,m.current=t,g.current=n,b.current=s,h.useEffect(()=>()=>{var v;(v=u.current)==null||v.call(u)},[]),h.useEffect(()=>{var A;if(!m.current||!b.current)return;const{hasChangedTo:v}=Ma(p.current,m.current),y=b.current,{debug:k}=g.current,{scrollDuration:w}=y,j=l===Be.BEACON_BEFORE||l===Be.TOOLTIP_BEFORE;if(f===Rt.RUNNING&&j&&d&&v("positioned",!0)){const C=ci(y.scrollTarget??y.spotlightTarget??y.target),$=i.current.getPositionData("beacon"),B=Xu(C),F=B?!B.isSameNode(bs()):!1;(A=u.current)==null||A.call(u),(async()=>{if(F&&!Ju(B)){const D=bs(),_=Ese(B),R={initial:D.scrollTop,target:_,element:D,duration:w};e(_r.SCROLL_START,y,{scroll:R});const{cancel:P,promise:G}=nC(_,{element:D,duration:w});u.current=P,await G,e(_r.SCROLL_END,y,{scroll:R})}const L=Math.floor(_se(C,y.scrollOffset))||0,O=F?L:Wse(L,{beaconPosition:$,lifecycle:l,scrollOffset:y.scrollOffset,step:y});Ar(k,`step:${a}`,"scroll",F?"custom":"document",`${L} → ${O}`);const W=B,M={initial:W.scrollTop,target:O,element:W,duration:w};e(_r.SCROLL_START,y,{scroll:M});const{cancel:T,promise:E}=nC(O,{element:W,duration:w});u.current=T,await E,e(_r.SCROLL_END,y,{scroll:M}),i.current.updateState({scrolling:!1})})().catch(()=>{i.current.updateState({scrolling:!1})})}},[e,a,l,c,d,f,i])}function Kse(e){const t=_ne(()=>Sse(bse,e),[e]),{debug:n,initialStepIndex:r,onEvent:s,run:i,stepIndex:a,steps:l}=t,c=h.useRef(Mse(t)),d=QP.useSyncExternalStore(c.current.subscribe,c.current.getSnapshot,c.current.getServerSnapshot),[f,u]=h.useState([]),p=h.useCallback((A,C)=>{u($=>[...$,{reason:C,step:A}])},[]),m=h.useCallback(()=>{u([])},[]);Fse(c,n);const g=$se(c,n,m),b=zse(s,g,c),{index:v,size:y,status:k}=d,w=d2(d),j=h.useMemo(()=>j0(t,l[v]),[v,t,l]);return Pne(()=>{i&&y&&$2(l,n)&&g.start(a??r)}),Ene(()=>{i&&y&&k===Rt.IDLE&&c.current.updateState({status:Rt.READY})},[i,y,k]),Hse({controls:g,emitEvent:b,props:t,state:d,store:c}),Bse({addFailure:p,controls:g,emitEvent:b,previousState:w,props:t,state:d,step:j,store:c}),Use({emitEvent:b,previousState:w,props:t,state:d,step:j,store:c}),{controls:g,failures:f,mergedProps:t,state:d,step:j,store:c}}function qse(e){const[t,n]=h.useState(null);return h.useEffect(()=>{let r=null,s=!1;if(e)if(Gr.domElement(e))r=e,s=!0;else{const i=document.querySelector(e);i&&(r=i)}else{const i=document.createElement("div");i.id=vse,document.body.appendChild(i),r=i}return n(r),()=>{!r||s||r.parentNode===document.body&&document.body.removeChild(r)}},[e]),t}const Yse={animation:"joyride-loader-spin 1s linear infinite",border:"5px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",borderTopColor:"#555"};function Gse({nonce:e,step:t}){const{loaderComponent:n}=t,r=!!n;if(h.useEffect(()=>{if(r||document.getElementById("joyride-loader-animation"))return Kf;const c=document.createElement("style");return c.id="joyride-loader-animation",e&&c.setAttribute("nonce",e),c.appendChild(document.createTextNode(`
|
|
209
|
-
@keyframes joyride-loader-spin {
|
|
210
|
-
to { transform: rotate(360deg); }
|
|
211
|
-
}
|
|
212
|
-
`)),document.head.appendChild(c),()=>{const d=document.getElementById("joyride-loader-animation");d!=null&&d.parentNode&&d.parentNode.removeChild(d)}},[r,e]),n===null)return null;const{height:s,width:i,...a}=t.styles.loader;let l;if(n){const c=n;l=at.createElement(c,{step:t})}else l=at.createElement("div",{style:{...Yse,height:s,width:i,borderTopColor:t.primaryColor}});return at.createElement("div",{className:"react-joyride__loader","data-testid":"loader",style:a},l)}const Xse={height:0,isFixed:!1,left:0,top:0,width:0};function Ad(e,t){const n=ci(e);if(!n)return Xse;const r=N0(n),s=Ju(n),i=Cse(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 Jse(e,t,n){const[r,s]=h.useState(()=>Ad(e,t)),i=h.useRef(void 0),a=h.useRef(null),l=h.useRef(n),c=h.useRef(null),d=h.useCallback(()=>{clearTimeout(i.current),i.current=window.setTimeout(()=>{s(u=>{const p=Ad(e,t);return u.top===p.top&&u.left===p.left&&u.width===p.width&&u.height===p.height&&u.isFixed===p.isFixed?u:p})},100)},[e,t]);h.useEffect(()=>{let u=null;const p=g=>{a.current=Xu(g,!0),a.current&&a.current.addEventListener("scroll",d,{passive:!0}),window.addEventListener("scroll",d,{passive:!0}),window.addEventListener("resize",d),typeof ResizeObserver<"u"&&(c.current=new ResizeObserver(d),c.current.observe(g)),s(Ad(e,t))},m=ci(e);return m?p(m):(u=new MutationObserver(()=>{const g=ci(e);g&&(u==null||u.disconnect(),u=null,p(g))}),u.observe(document.body,{childList:!0,subtree:!0})),()=>{var g;u==null||u.disconnect(),a.current&&a.current.removeEventListener("scroll",d),window.removeEventListener("scroll",d),window.removeEventListener("resize",d),(g=c.current)==null||g.disconnect(),clearTimeout(i.current)}},[e,t,d]),h.useEffect(()=>{l.current&&!n&&s(Ad(e,t)),l.current=n},[n,e,t]);let f=r;return l.current&&!n&&(f=Ad(e,t)),f}function Qse(e,t,n){let r=`M0 0H${e}V${t}H0Z`;return n&&(r+=` ${n}`),r}function sC(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 Zse=[Be.BEACON_BEFORE,Be.BEACON];function eie(e){var E,D;const{blockTargetInteraction:t,continuous:n,hideOverlay:r,lifecycle:s,onClickOverlay:i,overlayClickAction:a,placement:l,portalElement:c,scrolling:d,spotlightPadding:f,spotlightRadius:u,spotlightTarget:p,styles:m,target:g,waiting:b}=e,v=Ane(),y=Jse(p??g,f,d||b),k=h.useRef(null),w=(s===Be.TOOLTIP||s===Be.TOOLTIP_BEFORE)&&l!=="center",[j,A]=h.useState(!1),C=c?(E=k.current)==null?void 0:E.offsetParent:null,$=(C==null?void 0:C.clientWidth)??v.width,B=(C==null?void 0:C.clientHeight)??jse()??v.height,F=((D=m.overlay)==null?void 0:D.backgroundColor)??"rgba(0, 0, 0, 0.5)",z=h.useMemo(()=>{const{backgroundColor:_,mixBlendMode:R,...P}=m.overlay;return{height:B,pointerEvents:"none",...P}},[B,m.overlay]),L=w&&!d&&!b;h.useEffect(()=>{L?requestAnimationFrame(()=>A(!0)):A(!1)},[L]);const O=n&&Zse.includes(s),W=!n&&s!==Be.TOOLTIP;if(r||!b&&(O||W))return null;let M="";if(L)if(c&&C){const _=ci(p??g);if(_){const R=eC(_),P=eC(C);M=sC(R.left-P.left-f.left,R.top-P.top-f.top,_.offsetWidth+f.left+f.right,_.offsetHeight+f.top+f.bottom,u)}}else M=sC(y.left,y.top,y.width,y.height,u);const T=Qse($,B,M);return at.createElement("div",{ref:k,"aria-hidden":"true",className:"react-joyride__overlay","data-testid":"overlay",style:z},at.createElement("svg",{className:"react-joyride__spotlight","data-testid":"spotlight",style:{height:B,left:0,position:y.isFixed?"fixed":"absolute",top:0,width:$}},at.createElement("path",{d:T,fill:F,fillRule:"evenodd",onClick:i,style:{cursor:a?"pointer":"default",pointerEvents:"auto"}}),M&&at.createElement("path",{d:M,fill:F,style:{opacity:j?0:1,pointerEvents:t?"auto":"none",transition:"opacity 0.2s"}}),M&&Object.keys(m.spotlight).length>0&&at.createElement("path",{d:M,fill:"none",style:{pointerEvents:"none"},...m.spotlight})))}function D2(e){const{children:t,element:n}=e;return n?Mr.createPortal(t,n):null}const tie='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), area[href], [tabindex]:not([tabindex="-1"]), [contenteditable]';function nie(e,t){const n=h.useRef(null);h.useEffect(()=>{if(!e)return Kf;n.current=document.activeElement;const r=i=>{if(i.key!=="Tab")return;const a=[...e.querySelectorAll(tie)],{shiftKey:l}=i;if(!a.length)return;i.preventDefault();let c=document.activeElement?a.indexOf(document.activeElement):0;c===-1||!l&&c+1===a.length?c=0:l&&c===0?c=a.length-1:c+=l?-1:1,a[c].focus()};e.addEventListener("keydown",r,!1);let s;{const i=e.querySelector(t);i&&(s=setTimeout(()=>{i.focus({preventScroll:!0})},100))}return()=>{var i;e.removeEventListener("keydown",r),s!==void 0&&clearTimeout(s),(i=n.current)==null||i.focus({preventScroll:!0})}},[e,t])}function Jo(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 rie(e,t,n){const[r]=e.split("-");switch(r){case"top":return{points:`0,0 ${t/2},${n} ${t},0`,...Jo(e,t,n)};case"bottom":return{points:`${t},${n} ${t/2},0 0,${n}`,...Jo(e,t,n)};case"left":return{points:`0,0 ${n},${t/2} 0,${t}`,...Jo(e,t,n)};case"right":return{points:`${n},${t} ${n},0 0,${t/2}`,...Jo(e,t,n)};default:return null}}function sie(e,t,n,r){if(!t)return{};const[s]=e.split("-");switch(s){case"top":return{bottom:-n,left:t.x??0,...Jo(e,r,n)};case"bottom":return{top:-n,left:t.x??0,...Jo(e,r,n)};case"left":return{right:-n,top:t.y??0,...Jo(e,r,n)};case"right":return{left:-n,top:t.y??0,...Jo(e,r,n)};default:return{}}}function iie({arrowComponent:e,arrowRef:t,base:n,placement:r,position:s,size:i,styles:a}){const l=e;let c=null;if(l){if(!Jo(r,n,i))return null;c=at.createElement("span",{style:{flexShrink:0}},at.createElement(l,{base:n,placement:r,size:i}))}else{const d=rie(r,n,i);if(!d)return null;c=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,...sie(r,s,i,n),...s?{}:{visibility:"hidden"}}},c)}function oie(e){const{beaconComponent:t,continuous:n,index:r,isLastStep:s,locale:i,nonce:a,onInteract:l,shouldFocus:c,size:d,step:f,styles:u}=e,p=h.useRef(null),m=!!t;h.useEffect(()=>{if(m||document.getElementById("joyride-beacon-animation"))return Kf;const v=document.createElement("style");v.id="joyride-beacon-animation",a&&v.setAttribute("nonce",a),v.appendChild(document.createTextNode(`
|
|
213
|
-
@keyframes joyride-beacon-inner {
|
|
214
|
-
20% {
|
|
215
|
-
opacity: 0.9;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
90% {
|
|
219
|
-
opacity: 0.7;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
@keyframes joyride-beacon-outer {
|
|
224
|
-
0% {
|
|
225
|
-
transform: scale(1);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
45% {
|
|
229
|
-
opacity: 0.7;
|
|
230
|
-
transform: scale(0.75);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
100% {
|
|
234
|
-
opacity: 0.9;
|
|
235
|
-
transform: scale(1);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
`)),document.head.appendChild(v);const y=setTimeout(()=>{Gr.domElement(p.current)&&c&&p.current.focus()},0);return()=>{clearTimeout(y);const k=document.getElementById("joyride-beacon-animation");k!=null&&k.parentNode&&k.parentNode.removeChild(k)}},[m,a,c]);const g=Ko(i.open);let b;if(t){const v=t;b=at.createElement(v,{continuous:n,index:r,isLastStep:s,size:d,step:f})}else b=at.createElement("span",{style:u.beacon},at.createElement("span",{style:u.beaconOuter}),at.createElement("span",{style:u.beaconInner}));return at.createElement("button",{ref:p,"aria-label":g,className:"react-joyride__beacon","data-testid":"button-beacon",onClick:l,onMouseEnter:l,style:u.beaconWrapper,title:g,type:"button"},b)}function aie({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 lie(e){const{backProps:t,closeProps:n,index:r,isLastStep:s,primaryProps:i,skipProps:a,step:l,tooltipProps:c}=e,{buttons:d,content:f,styles:u,title:p}=l,m={};d.includes("primary")&&(m.primary=at.createElement("button",{"data-testid":"button-primary",style:u.buttonPrimary,type:"button",...i})),d.includes("skip")&&!s&&(m.skip=at.createElement("button",{"aria-live":"off","data-testid":"button-skip",style:u.buttonSkip,type:"button",...a})),d.includes("back")&&r>0&&(m.back=at.createElement("button",{"data-testid":"button-back",style:u.buttonBack,type:"button",...t})),m.close=d.includes("close")&&at.createElement(aie,{"data-testid":"button-close",styles:u.buttonClose,...n});const g=p?{"aria-labelledby":"joyride-tooltip-title","aria-describedby":"joyride-tooltip-content"}:{"aria-label":Ko(f),"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:u.tooltip,...c,...g},at.createElement("div",{style:u.tooltipContainer},p&&at.createElement("h4",{id:"joyride-tooltip-title",style:u.tooltipTitle},p),at.createElement("div",{id:"joyride-tooltip-content",style:u.tooltipContent},f)),d.some(b=>b==="back"||b==="primary"||b==="skip")&&at.createElement("div",{style:u.tooltipFooter},at.createElement("div",{style:u.tooltipFooterSpacer},m.skip),m.back,m.primary),m.close)}function cie(e){const{continuous:t,controls:n,index:r,isLastStep:s,size:i,step:a}=e,l=y=>{y.preventDefault(),n.prev(uo.BUTTON_BACK)},c=y=>{y.preventDefault(),a.closeButtonAction==="skip"?n.skip(uo.BUTTON_CLOSE):n.close(uo.BUTTON_CLOSE)},d=y=>{if(y.preventDefault(),!t){n.close(uo.BUTTON_PRIMARY);return}n.next(uo.BUTTON_PRIMARY)},f=y=>{y.preventDefault(),n.skip(uo.BUTTON_SKIP)},u=()=>{const{back:y,close:k,last:w,next:j,nextWithProgress:A,skip:C}=a.locale,$=Ko(y),B=Ko(k),F=Ko(w),z=Ko(j),L=Ko(C);let O=k,W=B;if(t){if(O=j,W=z,a.showProgress&&!s){const M=Ko(A,{step:r+1,steps:i});O=Cb(A,r+1,i),W=M}s&&(O=w,W=F)}return{backProps:{"aria-label":$,children:y,"data-action":"back",onClick:l,role:"button",title:$},closeProps:{"aria-label":B,children:k,"data-action":"close",onClick:c,role:"button",title:B},primaryProps:{"aria-label":W,children:O,"data-action":"primary",onClick:d,role:"button",title:W},skipProps:{"aria-label":L,children:C,"data-action":"skip",onClick:f,role:"button",title:L},tooltipProps:{"aria-modal":!0,role:"alertdialog"}}},{arrowComponent:p,beaconComponent:m,tooltipComponent:g,...b}=a;let v;if(g){const y=g;v=at.createElement(y,{...u(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:b})}else v=at.createElement(lie,{...u(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:b});return v}function uie(e){if(e.startsWith("left"))return["top","bottom"];if(e.startsWith("right"))return["bottom","top"]}function die(e,t,n){var r,s;return e?[mse()]:((r=t.floatingOptions)==null?void 0:r.flipOptions)===!1?[]:[hse({crossAxis:!1,fallbackPlacements:uie(n),padding:20,...(s=t.floatingOptions)==null?void 0:s.flipOptions})]}function fie(e){var R,P,G,Z,V;const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:a,portalElement:l,setPositionData:c,setTooltipRef:d,shouldScroll:f,size:u,step:p,target:m,updateState:g}=e,b=h.useRef(null),v=h.useRef({}),y=h.useRef({}),k=p.placement==="center",w=p.placement==="auto",j=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})}),[]),A=h.useMemo(()=>L2(m)?Xu(m):void 0,[m]),C=h.useMemo(()=>Ju(m),[m]),$=h.useMemo(()=>A?{boundary:A,rootBoundary:"viewport"}:{},[A]),B=k||w?"bottom":p.placement,F=k?"fixed":((R=p.floatingOptions)==null?void 0:R.strategy)??(p.isFixed||C?"fixed":"absolute"),z=h.useMemo(()=>{var se,ue,pe,ge;return k?[{name:"center",fn:({rects:ae})=>({x:(window.innerWidth-ae.floating.width)/2,y:(window.innerHeight-ae.floating.height)/2})}]:[J1(({placement:ae})=>{var we;let be="right";ae.startsWith("top")?be="top":ae.startsWith("bottom")?be="bottom":ae.startsWith("left")&&(be="left");const Pe=p.spotlightTarget?0:p.spotlightPadding[be];return p.offset+Pe+((we=p.floatingOptions)!=null&&we.hideArrow?0:p.arrowSize)},[p.offset,p.spotlightPadding,p.spotlightTarget,p.arrowSize,(se=p.floatingOptions)==null?void 0:se.hideArrow]),...die(w,p,B),pse({padding:10,...$,...(ue=p.floatingOptions)==null?void 0:ue.shiftOptions}),...(pe=p.floatingOptions)!=null&&pe.hideArrow?[]:[gse({element:b,padding:p.arrowSpacing},[p.arrowSpacing,p.arrowBase])],...((ge=p.floatingOptions)==null?void 0:ge.middleware)??[]]},[k,p,w,B,$]),L=X1({...k?{elements:{reference:j}}:{},placement:B,strategy:F,middleware:z}),O=X1({strategy:F,placement:p.beaconPlacement??(w||k?"bottom":p.placement),middleware:h.useMemo(()=>{var se,ue;return[J1(((ue=(se=p.floatingOptions)==null?void 0:se.beaconOptions)==null?void 0:ue.offset)??-18)]},[(G=(P=p.floatingOptions)==null?void 0:P.beaconOptions)==null?void 0:G.offset]),whileElementsMounted:q1});y.current=L.middlewareData,v.current=O.middlewareData,h.useEffect(()=>{var pe;const{floating:se,reference:ue}=L.elements;if(!(!ue||!se||s!==Be.TOOLTIP))return q1(ue,se,L.update,(pe=p.floatingOptions)==null?void 0:pe.autoUpdate)},[s,L.update,(Z=p.floatingOptions)==null?void 0:Z.autoUpdate,p.target,L.elements]),h.useEffect(()=>{!k&&m&&L.refs.setReference(m),m&&O.refs.setReference(m)},[O.refs,k,m,L.refs]),h.useEffect(()=>{L.isPositioned&&c("tooltip",{placement:L.placement,x:L.x??0,y:L.y??0,middlewareData:y.current})},[c,L.isPositioned,L.placement,L.x,L.y]),h.useEffect(()=>{O.isPositioned&&c("beacon",{placement:O.placement,x:O.x??0,y:O.y??0,middlewareData:v.current})},[c,O.isPositioned,O.placement,O.x,O.y]);const W=p.zIndex+100,M=h.useCallback(se=>{se.type==="mouseenter"&&p.beaconTrigger!=="hover"||g({lifecycle:Be.TOOLTIP_BEFORE,positioned:!1})},[p.beaconTrigger,g]),T=h.useCallback(se=>{se&&(L.refs.setFloating(se),d(se))},[L.refs,d]),{arrow:E,floater:D}=p.styles;let _=null;if(s===Be.TOOLTIP||s===Be.TOOLTIP_BEFORE){const se=Z1({...D,...L.floatingStyles,zIndex:W,opacity:a&&L.isPositioned?1:0,...!a&&{transition:"none"}});_=at.createElement("div",{ref:T,className:"react-joyride__floater","data-testid":"floater",id:`react-joyride-step-${r}`,style:se},at.createElement(cie,{continuous:t,controls:n,index:r,isLastStep:r+1===u,size:u,step:p}),!k&&!((V=p.floatingOptions)!=null&&V.hideArrow)&&at.createElement(iie,{arrowComponent:p.arrowComponent,arrowRef:b,base:p.arrowBase,placement:L.placement,position:L.middlewareData.arrow,size:p.arrowSize,styles:E}))}else(s===Be.BEACON||s===Be.BEACON_BEFORE)&&(_=at.createElement("div",{ref:O.refs.setFloating,className:"react-joyride__floater","data-testid":"floater-beacon",id:`react-joyride-step-${r}-beacon`,style:Z1({...O.floatingStyles,zIndex:W})},at.createElement(oie,{beaconComponent:p.beaconComponent,continuous:t,index:r,isLastStep:r+1===u,locale:p.locale,nonce:i,onInteract:M,shouldFocus:f,size:u,step:p,styles:p.styles})));return at.createElement(D2,{element:l},_)}function pie(e){const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,portalElement:a,setPositionData:l,shouldScroll:c,size:d,step:f,updateState:u}=e,[p,m]=h.useState(null);nie(f.disableFocusTrap?null:p,"[data-action=primary]");const g=ci(f.target),b=s===Be.TOOLTIP;return!M2(f)||!Gr.domElement(g)?null:at.createElement(fie,{key:`JoyrideStep-${r}`,continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:b,portalElement:a,setPositionData:l,setTooltipRef:m,shouldScroll:c,size:d,step:f,target:g,updateState:u})}function hie({controls:e,mergedProps:t,state:n,step:r,store:s}){const{continuous:i,debug:a,nonce:l,portalElement:c,scrollToFirstStep:d}=t,f=qse(c),{index:u,lifecycle:p,status:m}=n,g=m===Rt.RUNNING,[b,v]=h.useState(!1),y=h.useRef(null),k=(r==null?void 0:r.loaderDelay)??0;h.useEffect(()=>(n.waiting?k===0?v(!0):y.current=setTimeout(()=>{v(!0)},k):v(!1),()=>{y.current&&(clearTimeout(y.current),y.current=null)}),[k,n.waiting]),h.useEffect(()=>{if(!g)return;const A=C=>{!r||p!==Be.TOOLTIP||C.key==="Escape"&&r.dismissKeyAction&&(r.dismissKeyAction==="next"?e.next(uo.KEYBOARD):e.close(uo.KEYBOARD))};return document.body.addEventListener("keydown",A,{passive:!0}),()=>{document.body.removeEventListener("keydown",A)}},[e,g,p,r]);const w=h.useCallback(()=>{(r==null?void 0:r.overlayClickAction)==="close"?e.close(uo.OVERLAY):(r==null?void 0:r.overlayClickAction)==="next"&&e.next(uo.OVERLAY)},[e,r==null?void 0:r.overlayClickAction]);if(!r||!g)return null;const j=n.action===$t.START&&!r.skipBeacon&&r.placement!=="center";return at.createElement(at.Fragment,null,p!==Be.INIT&&at.createElement(pie,{...n,continuous:i,controls:e,debug:a,nonce:l,portalElement:f,setPositionData:s.current.setPositionData,shouldScroll:!r.skipScroll&&(u!==0||d),step:r,updateState:s.current.updateState}),at.createElement(D2,{element:f},at.createElement(at.Fragment,null,b&&at.createElement(Gse,{nonce:l,step:r}),!j&&at.createElement(eie,{...r,continuous:i,lifecycle:p,onClickOverlay:w,portalElement:c?f:null,scrolling:n.scrolling,waiting:n.waiting}))))}function mie(e){const{controls:t,failures:n,mergedProps:r,state:s,step:i,store:a}=Kse(e);return{controls:t,failures:n,on:h.useCallback((l,c)=>a.current.on(l,c),[a]),state:h.useMemo(()=>ag(s,"positioned"),[s]),step:i,Tour:S0()?at.createElement(hie,{controls:t,mergedProps:r,state:s,step:i,store:a}):null}}function gie(e){const{Tour:t}=mie(e);return t}function yie(e){return S0()?at.createElement(gie,e):null}function xie(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 wie(e){return[{target:"body",content:e("onboarding:flow.intro"),disableBeacon:!0,placement:"center"}]}function bie(e){return[{target:"body",content:e("onboarding:flow.introEmpty"),disableBeacon:!0,placement:"center"}]}const Ax="af:onboarding";function vie({page:e,hasNodes:t=!1}){const{t:n}=kn(),[r,s]=h.useState(!1),[i,a]=h.useState([]),l=h.useRef(null),c=h.useMemo(()=>e==="projects"?xie(n):t?wie(n):bie(n),[e,t,n]);return h.useEffect(()=>{const d=localStorage.getItem(Ax);console.log("[Onboarding] localStorage:",d);const f=d?JSON.parse(d):{};if(console.log("[Onboarding] progress:",f,"page:",e),f.completed||f[e]){console.log("[Onboarding] skipped - already done"),s(!1),a([]);return}console.log("[Onboarding] starting with steps:",c),a(c),s(!0)},[e,t,c]),h.useEffect(()=>{if(!r)return;const d=f=>{var g;const u=f.target.closest("button");if(!u||!u.closest(".react-joyride__tooltip"))return;const m=(g=u.textContent)==null?void 0:g.trim();if(m===n("onboarding:done")||m===n("onboarding:startCreate")||m===n("onboarding:skip")){const b=localStorage.getItem(Ax)||"{}",v=JSON.parse(b);m===n("onboarding:skip")?(v.projects=!0,v.flow=!0,v.completed=!0):v[e]=!0,localStorage.setItem(Ax,JSON.stringify(v)),a([]),s(!1),e==="projects"&&(m===n("onboarding:done")||m===n("onboarding:startCreate"))&&(localStorage.setItem("af:newPipelineGuide","true"),setTimeout(()=>{const y=document.querySelector(".af-create-btn");y&&y.click()},500))}};return document.addEventListener("click",d,!0),()=>document.removeEventListener("click",d,!0)},[r,e,n]),!r||i.length===0?null:o.jsx(yie,{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 kie(){const{navigate:e,path:t}=No(),[n,r]=h.useState([]),[s,i]=h.useState(!1);if(h.useEffect(()=>{let f=!1;const u=async()=>{try{const m=await fetch("/api/pipeline-recent-runs");if(!m.ok)return;const g=await m.json();if(f)return;const b=Array.isArray(g.runs)?g.runs:[];r(b.filter(v=>v&&v.status==="running"))}catch{}};u();const p=window.setInterval(u,3e3);return()=>{f=!0,window.clearInterval(p)}},[]),n.length===0)return null;const a=f=>{const u=new URLSearchParams({flowId:f.flowId,flowSource:f.flowSource||"workspace"});e(`/flow?${u.toString()}`),i(!1)},l=t==="/flow"?new URLSearchParams(window.location.search):null,c=(l==null?void 0:l.get("flowId"))||"",d=n.length===1;return o.jsxs("div",{className:"af-run-indicator",role:"status","aria-live":"polite",children:[s&&!d&&o.jsx("div",{className:"af-run-indicator__menu",onMouseLeave:()=>i(!1),children:n.map(f=>o.jsxs("button",{type:"button",className:"af-run-indicator__item"+(f.flowId===c?" af-run-indicator__item--current":""),onClick:()=>a(f),title:`${f.flowId} · ${f.runId}`,children:[o.jsx("span",{className:"af-run-indicator__dot"}),o.jsx("span",{className:"af-run-indicator__flow",children:f.flowId}),o.jsx("span",{className:"af-run-indicator__run",children:f.runId.slice(0,12)})]},`${f.flowId}:${f.runId}`))}),o.jsxs("button",{type:"button",className:"af-run-indicator__btn",onClick:()=>d?a(n[0]):i(f=>!f),title:d?`${n[0].flowId} 运行中,点击跳转`:`${n.length} 个 pipeline 运行中`,children:[o.jsx("span",{className:"af-run-indicator__pulse"}),o.jsx("span",{className:"af-run-indicator__label",children:d?n[0].flowId:`${n.length} running`})]})]})}class Sie 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 Nie({authUser:e}){const{path:t}=No();return t==="/projects"||t==="/"?o.jsx(Rc,{authUser:e}):t==="/nodes"?o.jsx(Rc,{authUser:e,resourceKind:"nodes"}):t==="/my-nodes"?o.jsx(Rc,{authUser:e,resourceKind:"my-nodes"}):t==="/my-flows"?o.jsx(Rc,{authUser:e,resourceKind:"my-flows"}):t==="/skills"?o.jsx(Rc,{authUser:e,resourceKind:"skills"}):t==="/mcps"?o.jsx(dne,{}):t==="/flow"?o.jsx(C7,{}):t==="/workspace"?o.jsx(Hq,{}):t.startsWith("/display")?o.jsx(t2,{}):t==="/settings"?o.jsx(lne,{authUser:e}):t==="/feedback"?o.jsx(cne,{}):o.jsx(Rc,{})}function jie({children:e}){const[t,n]=h.useState({loading:!0,authenticated:!1,user:null,setupRequired:!1}),[r,s]=h.useState(""),[i,a]=h.useState(""),[l,c]=h.useState(!1),[d,f]=h.useState(""),u=async()=>{try{const g=await(await fetch("/api/auth/me")).json().catch(()=>({}));n({loading:!1,authenticated:!!g.authenticated,user:g.user||null,setupRequired:!!g.setupRequired}),f(g.error?String(g.error):"")}catch(m){n({loading:!1,authenticated:!1,user:null,setupRequired:!1}),f(String(m.message||m))}};h.useEffect(()=>{u()},[]);const p=async m=>{m.preventDefault(),c(!0),f("");try{const g=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,password:i})}),b=await g.json().catch(()=>({}));if(!g.ok)throw new Error(b.error||"登录失败");n({loading:!1,authenticated:!0,user:b.user||null,setupRequired:!1})}catch(g){f(String(g.message||g))}finally{c(!1)}};return t.loading?o.jsx("div",{className:"af-auth-screen",children:o.jsx("div",{className:"af-auth-panel",children:"Loading..."})}):t.authenticated?e({user:t.user,onLogout:async()=>{await fetch("/api/auth/logout",{method:"POST"}).catch(()=>{}),n({loading:!1,authenticated:!1,user:null,setupRequired:!1})}}):o.jsx("div",{className:"af-auth-screen",children:o.jsxs("form",{className:"af-auth-panel",onSubmit:p,children:[o.jsxs("div",{className:"af-auth-brand",children:[o.jsx("span",{className:"material-symbols-outlined",children:"account_circle"}),o.jsxs("div",{children:[o.jsx("h1",{children:"AgentFlow"}),o.jsx("p",{children:t.setupRequired?"初始化管理员账号":"登录或创建用户"})]})]}),o.jsxs("label",{className:"af-auth-field",children:[o.jsx("span",{children:"用户名"}),o.jsx("input",{value:r,onChange: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 Cie({authUser:e,onLogout:t}){const{path:n}=No(),r=n==="/flow"||n==="/workspace";return o.jsxs("div",{className:"af-app",children:[n!=="/settings"?o.jsx(vie,{page:r?"flow":"projects"}):null,r?null:o.jsx(pM,{authUser:e,onLogout:t}),o.jsx("div",{className:r?"af-main af-main--pipeline":"af-main",children:o.jsx(Nie,{authUser:e})}),o.jsx(kie,{})]})}function Eie(){return o.jsx(Sie,{children:o.jsx(YO,{children:o.jsx(_ie,{})})})}function _ie(){const{path:e}=No();return e.startsWith("/display")?o.jsx(t2,{}):o.jsx(jie,{children:({user:t,onLogout:n})=>o.jsx(Cie,{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 iC=document.querySelector('link[rel="icon"]');iC&&(iC.href=v_);Ix.createRoot(document.getElementById("root")).render(o.jsx(at.StrictMode,{children:o.jsx(Eie,{})}));
|