@fieldwangai/agentflow 0.1.92 → 0.1.93
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 +2948 -159
- package/builtin/web-ui/dist/assets/index-DV-QkHHi.css +1 -0
- package/builtin/web-ui/dist/assets/index-Dtmpup-L.js +346 -0
- package/builtin/web-ui/dist/index.html +2 -2
- package/package.json +1 -1
- package/skills/agentflow-cli/SKILL.md +133 -0
- package/skills/agentflow-cli/agents/openai.yaml +4 -0
- package/skills/agentflow-cli/scripts/agentflow-cli.mjs +341 -0
- package/builtin/web-ui/dist/assets/index-CSBbCP8S.css +0 -1
- package/builtin/web-ui/dist/assets/index-Dk3al84f.js +0 -341
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
var bR=Object.defineProperty;var kR=(e,t,n)=>t in e?bR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Nn=(e,t,n)=>kR(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 uu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Po(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var y1={exports:{}},ih={},x1={exports:{}},Ct={};/**
|
|
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 Gu=Symbol.for("react.element"),vR=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"),_R=Symbol.for("react.context"),ER=Symbol.for("react.forward_ref"),AR=Symbol.for("react.suspense"),PR=Symbol.for("react.memo"),IR=Symbol.for("react.lazy"),xv=Symbol.iterator;function TR(e){return e===null||typeof e!="object"?null:(e=xv&&e[xv]||e["@@iterator"],typeof e=="function"?e:null)}var w1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b1=Object.assign,k1={};function Kl(e,t,n){this.props=e,this.context=t,this.refs=k1,this.updater=n||w1}Kl.prototype.isReactComponent={};Kl.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")};Kl.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function v1(){}v1.prototype=Kl.prototype;function $x(e,t,n){this.props=e,this.context=t,this.refs=k1,this.updater=n||w1}var Lx=$x.prototype=new v1;Lx.constructor=$x;b1(Lx,Kl.prototype);Lx.isPureReactComponent=!0;var wv=Array.isArray,S1=Object.prototype.hasOwnProperty,Ox={current:null},N1={key:!0,ref:!0,__self:!0,__source:!0};function j1(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)S1.call(t,r)&&!N1.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),u=0;u<l;u++)c[u]=arguments[u+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:Gu,type:e,key:i,ref:a,props:s,_owner:Ox.current}}function RR(e,t){return{$$typeof:Gu,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Dx(e){return typeof e=="object"&&e!==null&&e.$$typeof===Gu}function MR(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var bv=/\/+/g;function ym(e,t){return typeof e=="object"&&e!==null&&e.key!=null?MR(""+e.key):t.toString(36)}function Mf(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 Gu:case vR:a=!0}}if(a)return a=e,s=s(a),e=r===""?"."+ym(a,0):r,wv(s)?(n="",e!=null&&(n=e.replace(bv,"$&/")+"/"),Mf(s,t,n,"",function(u){return u})):s!=null&&(Dx(s)&&(s=RR(s,n+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(bv,"$&/")+"/")+e)),t.push(s)),1;if(a=0,r=r===""?".":r+":",wv(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+ym(i,l);a+=Mf(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+ym(i,l++),a+=Mf(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 Fd(e,t,n){if(e==null)return e;var r=[],s=0;return Mf(e,r,"","",function(i){return t.call(n,i,s++)}),r}function $R(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 jr={current:null},$f={transition:null},LR={ReactCurrentDispatcher:jr,ReactCurrentBatchConfig:$f,ReactCurrentOwner:Ox};function C1(){throw Error("act(...) is not supported in production builds of React.")}Ct.Children={map:Fd,forEach:function(e,t,n){Fd(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Fd(e,function(){t++}),t},toArray:function(e){return Fd(e,function(t){return t})||[]},only:function(e){if(!Dx(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ct.Component=Kl;Ct.Fragment=SR;Ct.Profiler=jR;Ct.PureComponent=$x;Ct.StrictMode=NR;Ct.Suspense=AR;Ct.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=LR;Ct.act=C1;Ct.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=b1({},e.props),s=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=Ox.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)S1.call(t,c)&&!N1.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 u=0;u<c;u++)l[u]=arguments[u+2];r.children=l}return{$$typeof:Gu,type:e.type,key:s,ref:i,props:r,_owner:a}};Ct.createContext=function(e){return e={$$typeof:_R,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:CR,_context:e},e.Consumer=e};Ct.createElement=j1;Ct.createFactory=function(e){var t=j1.bind(null,e);return t.type=e,t};Ct.createRef=function(){return{current:null}};Ct.forwardRef=function(e){return{$$typeof:ER,render:e}};Ct.isValidElement=Dx;Ct.lazy=function(e){return{$$typeof:IR,_payload:{_status:-1,_result:e},_init:$R}};Ct.memo=function(e,t){return{$$typeof:PR,type:e,compare:t===void 0?null:t}};Ct.startTransition=function(e){var t=$f.transition;$f.transition={};try{e()}finally{$f.transition=t}};Ct.unstable_act=C1;Ct.useCallback=function(e,t){return jr.current.useCallback(e,t)};Ct.useContext=function(e){return jr.current.useContext(e)};Ct.useDebugValue=function(){};Ct.useDeferredValue=function(e){return jr.current.useDeferredValue(e)};Ct.useEffect=function(e,t){return jr.current.useEffect(e,t)};Ct.useId=function(){return jr.current.useId()};Ct.useImperativeHandle=function(e,t,n){return jr.current.useImperativeHandle(e,t,n)};Ct.useInsertionEffect=function(e,t){return jr.current.useInsertionEffect(e,t)};Ct.useLayoutEffect=function(e,t){return jr.current.useLayoutEffect(e,t)};Ct.useMemo=function(e,t){return jr.current.useMemo(e,t)};Ct.useReducer=function(e,t,n){return jr.current.useReducer(e,t,n)};Ct.useRef=function(e){return jr.current.useRef(e)};Ct.useState=function(e){return jr.current.useState(e)};Ct.useSyncExternalStore=function(e,t,n){return jr.current.useSyncExternalStore(e,t,n)};Ct.useTransition=function(){return jr.current.useTransition()};Ct.version="18.3.1";x1.exports=Ct;var m=x1.exports;const it=Po(m);/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.production.min.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var OR=m,DR=Symbol.for("react.element"),FR=Symbol.for("react.fragment"),zR=Object.prototype.hasOwnProperty,BR=OR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,HR={key:!0,ref:!0,__self:!0,__source:!0};function _1(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}}ih.Fragment=FR;ih.jsx=_1;ih.jsxs=_1;y1.exports=ih;var o=y1.exports,Fg={},E1={exports:{}},ns={},A1={exports:{}},P1={};/**
|
|
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(I,B){var _=I.length;I.push(B);e:for(;0<_;){var q=_-1>>>1,z=I[q];if(0<s(z,B))I[q]=B,I[_]=z,_=q;else break e}}function n(I){return I.length===0?null:I[0]}function r(I){if(I.length===0)return null;var B=I[0],_=I.pop();if(_!==B){I[0]=_;e:for(var q=0,z=I.length,$=z>>>1;q<$;){var Q=2*(q+1)-1,te=I[Q],ie=Q+1,he=I[ie];if(0>s(te,_))ie<z&&0>s(he,te)?(I[q]=he,I[ie]=_,q=ie):(I[q]=te,I[Q]=_,q=Q);else if(ie<z&&0>s(he,_))I[q]=he,I[ie]=_,q=ie;else break e}}return B}function s(I,B){var _=I.sortIndex-B.sortIndex;return _!==0?_:I.id-B.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=[],u=[],p=1,f=null,d=3,h=!1,y=!1,w=!1,b=typeof setTimeout=="function"?setTimeout:null,g=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 x(I){for(var B=n(u);B!==null;){if(B.callback===null)r(u);else if(B.startTime<=I)r(u),B.sortIndex=B.expirationTime,t(c,B);else break;B=n(u)}}function S(I){if(w=!1,x(I),!y)if(n(c)!==null)y=!0,F(C);else{var B=n(u);B!==null&&M(S,B.startTime-I)}}function C(I,B){y=!1,w&&(w=!1,g(A),A=-1),h=!0;var _=d;try{for(x(B),f=n(c);f!==null&&(!(f.expirationTime>B)||I&&!H());){var q=f.callback;if(typeof q=="function"){f.callback=null,d=f.priorityLevel;var z=q(f.expirationTime<=B);B=e.unstable_now(),typeof z=="function"?f.callback=z:f===n(c)&&r(c),x(B)}else r(c);f=n(c)}if(f!==null)var $=!0;else{var Q=n(u);Q!==null&&M(S,Q.startTime-B),$=!1}return $}finally{f=null,d=_,h=!1}}var j=!1,E=null,A=-1,O=5,W=-1;function H(){return!(e.unstable_now()-W<O)}function D(){if(E!==null){var I=e.unstable_now();W=I;var B=!0;try{B=E(!0,I)}finally{B?R():(j=!1,E=null)}}else j=!1}var R;if(typeof k=="function")R=function(){k(D)};else if(typeof MessageChannel<"u"){var T=new MessageChannel,V=T.port2;T.port1.onmessage=D,R=function(){V.postMessage(null)}}else R=function(){b(D,0)};function F(I){E=I,j||(j=!0,R())}function M(I,B){A=b(function(){I(e.unstable_now())},B)}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(I){I.callback=null},e.unstable_continueExecution=function(){y||h||(y=!0,F(C))},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return d},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(I){switch(d){case 1:case 2:case 3:var B=3;break;default:B=d}var _=d;d=B;try{return I()}finally{d=_}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(I,B){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var _=d;d=I;try{return B()}finally{d=_}},e.unstable_scheduleCallback=function(I,B,_){var q=e.unstable_now();switch(typeof _=="object"&&_!==null?(_=_.delay,_=typeof _=="number"&&0<_?q+_:q):_=q,I){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=_+z,I={id:p++,callback:B,priorityLevel:I,startTime:_,expirationTime:z,sortIndex:-1},_>q?(I.sortIndex=_,t(u,I),n(c)===null&&I===n(u)&&(w?(g(A),A=-1):w=!0,M(S,_-q))):(I.sortIndex=z,t(c,I),y||h||(y=!0,F(C))),I},e.unstable_shouldYield=H,e.unstable_wrapCallback=function(I){var B=d;return function(){var _=d;d=B;try{return I.apply(this,arguments)}finally{d=_}}}})(P1);A1.exports=P1;var WR=A1.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=m,es=WR;function Ce(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 I1=new Set,du={};function ja(e,t){_l(e,t),_l(e+"Capture",t)}function _l(e,t){for(du[e]=t,e=0;e<t.length;e++)I1.add(t[e])}var Ii=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),zg=Object.prototype.hasOwnProperty,KR=/^[: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]*$/,kv={},vv={};function UR(e){return zg.call(vv,e)?!0:zg.call(kv,e)?!1:KR.test(e)?vv[e]=!0:(kv[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 Cr(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 rr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){rr[e]=new Cr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];rr[t]=new Cr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){rr[e]=new Cr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){rr[e]=new Cr(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){rr[e]=new Cr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){rr[e]=new Cr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){rr[e]=new Cr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){rr[e]=new Cr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){rr[e]=new Cr(e,5,!1,e.toLowerCase(),null,!1,!1)});var Fx=/[\-:]([a-z])/g;function zx(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(Fx,zx);rr[t]=new Cr(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(Fx,zx);rr[t]=new Cr(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(Fx,zx);rr[t]=new Cr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){rr[e]=new Cr(e,1,!1,e.toLowerCase(),null,!1,!1)});rr.xlinkHref=new Cr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){rr[e]=new Cr(e,1,!1,e.toLowerCase(),null,!0,!0)});function Bx(e,t,n,r){var s=rr.hasOwnProperty(t)?rr[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?UR(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 Oi=VR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,zd=Symbol.for("react.element"),Xa=Symbol.for("react.portal"),Qa=Symbol.for("react.fragment"),Hx=Symbol.for("react.strict_mode"),Bg=Symbol.for("react.profiler"),T1=Symbol.for("react.provider"),R1=Symbol.for("react.context"),Wx=Symbol.for("react.forward_ref"),Hg=Symbol.for("react.suspense"),Wg=Symbol.for("react.suspense_list"),Vx=Symbol.for("react.memo"),ro=Symbol.for("react.lazy"),M1=Symbol.for("react.offscreen"),Sv=Symbol.iterator;function gc(e){return e===null||typeof e!="object"?null:(e=Sv&&e[Sv]||e["@@iterator"],typeof e=="function"?e:null)}var kn=Object.assign,xm;function $c(e){if(xm===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);xm=t&&t[1]||""}return`
|
|
34
|
-
`+xm+e}var wm=!1;function bm(e,t){if(!e||wm)return"";wm=!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(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var s=u.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{wm=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?$c(e):""}function GR(e){switch(e.tag){case 5:return $c(e.type);case 16:return $c("Lazy");case 13:return $c("Suspense");case 19:return $c("SuspenseList");case 0:case 2:case 15:return e=bm(e.type,!1),e;case 11:return e=bm(e.type.render,!1),e;case 1:return e=bm(e.type,!0),e;default:return""}}function Vg(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 Qa:return"Fragment";case Xa:return"Portal";case Bg:return"Profiler";case Hx:return"StrictMode";case Hg:return"Suspense";case Wg:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case R1:return(e.displayName||"Context")+".Consumer";case T1:return(e._context.displayName||"Context")+".Provider";case Wx:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Vx:return t=e.displayName||null,t!==null?t:Vg(e.type)||"Memo";case ro:t=e._payload,e=e._init;try{return Vg(e(t))}catch{}}return null}function JR(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 Vg(t);case 8:return t===Hx?"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 jo(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function $1(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function XR(e){var t=$1(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(a){r=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Bd(e){e._valueTracker||(e._valueTracker=XR(e))}function L1(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=$1(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function sp(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 Kg(e,t){var n=t.checked;return kn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Nv(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=jo(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 O1(e,t){t=t.checked,t!=null&&Bx(e,"checked",t,!1)}function Ug(e,t){O1(e,t);var n=jo(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")?qg(e,t.type,n):t.hasOwnProperty("defaultValue")&&qg(e,t.type,jo(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function jv(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 qg(e,t,n){(t!=="number"||sp(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Lc=Array.isArray;function hl(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=""+jo(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 Yg(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Ce(91));return kn({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Cv(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Ce(92));if(Lc(n)){if(1<n.length)throw Error(Ce(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:jo(n)}}function D1(e,t){var n=jo(t.value),r=jo(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 _v(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function F1(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 Gg(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?F1(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Hd,z1=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(Hd=Hd||document.createElement("div"),Hd.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Hd.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function fu(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Kc={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(Kc).forEach(function(e){QR.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Kc[t]=Kc[e]})});function B1(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Kc.hasOwnProperty(e)&&Kc[e]?(""+t).trim():t+"px"}function H1(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=B1(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var ZR=kn({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 Jg(e,t){if(t){if(ZR[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Ce(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Ce(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Ce(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Ce(62))}}function Xg(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 Qg=null;function Kx(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Zg=null,ml=null,gl=null;function Ev(e){if(e=Qu(e)){if(typeof Zg!="function")throw Error(Ce(280));var t=e.stateNode;t&&(t=uh(t),Zg(e.stateNode,e.type,t))}}function W1(e){ml?gl?gl.push(e):gl=[e]:ml=e}function V1(){if(ml){var e=ml,t=gl;if(gl=ml=null,Ev(e),t)for(e=0;e<t.length;e++)Ev(t[e])}}function K1(e,t){return e(t)}function U1(){}var km=!1;function q1(e,t,n){if(km)return e(t,n);km=!0;try{return K1(e,t,n)}finally{km=!1,(ml!==null||gl!==null)&&(U1(),V1())}}function pu(e,t){var n=e.stateNode;if(n===null)return null;var r=uh(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(Ce(231,t,typeof n));return n}var ey=!1;if(Ii)try{var yc={};Object.defineProperty(yc,"passive",{get:function(){ey=!0}}),window.addEventListener("test",yc,yc),window.removeEventListener("test",yc,yc)}catch{ey=!1}function eM(e,t,n,r,s,i,a,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(p){this.onError(p)}}var Uc=!1,ip=null,op=!1,ty=null,tM={onError:function(e){Uc=!0,ip=e}};function nM(e,t,n,r,s,i,a,l,c){Uc=!1,ip=null,eM.apply(tM,arguments)}function rM(e,t,n,r,s,i,a,l,c){if(nM.apply(this,arguments),Uc){if(Uc){var u=ip;Uc=!1,ip=null}else throw Error(Ce(198));op||(op=!0,ty=u)}}function Ca(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 Y1(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 Av(e){if(Ca(e)!==e)throw Error(Ce(188))}function sM(e){var t=e.alternate;if(!t){if(t=Ca(e),t===null)throw Error(Ce(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 Av(s),e;if(i===r)return Av(s),t;i=i.sibling}throw Error(Ce(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(Ce(189))}}if(n.alternate!==r)throw Error(Ce(190))}if(n.tag!==3)throw Error(Ce(188));return n.stateNode.current===n?e:t}function G1(e){return e=sM(e),e!==null?J1(e):null}function J1(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=J1(e);if(t!==null)return t;e=e.sibling}return null}var X1=es.unstable_scheduleCallback,Pv=es.unstable_cancelCallback,iM=es.unstable_shouldYield,oM=es.unstable_requestPaint,Tn=es.unstable_now,aM=es.unstable_getCurrentPriorityLevel,Ux=es.unstable_ImmediatePriority,Q1=es.unstable_UserBlockingPriority,ap=es.unstable_NormalPriority,lM=es.unstable_LowPriority,Z1=es.unstable_IdlePriority,oh=null,ti=null;function cM(e){if(ti&&typeof ti.onCommitFiberRoot=="function")try{ti.onCommitFiberRoot(oh,e,void 0,(e.current.flags&128)===128)}catch{}}var Ms=Math.clz32?Math.clz32:fM,uM=Math.log,dM=Math.LN2;function fM(e){return e>>>=0,e===0?32:31-(uM(e)/dM|0)|0}var Wd=64,Vd=4194304;function Oc(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 lp(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=Oc(l):(i&=a,i!==0&&(r=Oc(i)))}else a=n&~s,a!==0?r=Oc(a):i!==0&&(r=Oc(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-Ms(t),s=1<<n,r|=e[n],t&=~s;return r}function pM(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 hM(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-Ms(i),l=1<<a,c=s[a];c===-1?(!(l&n)||l&r)&&(s[a]=pM(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function ny(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function eC(){var e=Wd;return Wd<<=1,!(Wd&4194240)&&(Wd=64),e}function vm(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ju(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ms(t),e[t]=n}function mM(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-Ms(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function qx(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ms(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var qt=0;function tC(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var nC,Yx,rC,sC,iC,ry=!1,Kd=[],ho=null,mo=null,go=null,hu=new Map,mu=new Map,oo=[],gM="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 Iv(e,t){switch(e){case"focusin":case"focusout":ho=null;break;case"dragenter":case"dragleave":mo=null;break;case"mouseover":case"mouseout":go=null;break;case"pointerover":case"pointerout":hu.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":mu.delete(t.pointerId)}}function xc(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=Qu(t),t!==null&&Yx(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function yM(e,t,n,r,s){switch(t){case"focusin":return ho=xc(ho,e,t,n,r,s),!0;case"dragenter":return mo=xc(mo,e,t,n,r,s),!0;case"mouseover":return go=xc(go,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return hu.set(i,xc(hu.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,mu.set(i,xc(mu.get(i)||null,e,t,n,r,s)),!0}return!1}function oC(e){var t=Xo(e.target);if(t!==null){var n=Ca(t);if(n!==null){if(t=n.tag,t===13){if(t=Y1(n),t!==null){e.blockedOn=t,iC(e.priority,function(){rC(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 Lf(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=sy(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Qg=r,n.target.dispatchEvent(r),Qg=null}else return t=Qu(n),t!==null&&Yx(t),e.blockedOn=n,!1;t.shift()}return!0}function Tv(e,t,n){Lf(e)&&n.delete(t)}function xM(){ry=!1,ho!==null&&Lf(ho)&&(ho=null),mo!==null&&Lf(mo)&&(mo=null),go!==null&&Lf(go)&&(go=null),hu.forEach(Tv),mu.forEach(Tv)}function wc(e,t){e.blockedOn===t&&(e.blockedOn=null,ry||(ry=!0,es.unstable_scheduleCallback(es.unstable_NormalPriority,xM)))}function gu(e){function t(s){return wc(s,e)}if(0<Kd.length){wc(Kd[0],e);for(var n=1;n<Kd.length;n++){var r=Kd[n];r.blockedOn===e&&(r.blockedOn=null)}}for(ho!==null&&wc(ho,e),mo!==null&&wc(mo,e),go!==null&&wc(go,e),hu.forEach(t),mu.forEach(t),n=0;n<oo.length;n++)r=oo[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<oo.length&&(n=oo[0],n.blockedOn===null);)oC(n),n.blockedOn===null&&oo.shift()}var yl=Oi.ReactCurrentBatchConfig,cp=!0;function wM(e,t,n,r){var s=qt,i=yl.transition;yl.transition=null;try{qt=1,Gx(e,t,n,r)}finally{qt=s,yl.transition=i}}function bM(e,t,n,r){var s=qt,i=yl.transition;yl.transition=null;try{qt=4,Gx(e,t,n,r)}finally{qt=s,yl.transition=i}}function Gx(e,t,n,r){if(cp){var s=sy(e,t,n,r);if(s===null)Tm(e,t,r,up,n),Iv(e,r);else if(yM(s,e,t,n,r))r.stopPropagation();else if(Iv(e,r),t&4&&-1<gM.indexOf(e)){for(;s!==null;){var i=Qu(s);if(i!==null&&nC(i),i=sy(e,t,n,r),i===null&&Tm(e,t,r,up,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Tm(e,t,r,null,n)}}var up=null;function sy(e,t,n,r){if(up=null,e=Kx(r),e=Xo(e),e!==null)if(t=Ca(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Y1(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 up=e,null}function aC(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(aM()){case Ux:return 1;case Q1:return 4;case ap:case lM:return 16;case Z1:return 536870912;default:return 16}default:return 16}}var co=null,Jx=null,Of=null;function lC(){if(Of)return Of;var e,t=Jx,n=t.length,r,s="value"in co?co.value:co.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 Of=s.slice(e,1<r?1-r:void 0)}function Df(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 Ud(){return!0}function Rv(){return!1}function rs(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)?Ud:Rv,this.isPropagationStopped=Rv,this}return kn(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=Ud)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ud)},persist:function(){},isPersistent:Ud}),t}var Ul={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Xx=rs(Ul),Xu=kn({},Ul,{view:0,detail:0}),kM=rs(Xu),Sm,Nm,bc,ah=kn({},Xu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qx,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!==bc&&(bc&&e.type==="mousemove"?(Sm=e.screenX-bc.screenX,Nm=e.screenY-bc.screenY):Nm=Sm=0,bc=e),Sm)},movementY:function(e){return"movementY"in e?e.movementY:Nm}}),Mv=rs(ah),vM=kn({},ah,{dataTransfer:0}),SM=rs(vM),NM=kn({},Xu,{relatedTarget:0}),jm=rs(NM),jM=kn({},Ul,{animationName:0,elapsedTime:0,pseudoElement:0}),CM=rs(jM),_M=kn({},Ul,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),EM=rs(_M),AM=kn({},Ul,{data:0}),$v=rs(AM),PM={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},IM={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"},TM={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function RM(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=TM[e])?!!t[e]:!1}function Qx(){return RM}var MM=kn({},Xu,{key:function(e){if(e.key){var t=PM[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Df(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?IM[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qx,charCode:function(e){return e.type==="keypress"?Df(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Df(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),$M=rs(MM),LM=kn({},ah,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lv=rs(LM),OM=kn({},Xu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qx}),DM=rs(OM),FM=kn({},Ul,{propertyName:0,elapsedTime:0,pseudoElement:0}),zM=rs(FM),BM=kn({},ah,{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}),HM=rs(BM),WM=[9,13,27,32],Zx=Ii&&"CompositionEvent"in window,qc=null;Ii&&"documentMode"in document&&(qc=document.documentMode);var VM=Ii&&"TextEvent"in window&&!qc,cC=Ii&&(!Zx||qc&&8<qc&&11>=qc),Ov=" ",Dv=!1;function uC(e,t){switch(e){case"keyup":return WM.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function dC(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Za=!1;function KM(e,t){switch(e){case"compositionend":return dC(t);case"keypress":return t.which!==32?null:(Dv=!0,Ov);case"textInput":return e=t.data,e===Ov&&Dv?null:e;default:return null}}function UM(e,t){if(Za)return e==="compositionend"||!Zx&&uC(e,t)?(e=lC(),Of=Jx=co=null,Za=!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 cC&&t.locale!=="ko"?null:t.data;default:return null}}var qM={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 Fv(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!qM[e.type]:t==="textarea"}function fC(e,t,n,r){W1(r),t=dp(t,"onChange"),0<t.length&&(n=new Xx("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Yc=null,yu=null;function YM(e){SC(e,0)}function lh(e){var t=nl(e);if(L1(t))return e}function GM(e,t){if(e==="change")return t}var pC=!1;if(Ii){var Cm;if(Ii){var _m="oninput"in document;if(!_m){var zv=document.createElement("div");zv.setAttribute("oninput","return;"),_m=typeof zv.oninput=="function"}Cm=_m}else Cm=!1;pC=Cm&&(!document.documentMode||9<document.documentMode)}function Bv(){Yc&&(Yc.detachEvent("onpropertychange",hC),yu=Yc=null)}function hC(e){if(e.propertyName==="value"&&lh(yu)){var t=[];fC(t,yu,e,Kx(e)),q1(YM,t)}}function JM(e,t,n){e==="focusin"?(Bv(),Yc=t,yu=n,Yc.attachEvent("onpropertychange",hC)):e==="focusout"&&Bv()}function XM(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return lh(yu)}function QM(e,t){if(e==="click")return lh(t)}function ZM(e,t){if(e==="input"||e==="change")return lh(t)}function e2(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Os=typeof Object.is=="function"?Object.is:e2;function xu(e,t){if(Os(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(!zg.call(t,s)||!Os(e[s],t[s]))return!1}return!0}function Hv(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Wv(e,t){var n=Hv(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=Hv(n)}}function mC(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?mC(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function gC(){for(var e=window,t=sp();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=sp(e.document)}return t}function ew(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 t2(e){var t=gC(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&mC(n.ownerDocument.documentElement,n)){if(r!==null&&ew(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=Wv(n,i);var a=Wv(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 n2=Ii&&"documentMode"in document&&11>=document.documentMode,el=null,iy=null,Gc=null,oy=!1;function Vv(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;oy||el==null||el!==sp(r)||(r=el,"selectionStart"in r&&ew(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}),Gc&&xu(Gc,r)||(Gc=r,r=dp(iy,"onSelect"),0<r.length&&(t=new Xx("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=el)))}function qd(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var tl={animationend:qd("Animation","AnimationEnd"),animationiteration:qd("Animation","AnimationIteration"),animationstart:qd("Animation","AnimationStart"),transitionend:qd("Transition","TransitionEnd")},Em={},yC={};Ii&&(yC=document.createElement("div").style,"AnimationEvent"in window||(delete tl.animationend.animation,delete tl.animationiteration.animation,delete tl.animationstart.animation),"TransitionEvent"in window||delete tl.transitionend.transition);function ch(e){if(Em[e])return Em[e];if(!tl[e])return e;var t=tl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in yC)return Em[e]=t[n];return e}var xC=ch("animationend"),wC=ch("animationiteration"),bC=ch("animationstart"),kC=ch("transitionend"),vC=new Map,Kv="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 Io(e,t){vC.set(e,t),ja(t,[e])}for(var Am=0;Am<Kv.length;Am++){var Pm=Kv[Am],r2=Pm.toLowerCase(),s2=Pm[0].toUpperCase()+Pm.slice(1);Io(r2,"on"+s2)}Io(xC,"onAnimationEnd");Io(wC,"onAnimationIteration");Io(bC,"onAnimationStart");Io("dblclick","onDoubleClick");Io("focusin","onFocus");Io("focusout","onBlur");Io(kC,"onTransitionEnd");_l("onMouseEnter",["mouseout","mouseover"]);_l("onMouseLeave",["mouseout","mouseover"]);_l("onPointerEnter",["pointerout","pointerover"]);_l("onPointerLeave",["pointerout","pointerover"]);ja("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ja("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ja("onBeforeInput",["compositionend","keypress","textInput","paste"]);ja("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ja("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ja("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Dc="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(" "),i2=new Set("cancel close invalid load scroll toggle".split(" ").concat(Dc));function Uv(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,rM(r,t,void 0,e),e.currentTarget=null}function SC(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,u=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;Uv(s,l,u),i=c}else for(a=0;a<r.length;a++){if(l=r[a],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;Uv(s,l,u),i=c}}}if(op)throw e=ty,op=!1,ty=null,e}function an(e,t){var n=t[dy];n===void 0&&(n=t[dy]=new Set);var r=e+"__bubble";n.has(r)||(NC(t,e,2,!1),n.add(r))}function Im(e,t,n){var r=0;t&&(r|=4),NC(n,e,r,t)}var Yd="_reactListening"+Math.random().toString(36).slice(2);function wu(e){if(!e[Yd]){e[Yd]=!0,I1.forEach(function(n){n!=="selectionchange"&&(i2.has(n)||Im(n,!1,e),Im(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Yd]||(t[Yd]=!0,Im("selectionchange",!1,t))}}function NC(e,t,n,r){switch(aC(t)){case 1:var s=wM;break;case 4:s=bM;break;default:s=Gx}n=s.bind(null,t,n,e),s=void 0,!ey||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 Tm(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=Xo(l),a===null)return;if(c=a.tag,c===5||c===6){r=i=a;continue e}l=l.parentNode}}r=r.return}q1(function(){var u=i,p=Kx(n),f=[];e:{var d=vC.get(e);if(d!==void 0){var h=Xx,y=e;switch(e){case"keypress":if(Df(n)===0)break e;case"keydown":case"keyup":h=$M;break;case"focusin":y="focus",h=jm;break;case"focusout":y="blur",h=jm;break;case"beforeblur":case"afterblur":h=jm;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=Mv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=SM;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=DM;break;case xC:case wC:case bC:h=CM;break;case kC:h=zM;break;case"scroll":h=kM;break;case"wheel":h=HM;break;case"copy":case"cut":case"paste":h=EM;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=Lv}var w=(t&4)!==0,b=!w&&e==="scroll",g=w?d!==null?d+"Capture":null:d;w=[];for(var k=u,x;k!==null;){x=k;var S=x.stateNode;if(x.tag===5&&S!==null&&(x=S,g!==null&&(S=pu(k,g),S!=null&&w.push(bu(k,S,x)))),b)break;k=k.return}0<w.length&&(d=new h(d,y,null,n,p),f.push({event:d,listeners:w}))}}if(!(t&7)){e:{if(d=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",d&&n!==Qg&&(y=n.relatedTarget||n.fromElement)&&(Xo(y)||y[Ti]))break e;if((h||d)&&(d=p.window===p?p:(d=p.ownerDocument)?d.defaultView||d.parentWindow:window,h?(y=n.relatedTarget||n.toElement,h=u,y=y?Xo(y):null,y!==null&&(b=Ca(y),y!==b||y.tag!==5&&y.tag!==6)&&(y=null)):(h=null,y=u),h!==y)){if(w=Mv,S="onMouseLeave",g="onMouseEnter",k="mouse",(e==="pointerout"||e==="pointerover")&&(w=Lv,S="onPointerLeave",g="onPointerEnter",k="pointer"),b=h==null?d:nl(h),x=y==null?d:nl(y),d=new w(S,k+"leave",h,n,p),d.target=b,d.relatedTarget=x,S=null,Xo(p)===u&&(w=new w(g,k+"enter",y,n,p),w.target=x,w.relatedTarget=b,S=w),b=S,h&&y)t:{for(w=h,g=y,k=0,x=w;x;x=Ba(x))k++;for(x=0,S=g;S;S=Ba(S))x++;for(;0<k-x;)w=Ba(w),k--;for(;0<x-k;)g=Ba(g),x--;for(;k--;){if(w===g||g!==null&&w===g.alternate)break t;w=Ba(w),g=Ba(g)}w=null}else w=null;h!==null&&qv(f,d,h,w,!1),y!==null&&b!==null&&qv(f,b,y,w,!0)}}e:{if(d=u?nl(u):window,h=d.nodeName&&d.nodeName.toLowerCase(),h==="select"||h==="input"&&d.type==="file")var C=GM;else if(Fv(d))if(pC)C=ZM;else{C=XM;var j=JM}else(h=d.nodeName)&&h.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(C=QM);if(C&&(C=C(e,u))){fC(f,C,n,p);break e}j&&j(e,d,u),e==="focusout"&&(j=d._wrapperState)&&j.controlled&&d.type==="number"&&qg(d,"number",d.value)}switch(j=u?nl(u):window,e){case"focusin":(Fv(j)||j.contentEditable==="true")&&(el=j,iy=u,Gc=null);break;case"focusout":Gc=iy=el=null;break;case"mousedown":oy=!0;break;case"contextmenu":case"mouseup":case"dragend":oy=!1,Vv(f,n,p);break;case"selectionchange":if(n2)break;case"keydown":case"keyup":Vv(f,n,p)}var E;if(Zx)e:{switch(e){case"compositionstart":var A="onCompositionStart";break e;case"compositionend":A="onCompositionEnd";break e;case"compositionupdate":A="onCompositionUpdate";break e}A=void 0}else Za?uC(e,n)&&(A="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(A="onCompositionStart");A&&(cC&&n.locale!=="ko"&&(Za||A!=="onCompositionStart"?A==="onCompositionEnd"&&Za&&(E=lC()):(co=p,Jx="value"in co?co.value:co.textContent,Za=!0)),j=dp(u,A),0<j.length&&(A=new $v(A,e,null,n,p),f.push({event:A,listeners:j}),E?A.data=E:(E=dC(n),E!==null&&(A.data=E)))),(E=VM?KM(e,n):UM(e,n))&&(u=dp(u,"onBeforeInput"),0<u.length&&(p=new $v("onBeforeInput","beforeinput",null,n,p),f.push({event:p,listeners:u}),p.data=E))}SC(f,t)})}function bu(e,t,n){return{instance:e,listener:t,currentTarget:n}}function dp(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=pu(e,n),i!=null&&r.unshift(bu(e,i,s)),i=pu(e,t),i!=null&&r.push(bu(e,i,s))),e=e.return}return r}function Ba(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function qv(e,t,n,r,s){for(var i=t._reactName,a=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,s?(c=pu(n,i),c!=null&&a.unshift(bu(n,c,l))):s||(c=pu(n,i),c!=null&&a.push(bu(n,c,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var o2=/\r\n?/g,a2=/\u0000|\uFFFD/g;function Yv(e){return(typeof e=="string"?e:""+e).replace(o2,`
|
|
38
|
-
`).replace(a2,"")}function Gd(e,t,n){if(t=Yv(t),Yv(e)!==t&&n)throw Error(Ce(425))}function fp(){}var ay=null,ly=null;function cy(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 uy=typeof setTimeout=="function"?setTimeout:void 0,l2=typeof clearTimeout=="function"?clearTimeout:void 0,Gv=typeof Promise=="function"?Promise:void 0,c2=typeof queueMicrotask=="function"?queueMicrotask:typeof Gv<"u"?function(e){return Gv.resolve(null).then(e).catch(u2)}:uy;function u2(e){setTimeout(function(){throw e})}function Rm(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),gu(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);gu(t)}function yo(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 Jv(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 ql=Math.random().toString(36).slice(2),Js="__reactFiber$"+ql,ku="__reactProps$"+ql,Ti="__reactContainer$"+ql,dy="__reactEvents$"+ql,d2="__reactListeners$"+ql,f2="__reactHandles$"+ql;function Xo(e){var t=e[Js];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ti]||n[Js]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Jv(e);e!==null;){if(n=e[Js])return n;e=Jv(e)}return t}e=n,n=e.parentNode}return null}function Qu(e){return e=e[Js]||e[Ti],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function nl(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Ce(33))}function uh(e){return e[ku]||null}var fy=[],rl=-1;function To(e){return{current:e}}function cn(e){0>rl||(e.current=fy[rl],fy[rl]=null,rl--)}function nn(e,t){rl++,fy[rl]=e.current,e.current=t}var Co={},pr=To(Co),Or=To(!1),ca=Co;function El(e,t){var n=e.type.contextTypes;if(!n)return Co;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 Dr(e){return e=e.childContextTypes,e!=null}function pp(){cn(Or),cn(pr)}function Xv(e,t,n){if(pr.current!==Co)throw Error(Ce(168));nn(pr,t),nn(Or,n)}function jC(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(Ce(108,JR(e)||"Unknown",s));return kn({},n,r)}function hp(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Co,ca=pr.current,nn(pr,e),nn(Or,Or.current),!0}function Qv(e,t,n){var r=e.stateNode;if(!r)throw Error(Ce(169));n?(e=jC(e,t,ca),r.__reactInternalMemoizedMergedChildContext=e,cn(Or),cn(pr),nn(pr,e)):cn(Or),nn(Or,n)}var vi=null,dh=!1,Mm=!1;function CC(e){vi===null?vi=[e]:vi.push(e)}function p2(e){dh=!0,CC(e)}function Ro(){if(!Mm&&vi!==null){Mm=!0;var e=0,t=qt;try{var n=vi;for(qt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}vi=null,dh=!1}catch(s){throw vi!==null&&(vi=vi.slice(e+1)),X1(Ux,Ro),s}finally{qt=t,Mm=!1}}return null}var sl=[],il=0,mp=null,gp=0,ds=[],fs=0,ua=null,Ni=1,ji="";function Vo(e,t){sl[il++]=gp,sl[il++]=mp,mp=e,gp=t}function _C(e,t,n){ds[fs++]=Ni,ds[fs++]=ji,ds[fs++]=ua,ua=e;var r=Ni;e=ji;var s=32-Ms(r)-1;r&=~(1<<s),n+=1;var i=32-Ms(t)+s;if(30<i){var a=s-s%5;i=(r&(1<<a)-1).toString(32),r>>=a,s-=a,Ni=1<<32-Ms(t)+s|n<<s|r,ji=i+e}else Ni=1<<i|n<<s|r,ji=e}function tw(e){e.return!==null&&(Vo(e,1),_C(e,1,0))}function nw(e){for(;e===mp;)mp=sl[--il],sl[il]=null,gp=sl[--il],sl[il]=null;for(;e===ua;)ua=ds[--fs],ds[fs]=null,ji=ds[--fs],ds[fs]=null,Ni=ds[--fs],ds[fs]=null}var Qr=null,Jr=null,fn=!1,As=null;function EC(e,t){var n=ms(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 Zv(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,Qr=e,Jr=yo(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Qr=e,Jr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=ua!==null?{id:Ni,overflow:ji}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=ms(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Qr=e,Jr=null,!0):!1;default:return!1}}function py(e){return(e.mode&1)!==0&&(e.flags&128)===0}function hy(e){if(fn){var t=Jr;if(t){var n=t;if(!Zv(e,t)){if(py(e))throw Error(Ce(418));t=yo(n.nextSibling);var r=Qr;t&&Zv(e,t)?EC(r,n):(e.flags=e.flags&-4097|2,fn=!1,Qr=e)}}else{if(py(e))throw Error(Ce(418));e.flags=e.flags&-4097|2,fn=!1,Qr=e}}}function e0(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Qr=e}function Jd(e){if(e!==Qr)return!1;if(!fn)return e0(e),fn=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!cy(e.type,e.memoizedProps)),t&&(t=Jr)){if(py(e))throw AC(),Error(Ce(418));for(;t;)EC(e,t),t=yo(t.nextSibling)}if(e0(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Ce(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Jr=yo(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Jr=null}}else Jr=Qr?yo(e.stateNode.nextSibling):null;return!0}function AC(){for(var e=Jr;e;)e=yo(e.nextSibling)}function Al(){Jr=Qr=null,fn=!1}function rw(e){As===null?As=[e]:As.push(e)}var h2=Oi.ReactCurrentBatchConfig;function kc(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(Ce(309));var r=n.stateNode}if(!r)throw Error(Ce(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(Ce(284));if(!n._owner)throw Error(Ce(290,e))}return e}function Xd(e,t){throw e=Object.prototype.toString.call(t),Error(Ce(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function t0(e){var t=e._init;return t(e._payload)}function PC(e){function t(g,k){if(e){var x=g.deletions;x===null?(g.deletions=[k],g.flags|=16):x.push(k)}}function n(g,k){if(!e)return null;for(;k!==null;)t(g,k),k=k.sibling;return null}function r(g,k){for(g=new Map;k!==null;)k.key!==null?g.set(k.key,k):g.set(k.index,k),k=k.sibling;return g}function s(g,k){return g=ko(g,k),g.index=0,g.sibling=null,g}function i(g,k,x){return g.index=x,e?(x=g.alternate,x!==null?(x=x.index,x<k?(g.flags|=2,k):x):(g.flags|=2,k)):(g.flags|=1048576,k)}function a(g){return e&&g.alternate===null&&(g.flags|=2),g}function l(g,k,x,S){return k===null||k.tag!==6?(k=Bm(x,g.mode,S),k.return=g,k):(k=s(k,x),k.return=g,k)}function c(g,k,x,S){var C=x.type;return C===Qa?p(g,k,x.props.children,S,x.key):k!==null&&(k.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===ro&&t0(C)===k.type)?(S=s(k,x.props),S.ref=kc(g,k,x),S.return=g,S):(S=Kf(x.type,x.key,x.props,null,g.mode,S),S.ref=kc(g,k,x),S.return=g,S)}function u(g,k,x,S){return k===null||k.tag!==4||k.stateNode.containerInfo!==x.containerInfo||k.stateNode.implementation!==x.implementation?(k=Hm(x,g.mode,S),k.return=g,k):(k=s(k,x.children||[]),k.return=g,k)}function p(g,k,x,S,C){return k===null||k.tag!==7?(k=ra(x,g.mode,S,C),k.return=g,k):(k=s(k,x),k.return=g,k)}function f(g,k,x){if(typeof k=="string"&&k!==""||typeof k=="number")return k=Bm(""+k,g.mode,x),k.return=g,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case zd:return x=Kf(k.type,k.key,k.props,null,g.mode,x),x.ref=kc(g,null,k),x.return=g,x;case Xa:return k=Hm(k,g.mode,x),k.return=g,k;case ro:var S=k._init;return f(g,S(k._payload),x)}if(Lc(k)||gc(k))return k=ra(k,g.mode,x,null),k.return=g,k;Xd(g,k)}return null}function d(g,k,x,S){var C=k!==null?k.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return C!==null?null:l(g,k,""+x,S);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case zd:return x.key===C?c(g,k,x,S):null;case Xa:return x.key===C?u(g,k,x,S):null;case ro:return C=x._init,d(g,k,C(x._payload),S)}if(Lc(x)||gc(x))return C!==null?null:p(g,k,x,S,null);Xd(g,x)}return null}function h(g,k,x,S,C){if(typeof S=="string"&&S!==""||typeof S=="number")return g=g.get(x)||null,l(k,g,""+S,C);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case zd:return g=g.get(S.key===null?x:S.key)||null,c(k,g,S,C);case Xa:return g=g.get(S.key===null?x:S.key)||null,u(k,g,S,C);case ro:var j=S._init;return h(g,k,x,j(S._payload),C)}if(Lc(S)||gc(S))return g=g.get(x)||null,p(k,g,S,C,null);Xd(k,S)}return null}function y(g,k,x,S){for(var C=null,j=null,E=k,A=k=0,O=null;E!==null&&A<x.length;A++){E.index>A?(O=E,E=null):O=E.sibling;var W=d(g,E,x[A],S);if(W===null){E===null&&(E=O);break}e&&E&&W.alternate===null&&t(g,E),k=i(W,k,A),j===null?C=W:j.sibling=W,j=W,E=O}if(A===x.length)return n(g,E),fn&&Vo(g,A),C;if(E===null){for(;A<x.length;A++)E=f(g,x[A],S),E!==null&&(k=i(E,k,A),j===null?C=E:j.sibling=E,j=E);return fn&&Vo(g,A),C}for(E=r(g,E);A<x.length;A++)O=h(E,g,A,x[A],S),O!==null&&(e&&O.alternate!==null&&E.delete(O.key===null?A:O.key),k=i(O,k,A),j===null?C=O:j.sibling=O,j=O);return e&&E.forEach(function(H){return t(g,H)}),fn&&Vo(g,A),C}function w(g,k,x,S){var C=gc(x);if(typeof C!="function")throw Error(Ce(150));if(x=C.call(x),x==null)throw Error(Ce(151));for(var j=C=null,E=k,A=k=0,O=null,W=x.next();E!==null&&!W.done;A++,W=x.next()){E.index>A?(O=E,E=null):O=E.sibling;var H=d(g,E,W.value,S);if(H===null){E===null&&(E=O);break}e&&E&&H.alternate===null&&t(g,E),k=i(H,k,A),j===null?C=H:j.sibling=H,j=H,E=O}if(W.done)return n(g,E),fn&&Vo(g,A),C;if(E===null){for(;!W.done;A++,W=x.next())W=f(g,W.value,S),W!==null&&(k=i(W,k,A),j===null?C=W:j.sibling=W,j=W);return fn&&Vo(g,A),C}for(E=r(g,E);!W.done;A++,W=x.next())W=h(E,g,A,W.value,S),W!==null&&(e&&W.alternate!==null&&E.delete(W.key===null?A:W.key),k=i(W,k,A),j===null?C=W:j.sibling=W,j=W);return e&&E.forEach(function(D){return t(g,D)}),fn&&Vo(g,A),C}function b(g,k,x,S){if(typeof x=="object"&&x!==null&&x.type===Qa&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case zd:e:{for(var C=x.key,j=k;j!==null;){if(j.key===C){if(C=x.type,C===Qa){if(j.tag===7){n(g,j.sibling),k=s(j,x.props.children),k.return=g,g=k;break e}}else if(j.elementType===C||typeof C=="object"&&C!==null&&C.$$typeof===ro&&t0(C)===j.type){n(g,j.sibling),k=s(j,x.props),k.ref=kc(g,j,x),k.return=g,g=k;break e}n(g,j);break}else t(g,j);j=j.sibling}x.type===Qa?(k=ra(x.props.children,g.mode,S,x.key),k.return=g,g=k):(S=Kf(x.type,x.key,x.props,null,g.mode,S),S.ref=kc(g,k,x),S.return=g,g=S)}return a(g);case Xa:e:{for(j=x.key;k!==null;){if(k.key===j)if(k.tag===4&&k.stateNode.containerInfo===x.containerInfo&&k.stateNode.implementation===x.implementation){n(g,k.sibling),k=s(k,x.children||[]),k.return=g,g=k;break e}else{n(g,k);break}else t(g,k);k=k.sibling}k=Hm(x,g.mode,S),k.return=g,g=k}return a(g);case ro:return j=x._init,b(g,k,j(x._payload),S)}if(Lc(x))return y(g,k,x,S);if(gc(x))return w(g,k,x,S);Xd(g,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,k!==null&&k.tag===6?(n(g,k.sibling),k=s(k,x),k.return=g,g=k):(n(g,k),k=Bm(x,g.mode,S),k.return=g,g=k),a(g)):n(g,k)}return b}var Pl=PC(!0),IC=PC(!1),yp=To(null),xp=null,ol=null,sw=null;function iw(){sw=ol=xp=null}function ow(e){var t=yp.current;cn(yp),e._currentValue=t}function my(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 xl(e,t){xp=e,sw=ol=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Mr=!0),e.firstContext=null)}function ys(e){var t=e._currentValue;if(sw!==e)if(e={context:e,memoizedValue:t,next:null},ol===null){if(xp===null)throw Error(Ce(308));ol=e,xp.dependencies={lanes:0,firstContext:e}}else ol=ol.next=e;return t}var Qo=null;function aw(e){Qo===null?Qo=[e]:Qo.push(e)}function TC(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,aw(t)):(n.next=s.next,s.next=n),t.interleaved=n,Ri(e,r)}function Ri(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 so=!1;function lw(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function RC(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 Ai(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function xo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,$t&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Ri(e,n)}return s=r.interleaved,s===null?(t.next=t,aw(r)):(t.next=s.next,s.next=t),r.interleaved=t,Ri(e,n)}function Ff(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,qx(e,n)}}function n0(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 wp(e,t,n,r){var s=e.updateQueue;so=!1;var i=s.firstBaseUpdate,a=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,a===null?i=u:a.next=u,a=c;var p=e.alternate;p!==null&&(p=p.updateQueue,l=p.lastBaseUpdate,l!==a&&(l===null?p.firstBaseUpdate=u:l.next=u,p.lastBaseUpdate=c))}if(i!==null){var f=s.baseState;a=0,p=u=c=null,l=i;do{var d=l.lane,h=l.eventTime;if((r&d)===d){p!==null&&(p=p.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var y=e,w=l;switch(d=t,h=n,w.tag){case 1:if(y=w.payload,typeof y=="function"){f=y.call(h,f,d);break e}f=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=w.payload,d=typeof y=="function"?y.call(h,f,d):y,d==null)break e;f=kn({},f,d);break e;case 2:so=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,d=s.effects,d===null?s.effects=[l]:d.push(l))}else h={eventTime:h,lane:d,tag:l.tag,payload:l.payload,callback:l.callback,next:null},p===null?(u=p=h,c=f):p=p.next=h,a|=d;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;d=l,l=d.next,d.next=null,s.lastBaseUpdate=d,s.shared.pending=null}}while(!0);if(p===null&&(c=f),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=p,t=s.shared.interleaved,t!==null){s=t;do a|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);fa|=a,e.lanes=a,e.memoizedState=f}}function r0(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(Ce(191,s));s.call(r)}}}var Zu={},ni=To(Zu),vu=To(Zu),Su=To(Zu);function Zo(e){if(e===Zu)throw Error(Ce(174));return e}function cw(e,t){switch(nn(Su,t),nn(vu,e),nn(ni,Zu),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Gg(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Gg(t,e)}cn(ni),nn(ni,t)}function Il(){cn(ni),cn(vu),cn(Su)}function MC(e){Zo(Su.current);var t=Zo(ni.current),n=Gg(t,e.type);t!==n&&(nn(vu,e),nn(ni,n))}function uw(e){vu.current===e&&(cn(ni),cn(vu))}var xn=To(0);function bp(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 $m=[];function dw(){for(var e=0;e<$m.length;e++)$m[e]._workInProgressVersionPrimary=null;$m.length=0}var zf=Oi.ReactCurrentDispatcher,Lm=Oi.ReactCurrentBatchConfig,da=0,bn=null,Wn=null,Yn=null,kp=!1,Jc=!1,Nu=0,m2=0;function lr(){throw Error(Ce(321))}function fw(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Os(e[n],t[n]))return!1;return!0}function pw(e,t,n,r,s,i){if(da=i,bn=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,zf.current=e===null||e.memoizedState===null?w2:b2,e=n(r,s),Jc){i=0;do{if(Jc=!1,Nu=0,25<=i)throw Error(Ce(301));i+=1,Yn=Wn=null,t.updateQueue=null,zf.current=k2,e=n(r,s)}while(Jc)}if(zf.current=vp,t=Wn!==null&&Wn.next!==null,da=0,Yn=Wn=bn=null,kp=!1,t)throw Error(Ce(300));return e}function hw(){var e=Nu!==0;return Nu=0,e}function Us(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Yn===null?bn.memoizedState=Yn=e:Yn=Yn.next=e,Yn}function xs(){if(Wn===null){var e=bn.alternate;e=e!==null?e.memoizedState:null}else e=Wn.next;var t=Yn===null?bn.memoizedState:Yn.next;if(t!==null)Yn=t,Wn=e;else{if(e===null)throw Error(Ce(310));Wn=e,e={memoizedState:Wn.memoizedState,baseState:Wn.baseState,baseQueue:Wn.baseQueue,queue:Wn.queue,next:null},Yn===null?bn.memoizedState=Yn=e:Yn=Yn.next=e}return Yn}function ju(e,t){return typeof t=="function"?t(e):t}function Om(e){var t=xs(),n=t.queue;if(n===null)throw Error(Ce(311));n.lastRenderedReducer=e;var r=Wn,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,u=i;do{var p=u.lane;if((da&p)===p)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var f={lane:p,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,a=r):c=c.next=f,bn.lanes|=p,fa|=p}u=u.next}while(u!==null&&u!==i);c===null?a=r:c.next=l,Os(r,t.memoizedState)||(Mr=!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,bn.lanes|=i,fa|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Dm(e){var t=xs(),n=t.queue;if(n===null)throw Error(Ce(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);Os(i,t.memoizedState)||(Mr=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function $C(){}function LC(e,t){var n=bn,r=xs(),s=t(),i=!Os(r.memoizedState,s);if(i&&(r.memoizedState=s,Mr=!0),r=r.queue,mw(FC.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Yn!==null&&Yn.memoizedState.tag&1){if(n.flags|=2048,Cu(9,DC.bind(null,n,r,s,t),void 0,null),Jn===null)throw Error(Ce(349));da&30||OC(n,t,s)}return s}function OC(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=bn.updateQueue,t===null?(t={lastEffect:null,stores:null},bn.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function DC(e,t,n,r){t.value=n,t.getSnapshot=r,zC(t)&&BC(e)}function FC(e,t,n){return n(function(){zC(t)&&BC(e)})}function zC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Os(e,n)}catch{return!0}}function BC(e){var t=Ri(e,1);t!==null&&$s(t,e,1,-1)}function s0(e){var t=Us();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ju,lastRenderedState:e},t.queue=e,e=e.dispatch=x2.bind(null,bn,e),[t.memoizedState,e]}function Cu(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=bn.updateQueue,t===null?(t={lastEffect:null,stores:null},bn.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 HC(){return xs().memoizedState}function Bf(e,t,n,r){var s=Us();bn.flags|=e,s.memoizedState=Cu(1|t,n,void 0,r===void 0?null:r)}function fh(e,t,n,r){var s=xs();r=r===void 0?null:r;var i=void 0;if(Wn!==null){var a=Wn.memoizedState;if(i=a.destroy,r!==null&&fw(r,a.deps)){s.memoizedState=Cu(t,n,i,r);return}}bn.flags|=e,s.memoizedState=Cu(1|t,n,i,r)}function i0(e,t){return Bf(8390656,8,e,t)}function mw(e,t){return fh(2048,8,e,t)}function WC(e,t){return fh(4,2,e,t)}function VC(e,t){return fh(4,4,e,t)}function KC(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 UC(e,t,n){return n=n!=null?n.concat([e]):null,fh(4,4,KC.bind(null,t,e),n)}function gw(){}function qC(e,t){var n=xs();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&fw(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function YC(e,t){var n=xs();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&fw(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function GC(e,t,n){return da&21?(Os(n,t)||(n=eC(),bn.lanes|=n,fa|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Mr=!0),e.memoizedState=n)}function g2(e,t){var n=qt;qt=n!==0&&4>n?n:4,e(!0);var r=Lm.transition;Lm.transition={};try{e(!1),t()}finally{qt=n,Lm.transition=r}}function JC(){return xs().memoizedState}function y2(e,t,n){var r=bo(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},XC(e))QC(t,n);else if(n=TC(e,t,n,r),n!==null){var s=Nr();$s(n,e,r,s),ZC(n,t,r)}}function x2(e,t,n){var r=bo(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(XC(e))QC(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,Os(l,a)){var c=t.interleaved;c===null?(s.next=s,aw(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=TC(e,t,s,r),n!==null&&(s=Nr(),$s(n,e,r,s),ZC(n,t,r))}}function XC(e){var t=e.alternate;return e===bn||t!==null&&t===bn}function QC(e,t){Jc=kp=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function ZC(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,qx(e,n)}}var vp={readContext:ys,useCallback:lr,useContext:lr,useEffect:lr,useImperativeHandle:lr,useInsertionEffect:lr,useLayoutEffect:lr,useMemo:lr,useReducer:lr,useRef:lr,useState:lr,useDebugValue:lr,useDeferredValue:lr,useTransition:lr,useMutableSource:lr,useSyncExternalStore:lr,useId:lr,unstable_isNewReconciler:!1},w2={readContext:ys,useCallback:function(e,t){return Us().memoizedState=[e,t===void 0?null:t],e},useContext:ys,useEffect:i0,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Bf(4194308,4,KC.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Bf(4194308,4,e,t)},useInsertionEffect:function(e,t){return Bf(4,2,e,t)},useMemo:function(e,t){var n=Us();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Us();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=y2.bind(null,bn,e),[r.memoizedState,e]},useRef:function(e){var t=Us();return e={current:e},t.memoizedState=e},useState:s0,useDebugValue:gw,useDeferredValue:function(e){return Us().memoizedState=e},useTransition:function(){var e=s0(!1),t=e[0];return e=g2.bind(null,e[1]),Us().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=bn,s=Us();if(fn){if(n===void 0)throw Error(Ce(407));n=n()}else{if(n=t(),Jn===null)throw Error(Ce(349));da&30||OC(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,i0(FC.bind(null,r,i,e),[e]),r.flags|=2048,Cu(9,DC.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Us(),t=Jn.identifierPrefix;if(fn){var n=ji,r=Ni;n=(r&~(1<<32-Ms(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Nu++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=m2++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},b2={readContext:ys,useCallback:qC,useContext:ys,useEffect:mw,useImperativeHandle:UC,useInsertionEffect:WC,useLayoutEffect:VC,useMemo:YC,useReducer:Om,useRef:HC,useState:function(){return Om(ju)},useDebugValue:gw,useDeferredValue:function(e){var t=xs();return GC(t,Wn.memoizedState,e)},useTransition:function(){var e=Om(ju)[0],t=xs().memoizedState;return[e,t]},useMutableSource:$C,useSyncExternalStore:LC,useId:JC,unstable_isNewReconciler:!1},k2={readContext:ys,useCallback:qC,useContext:ys,useEffect:mw,useImperativeHandle:UC,useInsertionEffect:WC,useLayoutEffect:VC,useMemo:YC,useReducer:Dm,useRef:HC,useState:function(){return Dm(ju)},useDebugValue:gw,useDeferredValue:function(e){var t=xs();return Wn===null?t.memoizedState=e:GC(t,Wn.memoizedState,e)},useTransition:function(){var e=Dm(ju)[0],t=xs().memoizedState;return[e,t]},useMutableSource:$C,useSyncExternalStore:LC,useId:JC,unstable_isNewReconciler:!1};function Cs(e,t){if(e&&e.defaultProps){t=kn({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function gy(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:kn({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var ph={isMounted:function(e){return(e=e._reactInternals)?Ca(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Nr(),s=bo(e),i=Ai(r,s);i.payload=t,n!=null&&(i.callback=n),t=xo(e,i,s),t!==null&&($s(t,e,s,r),Ff(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Nr(),s=bo(e),i=Ai(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=xo(e,i,s),t!==null&&($s(t,e,s,r),Ff(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Nr(),r=bo(e),s=Ai(n,r);s.tag=2,t!=null&&(s.callback=t),t=xo(e,s,r),t!==null&&($s(t,e,r,n),Ff(t,e,r))}};function o0(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?!xu(n,r)||!xu(s,i):!0}function e_(e,t,n){var r=!1,s=Co,i=t.contextType;return typeof i=="object"&&i!==null?i=ys(i):(s=Dr(t)?ca:pr.current,r=t.contextTypes,i=(r=r!=null)?El(e,s):Co),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ph,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function a0(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&&ph.enqueueReplaceState(t,t.state,null)}function yy(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},lw(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=ys(i):(i=Dr(t)?ca:pr.current,s.context=El(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(gy(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&&ph.enqueueReplaceState(s,s.state,null),wp(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Tl(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 Fm(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function xy(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var v2=typeof WeakMap=="function"?WeakMap:Map;function t_(e,t,n){n=Ai(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Np||(Np=!0,Ey=r),xy(e,t)},n}function n_(e,t,n){n=Ai(-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(){xy(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){xy(e,t),typeof r!="function"&&(wo===null?wo=new Set([this]):wo.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function l0(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new v2;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=L2.bind(null,e,t,n),t.then(e,e))}function c0(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 u0(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=Ai(-1,1),t.tag=2,xo(n,t,1))),n.lanes|=1),e)}var S2=Oi.ReactCurrentOwner,Mr=!1;function vr(e,t,n,r){t.child=e===null?IC(t,null,n,r):Pl(t,e.child,n,r)}function d0(e,t,n,r,s){n=n.render;var i=t.ref;return xl(t,s),r=pw(e,t,n,r,i,s),n=hw(),e!==null&&!Mr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Mi(e,t,s)):(fn&&n&&tw(t),t.flags|=1,vr(e,t,r,s),t.child)}function f0(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!Nw(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,r_(e,t,i,r,s)):(e=Kf(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:xu,n(a,r)&&e.ref===t.ref)return Mi(e,t,s)}return t.flags|=1,e=ko(i,r),e.ref=t.ref,e.return=t,t.child=e}function r_(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(xu(i,r)&&e.ref===t.ref)if(Mr=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(Mr=!0);else return t.lanes=e.lanes,Mi(e,t,s)}return wy(e,t,n,r,s)}function s_(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},nn(ll,qr),qr|=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,nn(ll,qr),qr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,nn(ll,qr),qr|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,nn(ll,qr),qr|=r;return vr(e,t,s,n),t.child}function i_(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function wy(e,t,n,r,s){var i=Dr(n)?ca:pr.current;return i=El(t,i),xl(t,s),n=pw(e,t,n,r,i,s),r=hw(),e!==null&&!Mr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,Mi(e,t,s)):(fn&&r&&tw(t),t.flags|=1,vr(e,t,n,s),t.child)}function p0(e,t,n,r,s){if(Dr(n)){var i=!0;hp(t)}else i=!1;if(xl(t,s),t.stateNode===null)Hf(e,t),e_(t,n,r),yy(t,n,r,s),r=!0;else if(e===null){var a=t.stateNode,l=t.memoizedProps;a.props=l;var c=a.context,u=n.contextType;typeof u=="object"&&u!==null?u=ys(u):(u=Dr(n)?ca:pr.current,u=El(t,u));var p=n.getDerivedStateFromProps,f=typeof p=="function"||typeof a.getSnapshotBeforeUpdate=="function";f||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||c!==u)&&a0(t,a,r,u),so=!1;var d=t.memoizedState;a.state=d,wp(t,r,a,s),c=t.memoizedState,l!==r||d!==c||Or.current||so?(typeof p=="function"&&(gy(t,n,p,r),c=t.memoizedState),(l=so||o0(t,n,l,r,d,c,u))?(f||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),a.props=r,a.state=c,a.context=u,r=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,RC(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Cs(t.type,l),a.props=u,f=t.pendingProps,d=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=ys(c):(c=Dr(n)?ca:pr.current,c=El(t,c));var h=n.getDerivedStateFromProps;(p=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==f||d!==c)&&a0(t,a,r,c),so=!1,d=t.memoizedState,a.state=d,wp(t,r,a,s);var y=t.memoizedState;l!==f||d!==y||Or.current||so?(typeof h=="function"&&(gy(t,n,h,r),y=t.memoizedState),(u=so||o0(t,n,u,r,d,y,c)||!1)?(p||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,y,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,y,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=y),a.props=r,a.state=y,a.context=c,r=u):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&d===e.memoizedState||(t.flags|=1024),r=!1)}return by(e,t,n,r,i,s)}function by(e,t,n,r,s,i){i_(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return s&&Qv(t,n,!1),Mi(e,t,i);r=t.stateNode,S2.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=Pl(t,e.child,null,i),t.child=Pl(t,null,l,i)):vr(e,t,l,i),t.memoizedState=r.state,s&&Qv(t,n,!0),t.child}function o_(e){var t=e.stateNode;t.pendingContext?Xv(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Xv(e,t.context,!1),cw(e,t.containerInfo)}function h0(e,t,n,r,s){return Al(),rw(s),t.flags|=256,vr(e,t,n,r),t.child}var ky={dehydrated:null,treeContext:null,retryLane:0};function vy(e){return{baseLanes:e,cachePool:null,transitions:null}}function a_(e,t,n){var r=t.pendingProps,s=xn.current,i=!1,a=(t.flags&128)!==0,l;if((l=a)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),nn(xn,s&1),e===null)return hy(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=gh(a,r,0,null),e=ra(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=vy(n),t.memoizedState=ky,e):yw(t,a));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return N2(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=ko(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=ko(l,i):(i=ra(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?vy(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=ky,r}return i=e.child,e=i.sibling,r=ko(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 yw(e,t){return t=gh({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Qd(e,t,n,r){return r!==null&&rw(r),Pl(t,e.child,null,n),e=yw(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function N2(e,t,n,r,s,i,a){if(n)return t.flags&256?(t.flags&=-257,r=Fm(Error(Ce(422))),Qd(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=gh({mode:"visible",children:r.children},s,0,null),i=ra(i,s,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&Pl(t,e.child,null,a),t.child.memoizedState=vy(a),t.memoizedState=ky,i);if(!(t.mode&1))return Qd(e,t,a,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(Ce(419)),r=Fm(i,r,void 0),Qd(e,t,a,r)}if(l=(a&e.childLanes)!==0,Mr||l){if(r=Jn,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,Ri(e,s),$s(r,e,s,-1))}return Sw(),r=Fm(Error(Ce(421))),Qd(e,t,a,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=O2.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,Jr=yo(s.nextSibling),Qr=t,fn=!0,As=null,e!==null&&(ds[fs++]=Ni,ds[fs++]=ji,ds[fs++]=ua,Ni=e.id,ji=e.overflow,ua=t),t=yw(t,r.children),t.flags|=4096,t)}function m0(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),my(e.return,t,n)}function zm(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 l_(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(vr(e,t,r.children,n),r=xn.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&m0(e,n,t);else if(e.tag===19)m0(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(nn(xn,r),!(t.mode&1))t.memoizedState=null;else switch(s){case"forwards":for(n=t.child,s=null;n!==null;)e=n.alternate,e!==null&&bp(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),zm(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&&bp(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}zm(t,!0,n,null,i);break;case"together":zm(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Hf(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Mi(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),fa|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Ce(153));if(t.child!==null){for(e=t.child,n=ko(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ko(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function j2(e,t,n){switch(t.tag){case 3:o_(t),Al();break;case 5:MC(t);break;case 1:Dr(t.type)&&hp(t);break;case 4:cw(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;nn(yp,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(nn(xn,xn.current&1),t.flags|=128,null):n&t.child.childLanes?a_(e,t,n):(nn(xn,xn.current&1),e=Mi(e,t,n),e!==null?e.sibling:null);nn(xn,xn.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return l_(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),nn(xn,xn.current),r)break;return null;case 22:case 23:return t.lanes=0,s_(e,t,n)}return Mi(e,t,n)}var c_,Sy,u_,d_;c_=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Sy=function(){};u_=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Zo(ni.current);var i=null;switch(n){case"input":s=Kg(e,s),r=Kg(e,r),i=[];break;case"select":s=kn({},s,{value:void 0}),r=kn({},r,{value:void 0}),i=[];break;case"textarea":s=Yg(e,s),r=Yg(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=fp)}Jg(n,r);var a;n=null;for(u in s)if(!r.hasOwnProperty(u)&&s.hasOwnProperty(u)&&s[u]!=null)if(u==="style"){var l=s[u];for(a in l)l.hasOwnProperty(a)&&(n||(n={}),n[a]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(du.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(l=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="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(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(du.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&an("scroll",e),i||l===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};d_=function(e,t,n,r){n!==r&&(t.flags|=4)};function vc(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 cr(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 C2(e,t,n){var r=t.pendingProps;switch(nw(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return cr(t),null;case 1:return Dr(t.type)&&pp(),cr(t),null;case 3:return r=t.stateNode,Il(),cn(Or),cn(pr),dw(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Jd(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,As!==null&&(Iy(As),As=null))),Sy(e,t),cr(t),null;case 5:uw(t);var s=Zo(Su.current);if(n=t.type,e!==null&&t.stateNode!=null)u_(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(Ce(166));return cr(t),null}if(e=Zo(ni.current),Jd(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Js]=t,r[ku]=i,e=(t.mode&1)!==0,n){case"dialog":an("cancel",r),an("close",r);break;case"iframe":case"object":case"embed":an("load",r);break;case"video":case"audio":for(s=0;s<Dc.length;s++)an(Dc[s],r);break;case"source":an("error",r);break;case"img":case"image":case"link":an("error",r),an("load",r);break;case"details":an("toggle",r);break;case"input":Nv(r,i),an("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},an("invalid",r);break;case"textarea":Cv(r,i),an("invalid",r)}Jg(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&&Gd(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Gd(r.textContent,l,e),s=["children",""+l]):du.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&an("scroll",r)}switch(n){case"input":Bd(r),jv(r,i,!0);break;case"textarea":Bd(r),_v(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=fp)}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=F1(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[Js]=t,e[ku]=r,c_(e,t,!1,!1),t.stateNode=e;e:{switch(a=Xg(n,r),n){case"dialog":an("cancel",e),an("close",e),s=r;break;case"iframe":case"object":case"embed":an("load",e),s=r;break;case"video":case"audio":for(s=0;s<Dc.length;s++)an(Dc[s],e);s=r;break;case"source":an("error",e),s=r;break;case"img":case"image":case"link":an("error",e),an("load",e),s=r;break;case"details":an("toggle",e),s=r;break;case"input":Nv(e,r),s=Kg(e,r),an("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=kn({},r,{value:void 0}),an("invalid",e);break;case"textarea":Cv(e,r),s=Yg(e,r),an("invalid",e);break;default:s=r}Jg(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?H1(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&z1(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&fu(e,c):typeof c=="number"&&fu(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(du.hasOwnProperty(i)?c!=null&&i==="onScroll"&&an("scroll",e):c!=null&&Bx(e,i,c,a))}switch(n){case"input":Bd(e),jv(e,r,!1);break;case"textarea":Bd(e),_v(e);break;case"option":r.value!=null&&e.setAttribute("value",""+jo(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?hl(e,!!r.multiple,i,!1):r.defaultValue!=null&&hl(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=fp)}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 cr(t),null;case 6:if(e&&t.stateNode!=null)d_(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Ce(166));if(n=Zo(Su.current),Zo(ni.current),Jd(t)){if(r=t.stateNode,n=t.memoizedProps,r[Js]=t,(i=r.nodeValue!==n)&&(e=Qr,e!==null))switch(e.tag){case 3:Gd(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Gd(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Js]=t,t.stateNode=r}return cr(t),null;case 13:if(cn(xn),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(fn&&Jr!==null&&t.mode&1&&!(t.flags&128))AC(),Al(),t.flags|=98560,i=!1;else if(i=Jd(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(Ce(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Ce(317));i[Js]=t}else Al(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;cr(t),i=!1}else As!==null&&(Iy(As),As=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||xn.current&1?Vn===0&&(Vn=3):Sw())),t.updateQueue!==null&&(t.flags|=4),cr(t),null);case 4:return Il(),Sy(e,t),e===null&&wu(t.stateNode.containerInfo),cr(t),null;case 10:return ow(t.type._context),cr(t),null;case 17:return Dr(t.type)&&pp(),cr(t),null;case 19:if(cn(xn),i=t.memoizedState,i===null)return cr(t),null;if(r=(t.flags&128)!==0,a=i.rendering,a===null)if(r)vc(i,!1);else{if(Vn!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=bp(e),a!==null){for(t.flags|=128,vc(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 nn(xn,xn.current&1|2),t.child}e=e.sibling}i.tail!==null&&Tn()>Rl&&(t.flags|=128,r=!0,vc(i,!1),t.lanes=4194304)}else{if(!r)if(e=bp(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),vc(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!fn)return cr(t),null}else 2*Tn()-i.renderingStartTime>Rl&&n!==1073741824&&(t.flags|=128,r=!0,vc(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=Tn(),t.sibling=null,n=xn.current,nn(xn,r?n&1|2:n&1),t):(cr(t),null);case 22:case 23:return vw(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?qr&1073741824&&(cr(t),t.subtreeFlags&6&&(t.flags|=8192)):cr(t),null;case 24:return null;case 25:return null}throw Error(Ce(156,t.tag))}function _2(e,t){switch(nw(t),t.tag){case 1:return Dr(t.type)&&pp(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Il(),cn(Or),cn(pr),dw(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return uw(t),null;case 13:if(cn(xn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ce(340));Al()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return cn(xn),null;case 4:return Il(),null;case 10:return ow(t.type._context),null;case 22:case 23:return vw(),null;case 24:return null;default:return null}}var Zd=!1,ur=!1,E2=typeof WeakSet=="function"?WeakSet:Set,He=null;function al(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){jn(e,t,r)}else n.current=null}function Ny(e,t,n){try{n()}catch(r){jn(e,t,r)}}var g0=!1;function A2(e,t){if(ay=cp,e=gC(),ew(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,u=0,p=0,f=e,d=null;t:for(;;){for(var h;f!==n||s!==0&&f.nodeType!==3||(l=a+s),f!==i||r!==0&&f.nodeType!==3||(c=a+r),f.nodeType===3&&(a+=f.nodeValue.length),(h=f.firstChild)!==null;)d=f,f=h;for(;;){if(f===e)break t;if(d===n&&++u===s&&(l=a),d===i&&++p===r&&(c=a),(h=f.nextSibling)!==null)break;f=d,d=f.parentNode}f=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(ly={focusedElem:e,selectionRange:n},cp=!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 y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var w=y.memoizedProps,b=y.memoizedState,g=t.stateNode,k=g.getSnapshotBeforeUpdate(t.elementType===t.type?w:Cs(t.type,w),b);g.__reactInternalSnapshotBeforeUpdate=k}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ce(163))}}catch(S){jn(t,t.return,S)}if(e=t.sibling,e!==null){e.return=t.return,He=e;break}He=t.return}return y=g0,g0=!1,y}function Xc(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&&Ny(t,n,i)}s=s.next}while(s!==r)}}function hh(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 jy(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 f_(e){var t=e.alternate;t!==null&&(e.alternate=null,f_(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Js],delete t[ku],delete t[dy],delete t[d2],delete t[f2])),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 p_(e){return e.tag===5||e.tag===3||e.tag===4}function y0(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||p_(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 Cy(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=fp));else if(r!==4&&(e=e.child,e!==null))for(Cy(e,t,n),e=e.sibling;e!==null;)Cy(e,t,n),e=e.sibling}function _y(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(_y(e,t,n),e=e.sibling;e!==null;)_y(e,t,n),e=e.sibling}var tr=null,_s=!1;function Xi(e,t,n){for(n=n.child;n!==null;)h_(e,t,n),n=n.sibling}function h_(e,t,n){if(ti&&typeof ti.onCommitFiberUnmount=="function")try{ti.onCommitFiberUnmount(oh,n)}catch{}switch(n.tag){case 5:ur||al(n,t);case 6:var r=tr,s=_s;tr=null,Xi(e,t,n),tr=r,_s=s,tr!==null&&(_s?(e=tr,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):tr.removeChild(n.stateNode));break;case 18:tr!==null&&(_s?(e=tr,n=n.stateNode,e.nodeType===8?Rm(e.parentNode,n):e.nodeType===1&&Rm(e,n),gu(e)):Rm(tr,n.stateNode));break;case 4:r=tr,s=_s,tr=n.stateNode.containerInfo,_s=!0,Xi(e,t,n),tr=r,_s=s;break;case 0:case 11:case 14:case 15:if(!ur&&(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)&&Ny(n,t,a),s=s.next}while(s!==r)}Xi(e,t,n);break;case 1:if(!ur&&(al(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){jn(n,t,l)}Xi(e,t,n);break;case 21:Xi(e,t,n);break;case 22:n.mode&1?(ur=(r=ur)||n.memoizedState!==null,Xi(e,t,n),ur=r):Xi(e,t,n);break;default:Xi(e,t,n)}}function x0(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new E2),t.forEach(function(r){var s=D2.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Ss(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:tr=l.stateNode,_s=!1;break e;case 3:tr=l.stateNode.containerInfo,_s=!0;break e;case 4:tr=l.stateNode.containerInfo,_s=!0;break e}l=l.return}if(tr===null)throw Error(Ce(160));h_(i,a,s),tr=null,_s=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){jn(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)m_(t,e),t=t.sibling}function m_(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ss(t,e),Ws(e),r&4){try{Xc(3,e,e.return),hh(3,e)}catch(w){jn(e,e.return,w)}try{Xc(5,e,e.return)}catch(w){jn(e,e.return,w)}}break;case 1:Ss(t,e),Ws(e),r&512&&n!==null&&al(n,n.return);break;case 5:if(Ss(t,e),Ws(e),r&512&&n!==null&&al(n,n.return),e.flags&32){var s=e.stateNode;try{fu(s,"")}catch(w){jn(e,e.return,w)}}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&&O1(s,i),Xg(l,a);var u=Xg(l,i);for(a=0;a<c.length;a+=2){var p=c[a],f=c[a+1];p==="style"?H1(s,f):p==="dangerouslySetInnerHTML"?z1(s,f):p==="children"?fu(s,f):Bx(s,p,f,u)}switch(l){case"input":Ug(s,i);break;case"textarea":D1(s,i);break;case"select":var d=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var h=i.value;h!=null?hl(s,!!i.multiple,h,!1):d!==!!i.multiple&&(i.defaultValue!=null?hl(s,!!i.multiple,i.defaultValue,!0):hl(s,!!i.multiple,i.multiple?[]:"",!1))}s[ku]=i}catch(w){jn(e,e.return,w)}}break;case 6:if(Ss(t,e),Ws(e),r&4){if(e.stateNode===null)throw Error(Ce(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(w){jn(e,e.return,w)}}break;case 3:if(Ss(t,e),Ws(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{gu(t.containerInfo)}catch(w){jn(e,e.return,w)}break;case 4:Ss(t,e),Ws(e);break;case 13:Ss(t,e),Ws(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(bw=Tn())),r&4&&x0(e);break;case 22:if(p=n!==null&&n.memoizedState!==null,e.mode&1?(ur=(u=ur)||p,Ss(t,e),ur=u):Ss(t,e),Ws(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!p&&e.mode&1)for(He=e,p=e.child;p!==null;){for(f=He=p;He!==null;){switch(d=He,h=d.child,d.tag){case 0:case 11:case 14:case 15:Xc(4,d,d.return);break;case 1:al(d,d.return);var y=d.stateNode;if(typeof y.componentWillUnmount=="function"){r=d,n=d.return;try{t=r,y.props=t.memoizedProps,y.state=t.memoizedState,y.componentWillUnmount()}catch(w){jn(r,n,w)}}break;case 5:al(d,d.return);break;case 22:if(d.memoizedState!==null){b0(f);continue}}h!==null?(h.return=d,He=h):b0(f)}p=p.sibling}e:for(p=null,f=e;;){if(f.tag===5){if(p===null){p=f;try{s=f.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=f.stateNode,c=f.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=B1("display",a))}catch(w){jn(e,e.return,w)}}}else if(f.tag===6){if(p===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(w){jn(e,e.return,w)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;p===f&&(p=null),f=f.return}p===f&&(p=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Ss(t,e),Ws(e),r&4&&x0(e);break;case 21:break;default:Ss(t,e),Ws(e)}}function Ws(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(p_(n)){var r=n;break e}n=n.return}throw Error(Ce(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(fu(s,""),r.flags&=-33);var i=y0(e);_y(e,i,s);break;case 3:case 4:var a=r.stateNode.containerInfo,l=y0(e);Cy(e,l,a);break;default:throw Error(Ce(161))}}catch(c){jn(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function P2(e,t,n){He=e,g_(e)}function g_(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||Zd;if(!a){var l=s.alternate,c=l!==null&&l.memoizedState!==null||ur;l=Zd;var u=ur;if(Zd=a,(ur=c)&&!u)for(He=s;He!==null;)a=He,c=a.child,a.tag===22&&a.memoizedState!==null?k0(s):c!==null?(c.return=a,He=c):k0(s);for(;i!==null;)He=i,g_(i),i=i.sibling;He=s,Zd=l,ur=u}w0(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,He=i):w0(e)}}function w0(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:ur||hh(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!ur)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:Cs(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&r0(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}r0(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 u=t.alternate;if(u!==null){var p=u.memoizedState;if(p!==null){var f=p.dehydrated;f!==null&&gu(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Ce(163))}ur||t.flags&512&&jy(t)}catch(d){jn(t,t.return,d)}}if(t===e){He=null;break}if(n=t.sibling,n!==null){n.return=t.return,He=n;break}He=t.return}}function b0(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 k0(e){for(;He!==null;){var t=He;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{hh(4,t)}catch(c){jn(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){jn(t,s,c)}}var i=t.return;try{jy(t)}catch(c){jn(t,i,c)}break;case 5:var a=t.return;try{jy(t)}catch(c){jn(t,a,c)}}}catch(c){jn(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 I2=Math.ceil,Sp=Oi.ReactCurrentDispatcher,xw=Oi.ReactCurrentOwner,gs=Oi.ReactCurrentBatchConfig,$t=0,Jn=null,$n=null,nr=0,qr=0,ll=To(0),Vn=0,_u=null,fa=0,mh=0,ww=0,Qc=null,Rr=null,bw=0,Rl=1/0,ki=null,Np=!1,Ey=null,wo=null,ef=!1,uo=null,jp=0,Zc=0,Ay=null,Wf=-1,Vf=0;function Nr(){return $t&6?Tn():Wf!==-1?Wf:Wf=Tn()}function bo(e){return e.mode&1?$t&2&&nr!==0?nr&-nr:h2.transition!==null?(Vf===0&&(Vf=eC()),Vf):(e=qt,e!==0||(e=window.event,e=e===void 0?16:aC(e.type)),e):1}function $s(e,t,n,r){if(50<Zc)throw Zc=0,Ay=null,Error(Ce(185));Ju(e,n,r),(!($t&2)||e!==Jn)&&(e===Jn&&(!($t&2)&&(mh|=n),Vn===4&&ao(e,nr)),Fr(e,r),n===1&&$t===0&&!(t.mode&1)&&(Rl=Tn()+500,dh&&Ro()))}function Fr(e,t){var n=e.callbackNode;hM(e,t);var r=lp(e,e===Jn?nr:0);if(r===0)n!==null&&Pv(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&Pv(n),t===1)e.tag===0?p2(v0.bind(null,e)):CC(v0.bind(null,e)),c2(function(){!($t&6)&&Ro()}),n=null;else{switch(tC(r)){case 1:n=Ux;break;case 4:n=Q1;break;case 16:n=ap;break;case 536870912:n=Z1;break;default:n=ap}n=N_(n,y_.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function y_(e,t){if(Wf=-1,Vf=0,$t&6)throw Error(Ce(327));var n=e.callbackNode;if(wl()&&e.callbackNode!==n)return null;var r=lp(e,e===Jn?nr:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Cp(e,r);else{t=r;var s=$t;$t|=2;var i=w_();(Jn!==e||nr!==t)&&(ki=null,Rl=Tn()+500,na(e,t));do try{M2();break}catch(l){x_(e,l)}while(!0);iw(),Sp.current=i,$t=s,$n!==null?t=0:(Jn=null,nr=0,t=Vn)}if(t!==0){if(t===2&&(s=ny(e),s!==0&&(r=s,t=Py(e,s))),t===1)throw n=_u,na(e,0),ao(e,r),Fr(e,Tn()),n;if(t===6)ao(e,r);else{if(s=e.current.alternate,!(r&30)&&!T2(s)&&(t=Cp(e,r),t===2&&(i=ny(e),i!==0&&(r=i,t=Py(e,i))),t===1))throw n=_u,na(e,0),ao(e,r),Fr(e,Tn()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(Ce(345));case 2:Ko(e,Rr,ki);break;case 3:if(ao(e,r),(r&130023424)===r&&(t=bw+500-Tn(),10<t)){if(lp(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){Nr(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=uy(Ko.bind(null,e,Rr,ki),t);break}Ko(e,Rr,ki);break;case 4:if(ao(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var a=31-Ms(r);i=1<<a,a=t[a],a>s&&(s=a),r&=~i}if(r=s,r=Tn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*I2(r/1960))-r,10<r){e.timeoutHandle=uy(Ko.bind(null,e,Rr,ki),r);break}Ko(e,Rr,ki);break;case 5:Ko(e,Rr,ki);break;default:throw Error(Ce(329))}}}return Fr(e,Tn()),e.callbackNode===n?y_.bind(null,e):null}function Py(e,t){var n=Qc;return e.current.memoizedState.isDehydrated&&(na(e,t).flags|=256),e=Cp(e,t),e!==2&&(t=Rr,Rr=n,t!==null&&Iy(t)),e}function Iy(e){Rr===null?Rr=e:Rr.push.apply(Rr,e)}function T2(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(!Os(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 ao(e,t){for(t&=~ww,t&=~mh,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Ms(t),r=1<<n;e[n]=-1,t&=~r}}function v0(e){if($t&6)throw Error(Ce(327));wl();var t=lp(e,0);if(!(t&1))return Fr(e,Tn()),null;var n=Cp(e,t);if(e.tag!==0&&n===2){var r=ny(e);r!==0&&(t=r,n=Py(e,r))}if(n===1)throw n=_u,na(e,0),ao(e,t),Fr(e,Tn()),n;if(n===6)throw Error(Ce(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ko(e,Rr,ki),Fr(e,Tn()),null}function kw(e,t){var n=$t;$t|=1;try{return e(t)}finally{$t=n,$t===0&&(Rl=Tn()+500,dh&&Ro())}}function pa(e){uo!==null&&uo.tag===0&&!($t&6)&&wl();var t=$t;$t|=1;var n=gs.transition,r=qt;try{if(gs.transition=null,qt=1,e)return e()}finally{qt=r,gs.transition=n,$t=t,!($t&6)&&Ro()}}function vw(){qr=ll.current,cn(ll)}function na(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,l2(n)),$n!==null)for(n=$n.return;n!==null;){var r=n;switch(nw(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&pp();break;case 3:Il(),cn(Or),cn(pr),dw();break;case 5:uw(r);break;case 4:Il();break;case 13:cn(xn);break;case 19:cn(xn);break;case 10:ow(r.type._context);break;case 22:case 23:vw()}n=n.return}if(Jn=e,$n=e=ko(e.current,null),nr=qr=t,Vn=0,_u=null,ww=mh=fa=0,Rr=Qc=null,Qo!==null){for(t=0;t<Qo.length;t++)if(n=Qo[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}Qo=null}return e}function x_(e,t){do{var n=$n;try{if(iw(),zf.current=vp,kp){for(var r=bn.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}kp=!1}if(da=0,Yn=Wn=bn=null,Jc=!1,Nu=0,xw.current=null,n===null||n.return===null){Vn=1,_u=t,$n=null;break}e:{var i=e,a=n.return,l=n,c=t;if(t=nr,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,p=l,f=p.tag;if(!(p.mode&1)&&(f===0||f===11||f===15)){var d=p.alternate;d?(p.updateQueue=d.updateQueue,p.memoizedState=d.memoizedState,p.lanes=d.lanes):(p.updateQueue=null,p.memoizedState=null)}var h=c0(a);if(h!==null){h.flags&=-257,u0(h,a,l,i,t),h.mode&1&&l0(i,u,t),t=h,c=u;var y=t.updateQueue;if(y===null){var w=new Set;w.add(c),t.updateQueue=w}else y.add(c);break e}else{if(!(t&1)){l0(i,u,t),Sw();break e}c=Error(Ce(426))}}else if(fn&&l.mode&1){var b=c0(a);if(b!==null){!(b.flags&65536)&&(b.flags|=256),u0(b,a,l,i,t),rw(Tl(c,l));break e}}i=c=Tl(c,l),Vn!==4&&(Vn=2),Qc===null?Qc=[i]:Qc.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var g=t_(i,c,t);n0(i,g);break e;case 1:l=c;var k=i.type,x=i.stateNode;if(!(i.flags&128)&&(typeof k.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(wo===null||!wo.has(x)))){i.flags|=65536,t&=-t,i.lanes|=t;var S=n_(i,l,t);n0(i,S);break e}}i=i.return}while(i!==null)}k_(n)}catch(C){t=C,$n===n&&n!==null&&($n=n=n.return);continue}break}while(!0)}function w_(){var e=Sp.current;return Sp.current=vp,e===null?vp:e}function Sw(){(Vn===0||Vn===3||Vn===2)&&(Vn=4),Jn===null||!(fa&268435455)&&!(mh&268435455)||ao(Jn,nr)}function Cp(e,t){var n=$t;$t|=2;var r=w_();(Jn!==e||nr!==t)&&(ki=null,na(e,t));do try{R2();break}catch(s){x_(e,s)}while(!0);if(iw(),$t=n,Sp.current=r,$n!==null)throw Error(Ce(261));return Jn=null,nr=0,Vn}function R2(){for(;$n!==null;)b_($n)}function M2(){for(;$n!==null&&!iM();)b_($n)}function b_(e){var t=S_(e.alternate,e,qr);e.memoizedProps=e.pendingProps,t===null?k_(e):$n=t,xw.current=null}function k_(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=_2(n,t),n!==null){n.flags&=32767,$n=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Vn=6,$n=null;return}}else if(n=C2(n,t,qr),n!==null){$n=n;return}if(t=t.sibling,t!==null){$n=t;return}$n=t=e}while(t!==null);Vn===0&&(Vn=5)}function Ko(e,t,n){var r=qt,s=gs.transition;try{gs.transition=null,qt=1,$2(e,t,n,r)}finally{gs.transition=s,qt=r}return null}function $2(e,t,n,r){do wl();while(uo!==null);if($t&6)throw Error(Ce(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(Ce(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(mM(e,i),e===Jn&&($n=Jn=null,nr=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||ef||(ef=!0,N_(ap,function(){return wl(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=gs.transition,gs.transition=null;var a=qt;qt=1;var l=$t;$t|=4,xw.current=null,A2(e,n),m_(n,e),t2(ly),cp=!!ay,ly=ay=null,e.current=n,P2(n),oM(),$t=l,qt=a,gs.transition=i}else e.current=n;if(ef&&(ef=!1,uo=e,jp=s),i=e.pendingLanes,i===0&&(wo=null),cM(n.stateNode),Fr(e,Tn()),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(Np)throw Np=!1,e=Ey,Ey=null,e;return jp&1&&e.tag!==0&&wl(),i=e.pendingLanes,i&1?e===Ay?Zc++:(Zc=0,Ay=e):Zc=0,Ro(),null}function wl(){if(uo!==null){var e=tC(jp),t=gs.transition,n=qt;try{if(gs.transition=null,qt=16>e?16:e,uo===null)var r=!1;else{if(e=uo,uo=null,jp=0,$t&6)throw Error(Ce(331));var s=$t;for($t|=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 u=l[c];for(He=u;He!==null;){var p=He;switch(p.tag){case 0:case 11:case 15:Xc(8,p,i)}var f=p.child;if(f!==null)f.return=p,He=f;else for(;He!==null;){p=He;var d=p.sibling,h=p.return;if(f_(p),p===u){He=null;break}if(d!==null){d.return=h,He=d;break}He=h}}}var y=i.alternate;if(y!==null){var w=y.child;if(w!==null){y.child=null;do{var b=w.sibling;w.sibling=null,w=b}while(w!==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:Xc(9,i,i.return)}var g=i.sibling;if(g!==null){g.return=i.return,He=g;break e}He=i.return}}var k=e.current;for(He=k;He!==null;){a=He;var x=a.child;if(a.subtreeFlags&2064&&x!==null)x.return=a,He=x;else e:for(a=k;He!==null;){if(l=He,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:hh(9,l)}}catch(C){jn(l,l.return,C)}if(l===a){He=null;break e}var S=l.sibling;if(S!==null){S.return=l.return,He=S;break e}He=l.return}}if($t=s,Ro(),ti&&typeof ti.onPostCommitFiberRoot=="function")try{ti.onPostCommitFiberRoot(oh,e)}catch{}r=!0}return r}finally{qt=n,gs.transition=t}}return!1}function S0(e,t,n){t=Tl(n,t),t=t_(e,t,1),e=xo(e,t,1),t=Nr(),e!==null&&(Ju(e,1,t),Fr(e,t))}function jn(e,t,n){if(e.tag===3)S0(e,e,n);else for(;t!==null;){if(t.tag===3){S0(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(wo===null||!wo.has(r))){e=Tl(n,e),e=n_(t,e,1),t=xo(t,e,1),e=Nr(),t!==null&&(Ju(t,1,e),Fr(t,e));break}}t=t.return}}function L2(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Nr(),e.pingedLanes|=e.suspendedLanes&n,Jn===e&&(nr&n)===n&&(Vn===4||Vn===3&&(nr&130023424)===nr&&500>Tn()-bw?na(e,0):ww|=n),Fr(e,t)}function v_(e,t){t===0&&(e.mode&1?(t=Vd,Vd<<=1,!(Vd&130023424)&&(Vd=4194304)):t=1);var n=Nr();e=Ri(e,t),e!==null&&(Ju(e,t,n),Fr(e,n))}function O2(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),v_(e,n)}function D2(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(Ce(314))}r!==null&&r.delete(t),v_(e,n)}var S_;S_=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Or.current)Mr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Mr=!1,j2(e,t,n);Mr=!!(e.flags&131072)}else Mr=!1,fn&&t.flags&1048576&&_C(t,gp,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Hf(e,t),e=t.pendingProps;var s=El(t,pr.current);xl(t,n),s=pw(null,t,r,e,s,n);var i=hw();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,Dr(r)?(i=!0,hp(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,lw(t),s.updater=ph,t.stateNode=s,s._reactInternals=t,yy(t,r,e,n),t=by(null,t,r,!0,i,n)):(t.tag=0,fn&&i&&tw(t),vr(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Hf(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=z2(r),e=Cs(r,e),s){case 0:t=wy(null,t,r,e,n);break e;case 1:t=p0(null,t,r,e,n);break e;case 11:t=d0(null,t,r,e,n);break e;case 14:t=f0(null,t,r,Cs(r.type,e),n);break e}throw Error(Ce(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Cs(r,s),wy(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Cs(r,s),p0(e,t,r,s,n);case 3:e:{if(o_(t),e===null)throw Error(Ce(387));r=t.pendingProps,i=t.memoizedState,s=i.element,RC(e,t),wp(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=Tl(Error(Ce(423)),t),t=h0(e,t,r,n,s);break e}else if(r!==s){s=Tl(Error(Ce(424)),t),t=h0(e,t,r,n,s);break e}else for(Jr=yo(t.stateNode.containerInfo.firstChild),Qr=t,fn=!0,As=null,n=IC(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Al(),r===s){t=Mi(e,t,n);break e}vr(e,t,r,n)}t=t.child}return t;case 5:return MC(t),e===null&&hy(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,cy(r,s)?a=null:i!==null&&cy(r,i)&&(t.flags|=32),i_(e,t),vr(e,t,a,n),t.child;case 6:return e===null&&hy(t),null;case 13:return a_(e,t,n);case 4:return cw(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Pl(t,null,r,n):vr(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Cs(r,s),d0(e,t,r,s,n);case 7:return vr(e,t,t.pendingProps,n),t.child;case 8:return vr(e,t,t.pendingProps.children,n),t.child;case 12:return vr(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,a=s.value,nn(yp,r._currentValue),r._currentValue=a,i!==null)if(Os(i.value,a)){if(i.children===s.children&&!Or.current){t=Mi(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=Ai(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var p=u.pending;p===null?c.next=c:(c.next=p.next,p.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),my(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(Ce(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),my(a,n,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}vr(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,xl(t,n),s=ys(s),r=r(s),t.flags|=1,vr(e,t,r,n),t.child;case 14:return r=t.type,s=Cs(r,t.pendingProps),s=Cs(r.type,s),f0(e,t,r,s,n);case 15:return r_(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Cs(r,s),Hf(e,t),t.tag=1,Dr(r)?(e=!0,hp(t)):e=!1,xl(t,n),e_(t,r,s),yy(t,r,s,n),by(null,t,r,!0,e,n);case 19:return l_(e,t,n);case 22:return s_(e,t,n)}throw Error(Ce(156,t.tag))};function N_(e,t){return X1(e,t)}function F2(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 ms(e,t,n,r){return new F2(e,t,n,r)}function Nw(e){return e=e.prototype,!(!e||!e.isReactComponent)}function z2(e){if(typeof e=="function")return Nw(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Wx)return 11;if(e===Vx)return 14}return 2}function ko(e,t){var n=e.alternate;return n===null?(n=ms(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 Kf(e,t,n,r,s,i){var a=2;if(r=e,typeof e=="function")Nw(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Qa:return ra(n.children,s,i,t);case Hx:a=8,s|=8;break;case Bg:return e=ms(12,n,t,s|2),e.elementType=Bg,e.lanes=i,e;case Hg:return e=ms(13,n,t,s),e.elementType=Hg,e.lanes=i,e;case Wg:return e=ms(19,n,t,s),e.elementType=Wg,e.lanes=i,e;case M1:return gh(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case T1:a=10;break e;case R1:a=9;break e;case Wx:a=11;break e;case Vx:a=14;break e;case ro:a=16,r=null;break e}throw Error(Ce(130,e==null?e:typeof e,""))}return t=ms(a,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function ra(e,t,n,r){return e=ms(7,e,r,t),e.lanes=n,e}function gh(e,t,n,r){return e=ms(22,e,r,t),e.elementType=M1,e.lanes=n,e.stateNode={isHidden:!1},e}function Bm(e,t,n){return e=ms(6,e,null,t),e.lanes=n,e}function Hm(e,t,n){return t=ms(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function B2(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=vm(0),this.expirationTimes=vm(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=vm(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function jw(e,t,n,r,s,i,a,l,c){return e=new B2(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=ms(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},lw(i),e}function H2(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Xa,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function j_(e){if(!e)return Co;e=e._reactInternals;e:{if(Ca(e)!==e||e.tag!==1)throw Error(Ce(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Dr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Ce(171))}if(e.tag===1){var n=e.type;if(Dr(n))return jC(e,n,t)}return t}function C_(e,t,n,r,s,i,a,l,c){return e=jw(n,r,!0,e,s,i,a,l,c),e.context=j_(null),n=e.current,r=Nr(),s=bo(n),i=Ai(r,s),i.callback=t??null,xo(n,i,s),e.current.lanes=s,Ju(e,s,r),Fr(e,r),e}function yh(e,t,n,r){var s=t.current,i=Nr(),a=bo(s);return n=j_(n),t.context===null?t.context=n:t.pendingContext=n,t=Ai(i,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=xo(s,t,a),e!==null&&($s(e,s,a,i),Ff(e,s,a)),a}function _p(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 N0(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Cw(e,t){N0(e,t),(e=e.alternate)&&N0(e,t)}function W2(){return null}var __=typeof reportError=="function"?reportError:function(e){console.error(e)};function _w(e){this._internalRoot=e}xh.prototype.render=_w.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Ce(409));yh(e,t,null,null)};xh.prototype.unmount=_w.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;pa(function(){yh(null,e,null,null)}),t[Ti]=null}};function xh(e){this._internalRoot=e}xh.prototype.unstable_scheduleHydration=function(e){if(e){var t=sC();e={blockedOn:null,target:e,priority:t};for(var n=0;n<oo.length&&t!==0&&t<oo[n].priority;n++);oo.splice(n,0,e),n===0&&oC(e)}};function Ew(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function wh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function j0(){}function V2(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=_p(a);i.call(u)}}var a=C_(t,r,e,0,null,!1,!1,"",j0);return e._reactRootContainer=a,e[Ti]=a.current,wu(e.nodeType===8?e.parentNode:e),pa(),a}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var u=_p(c);l.call(u)}}var c=jw(e,0,!1,null,null,!1,!1,"",j0);return e._reactRootContainer=c,e[Ti]=c.current,wu(e.nodeType===8?e.parentNode:e),pa(function(){yh(t,c,n,r)}),c}function bh(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=_p(a);l.call(c)}}yh(t,a,e,s)}else a=V2(n,t,e,s,r);return _p(a)}nC=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Oc(t.pendingLanes);n!==0&&(qx(t,n|1),Fr(t,Tn()),!($t&6)&&(Rl=Tn()+500,Ro()))}break;case 13:pa(function(){var r=Ri(e,1);if(r!==null){var s=Nr();$s(r,e,1,s)}}),Cw(e,1)}};Yx=function(e){if(e.tag===13){var t=Ri(e,134217728);if(t!==null){var n=Nr();$s(t,e,134217728,n)}Cw(e,134217728)}};rC=function(e){if(e.tag===13){var t=bo(e),n=Ri(e,t);if(n!==null){var r=Nr();$s(n,e,t,r)}Cw(e,t)}};sC=function(){return qt};iC=function(e,t){var n=qt;try{return qt=e,t()}finally{qt=n}};Zg=function(e,t,n){switch(t){case"input":if(Ug(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=uh(r);if(!s)throw Error(Ce(90));L1(r),Ug(r,s)}}}break;case"textarea":D1(e,n);break;case"select":t=n.value,t!=null&&hl(e,!!n.multiple,t,!1)}};K1=kw;U1=pa;var K2={usingClientEntryPoint:!1,Events:[Qu,nl,uh,W1,V1,kw]},Sc={findFiberByHostInstance:Xo,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},U2={bundleType:Sc.bundleType,version:Sc.version,rendererPackageName:Sc.rendererPackageName,rendererConfig:Sc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Oi.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=G1(e),e===null?null:e.stateNode},findFiberByHostInstance:Sc.findFiberByHostInstance||W2,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 tf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!tf.isDisabled&&tf.supportsFiber)try{oh=tf.inject(U2),ti=tf}catch{}}ns.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=K2;ns.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ew(t))throw Error(Ce(200));return H2(e,t,null,n)};ns.createRoot=function(e,t){if(!Ew(e))throw Error(Ce(299));var n=!1,r="",s=__;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=jw(e,1,!1,null,null,n,!1,r,s),e[Ti]=t.current,wu(e.nodeType===8?e.parentNode:e),new _w(t)};ns.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(Ce(188)):(e=Object.keys(e).join(","),Error(Ce(268,e)));return e=G1(t),e=e===null?null:e.stateNode,e};ns.flushSync=function(e){return pa(e)};ns.hydrate=function(e,t,n){if(!wh(t))throw Error(Ce(200));return bh(null,e,t,!0,n)};ns.hydrateRoot=function(e,t,n){if(!Ew(e))throw Error(Ce(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",a=__;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=C_(t,null,e,1,n??null,s,!1,i,a),e[Ti]=t.current,wu(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 xh(t)};ns.render=function(e,t,n){if(!wh(t))throw Error(Ce(200));return bh(null,e,t,!1,n)};ns.unmountComponentAtNode=function(e){if(!wh(e))throw Error(Ce(40));return e._reactRootContainer?(pa(function(){bh(null,null,e,!1,function(){e._reactRootContainer=null,e[Ti]=null})}),!0):!1};ns.unstable_batchedUpdates=kw;ns.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!wh(n))throw Error(Ce(200));if(e==null||e._reactInternals===void 0)throw Error(Ce(38));return bh(e,t,n,!1,r)};ns.version="18.3.1-next-f1338f8080-20240426";function E_(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(E_)}catch(e){console.error(e)}}E_(),E1.exports=ns;var Sr=E1.exports,C0=Sr;Fg.createRoot=C0.createRoot,Fg.hydrateRoot=C0.hydrateRoot;const A_=m.createContext(null);function Ty(e){let t=e||"/";return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t||"/"}function q2(){const e=Ty(window.location.pathname);return e==="/"?(window.history.replaceState({},"","/projects"),"/projects"):e}function Y2({children:e}){const[t,n]=m.useState(q2);m.useEffect(()=>{const i=()=>n(Ty(window.location.pathname));return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[]);const r=m.useCallback(i=>{const a=i.startsWith("/")?i:`/${i}`;let l;try{l=new URL(a,window.location.origin)}catch{l=new URL("/",window.location.origin)}const c=Ty(l.pathname),u=l.search||"";window.history.pushState({},"",c+u),n(c)},[]),s=m.useMemo(()=>({path:t,navigate:r}),[t,r]);return o.jsx(A_.Provider,{value:s,children:e})}function li(){const e=m.useContext(A_);if(!e)throw new Error("useRoute must be used within RouteProvider");return e}function G2(){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 _0={};function Ry(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&_0[t[0]]||(typeof t[0]=="string"&&(_0[t[0]]=new Date),G2(...t))}const P_=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function E0(e,t,n){e.loadNamespaces(t,P_(e,n))}function A0(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,P_(e,r))}function J2(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 u=t.services.backendConnector.state[`${l}|${c}`];return u===-1||u===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 X2(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(Ry("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}}):J2(e,t,n)}const Q2=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,Z2={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},e$=e=>Z2[e],t$=e=>e.replace(Q2,e$);let My={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:t$};function n$(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};My={...My,...e}}function r$(){return My}let I_;function s$(e){I_=e}function i$(){return I_}const o$={type:"3rdParty",init(e){n$(e.options.react),s$(e)}},a$=m.createContext();class l${constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const c$=(e,t)=>{const n=m.useRef();return m.useEffect(()=>{n.current=e},[e,t]),n.current};function _r(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:s}=m.useContext(a$)||{},i=n||r||i$();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new l$),!i){Ry("You will need to pass in an i18next instance by using initReactI18next");const x=(C,j)=>typeof j=="string"?j:j&&typeof j=="object"&&typeof j.defaultValue=="string"?j.defaultValue:Array.isArray(C)?C[C.length-1]:C,S=[x,{},!1];return S.t=x,S.i18n={},S.ready=!1,S}i.options.react&&i.options.react.wait!==void 0&&Ry("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...r$(),...i.options.react,...t},{useSuspense:l,keyPrefix:c}=a;let u=e||s||i.options&&i.options.defaultNS;u=typeof u=="string"?[u]:u||["translation"],i.reportNamespaces.addUsedNamespaces&&i.reportNamespaces.addUsedNamespaces(u);const p=(i.isInitialized||i.initializedStoreOnce)&&u.every(x=>X2(x,i,a));function f(){return i.getFixedT(t.lng||null,a.nsMode==="fallback"?u:u[0],c)}const[d,h]=m.useState(f);let y=u.join();t.lng&&(y=`${t.lng}${y}`);const w=c$(y),b=m.useRef(!0);m.useEffect(()=>{const{bindI18n:x,bindI18nStore:S}=a;b.current=!0,!p&&!l&&(t.lng?A0(i,t.lng,u,()=>{b.current&&h(f)}):E0(i,u,()=>{b.current&&h(f)})),p&&w&&w!==y&&b.current&&h(f);function C(){b.current&&h(f)}return x&&i&&i.on(x,C),S&&i&&i.store.on(S,C),()=>{b.current=!1,x&&i&&x.split(" ").forEach(j=>i.off(j,C)),S&&i&&S.split(" ").forEach(j=>i.store.off(j,C))}},[i,y]);const g=m.useRef(!0);m.useEffect(()=>{b.current&&!g.current&&h(f),g.current=!1},[i,c]);const k=[d,i,p];if(k.t=d,k.i18n=i,k.ready=p,p||!p&&!l)return k;throw new Promise(x=>{t.lng?A0(i,t.lng,u,()=>x()):E0(i,u,()=>x())})}const T_="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",u$=[{to:"/projects",labelKey:"common:nav.projects",icon:"folder_open"},{to:"/workspaces",label:"知识库",icon:"folder_managed"},{to:"/nodes",labelKey:"common:nav.nodes",icon:"account_tree"},{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:"/node-studio",label:"节点编辑器",icon:"draw"},{to:"/schedules",label:"定时任务",icon:"event_busy"},{to:"/admin/usage",label:"管理看板",icon:"query_stats",adminOnly:!0},{to:"/feedback",labelKey:"common:nav.feedback",icon:"rate_review"},{to:"/settings",labelKey:"common:nav.settings",icon:"settings"}],d$=[{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 f$(e,t){return t==="/projects"?e==="/projects"||e==="/":t==="/nodes"?e==="/nodes"||e==="/my-nodes":e===t||e.startsWith(t+"/")}function p$({authUser:e,onLogout:t}){const{path:n,navigate:r}=li(),{t:s}=_r(),[i,a]=m.useState(!1);return m.useEffect(()=>{let l=!1;return fetch("/api/ui-context").then(c=>c.json()).then(c=>{l||a(!!c.hideCommunityLinks)}).catch(()=>{}),()=>{l=!0}},[]),o.jsxs("aside",{className:"af-sidebar","aria-label":s("flow:sidebar.mainNav"),children:[o.jsxs("div",{className:"af-brand",children:[o.jsx("div",{className:"af-brand-mark","aria-hidden":!0,children:o.jsx("img",{src:T_,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:u$.filter(l=>!l.adminOnly||(e==null?void 0:e.isAdmin)).map(l=>o.jsxs("button",{type:"button",className:"af-nav-link"+(f$(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:l.label||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&&d$.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 h$="agentflow.pipelineRecent",m$=15;function g$(e){try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function y$(){if(typeof localStorage>"u")return[];const e=localStorage.getItem(h$);return e?g$(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 x$(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 P0(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,u=new Date(c);if(u.setDate(u.getDate()-1),l.toDateString()===u.toDateString())return t("flow:time.yesterday");const p=Math.floor(a/24);return p<7?t("flow:time.daysAgo",{n:p}):`${l.getMonth()+1}/${l.getDate()}`}function w$(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:x$(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,m$)}var Yr=Uint8Array,cl=Uint16Array,b$=Int32Array,R_=new Yr([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]),M_=new Yr([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]),k$=new Yr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$_=function(e,t){for(var n=new cl(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var s=new b$(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}},L_=$_(R_,2),O_=L_.b,v$=L_.r;O_[28]=258,v$[258]=28;var S$=$_(M_,0),N$=S$.b,$y=new cl(32768);for(var ln=0;ln<32768;++ln){var Qi=(ln&43690)>>1|(ln&21845)<<1;Qi=(Qi&52428)>>2|(Qi&13107)<<2,Qi=(Qi&61680)>>4|(Qi&3855)<<4,$y[ln]=((Qi&65280)>>8|(Qi&255)<<8)>>1}var eu=function(e,t,n){for(var r=e.length,s=0,i=new cl(t);s<r;++s)e[s]&&++i[e[s]-1];var a=new cl(t);for(s=1;s<t;++s)a[s]=a[s-1]+i[s-1]<<1;var l;if(n){l=new cl(1<<t);var c=15-t;for(s=0;s<r;++s)if(e[s])for(var u=s<<4|e[s],p=t-e[s],f=a[e[s]-1]++<<p,d=f|(1<<p)-1;f<=d;++f)l[$y[f]>>c]=u}else for(l=new cl(r),s=0;s<r;++s)e[s]&&(l[s]=$y[a[e[s]-1]++]>>15-e[s]);return l},ed=new Yr(288);for(var ln=0;ln<144;++ln)ed[ln]=8;for(var ln=144;ln<256;++ln)ed[ln]=9;for(var ln=256;ln<280;++ln)ed[ln]=7;for(var ln=280;ln<288;++ln)ed[ln]=8;var D_=new Yr(32);for(var ln=0;ln<32;++ln)D_[ln]=5;var j$=eu(ed,9,1),C$=eu(D_,5,1),Wm=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Ns=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},Vm=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},_$=function(e){return(e+7)/8|0},Aw=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Yr(e.subarray(t,n))},E$=["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"],us=function(e,t,n){var r=new Error(t||E$[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,us),!n)throw r;return r},A$=function(e,t,n,r){var s=e.length,i=r?r.length:0;if(!s||t.f&&!t.l)return n||new Yr(0);var a=!n,l=a||t.i!=2,c=t.i;a&&(n=new Yr(s*3));var u=function(le){var ue=n.length;if(le>ue){var Se=new Yr(Math.max(ue*2,le));Se.set(n),n=Se}},p=t.f||0,f=t.p||0,d=t.b||0,h=t.l,y=t.d,w=t.m,b=t.n,g=s*8;do{if(!h){p=Ns(e,f,1);var k=Ns(e,f+1,3);if(f+=3,k)if(k==1)h=j$,y=C$,w=9,b=5;else if(k==2){var j=Ns(e,f,31)+257,E=Ns(e,f+10,15)+4,A=j+Ns(e,f+5,31)+1;f+=14;for(var O=new Yr(A),W=new Yr(19),H=0;H<E;++H)W[k$[H]]=Ns(e,f+H*3,7);f+=E*3;for(var D=Wm(W),R=(1<<D)-1,T=eu(W,D,1),H=0;H<A;){var V=T[Ns(e,f,R)];f+=V&15;var x=V>>4;if(x<16)O[H++]=x;else{var F=0,M=0;for(x==16?(M=3+Ns(e,f,3),f+=2,F=O[H-1]):x==17?(M=3+Ns(e,f,7),f+=3):x==18&&(M=11+Ns(e,f,127),f+=7);M--;)O[H++]=F}}var I=O.subarray(0,j),B=O.subarray(j);w=Wm(I),b=Wm(B),h=eu(I,w,1),y=eu(B,b,1)}else us(1);else{var x=_$(f)+4,S=e[x-4]|e[x-3]<<8,C=x+S;if(C>s){c&&us(0);break}l&&u(d+S),n.set(e.subarray(x,C),d),t.b=d+=S,t.p=f=C*8,t.f=p;continue}if(f>g){c&&us(0);break}}l&&u(d+131072);for(var _=(1<<w)-1,q=(1<<b)-1,z=f;;z=f){var F=h[Vm(e,f)&_],$=F>>4;if(f+=F&15,f>g){c&&us(0);break}if(F||us(2),$<256)n[d++]=$;else if($==256){z=f,h=null;break}else{var Q=$-254;if($>264){var H=$-257,te=R_[H];Q=Ns(e,f,(1<<te)-1)+O_[H],f+=te}var ie=y[Vm(e,f)&q],he=ie>>4;ie||us(3),f+=ie&15;var B=N$[he];if(he>3){var te=M_[he];B+=Vm(e,f)&(1<<te)-1,f+=te}if(f>g){c&&us(0);break}l&&u(d+131072);var ne=d+Q;if(d<B){var ce=i-B,re=Math.min(B,ne);for(ce+d<0&&us(3);d<re;++d)n[d]=r[ce+d]}for(;d<ne;++d)n[d]=n[d-B]}}t.l=h,t.p=z,t.b=d,t.f=p,h&&(p=1,t.m=w,t.d=y,t.n=b)}while(!p);return d!=n.length&&a?Aw(n,0,d):n.subarray(0,d)},P$=new Yr(0),Xs=function(e,t){return e[t]|e[t+1]<<8},Ps=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Km=function(e,t){return Ps(e,t)+Ps(e,t+4)*4294967296};function I$(e,t){return A$(e,{i:2},t&&t.out,t&&t.dictionary)}var Ly=typeof TextDecoder<"u"&&new TextDecoder,T$=0;try{Ly.decode(P$,{stream:!0}),T$=1}catch{}var R$=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:Aw(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 M$(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(Ly)return Ly.decode(e);var s=R$(e),i=s.s,n=s.r;return n.length&&us(8),i}}var $$=function(e,t){return t+30+Xs(e,t+26)+Xs(e,t+28)},L$=function(e,t,n){var r=Xs(e,t+28),s=M$(e.subarray(t+46,t+46+r),!(Xs(e,t+8)&2048)),i=t+46+r,a=Ps(e,t+20),l=n&&a==4294967295?O$(e,i):[a,Ps(e,t+24),Ps(e,t+42)],c=l[0],u=l[1],p=l[2];return[Xs(e,t+10),c,u,s,i+Xs(e,t+30)+Xs(e,t+32),p]},O$=function(e,t){for(;Xs(e,t)!=1;t+=4+Xs(e,t+2));return[Km(e,t+12),Km(e,t+4),Km(e,t+20)]};function D$(e,t){for(var n={},r=e.length-22;Ps(e,r)!=101010256;--r)(!r||e.length-r>65558)&&us(13);var s=Xs(e,r+8);if(!s)return{};var i=Ps(e,r+16),a=i==4294967295||s==65535;if(a){var l=Ps(e,r-12);a=Ps(e,l)==101075792,a&&(s=Ps(e,l+32),i=Ps(e,l+48))}for(var c=0;c<s;++c){var u=L$(e,i,a),p=u[0],f=u[1],d=u[2],h=u[3],y=u[4],w=u[5],b=$$(e,w);i=y,p?p==8?n[h]=I$(e.subarray(b,b+f),{out:new Yr(d)}):us(14,"unknown compression type "+p):n[h]=Aw(e,b,b+f)}return n}const F$=8*1024*1024,z$=500;function B$(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 H$(e){return e?e.split("/").some(n=>n==="__MACOSX"||n.startsWith("._")):!0}function W$(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 V$=/^[a-zA-Z][a-zA-Z0-9_-]*$/;async function K$(e){try{const t=new Uint8Array(await e.arrayBuffer()),n=D$(t),r=new Map;let s=0,i=0;for(const[c,u]of Object.entries(n)){if(c.endsWith("/"))continue;const p=B$(c);if(!p||H$(p))continue;const f=(u==null?void 0:u.length)??0;if(s+=f,s>F$||(i+=1,i>z$))return null;r.set(p,f)}if(r.size===0)return null;const a=new Set;for(const c of r.keys()){const u=W$(c);u!==null&&a.add(u)}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 V$.test(l)?l:null}catch{return null}}const Um=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function U$({file:e,onClose:t,onImported:n}){const{t:r}=_r(),s=m.useId(),i=m.useRef(null),a=m.useRef(null),[l,c]=m.useState(""),[u,p]=m.useState("user"),[f,d]=m.useState(!1),[h,y]=m.useState(""),[w,b]=m.useState(null),g=w??e;m.useEffect(()=>{const C=requestAnimationFrame(()=>{var j;return(j=i.current)==null?void 0:j.focus()});return()=>cancelAnimationFrame(C)},[]),m.useEffect(()=>{let C=!1;return(async()=>{const j=g.name||"",E=j.toLowerCase();let A="";if(E.endsWith(".zip")){if(A=await K$(g)||"",!A){const O=j.replace(/\.zip$/i,"");Um.test(O)&&(A=O)}}else if(E.endsWith(".yaml")||E.endsWith(".yml")){const O=j.replace(/\.ya?ml$/i,"");Um.test(O)&&(A=O)}C||c(A)})(),()=>{C=!0}},[g]);const k=l.trim(),x=k.length>0&&Um.test(k);async function S(C){if(C.preventDefault(),!(!x||f)){d(!0),y("");try{const j=new FormData;j.set("flowId",k),j.set("targetSpace",u),j.set("file",g,g.name);const E=await fetch("/api/flows/import",{method:"POST",body:j}),A=await E.json().catch(()=>({}));if(!E.ok){y(typeof A.error=="string"?A.error:r("project:importModal.importFailed"));return}n({id:A.flowId,source:A.flowSource??"user"})}catch(j){y(String((j==null?void 0:j.message)||j))}finally{d(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:C=>{C.target===C.currentTarget&&t()},children:o.jsxs("div",{ref:i,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":s,tabIndex:-1,onMouseDown:C=>C.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:s,className:"af-shortcuts-panel__title",children:r("project:importModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":r("project:importModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:S,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:r("project:importModal.lead",{filename:g.name})}),o.jsx("input",{ref:a,type:"file",className:"af-import-file-input",accept:".yaml,.yml,.zip,application/zip","aria-hidden":!0,tabIndex:-1,onChange:C=>{var E;const j=(E=C.target.files)==null?void 0:E[0];j&&b(j),C.target.value=""}}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:importModal.nameLabel")}),o.jsx("input",{className:"af-new-pipeline-input",type:"text",name:"importFlowId",autoComplete:"off",spellCheck:!1,placeholder:r("project:importModal.namePlaceholder"),value:l,onChange:C=>c(C.target.value),"aria-invalid":k.length>0&&!x}),o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r("project:importModal.nameHint")})]}),o.jsx("div",{className:"af-import-repick",children:o.jsx("button",{type:"button",className:"af-btn-secondary af-import-repick-btn",onClick:()=>{var C;return(C=a.current)==null?void 0:C.click()},children:r("project:importModal.changeFile")})}),h?o.jsx("p",{className:"af-err af-new-pipeline-err",children:h}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:f,children:r("project:importModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!x||f,children:r(f?"project:importModal.importing":"project:importModal.importAndOpen")})]})]})]})})}const q$=/^[a-zA-Z][a-zA-Z0-9_-]*$/,I0="af:newPipelineGuide";function Y$({open:e,onClose:t,onCreated:n}){const{t:r}=_r(),s=m.useId(),i=m.useRef(null),[a,l]=m.useState(""),[c,u]=m.useState(""),[p,f]=m.useState("user"),[d,h]=m.useState(!1),[y,w]=m.useState(""),[b,g]=m.useState(!1);m.useEffect(()=>{if(!e)return;l(""),u(""),f("user"),w(""),h(!1),localStorage.getItem(I0)==="true"&&g(!0);const E=requestAnimationFrame(()=>{var A;return(A=i.current)==null?void 0:A.focus()});return()=>cancelAnimationFrame(E)},[e]);const k=()=>{localStorage.removeItem(I0),g(!1)};if(!e)return null;const x=a.trim(),S=x.length>0&&q$.test(x);async function C(j){if(j.preventDefault(),!(!S||d)){h(!0),w(""),k();try{const E=await fetch("/api/flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:x,description:c.trim(),targetSpace:p})}),A=await E.json().catch(()=>({}));if(!E.ok){w(typeof A.error=="string"?A.error:r("project:newPipelineModal.createFailed"));return}n({id:A.flowId,source:A.flowSource??"user"})}catch(E){w(String((E==null?void 0:E.message)||E))}finally{h(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:j=>{j.target===j.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:j=>j.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:s,className:"af-shortcuts-panel__title",children:r("project:newPipelineModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:()=>{k(),t()},"aria-label":r("project:newPipelineModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),b?o.jsx("div",{className:"af-new-pipeline-guide",children:o.jsxs("div",{className:"af-new-pipeline-guide-content",children:[o.jsx("span",{className:"material-symbols-outlined af-new-pipeline-guide-icon",children:"lightbulb"}),o.jsxs("div",{className:"af-new-pipeline-guide-text",children:[o.jsx("p",{children:o.jsx("strong",{children:r("onboarding:newPipeline.guideTitle")})}),o.jsx("p",{children:r("onboarding:newPipeline.guideDesc")})]}),o.jsx("button",{type:"button",className:"af-new-pipeline-guide-close",onClick: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:C,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:r("project:newPipelineModal.lead")}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:newPipelineModal.nameLabel")}),o.jsx("input",{className:"af-new-pipeline-input",type:"text",name:"pipelineName",autoComplete:"off",spellCheck:!1,placeholder:r("project:newPipelineModal.namePlaceholder"),value:a,onChange:j=>l(j.target.value),"aria-invalid":x.length>0&&!S}),o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r(b?"onboarding:newPipeline.nameHintGuide":"project:newPipelineModal.nameHint")})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:newPipelineModal.descLabel")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea af-new-pipeline-textarea",name:"pipelineDescription",rows:3,placeholder:r(b?"onboarding:newPipeline.descPlaceholderGuide":"project:newPipelineModal.descPlaceholder"),value:c,onChange:j=>u(j.target.value)}),b?o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-guide-hint",children:r("onboarding:newPipeline.descHintGuide")}):null]}),y?o.jsx("p",{className:"af-err af-new-pipeline-err",children:y}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:()=>{k(),t()},disabled:d,children:r("project:newPipelineModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!S||d,children:r(d?"project:newPipelineModal.creating":b?"onboarding:newPipeline.createGuide":"project:newPipelineModal.createAndOpen")})]})]})]})})}const F_="agentflow.pipelineViewPreference";function z_(e,t="user",n=!1){return`${String(t||"user")}:${String(e||"")}:${n?"archived":"active"}`}function B_(){if(typeof localStorage>"u")return{};try{const e=JSON.parse(localStorage.getItem(F_)||"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function G$(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(F_,JSON.stringify(e))}catch{}}function Pw(e){return e==="display"?"display":"workspace"}function J$(e){const t=String(e||"").toLowerCase();return t==="builtin"||t==="admin"}function H_(e,t){const n=Pw(t);return n==="pipeline"&&J$(e==null?void 0:e.source)?"workspace":n}function X$(e){return(e==null?void 0:e.hasPipeline)!==!1&&(e==null?void 0:e.hasFlow)!==!1&&(e==null?void 0:e.flowYaml)!==!1}function Q$(e,t,n,r=!1){if(!e)return;const s=B_();s[z_(e,t,r)]={view:Pw(n),at:Date.now()},G$(s)}function Z$(e,t="workspace"){if(!(e!=null&&e.id))return Pw(t);const r=B_()[z_(e.id,e.source??"user",!!e.archived)],s=H_(e,(r==null?void 0:r.view)||t);return s==="pipeline"&&!X$(e)?"workspace":s}function eL(e,t="workspace"){const n=H_(e,t);if(!(e!=null&&e.id))return n==="display"?"/workspace?view=display":"/workspace";const r=new URLSearchParams({flowId:e.id,flowSource:e.source??"user"});return e.archived&&r.set("archived","1"),n==="display"&&r.set("view","display"),`/workspace?${r.toString()}`}function nf(e,t="workspace"){return eL(e,Z$(e,t))}function tL(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 Oy(e){return String((e==null?void 0:e.version)||"").trim()}function nL(e){const t=Oy(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 rL({onChanged:e,canManage:t=!1}){const[n,r]=m.useState({available:!1,version:"",loggedIn:!1,user:"",error:""}),[s,i]=m.useState([]),[a,l]=m.useState(""),[c,u]=m.useState(""),[p,f]=m.useState("keyword"),[d,h]=m.useState([]),[y,w]=m.useState({}),[b,g]=m.useState(""),[k,x]=m.useState(""),[S,C]=m.useState(""),j=m.useCallback(async()=>{x("");try{const[D,R]=await Promise.all([fetch("/api/skillhub/status"),fetch("/api/skillhub/list?target=agentflow&agent=codex")]),T=await D.json().catch(()=>({}));D.ok&&r({available:!!T.available,version:typeof T.version=="string"?T.version:"",loggedIn:!!T.loggedIn,user:typeof T.user=="string"?T.user:"",error:typeof T.error=="string"?T.error:""});const V=await R.json().catch(()=>({}));if(!R.ok)throw new Error(typeof V.error=="string"?V.error:"HTTP "+R.status);i(Array.isArray(V.skills)?V.skills:[]),l(typeof V.skillsRoot=="string"?V.skillsRoot:""),w({})}catch(D){x(String(D.message||D))}},[]);m.useEffect(()=>{j()},[j]);const E=m.useCallback(async()=>{const D=c.trim();if(D){g("search"),x(""),C("");try{const R=await fetch(`/api/skillhub/search?q=${encodeURIComponent(D)}&mode=${encodeURIComponent(p)}`),T=await R.json().catch(()=>({}));if(!R.ok)throw new Error(typeof T.error=="string"?T.error:"HTTP "+R.status);h(Array.isArray(T.items)?T.items:[])}catch(R){x(String(R.message||R))}finally{g("")}}},[c,p]),A=m.useCallback(async(D,R=!1)=>{if(!t)return;const T=D&&typeof D=="object"?D:null,V=String(T?T.slug||T.name||T.collection||T.skillId||T.id:D||"").trim();if(V){g(`install:${V}`),x(""),C("");try{const F=T?{slug:T.slug||"",skillId:T.skillId||"",collection:T.collection||"",collectionName:T.collection&&T.name||"",target:"agentflow",agent:"codex",force:R}:{slug:V,target:"agentflow",agent:"codex",force:R},M=await fetch("/api/skillhub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F)}),I=await M.json().catch(()=>({}));if(!M.ok)throw new Error(typeof I.error=="string"?I.error:"HTTP "+M.status);C(R?`已更新 ${V}`:`已安装 ${V}`),await j(),typeof e=="function"&&await e()}catch(F){x(String(F.message||F))}finally{g("")}}},[t,j,e]),O=m.useCallback(async()=>{if(t&&s.length!==0){g("check-updates"),x(""),C("");try{const D=await Promise.all(s.map(async V=>{const F=String(V.name||"").trim();if(!F)return null;try{const M=await fetch(`/api/skillhub/search?q=${encodeURIComponent(F)}&mode=keyword`),I=await M.json().catch(()=>({}));if(!M.ok)throw new Error(typeof I.error=="string"?I.error:"HTTP "+M.status);const B=Array.isArray(I.items)?I.items:[],_=B.find(Q=>Q.slug===F||Q.name===F||Q.id===F)||B[0],q=Oy(V),z=String((_==null?void 0:_.version)||"").trim();let $="unknown";return _?q&&z?$=tL(q,z)<0?"update":"current":z&&($="remote-only"):$="missing",[F,{state:$,latestVersion:z,installedVersion:q,summary:(_==null?void 0:_.summary)||""}]}catch(M){return[F,{state:"error",error:String(M.message||M),installedVersion:Oy(V)}]}})),R={};for(const V of D)V&&(R[V[0]]=V[1]);w(R);const T=Object.values(R).filter(V=>V.state==="update").length;C(T>0?`发现 ${T} 个可更新 skill`:"已检查,暂无明确可更新项")}finally{g("")}}},[t,s]),W=m.useCallback(async D=>{if(!t)return;const R=String(D||"").trim();if(R){g(`uninstall:${R}`),x(""),C("");try{const T=await fetch("/api/skillhub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:R,target:"agentflow",agent:"codex"})}),V=await T.json().catch(()=>({}));if(!T.ok)throw new Error(typeof V.error=="string"?V.error:"HTTP "+T.status);C(`已卸载 ${R}`),await j(),typeof e=="function"&&await e()}catch(T){x(String(T.message||T))}finally{g("")}}},[t,j,e]),H=m.useCallback(async()=>{if(t){g("update-cli"),x(""),C("");try{const D=await fetch("/api/skillhub/update",{method:"POST"}),R=await D.json().catch(()=>({}));if(!D.ok)throw new Error(typeof R.error=="string"?R.error:"HTTP "+D.status);C("SkillHub CLI 已更新"),await j()}catch(D){x(String(D.message||D))}finally{g("")}}},[t,j]);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:t?"搜索、安装、更新和卸载 AgentFlow 共享 skills。":"查看 AgentFlow 共享 skills;使用时在 Workspace 中通过 Load Skills 加载。"}),a?o.jsxs("p",{className:"af-set-hint af-set-hint--inline",children:["Skills Root:",o.jsx("code",{children:a})]}):null]}),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:n.loggedIn?`已登录 ${n.user}`:"未登录 SkillHub"}),o.jsx("span",{className:"af-set-badge"+(n.available?" af-set-badge--ok":" af-set-badge--err"),children:n.available?`v${n.version}`:"not found"})]}),o.jsxs("div",{className:"af-set-skillhub-toolbar",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:j,disabled:!!b,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:O,disabled:!t||!!b||s.length===0,children:b==="check-updates"?"检查中…":"检查更新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:H,disabled:!t||!!b,children:b==="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:p,onChange:D=>{f(D.target.value),h([])},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:c,onChange:D=>u(D.target.value),onKeyDown:D=>{D.key==="Enter"&&E()},placeholder:p==="collectionId"?"输入 collection id,例如 1":p==="skillId"?"输入 skill id":"搜索 skill slug / 关键词,例如 android、issue-tracker"}),o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:()=>E(),disabled:!c.trim()||b==="search",children:[o.jsx("span",{className:"material-symbols-outlined",children:"search"}),b==="search"?"搜索中…":"搜索"]})]}),k?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:k}):null,S?o.jsx("p",{className:"af-set-hint af-set-hint--inline",children:S}):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:s.length})]}),o.jsx("div",{className:"af-set-skillhub-list",children:s.length===0?o.jsx("div",{className:"af-set-skillhub-empty",children:"暂无 AgentFlow 共享 skills"}):s.map(D=>{const R=y[D.name],T=!R||R.state==="update"||R.state==="remote-only"||R.state==="unknown"||R.state==="error",V=b===`install:${D.name}`?"更新中…":(R==null?void 0:R.state)==="current"?"已最新":(R==null?void 0:R.state)==="update"&&R.latestVersion?`更新到 v${R.latestVersion}`:(R==null?void 0:R.state)==="remote-only"&&R.latestVersion?`安装 v${R.latestVersion}`:"重装";return o.jsxs("div",{className:"af-set-skillhub-item",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-set-skillhub-title",children:D.displayName||D.name}),o.jsx("div",{className:"af-set-skillhub-meta",children:nL(D)}),o.jsx("div",{className:"af-set-skillhub-version-row",children:R?R.state==="update"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--warn",children:["可更新 ",R.installedVersion?`v${R.installedVersion} -> `:"","v",R.latestVersion]}):R.state==="current"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--ok",children:["已最新 v",R.latestVersion||R.installedVersion]}):R.state==="remote-only"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:["远端 v",R.latestVersion,",本地版本未知"]}):R.state==="missing"?o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"未找到远端匹配项"}):R.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(D.name,!0),disabled:!t||!!b||!T,children:V}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>W(D.name),disabled:!t||!!b,children:"卸载"})]})]},`${D.agent}:${D.path}:${D.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(D=>{const R=D.slug||D.name,T=D.kind==="collection"||D.collection,V=!T&&s.some(F=>F.name===R||F.name===D.name);return o.jsxs("div",{className:"af-set-skillhub-item",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-set-skillhub-title",children:D.name||R}),o.jsxs("div",{className:"af-set-skillhub-meta",children:[T?`collection:${D.collection}`:R,D.skillId?` · id:${D.skillId}`:"",D.version?` · ${D.version}`:""]}),D.summary?o.jsx("p",{className:"af-set-skillhub-summary",children:D.summary}):null]}),o.jsx("button",{type:"button",className:V?"af-set-btn-mini":"af-set-btn-add af-set-btn-add--compact",onClick:()=>A(D,V),disabled:!t||!!b,children:V?"更新":T?"安装合集":"安装"})]},D.id||R)})})]})]})]})}function sa(e){return(Array.isArray(e==null?void 0:e.collections)?e.collections:[]).filter(n=>n&&typeof n=="object").map(n=>({id:String(n.id||n.name||"").trim(),name:String(n.name||n.id||"").trim(),skillKeys:Array.from(new Set((Array.isArray(n.skillKeys)?n.skillKeys:[]).map(r=>String(r||"").trim()).filter(Boolean))),builtin:!!n.builtin,createdAt:Number.isFinite(n.createdAt)?Number(n.createdAt):Date.now(),updatedAt:Number.isFinite(n.updatedAt)?Number(n.updatedAt):Date.now()})).filter(n=>n.id&&n.name)}function sL(e){return{version:1,collections:sa({collections:e})}}function iL(e){const t=String(e||"").trim(),n=t.indexOf(":");return n>=0?t.slice(n+1).trim():t}function W_(e){const t=new Map,n=new Map;for(const r of Array.isArray(e)?e:[])r!=null&&r.key&&t.set(r.key,r.key),r!=null&&r.name&&(r!=null&&r.key)&&!n.has(r.name)&&n.set(r.name,r.key);return r=>{const s=String(r||"").trim();return s&&(t.get(s)||n.get(iL(s)))||""}}function ha(e,t){const n=W_(t);return Array.from(new Set((Array.isArray(e==null?void 0:e.skillKeys)?e.skillKeys:[]).map(r=>n(r)).filter(Boolean)))}function oL(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 aL(e,t){const n=new Set(Array.isArray(t)?t:[]);return(Array.isArray(e)?e:[]).filter(r=>!n.has(r))}function lL(e,t,n){const r=ha(e,n);if(r.length===0)return"empty";const s=r.filter(i=>t.has(i)).length;return s===0?"none":s===r.length?"all":"partial"}function cL(e,t,n){const r=String(e).trim().toLowerCase(),s=sa({collections:n}).find(i=>i.id===r||i.name.toLowerCase()===r);return ha(s,t)}function uL(e,t,n,r){const s=(Array.isArray(n)?n:[]).map(u=>u.key).filter(Boolean),i=String(t).trim().toLowerCase(),a=sa({collections:r}),l=cL(t,n,r),c=l.length>0?l:s;if(!e)return c;try{const u=localStorage.getItem(e);if(u!==null){const p=JSON.parse(u);if(Array.isArray(p)){const f=W_(n),d=Array.from(new Set(p.map(f).filter(Boolean)));if(s.length>0&&d.length===s.length)return c;const h=new Set(d),y=new Set(l),w=l.length>0&&l.every(g=>h.has(g)),b=a.some(g=>{if(!g.builtin||g.id===i||g.name.toLowerCase()===i)return!1;const k=ha(g,n);return k.length>0&&k.every(x=>h.has(x))});return l.length>0&&b&&!w?c:d}}}catch{}return c}function Nc(e){return e==="builtin"?"af-proj-badge af-proj-badge--builtin":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 dL(e){const t=e??"user";return t==="builtin"||t==="admin"?"af-project-card af-project-card--builtin":"af-project-card"}function fL(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 Dy(e,t){return e==="builtin"?{label:t("project:sourceBadge.builtin"),tone:"builtin"}:e==="admin"?{label:t("project:sourceBadge.builtin"),tone:"builtin"}:e==="workspace"?{label:t("project:sourceBadge.workspace"),tone:"secondary"}:{label:t("project:sourceBadge.user"),tone:"primary"}}function V_(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 pL="project:defaultCardDesc";function K_(e,t){const n=e.description!=null?String(e.description).trim():"";return n!==""?n:t(pL)}function hL(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function In({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(`(${hL(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 mL(e,t,n){const r=[String(e.id),K_(e,n),V_(e),Dy(e.source,n).label];return e.archived&&r.push(n("project:archived")),r.join(`
|
|
41
|
-
`).toLowerCase()}function gL(e,t,n){return t?mL(e,t,n).includes(t):!0}function yL(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 qm(e,t){const n=e.trim().toLowerCase();return n?t.filter(Boolean).join(`
|
|
42
|
-
`).toLowerCase().includes(n):!0}function T0(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 R0(e){return e!=null&&e.packageDir?e.packageDir:`marketplace/flow-snippets / ${(e==null?void 0:e.id)||""}`}const xL=["all","agent","control","provide","marketplace"],wL=["all","agent","control","provide"],U_="agentflow.projects.activityPanelOpen",Fy="agentflow.projects.activitySelected";function bL(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(U_);return e!=="0"}function M0(e){return`${(e==null?void 0:e.flowSource)||"user"}:${(e==null?void 0:e.flowId)||""}`}function kL(){return typeof localStorage>"u"?"":localStorage.getItem(Fy)||""}function rf(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 vL(e,t){if((e==null?void 0:e.source)!=="marketplace")return!1;const n=String((e==null?void 0:e.ownerUserId)||(e==null?void 0:e.createdBy)||"").trim();return n?new Set([String((t==null?void 0:t.userId)||"").trim(),String((t==null?void 0:t.username)||"").trim()].filter(Boolean)).has(n):!0}function Zi(e){return`${(e==null?void 0:e.id)||""}:${(e==null?void 0:e.version)||""}:${(e==null?void 0:e.packageDir)||""}`}function q_(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 Y_(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 zy(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 $0(e,t){return String((e==null?void 0:e.label)||(e==null?void 0:e.displayName)||(e==null?void 0:e.name)||zy(e,t))}function SL(e){return String((e==null?void 0:e.definitionId)||(e==null?void 0:e.type)||(e==null?void 0:e.runtimeType)||"").replace(/^marketplace:/,"")}function L0(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 NL(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 Ym(e,t=16){const n=String(e||"").trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function jL(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 CL(e,t){const n=e.map(p=>p.id),r=new Set(n),s=new Map(n.map(p=>[p,0])),i=new Map(n.map(p=>[p,[]]));t.forEach(p=>{var f;!r.has(p.sourceId)||!r.has(p.targetId)||(s.set(p.targetId,(s.get(p.targetId)||0)+1),(f=i.get(p.sourceId))==null||f.push(p.targetId))});const a=new Map,l=n.filter(p=>(s.get(p)||0)===0);l.length===0&&n[0]&&l.push(n[0]),l.forEach(p=>a.set(p,0));for(let p=0;p<l.length;p+=1){const f=l[p],d=(a.get(f)||0)+1;for(const h of i.get(f)||[])(!a.has(h)||d>a.get(h))&&(a.set(h,d),l.push(h))}n.forEach((p,f)=>{a.has(p)||a.set(p,f%3)});const c=new Map,u=new Map;return n.forEach(p=>{const f=a.get(p)||0,d=c.get(f)||0;c.set(f,d+1),u.set(p,{x:f*190,y:d*86})}),u}function _L(e){var w,b,g,k;const t=q_(e),n=Y_(e),r=new Map(t.map((x,S)=>[zy(x,S),$0(x,S)])),s=t.map((x,S)=>({id:zy(x,S),title:$0(x,S),meta:SL(x)})),i=n.map((x,S)=>{const C=L0(x,"source"),j=L0(x,"target");return{key:(x==null?void 0:x.id)||`${C}-${j}-${S}`,sourceId:C,targetId:j,source:r.get(C)||C||"?",target:r.get(j)||j||"?",label:NL(x)}}),a=(b=(w=e==null?void 0:e.snippet)==null?void 0:w.ui)!=null&&b.nodePositions&&typeof e.snippet.ui.nodePositions=="object"?e.snippet.ui.nodePositions:{},l=(k=(g=e==null?void 0:e.snippet)==null?void 0:g.ui)!=null&&k.nodeSizes&&typeof e.snippet.ui.nodeSizes=="object"?e.snippet.ui.nodeSizes:{},c=CL(s,i),u=s.map(x=>{const S=jL(a[x.id])||c.get(x.id)||{x:0,y:0},C=l[x.id]&&typeof l[x.id]=="object"?l[x.id]:{},j=Number(C.width),E=Number(C.height),A=Math.max(132,Math.min(210,Number.isFinite(j)?j*.62:150)),O=Math.max(48,Math.min(76,Number.isFinite(E)?E*.46:54));return{...x,x:S.x,y:S.y,width:A,height:O}}),p=new Map(u.map(x=>[x.id,x])),f=i.map(x=>{const S=p.get(x.sourceId),C=p.get(x.targetId);if(!S||!C)return null;const j=S.x+S.width,E=S.y+S.height/2,A=C.x,O=C.y+C.height/2,W=Math.max(48,Math.abs(A-j)*.45);return{...x,path:`M ${j} ${E} C ${j+W} ${E}, ${A-W} ${O}, ${A} ${O}`,labelX:(j+A)/2,labelY:(E+O)/2}}).filter(Boolean),d=u.reduce((x,S)=>({minX:Math.min(x.minX,S.x),minY:Math.min(x.minY,S.y),maxX:Math.max(x.maxX,S.x+S.width),maxY:Math.max(x.maxY,S.y+S.height)}),{minX:0,minY:0,maxX:420,maxY:220}),h=36,y=`${d.minX-h} ${d.minY-h} ${Math.max(360,d.maxX-d.minX+h*2)} ${Math.max(180,d.maxY-d.minY+h*2)}`;return{nodes:s,edges:i,diagram:{nodes:u,edges:f,viewBox:y}}}function Ha({resourceKind:e="",authUser:t=null}){var me,Sn,Wr,Zn,is,xr;const{t:n}=_r(),{navigate:r,path:s}=li(),i=!!(t!=null&&t.isAdmin),[a,l]=m.useState(e||"all"),[c,u]=m.useState([]),[p,f]=m.useState([]),[d,h]=m.useState([]),[y,w]=m.useState([]),[b,g]=m.useState([]),[k,x]=m.useState(""),[S,C]=m.useState(!1),[j,E]=m.useState([]),[A,O]=m.useState(""),[W,H]=m.useState(""),[D,R]=m.useState(!1),[T,V]=m.useState(!1),[F,M]=m.useState(!1),[I,B]=m.useState(null),[_,q]=m.useState(!1),[z,$]=m.useState(""),[Q,te]=m.useState(bL),[ie,he]=m.useState(kL),[ne,ce]=m.useState("all"),[re,le]=m.useState(""),[ue,Se]=m.useState("overview"),[De,Ye]=m.useState({}),[Ie,Je]=m.useState(""),[Et,bt]=m.useState({}),[Pe,rt]=m.useState(""),[At,zt]=m.useState(""),[Kt,tt]=m.useState({}),[oe,be]=m.useState(""),[ke,st]=m.useState(""),[Ze,kt]=m.useState(""),[Bt,Gt]=m.useState(""),[Z,xe]=m.useState(""),[$e,Ee]=m.useState(!1),[ut,St]=m.useState(""),[ir,Er]=m.useState({hiddenBuiltins:[],promoted:[]}),Xn=m.useRef(0),hn=m.useRef(0),Cn=m.useRef(0),_n=m.useCallback(async()=>{var fe,Te;const U=++hn.current;O("");try{const Ae=await fetch("/api/flows");if(U!==hn.current)return;if(!Ae.ok)throw new Error("HTTP "+Ae.status);const Xe=await Ae.json();if(U!==hn.current)return;u(Array.isArray(Xe)?Xe:[])}catch(Ae){if(U!==hn.current)return;u([]),O(String(Ae.message||Ae))}try{const Ae=await fetch("/api/pipeline-recent-runs");if(U!==hn.current)return;if(Ae.ok){const Xe=await Ae.json();if(U!==hn.current)return;E(Array.isArray(Xe.runs)?Xe.runs:[])}else E([])}catch{if(U!==hn.current)return;E([])}if(t!=null&&t.isAdmin)try{const Ae=await fetch("/api/admin/builtin-flows");if(U!==hn.current)return;const Xe=await Ae.json().catch(()=>({}));Ae.ok&&Er({hiddenBuiltins:Array.isArray((fe=Xe==null?void 0:Xe.config)==null?void 0:fe.hiddenBuiltins)?Xe.config.hiddenBuiltins:[],promoted:Array.isArray((Te=Xe==null?void 0:Xe.config)==null?void 0:Te.promoted)?Xe.config.promoted:[]})}catch{if(U!==hn.current)return;Er({hiddenBuiltins:[],promoted:[]})}else Er({hiddenBuiltins:[],promoted:[]});R(!0)},[t==null?void 0:t.isAdmin]),mr=m.useCallback(async(U,fe)=>{if(!(t!=null&&t.isAdmin)||!(U!=null&&U.id))return;const Te=`${fe}:${U.source}:${U.id}`;St(Te),O("");try{const Ae=await fetch("/api/admin/builtin-flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:fe,flowId:U.id,ownerUserId:U.ownerUserId||t.userId})}),Xe=await Ae.json().catch(()=>({}));if(!Ae.ok)throw new Error(Xe.error||"更新内置配置失败");await _n()}catch(Ae){O(String(Ae.message||Ae))}finally{St("")}},[t==null?void 0:t.isAdmin,t==null?void 0:t.userId,_n]),En=m.useCallback(async()=>{const U=++Cn.current;H(""),V(!1);const fe="/api/nodes",Te=e==="my-flows"?"/api/marketplace/flow-snippets?scope=owned":"/api/marketplace/flow-snippets";f([]),w([]),le("");try{const[Ae,Xe,Qt,Pt]=await Promise.all([fetch(fe),fetch("/api/skills"),fetch("/api/skill-collections"),fetch(Te)]),Kn=await Ae.json().catch(()=>({})),os=await Xe.json().catch(()=>({})),fi=await Qt.json().catch(()=>({})),$o=await Pt.json().catch(()=>({}));if(!Ae.ok)throw new Error(Kn.error||"Nodes HTTP "+Ae.status);if(!Xe.ok)throw new Error(os.error||"Skills HTTP "+Xe.status);if(!Qt.ok)throw new Error(fi.error||"Collections HTTP "+Qt.status);if(!Pt.ok)throw new Error($o.error||"Flow snippets HTTP "+Pt.status);if(U!==Cn.current)return;f(Array.isArray(Kn.nodes)?Kn.nodes:Array.isArray(Kn)?Kn:[]),h(Array.isArray(os.skills)?os.skills:[]),g(sa(fi)),w(Array.isArray($o.snippets)?$o.snippets:[])}catch(Ae){if(U!==Cn.current)return;f([]),h([]),w([]),g([]),H(String(Ae.message||Ae))}finally{if(U!==Cn.current)return;V(!0)}},[e]);m.useEffect(()=>{R(!1),_n(),En()},[_n,En]),m.useEffect(()=>{try{localStorage.setItem(U_,Q?"1":"0")}catch{}},[Q]),m.useEffect(()=>{try{ie?localStorage.setItem(Fy,ie):localStorage.removeItem(Fy)}catch{}},[ie]),m.useEffect(()=>{let U=!1;return fetch("/api/ui-context").then(fe=>fe.json()).then(fe=>{U||Ee(!!fe.hideCommunityLinks)}).catch(()=>{}),()=>{U=!0}},[]);const Dn=m.useCallback(async U=>{if(!i)return;const fe=sa({collections:U});C(!0),H("");try{const Te=await fetch("/api/skill-collections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(sL(fe))}),Ae=await Te.json().catch(()=>({}));if(!Te.ok)throw new Error(Ae.error||"Collections HTTP "+Te.status);g(sa(Ae))}catch(Te){H(String(Te.message||Te))}finally{C(!1)}},[i]),Qn=m.useCallback(()=>{if(!i)return;const U=k.trim();if(!U)return;const fe=U.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"collection",Te=new Set(b.map(Pt=>Pt.id));let Ae=fe,Xe=2;for(;Te.has(Ae);)Ae=`${fe}-${Xe++}`;const Qt=Date.now();Dn([...b,{id:Ae,name:U,skillKeys:[],createdAt:Qt,updatedAt:Qt}]),x(""),ce(`collection:${Ae}`)},[i,k,Dn,b]),Hr=m.useCallback(U=>{if(!i)return;const fe=b.find(Ae=>Ae.id===U);if(fe!=null&&fe.builtin)return;const Te=b.filter(Ae=>Ae.id!==U);ne===`collection:${U}`&&ce("all"),Dn(Te)},[i,ne,Dn,b]),gr=m.useCallback((U,fe,Te)=>{if(!i)return;const Ae=String(fe||"").trim();if(!Ae)return;const Xe=Date.now(),Qt=b.map(Pt=>{if(Pt.id!==U)return Pt;const Kn=new Set(Pt.skillKeys||[]);return Te?Kn.add(Ae):Kn.delete(Ae),{...Pt,skillKeys:Array.from(Kn),updatedAt:Xe}});Dn(Qt)},[i,Dn,b]),An=m.useCallback(async U=>{const fe=U==null?void 0:U.packageId,Te=U==null?void 0:U.version;if(!fe||!Te||!window.confirm(n("project:deleteMyNodeConfirm",{id:fe,version:Te})))return;const Ae=dn(U);st(Ae),kt(""),H("");try{const Xe=new URLSearchParams({id:fe,version:Te}),Qt=await fetch(`/api/marketplace/node?${Xe.toString()}`,{method:"DELETE"}),Pt=await Qt.json().catch(()=>({}));if(!Qt.ok||(Pt==null?void 0:Pt.ok)===!1){const Kn=Array.isArray(Pt==null?void 0:Pt.usage)&&Pt.usage.length>0?` ${n("project:deleteMyNodeUsedBy",{count:Pt.usage.length})}`:"";throw new Error(((Pt==null?void 0:Pt.error)||"Delete failed")+Kn)}kt(n("project:deleteMyNodeSuccess",{id:fe,version:Te})),bt(Kn=>{const os={...Kn};return delete os[Ae],os}),tt(Kn=>{const os={};for(const[fi,$o]of Object.entries(Kn))fi.startsWith(`${Ae}:`)||(os[fi]=$o);return os}),le(""),await En()}catch(Xe){kt(String(Xe.message||Xe))}finally{st("")}},[En,n]),ss=m.useCallback(async U=>{const fe=U==null?void 0:U.id,Te=(U==null?void 0:U.version)||"1.0.0";if(!fe||!Te||!window.confirm(n("project:deleteMyFlowConfirm",{id:fe,version:Te})))return;const Ae=Zi(U);Gt(Ae),xe(""),H("");try{const Xe=new URLSearchParams({id:fe,version:Te}),Qt=await fetch(`/api/marketplace/flow-snippet?${Xe.toString()}`,{method:"DELETE"}),Pt=await Qt.json().catch(()=>({}));if(!Qt.ok||(Pt==null?void 0:Pt.ok)===!1)throw new Error((Pt==null?void 0:Pt.error)||"Delete failed");xe(n("project:deleteMyFlowSuccess",{id:fe,version:Te})),le(""),await En()}catch(Xe){xe(String(Xe.message||Xe))}finally{Gt("")}},[En,n]);m.useEffect(()=>{if(e==="nodes"||e==="my-nodes"||e==="my-flows"||e==="skills"){l(e),ce("all"),le(""),Se("overview");return}l(U=>U==="archived"?"archived":"all")},[e]),m.useEffect(()=>{if(s!=="/projects"&&s!=="/")return;const U=new URLSearchParams(window.location.search),fe=U.get("tab");let Te=!1;if(fe==="nodes"){r("/nodes");return}if(fe==="my-nodes"){r("/my-nodes");return}if(fe==="my-flows"){r("/my-flows");return}if(fe==="skills"){r("/skills");return}if(fe==="archived"?(l("archived"),U.delete("tab"),Te=!0):fe&&(l("all"),U.delete("tab"),Te=!0),U.get("new")==="1"&&(M(!0),U.delete("new"),Te=!0),Te){const Ae=U.toString();window.history.replaceState({},"",Ae?`/projects?${Ae}`:"/projects")}},[s,r]);const or=m.useMemo(()=>w$(j,y$(),c),[j,c,s]),Ar=m.useMemo(()=>or.filter(U=>yL(z,U)),[or,z]),Fn=z.trim().toLowerCase(),mn=m.useMemo(()=>a==="archived"?c.filter(U=>U.archived):c.filter(U=>!U.archived),[c,a]),vn=m.useMemo(()=>mn.filter(U=>gL(U,Fn,n)),[mn,Fn,n]),zn=m.useMemo(()=>new Set((ir.promoted||[]).map(U=>String((U==null?void 0:U.id)||"").trim()).filter(Boolean)),[ir.promoted]),Pr=m.useMemo(()=>(ir.hiddenBuiltins||[]).map(U=>String(U||"").trim()).filter(Boolean),[ir.hiddenBuiltins]),Jt=a==="nodes"||a==="my-nodes",se=a==="my-nodes",Ne=a==="my-flows",et=m.useMemo(()=>p.filter(U=>se&&!vL(U,t)?!1:(ne==="all"||(ne==="marketplace"?U.source==="marketplace":U.type===ne))&&qm(z,[U.id,U.label,U.displayName,U.description,U.type,U.source,U.packageId,U.version])),[t,p,se,z,ne]),mt=m.useMemo(()=>{const U=new Map;for(const fe of b)U.set(fe.id,new Set(fe.skillKeys||[]));return U},[b]),sn=m.useMemo(()=>[{id:"all",label:"全部"},...b.map(U=>({id:`collection:${U.id}`,label:U.name,count:U.skillKeys.length,collection:U})),{id:"ungrouped",label:"未分组"}],[b]),gn=m.useMemo(()=>d.filter(U=>{var Ae;const fe=dn(U);let Te=ne==="all";if(ne.startsWith("collection:")){const Xe=ne.slice(11);Te=!!((Ae=mt.get(Xe))!=null&&Ae.has(fe))}else ne==="ungrouped"&&(Te=!Array.from(mt.values()).some(Xe=>Xe.has(fe)));return Te&&qm(z,[U.name,U.id,U.description,U.sourceLabel,U.source,U.path])}),[d,z,ne,mt]),Rn=m.useMemo(()=>y.filter(U=>qm(z,[U.id,U.name,U.displayName,U.description,U.version,U.packageDir,Array.isArray(U.tags)?U.tags.join(" "):""])),[y,z]),yr=Jt||Ne||a==="skills",ot=m.useMemo(()=>et.find(U=>dn(U)===re)||et[0]||null,[et,re]),jt=m.useMemo(()=>gn.find(U=>dn(U)===re)||gn[0]||null,[gn,re]),gt=m.useMemo(()=>Rn.find(U=>Zi(U)===re)||Rn[0]||null,[Rn,re]),Bn=jt?De[dn(jt)]:null,we=ot?Et[dn(ot)]:null,Xt=ot&&At?Kt[`${dn(ot)}:${At}`]:null,di=n(Jt?"project:searchNodes":Ne?"project:searchFlows":a==="skills"?"project:searchSkills":"project:searchPipelines");m.useEffect(()=>{if(a!=="skills"||!jt)return;const U=dn(jt);if(De[U])return;let fe=!1;return Je(U),fetch(`/api/skills/detail?key=${encodeURIComponent(U)}`).then(Te=>Te.json().then(Ae=>({ok:Te.ok,json:Ae}))).then(({ok:Te,json:Ae})=>{fe||Te&&Ae.skill&&Ye(Xe=>({...Xe,[U]:Ae.skill}))}).catch(()=>{}).finally(()=>{fe||Je("")}),()=>{fe=!0}},[a,jt,De]),m.useEffect(()=>{if(!Jt||!ot)return;const U=dn(ot);if(Et[U])return;let fe=!1;return rt(U),fetch(`/api/nodes/detail?id=${encodeURIComponent(ot.id)}`).then(Te=>Te.json().then(Ae=>({ok:Te.ok,json:Ae}))).then(({ok:Te,json:Ae})=>{fe||Te&&bt(Xe=>({...Xe,[U]:Ae}))}).catch(()=>{}).finally(()=>{fe||rt("")}),()=>{fe=!0}},[Jt,ot,Et]),m.useEffect(()=>{if(!Jt)return;const U=Array.isArray(we==null?void 0:we.files)?we.files:[];zt(fe=>{var Te;return fe&&U.some(Ae=>Ae.path===fe)?fe:((Te=U[0])==null?void 0:Te.path)||""})},[Jt,we]),m.useEffect(()=>{if(!Jt||!ot||!At)return;const U=`${dn(ot)}:${At}`;if(Kt[U])return;let fe=!1;return be(U),fetch(`/api/nodes/file?id=${encodeURIComponent(ot.id)}&path=${encodeURIComponent(At)}`).then(Te=>Te.json().then(Ae=>({ok:Te.ok,json:Ae}))).then(({ok:Te,json:Ae})=>{fe||Te&&tt(Xe=>({...Xe,[U]:Ae}))}).catch(()=>{}).finally(()=>{fe||be("")}),()=>{fe=!0}},[Jt,ot,At,Kt]),m.useEffect(()=>{kt("")},[re,a]);const Bi=U=>{r(nf(U,"workspace"))},ar=U=>{he(M0(U)),r(nf({id:U.flowId,source:U.flowSource,archived:!!U.archived},"workspace"))},ee=m.useCallback(U=>{var fe,Te;U.preventDefault(),U.stopPropagation(),(Te=(fe=U.dataTransfer)==null?void 0:fe.types)!=null&&Te.includes("Files")&&(Xn.current+=1,q(!0))},[]),je=m.useCallback(U=>{U.preventDefault(),U.stopPropagation(),Xn.current-=1,Xn.current<=0&&(Xn.current=0,q(!1))},[]),Le=m.useCallback(U=>{U.preventDefault(),U.stopPropagation()},[]),Ht=m.useCallback(U=>{var Ae,Xe;U.preventDefault(),U.stopPropagation(),Xn.current=0,q(!1);const fe=(Xe=(Ae=U.dataTransfer)==null?void 0:Ae.files)==null?void 0:Xe[0];if(!fe)return;const Te=fe.name.toLowerCase();!Te.endsWith(".yaml")&&!Te.endsWith(".yml")&&!Te.endsWith(".zip")||B(fe)},[]);return o.jsxs("div",{className:"af-projects"+(_?" af-projects--drop-target":""),onDragEnter:ee,onDragLeave:je,onDragOver:Le,onDrop:Ht,children:[o.jsxs("header",{className:"af-projects-top",children:[e?o.jsx("div",{className:"af-projects-tabs af-projects-tabs--empty","aria-hidden":!0}):o.jsxs("div",{className:"af-projects-tabs",children:[o.jsx("button",{type:"button",className:a==="all"?"af-tab af-tab--active":"af-tab",onClick:()=>l("all"),children:n("project:all")}),o.jsx("button",{type:"button",className:a==="archived"?"af-tab af-tab--active":"af-tab",onClick:()=>l("archived"),children:n("project:archived")})]}),o.jsxs("div",{className:"af-projects-top-right",children:[o.jsxs("div",{className:"af-search-wrap",children:[o.jsx("span",{className:"material-symbols-outlined af-search-icon",children:"search"}),o.jsx("input",{className:"af-search"+(z.trim()?" af-search--has-clear":""),type:"search",placeholder:di,"aria-label":di,autoComplete:"off",value:z,onChange:U=>$(U.target.value),onKeyDown:U=>{U.key==="Escape"&&($(""),U.currentTarget.blur())}}),z.trim()?o.jsx("button",{type:"button",className:"af-search-clear","aria-label":"Clear search",onClick:()=>$(""),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),yr?o.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>En(),children:n("project:refreshResources")}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-icon-btn"+(Q?" af-icon-btn--active":""),"aria-label":n("flow:palette.toggleRecentActivity"),"aria-expanded":Q,"aria-controls":"af-recent-activity-panel",onClick:()=>te(U=>!U),children:o.jsx("span",{className:"material-symbols-outlined",children:"notifications"})}),o.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>M(!0),children:n("project:createNew")})]})]})]}),o.jsxs("div",{className:"af-projects-body",children:[o.jsxs("section",{className:"af-projects-main",children:[o.jsxs("header",{className:"af-projects-section-head",children:[o.jsx("h2",{className:"af-projects-h2",children:n(a==="my-nodes"?"project:myNodes":a==="my-flows"?"project:myFlows":a==="nodes"?"project:nodes":a==="skills"?"project:globalSkills":a==="archived"?"project:archivedPipelines":"project:activeProjects")}),o.jsx("p",{className:"af-projects-sub",children:Fn?n("project:filterResult",{count:a==="nodes"||a==="my-nodes"?et.length:a==="my-flows"?Rn.length:a==="skills"?gn.length:vn.length}):a==="my-nodes"?n("project:myNodesHint",{count:et.length}):a==="my-flows"?n("project:myFlowsHint",{count:Rn.length}):a==="nodes"?n("project:nodesHint",{count:p.length}):a==="skills"?n("project:skillsHint",{count:d.length}):n(a==="archived"?"project:archivedHint":"project:activeHint")}),A?o.jsx("p",{className:"af-err af-projects-api-hint",children:A}):null,W&&yr?o.jsx("p",{className:"af-err af-projects-api-hint",children:W}):null]}),yr?o.jsxs("div",{className:"af-resource-toolbar",children:[a==="skills"?o.jsx(rL,{onChanged:En,canManage:!!(t!=null&&t.isAdmin)}):null,o.jsxs("div",{className:"af-resource-purpose",children:[o.jsx("span",{className:"material-symbols-outlined",children:Ne?"schema":Jt?se?"deployed_code":"account_tree":"extension"}),o.jsxs("div",{children:[o.jsx("h3",{children:n(Ne?"project:myFlowsPurposeTitle":se?"project:myNodesPurposeTitle":Jt?"project:nodesPurposeTitle":"project:skillsPurposeTitle")}),o.jsx("p",{children:n(Ne?"project:myFlowsPurposeDesc":se?"project:myNodesPurposeDesc":Jt?"project:nodesPurposeDesc":"project:skillsPurposeDesc")})]})]}),Ne?null:o.jsxs(o.Fragment,{children:[Jt?o.jsxs("div",{className:"af-resource-filter-row",children:[o.jsx("button",{type:"button",className:"af-resource-filter"+(se?"":" af-resource-filter--active"),onClick:()=>{l("nodes"),ce("all"),le("")},children:n("project:nodeScopeAll")}),o.jsx("button",{type:"button",className:"af-resource-filter"+(se?" af-resource-filter--active":""),onClick:()=>{l("my-nodes"),ce("all"),le("")},children:n("project:nodeScopeMine")})]}):null,o.jsx("div",{className:"af-resource-filter-row",children:(Jt?(se?wL:xL).map(U=>({id:U,label:n(`project:resourceFilter.${U}`)})):sn).map(U=>U.collection?o.jsxs("span",{className:"af-resource-filter-chip"+(ne===U.id?" af-resource-filter-chip--active":""),children:[o.jsxs("button",{type:"button",className:"af-resource-filter af-resource-filter--embedded",onClick:()=>{ce(U.id),le("")},children:[U.label,o.jsx("em",{children:U.count}),U.collection.builtin?o.jsx("strong",{children:"built-in"}):null]}),i&&!U.collection.builtin?o.jsx("button",{type:"button",className:"af-resource-filter-chip__delete",disabled:S,"aria-label":`删除 ${U.collection.name}`,onClick:()=>Hr(U.collection.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})}):null]},U.id):o.jsx("button",{type:"button",className:"af-resource-filter"+(ne===U.id?" af-resource-filter--active":""),onClick:()=>{ce(U.id),le("")},children:U.label},U.id))})]}),a==="skills"&&i?o.jsx("div",{className:"af-skill-collections-manager",children:o.jsxs("div",{className:"af-skill-collections-create",children:[o.jsx("input",{className:"af-set-input af-set-input--sm",value:k,onChange:U=>x(U.target.value),onKeyDown:U=>{U.key==="Enter"&&Qn()},placeholder:"新建 skill collection"}),o.jsxs("button",{type:"button",className:"af-set-btn-add af-set-btn-add--compact",disabled:!k.trim()||S,onClick:()=>Qn(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新建"]})]})}):null]}):null,Jt?o.jsx("div",{className:"af-resource-grid",children:et.length>0?et.map(U=>o.jsxs("button",{type:"button",className:"af-resource-card"+(ot&&dn(U)===dn(ot)?" af-resource-card--active":""),onClick:()=>le(dn(U)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:Nc(U.type==="control"?"secondary":U.type==="provide"?"primary":"muted"),children:o.jsx(In,{query:z,children:U.type||"node"})}),o.jsx("span",{className:"af-resource-source",children:o.jsx(In,{query:z,children:T0(U.source,n)})})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(In,{query:z,children:U.label||U.displayName||U.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(In,{query:z,children:U.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:o.jsx(In,{query:z,children:U.id})}),o.jsx("span",{children:n("project:nodeSlots",{inputs:Object.keys(U.inputs||{}).length,outputs:Object.keys(U.outputs||{}).length})})]}),U.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(In,{query:z,children:`${U.packageId}${U.version?` / ${U.version}`:""}`})})]}):null]},`${U.id}:${U.source||""}:${U.packageId||""}`)):T?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:Fn?n("project:noNodeMatch",{query:z.trim()}):n(se?"project:noMyNodes":"project:noNodes")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):Ne?o.jsx("div",{className:"af-resource-grid",children:Rn.length>0?Rn.map(U=>{const fe=q_(U),Te=Y_(U),Ae=Number.isFinite(Number(U.nodeCount))?Number(U.nodeCount):fe.length,Xe=Number.isFinite(Number(U.edgeCount))?Number(U.edgeCount):Te.length;return o.jsxs("button",{type:"button",className:"af-resource-card"+(gt&&Zi(U)===Zi(gt)?" af-resource-card--active":""),onClick:()=>le(Zi(U)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:Nc("primary"),children:o.jsx(In,{query:z,children:U.version?`v${U.version}`:"flow"})}),o.jsx("span",{className:"af-resource-source",children:n("project:flowSnippet")})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(In,{query:z,children:U.displayName||U.name||U.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(In,{query:z,children:U.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(In,{query:z,children:U.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(In,{query:z,children:R0(U)})})]})]},Zi(U))}):T?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:Fn?n("project:noFlowSnippetMatch",{query:z.trim()}):n("project:noMyFlows")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):a==="skills"?o.jsx("div",{className:"af-resource-grid",children:gn.length>0?gn.map(U=>o.jsxs("button",{type:"button",className:"af-resource-card"+(jt&&dn(U)===dn(jt)?" af-resource-card--active":""),onClick:()=>le(dn(U)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:Nc(U.source==="builtin"?"muted":"primary"),children:o.jsx(In,{query:z,children:U.sourceLabel||U.source||"skill"})}),o.jsx("span",{className:"af-resource-source",children:n("project:skill")})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(In,{query:z,children:U.name||U.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(In,{query:z,children:U.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(In,{query:z,children:U.path||U.key||""})})]}),o.jsxs("div",{className:"af-skill-card-collections",children:[b.filter(fe=>fe.skillKeys.includes(dn(U))).slice(0,3).map(fe=>o.jsx("span",{children:fe.name},fe.id)),b.filter(fe=>fe.skillKeys.includes(dn(U))).length===0?o.jsx("span",{className:"af-skill-card-collection-empty",children:"未分组"}):null]})]},U.key||`${U.source}:${U.name}`)):T?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:Fn?n("project:noSkillMatch",{query:z.trim()}):n("project:noSkills")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):o.jsxs(o.Fragment,{children:[t!=null&&t.isAdmin&&a==="all"&&Pr.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:Pr.map(U=>{const fe=ut===`show-builtin:builtin:${U}`;return o.jsxs("button",{type:"button",disabled:fe,onClick:()=>mr({id:U,source:"builtin"},"show-builtin"),children:[o.jsx("span",{children:U}),o.jsx("em",{children:fe?"恢复中":"恢复"})]},U)})})]}):null,o.jsxs("div",{className:"af-project-grid",children:[vn.length>0?vn.map(U=>{const fe=(t==null?void 0:t.isAdmin)&&U.source==="user"&&!U.archived&&!zn.has(U.id),Te=(t==null?void 0:t.isAdmin)&&U.source==="admin",Ae=(t==null?void 0:t.isAdmin)&&U.source==="builtin",Xe=ut.endsWith(`:${U.source}:${U.id}`);return o.jsx("div",{className:dL(U.source),role:"button",tabIndex:0,onClick:()=>Bi(U),onKeyDown:Qt=>{(Qt.key==="Enter"||Qt.key===" ")&&(Qt.preventDefault(),Bi(U))},children:o.jsxs("div",{className:"af-project-card-body",children:[o.jsx("span",{className:Nc(Dy(U.source,n).tone),children:o.jsx(In,{query:z,children:Dy(U.source,n).label})}),U.archived?o.jsx("span",{className:Nc("muted"),children:o.jsx(In,{query:z,children:n("project:archived")})}):null,o.jsx("h3",{className:"af-project-title",children:o.jsx(In,{query:z,children:U.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(In,{query:z,children:K_(U,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(In,{query:z,children:V_(U)})})]}),t!=null&&t.isAdmin?o.jsxs("div",{className:"af-project-admin-actions",onClick:Qt=>Qt.stopPropagation(),onKeyDown:Qt=>Qt.stopPropagation(),children:[fe?o.jsx("button",{type:"button",disabled:Xe,onClick:()=>mr(U,"promote"),children:"设为内置"}):null,Te?o.jsx("button",{type:"button",disabled:Xe,onClick:()=>mr(U,"unpromote"),children:"取消内置"}):null,Ae?o.jsx("button",{type:"button",disabled:Xe,onClick:()=>mr(U,"hide-builtin"),children:"隐藏内置"}):null]}):null]})},`${U.id}:${U.source??"user"}:${U.archived?"a":""}`)}):D?mn.length===0?o.jsxs("div",{className:"af-projects-empty-block",children:[o.jsx("p",{className:"af-projects-empty",children:a==="archived"?n("project:noArchived"):c.length>0?n("project:noActive"):n(A?"project:loadFailed":"project:noPipelines")}),!A&&c.length===0&&a==="all"?o.jsx("p",{className:"af-projects-empty-hint",children:n("project:emptyHint",{code1:"agentflow ui",code2:".agentflow/pipelines"})}):null]}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:noMatch",{query:z.trim()})})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingPipelines")})}),o.jsxs("button",{type:"button",className:"af-project-add",onClick:()=>M(!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")})]}),$e?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")})]})]})]})]}),yr?o.jsx("aside",{className:"af-resource-detail","aria-label":n(Jt?"project:nodeDetail":Ne?"project:flowDetail":"project:skillDetail"),children:Jt&&ot?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:ot.label||ot.displayName||ot.id}),o.jsx("p",{children:ot.id})]})]}),o.jsx("div",{className:"af-resource-detail-tabs",children:["overview","schema","runtime","files","usage"].map(U=>o.jsx("button",{type:"button",className:"af-resource-detail-tab"+(ue===U?" af-resource-detail-tab--active":""),onClick:()=>Se(U),children:n(`project:nodeDetailTabs.${U}`)},U))}),Pe===dn(ot)?o.jsx("p",{className:"af-resource-detail-desc",children:n("project:loadingResources")}):ue==="overview"?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"af-resource-detail-desc",children:ot.description||((me=we==null?void 0:we.node)==null?void 0:me.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:ot.type||((Sn=we==null?void 0:we.node)==null?void 0:Sn.type)||"node"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailSource")}),o.jsx("dd",{children:T0(ot.source,n)})]}),ot.packageId?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPackage")}),o.jsx("dd",{children:ot.packageId})]}):null,ot.version?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailVersion")}),o.jsx("dd",{children:ot.version})]}):null,ot.packageDir||we!=null&&we.baseDir?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:ot.packageDir||(we==null?void 0:we.baseDir)})]}):null,o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailEditable")}),o.jsx("dd",{children:(we==null?void 0:we.readOnly)===!1?n("project:editable"):n("project:readOnly")})]})]}),se&&ot.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:ke===dn(ot),onClick:()=>An(ot),children:[o.jsx("span",{className:"material-symbols-outlined",children:"delete"}),ke===dn(ot)?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")})]})]}):ue==="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")}),rf(((Wr=we==null?void 0:we.node)==null?void 0:Wr.inputs)||ot.inputs).length>0?rf(((Zn=we==null?void 0:we.node)==null?void 0:Zn.inputs)||ot.inputs).map(U=>o.jsxs("code",{children:[U.name||U.key,U.type?`: ${U.type}`:""]},U.key)):o.jsx("em",{children:n("project:noSlots")})]}),o.jsxs("div",{className:"af-resource-slot-group",children:[o.jsx("span",{children:n("project:nodeOutputs")}),rf(((is=we==null?void 0:we.node)==null?void 0:is.outputs)||ot.outputs).length>0?rf(((xr=we==null?void 0:we.node)==null?void 0:xr.outputs)||ot.outputs).map(U=>o.jsxs("code",{children:[U.name||U.key,U.type?`: ${U.type}`:""]},U.key)):o.jsx("em",{children:n("project:noSlots")})]})]}):ue==="runtime"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeRuntime")}),we!=null&&we.runtime?o.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(we.runtime,null,2)}):o.jsx("p",{children:n("project:noRuntimeManifest")}),we!=null&&we.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:we.body})]}):o.jsx("p",{children:n("project:noNodeBody")})]}):ue==="files"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeFiles")}),Array.isArray(we==null?void 0:we.files)&&we.files.length>0?o.jsxs("div",{className:"af-node-file-browser",children:[o.jsx("div",{className:"af-node-file-list",children:we.files.map(U=>o.jsxs("button",{type:"button",className:"af-node-file-item"+(At===U.path?" af-node-file-item--active":""),onClick:()=>zt(U.path),children:[o.jsx("span",{className:"material-symbols-outlined",children:"description"}),o.jsx("span",{children:U.path})]},U.path))}),o.jsxs("pre",{className:"af-resource-skill-preview",children:[oe===`${dn(ot)}:${At}`?n("project:loadingResources"):Xt!=null&&Xt.binary?n("project:binaryFile"):(Xt==null?void 0:Xt.content)||n("project:selectNodeFile"),Xt!=null&&Xt.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(we==null?void 0:we.usage)&&we.usage.length>0?o.jsx("div",{className:"af-node-usage-list",children:we.usage.map(U=>o.jsxs("div",{className:"af-node-usage-item",children:[o.jsx("strong",{children:U.flowId}),o.jsxs("span",{children:[U.flowSource,U.archived?` · ${n("project:archived")}`:""]}),o.jsx("em",{children:U.instances.map(fe=>fe.label||fe.instanceId).join(", ")})]},`${U.flowSource}:${U.flowId}:${U.archived?"a":""}`))}):o.jsx("p",{children:n("project:noNodeUsage")})]})]}):Ne&>?(()=>{const U=_L(gt);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:gt.displayName||gt.name||gt.id}),o.jsx("p",{children:gt.id})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:gt.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:gt.version||"1.0.0"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:R0(gt)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:flowSnippetScale")}),o.jsx("dd",{children:n("project:flowSnippetNodes",{nodes:Number.isFinite(Number(gt.nodeCount))?Number(gt.nodeCount):U.nodes.length,edges:Number.isFinite(Number(gt.edgeCount))?Number(gt.edgeCount):U.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:Bt===Zi(gt),onClick:()=>ss(gt),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"}),Bt===Zi(gt)?n("project:deletingMyFlow"):n("project:deleteMyFlow")]}),Z?o.jsx("p",{className:"af-resource-action-message",children:Z}):null]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:flowSnippetPreview")}),U.diagram.nodes.length>0?o.jsx("div",{className:"af-flow-snippet-map",children:o.jsxs("svg",{viewBox:U.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:U.diagram.edges.map(fe=>o.jsxs("g",{children:[o.jsx("path",{d:fe.path}),fe.label?o.jsx("text",{x:fe.labelX,y:fe.labelY-5,textAnchor:"middle",children:Ym(fe.label,18)}):null]},fe.key))}),o.jsx("g",{className:"af-flow-snippet-map__nodes",children:U.diagram.nodes.map((fe,Te)=>o.jsxs("g",{transform:`translate(${fe.x} ${fe.y})`,children:[o.jsx("rect",{width:fe.width,height:fe.height,rx:"10"}),o.jsx("circle",{cx:"19",cy:fe.height/2,r:"12"}),o.jsx("text",{className:"af-flow-snippet-map__node-index",x:"19",y:fe.height/2+4,textAnchor:"middle",children:Te+1}),o.jsx("text",{className:"af-flow-snippet-map__node-title",x:"40",y:fe.height/2-3,children:Ym(fe.title)}),o.jsx("text",{className:"af-flow-snippet-map__node-meta",x:"40",y:fe.height/2+16,children:Ym(fe.meta||fe.id,20)})]},fe.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(gt.snippet||{},null,2)})]})]})]})})():a==="skills"&&jt?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:jt.name||jt.id}),o.jsx("p",{children:jt.sourceLabel||jt.source})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:jt.description||n("project:noDescription")}),o.jsxs("dl",{className:"af-resource-detail-kv",children:[o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailSource")}),o.jsx("dd",{children:jt.sourceLabel||jt.source})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:jt.path||jt.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(U=>{const fe=dn(jt),Te=U.skillKeys.includes(fe);return o.jsxs("label",{className:"af-composer-skill-option af-skill-detail-collection-option",children:[o.jsx("input",{type:"checkbox",checked:Te,disabled:S||!i,onChange:Ae=>gr(U.id,fe,Ae.target.checked)}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:U.name}),o.jsxs("span",{className:"af-composer-skill-option-desc",children:[U.skillKeys.length," skills"]})]})]},U.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:Ie===dn(jt)?n("project:loadingResources"):(Bn==null?void 0:Bn.body)||(Bn==null?void 0:Bn.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"+(Q?"":" af-activity--hidden"),"aria-hidden":!Q,"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:Ar.length===0?o.jsx("p",{className:"af-activity-empty",children:or.length===0?n("project:noRecentActivity"):n("project:noMatchRecent")}):Ar.map(U=>{const fe=ie===M0(U);return o.jsxs("button",{type:"button",className:"af-activity-row af-activity-row--action"+(fe?" af-activity-row--active":""),"aria-current":fe?"page":void 0,onClick:()=>ar(U),children:[o.jsxs("div",{className:"af-activity-row-top",children:[o.jsx("h4",{className:"af-activity-name",children:o.jsx(In,{query:z,children:U.flowId})}),o.jsx("span",{className:"af-activity-time",children:P0(U.at,n)})]}),o.jsxs("div",{className:"af-activity-meta",children:[o.jsx("span",{className:fL(U.kind),children:U.kind==="executed"?"play_arrow":"visibility"}),o.jsxs("p",{className:"af-activity-text",children:[U.kind==="executed"?n("project:recentRun"):n("project:recentOpen")," · ",P0(U.at,n)]})]})]},`${U.kind}-${U.flowId}-${U.flowSource}-${U.at}`)})})]})]}),o.jsx(Y$,{open:F,onClose:()=>M(!1),onCreated:async U=>{M(!1),await _n();const fe=U.source??"user";r(nf({id:U.id,source:fe},"workspace"))}}),I?o.jsx(U$,{file:I,onClose:()=>B(null),onImported:async U=>{B(null),await _n();const fe=U.source??"user";r(nf({id:U.id,source:fe},"workspace"))}},`${I.name}-${I.size}-${I.lastModified}`):null]})}function On(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=On(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var EL={value:()=>{}};function kh(){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 Uf(n)}function Uf(e){this._=e}function AL(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}})}Uf.prototype=kh.prototype={constructor:Uf,on:function(e,t){var n=this._,r=AL(e+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((s=(e=r[i]).type)&&(s=PL(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]=O0(n[s],e.name,t);else if(t==null)for(s in n)n[s]=O0(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 Uf(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 PL(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function O0(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=EL,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var By="http://www.w3.org/1999/xhtml";const D0={svg:"http://www.w3.org/2000/svg",xhtml:By,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function vh(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),D0.hasOwnProperty(t)?{space:D0[t],local:e}:e}function IL(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===By&&t.documentElement.namespaceURI===By?t.createElement(e):t.createElementNS(n,e)}}function TL(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function G_(e){var t=vh(e);return(t.local?TL:IL)(t)}function RL(){}function Iw(e){return e==null?RL:function(){return this.querySelector(e)}}function ML(e){typeof e!="function"&&(e=Iw(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,u,p=0;p<a;++p)(c=i[p])&&(u=e.call(c,c.__data__,p,i))&&("__data__"in c&&(u.__data__=c.__data__),l[p]=u);return new ts(r,this._parents)}function $L(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function LL(){return[]}function J_(e){return e==null?LL:function(){return this.querySelectorAll(e)}}function OL(e){return function(){return $L(e.apply(this,arguments))}}function DL(e){typeof e=="function"?e=OL(e):e=J_(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,u=0;u<l;++u)(c=a[u])&&(r.push(e.call(c,c.__data__,u,a)),s.push(c));return new ts(r,s)}function X_(e){return function(){return this.matches(e)}}function Q_(e){return function(t){return t.matches(e)}}var FL=Array.prototype.find;function zL(e){return function(){return FL.call(this.children,e)}}function BL(){return this.firstElementChild}function HL(e){return this.select(e==null?BL:zL(typeof e=="function"?e:Q_(e)))}var WL=Array.prototype.filter;function VL(){return Array.from(this.children)}function KL(e){return function(){return WL.call(this.children,e)}}function UL(e){return this.selectAll(e==null?VL:KL(typeof e=="function"?e:Q_(e)))}function qL(e){typeof e!="function"&&(e=X_(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,u=0;u<a;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&l.push(c);return new ts(r,this._parents)}function Z_(e){return new Array(e.length)}function YL(){return new ts(this._enter||this._groups.map(Z_),this._parents)}function Ep(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ep.prototype={constructor:Ep,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 GL(e){return function(){return e}}function JL(e,t,n,r,s,i){for(var a=0,l,c=t.length,u=i.length;a<u;++a)(l=t[a])?(l.__data__=i[a],r[a]=l):n[a]=new Ep(e,i[a]);for(;a<c;++a)(l=t[a])&&(s[a]=l)}function XL(e,t,n,r,s,i,a){var l,c,u=new Map,p=t.length,f=i.length,d=new Array(p),h;for(l=0;l<p;++l)(c=t[l])&&(d[l]=h=a.call(c,c.__data__,l,t)+"",u.has(h)?s[l]=c:u.set(h,c));for(l=0;l<f;++l)h=a.call(e,i[l],l,i)+"",(c=u.get(h))?(r[l]=c,c.__data__=i[l],u.delete(h)):n[l]=new Ep(e,i[l]);for(l=0;l<p;++l)(c=t[l])&&u.get(d[l])===c&&(s[l]=c)}function QL(e){return e.__data__}function ZL(e,t){if(!arguments.length)return Array.from(this,QL);var n=t?XL:JL,r=this._parents,s=this._groups;typeof e!="function"&&(e=GL(e));for(var i=s.length,a=new Array(i),l=new Array(i),c=new Array(i),u=0;u<i;++u){var p=r[u],f=s[u],d=f.length,h=eO(e.call(p,p&&p.__data__,u,r)),y=h.length,w=l[u]=new Array(y),b=a[u]=new Array(y),g=c[u]=new Array(d);n(p,f,w,b,g,h,t);for(var k=0,x=0,S,C;k<y;++k)if(S=w[k]){for(k>=x&&(x=k+1);!(C=b[x])&&++x<y;);S._next=C||null}}return a=new ts(a,r),a._enter=l,a._exit=c,a}function eO(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function tO(){return new ts(this._exit||this._groups.map(Z_),this._parents)}function nO(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 rO(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 u=n[c],p=r[c],f=u.length,d=l[c]=new Array(f),h,y=0;y<f;++y)(h=u[y]||p[y])&&(d[y]=h);for(;c<s;++c)l[c]=n[c];return new ts(l,this._parents)}function sO(){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 iO(e){e||(e=oO);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}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),u,p=0;p<l;++p)(u=a[p])&&(c[p]=u);c.sort(t)}return new ts(s,this._parents).order()}function oO(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function aO(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function lO(){return Array.from(this)}function cO(){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 uO(){let e=0;for(const t of this)++e;return e}function dO(){return!this.node()}function fO(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 pO(e){return function(){this.removeAttribute(e)}}function hO(e){return function(){this.removeAttributeNS(e.space,e.local)}}function mO(e,t){return function(){this.setAttribute(e,t)}}function gO(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function yO(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function xO(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 wO(e,t){var n=vh(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?hO:pO:typeof t=="function"?n.local?xO:yO:n.local?gO:mO)(n,t))}function eE(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function bO(e){return function(){this.style.removeProperty(e)}}function kO(e,t,n){return function(){this.style.setProperty(e,t,n)}}function vO(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function SO(e,t,n){return arguments.length>1?this.each((t==null?bO:typeof t=="function"?vO:kO)(e,t,n??"")):Ml(this.node(),e)}function Ml(e,t){return e.style.getPropertyValue(t)||eE(e).getComputedStyle(e,null).getPropertyValue(t)}function NO(e){return function(){delete this[e]}}function jO(e,t){return function(){this[e]=t}}function CO(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function _O(e,t){return arguments.length>1?this.each((t==null?NO:typeof t=="function"?CO:jO)(e,t)):this.node()[e]}function tE(e){return e.trim().split(/^|\s+/)}function Tw(e){return e.classList||new nE(e)}function nE(e){this._node=e,this._names=tE(e.getAttribute("class")||"")}nE.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 rE(e,t){for(var n=Tw(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function sE(e,t){for(var n=Tw(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function EO(e){return function(){rE(this,e)}}function AO(e){return function(){sE(this,e)}}function PO(e,t){return function(){(t.apply(this,arguments)?rE:sE)(this,e)}}function IO(e,t){var n=tE(e+"");if(arguments.length<2){for(var r=Tw(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?PO:t?EO:AO)(n,t))}function TO(){this.textContent=""}function RO(e){return function(){this.textContent=e}}function MO(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function $O(e){return arguments.length?this.each(e==null?TO:(typeof e=="function"?MO:RO)(e)):this.node().textContent}function LO(){this.innerHTML=""}function OO(e){return function(){this.innerHTML=e}}function DO(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function FO(e){return arguments.length?this.each(e==null?LO:(typeof e=="function"?DO:OO)(e)):this.node().innerHTML}function zO(){this.nextSibling&&this.parentNode.appendChild(this)}function BO(){return this.each(zO)}function HO(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function WO(){return this.each(HO)}function VO(e){var t=typeof e=="function"?e:G_(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function KO(){return null}function UO(e,t){var n=typeof e=="function"?e:G_(e),r=t==null?KO:typeof t=="function"?t:Iw(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function qO(){var e=this.parentNode;e&&e.removeChild(this)}function YO(){return this.each(qO)}function GO(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function JO(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function XO(e){return this.select(e?JO:GO)}function QO(e){return arguments.length?this.property("__data__",e):this.node().__data__}function ZO(e){return function(t){e.call(this,t,this.__data__)}}function eD(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 tD(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 nD(e,t,n){return function(){var r=this.__on,s,i=ZO(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 rD(e,t,n){var r=eD(e+""),s,i=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,p;c<u;++c)for(s=0,p=l[c];s<i;++s)if((a=r[s]).type===p.type&&a.name===p.name)return p.value}return}for(l=t?nD:tD,s=0;s<i;++s)this.each(l(r[s],t,n));return this}function iE(e,t,n){var r=eE(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 sD(e,t){return function(){return iE(this,e,t)}}function iD(e,t){return function(){return iE(this,e,t.apply(this,arguments))}}function oD(e,t){return this.each((typeof t=="function"?iD:sD)(e,t))}function*aD(){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 oE=[null];function ts(e,t){this._groups=e,this._parents=t}function td(){return new ts([[document.documentElement]],oE)}function lD(){return this}ts.prototype=td.prototype={constructor:ts,select:ML,selectAll:DL,selectChild:HL,selectChildren:UL,filter:qL,data:ZL,enter:YL,exit:tO,join:nO,merge:rO,selection:lD,order:sO,sort:iO,call:aO,nodes:lO,node:cO,size:uO,empty:dO,each:fO,attr:wO,style:SO,property:_O,classed:IO,text:$O,html:FO,raise:BO,lower:WO,append:VO,insert:UO,remove:YO,clone:XO,datum:QO,on:rD,dispatch:oD,[Symbol.iterator]:aD};function Gr(e){return typeof e=="string"?new ts([[document.querySelector(e)]],[document.documentElement]):new ts([[e]],oE)}function cD(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Es(e,t){if(e=cD(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 uD={passive:!1},Eu={capture:!0,passive:!1};function Gm(e){e.stopImmediatePropagation()}function bl(e){e.preventDefault(),e.stopImmediatePropagation()}function aE(e){var t=e.document.documentElement,n=Gr(e).on("dragstart.drag",bl,Eu);"onselectstart"in t?n.on("selectstart.drag",bl,Eu):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function lE(e,t){var n=e.document.documentElement,r=Gr(e).on("dragstart.drag",null);t&&(r.on("click.drag",bl,Eu),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 sf=e=>()=>e;function Hy(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:a,y:l,dx:c,dy:u,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:p}})}Hy.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function dD(e){return!e.ctrlKey&&!e.button}function fD(){return this.parentNode}function pD(e,t){return t??{x:e.x,y:e.y}}function hD(){return navigator.maxTouchPoints||"ontouchstart"in this}function cE(){var e=dD,t=fD,n=pD,r=hD,s={},i=kh("start","drag","end"),a=0,l,c,u,p,f=0;function d(S){S.on("mousedown.drag",h).filter(r).on("touchstart.drag",b).on("touchmove.drag",g,uD).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(S,C){if(!(p||!e.call(this,S,C))){var j=x(this,t.call(this,S,C),S,C,"mouse");j&&(Gr(S.view).on("mousemove.drag",y,Eu).on("mouseup.drag",w,Eu),aE(S.view),Gm(S),u=!1,l=S.clientX,c=S.clientY,j("start",S))}}function y(S){if(bl(S),!u){var C=S.clientX-l,j=S.clientY-c;u=C*C+j*j>f}s.mouse("drag",S)}function w(S){Gr(S.view).on("mousemove.drag mouseup.drag",null),lE(S.view,u),bl(S),s.mouse("end",S)}function b(S,C){if(e.call(this,S,C)){var j=S.changedTouches,E=t.call(this,S,C),A=j.length,O,W;for(O=0;O<A;++O)(W=x(this,E,S,C,j[O].identifier,j[O]))&&(Gm(S),W("start",S,j[O]))}}function g(S){var C=S.changedTouches,j=C.length,E,A;for(E=0;E<j;++E)(A=s[C[E].identifier])&&(bl(S),A("drag",S,C[E]))}function k(S){var C=S.changedTouches,j=C.length,E,A;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),E=0;E<j;++E)(A=s[C[E].identifier])&&(Gm(S),A("end",S,C[E]))}function x(S,C,j,E,A,O){var W=i.copy(),H=Es(O||j,C),D,R,T;if((T=n.call(S,new Hy("beforestart",{sourceEvent:j,target:d,identifier:A,active:a,x:H[0],y:H[1],dx:0,dy:0,dispatch:W}),E))!=null)return D=T.x-H[0]||0,R=T.y-H[1]||0,function V(F,M,I){var B=H,_;switch(F){case"start":s[A]=V,_=a++;break;case"end":delete s[A],--a;case"drag":H=Es(I||M,C),_=a;break}W.call(F,S,new Hy(F,{sourceEvent:M,subject:T,target:d,identifier:A,active:_,x:H[0]+D,y:H[1]+R,dx:H[0]-B[0],dy:H[1]-B[1],dispatch:W}),E)}}return d.filter=function(S){return arguments.length?(e=typeof S=="function"?S:sf(!!S),d):e},d.container=function(S){return arguments.length?(t=typeof S=="function"?S:sf(S),d):t},d.subject=function(S){return arguments.length?(n=typeof S=="function"?S:sf(S),d):n},d.touchable=function(S){return arguments.length?(r=typeof S=="function"?S:sf(!!S),d):r},d.on=function(){var S=i.on.apply(i,arguments);return S===i?d:S},d.clickDistance=function(S){return arguments.length?(f=(S=+S)*S,d):Math.sqrt(f)},d}function Rw(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function uE(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function nd(){}var Au=.7,Ap=1/Au,kl="\\s*([+-]?\\d+)\\s*",Pu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ri="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",mD=/^#([0-9a-f]{3,8})$/,gD=new RegExp(`^rgb\\(${kl},${kl},${kl}\\)$`),yD=new RegExp(`^rgb\\(${ri},${ri},${ri}\\)$`),xD=new RegExp(`^rgba\\(${kl},${kl},${kl},${Pu}\\)$`),wD=new RegExp(`^rgba\\(${ri},${ri},${ri},${Pu}\\)$`),bD=new RegExp(`^hsl\\(${Pu},${ri},${ri}\\)$`),kD=new RegExp(`^hsla\\(${Pu},${ri},${ri},${Pu}\\)$`),F0={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};Rw(nd,ma,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:z0,formatHex:z0,formatHex8:vD,formatHsl:SD,formatRgb:B0,toString:B0});function z0(){return this.rgb().formatHex()}function vD(){return this.rgb().formatHex8()}function SD(){return dE(this).formatHsl()}function B0(){return this.rgb().formatRgb()}function ma(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=mD.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?H0(t):n===3?new $r(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?of(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?of(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=gD.exec(e))?new $r(t[1],t[2],t[3],1):(t=yD.exec(e))?new $r(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=xD.exec(e))?of(t[1],t[2],t[3],t[4]):(t=wD.exec(e))?of(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=bD.exec(e))?K0(t[1],t[2]/100,t[3]/100,1):(t=kD.exec(e))?K0(t[1],t[2]/100,t[3]/100,t[4]):F0.hasOwnProperty(e)?H0(F0[e]):e==="transparent"?new $r(NaN,NaN,NaN,0):null}function H0(e){return new $r(e>>16&255,e>>8&255,e&255,1)}function of(e,t,n,r){return r<=0&&(e=t=n=NaN),new $r(e,t,n,r)}function ND(e){return e instanceof nd||(e=ma(e)),e?(e=e.rgb(),new $r(e.r,e.g,e.b,e.opacity)):new $r}function Wy(e,t,n,r){return arguments.length===1?ND(e):new $r(e,t,n,r??1)}function $r(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Rw($r,Wy,uE(nd,{brighter(e){return e=e==null?Ap:Math.pow(Ap,e),new $r(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Au:Math.pow(Au,e),new $r(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new $r(ia(this.r),ia(this.g),ia(this.b),Pp(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:W0,formatHex:W0,formatHex8:jD,formatRgb:V0,toString:V0}));function W0(){return`#${ea(this.r)}${ea(this.g)}${ea(this.b)}`}function jD(){return`#${ea(this.r)}${ea(this.g)}${ea(this.b)}${ea((isNaN(this.opacity)?1:this.opacity)*255)}`}function V0(){const e=Pp(this.opacity);return`${e===1?"rgb(":"rgba("}${ia(this.r)}, ${ia(this.g)}, ${ia(this.b)}${e===1?")":`, ${e})`}`}function Pp(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ia(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ea(e){return e=ia(e),(e<16?"0":"")+e.toString(16)}function K0(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Is(e,t,n,r)}function dE(e){if(e instanceof Is)return new Is(e.h,e.s,e.l,e.opacity);if(e instanceof nd||(e=ma(e)),!e)return new Is;if(e instanceof Is)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 Is(a,l,c,e.opacity)}function CD(e,t,n,r){return arguments.length===1?dE(e):new Is(e,t,n,r??1)}function Is(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Rw(Is,CD,uE(nd,{brighter(e){return e=e==null?Ap:Math.pow(Ap,e),new Is(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Au:Math.pow(Au,e),new Is(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 $r(Jm(e>=240?e-240:e+120,s,r),Jm(e,s,r),Jm(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Is(U0(this.h),af(this.s),af(this.l),Pp(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=Pp(this.opacity);return`${e===1?"hsl(":"hsla("}${U0(this.h)}, ${af(this.s)*100}%, ${af(this.l)*100}%${e===1?")":`, ${e})`}`}}));function U0(e){return e=(e||0)%360,e<0?e+360:e}function af(e){return Math.max(0,Math.min(1,e||0))}function Jm(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 Mw=e=>()=>e;function _D(e,t){return function(n){return e+n*t}}function ED(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 AD(e){return(e=+e)==1?fE:function(t,n){return n-t?ED(t,n,e):Mw(isNaN(t)?n:t)}}function fE(e,t){var n=t-e;return n?_D(e,n):Mw(isNaN(e)?t:e)}const Ip=function e(t){var n=AD(t);function r(s,i){var a=n((s=Wy(s)).r,(i=Wy(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),u=fE(s.opacity,i.opacity);return function(p){return s.r=a(p),s.g=l(p),s.b=c(p),s.opacity=u(p),s+""}}return r.gamma=e,r}(1);function PD(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 ID(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function TD(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,s=new Array(r),i=new Array(n),a;for(a=0;a<r;++a)s[a]=tu(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 RD(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Ys(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function MD(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]=tu(e[s],t[s]):r[s]=t[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var Vy=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Xm=new RegExp(Vy.source,"g");function $D(e){return function(){return e}}function LD(e){return function(t){return e(t)+""}}function pE(e,t){var n=Vy.lastIndex=Xm.lastIndex=0,r,s,i,a=-1,l=[],c=[];for(e=e+"",t=t+"";(r=Vy.exec(e))&&(s=Xm.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:Ys(r,s)})),n=Xm.lastIndex;return n<t.length&&(i=t.slice(n),l[a]?l[a]+=i:l[++a]=i),l.length<2?c[0]?LD(c[0].x):$D(t):(t=c.length,function(u){for(var p=0,f;p<t;++p)l[(f=c[p]).i]=f.x(u);return l.join("")})}function tu(e,t){var n=typeof t,r;return t==null||n==="boolean"?Mw(t):(n==="number"?Ys:n==="string"?(r=ma(t))?(t=r,Ip):pE:t instanceof ma?Ip:t instanceof Date?RD:ID(t)?PD:Array.isArray(t)?TD:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?MD:Ys)(e,t)}var q0=180/Math.PI,Ky={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function hE(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)*q0,skewX:Math.atan(c)*q0,scaleX:a,scaleY:l}}var lf;function OD(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ky:hE(t.a,t.b,t.c,t.d,t.e,t.f)}function DD(e){return e==null||(lf||(lf=document.createElementNS("http://www.w3.org/2000/svg","g")),lf.setAttribute("transform",e),!(e=lf.transform.baseVal.consolidate()))?Ky:(e=e.matrix,hE(e.a,e.b,e.c,e.d,e.e,e.f))}function mE(e,t,n,r){function s(u){return u.length?u.pop()+" ":""}function i(u,p,f,d,h,y){if(u!==f||p!==d){var w=h.push("translate(",null,t,null,n);y.push({i:w-4,x:Ys(u,f)},{i:w-2,x:Ys(p,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function a(u,p,f,d){u!==p?(u-p>180?p+=360:p-u>180&&(u+=360),d.push({i:f.push(s(f)+"rotate(",null,r)-2,x:Ys(u,p)})):p&&f.push(s(f)+"rotate("+p+r)}function l(u,p,f,d){u!==p?d.push({i:f.push(s(f)+"skewX(",null,r)-2,x:Ys(u,p)}):p&&f.push(s(f)+"skewX("+p+r)}function c(u,p,f,d,h,y){if(u!==f||p!==d){var w=h.push(s(h)+"scale(",null,",",null,")");y.push({i:w-4,x:Ys(u,f)},{i:w-2,x:Ys(p,d)})}else(f!==1||d!==1)&&h.push(s(h)+"scale("+f+","+d+")")}return function(u,p){var f=[],d=[];return u=e(u),p=e(p),i(u.translateX,u.translateY,p.translateX,p.translateY,f,d),a(u.rotate,p.rotate,f,d),l(u.skewX,p.skewX,f,d),c(u.scaleX,u.scaleY,p.scaleX,p.scaleY,f,d),u=p=null,function(h){for(var y=-1,w=d.length,b;++y<w;)f[(b=d[y]).i]=b.x(h);return f.join("")}}}var FD=mE(OD,"px, ","px)","deg)"),zD=mE(DD,", ",")",")"),BD=1e-12;function Y0(e){return((e=Math.exp(e))+1/e)/2}function HD(e){return((e=Math.exp(e))-1/e)/2}function WD(e){return((e=Math.exp(2*e))-1)/(e+1)}const qf=function e(t,n,r){function s(i,a){var l=i[0],c=i[1],u=i[2],p=a[0],f=a[1],d=a[2],h=p-l,y=f-c,w=h*h+y*y,b,g;if(w<BD)g=Math.log(d/u)/t,b=function(E){return[l+E*h,c+E*y,u*Math.exp(t*E*g)]};else{var k=Math.sqrt(w),x=(d*d-u*u+r*w)/(2*u*n*k),S=(d*d-u*u-r*w)/(2*d*n*k),C=Math.log(Math.sqrt(x*x+1)-x),j=Math.log(Math.sqrt(S*S+1)-S);g=(j-C)/t,b=function(E){var A=E*g,O=Y0(C),W=u/(n*k)*(O*WD(t*A+C)-HD(C));return[l+W*h,c+W*y,u*O/Y0(t*A+C)]}}return b.duration=g*1e3*t/Math.SQRT2,b}return s.rho=function(i){var a=Math.max(.001,+i),l=a*a,c=l*l;return e(a,l,c)},s}(Math.SQRT2,2,4);var $l=0,Fc=0,jc=0,gE=1e3,Tp,zc,Rp=0,ga=0,Sh=0,Iu=typeof performance=="object"&&performance.now?performance:Date,yE=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function $w(){return ga||(yE(VD),ga=Iu.now()+Sh)}function VD(){ga=0}function Mp(){this._call=this._time=this._next=null}Mp.prototype=xE.prototype={constructor:Mp,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?$w():+n)+(t==null?0:+t),!this._next&&zc!==this&&(zc?zc._next=this:Tp=this,zc=this),this._call=e,this._time=n,Uy()},stop:function(){this._call&&(this._call=null,this._time=1/0,Uy())}};function xE(e,t,n){var r=new Mp;return r.restart(e,t,n),r}function KD(){$w(),++$l;for(var e=Tp,t;e;)(t=ga-e._time)>=0&&e._call.call(void 0,t),e=e._next;--$l}function G0(){ga=(Rp=Iu.now())+Sh,$l=Fc=0;try{KD()}finally{$l=0,qD(),ga=0}}function UD(){var e=Iu.now(),t=e-Rp;t>gE&&(Sh-=t,Rp=e)}function qD(){for(var e,t=Tp,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:Tp=n);zc=e,Uy(r)}function Uy(e){if(!$l){Fc&&(Fc=clearTimeout(Fc));var t=e-ga;t>24?(e<1/0&&(Fc=setTimeout(G0,e-Iu.now()-Sh)),jc&&(jc=clearInterval(jc))):(jc||(Rp=Iu.now(),jc=setInterval(UD,gE)),$l=1,yE(G0))}}function J0(e,t,n){var r=new Mp;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var YD=kh("start","end","cancel","interrupt"),GD=[],wE=0,X0=1,qy=2,Yf=3,Q0=4,Yy=5,Gf=6;function Nh(e,t,n,r,s,i){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;JD(e,n,{name:t,index:r,group:s,on:YD,tween:GD,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:wE})}function Lw(e,t){var n=zs(e,t);if(n.state>wE)throw new Error("too late; already scheduled");return n}function ci(e,t){var n=zs(e,t);if(n.state>Yf)throw new Error("too late; already running");return n}function zs(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function JD(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=xE(i,0,n.time);function i(u){n.state=X0,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var p,f,d,h;if(n.state!==X0)return c();for(p in r)if(h=r[p],h.name===n.name){if(h.state===Yf)return J0(a);h.state===Q0?(h.state=Gf,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[p]):+p<t&&(h.state=Gf,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[p])}if(J0(function(){n.state===Yf&&(n.state=Q0,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=qy,n.on.call("start",e,e.__data__,n.index,n.group),n.state===qy){for(n.state=Yf,s=new Array(d=n.tween.length),p=0,f=-1;p<d;++p)(h=n.tween[p].value.call(e,e.__data__,n.index,n.group))&&(s[++f]=h);s.length=f+1}}function l(u){for(var p=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=Yy,1),f=-1,d=s.length;++f<d;)s[f].call(e,p);n.state===Yy&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Gf,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function Jf(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>qy&&r.state<Yy,r.state=Gf,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}i&&delete e.__transition}}function XD(e){return this.each(function(){Jf(this,e)})}function QD(e,t){var n,r;return function(){var s=ci(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 ZD(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=ci(this,e),a=i.tween;if(a!==r){s=(r=a).slice();for(var l={name:t,value:n},c=0,u=s.length;c<u;++c)if(s[c].name===t){s[c]=l;break}c===u&&s.push(l)}i.tween=s}}function eF(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=zs(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?QD:ZD)(n,e,t))}function Ow(e,t,n){var r=e._id;return e.each(function(){var s=ci(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return zs(s,r).value[t]}}function bE(e,t){var n;return(typeof t=="number"?Ys:t instanceof ma?Ip:(n=ma(t))?(t=n,Ip):pE)(e,t)}function tF(e){return function(){this.removeAttribute(e)}}function nF(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rF(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 sF(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 iF(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 oF(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 aF(e,t){var n=vh(e),r=n==="transform"?zD:bE;return this.attrTween(e,typeof t=="function"?(n.local?oF:iF)(n,r,Ow(this,"attr."+e,t)):t==null?(n.local?nF:tF)(n):(n.local?sF:rF)(n,r,t))}function lF(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function cF(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function uF(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&cF(e,i)),n}return s._value=t,s}function dF(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&lF(e,i)),n}return s._value=t,s}function fF(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=vh(e);return this.tween(n,(r.local?uF:dF)(r,t))}function pF(e,t){return function(){Lw(this,e).delay=+t.apply(this,arguments)}}function hF(e,t){return t=+t,function(){Lw(this,e).delay=t}}function mF(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?pF:hF)(t,e)):zs(this.node(),t).delay}function gF(e,t){return function(){ci(this,e).duration=+t.apply(this,arguments)}}function yF(e,t){return t=+t,function(){ci(this,e).duration=t}}function xF(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?gF:yF)(t,e)):zs(this.node(),t).duration}function wF(e,t){if(typeof t!="function")throw new Error;return function(){ci(this,e).ease=t}}function bF(e){var t=this._id;return arguments.length?this.each(wF(t,e)):zs(this.node(),t).ease}function kF(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;ci(this,e).ease=n}}function vF(e){if(typeof e!="function")throw new Error;return this.each(kF(this._id,e))}function SF(e){typeof e!="function"&&(e=X_(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,u=0;u<a;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&l.push(c);return new $i(r,this._parents,this._name,this._id)}function NF(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],u=n[l],p=c.length,f=a[l]=new Array(p),d,h=0;h<p;++h)(d=c[h]||u[h])&&(f[h]=d);for(;l<r;++l)a[l]=t[l];return new $i(a,this._parents,this._name,this._id)}function jF(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 CF(e,t,n){var r,s,i=jF(t)?Lw:ci;return function(){var a=i(this,e),l=a.on;l!==r&&(s=(r=l).copy()).on(t,n),a.on=s}}function _F(e,t){var n=this._id;return arguments.length<2?zs(this.node(),n).on.on(e):this.each(CF(n,e,t))}function EF(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function AF(){return this.on("end.remove",EF(this._id))}function PF(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Iw(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,u=i[a]=new Array(c),p,f,d=0;d<c;++d)(p=l[d])&&(f=e.call(p,p.__data__,d,l))&&("__data__"in p&&(f.__data__=p.__data__),u[d]=f,Nh(u[d],t,n,d,u,zs(p,n)));return new $i(i,this._parents,t,n)}function IF(e){var t=this._name,n=this._id;typeof e!="function"&&(e=J_(e));for(var r=this._groups,s=r.length,i=[],a=[],l=0;l<s;++l)for(var c=r[l],u=c.length,p,f=0;f<u;++f)if(p=c[f]){for(var d=e.call(p,p.__data__,f,c),h,y=zs(p,n),w=0,b=d.length;w<b;++w)(h=d[w])&&Nh(h,t,n,w,d,y);i.push(d),a.push(p)}return new $i(i,a,t,n)}var TF=td.prototype.constructor;function RF(){return new TF(this._groups,this._parents)}function MF(e,t){var n,r,s;return function(){var i=Ml(this,e),a=(this.style.removeProperty(e),Ml(this,e));return i===a?null:i===n&&a===r?s:s=t(n=i,r=a)}}function kE(e){return function(){this.style.removeProperty(e)}}function $F(e,t,n){var r,s=n+"",i;return function(){var a=Ml(this,e);return a===s?null:a===r?i:i=t(r=a,n)}}function LF(e,t,n){var r,s,i;return function(){var a=Ml(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),Ml(this,e))),a===c?null:a===r&&c===s?i:(s=c,i=t(r=a,l))}}function OF(e,t){var n,r,s,i="style."+t,a="end."+i,l;return function(){var c=ci(this,e),u=c.on,p=c.value[i]==null?l||(l=kE(t)):void 0;(u!==n||s!==p)&&(r=(n=u).copy()).on(a,s=p),c.on=r}}function DF(e,t,n){var r=(e+="")=="transform"?FD:bE;return t==null?this.styleTween(e,MF(e,r)).on("end.style."+e,kE(e)):typeof t=="function"?this.styleTween(e,LF(e,r,Ow(this,"style."+e,t))).each(OF(this._id,e)):this.styleTween(e,$F(e,r,t),n).on("end.style."+e,null)}function FF(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function zF(e,t,n){var r,s;function i(){var a=t.apply(this,arguments);return a!==s&&(r=(s=a)&&FF(e,a,n)),r}return i._value=t,i}function BF(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,zF(e,t,n??""))}function HF(e){return function(){this.textContent=e}}function WF(e){return function(){var t=e(this);this.textContent=t??""}}function VF(e){return this.tween("text",typeof e=="function"?WF(Ow(this,"text",e)):HF(e==null?"":e+""))}function KF(e){return function(t){this.textContent=e.call(this,t)}}function UF(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&KF(s)),t}return r._value=e,r}function qF(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,UF(e))}function YF(){for(var e=this._name,t=this._id,n=vE(),r=this._groups,s=r.length,i=0;i<s;++i)for(var a=r[i],l=a.length,c,u=0;u<l;++u)if(c=a[u]){var p=zs(c,t);Nh(c,e,n,u,a,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new $i(r,this._parents,e,n)}function GF(){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 u=ci(this,r),p=u.on;p!==e&&(t=(e=p).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),u.on=t}),s===0&&i()})}var JF=0;function $i(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function vE(){return++JF}var wi=td.prototype;$i.prototype={constructor:$i,select:PF,selectAll:IF,selectChild:wi.selectChild,selectChildren:wi.selectChildren,filter:SF,merge:NF,selection:RF,transition:YF,call:wi.call,nodes:wi.nodes,node:wi.node,size:wi.size,empty:wi.empty,each:wi.each,on:_F,attr:aF,attrTween:fF,style:DF,styleTween:BF,text:VF,textTween:qF,remove:AF,tween:eF,delay:mF,duration:xF,ease:bF,easeVarying:vF,end:GF,[Symbol.iterator]:wi[Symbol.iterator]};function XF(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var QF={time:null,delay:0,duration:250,ease:XF};function ZF(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 ez(e){var t,n;e instanceof $i?(t=e._id,e=e._name):(t=vE(),(n=QF).time=$w(),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,u=0;u<l;++u)(c=a[u])&&Nh(c,e,t,u,a,n||ZF(c,t));return new $i(r,this._parents,e,t)}td.prototype.interrupt=XD;td.prototype.transition=ez;const cf=e=>()=>e;function tz(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 Ci(e,t,n){this.k=e,this.x=t,this.y=n}Ci.prototype={constructor:Ci,scale:function(e){return e===1?this:new Ci(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ci(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 jh=new Ci(1,0,0);SE.prototype=Ci.prototype;function SE(e){for(;!e.__zoom;)if(!(e=e.parentNode))return jh;return e.__zoom}function Qm(e){e.stopImmediatePropagation()}function Cc(e){e.preventDefault(),e.stopImmediatePropagation()}function nz(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function rz(){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 Z0(){return this.__zoom||jh}function sz(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function iz(){return navigator.maxTouchPoints||"ontouchstart"in this}function oz(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 NE(){var e=nz,t=rz,n=oz,r=sz,s=iz,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=qf,u=kh("start","zoom","end"),p,f,d,h=500,y=150,w=0,b=10;function g(T){T.property("__zoom",Z0).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",W).filter(s).on("touchstart.zoom",H).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(T,V,F,M){var I=T.selection?T.selection():T;I.property("__zoom",Z0),T!==I?C(T,V,F,M):I.interrupt().each(function(){j(this,arguments).event(M).start().zoom(null,typeof V=="function"?V.apply(this,arguments):V).end()})},g.scaleBy=function(T,V,F,M){g.scaleTo(T,function(){var I=this.__zoom.k,B=typeof V=="function"?V.apply(this,arguments):V;return I*B},F,M)},g.scaleTo=function(T,V,F,M){g.transform(T,function(){var I=t.apply(this,arguments),B=this.__zoom,_=F==null?S(I):typeof F=="function"?F.apply(this,arguments):F,q=B.invert(_),z=typeof V=="function"?V.apply(this,arguments):V;return n(x(k(B,z),_,q),I,a)},F,M)},g.translateBy=function(T,V,F,M){g.transform(T,function(){return n(this.__zoom.translate(typeof V=="function"?V.apply(this,arguments):V,typeof F=="function"?F.apply(this,arguments):F),t.apply(this,arguments),a)},null,M)},g.translateTo=function(T,V,F,M,I){g.transform(T,function(){var B=t.apply(this,arguments),_=this.__zoom,q=M==null?S(B):typeof M=="function"?M.apply(this,arguments):M;return n(jh.translate(q[0],q[1]).scale(_.k).translate(typeof V=="function"?-V.apply(this,arguments):-V,typeof F=="function"?-F.apply(this,arguments):-F),B,a)},M,I)};function k(T,V){return V=Math.max(i[0],Math.min(i[1],V)),V===T.k?T:new Ci(V,T.x,T.y)}function x(T,V,F){var M=V[0]-F[0]*T.k,I=V[1]-F[1]*T.k;return M===T.x&&I===T.y?T:new Ci(T.k,M,I)}function S(T){return[(+T[0][0]+ +T[1][0])/2,(+T[0][1]+ +T[1][1])/2]}function C(T,V,F,M){T.on("start.zoom",function(){j(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){j(this,arguments).event(M).end()}).tween("zoom",function(){var I=this,B=arguments,_=j(I,B).event(M),q=t.apply(I,B),z=F==null?S(q):typeof F=="function"?F.apply(I,B):F,$=Math.max(q[1][0]-q[0][0],q[1][1]-q[0][1]),Q=I.__zoom,te=typeof V=="function"?V.apply(I,B):V,ie=c(Q.invert(z).concat($/Q.k),te.invert(z).concat($/te.k));return function(he){if(he===1)he=te;else{var ne=ie(he),ce=$/ne[2];he=new Ci(ce,z[0]-ne[0]*ce,z[1]-ne[1]*ce)}_.zoom(null,he)}})}function j(T,V,F){return!F&&T.__zooming||new E(T,V)}function E(T,V){this.that=T,this.args=V,this.active=0,this.sourceEvent=null,this.extent=t.apply(T,V),this.taps=0}E.prototype={event:function(T){return T&&(this.sourceEvent=T),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(T,V){return this.mouse&&T!=="mouse"&&(this.mouse[1]=V.invert(this.mouse[0])),this.touch0&&T!=="touch"&&(this.touch0[1]=V.invert(this.touch0[0])),this.touch1&&T!=="touch"&&(this.touch1[1]=V.invert(this.touch1[0])),this.that.__zoom=V,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(T){var V=Gr(this.that).datum();u.call(T,this.that,new tz(T,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:u}),V)}};function A(T,...V){if(!e.apply(this,arguments))return;var F=j(this,V).event(T),M=this.__zoom,I=Math.max(i[0],Math.min(i[1],M.k*Math.pow(2,r.apply(this,arguments)))),B=Es(T);if(F.wheel)(F.mouse[0][0]!==B[0]||F.mouse[0][1]!==B[1])&&(F.mouse[1]=M.invert(F.mouse[0]=B)),clearTimeout(F.wheel);else{if(M.k===I)return;F.mouse=[B,M.invert(B)],Jf(this),F.start()}Cc(T),F.wheel=setTimeout(_,y),F.zoom("mouse",n(x(k(M,I),F.mouse[0],F.mouse[1]),F.extent,a));function _(){F.wheel=null,F.end()}}function O(T,...V){if(d||!e.apply(this,arguments))return;var F=T.currentTarget,M=j(this,V,!0).event(T),I=Gr(T.view).on("mousemove.zoom",z,!0).on("mouseup.zoom",$,!0),B=Es(T,F),_=T.clientX,q=T.clientY;aE(T.view),Qm(T),M.mouse=[B,this.__zoom.invert(B)],Jf(this),M.start();function z(Q){if(Cc(Q),!M.moved){var te=Q.clientX-_,ie=Q.clientY-q;M.moved=te*te+ie*ie>w}M.event(Q).zoom("mouse",n(x(M.that.__zoom,M.mouse[0]=Es(Q,F),M.mouse[1]),M.extent,a))}function $(Q){I.on("mousemove.zoom mouseup.zoom",null),lE(Q.view,M.moved),Cc(Q),M.event(Q).end()}}function W(T,...V){if(e.apply(this,arguments)){var F=this.__zoom,M=Es(T.changedTouches?T.changedTouches[0]:T,this),I=F.invert(M),B=F.k*(T.shiftKey?.5:2),_=n(x(k(F,B),M,I),t.apply(this,V),a);Cc(T),l>0?Gr(this).transition().duration(l).call(C,_,M,T):Gr(this).call(g.transform,_,M,T)}}function H(T,...V){if(e.apply(this,arguments)){var F=T.touches,M=F.length,I=j(this,V,T.changedTouches.length===M).event(T),B,_,q,z;for(Qm(T),_=0;_<M;++_)q=F[_],z=Es(q,this),z=[z,this.__zoom.invert(z),q.identifier],I.touch0?!I.touch1&&I.touch0[2]!==z[2]&&(I.touch1=z,I.taps=0):(I.touch0=z,B=!0,I.taps=1+!!p);p&&(p=clearTimeout(p)),B&&(I.taps<2&&(f=z[0],p=setTimeout(function(){p=null},h)),Jf(this),I.start())}}function D(T,...V){if(this.__zooming){var F=j(this,V).event(T),M=T.changedTouches,I=M.length,B,_,q,z;for(Cc(T),B=0;B<I;++B)_=M[B],q=Es(_,this),F.touch0&&F.touch0[2]===_.identifier?F.touch0[0]=q:F.touch1&&F.touch1[2]===_.identifier&&(F.touch1[0]=q);if(_=F.that.__zoom,F.touch1){var $=F.touch0[0],Q=F.touch0[1],te=F.touch1[0],ie=F.touch1[1],he=(he=te[0]-$[0])*he+(he=te[1]-$[1])*he,ne=(ne=ie[0]-Q[0])*ne+(ne=ie[1]-Q[1])*ne;_=k(_,Math.sqrt(he/ne)),q=[($[0]+te[0])/2,($[1]+te[1])/2],z=[(Q[0]+ie[0])/2,(Q[1]+ie[1])/2]}else if(F.touch0)q=F.touch0[0],z=F.touch0[1];else return;F.zoom("touch",n(x(_,q,z),F.extent,a))}}function R(T,...V){if(this.__zooming){var F=j(this,V).event(T),M=T.changedTouches,I=M.length,B,_;for(Qm(T),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),B=0;B<I;++B)_=M[B],F.touch0&&F.touch0[2]===_.identifier?delete F.touch0:F.touch1&&F.touch1[2]===_.identifier&&delete F.touch1;if(F.touch1&&!F.touch0&&(F.touch0=F.touch1,delete F.touch1),F.touch0)F.touch0[1]=this.__zoom.invert(F.touch0[0]);else if(F.end(),F.taps===2&&(_=Es(_,this),Math.hypot(f[0]-_[0],f[1]-_[1])<b)){var q=Gr(this).on("dblclick.zoom");q&&q.apply(this,arguments)}}}return g.wheelDelta=function(T){return arguments.length?(r=typeof T=="function"?T:cf(+T),g):r},g.filter=function(T){return arguments.length?(e=typeof T=="function"?T:cf(!!T),g):e},g.touchable=function(T){return arguments.length?(s=typeof T=="function"?T:cf(!!T),g):s},g.extent=function(T){return arguments.length?(t=typeof T=="function"?T:cf([[+T[0][0],+T[0][1]],[+T[1][0],+T[1][1]]]),g):t},g.scaleExtent=function(T){return arguments.length?(i[0]=+T[0],i[1]=+T[1],g):[i[0],i[1]]},g.translateExtent=function(T){return arguments.length?(a[0][0]=+T[0][0],a[1][0]=+T[1][0],a[0][1]=+T[0][1],a[1][1]=+T[1][1],g):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},g.constrain=function(T){return arguments.length?(n=T,g):n},g.duration=function(T){return arguments.length?(l=+T,g):l},g.interpolate=function(T){return arguments.length?(c=T,g):c},g.on=function(){var T=u.on.apply(u,arguments);return T===u?g:T},g.clickDistance=function(T){return arguments.length?(w=(T=+T)*T,g):Math.sqrt(w)},g.tapDistance=function(T){return arguments.length?(b=+T,g):b},g}const oi={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."},Tu=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],jE=["Enter"," ","Escape"],CE={"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 Ll;(function(e){e.Strict="strict",e.Loose="loose"})(Ll||(Ll={}));var oa;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(oa||(oa={}));var Ru;(function(e){e.Partial="partial",e.Full="full"})(Ru||(Ru={}));const _E={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var lo;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(lo||(lo={}));var Qs;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Qs||(Qs={}));var Oe;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Oe||(Oe={}));const eS={[Oe.Left]:Oe.Right,[Oe.Right]:Oe.Left,[Oe.Top]:Oe.Bottom,[Oe.Bottom]:Oe.Top};function EE(e){return e===null?null:e?"valid":"invalid"}const AE=e=>"id"in e&&"source"in e&&"target"in e,az=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Dw=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),rd=(e,t=[0,0])=>{const{width:n,height:r}=Di(e),s=e.origin??t,i=n*s[0],a=r*s[1];return{x:e.position.x-i,y:e.position.y-a}},lz=(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):Dw(s)?s:t.nodeLookup.get(s.id));const l=a?$p(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ch(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return _h(n)},sd=(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=Ch(n,$p(s)),r=!0)}),r?_h(n):{x:0,y:0,width:0,height:0}},Fw=(e,t,[n,r,s]=[0,0,1],i=!1,a=!1)=>{const l={...od(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const u of e.values()){const{measured:p,selectable:f=!0,hidden:d=!1}=u;if(a&&!f||d)continue;const h=p.width??u.width??u.initialWidth??null,y=p.height??u.height??u.initialHeight??null,w=Mu(l,Dl(u)),b=(h??0)*(y??0),g=i&&w>0;(!u.internals.handleBounds||g||w>=b||u.dragging)&&c.push(u)}return c},cz=(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 uz(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 dz({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},a){if(e.size===0)return Promise.resolve(!0);const l=uz(e,a),c=sd(l),u=zw(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(u,{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 PE({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:u}=l?l.internals.positionAbsolute:{x:0,y:0},p=a.origin??r;let f=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!l)i==null||i("005",oi.error005());else{const h=l.measured.width,y=l.measured.height;h&&y&&(f=[[c,u],[c+h,u+y]])}else l&&Fl(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const d=Fl(f)?ya(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",oi.error015())),{position:{x:d.x-c+(a.measured.width??0)*p[0],y:d.y-u+(a.measured.height??0)*p[1]},positionAbsolute:d}}async function fz({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(d=>d.id)),a=[];for(const d of n){if(d.deletable===!1)continue;const h=i.has(d.id),y=!h&&d.parentId&&a.find(w=>w.id===d.parentId);(h||y)&&a.push(d)}const l=new Set(t.map(d=>d.id)),c=r.filter(d=>d.deletable!==!1),p=cz(a,c);for(const d of c)l.has(d.id)&&!p.find(y=>y.id===d.id)&&p.push(d);if(!s)return{edges:p,nodes:a};const f=await s({nodes:a,edges:p});return typeof f=="boolean"?f?{edges:p,nodes:a}:{edges:[],nodes:[]}:f}const Ol=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),ya=(e={x:0,y:0},t,n)=>({x:Ol(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Ol(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function IE(e,t,n){const{width:r,height:s}=Di(n),{x:i,y:a}=n.internals.positionAbsolute;return ya(e,[[i,a],[i+r,a+s]],t)}const tS=(e,t,n)=>e<t?Ol(Math.abs(e-t),1,t)/t:e>n?-Ol(Math.abs(e-n),1,t)/t:0,TE=(e,t,n=15,r=40)=>{const s=tS(e.x,r,t.width-r)*n,i=tS(e.y,r,t.height-r)*n;return[s,i]},Ch=(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)}),Gy=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),_h=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Dl=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Dw(e)?e.internals.positionAbsolute:rd(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}},$p=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Dw(e)?e.internals.positionAbsolute:rd(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)}},RE=(e,t)=>_h(Ch(Gy(e),Gy(t))),Mu=(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)},nS=e=>Ts(e.width)&&Ts(e.height)&&Ts(e.x)&&Ts(e.y),Ts=e=>!isNaN(e)&&isFinite(e),pz=(e,t)=>{},id=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),od=({x:e,y:t},[n,r,s],i=!1,a=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return i?id(l,a):l},Lp=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function Wa(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 hz(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Wa(e,n),s=Wa(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=Wa(e.top??e.y??0,n),s=Wa(e.bottom??e.y??0,n),i=Wa(e.left??e.x??0,t),a=Wa(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 mz(e,t,n,r,s,i){const{x:a,y:l}=Lp(e,[t,n,r]),{x:c,y:u}=Lp({x:e.x+e.width,y:e.y+e.height},[t,n,r]),p=s-c,f=i-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(p),bottom:Math.floor(f)}}const zw=(e,t,n,r,s,i)=>{const a=hz(i,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),p=Ol(u,r,s),f=e.x+e.width/2,d=e.y+e.height/2,h=t/2-f*p,y=n/2-d*p,w=mz(e,h,y,p,t,n),b={left:Math.min(w.left-a.left,0),top:Math.min(w.top-a.top,0),right:Math.min(w.right-a.right,0),bottom:Math.min(w.bottom-a.bottom,0)};return{x:h-b.left+b.right,y:y-b.top+b.bottom,zoom:p}},$u=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Fl(e){return e!=null&&e!=="parent"}function Di(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 ME(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 $E(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 rS(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function gz(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function yz(e){return{...CE,...e||{}}}function nu(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:a}=Rs(e),l=od({x:i-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},r),{x:c,y:u}=n?id(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const Bw=e=>({width:e.offsetWidth,height:e.offsetHeight}),LE=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},xz=["INPUT","SELECT","TEXTAREA"];function OE(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:xz.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const DE=e=>"clientX"in e,Rs=(e,t)=>{var i,a;const n=DE(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)}},sS=(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,...Bw(a)}})};function FE({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,u=t*.125+i*.375+l*.375+r*.125,p=Math.abs(c-e),f=Math.abs(u-t);return[c,u,p,f]}function uf(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function iS({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case Oe.Left:return[t-uf(t-r,i),n];case Oe.Right:return[t+uf(r-t,i),n];case Oe.Top:return[t,n-uf(n-s,i)];case Oe.Bottom:return[t,n+uf(s-n,i)]}}function zE({sourceX:e,sourceY:t,sourcePosition:n=Oe.Bottom,targetX:r,targetY:s,targetPosition:i=Oe.Top,curvature:a=.25}){const[l,c]=iS({pos:n,x1:e,y1:t,x2:r,y2:s,c:a}),[u,p]=iS({pos:i,x1:r,y1:s,x2:e,y2:t,c:a}),[f,d,h,y]=FE({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:p});return[`M${e},${t} C${l},${c} ${u},${p} ${r},${s}`,f,d,h,y]}function BE({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 wz({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 bz({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=Ch($p(e),$p(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 Mu(a,_h(i))>0}const kz=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,vz=(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)),Xf=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||kz;let s;return AE(e)?s={...e}:s={...e,id:r(e)},vz(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function HE({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,a,l]=BE({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,a,l]}const oS={[Oe.Left]:{x:-1,y:0},[Oe.Right]:{x:1,y:0},[Oe.Top]:{x:0,y:-1},[Oe.Bottom]:{x:0,y:1}},Sz=({source:e,sourcePosition:t=Oe.Bottom,target:n})=>t===Oe.Left||t===Oe.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 Nz({source:e,sourcePosition:t=Oe.Bottom,target:n,targetPosition:r=Oe.Top,center:s,offset:i,stepPosition:a}){const l=oS[t],c=oS[r],u={x:e.x+l.x*i,y:e.y+l.y*i},p={x:n.x+c.x*i,y:n.y+c.y*i},f=Sz({source:u,sourcePosition:t,target:p}),d=f.x!==0?"x":"y",h=f[d];let y=[],w,b;const g={x:0,y:0},k={x:0,y:0},[,,x,S]=BE({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[d]*c[d]===-1){d==="x"?(w=s.x??u.x+(p.x-u.x)*a,b=s.y??(u.y+p.y)/2):(w=s.x??(u.x+p.x)/2,b=s.y??u.y+(p.y-u.y)*a);const A=[{x:w,y:u.y},{x:w,y:p.y}],O=[{x:u.x,y:b},{x:p.x,y:b}];l[d]===h?y=d==="x"?A:O:y=d==="x"?O:A}else{const A=[{x:u.x,y:p.y}],O=[{x:p.x,y:u.y}];if(d==="x"?y=l.x===h?O:A:y=l.y===h?A:O,t===r){const T=Math.abs(e[d]-n[d]);if(T<=i){const V=Math.min(i-1,i-T);l[d]===h?g[d]=(u[d]>e[d]?-1:1)*V:k[d]=(p[d]>n[d]?-1:1)*V}}if(t!==r){const T=d==="x"?"y":"x",V=l[d]===c[T],F=u[T]>p[T],M=u[T]<p[T];(l[d]===1&&(!V&&F||V&&M)||l[d]!==1&&(!V&&M||V&&F))&&(y=d==="x"?A:O)}const W={x:u.x+g.x,y:u.y+g.y},H={x:p.x+k.x,y:p.y+k.y},D=Math.max(Math.abs(W.x-y[0].x),Math.abs(H.x-y[0].x)),R=Math.max(Math.abs(W.y-y[0].y),Math.abs(H.y-y[0].y));D>=R?(w=(W.x+H.x)/2,b=y[0].y):(w=y[0].x,b=(W.y+H.y)/2)}const C={x:u.x+g.x,y:u.y+g.y},j={x:p.x+k.x,y:p.y+k.y};return[[e,...C.x!==y[0].x||C.y!==y[0].y?[C]:[],...y,...j.x!==y[y.length-1].x||j.y!==y[y.length-1].y?[j]:[],n],w,b,x,S]}function jz(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 u=e.x<n.x?-1:1,p=e.y<n.y?1:-1;return`L ${i+s*u},${a}Q ${i},${a} ${i},${a+s*p}`}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 Jy({sourceX:e,sourceY:t,sourcePosition:n=Oe.Bottom,targetX:r,targetY:s,targetPosition:i=Oe.Top,borderRadius:a=5,centerX:l,centerY:c,offset:u=20,stepPosition:p=.5}){const[f,d,h,y,w]=Nz({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:l,y:c},offset:u,stepPosition:p});let b=`M${f[0].x} ${f[0].y}`;for(let g=1;g<f.length-1;g++)b+=jz(f[g-1],f[g],f[g+1],a);return b+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[b,d,h,y,w]}function lS(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Cz(e){var f;const{sourceNode:t,targetNode:n}=e;if(!lS(t)||!lS(n))return null;const r=t.internals.handleBounds||cS(t.handles),s=n.internals.handleBounds||cS(n.handles),i=uS((r==null?void 0:r.source)??[],e.sourceHandle),a=uS(e.connectionMode===Ll.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!i||!a)return(f=e.onError)==null||f.call(e,"008",oi.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||Oe.Bottom,c=(a==null?void 0:a.position)||Oe.Top,u=xa(t,i,l),p=xa(n,a,c);return{sourceX:u.x,sourceY:u.y,targetX:p.x,targetY:p.y,sourcePosition:l,targetPosition:c}}function cS(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 xa(e,t,n=Oe.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??Di(e);if(r)return{x:s+a/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case Oe.Top:return{x:s+a/2,y:i};case Oe.Right:return{x:s+a,y:i+l/2};case Oe.Bottom:return{x:s+a/2,y:i+l};case Oe.Left:return{x:s,y:i+l/2}}}function uS(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Xy(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function _z(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 u=Xy(c,t);i.has(u)||(a.push({id:u,color:c.color||n,...c}),i.add(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const WE=1e3,Ez=10,Hw={nodeOrigin:[0,0],nodeExtent:Tu,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Az={...Hw,checkEquality:!0};function Ww(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function Pz(e,t,n){const r=Ww(Hw,n);for(const s of e.values())if(s.parentId)Kw(s,e,t,r);else{const i=rd(s,r.nodeOrigin),a=Fl(s.extent)?s.extent:r.nodeExtent,l=ya(i,a,Di(s));s.internals.positionAbsolute=l}}function Iz(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 Vw(e){return e==="manual"}function Qy(e,t,n,r={}){var p,f;const s=Ww(Az,r),i={i:0},a=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!Vw(s.zIndexMode)?WE:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const d of e){let h=a.get(d.id);if(s.checkEquality&&d===(h==null?void 0:h.internals.userNode))t.set(d.id,h);else{const y=rd(d,s.nodeOrigin),w=Fl(d.extent)?d.extent:s.nodeExtent,b=ya(y,w,Di(d));h={...s.defaults,...d,measured:{width:(p=d.measured)==null?void 0:p.width,height:(f=d.measured)==null?void 0:f.height},internals:{positionAbsolute:b,handleBounds:Iz(d,h),z:VE(d,l,s.zIndexMode),userNode:d}},t.set(d.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),d.parentId&&Kw(h,t,n,r,i),u||(u=d.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function Tz(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 Kw(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=Ww(Hw,r),u=e.parentId,p=t.get(u);if(!p){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Tz(e,n),s&&!p.parentId&&p.internals.rootParentIndex===void 0&&c==="auto"&&(p.internals.rootParentIndex=++s.i,p.internals.z=p.internals.z+s.i*Ez),s&&p.internals.rootParentIndex!==void 0&&(s.i=p.internals.rootParentIndex);const f=i&&!Vw(c)?WE:0,{x:d,y:h,z:y}=Rz(e,p,a,l,f,c),{positionAbsolute:w}=e.internals,b=d!==w.x||h!==w.y;(b||y!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:d,y:h}:w,z:y}})}function VE(e,t,n){const r=Ts(e.zIndex)?e.zIndex:0;return Vw(n)?r:r+(e.selected?t:0)}function Rz(e,t,n,r,s,i){const{x:a,y:l}=t.internals.positionAbsolute,c=Di(e),u=rd(e,n),p=Fl(e.extent)?ya(u,e.extent,c):u;let f=ya({x:a+p.x,y:l+p.y},r,c);e.extent==="parent"&&(f=IE(f,c,t));const d=VE(e,s,i),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=d?h+1:d}}function Uw(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 u=((a=i.get(l.parentId))==null?void 0:a.expandedRect)??Dl(c),p=RE(u,l.rect);i.set(l.parentId,{expandedRect:p,parent:c})}return i.size>0&&i.forEach(({expandedRect:l,parent:c},u)=>{var x;const p=c.internals.positionAbsolute,f=Di(c),d=c.origin??r,h=l.x<p.x?Math.round(Math.abs(p.x-l.x)):0,y=l.y<p.y?Math.round(Math.abs(p.y-l.y)):0,w=Math.max(f.width,Math.round(l.width)),b=Math.max(f.height,Math.round(l.height)),g=(w-f.width)*d[0],k=(b-f.height)*d[1];(h>0||y>0||g||k)&&(s.push({id:u,type:"position",position:{x:c.position.x-h+g,y:c.position.y-y+k}}),(x=n.get(u))==null||x.forEach(S=>{e.some(C=>C.id===S.id)||s.push({id:S.id,type:"position",position:{x:S.position.x+h,y:S.position.y+y}})})),(f.width<l.width||f.height<l.height||h||y)&&s.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:w+(h?d[0]*h-g:0),height:b+(y?d[1]*y-k:0)}})}),s}function Mz(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 u=[],p=window.getComputedStyle(l),{m22:f}=new window.DOMMatrixReadOnly(p.transform),d=[];for(const h of e.values()){const y=t.get(h.id);if(!y)continue;if(y.hidden){t.set(y.id,{...y,internals:{...y.internals,handleBounds:void 0}}),c=!0;continue}const w=Bw(h.nodeElement),b=y.measured.width!==w.width||y.measured.height!==w.height;if(!!(w.width&&w.height&&(b||!y.internals.handleBounds||h.force))){const k=h.nodeElement.getBoundingClientRect(),x=Fl(y.extent)?y.extent:i;let{positionAbsolute:S}=y.internals;y.parentId&&y.extent==="parent"?S=IE(S,w,t.get(y.parentId)):x&&(S=ya(S,x,w));const C={...y,measured:w,internals:{...y.internals,positionAbsolute:S,handleBounds:{source:sS("source",h.nodeElement,k,f,y.id),target:sS("target",h.nodeElement,k,f,y.id)}}};t.set(y.id,C),y.parentId&&Kw(C,t,n,{nodeOrigin:s,zIndexMode:a}),c=!0,b&&(u.push({id:y.id,type:"dimensions",dimensions:w}),y.expandParent&&y.parentId&&d.push({id:y.id,parentId:y.parentId,rect:Dl(C,s)}))}}if(d.length>0){const h=Uw(d,t,n,s);u.push(...h)}return{changes:u,updatedInternals:c}}async function $z({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 dS(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 u=r.get(a)||new Map;r.set(a,u.set(n,t))}}function KE(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},u=`${s}-${a}--${i}-${l}`,p=`${i}-${l}--${s}-${a}`;dS("source",c,p,e,s,a),dS("target",c,u,e,i,l),t.set(r.id,r)}}function UE(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:UE(n,t):!1}function fS(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 Lz(e,t,n,r){const s=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!UE(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 Zm({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,l,c;const s=[];for(const[u,p]of t){const f=(a=n.get(u))==null?void 0:a.internals.userNode;f&&s.push({...f,position:p.position,dragging:r})}if(!e)return[s[0],s];const i=(l=n.get(e))==null?void 0:l.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:s[0],s]}function Oz({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=id(i,t);return{x:a.x-i.x,y:a.y-i.y}}function Dz({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},a=0,l=new Map,c=!1,u={x:0,y:0},p=null,f=!1,d=null,h=!1,y=!1,w=null;function b({noDragClassName:k,handleSelector:x,domNode:S,isSelectable:C,nodeId:j,nodeClickDistance:E=0}){d=Gr(S);function A({x:D,y:R}){const{nodeLookup:T,nodeExtent:V,snapGrid:F,snapToGrid:M,nodeOrigin:I,onNodeDrag:B,onSelectionDrag:_,onError:q,updateNodePositions:z}=t();i={x:D,y:R};let $=!1;const Q=l.size>1,te=Q&&V?Gy(sd(l)):null,ie=Q&&M?Oz({dragItems:l,snapGrid:F,x:D,y:R}):null;for(const[he,ne]of l){if(!T.has(he))continue;let ce={x:D-ne.distance.x,y:R-ne.distance.y};M&&(ce=ie?{x:Math.round(ce.x+ie.x),y:Math.round(ce.y+ie.y)}:id(ce,F));let re=null;if(Q&&V&&!ne.extent&&te){const{positionAbsolute:Se}=ne.internals,De=Se.x-te.x+V[0][0],Ye=Se.x+ne.measured.width-te.x2+V[1][0],Ie=Se.y-te.y+V[0][1],Je=Se.y+ne.measured.height-te.y2+V[1][1];re=[[De,Ie],[Ye,Je]]}const{position:le,positionAbsolute:ue}=PE({nodeId:he,nextPosition:ce,nodeLookup:T,nodeExtent:re||V,nodeOrigin:I,onError:q});$=$||ne.position.x!==le.x||ne.position.y!==le.y,ne.position=le,ne.internals.positionAbsolute=ue}if(y=y||$,!!$&&(z(l,!0),w&&(r||B||!j&&_))){const[he,ne]=Zm({nodeId:j,dragItems:l,nodeLookup:T});r==null||r(w,l,he,ne),B==null||B(w,he,ne),j||_==null||_(w,ne)}}async function O(){if(!p)return;const{transform:D,panBy:R,autoPanSpeed:T,autoPanOnNodeDrag:V}=t();if(!V){c=!1,cancelAnimationFrame(a);return}const[F,M]=TE(u,p,T);(F!==0||M!==0)&&(i.x=(i.x??0)-F/D[2],i.y=(i.y??0)-M/D[2],await R({x:F,y:M})&&A(i)),a=requestAnimationFrame(O)}function W(D){var Q;const{nodeLookup:R,multiSelectionActive:T,nodesDraggable:V,transform:F,snapGrid:M,snapToGrid:I,selectNodesOnDrag:B,onNodeDragStart:_,onSelectionDragStart:q,unselectNodesAndEdges:z}=t();f=!0,(!B||!C)&&!T&&j&&((Q=R.get(j))!=null&&Q.selected||z()),C&&B&&j&&(e==null||e(j));const $=nu(D.sourceEvent,{transform:F,snapGrid:M,snapToGrid:I,containerBounds:p});if(i=$,l=Lz(R,V,$,j),l.size>0&&(n||_||!j&&q)){const[te,ie]=Zm({nodeId:j,dragItems:l,nodeLookup:R});n==null||n(D.sourceEvent,l,te,ie),_==null||_(D.sourceEvent,te,ie),j||q==null||q(D.sourceEvent,ie)}}const H=cE().clickDistance(E).on("start",D=>{const{domNode:R,nodeDragThreshold:T,transform:V,snapGrid:F,snapToGrid:M}=t();p=(R==null?void 0:R.getBoundingClientRect())||null,h=!1,y=!1,w=D.sourceEvent,T===0&&W(D),i=nu(D.sourceEvent,{transform:V,snapGrid:F,snapToGrid:M,containerBounds:p}),u=Rs(D.sourceEvent,p)}).on("drag",D=>{const{autoPanOnNodeDrag:R,transform:T,snapGrid:V,snapToGrid:F,nodeDragThreshold:M,nodeLookup:I}=t(),B=nu(D.sourceEvent,{transform:T,snapGrid:V,snapToGrid:F,containerBounds:p});if(w=D.sourceEvent,(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1||j&&!I.has(j))&&(h=!0),!h){if(!c&&R&&f&&(c=!0,O()),!f){const _=Rs(D.sourceEvent,p),q=_.x-u.x,z=_.y-u.y;Math.sqrt(q*q+z*z)>M&&W(D)}(i.x!==B.xSnapped||i.y!==B.ySnapped)&&l&&f&&(u=Rs(D.sourceEvent,p),A(B))}}).on("end",D=>{if(!(!f||h)&&(c=!1,f=!1,cancelAnimationFrame(a),l.size>0)){const{nodeLookup:R,updateNodePositions:T,onNodeDragStop:V,onSelectionDragStop:F}=t();if(y&&(T(l,!1),y=!1),s||V||!j&&F){const[M,I]=Zm({nodeId:j,dragItems:l,nodeLookup:R,dragging:!1});s==null||s(D.sourceEvent,l,M,I),V==null||V(D.sourceEvent,M,I),j||F==null||F(D.sourceEvent,I)}}}).filter(D=>{const R=D.target;return!D.button&&(!k||!fS(R,`.${k}`,S))&&(!x||fS(R,x,S))});d.call(H)}function g(){d==null||d.on(".drag",null)}return{update:b,destroy:g}}function Fz(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())Mu(s,Dl(i))>0&&r.push(i);return r}const zz=250;function Bz(e,t,n,r){var l,c;let s=[],i=1/0;const a=Fz(e,n,t+zz);for(const u of a){const p=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const f of p){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:d,y:h}=xa(u,f,f.position,!0),y=Math.sqrt(Math.pow(d-e.x,2)+Math.pow(h-e.y,2));y>t||(y<i?(s=[{...f,x:d,y:h}],i=y):y===i&&s.push({...f,x:d,y:h}))}}if(!s.length)return null;if(s.length>1){const u=r.type==="source"?"target":"source";return s.find(p=>p.type===u)??s[0]}return s[0]}function qE(e,t,n,r,s,i=!1){var u,p,f;const a=r.get(e);if(!a)return null;const l=s==="strict"?(u=a.internals.handleBounds)==null?void 0:u[t]:[...((p=a.internals.handleBounds)==null?void 0:p.source)??[],...((f=a.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?l==null?void 0:l.find(d=>d.id===n):l==null?void 0:l[0])??null;return c&&i?{...c,...xa(a,c,c.position,!0)}:c}function YE(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Hz(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const GE=()=>!0;function Wz(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:p,flowId:f,panBy:d,cancelConnection:h,onConnectStart:y,onConnect:w,onConnectEnd:b,isValidConnection:g=GE,onReconnectEnd:k,updateConnection:x,getTransform:S,getFromHandle:C,autoPanSpeed:j,dragThreshold:E=1,handleDomNode:A}){const O=LE(e.target);let W=0,H;const{x:D,y:R}=Rs(e),T=YE(i,A),V=l==null?void 0:l.getBoundingClientRect();let F=!1;if(!V||!T)return;const M=qE(s,T,r,c,t);if(!M)return;let I=Rs(e,V),B=!1,_=null,q=!1,z=null;function $(){if(!p||!V)return;const[le,ue]=TE(I,V,j);d({x:le,y:ue}),W=requestAnimationFrame($)}const Q={...M,nodeId:s,type:T,position:M.position},te=c.get(s);let he={inProgress:!0,isValid:null,from:xa(te,Q,Oe.Left,!0),fromHandle:Q,fromPosition:Q.position,fromNode:te,to:I,toHandle:null,toPosition:eS[Q.position],toNode:null,pointer:I};function ne(){F=!0,x(he),y==null||y(e,{nodeId:s,handleId:r,handleType:T})}E===0&&ne();function ce(le){if(!F){const{x:Je,y:Et}=Rs(le),bt=Je-D,Pe=Et-R;if(!(bt*bt+Pe*Pe>E*E))return;ne()}if(!C()||!Q){re(le);return}const ue=S();I=Rs(le,V),H=Bz(od(I,ue,!1,[1,1]),n,c,Q),B||($(),B=!0);const Se=JE(le,{handle:H,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:a?"target":"source",isValidConnection:g,doc:O,lib:u,flowId:f,nodeLookup:c});z=Se.handleDomNode,_=Se.connection,q=Hz(!!H,Se.isValid);const De=c.get(s),Ye=De?xa(De,Q,Oe.Left,!0):he.from,Ie={...he,from:Ye,isValid:q,to:Se.toHandle&&q?Lp({x:Se.toHandle.x,y:Se.toHandle.y},ue):I,toHandle:Se.toHandle,toPosition:q&&Se.toHandle?Se.toHandle.position:eS[Q.position],toNode:Se.toHandle?c.get(Se.toHandle.nodeId):null,pointer:I};x(Ie),he=Ie}function re(le){if(!("touches"in le&&le.touches.length>0)){if(F){(H||z)&&_&&q&&(w==null||w(_));const{inProgress:ue,...Se}=he,De={...Se,toPosition:he.toHandle?he.toPosition:null};b==null||b(le,De),i&&(k==null||k(le,De))}h(),cancelAnimationFrame(W),B=!1,q=!1,_=null,z=null,O.removeEventListener("mousemove",ce),O.removeEventListener("mouseup",re),O.removeEventListener("touchmove",ce),O.removeEventListener("touchend",re)}}O.addEventListener("mousemove",ce),O.addEventListener("mouseup",re),O.addEventListener("touchmove",ce),O.addEventListener("touchend",re)}function JE(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:a,lib:l,flowId:c,isValidConnection:u=GE,nodeLookup:p}){const f=i==="target",d=t?a.querySelector(`.${l}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y}=Rs(e),w=a.elementFromPoint(h,y),b=w!=null&&w.classList.contains(`${l}-flow__handle`)?w:d,g={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const k=YE(void 0,b),x=b.getAttribute("data-nodeid"),S=b.getAttribute("data-handleid"),C=b.classList.contains("connectable"),j=b.classList.contains("connectableend");if(!x||!k)return g;const E={source:f?x:r,sourceHandle:f?S:s,target:f?r:x,targetHandle:f?s:S};g.connection=E;const O=C&&j&&(n===Ll.Strict?f&&k==="source"||!f&&k==="target":x!==r||S!==s);g.isValid=O&&u(E),g.toHandle=qE(x,k,S,p,n,!0)}return g}const Zy={onPointerDown:Wz,isValid:JE};function Vz({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=Gr(e);function i({translateExtent:l,width:c,height:u,zoomStep:p=1,pannable:f=!0,zoomable:d=!0,inversePan:h=!1}){const y=x=>{if(x.sourceEvent.type!=="wheel"||!t)return;const S=n(),C=x.sourceEvent.ctrlKey&&$u()?10:1,j=-x.sourceEvent.deltaY*(x.sourceEvent.deltaMode===1?.05:x.sourceEvent.deltaMode?1:.002)*p,E=S[2]*Math.pow(2,j*C);t.scaleTo(E)};let w=[0,0];const b=x=>{(x.sourceEvent.type==="mousedown"||x.sourceEvent.type==="touchstart")&&(w=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY])},g=x=>{const S=n();if(x.sourceEvent.type!=="mousemove"&&x.sourceEvent.type!=="touchmove"||!t)return;const C=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY],j=[C[0]-w[0],C[1]-w[1]];w=C;const E=r()*Math.max(S[2],Math.log(S[2]))*(h?-1:1),A={x:S[0]-j[0]*E,y:S[1]-j[1]*E},O=[[0,0],[c,u]];t.setViewportConstrained({x:A.x,y:A.y,zoom:S[2]},O,l)},k=NE().on("start",b).on("zoom",f?g:null).on("zoom.wheel",d?y:null);s.call(k,{})}function a(){s.on("zoom",null)}return{update:i,destroy:a,pointer:Es}}const Eh=e=>({x:e.x,y:e.y,zoom:e.k}),eg=({x:e,y:t,zoom:n})=>jh.translate(e,t).scale(n),ul=(e,t)=>e.target.closest(`.${t}`),XE=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Kz=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,tg=(e,t=0,n=Kz,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},QE=e=>{const t=e.ctrlKey&&$u()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Uz({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return p=>{if(ul(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(p.ctrlKey&&a){const b=Es(p),g=QE(p),k=f*Math.pow(2,g);r.scaleTo(n,k,b,p);return}const d=p.deltaMode===1?20:1;let h=s===oa.Vertical?0:p.deltaX*d,y=s===oa.Horizontal?0:p.deltaY*d;!$u()&&p.shiftKey&&s!==oa.Vertical&&(h=p.deltaY*d,y=0),r.translateBy(n,-(h/f)*i,-(y/f)*i,{internal:!0});const w=Eh(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(p,w),e.panScrollTimeout=setTimeout(()=>{u==null||u(p,w),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(p,w))}}function qz({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",a=!t&&i&&!r.ctrlKey,l=ul(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,s)}}function Yz({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,a,l;if((i=r.sourceEvent)!=null&&i.internal)return;const s=Eh(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 Gz({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var a,l;e.usedRightMouseButton=!!(n&&XE(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,Eh(i.transform)))}}function Jz({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&&XE(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=Eh(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,c)},n?150:0)}}}function Xz({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:p}){return f=>{var b;const d=e||t,h=n&&f.ctrlKey,y=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(ul(f,`${u}-flow__node`)||ul(f,`${u}-flow__edge`)))return!0;if(!r&&!d&&!s&&!i&&!n||a||p&&!y||ul(f,l)&&y||ul(f,c)&&(!y||s&&y&&!e)||!n&&f.ctrlKey&&y)return!1;if(!n&&f.type==="touchstart"&&((b=f.touches)==null?void 0:b.length)>1)return f.preventDefault(),!1;if(!d&&!s&&!h&&y||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const w=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||y)&&w}}function Qz({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),f=NE().scaleExtent([t,n]).translateExtent(r),d=Gr(e).call(f);k({x:s.x,y:s.y,zoom:Ol(s.zoom,t,n)},[[0,0],[p.width,p.height]],r);const h=d.on("wheel.zoom"),y=d.on("dblclick.zoom");f.wheelDelta(QE);function w(H,D){return d?new Promise(R=>{f==null||f.interpolate((D==null?void 0:D.interpolate)==="linear"?tu:qf).transform(tg(d,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>R(!0)),H)}):Promise.resolve(!1)}function b({noWheelClassName:H,noPanClassName:D,onPaneContextMenu:R,userSelectionActive:T,panOnScroll:V,panOnDrag:F,panOnScrollMode:M,panOnScrollSpeed:I,preventScrolling:B,zoomOnPinch:_,zoomOnScroll:q,zoomOnDoubleClick:z,zoomActivationKeyPressed:$,lib:Q,onTransformChange:te,connectionInProgress:ie,paneClickDistance:he,selectionOnDrag:ne}){T&&!u.isZoomingOrPanning&&g();const ce=V&&!$&&!T;f.clickDistance(ne?1/0:!Ts(he)||he<0?0:he);const re=ce?Uz({zoomPanValues:u,noWheelClassName:H,d3Selection:d,d3Zoom:f,panOnScrollMode:M,panOnScrollSpeed:I,zoomOnPinch:_,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:l}):qz({noWheelClassName:H,preventScrolling:B,d3ZoomHandler:h});if(d.on("wheel.zoom",re,{passive:!1}),!T){const ue=Yz({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",ue);const Se=Gz({zoomPanValues:u,panOnDrag:F,onPaneContextMenu:!!R,onPanZoom:i,onTransformChange:te});f.on("zoom",Se);const De=Jz({zoomPanValues:u,panOnDrag:F,panOnScroll:V,onPaneContextMenu:R,onPanZoomEnd:l,onDraggingChange:c});f.on("end",De)}const le=Xz({zoomActivationKeyPressed:$,panOnDrag:F,zoomOnScroll:q,panOnScroll:V,zoomOnDoubleClick:z,zoomOnPinch:_,userSelectionActive:T,noPanClassName:D,noWheelClassName:H,lib:Q,connectionInProgress:ie});f.filter(le),z?d.on("dblclick.zoom",y):d.on("dblclick.zoom",null)}function g(){f.on("zoom",null)}async function k(H,D,R){const T=eg(H),V=f==null?void 0:f.constrain()(T,D,R);return V&&await w(V),new Promise(F=>F(V))}async function x(H,D){const R=eg(H);return await w(R,D),new Promise(T=>T(R))}function S(H){if(d){const D=eg(H),R=d.property("__zoom");(R.k!==H.zoom||R.x!==H.x||R.y!==H.y)&&(f==null||f.transform(d,D,null,{sync:!0}))}}function C(){const H=d?SE(d.node()):{x:0,y:0,k:1};return{x:H.x,y:H.y,zoom:H.k}}function j(H,D){return d?new Promise(R=>{f==null||f.interpolate((D==null?void 0:D.interpolate)==="linear"?tu:qf).scaleTo(tg(d,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>R(!0)),H)}):Promise.resolve(!1)}function E(H,D){return d?new Promise(R=>{f==null||f.interpolate((D==null?void 0:D.interpolate)==="linear"?tu:qf).scaleBy(tg(d,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>R(!0)),H)}):Promise.resolve(!1)}function A(H){f==null||f.scaleExtent(H)}function O(H){f==null||f.translateExtent(H)}function W(H){const D=!Ts(H)||H<0?0:H;f==null||f.clickDistance(D)}return{update:b,destroy:g,setViewport:x,setViewportConstrained:k,getViewport:C,scaleTo:j,scaleBy:E,setScaleExtent:A,setTranslateExtent:O,syncViewport:S,setClickDistance:W}}var zl;(function(e){e.Line="line",e.Handle="handle"})(zl||(zl={}));function Zz({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 pS(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 eo(e,t){return Math.max(0,t-e)}function to(e,t){return Math.max(0,e-t)}function df(e,t,n){return Math.max(0,t-e,e-n)}function hS(e,t){return e?!t:t}function e3(e,t,n,r,s,i,a,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:p,isVertical:f}=t,d=p&&f,{xSnapped:h,ySnapped:y}=n,{minWidth:w,maxWidth:b,minHeight:g,maxHeight:k}=r,{x,y:S,width:C,height:j,aspectRatio:E}=e;let A=Math.floor(p?h-e.pointerX:0),O=Math.floor(f?y-e.pointerY:0);const W=C+(c?-A:A),H=j+(u?-O:O),D=-i[0]*C,R=-i[1]*j;let T=df(W,w,b),V=df(H,g,k);if(a){let I=0,B=0;c&&A<0?I=eo(x+A+D,a[0][0]):!c&&A>0&&(I=to(x+W+D,a[1][0])),u&&O<0?B=eo(S+O+R,a[0][1]):!u&&O>0&&(B=to(S+H+R,a[1][1])),T=Math.max(T,I),V=Math.max(V,B)}if(l){let I=0,B=0;c&&A>0?I=to(x+A,l[0][0]):!c&&A<0&&(I=eo(x+W,l[1][0])),u&&O>0?B=to(S+O,l[0][1]):!u&&O<0&&(B=eo(S+H,l[1][1])),T=Math.max(T,I),V=Math.max(V,B)}if(s){if(p){const I=df(W/E,g,k)*E;if(T=Math.max(T,I),a){let B=0;!c&&!u||c&&!u&&d?B=to(S+R+W/E,a[1][1])*E:B=eo(S+R+(c?A:-A)/E,a[0][1])*E,T=Math.max(T,B)}if(l){let B=0;!c&&!u||c&&!u&&d?B=eo(S+W/E,l[1][1])*E:B=to(S+(c?A:-A)/E,l[0][1])*E,T=Math.max(T,B)}}if(f){const I=df(H*E,w,b)/E;if(V=Math.max(V,I),a){let B=0;!c&&!u||u&&!c&&d?B=to(x+H*E+D,a[1][0])/E:B=eo(x+(u?O:-O)*E+D,a[0][0])/E,V=Math.max(V,B)}if(l){let B=0;!c&&!u||u&&!c&&d?B=eo(x+H*E,l[1][0])/E:B=to(x+(u?O:-O)*E,l[0][0])/E,V=Math.max(V,B)}}}O=O+(O<0?V:-V),A=A+(A<0?T:-T),s&&(d?W>H*E?O=(hS(c,u)?-A:A)/E:A=(hS(c,u)?-O:O)*E:p?(O=A/E,u=c):(A=O*E,c=u));const F=c?x+A:x,M=u?S+O:S;return{width:C+(c?-A:A),height:j+(u?-O:O),x:i[0]*A*(c?-1:1)+F,y:i[1]*O*(u?-1:1)+M}}const ZE={width:0,height:0,x:0,y:0},t3={...ZE,pointerX:0,pointerY:0,aspectRatio:1};function n3(e){return[[0,0],[e.measured.width,e.measured.height]]}function r3(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 s3({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=Gr(e);let a={controlDirection:pS("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:p,keepAspectRatio:f,resizeDirection:d,onResizeStart:h,onResize:y,onResizeEnd:w,shouldResize:b}){let g={...ZE},k={...t3};a={boundaries:p,resizeDirection:d,keepAspectRatio:f,controlDirection:pS(u)};let x,S=null,C=[],j,E,A,O=!1;const W=cE().on("start",H=>{const{nodeLookup:D,transform:R,snapGrid:T,snapToGrid:V,nodeOrigin:F,paneDomNode:M}=n();if(x=D.get(t),!x)return;S=(M==null?void 0:M.getBoundingClientRect())??null;const{xSnapped:I,ySnapped:B}=nu(H.sourceEvent,{transform:R,snapGrid:T,snapToGrid:V,containerBounds:S});g={width:x.measured.width??0,height:x.measured.height??0,x:x.position.x??0,y:x.position.y??0},k={...g,pointerX:I,pointerY:B,aspectRatio:g.width/g.height},j=void 0,x.parentId&&(x.extent==="parent"||x.expandParent)&&(j=D.get(x.parentId),E=j&&x.extent==="parent"?n3(j):void 0),C=[],A=void 0;for(const[_,q]of D)if(q.parentId===t&&(C.push({id:_,position:{...q.position},extent:q.extent}),q.extent==="parent"||q.expandParent)){const z=r3(q,x,q.origin??F);A?A=[[Math.min(z[0][0],A[0][0]),Math.min(z[0][1],A[0][1])],[Math.max(z[1][0],A[1][0]),Math.max(z[1][1],A[1][1])]]:A=z}h==null||h(H,{...g})}).on("drag",H=>{const{transform:D,snapGrid:R,snapToGrid:T,nodeOrigin:V}=n(),F=nu(H.sourceEvent,{transform:D,snapGrid:R,snapToGrid:T,containerBounds:S}),M=[];if(!x)return;const{x:I,y:B,width:_,height:q}=g,z={},$=x.origin??V,{width:Q,height:te,x:ie,y:he}=e3(k,a.controlDirection,F,a.boundaries,a.keepAspectRatio,$,E,A),ne=Q!==_,ce=te!==q,re=ie!==I&&ne,le=he!==B&&ce;if(!re&&!le&&!ne&&!ce)return;if((re||le||$[0]===1||$[1]===1)&&(z.x=re?ie:g.x,z.y=le?he:g.y,g.x=z.x,g.y=z.y,C.length>0)){const Ye=ie-I,Ie=he-B;for(const Je of C)Je.position={x:Je.position.x-Ye+$[0]*(Q-_),y:Je.position.y-Ie+$[1]*(te-q)},M.push(Je)}if((ne||ce)&&(z.width=ne&&(!a.resizeDirection||a.resizeDirection==="horizontal")?Q:g.width,z.height=ce&&(!a.resizeDirection||a.resizeDirection==="vertical")?te:g.height,g.width=z.width,g.height=z.height),j&&x.expandParent){const Ye=$[0]*(z.width??0);z.x&&z.x<Ye&&(g.x=Ye,k.x=k.x-(z.x-Ye));const Ie=$[1]*(z.height??0);z.y&&z.y<Ie&&(g.y=Ie,k.y=k.y-(z.y-Ie))}const ue=Zz({width:g.width,prevWidth:_,height:g.height,prevHeight:q,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),Se={...g,direction:ue};(b==null?void 0:b(H,Se))!==!1&&(O=!0,y==null||y(H,Se),r(z,M))}).on("end",H=>{O&&(w==null||w(H,{...g}),s==null||s({...g}),O=!1)});i.call(W)}function c(){i.on(".drag",null)}return{update:l,destroy:c}}var eA={exports:{}},tA={},nA={exports:{}},rA={};/**
|
|
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 Bl=m;function i3(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var o3=typeof Object.is=="function"?Object.is:i3,a3=Bl.useState,l3=Bl.useEffect,c3=Bl.useLayoutEffect,u3=Bl.useDebugValue;function d3(e,t){var n=t(),r=a3({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return c3(function(){s.value=n,s.getSnapshot=t,ng(s)&&i({inst:s})},[e,n,t]),l3(function(){return ng(s)&&i({inst:s}),e(function(){ng(s)&&i({inst:s})})},[e]),u3(n),n}function ng(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o3(e,n)}catch{return!0}}function f3(e,t){return t()}var p3=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f3:d3;rA.useSyncExternalStore=Bl.useSyncExternalStore!==void 0?Bl.useSyncExternalStore:p3;nA.exports=rA;var sA=nA.exports;/**
|
|
53
|
-
* @license React
|
|
54
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
55
|
-
*
|
|
56
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
57
|
-
*
|
|
58
|
-
* This source code is licensed under the MIT license found in the
|
|
59
|
-
* LICENSE file in the root directory of this source tree.
|
|
60
|
-
*/var Ah=m,h3=sA;function m3(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var g3=typeof Object.is=="function"?Object.is:m3,y3=h3.useSyncExternalStore,x3=Ah.useRef,w3=Ah.useEffect,b3=Ah.useMemo,k3=Ah.useDebugValue;tA.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=x3(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=b3(function(){function c(h){if(!u){if(u=!0,p=h,h=r(h),s!==void 0&&a.hasValue){var y=a.value;if(s(y,h))return f=y}return f=h}if(y=f,g3(p,h))return y;var w=r(h);return s!==void 0&&s(y,w)?(p=h,y):(p=h,f=w)}var u=!1,p,f,d=n===void 0?null:n;return[function(){return c(t())},d===null?void 0:function(){return c(d())}]},[t,n,r,s]);var l=y3(e,i[0],i[1]);return w3(function(){a.hasValue=!0,a.value=l},[l]),k3(l),l};eA.exports=tA;var v3=eA.exports;const S3=Po(v3),N3={},mS=e=>{let t;const n=new Set,r=(p,f)=>{const d=typeof p=="function"?p(t):p;if(!Object.is(d,t)){const h=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),n.forEach(y=>y(t,h))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>u,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(N3?"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()}},u=t=e(r,s,c);return c},j3=e=>e?mS(e):mS,{useDebugValue:C3}=it,{useSyncExternalStoreWithSelector:_3}=S3,E3=e=>e;function iA(e,t=E3,n){const r=_3(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return C3(r),r}const gS=(e,t)=>{const n=j3(e),r=(s,i=t)=>iA(n,s,i);return Object.assign(r,n),r},A3=(e,t)=>e?gS(e,t):gS;function pn(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 Ph=m.createContext(null),P3=Ph.Provider,oA=oi.error001();function Rt(e,t){const n=m.useContext(Ph);if(n===null)throw new Error(oA);return iA(n,e,t)}function un(){const e=m.useContext(Ph);if(e===null)throw new Error(oA);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const yS={display:"none"},I3={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},aA="react-flow__node-desc",lA="react-flow__edge-desc",T3="react-flow__aria-live",R3=e=>e.ariaLiveMessage,M3=e=>e.ariaLabelConfig;function $3({rfId:e}){const t=Rt(R3);return o.jsx("div",{id:`${T3}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:I3,children:t})}function L3({rfId:e,disableKeyboardA11y:t}){const n=Rt(M3);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${aA}-${e}`,style:yS,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${lA}-${e}`,style:yS,children:n["edge.a11yDescription.default"]}),!t&&o.jsx($3,{rfId:e})]})}const Ih=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const a=`${e}`.split("-");return o.jsx("div",{className:On(["react-flow__panel",n,...a]),style:r,ref:i,...s,children:t})});Ih.displayName="Panel";function O3({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(Ih,{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 D3=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}},ff=e=>e.id;function F3(e,t){return pn(e.selectedNodes.map(ff),t.selectedNodes.map(ff))&&pn(e.selectedEdges.map(ff),t.selectedEdges.map(ff))}function z3({onSelectionChange:e}){const t=un(),{selectedNodes:n,selectedEdges:r}=Rt(D3,F3);return m.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,e]),null}const B3=e=>!!e.onSelectionChangeHandlers;function H3({onSelectionChange:e}){const t=Rt(B3);return e||t?o.jsx(z3,{onSelectionChange:e}):null}const ex=typeof window<"u"?m.useLayoutEffect:m.useEffect,cA=[0,0],W3={x:0,y:0,zoom:1},V3=["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"],xS=[...V3,"rfId"],K3=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}),wS={translateExtent:Tu,nodeOrigin:cA,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function U3(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=Rt(K3,pn),u=un();ex(()=>(c(e.defaultNodes,e.defaultEdges),()=>{p.current=wS,l()}),[]);const p=m.useRef(wS);return ex(()=>{for(const f of xS){const d=e[f],h=p.current[f];d!==h&&(typeof e[f]>"u"||(f==="nodes"?t(d):f==="edges"?n(d):f==="minZoom"?r(d):f==="maxZoom"?s(d):f==="translateExtent"?i(d):f==="nodeExtent"?a(d):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:yz(d)}):f==="fitView"?u.setState({fitViewQueued:d}):f==="fitViewOptions"?u.setState({fitViewOptions:d}):u.setState({[f]:d})))}p.current=e},xS.map(f=>e[f])),null}function bS(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function q3(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const s=bS(),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=bS())!=null&&r.matches?"dark":"light"}const kS=typeof document<"u"?document:null;function Lu(e=null,t={target:kS,actInsideInputWithModifier:!0}){const[n,r]=m.useState(!1),s=m.useRef(!1),i=m.useRef(new Set([])),[a,l]=m.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.replace("+",`
|
|
61
|
-
`).replace(`
|
|
62
|
-
|
|
63
|
-
`,`
|
|
64
|
-
+`).split(`
|
|
65
|
-
`)),p=u.reduce((f,d)=>f.concat(...d),[]);return[u,p]}return[[],[]]},[e]);return m.useEffect(()=>{const c=(t==null?void 0:t.target)??kS,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const p=h=>{var b,g;if(s.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!s.current||s.current&&!u)&&OE(h))return!1;const w=SS(h.code,l);if(i.current.add(h[w]),vS(a,i.current,!1)){const k=((g=(b=h.composedPath)==null?void 0:b.call(h))==null?void 0:g[0])||h.target,x=(k==null?void 0:k.nodeName)==="BUTTON"||(k==null?void 0:k.nodeName)==="A";t.preventDefault!==!1&&(s.current||!x)&&h.preventDefault(),r(!0)}},f=h=>{const y=SS(h.code,l);vS(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(h[y]),h.key==="Meta"&&i.current.clear(),s.current=!1},d=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",p),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{c==null||c.removeEventListener("keydown",p),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,r]),n}function vS(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function SS(e,t){return t.includes(e)?"code":"key"}const Y3=()=>{const e=un();return m.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,i],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:i,maxZoom:a,panZoom:l}=e.getState(),c=zw(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(),u={x:t.x-l,y:t.y-c},p=n.snapGrid??s,f=n.snapToGrid??i;return od(u,r,f,p)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),a=Lp(t,n);return{x:a.x+s,y:a.y+i}}}),[])};function uA(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)G3(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 G3(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 Op(e,t){return uA(e,t)}function qw(e,t){return uA(e,t)}function Uo(e,t){return{id:e,type:"select",selected:t}}function dl(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(Uo(i.id,a)))}return r}function NS({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 jS(e){return{id:e.id,type:"remove"}}const CS=e=>az(e),J3=e=>AE(e);function dA(e){return m.forwardRef(e)}function _S(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>X3(()=>n(s=>s+BigInt(1))));return ex(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function X3(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const fA=m.createContext(null);function Q3({children:e}){const t=un(),n=m.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:p,onNodesChange:f,nodeLookup:d,fitViewQueued:h,onNodesChangeMiddlewareMap:y}=t.getState();let w=c;for(const g of l)w=typeof g=="function"?g(w):g;let b=NS({items:w,lookup:d});for(const g of y.values())b=g(b);p&&u(w),b.length>0?f==null||f(b):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:g,nodes:k,setNodes:x}=t.getState();g&&x(k)})},[]),r=_S(n),s=m.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:p,onEdgesChange:f,edgeLookup:d}=t.getState();let h=c;for(const y of l)h=typeof y=="function"?y(h):y;p?u(h):f&&f(NS({items:h,lookup:d}))},[]),i=_S(s),a=m.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return o.jsx(fA.Provider,{value:a,children:e})}function Z3(){const e=m.useContext(fA);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const e4=e=>!!e.panZoom;function Yl(){const e=Y3(),t=un(),n=Z3(),r=Rt(e4),s=m.useMemo(()=>{const i=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var g,k;const{nodeLookup:d,nodeOrigin:h}=t.getState(),y=CS(f)?f:d.get(f.id),w=y.parentId?$E(y.position,y.measured,y.parentId,d,h):y.position,b={...y,position:w,width:((g=y.measured)==null?void 0:g.width)??y.width,height:((k=y.measured)==null?void 0:k.height)??y.height};return Dl(b)},u=(f,d,h={replace:!1})=>{a(y=>y.map(w=>{if(w.id===f){const b=typeof d=="function"?d(w):d;return h.replace&&CS(b)?b:{...w,...b}}return w}))},p=(f,d,h={replace:!1})=>{l(y=>y.map(w=>{if(w.id===f){const b=typeof d=="function"?d(w):d;return h.replace&&J3(b)?b:{...w,...b}}return w}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var d;return(d=i(f))==null?void 0:d.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(d=>({...d}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:a,setEdges:l,addNodes:f=>{const d=Array.isArray(f)?f:[f];n.nodeQueue.push(h=>[...h,...d])},addEdges:f=>{const d=Array.isArray(f)?f:[f];n.edgeQueue.push(h=>[...h,...d])},toObject:()=>{const{nodes:f=[],edges:d=[],transform:h}=t.getState(),[y,w,b]=h;return{nodes:f.map(g=>({...g})),edges:d.map(g=>({...g})),viewport:{x:y,y:w,zoom:b}}},deleteElements:async({nodes:f=[],edges:d=[]})=>{const{nodes:h,edges:y,onNodesDelete:w,onEdgesDelete:b,triggerNodeChanges:g,triggerEdgeChanges:k,onDelete:x,onBeforeDelete:S}=t.getState(),{nodes:C,edges:j}=await fz({nodesToRemove:f,edgesToRemove:d,nodes:h,edges:y,onBeforeDelete:S}),E=j.length>0,A=C.length>0;if(E){const O=j.map(jS);b==null||b(j),k(O)}if(A){const O=C.map(jS);w==null||w(C),g(O)}return(A||E)&&(x==null||x({nodes:C,edges:j})),{deletedNodes:C,deletedEdges:j}},getIntersectingNodes:(f,d=!0,h)=>{const y=nS(f),w=y?f:c(f),b=h!==void 0;return w?(h||t.getState().nodes).filter(g=>{const k=t.getState().nodeLookup.get(g.id);if(k&&!y&&(g.id===f.id||!k.internals.positionAbsolute))return!1;const x=Dl(b?g:k),S=Mu(x,w);return d&&S>0||S>=x.width*x.height||S>=w.width*w.height}):[]},isNodeIntersecting:(f,d,h=!0)=>{const w=nS(f)?f:c(f);if(!w)return!1;const b=Mu(w,d);return h&&b>0||b>=d.width*d.height||b>=w.width*w.height},updateNode:u,updateNodeData:(f,d,h={replace:!1})=>{u(f,y=>{const w=typeof d=="function"?d(y):d;return h.replace?{...y,data:w}:{...y,data:{...y.data,...w}}},h)},updateEdge:p,updateEdgeData:(f,d,h={replace:!1})=>{p(f,y=>{const w=typeof d=="function"?d(y):d;return h.replace?{...y,data:w}:{...y,data:{...y.data,...w}}},h)},getNodesBounds:f=>{const{nodeLookup:d,nodeOrigin:h}=t.getState();return lz(f,{nodeLookup:d,nodeOrigin:h})},getHandleConnections:({type:f,id:d,nodeId:h})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${h}-${f}${d?`-${d}`:""}`))==null?void 0:y.values())??[])},getNodeConnections:({type:f,handleId:d,nodeId:h})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${h}${f?d?`-${f}-${d}`:`-${f}`:""}`))==null?void 0:y.values())??[])},fitView:async f=>{const d=t.getState().fitViewResolver??gz();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:d}),n.nodeQueue.push(h=>[...h]),d.promise}}},[]);return m.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const ES=e=>e.selected,t4=typeof window<"u"?window:void 0;function n4({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=un(),{deleteElements:r}=Yl(),s=Lu(e,{actInsideInputWithModifier:!1}),i=Lu(t,{target:t4});m.useEffect(()=>{if(s){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(ES),edges:a.filter(ES)}),n.setState({nodesSelectionActive:!1})}},[s]),m.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function r4(e){const t=un();m.useEffect(()=>{const n=()=>{var s,i,a,l;if(!e.current||!(((i=(s=e.current).checkVisibility)==null?void 0:i.call(s))??!0))return!1;const r=Bw(e.current);(r.height===0||r.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",oi.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 Th={position:"absolute",width:"100%",height:"100%",top:0,left:0},s4=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function i4({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=oa.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:p,maxZoom:f,zoomActivationKeyCode:d,preventScrolling:h=!0,children:y,noWheelClassName:w,noPanClassName:b,onViewportChange:g,isControlledViewport:k,paneClickDistance:x,selectionOnDrag:S}){const C=un(),j=m.useRef(null),{userSelectionActive:E,lib:A,connectionInProgress:O}=Rt(s4,pn),W=Lu(d),H=m.useRef();r4(j);const D=m.useCallback(R=>{g==null||g({x:R[0],y:R[1],zoom:R[2]}),k||C.setState({transform:R})},[g,k]);return m.useEffect(()=>{if(j.current){H.current=Qz({domNode:j.current,minZoom:p,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:F=>C.setState(M=>M.paneDragging===F?M:{paneDragging:F}),onPanZoomStart:(F,M)=>{const{onViewportChangeStart:I,onMoveStart:B}=C.getState();B==null||B(F,M),I==null||I(M)},onPanZoom:(F,M)=>{const{onViewportChange:I,onMove:B}=C.getState();B==null||B(F,M),I==null||I(M)},onPanZoomEnd:(F,M)=>{const{onViewportChangeEnd:I,onMoveEnd:B}=C.getState();B==null||B(F,M),I==null||I(M)}});const{x:R,y:T,zoom:V}=H.current.getViewport();return C.setState({panZoom:H.current,transform:[R,T,V],domNode:j.current.closest(".react-flow")}),()=>{var F;(F=H.current)==null||F.destroy()}}},[]),m.useEffect(()=>{var R;(R=H.current)==null||R.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:W,preventScrolling:h,noPanClassName:b,userSelectionActive:E,noWheelClassName:w,lib:A,onTransformChange:D,connectionInProgress:O,selectionOnDrag:S,paneClickDistance:x})},[e,t,n,r,s,i,a,l,W,h,b,E,w,A,D,O,S,x]),o.jsx("div",{className:"react-flow__renderer",ref:j,style:Th,children:y})}const o4=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function a4(){const{userSelectionActive:e,userSelectionRect:t}=Rt(o4,pn);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 rg=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},l4=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function c4({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Ru.Full,panOnDrag:r,paneClickDistance:s,selectionOnDrag:i,onSelectionStart:a,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:p,onPaneMouseEnter:f,onPaneMouseMove:d,onPaneMouseLeave:h,children:y}){const w=un(),{userSelectionActive:b,elementsSelectable:g,dragging:k,connectionInProgress:x}=Rt(l4,pn),S=g&&(e||b),C=m.useRef(null),j=m.useRef(),E=m.useRef(new Set),A=m.useRef(new Set),O=m.useRef(!1),W=I=>{if(O.current||x){O.current=!1;return}c==null||c(I),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},H=I=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){I.preventDefault();return}u==null||u(I)},D=p?I=>p(I):void 0,R=I=>{O.current&&(I.stopPropagation(),O.current=!1)},T=I=>{var te,ie;const{domNode:B}=w.getState();if(j.current=B==null?void 0:B.getBoundingClientRect(),!j.current)return;const _=I.target===C.current;if(!_&&!!I.target.closest(".nokey")||!e||!(i&&_||t)||I.button!==0||!I.isPrimary)return;(ie=(te=I.target)==null?void 0:te.setPointerCapture)==null||ie.call(te,I.pointerId),O.current=!1;const{x:$,y:Q}=Rs(I.nativeEvent,j.current);w.setState({userSelectionRect:{width:0,height:0,startX:$,startY:Q,x:$,y:Q}}),_||(I.stopPropagation(),I.preventDefault())},V=I=>{const{userSelectionRect:B,transform:_,nodeLookup:q,edgeLookup:z,connectionLookup:$,triggerNodeChanges:Q,triggerEdgeChanges:te,defaultEdgeOptions:ie,resetSelectedElements:he}=w.getState();if(!j.current||!B)return;const{x:ne,y:ce}=Rs(I.nativeEvent,j.current),{startX:re,startY:le}=B;if(!O.current){const Ie=t?0:s;if(Math.hypot(ne-re,ce-le)<=Ie)return;he(),a==null||a(I)}O.current=!0;const ue={startX:re,startY:le,x:ne<re?ne:re,y:ce<le?ce:le,width:Math.abs(ne-re),height:Math.abs(ce-le)},Se=E.current,De=A.current;E.current=new Set(Fw(q,ue,_,n===Ru.Partial,!0).map(Ie=>Ie.id)),A.current=new Set;const Ye=(ie==null?void 0:ie.selectable)??!0;for(const Ie of E.current){const Je=$.get(Ie);if(Je)for(const{edgeId:Et}of Je.values()){const bt=z.get(Et);bt&&(bt.selectable??Ye)&&A.current.add(Et)}}if(!rS(Se,E.current)){const Ie=dl(q,E.current,!0);Q(Ie)}if(!rS(De,A.current)){const Ie=dl(z,A.current);te(Ie)}w.setState({userSelectionRect:ue,userSelectionActive:!0,nodesSelectionActive:!1})},F=I=>{var B,_;I.button===0&&((_=(B=I.target)==null?void 0:B.releasePointerCapture)==null||_.call(B,I.pointerId),!b&&I.target===C.current&&w.getState().userSelectionRect&&(W==null||W(I)),w.setState({userSelectionActive:!1,userSelectionRect:null}),O.current&&(l==null||l(I),w.setState({nodesSelectionActive:E.current.size>0})))},M=r===!0||Array.isArray(r)&&r.includes(0);return o.jsxs("div",{className:On(["react-flow__pane",{draggable:M,dragging:k,selection:e}]),onClick:S?void 0:rg(W,C),onContextMenu:rg(H,C),onWheel:rg(D,C),onPointerEnter:S?void 0:f,onPointerMove:S?V:d,onPointerUp:S?F:void 0,onPointerDownCapture:S?T:void 0,onClickCapture:S?R:void 0,onPointerLeave:h,ref:C,style:Th,children:[y,o.jsx(a4,{})]})}function tx({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",oi.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var p;return(p=r==null?void 0:r.current)==null?void 0:p.blur()})):s([e])}function pA({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:a}){const l=un(),[c,u]=m.useState(!1),p=m.useRef();return m.useEffect(()=>{p.current=Dz({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{tx({id:f,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),m.useEffect(()=>{if(!(t||!e.current||!p.current))return p.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:a}),()=>{var f;(f=p.current)==null||f.destroy()}},[n,r,t,i,e,s,a]),c}const u4=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function hA(){const e=un();return m.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:p}=e.getState(),f=new Map,d=u4(a),h=s?i[0]:5,y=s?i[1]:5,w=n.direction.x*h*n.factor,b=n.direction.y*y*n.factor;for(const[,g]of u){if(!d(g))continue;let k={x:g.internals.positionAbsolute.x+w,y:g.internals.positionAbsolute.y+b};s&&(k=id(k,i));const{position:x,positionAbsolute:S}=PE({nodeId:g.id,nextPosition:k,nodeLookup:u,nodeExtent:r,nodeOrigin:p,onError:l});g.position=x,g.internals.positionAbsolute=S,f.set(g.id,g)}c(f)},[])}const Yw=m.createContext(null),d4=Yw.Provider;Yw.Consumer;const mA=()=>m.useContext(Yw),f4=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),p4=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:a}=r,{fromHandle:l,toHandle:c,isValid:u}=a,p=(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:p,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===Ll.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!s,valid:p&&u}};function h4({type:e="source",position:t=Oe.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:c,className:u,onMouseDown:p,onTouchStart:f,...d},h){var V,F;const y=a||null,w=e==="target",b=un(),g=mA(),{connectOnClick:k,noPanClassName:x,rfId:S}=Rt(f4,pn),{connectingFrom:C,connectingTo:j,clickConnecting:E,isPossibleEndHandle:A,connectionInProcess:O,clickConnectionInProcess:W,valid:H}=Rt(p4(g,y,e),pn);g||(F=(V=b.getState()).onError)==null||F.call(V,"010",oi.error010());const D=M=>{const{defaultEdgeOptions:I,onConnect:B,hasDefaultEdges:_}=b.getState(),q={...I,...M};if(_){const{edges:z,setEdges:$}=b.getState();$(Xf(q,z))}B==null||B(q),l==null||l(q)},R=M=>{if(!g)return;const I=DE(M.nativeEvent);if(s&&(I&&M.button===0||!I)){const B=b.getState();Zy.onPointerDown(M.nativeEvent,{handleDomNode:M.currentTarget,autoPanOnConnect:B.autoPanOnConnect,connectionMode:B.connectionMode,connectionRadius:B.connectionRadius,domNode:B.domNode,nodeLookup:B.nodeLookup,lib:B.lib,isTarget:w,handleId:y,nodeId:g,flowId:B.rfId,panBy:B.panBy,cancelConnection:B.cancelConnection,onConnectStart:B.onConnectStart,onConnectEnd:(..._)=>{var q,z;return(z=(q=b.getState()).onConnectEnd)==null?void 0:z.call(q,..._)},updateConnection:B.updateConnection,onConnect:D,isValidConnection:n||((..._)=>{var q,z;return((z=(q=b.getState()).isValidConnection)==null?void 0:z.call(q,..._))??!0}),getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,autoPanSpeed:B.autoPanSpeed,dragThreshold:B.connectionDragThreshold})}I?p==null||p(M):f==null||f(M)},T=M=>{const{onClickConnectStart:I,onClickConnectEnd:B,connectionClickStartHandle:_,connectionMode:q,isValidConnection:z,lib:$,rfId:Q,nodeLookup:te,connection:ie}=b.getState();if(!g||!_&&!s)return;if(!_){I==null||I(M.nativeEvent,{nodeId:g,handleId:y,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:g,type:e,id:y}});return}const he=LE(M.target),ne=n||z,{connection:ce,isValid:re}=Zy.isValid(M.nativeEvent,{handle:{nodeId:g,id:y,type:e},connectionMode:q,fromNodeId:_.nodeId,fromHandleId:_.id||null,fromType:_.type,isValidConnection:ne,flowId:Q,doc:he,lib:$,nodeLookup:te});re&&ce&&D(ce);const le=structuredClone(ie);delete le.inProgress,le.toPosition=le.toHandle?le.toHandle.position:null,B==null||B(M,le),b.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":y,"data-nodeid":g,"data-handlepos":t,"data-id":`${S}-${g}-${y}-${e}`,className:On(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",x,u,{source:!w,target:w,connectable:r,connectablestart:s,connectableend:i,clickconnecting:E,connectingfrom:C,connectingto:j,valid:H,connectionindicator:r&&(!O||A)&&(O||W?i:s)}]),onMouseDown:R,onTouchStart:R,onClick:k?T:void 0,ref:h,...d,children:c})}const Ln=m.memo(dA(h4));function m4({data:e,isConnectable:t,sourcePosition:n=Oe.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(Ln,{type:"source",position:n,isConnectable:t})]})}function g4({data:e,isConnectable:t,targetPosition:n=Oe.Top,sourcePosition:r=Oe.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(Ln,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(Ln,{type:"source",position:r,isConnectable:t})]})}function y4(){return null}function x4({data:e,isConnectable:t,targetPosition:n=Oe.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(Ln,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Dp={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},AS={input:m4,default:g4,output:x4,group:y4};function w4(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 b4=e=>{const{width:t,height:n,x:r,y:s}=sd(e.nodeLookup,{filter:i=>!!i.selected});return{width:Ts(t)?t:null,height:Ts(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 k4({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=un(),{width:s,height:i,transformString:a,userSelectionActive:l}=Rt(b4,pn),c=hA(),u=m.useRef(null);m.useEffect(()=>{var h;n||(h=u.current)==null||h.focus({preventScroll:!0})},[n]);const p=!l&&s!==null&&i!==null;if(pA({nodeRef:u,disabled:!p}),!p)return null;const f=e?h=>{const y=r.getState().nodes.filter(w=>w.selected);e(h,y)}:void 0,d=h=>{Object.prototype.hasOwnProperty.call(Dp,h.key)&&(h.preventDefault(),c({direction:Dp[h.key],factor:h.shiftKey?4:1}))};return o.jsx("div",{className:On(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:o.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:d,style:{width:s,height:i}})})}const PS=typeof window<"u"?window:void 0,v4=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function gA({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:p,selectionMode:f,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:y,panActivationKeyCode:w,zoomActivationKeyCode:b,elementsSelectable:g,zoomOnScroll:k,zoomOnPinch:x,panOnScroll:S,panOnScrollSpeed:C,panOnScrollMode:j,zoomOnDoubleClick:E,panOnDrag:A,defaultViewport:O,translateExtent:W,minZoom:H,maxZoom:D,preventScrolling:R,onSelectionContextMenu:T,noWheelClassName:V,noPanClassName:F,disableKeyboardA11y:M,onViewportChange:I,isControlledViewport:B}){const{nodesSelectionActive:_,userSelectionActive:q}=Rt(v4,pn),z=Lu(u,{target:PS}),$=Lu(w,{target:PS}),Q=$||A,te=$||S,ie=p&&Q!==!0,he=z||q||ie;return n4({deleteKeyCode:c,multiSelectionKeyCode:y}),o.jsx(i4,{onPaneContextMenu:i,elementsSelectable:g,zoomOnScroll:k,zoomOnPinch:x,panOnScroll:te,panOnScrollSpeed:C,panOnScrollMode:j,zoomOnDoubleClick:E,panOnDrag:!z&&Q,defaultViewport:O,translateExtent:W,minZoom:H,maxZoom:D,zoomActivationKeyCode:b,preventScrolling:R,noWheelClassName:V,noPanClassName:F,onViewportChange:I,isControlledViewport:B,paneClickDistance:l,selectionOnDrag:ie,children:o.jsxs(c4,{onSelectionStart:d,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:Q,isSelecting:!!he,selectionMode:f,selectionKeyPressed:z,paneClickDistance:l,selectionOnDrag:ie,children:[e,_&&o.jsx(k4,{onSelectionContextMenu:T,noPanClassName:F,disableKeyboardA11y:M})]})})}gA.displayName="FlowRenderer";const S4=m.memo(gA),N4=e=>t=>e?Fw(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 j4(e){return Rt(m.useCallback(N4(e),[e]),pn)}const C4=e=>e.updateNodeInternals;function _4(){const e=Rt(C4),[t]=m.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),e(r)}));return m.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function E4({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=un(),i=m.useRef(null),a=m.useRef(null),l=m.useRef(e.sourcePosition),c=m.useRef(e.targetPosition),u=m.useRef(t),p=n&&!!e.internals.handleBounds;return m.useEffect(()=>{i.current&&!e.hidden&&(!p||a.current!==i.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(i.current),a.current=i.current)},[p,e.hidden]),m.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),m.useEffect(()=>{if(i.current){const f=u.current!==t,d=l.current!==e.sourcePosition,h=c.current!==e.targetPosition;(f||d||h)&&(u.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 A4({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:p,resizeObserver:f,noDragClassName:d,noPanClassName:h,disableKeyboardA11y:y,rfId:w,nodeTypes:b,nodeClickDistance:g,onError:k}){const{node:x,internals:S,isParent:C}=Rt(ne=>{const ce=ne.nodeLookup.get(e),re=ne.parentLookup.has(e);return{node:ce,internals:ce.internals,isParent:re}},pn);let j=x.type||"default",E=(b==null?void 0:b[j])||AS[j];E===void 0&&(k==null||k("003",oi.error003(j)),j="default",E=(b==null?void 0:b.default)||AS.default);const A=!!(x.draggable||l&&typeof x.draggable>"u"),O=!!(x.selectable||c&&typeof x.selectable>"u"),W=!!(x.connectable||u&&typeof x.connectable>"u"),H=!!(x.focusable||p&&typeof x.focusable>"u"),D=un(),R=ME(x),T=E4({node:x,nodeType:j,hasDimensions:R,resizeObserver:f}),V=pA({nodeRef:T,disabled:x.hidden||!A,noDragClassName:d,handleSelector:x.dragHandle,nodeId:e,isSelectable:O,nodeClickDistance:g}),F=hA();if(x.hidden)return null;const M=Di(x),I=w4(x),B=O||A||t||n||r||s,_=n?ne=>n(ne,{...S.userNode}):void 0,q=r?ne=>r(ne,{...S.userNode}):void 0,z=s?ne=>s(ne,{...S.userNode}):void 0,$=i?ne=>i(ne,{...S.userNode}):void 0,Q=a?ne=>a(ne,{...S.userNode}):void 0,te=ne=>{const{selectNodesOnDrag:ce,nodeDragThreshold:re}=D.getState();O&&(!ce||!A||re>0)&&tx({id:e,store:D,nodeRef:T}),t&&t(ne,{...S.userNode})},ie=ne=>{if(!(OE(ne.nativeEvent)||y)){if(jE.includes(ne.key)&&O){const ce=ne.key==="Escape";tx({id:e,store:D,unselect:ce,nodeRef:T})}else if(A&&x.selected&&Object.prototype.hasOwnProperty.call(Dp,ne.key)){ne.preventDefault();const{ariaLabelConfig:ce}=D.getState();D.setState({ariaLiveMessage:ce["node.a11yDescription.ariaLiveMessage"]({direction:ne.key.replace("Arrow","").toLowerCase(),x:~~S.positionAbsolute.x,y:~~S.positionAbsolute.y})}),F({direction:Dp[ne.key],factor:ne.shiftKey?4:1})}}},he=()=>{var De;if(y||!((De=T.current)!=null&&De.matches(":focus-visible")))return;const{transform:ne,width:ce,height:re,autoPanOnNodeFocus:le,setCenter:ue}=D.getState();if(!le)return;Fw(new Map([[e,x]]),{x:0,y:0,width:ce,height:re},ne,!0).length>0||ue(x.position.x+M.width/2,x.position.y+M.height/2,{zoom:ne[2]})};return o.jsx("div",{className:On(["react-flow__node",`react-flow__node-${j}`,{[h]:A},x.className,{selected:x.selected,selectable:O,parent:C,draggable:A,dragging:V}]),ref:T,style:{zIndex:S.z,transform:`translate(${S.positionAbsolute.x}px,${S.positionAbsolute.y}px)`,pointerEvents:B?"all":"none",visibility:R?"visible":"hidden",...x.style,...I},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:_,onMouseMove:q,onMouseLeave:z,onContextMenu:$,onClick:te,onDoubleClick:Q,onKeyDown:H?ie:void 0,tabIndex:H?0:void 0,onFocus:H?he:void 0,role:x.ariaRole??(H?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${aA}-${w}`,"aria-label":x.ariaLabel,...x.domAttributes,children:o.jsx(d4,{value:e,children:o.jsx(E,{id:e,data:x.data,type:j,positionAbsoluteX:S.positionAbsolute.x,positionAbsoluteY:S.positionAbsolute.y,selected:x.selected??!1,selectable:O,draggable:A,deletable:x.deletable??!0,isConnectable:W,sourcePosition:x.sourcePosition,targetPosition:x.targetPosition,dragging:V,dragHandle:x.dragHandle,zIndex:S.z,parentId:x.parentId,...M})})})}var P4=m.memo(A4);const I4=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function yA(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=Rt(I4,pn),a=j4(e.onlyRenderVisibleElements),l=_4();return o.jsx("div",{className:"react-flow__nodes",style:Th,children:a.map(c=>o.jsx(P4,{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))})}yA.displayName="NodeRenderer";const T4=m.memo(yA);function R4(e){return Rt(m.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const i=n.nodeLookup.get(s.source),a=n.nodeLookup.get(s.target);i&&a&&bz({sourceNode:i,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),pn)}const M4=({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"})},$4=({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"})},IS={[Qs.Arrow]:M4,[Qs.ArrowClosed]:$4};function L4(e){const t=un();return m.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(IS,e)?IS[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",oi.error009(e)),null)},[e])}const O4=({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=L4(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},xA=({defaultColor:e,rfId:t})=>{const n=Rt(i=>i.edges),r=Rt(i=>i.defaultEdgeOptions),s=m.useMemo(()=>_z(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(O4,{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};xA.displayName="MarkerDefinitions";var D4=m.memo(xA);function wA({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...p}){const[f,d]=m.useState({x:1,y:0,width:0,height:0}),h=On(["react-flow__edge-textwrapper",u]),y=m.useRef(null);return m.useEffect(()=>{if(y.current){const w=y.current.getBBox();d({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?o.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:h,visibility:f.width?"visible":"hidden",...p,children:[s&&o.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),o.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:y,style:r,children:n}),c]}):null}wA.displayName="EdgeText";const F4=m.memo(wA);function Rh({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...p}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...p,d:e,fill:"none",className:On(["react-flow__edge-path",p.className])}),u?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&Ts(t)&&Ts(n)?o.jsx(F4,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function TS({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Oe.Left||e===Oe.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function bA({sourceX:e,sourceY:t,sourcePosition:n=Oe.Bottom,targetX:r,targetY:s,targetPosition:i=Oe.Top}){const[a,l]=TS({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,u]=TS({pos:i,x1:r,y1:s,x2:e,y2:t}),[p,f,d,h]=FE({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${r},${s}`,p,f,d,h]}function kA(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:l,label:c,labelStyle:u,labelShowBg:p,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:y,markerEnd:w,markerStart:b,interactionWidth:g})=>{const[k,x,S]=bA({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l}),C=e.isInternal?void 0:t;return o.jsx(Rh,{id:C,path:k,labelX:x,labelY:S,label:c,labelStyle:u,labelShowBg:p,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:y,markerEnd:w,markerStart:b,interactionWidth:g})})}const z4=kA({isInternal:!1}),vA=kA({isInternal:!0});z4.displayName="SimpleBezierEdge";vA.displayName="SimpleBezierEdgeInternal";function SA(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:f,style:d,sourcePosition:h=Oe.Bottom,targetPosition:y=Oe.Top,markerEnd:w,markerStart:b,pathOptions:g,interactionWidth:k})=>{const[x,S,C]=Jy({sourceX:n,sourceY:r,sourcePosition:h,targetX:s,targetY:i,targetPosition:y,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset,stepPosition:g==null?void 0:g.stepPosition}),j=e.isInternal?void 0:t;return o.jsx(Rh,{id:j,path:x,labelX:S,labelY:C,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:f,style:d,markerEnd:w,markerStart:b,interactionWidth:k})})}const NA=SA({isInternal:!1}),jA=SA({isInternal:!0});NA.displayName="SmoothStepEdge";jA.displayName="SmoothStepEdgeInternal";function CA(e){return m.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return o.jsx(NA,{...n,id:r,pathOptions:m.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const B4=CA({isInternal:!1}),_A=CA({isInternal:!0});B4.displayName="StepEdge";_A.displayName="StepEdgeInternal";function EA(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:y,interactionWidth:w})=>{const[b,g,k]=HE({sourceX:n,sourceY:r,targetX:s,targetY:i}),x=e.isInternal?void 0:t;return o.jsx(Rh,{id:x,path:b,labelX:g,labelY:k,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:y,interactionWidth:w})})}const H4=EA({isInternal:!1}),AA=EA({isInternal:!0});H4.displayName="StraightEdge";AA.displayName="StraightEdgeInternal";function PA(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a=Oe.Bottom,targetPosition:l=Oe.Top,label:c,labelStyle:u,labelShowBg:p,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:y,markerEnd:w,markerStart:b,pathOptions:g,interactionWidth:k})=>{const[x,S,C]=zE({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l,curvature:g==null?void 0:g.curvature}),j=e.isInternal?void 0:t;return o.jsx(Rh,{id:j,path:x,labelX:S,labelY:C,label:c,labelStyle:u,labelShowBg:p,labelBgStyle:f,labelBgPadding:d,labelBgBorderRadius:h,style:y,markerEnd:w,markerStart:b,interactionWidth:k})})}const W4=PA({isInternal:!1}),IA=PA({isInternal:!0});W4.displayName="BezierEdge";IA.displayName="BezierEdgeInternal";const RS={default:IA,straight:AA,step:_A,smoothstep:jA,simplebezier:vA},MS={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},V4=(e,t,n)=>n===Oe.Left?e-t:n===Oe.Right?e+t:e,K4=(e,t,n)=>n===Oe.Top?e-t:n===Oe.Bottom?e+t:e,$S="react-flow__edgeupdater";function LS({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:On([$S,`${$S}-${l}`]),cx:V4(t,r,e),cy:K4(n,r,e),r,stroke:"transparent",fill:"transparent"})}function U4({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:p,onReconnectEnd:f,setReconnecting:d,setUpdateHover:h}){const y=un(),w=(S,C)=>{if(S.button!==0)return;const{autoPanOnConnect:j,domNode:E,connectionMode:A,connectionRadius:O,lib:W,onConnectStart:H,cancelConnection:D,nodeLookup:R,rfId:T,panBy:V,updateConnection:F}=y.getState(),M=C.type==="target",I=(q,z)=>{d(!1),f==null||f(q,n,C.type,z)},B=q=>u==null?void 0:u(n,q),_=(q,z)=>{d(!0),p==null||p(S,n,C.type),H==null||H(q,z)};Zy.onPointerDown(S.nativeEvent,{autoPanOnConnect:j,connectionMode:A,connectionRadius:O,domNode:E,handleId:C.id,nodeId:C.nodeId,nodeLookup:R,isTarget:M,edgeUpdaterType:C.type,lib:W,flowId:T,cancelConnection:D,panBy:V,isValidConnection:(...q)=>{var z,$;return(($=(z=y.getState()).isValidConnection)==null?void 0:$.call(z,...q))??!0},onConnect:B,onConnectStart:_,onConnectEnd:(...q)=>{var z,$;return($=(z=y.getState()).onConnectEnd)==null?void 0:$.call(z,...q)},onReconnectEnd:I,updateConnection:F,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,dragThreshold:y.getState().connectionDragThreshold,handleDomNode:S.currentTarget})},b=S=>w(S,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),g=S=>w(S,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),k=()=>h(!0),x=()=>h(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(LS,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:b,onMouseEnter:k,onMouseOut:x,type:"source"}),(e===!0||e==="target")&&o.jsx(LS,{position:c,centerX:i,centerY:a,radius:t,onMouseDown:g,onMouseEnter:k,onMouseOut:x,type:"target"})]})}function q4({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:p,onReconnect:f,onReconnectStart:d,onReconnectEnd:h,rfId:y,edgeTypes:w,noPanClassName:b,onError:g,disableKeyboardA11y:k}){let x=Rt(ue=>ue.edgeLookup.get(e));const S=Rt(ue=>ue.defaultEdgeOptions);x=S?{...S,...x}:x;let C=x.type||"default",j=(w==null?void 0:w[C])||RS[C];j===void 0&&(g==null||g("011",oi.error011(C)),C="default",j=(w==null?void 0:w.default)||RS.default);const E=!!(x.focusable||t&&typeof x.focusable>"u"),A=typeof f<"u"&&(x.reconnectable||n&&typeof x.reconnectable>"u"),O=!!(x.selectable||r&&typeof x.selectable>"u"),W=m.useRef(null),[H,D]=m.useState(!1),[R,T]=m.useState(!1),V=un(),{zIndex:F,sourceX:M,sourceY:I,targetX:B,targetY:_,sourcePosition:q,targetPosition:z}=Rt(m.useCallback(ue=>{const Se=ue.nodeLookup.get(x.source),De=ue.nodeLookup.get(x.target);if(!Se||!De)return{zIndex:x.zIndex,...MS};const Ye=Cz({id:e,sourceNode:Se,targetNode:De,sourceHandle:x.sourceHandle||null,targetHandle:x.targetHandle||null,connectionMode:ue.connectionMode,onError:g});return{zIndex:wz({selected:x.selected,zIndex:x.zIndex,sourceNode:Se,targetNode:De,elevateOnSelect:ue.elevateEdgesOnSelect,zIndexMode:ue.zIndexMode}),...Ye||MS}},[x.source,x.target,x.sourceHandle,x.targetHandle,x.selected,x.zIndex]),pn),$=m.useMemo(()=>x.markerStart?`url('#${Xy(x.markerStart,y)}')`:void 0,[x.markerStart,y]),Q=m.useMemo(()=>x.markerEnd?`url('#${Xy(x.markerEnd,y)}')`:void 0,[x.markerEnd,y]);if(x.hidden||M===null||I===null||B===null||_===null)return null;const te=ue=>{var Ie;const{addSelectedEdges:Se,unselectNodesAndEdges:De,multiSelectionActive:Ye}=V.getState();O&&(V.setState({nodesSelectionActive:!1}),x.selected&&Ye?(De({nodes:[],edges:[x]}),(Ie=W.current)==null||Ie.blur()):Se([e])),s&&s(ue,x)},ie=i?ue=>{i(ue,{...x})}:void 0,he=a?ue=>{a(ue,{...x})}:void 0,ne=l?ue=>{l(ue,{...x})}:void 0,ce=c?ue=>{c(ue,{...x})}:void 0,re=u?ue=>{u(ue,{...x})}:void 0,le=ue=>{var Se;if(!k&&jE.includes(ue.key)&&O){const{unselectNodesAndEdges:De,addSelectedEdges:Ye}=V.getState();ue.key==="Escape"?((Se=W.current)==null||Se.blur(),De({edges:[x]})):Ye([e])}};return o.jsx("svg",{style:{zIndex:F},children:o.jsxs("g",{className:On(["react-flow__edge",`react-flow__edge-${C}`,x.className,b,{selected:x.selected,animated:x.animated,inactive:!O&&!s,updating:H,selectable:O}]),onClick:te,onDoubleClick:ie,onContextMenu:he,onMouseEnter:ne,onMouseMove:ce,onMouseLeave:re,onKeyDown:E?le:void 0,tabIndex:E?0:void 0,role:x.ariaRole??(E?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":x.ariaLabel===null?void 0:x.ariaLabel||`Edge from ${x.source} to ${x.target}`,"aria-describedby":E?`${lA}-${y}`:void 0,ref:W,...x.domAttributes,children:[!R&&o.jsx(j,{id:e,source:x.source,target:x.target,type:x.type,selected:x.selected,animated:x.animated,selectable:O,deletable:x.deletable??!0,label:x.label,labelStyle:x.labelStyle,labelShowBg:x.labelShowBg,labelBgStyle:x.labelBgStyle,labelBgPadding:x.labelBgPadding,labelBgBorderRadius:x.labelBgBorderRadius,sourceX:M,sourceY:I,targetX:B,targetY:_,sourcePosition:q,targetPosition:z,data:x.data,style:x.style,sourceHandleId:x.sourceHandle,targetHandleId:x.targetHandle,markerStart:$,markerEnd:Q,pathOptions:"pathOptions"in x?x.pathOptions:void 0,interactionWidth:x.interactionWidth}),A&&o.jsx(U4,{edge:x,isReconnectable:A,reconnectRadius:p,onReconnect:f,onReconnectStart:d,onReconnectEnd:h,sourceX:M,sourceY:I,targetX:B,targetY:_,sourcePosition:q,targetPosition:z,setUpdateHover:D,setReconnecting:T})]})})}var Y4=m.memo(q4);const G4=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function TA({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:p,reconnectRadius:f,onEdgeDoubleClick:d,onReconnectStart:h,onReconnectEnd:y,disableKeyboardA11y:w}){const{edgesFocusable:b,edgesReconnectable:g,elementsSelectable:k,onError:x}=Rt(G4,pn),S=R4(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(D4,{defaultColor:e,rfId:n}),S.map(C=>o.jsx(Y4,{id:C,edgesFocusable:b,edgesReconnectable:g,elementsSelectable:k,noPanClassName:s,onReconnect:i,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:p,reconnectRadius:f,onDoubleClick:d,onReconnectStart:h,onReconnectEnd:y,rfId:n,onError:x,edgeTypes:r,disableKeyboardA11y:w},C))]})}TA.displayName="EdgeRenderer";const J4=m.memo(TA),X4=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Q4({children:e}){const t=Rt(X4);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Z4(e){const t=Yl(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const e5=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function t5(e){const t=Rt(e5),n=un();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function n5(e){return e.connection.inProgress?{...e.connection,to:od(e.connection.to,e.transform)}:{...e.connection}}function r5(e){return n5}function s5(e){const t=r5();return Rt(t,pn)}const i5=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function o5({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:a,isValid:l,inProgress:c}=Rt(i5,pn);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:On(["react-flow__connection",EE(l)]),children:o.jsx(RA,{style:t,type:n,CustomComponent:r,isValid:l})})})}const RA=({style:e,type:t=lo.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:a,fromHandle:l,fromPosition:c,to:u,toNode:p,toHandle:f,toPosition:d,pointer:h}=s5();if(!s)return;if(n)return o.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:d,connectionStatus:EE(r),toNode:p,toHandle:f,pointer:h});let y="";const w={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:d};switch(t){case lo.Bezier:[y]=zE(w);break;case lo.SimpleBezier:[y]=bA(w);break;case lo.Step:[y]=Jy({...w,borderRadius:0});break;case lo.SmoothStep:[y]=Jy(w);break;default:[y]=HE(w)}return o.jsx("path",{d:y,fill:"none",className:"react-flow__connection-path",style:e})};RA.displayName="ConnectionLine";const a5={};function OS(e=a5){m.useRef(e),un(),m.useEffect(()=>{},[e])}function l5(){un(),m.useRef(!1),m.useEffect(()=>{},[])}function MA({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:p,onSelectionContextMenu:f,onSelectionStart:d,onSelectionEnd:h,connectionLineType:y,connectionLineStyle:w,connectionLineComponent:b,connectionLineContainerStyle:g,selectionKeyCode:k,selectionOnDrag:x,selectionMode:S,multiSelectionKeyCode:C,panActivationKeyCode:j,zoomActivationKeyCode:E,deleteKeyCode:A,onlyRenderVisibleElements:O,elementsSelectable:W,defaultViewport:H,translateExtent:D,minZoom:R,maxZoom:T,preventScrolling:V,defaultMarkerColor:F,zoomOnScroll:M,zoomOnPinch:I,panOnScroll:B,panOnScrollSpeed:_,panOnScrollMode:q,zoomOnDoubleClick:z,panOnDrag:$,onPaneClick:Q,onPaneMouseEnter:te,onPaneMouseMove:ie,onPaneMouseLeave:he,onPaneScroll:ne,onPaneContextMenu:ce,paneClickDistance:re,nodeClickDistance:le,onEdgeContextMenu:ue,onEdgeMouseEnter:Se,onEdgeMouseMove:De,onEdgeMouseLeave:Ye,reconnectRadius:Ie,onReconnect:Je,onReconnectStart:Et,onReconnectEnd:bt,noDragClassName:Pe,noWheelClassName:rt,noPanClassName:At,disableKeyboardA11y:zt,nodeExtent:Kt,rfId:tt,viewport:oe,onViewportChange:be}){return OS(e),OS(t),l5(),Z4(n),t5(oe),o.jsx(S4,{onPaneClick:Q,onPaneMouseEnter:te,onPaneMouseMove:ie,onPaneMouseLeave:he,onPaneContextMenu:ce,onPaneScroll:ne,paneClickDistance:re,deleteKeyCode:A,selectionKeyCode:k,selectionOnDrag:x,selectionMode:S,onSelectionStart:d,onSelectionEnd:h,multiSelectionKeyCode:C,panActivationKeyCode:j,zoomActivationKeyCode:E,elementsSelectable:W,zoomOnScroll:M,zoomOnPinch:I,zoomOnDoubleClick:z,panOnScroll:B,panOnScrollSpeed:_,panOnScrollMode:q,panOnDrag:$,defaultViewport:H,translateExtent:D,minZoom:R,maxZoom:T,onSelectionContextMenu:f,preventScrolling:V,noDragClassName:Pe,noWheelClassName:rt,noPanClassName:At,disableKeyboardA11y:zt,onViewportChange:be,isControlledViewport:!!oe,children:o.jsxs(Q4,{children:[o.jsx(J4,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:Je,onReconnectStart:Et,onReconnectEnd:bt,onlyRenderVisibleElements:O,onEdgeContextMenu:ue,onEdgeMouseEnter:Se,onEdgeMouseMove:De,onEdgeMouseLeave:Ye,reconnectRadius:Ie,defaultMarkerColor:F,noPanClassName:At,disableKeyboardA11y:zt,rfId:tt}),o.jsx(o5,{style:w,type:y,component:b,containerStyle:g}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(T4,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:p,nodeClickDistance:le,onlyRenderVisibleElements:O,noPanClassName:At,noDragClassName:Pe,disableKeyboardA11y:zt,nodeExtent:Kt,rfId:tt}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}MA.displayName="GraphView";const c5=m.memo(MA),DS=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:p,nodeExtent:f,zIndexMode:d="basic"}={})=>{const h=new Map,y=new Map,w=new Map,b=new Map,g=r??t??[],k=n??e??[],x=p??[0,0],S=f??Tu;KE(w,b,g);const{nodesInitialized:C}=Qy(k,h,y,{nodeOrigin:x,nodeExtent:S,zIndexMode:d});let j=[0,0,1];if(a&&s&&i){const E=sd(h,{filter:H=>!!((H.width||H.initialWidth)&&(H.height||H.initialHeight))}),{x:A,y:O,zoom:W}=zw(E,s,i,c,u,(l==null?void 0:l.padding)??.1);j=[A,O,W]}return{rfId:"1",width:s??0,height:i??0,transform:j,nodes:k,nodesInitialized:C,nodeLookup:h,parentLookup:y,edges:g,edgeLookup:b,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Tu,nodeExtent:S,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ll.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:x,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:l,fitViewResolver:null,connection:{..._E},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:pz,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:CE,zIndexMode:d,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},u5=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:p,nodeExtent:f,zIndexMode:d})=>A3((h,y)=>{async function w(){const{nodeLookup:b,panZoom:g,fitViewOptions:k,fitViewResolver:x,width:S,height:C,minZoom:j,maxZoom:E}=y();g&&(await dz({nodes:b,width:S,height:C,panZoom:g,minZoom:j,maxZoom:E},k),x==null||x.resolve(!0),h({fitViewResolver:null}))}return{...DS({nodes:e,edges:t,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:p,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:d}),setNodes:b=>{const{nodeLookup:g,parentLookup:k,nodeOrigin:x,elevateNodesOnSelect:S,fitViewQueued:C,zIndexMode:j,nodesSelectionActive:E}=y(),{nodesInitialized:A,hasSelectedNodes:O}=Qy(b,g,k,{nodeOrigin:x,nodeExtent:f,elevateNodesOnSelect:S,checkEquality:!0,zIndexMode:j}),W=E&&O;C&&A?(w(),h({nodes:b,nodesInitialized:A,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:W})):h({nodes:b,nodesInitialized:A,nodesSelectionActive:W})},setEdges:b=>{const{connectionLookup:g,edgeLookup:k}=y();KE(g,k,b),h({edges:b})},setDefaultNodesAndEdges:(b,g)=>{if(b){const{setNodes:k}=y();k(b),h({hasDefaultNodes:!0})}if(g){const{setEdges:k}=y();k(g),h({hasDefaultEdges:!0})}},updateNodeInternals:b=>{const{triggerNodeChanges:g,nodeLookup:k,parentLookup:x,domNode:S,nodeOrigin:C,nodeExtent:j,debug:E,fitViewQueued:A,zIndexMode:O}=y(),{changes:W,updatedInternals:H}=Mz(b,k,x,S,C,j,O);H&&(Pz(k,x,{nodeOrigin:C,nodeExtent:j,zIndexMode:O}),A?(w(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(W==null?void 0:W.length)>0&&(E&&console.log("React Flow: trigger node changes",W),g==null||g(W)))},updateNodePositions:(b,g=!1)=>{const k=[];let x=[];const{nodeLookup:S,triggerNodeChanges:C,connection:j,updateConnection:E,onNodesChangeMiddlewareMap:A}=y();for(const[O,W]of b){const H=S.get(O),D=!!(H!=null&&H.expandParent&&(H!=null&&H.parentId)&&(W!=null&&W.position)),R={id:O,type:"position",position:D?{x:Math.max(0,W.position.x),y:Math.max(0,W.position.y)}:W.position,dragging:g};if(H&&j.inProgress&&j.fromNode.id===H.id){const T=xa(H,j.fromHandle,Oe.Left,!0);E({...j,from:T})}D&&H.parentId&&k.push({id:O,parentId:H.parentId,rect:{...W.internals.positionAbsolute,width:W.measured.width??0,height:W.measured.height??0}}),x.push(R)}if(k.length>0){const{parentLookup:O,nodeOrigin:W}=y(),H=Uw(k,S,O,W);x.push(...H)}for(const O of A.values())x=O(x);C(x)},triggerNodeChanges:b=>{const{onNodesChange:g,setNodes:k,nodes:x,hasDefaultNodes:S,debug:C}=y();if(b!=null&&b.length){if(S){const j=Op(b,x);k(j)}C&&console.log("React Flow: trigger node changes",b),g==null||g(b)}},triggerEdgeChanges:b=>{const{onEdgesChange:g,setEdges:k,edges:x,hasDefaultEdges:S,debug:C}=y();if(b!=null&&b.length){if(S){const j=qw(b,x);k(j)}C&&console.log("React Flow: trigger edge changes",b),g==null||g(b)}},addSelectedNodes:b=>{const{multiSelectionActive:g,edgeLookup:k,nodeLookup:x,triggerNodeChanges:S,triggerEdgeChanges:C}=y();if(g){const j=b.map(E=>Uo(E,!0));S(j);return}S(dl(x,new Set([...b]),!0)),C(dl(k))},addSelectedEdges:b=>{const{multiSelectionActive:g,edgeLookup:k,nodeLookup:x,triggerNodeChanges:S,triggerEdgeChanges:C}=y();if(g){const j=b.map(E=>Uo(E,!0));C(j);return}C(dl(k,new Set([...b]))),S(dl(x,new Set,!0))},unselectNodesAndEdges:({nodes:b,edges:g}={})=>{const{edges:k,nodes:x,nodeLookup:S,triggerNodeChanges:C,triggerEdgeChanges:j}=y(),E=b||x,A=g||k,O=[];for(const H of E){if(!H.selected)continue;const D=S.get(H.id);D&&(D.selected=!1),O.push(Uo(H.id,!1))}const W=[];for(const H of A)H.selected&&W.push(Uo(H.id,!1));C(O),j(W)},setMinZoom:b=>{const{panZoom:g,maxZoom:k}=y();g==null||g.setScaleExtent([b,k]),h({minZoom:b})},setMaxZoom:b=>{const{panZoom:g,minZoom:k}=y();g==null||g.setScaleExtent([k,b]),h({maxZoom:b})},setTranslateExtent:b=>{var g;(g=y().panZoom)==null||g.setTranslateExtent(b),h({translateExtent:b})},resetSelectedElements:()=>{const{edges:b,nodes:g,triggerNodeChanges:k,triggerEdgeChanges:x,elementsSelectable:S}=y();if(!S)return;const C=g.reduce((E,A)=>A.selected?[...E,Uo(A.id,!1)]:E,[]),j=b.reduce((E,A)=>A.selected?[...E,Uo(A.id,!1)]:E,[]);k(C),x(j)},setNodeExtent:b=>{const{nodes:g,nodeLookup:k,parentLookup:x,nodeOrigin:S,elevateNodesOnSelect:C,nodeExtent:j,zIndexMode:E}=y();b[0][0]===j[0][0]&&b[0][1]===j[0][1]&&b[1][0]===j[1][0]&&b[1][1]===j[1][1]||(Qy(g,k,x,{nodeOrigin:S,nodeExtent:b,elevateNodesOnSelect:C,checkEquality:!1,zIndexMode:E}),h({nodeExtent:b}))},panBy:b=>{const{transform:g,width:k,height:x,panZoom:S,translateExtent:C}=y();return $z({delta:b,panZoom:S,transform:g,translateExtent:C,width:k,height:x})},setCenter:async(b,g,k)=>{const{width:x,height:S,maxZoom:C,panZoom:j}=y();if(!j)return Promise.resolve(!1);const E=typeof(k==null?void 0:k.zoom)<"u"?k.zoom:C;return await j.setViewport({x:x/2-b*E,y:S/2-g*E,zoom:E},{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:()=>{h({connection:{..._E}})},updateConnection:b=>{h({connection:b})},reset:()=>h({...DS()})}},Object.is);function Gw({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:p,nodeExtent:f,zIndexMode:d,children:h}){const[y]=m.useState(()=>u5({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:u,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:p,nodeExtent:f,zIndexMode:d}));return o.jsx(P3,{value:y,children:o.jsx(Q3,{children:h})})}function d5({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:a,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:p,nodeOrigin:f,nodeExtent:d,zIndexMode:h}){return m.useContext(Ph)?o.jsx(o.Fragment,{children:e}):o.jsx(Gw,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:p,nodeOrigin:f,nodeExtent:d,zIndexMode:h,children:e})}const f5={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function p5({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:p,onMoveStart:f,onMoveEnd:d,onConnect:h,onConnectStart:y,onConnectEnd:w,onClickConnectStart:b,onClickConnectEnd:g,onNodeMouseEnter:k,onNodeMouseMove:x,onNodeMouseLeave:S,onNodeContextMenu:C,onNodeDoubleClick:j,onNodeDragStart:E,onNodeDrag:A,onNodeDragStop:O,onNodesDelete:W,onEdgesDelete:H,onDelete:D,onSelectionChange:R,onSelectionDragStart:T,onSelectionDrag:V,onSelectionDragStop:F,onSelectionContextMenu:M,onSelectionStart:I,onSelectionEnd:B,onBeforeDelete:_,connectionMode:q,connectionLineType:z=lo.Bezier,connectionLineStyle:$,connectionLineComponent:Q,connectionLineContainerStyle:te,deleteKeyCode:ie="Backspace",selectionKeyCode:he="Shift",selectionOnDrag:ne=!1,selectionMode:ce=Ru.Full,panActivationKeyCode:re="Space",multiSelectionKeyCode:le=$u()?"Meta":"Control",zoomActivationKeyCode:ue=$u()?"Meta":"Control",snapToGrid:Se,snapGrid:De,onlyRenderVisibleElements:Ye=!1,selectNodesOnDrag:Ie,nodesDraggable:Je,autoPanOnNodeFocus:Et,nodesConnectable:bt,nodesFocusable:Pe,nodeOrigin:rt=cA,edgesFocusable:At,edgesReconnectable:zt,elementsSelectable:Kt=!0,defaultViewport:tt=W3,minZoom:oe=.5,maxZoom:be=2,translateExtent:ke=Tu,preventScrolling:st=!0,nodeExtent:Ze,defaultMarkerColor:kt="#b1b1b7",zoomOnScroll:Bt=!0,zoomOnPinch:Gt=!0,panOnScroll:Z=!1,panOnScrollSpeed:xe=.5,panOnScrollMode:$e=oa.Free,zoomOnDoubleClick:Ee=!0,panOnDrag:ut=!0,onPaneClick:St,onPaneMouseEnter:ir,onPaneMouseMove:Er,onPaneMouseLeave:Xn,onPaneScroll:hn,onPaneContextMenu:Cn,paneClickDistance:_n=1,nodeClickDistance:mr=0,children:En,onReconnect:Dn,onReconnectStart:Qn,onReconnectEnd:Hr,onEdgeContextMenu:gr,onEdgeDoubleClick:An,onEdgeMouseEnter:ss,onEdgeMouseMove:or,onEdgeMouseLeave:Ar,reconnectRadius:Fn=10,onNodesChange:mn,onEdgesChange:vn,noDragClassName:zn="nodrag",noWheelClassName:Pr="nowheel",noPanClassName:Jt="nopan",fitView:se,fitViewOptions:Ne,connectOnClick:et,attributionPosition:mt,proOptions:sn,defaultEdgeOptions:gn,elevateNodesOnSelect:Rn=!0,elevateEdgesOnSelect:yr=!1,disableKeyboardA11y:ot=!1,autoPanOnConnect:jt,autoPanOnNodeDrag:gt,autoPanSpeed:Bn,connectionRadius:we,isValidConnection:Xt,onError:di,style:Bi,id:ar,nodeDragThreshold:ee,connectionDragThreshold:je,viewport:Le,onViewportChange:Ht,width:me,height:Sn,colorMode:Wr="light",debug:Zn,onScroll:is,ariaLabelConfig:xr,zIndexMode:U="basic",...fe},Te){const Ae=ar||"1",Xe=q3(Wr),Qt=m.useCallback(Pt=>{Pt.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),is==null||is(Pt)},[is]);return o.jsx("div",{"data-testid":"rf__wrapper",...fe,onScroll:Qt,style:{...Bi,...f5},ref:Te,className:On(["react-flow",s,Xe]),id:ar,role:"application",children:o.jsxs(d5,{nodes:e,edges:t,width:me,height:Sn,fitView:se,fitViewOptions:Ne,minZoom:oe,maxZoom:be,nodeOrigin:rt,nodeExtent:Ze,zIndexMode:U,children:[o.jsx(U3,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:y,onConnectEnd:w,onClickConnectStart:b,onClickConnectEnd:g,nodesDraggable:Je,autoPanOnNodeFocus:Et,nodesConnectable:bt,nodesFocusable:Pe,edgesFocusable:At,edgesReconnectable:zt,elementsSelectable:Kt,elevateNodesOnSelect:Rn,elevateEdgesOnSelect:yr,minZoom:oe,maxZoom:be,nodeExtent:Ze,onNodesChange:mn,onEdgesChange:vn,snapToGrid:Se,snapGrid:De,connectionMode:q,translateExtent:ke,connectOnClick:et,defaultEdgeOptions:gn,fitView:se,fitViewOptions:Ne,onNodesDelete:W,onEdgesDelete:H,onDelete:D,onNodeDragStart:E,onNodeDrag:A,onNodeDragStop:O,onSelectionDrag:V,onSelectionDragStart:T,onSelectionDragStop:F,onMove:p,onMoveStart:f,onMoveEnd:d,noPanClassName:Jt,nodeOrigin:rt,rfId:Ae,autoPanOnConnect:jt,autoPanOnNodeDrag:gt,autoPanSpeed:Bn,onError:di,connectionRadius:we,isValidConnection:Xt,selectNodesOnDrag:Ie,nodeDragThreshold:ee,connectionDragThreshold:je,onBeforeDelete:_,debug:Zn,ariaLabelConfig:xr,zIndexMode:U}),o.jsx(c5,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:k,onNodeMouseMove:x,onNodeMouseLeave:S,onNodeContextMenu:C,onNodeDoubleClick:j,nodeTypes:i,edgeTypes:a,connectionLineType:z,connectionLineStyle:$,connectionLineComponent:Q,connectionLineContainerStyle:te,selectionKeyCode:he,selectionOnDrag:ne,selectionMode:ce,deleteKeyCode:ie,multiSelectionKeyCode:le,panActivationKeyCode:re,zoomActivationKeyCode:ue,onlyRenderVisibleElements:Ye,defaultViewport:tt,translateExtent:ke,minZoom:oe,maxZoom:be,preventScrolling:st,zoomOnScroll:Bt,zoomOnPinch:Gt,zoomOnDoubleClick:Ee,panOnScroll:Z,panOnScrollSpeed:xe,panOnScrollMode:$e,panOnDrag:ut,onPaneClick:St,onPaneMouseEnter:ir,onPaneMouseMove:Er,onPaneMouseLeave:Xn,onPaneScroll:hn,onPaneContextMenu:Cn,paneClickDistance:_n,nodeClickDistance:mr,onSelectionContextMenu:M,onSelectionStart:I,onSelectionEnd:B,onReconnect:Dn,onReconnectStart:Qn,onReconnectEnd:Hr,onEdgeContextMenu:gr,onEdgeDoubleClick:An,onEdgeMouseEnter:ss,onEdgeMouseMove:or,onEdgeMouseLeave:Ar,reconnectRadius:Fn,defaultMarkerColor:kt,noDragClassName:zn,noWheelClassName:Pr,noPanClassName:Jt,rfId:Ae,disableKeyboardA11y:ot,nodeExtent:Ze,viewport:Le,onViewportChange:Ht}),o.jsx(H3,{onSelectionChange:R}),En,o.jsx(O3,{proOptions:sn,position:mt}),o.jsx(L3,{rfId:Ae,disableKeyboardA11y:ot})]})})}var $A=dA(p5);function h5(){const e=un();return m.useCallback(t=>{const{domNode:n,updateNodeInternals:r}=e.getState(),s=Array.isArray(t)?t:[t],i=new Map;s.forEach(a=>{const l=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${a}"]`);l&&i.set(a,{id:a,nodeElement:l,force:!0})}),requestAnimationFrame(()=>r(i,{triggerFitView:!1}))},[])}function m5(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(i=>Op(s,i)),[]);return[t,n,r]}function g5(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(i=>qw(s,i)),[]);return[t,n,r]}function y5({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:On(["react-flow__background-pattern",n,r])})}function x5({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:On(["react-flow__background-pattern","dots",t])})}var vo;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(vo||(vo={}));const w5={[vo.Dots]:1,[vo.Lines]:1,[vo.Cross]:6},b5=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function LA({id:e,variant:t=vo.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:a,bgColor:l,style:c,className:u,patternClassName:p}){const f=m.useRef(null),{transform:d,patternId:h}=Rt(b5,pn),y=r||w5[t],w=t===vo.Dots,b=t===vo.Cross,g=Array.isArray(n)?n:[n,n],k=[g[0]*d[2]||1,g[1]*d[2]||1],x=y*d[2],S=Array.isArray(i)?i:[i,i],C=b?[x,x]:k,j=[S[0]*d[2]||1+C[0]/2,S[1]*d[2]||1+C[1]/2],E=`${h}${e||""}`;return o.jsxs("svg",{className:On(["react-flow__background",u]),style:{...c,...Th,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[o.jsx("pattern",{id:E,x:d[0]%k[0],y:d[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${j[0]},-${j[1]})`,children:w?o.jsx(x5,{radius:x/2,className:p}):o.jsx(y5,{dimensions:C,lineWidth:s,variant:t,className:p})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${E})`})]})}LA.displayName="Background";const OA=m.memo(LA);function k5(){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 v5(){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 S5(){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 N5(){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 j5(){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 pf({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:On(["react-flow__controls-button",t]),...n,children:e})}const C5=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function DA({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:u,children:p,position:f="bottom-left",orientation:d="vertical","aria-label":h}){const y=un(),{isInteractive:w,minZoomReached:b,maxZoomReached:g,ariaLabelConfig:k}=Rt(C5,pn),{zoomIn:x,zoomOut:S,fitView:C}=Yl(),j=()=>{x(),i==null||i()},E=()=>{S(),a==null||a()},A=()=>{C(s),l==null||l()},O=()=>{y.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),c==null||c(!w)},W=d==="horizontal"?"horizontal":"vertical";return o.jsxs(Ih,{className:On(["react-flow__controls",W,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":h??k["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(pf,{onClick:j,className:"react-flow__controls-zoomin",title:k["controls.zoomIn.ariaLabel"],"aria-label":k["controls.zoomIn.ariaLabel"],disabled:g,children:o.jsx(k5,{})}),o.jsx(pf,{onClick:E,className:"react-flow__controls-zoomout",title:k["controls.zoomOut.ariaLabel"],"aria-label":k["controls.zoomOut.ariaLabel"],disabled:b,children:o.jsx(v5,{})})]}),n&&o.jsx(pf,{className:"react-flow__controls-fitview",onClick:A,title:k["controls.fitView.ariaLabel"],"aria-label":k["controls.fitView.ariaLabel"],children:o.jsx(S5,{})}),r&&o.jsx(pf,{className:"react-flow__controls-interactive",onClick:O,title:k["controls.interactive.ariaLabel"],"aria-label":k["controls.interactive.ariaLabel"],children:w?o.jsx(j5,{}):o.jsx(N5,{})}),p]})}DA.displayName="Controls";m.memo(DA);function _5({id:e,x:t,y:n,width:r,height:s,style:i,color:a,strokeColor:l,strokeWidth:c,className:u,borderRadius:p,shapeRendering:f,selected:d,onClick:h}){const{background:y,backgroundColor:w}=i||{},b=a||y||w;return o.jsx("rect",{className:On(["react-flow__minimap-node",{selected:d},u]),x:t,y:n,rx:p,ry:p,width:r,height:s,style:{fill:b,stroke:l,strokeWidth:c},shapeRendering:f,onClick:h?g=>h(g,e):void 0})}const E5=m.memo(_5),A5=e=>e.nodes.map(t=>t.id),sg=e=>e instanceof Function?e:()=>e;function P5({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=E5,onClick:a}){const l=Rt(A5,pn),c=sg(t),u=sg(e),p=sg(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(d=>o.jsx(T5,{id:d,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:p,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:a,shapeRendering:f},d))})}function I5({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:u,x:p,y:f,width:d,height:h}=Rt(y=>{const w=y.nodeLookup.get(e);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const b=w.internals.userNode,{x:g,y:k}=w.internals.positionAbsolute,{width:x,height:S}=Di(b);return{node:b,x:g,y:k,width:x,height:S}},pn);return!u||u.hidden||!ME(u)?null:o.jsx(l,{x:p,y:f,width:d,height:h,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:i,shapeRendering:a,onClick:c,id:u.id})}const T5=m.memo(I5);var R5=m.memo(P5);const M5=200,$5=150,L5=e=>!e.hidden,O5=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?RE(sd(e.nodeLookup,{filter:L5}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},D5="react-flow__minimap-desc";function FA({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:p,maskStrokeWidth:f,position:d="bottom-right",onClick:h,onNodeClick:y,pannable:w=!1,zoomable:b=!1,ariaLabel:g,inversePan:k,zoomStep:x=1,offsetScale:S=5}){const C=un(),j=m.useRef(null),{boundingRect:E,viewBB:A,rfId:O,panZoom:W,translateExtent:H,flowWidth:D,flowHeight:R,ariaLabelConfig:T}=Rt(O5,pn),V=(e==null?void 0:e.width)??M5,F=(e==null?void 0:e.height)??$5,M=E.width/V,I=E.height/F,B=Math.max(M,I),_=B*V,q=B*F,z=S*B,$=E.x-(_-E.width)/2-z,Q=E.y-(q-E.height)/2-z,te=_+z*2,ie=q+z*2,he=`${D5}-${O}`,ne=m.useRef(0),ce=m.useRef();ne.current=B,m.useEffect(()=>{if(j.current&&W)return ce.current=Vz({domNode:j.current,panZoom:W,getTransform:()=>C.getState().transform,getViewScale:()=>ne.current}),()=>{var Se;(Se=ce.current)==null||Se.destroy()}},[W]),m.useEffect(()=>{var Se;(Se=ce.current)==null||Se.update({translateExtent:H,width:D,height:R,inversePan:k,pannable:w,zoomStep:x,zoomable:b})},[w,b,k,x,H,D,R]);const re=h?Se=>{var Ie;const[De,Ye]=((Ie=ce.current)==null?void 0:Ie.pointer(Se))||[0,0];h(Se,{x:De,y:Ye})}:void 0,le=y?m.useCallback((Se,De)=>{const Ye=C.getState().nodeLookup.get(De).internals.userNode;y(Se,Ye)},[]):void 0,ue=g??T["minimap.ariaLabel"];return o.jsx(Ih,{position:d,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof f=="number"?f*B: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:On(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:V,height:F,viewBox:`${$} ${Q} ${te} ${ie}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":he,ref:j,onClick:re,children:[ue&&o.jsx("title",{id:he,children:ue}),o.jsx(R5,{onClick:le,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${$-z},${Q-z}h${te+z*2}v${ie+z*2}h${-te-z*2}z
|
|
66
|
-
M${A.x},${A.y}h${A.width}v${A.height}h${-A.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}FA.displayName="MiniMap";m.memo(FA);const F5=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,z5={[zl.Line]:"right",[zl.Handle]:"bottom-right"};function B5({nodeId:e,position:t,variant:n=zl.Handle,className:r,style:s=void 0,children:i,color:a,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:f=!1,resizeDirection:d,autoScale:h=!0,shouldResize:y,onResizeStart:w,onResize:b,onResizeEnd:g}){const k=mA(),x=typeof e=="string"?e:k,S=un(),C=m.useRef(null),j=n===zl.Handle,E=Rt(m.useCallback(F5(j&&h),[j,h]),pn),A=m.useRef(null),O=t??z5[n];m.useEffect(()=>{if(!(!C.current||!x))return A.current||(A.current=s3({domNode:C.current,nodeId:x,getStoreItems:()=>{const{nodeLookup:H,transform:D,snapGrid:R,snapToGrid:T,nodeOrigin:V,domNode:F}=S.getState();return{nodeLookup:H,transform:D,snapGrid:R,snapToGrid:T,nodeOrigin:V,paneDomNode:F}},onChange:(H,D)=>{const{triggerNodeChanges:R,nodeLookup:T,parentLookup:V,nodeOrigin:F}=S.getState(),M=[],I={x:H.x,y:H.y},B=T.get(x);if(B&&B.expandParent&&B.parentId){const _=B.origin??F,q=H.width??B.measured.width??0,z=H.height??B.measured.height??0,$={id:B.id,parentId:B.parentId,rect:{width:q,height:z,...$E({x:H.x??B.position.x,y:H.y??B.position.y},{width:q,height:z},B.parentId,T,_)}},Q=Uw([$],T,V,F);M.push(...Q),I.x=H.x?Math.max(_[0]*q,H.x):void 0,I.y=H.y?Math.max(_[1]*z,H.y):void 0}if(I.x!==void 0&&I.y!==void 0){const _={id:x,type:"position",position:{...I}};M.push(_)}if(H.width!==void 0&&H.height!==void 0){const q={id:x,type:"dimensions",resizing:!0,setAttributes:d?d==="horizontal"?"width":"height":!0,dimensions:{width:H.width,height:H.height}};M.push(q)}for(const _ of D){const q={..._,type:"position"};M.push(q)}R(M)},onEnd:({width:H,height:D})=>{const R={id:x,type:"dimensions",resizing:!1,dimensions:{width:H,height:D}};S.getState().triggerNodeChanges([R])}})),A.current.update({controlPosition:O,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:p},keepAspectRatio:f,resizeDirection:d,onResizeStart:w,onResize:b,onResizeEnd:g,shouldResize:y}),()=>{var H;(H=A.current)==null||H.destroy()}},[O,l,c,u,p,f,w,b,g,y]);const W=O.split("-");return o.jsx("div",{className:On(["react-flow__resize-control","nodrag",...W,n,r]),ref:C,style:{...s,scale:E,...a&&{[j?"backgroundColor":"borderColor"]:a}},children:i})}const Jw=m.memo(B5),H5="modulepreload",W5=function(e){return"/"+e},FS={},V5=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=W5(c),c in FS)return;FS[c]=!0;const u=c.endsWith(".css"),p=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${p}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":H5,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((d,h)=>{f.addEventListener("load",d),f.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return s.then(a=>{for(const l of a||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};function K5(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const U5=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,q5=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Y5={};function zS(e,t){return(Y5.jsx?q5:U5).test(e)}const G5=/[ \t\n\f\r]/g;function J5(e){return typeof e=="object"?e.type==="text"?BS(e.value):!1:BS(e)}function BS(e){return e.replace(G5,"")===""}class ad{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}ad.prototype.normal={};ad.prototype.property={};ad.prototype.space=void 0;function zA(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new ad(n,r,t)}function nx(e){return e.toLowerCase()}class Br{constructor(t,n){this.attribute=n,this.property=t}}Br.prototype.attribute="";Br.prototype.booleanish=!1;Br.prototype.boolean=!1;Br.prototype.commaOrSpaceSeparated=!1;Br.prototype.commaSeparated=!1;Br.prototype.defined=!1;Br.prototype.mustUseProperty=!1;Br.prototype.number=!1;Br.prototype.overloadedBoolean=!1;Br.prototype.property="";Br.prototype.spaceSeparated=!1;Br.prototype.space=void 0;let X5=0;const xt=_a(),Mn=_a(),rx=_a(),_e=_a(),tn=_a(),vl=_a(),Ur=_a();function _a(){return 2**++X5}const sx=Object.freeze(Object.defineProperty({__proto__:null,boolean:xt,booleanish:Mn,commaOrSpaceSeparated:Ur,commaSeparated:vl,number:_e,overloadedBoolean:rx,spaceSeparated:tn},Symbol.toStringTag,{value:"Module"})),ig=Object.keys(sx);class Xw extends Br{constructor(t,n,r,s){let i=-1;if(super(t,n),HS(this,"space",s),typeof r=="number")for(;++i<ig.length;){const a=ig[i];HS(this,ig[i],(r&sx[a])===sx[a])}}}Xw.prototype.defined=!0;function HS(e,t,n){n&&(e[t]=n)}function Gl(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new Xw(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[nx(r)]=r,n[nx(i.attribute)]=r}return new ad(t,n,e.space)}const BA=Gl({properties:{ariaActiveDescendant:null,ariaAtomic:Mn,ariaAutoComplete:null,ariaBusy:Mn,ariaChecked:Mn,ariaColCount:_e,ariaColIndex:_e,ariaColSpan:_e,ariaControls:tn,ariaCurrent:null,ariaDescribedBy:tn,ariaDetails:null,ariaDisabled:Mn,ariaDropEffect:tn,ariaErrorMessage:null,ariaExpanded:Mn,ariaFlowTo:tn,ariaGrabbed:Mn,ariaHasPopup:null,ariaHidden:Mn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:tn,ariaLevel:_e,ariaLive:null,ariaModal:Mn,ariaMultiLine:Mn,ariaMultiSelectable:Mn,ariaOrientation:null,ariaOwns:tn,ariaPlaceholder:null,ariaPosInSet:_e,ariaPressed:Mn,ariaReadOnly:Mn,ariaRelevant:null,ariaRequired:Mn,ariaRoleDescription:tn,ariaRowCount:_e,ariaRowIndex:_e,ariaRowSpan:_e,ariaSelected:Mn,ariaSetSize:_e,ariaSort:null,ariaValueMax:_e,ariaValueMin:_e,ariaValueNow:_e,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function HA(e,t){return t in e?e[t]:t}function WA(e,t){return HA(e,t.toLowerCase())}const Q5=Gl({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:vl,acceptCharset:tn,accessKey:tn,action:null,allow:null,allowFullScreen:xt,allowPaymentRequest:xt,allowUserMedia:xt,alt:null,as:null,async:xt,autoCapitalize:null,autoComplete:tn,autoFocus:xt,autoPlay:xt,blocking:tn,capture:null,charSet:null,checked:xt,cite:null,className:tn,cols:_e,colSpan:null,content:null,contentEditable:Mn,controls:xt,controlsList:tn,coords:_e|vl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:xt,defer:xt,dir:null,dirName:null,disabled:xt,download:rx,draggable:Mn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:xt,formTarget:null,headers:tn,height:_e,hidden:rx,high:_e,href:null,hrefLang:null,htmlFor:tn,httpEquiv:tn,id:null,imageSizes:null,imageSrcSet:null,inert:xt,inputMode:null,integrity:null,is:null,isMap:xt,itemId:null,itemProp:tn,itemRef:tn,itemScope:xt,itemType:tn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:xt,low:_e,manifest:null,max:null,maxLength:_e,media:null,method:null,min:null,minLength:_e,multiple:xt,muted:xt,name:null,nonce:null,noModule:xt,noValidate:xt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:xt,optimum:_e,pattern:null,ping:tn,placeholder:null,playsInline:xt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:xt,referrerPolicy:null,rel:tn,required:xt,reversed:xt,rows:_e,rowSpan:_e,sandbox:tn,scope:null,scoped:xt,seamless:xt,selected:xt,shadowRootClonable:xt,shadowRootDelegatesFocus:xt,shadowRootMode:null,shape:null,size:_e,sizes:null,slot:null,span:_e,spellCheck:Mn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:_e,step:null,style:null,tabIndex:_e,target:null,title:null,translate:null,type:null,typeMustMatch:xt,useMap:null,value:Mn,width:_e,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:tn,axis:null,background:null,bgColor:null,border:_e,borderColor:null,bottomMargin:_e,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:xt,declare:xt,event:null,face:null,frame:null,frameBorder:null,hSpace:_e,leftMargin:_e,link:null,longDesc:null,lowSrc:null,marginHeight:_e,marginWidth:_e,noResize:xt,noHref:xt,noShade:xt,noWrap:xt,object:null,profile:null,prompt:null,rev:null,rightMargin:_e,rules:null,scheme:null,scrolling:Mn,standby:null,summary:null,text:null,topMargin:_e,valueType:null,version:null,vAlign:null,vLink:null,vSpace:_e,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:xt,disableRemotePlayback:xt,prefix:null,property:null,results:_e,security:null,unselectable:null},space:"html",transform:WA}),Z5=Gl({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:Ur,accentHeight:_e,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:_e,amplitude:_e,arabicForm:null,ascent:_e,attributeName:null,attributeType:null,azimuth:_e,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:_e,by:null,calcMode:null,capHeight:_e,className:tn,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:_e,diffuseConstant:_e,direction:null,display:null,dur:null,divisor:_e,dominantBaseline:null,download:xt,dx:null,dy:null,edgeMode:null,editable:null,elevation:_e,enableBackground:null,end:null,event:null,exponent:_e,externalResourcesRequired:null,fill:null,fillOpacity:_e,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:vl,g2:vl,glyphName:vl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:_e,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:_e,horizOriginX:_e,horizOriginY:_e,id:null,ideographic:_e,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:_e,k:_e,k1:_e,k2:_e,k3:_e,k4:_e,kernelMatrix:Ur,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:_e,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:_e,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:_e,overlineThickness:_e,paintOrder:null,panose1:null,path:null,pathLength:_e,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:tn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:_e,pointsAtY:_e,pointsAtZ:_e,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ur,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ur,rev:Ur,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ur,requiredFeatures:Ur,requiredFonts:Ur,requiredFormats:Ur,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:_e,specularExponent:_e,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:_e,strikethroughThickness:_e,string:null,stroke:null,strokeDashArray:Ur,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:_e,strokeOpacity:_e,strokeWidth:null,style:null,surfaceScale:_e,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ur,tabIndex:_e,tableValues:null,target:null,targetX:_e,targetY:_e,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ur,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:_e,underlineThickness:_e,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:_e,values:null,vAlphabetic:_e,vMathematical:_e,vectorEffect:null,vHanging:_e,vIdeographic:_e,version:null,vertAdvY:_e,vertOriginX:_e,vertOriginY:_e,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:_e,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:HA}),VA=Gl({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()}}),KA=Gl({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:WA}),UA=Gl({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),eB={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"},tB=/[A-Z]/g,WS=/-[a-z]/g,nB=/^data[-\w.:]+$/i;function rB(e,t){const n=nx(t);let r=t,s=Br;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&nB.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(WS,iB);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!WS.test(i)){let a=i.replace(tB,sB);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=Xw}return new s(r,t)}function sB(e){return"-"+e.toLowerCase()}function iB(e){return e.charAt(1).toUpperCase()}const oB=zA([BA,Q5,VA,KA,UA],"html"),Qw=zA([BA,Z5,VA,KA,UA],"svg");function aB(e){return e.join(" ").trim()}var Zw={},VS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,lB=/\n/g,cB=/^\s*/,uB=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,dB=/^:\s*/,fB=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,pB=/^[;\s]*/,hB=/^\s+|\s+$/g,mB=`
|
|
67
|
-
`,KS="/",US="*",Yo="",gB="comment",yB="declaration";function xB(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(y){var w=y.match(lB);w&&(n+=w.length);var b=y.lastIndexOf(mB);r=~b?y.length-b:r+y.length}function i(){var y={line:n,column:r};return function(w){return w.position=new a(y),u(),w}}function a(y){this.start=y,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function l(y){var w=new Error(t.source+":"+n+":"+r+": "+y);if(w.reason=y,w.filename=t.source,w.line=n,w.column=r,w.source=e,!t.silent)throw w}function c(y){var w=y.exec(e);if(w){var b=w[0];return s(b),e=e.slice(b.length),w}}function u(){c(cB)}function p(y){var w;for(y=y||[];w=f();)w!==!1&&y.push(w);return y}function f(){var y=i();if(!(KS!=e.charAt(0)||US!=e.charAt(1))){for(var w=2;Yo!=e.charAt(w)&&(US!=e.charAt(w)||KS!=e.charAt(w+1));)++w;if(w+=2,Yo===e.charAt(w-1))return l("End of comment missing");var b=e.slice(2,w-2);return r+=2,s(b),e=e.slice(w),r+=2,y({type:gB,comment:b})}}function d(){var y=i(),w=c(uB);if(w){if(f(),!c(dB))return l("property missing ':'");var b=c(fB),g=y({type:yB,property:qS(w[0].replace(VS,Yo)),value:b?qS(b[0].replace(VS,Yo)):Yo});return c(pB),g}}function h(){var y=[];p(y);for(var w;w=d();)w!==!1&&(y.push(w),p(y));return y}return u(),h()}function qS(e){return e?e.replace(hB,Yo):Yo}var wB=xB,bB=uu&&uu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zw,"__esModule",{value:!0});Zw.default=vB;const kB=bB(wB);function vB(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,kB.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 Mh={};Object.defineProperty(Mh,"__esModule",{value:!0});Mh.camelCase=void 0;var SB=/^--[a-zA-Z0-9_-]+$/,NB=/-([a-z])/g,jB=/^[^-]+$/,CB=/^-(webkit|moz|ms|o|khtml)-/,_B=/^-(ms)-/,EB=function(e){return!e||jB.test(e)||SB.test(e)},AB=function(e,t){return t.toUpperCase()},YS=function(e,t){return"".concat(t,"-")},PB=function(e,t){return t===void 0&&(t={}),EB(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(_B,YS):e=e.replace(CB,YS),e.replace(NB,AB))};Mh.camelCase=PB;var IB=uu&&uu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},TB=IB(Zw),RB=Mh;function ix(e,t){var n={};return!e||typeof e!="string"||(0,TB.default)(e,function(r,s){r&&s&&(n[(0,RB.camelCase)(r,t)]=s)}),n}ix.default=ix;var MB=ix;const $B=Po(MB),qA=YA("end"),eb=YA("start");function YA(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 LB(e){const t=eb(e),n=qA(e);if(t&&n)return{start:t,end:n}}function ru(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?GS(e.position):"start"in e||"end"in e?GS(e):"line"in e||"column"in e?ox(e):""}function ox(e){return JS(e&&e.line)+":"+JS(e&&e.column)}function GS(e){return ox(e&&e.start)+"-"+ox(e&&e.end)}function JS(e){return e&&typeof e=="number"?e:1}class hr 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=ru(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}}hr.prototype.file="";hr.prototype.name="";hr.prototype.reason="";hr.prototype.message="";hr.prototype.stack="";hr.prototype.column=void 0;hr.prototype.line=void 0;hr.prototype.ancestors=void 0;hr.prototype.cause=void 0;hr.prototype.fatal=void 0;hr.prototype.place=void 0;hr.prototype.ruleId=void 0;hr.prototype.source=void 0;const tb={}.hasOwnProperty,OB=new Map,DB=/[A-Z]/g,FB=new Set(["table","tbody","thead","tfoot","tr"]),zB=new Set(["td","th"]),GA="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function BB(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=GB(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=YB(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"?Qw:oB,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=JA(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function JA(e,t,n){if(t.type==="element")return HB(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return WB(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return KB(e,t,n);if(t.type==="mdxjsEsm")return VB(e,t);if(t.type==="root")return UB(e,t,n);if(t.type==="text")return qB(e,t)}function HB(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Qw,e.schema=s),e.ancestors.push(t);const i=QA(e,t.tagName,!1),a=JB(e,t);let l=rb(e,t);return FB.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!J5(c):!0})),XA(e,a,i,t),nb(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function WB(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Ou(e,t.position)}function VB(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Ou(e,t.position)}function KB(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Qw,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:QA(e,t.name,!0),a=XB(e,t),l=rb(e,t);return XA(e,a,i,t),nb(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function UB(e,t,n){const r={};return nb(r,rb(e,t)),e.create(t,e.Fragment,r,n)}function qB(e,t){return t.value}function XA(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function nb(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function YB(e,t,n){return r;function r(s,i,a,l){const u=Array.isArray(a.children)?n:t;return l?u(i,a,l):u(i,a)}}function GB(e,t){return n;function n(r,s,i,a){const l=Array.isArray(i.children),c=eb(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 JB(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&tb.call(t.properties,s)){const i=QB(e,s,t.properties[s]);if(i){const[a,l]=i;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&zB.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 XB(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 Ou(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 Ou(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function rb(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:OB;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 u=s.get(c)||0;a=c+"-"+u,s.set(c,u+1)}}const l=JA(e,i,a);l!==void 0&&n.push(l)}return n}function QB(e,t,n){const r=rB(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?K5(n):aB(n)),r.property==="style"){let s=typeof n=="object"?n:ZB(e,String(n));return e.stylePropertyNameCase==="css"&&(s=eH(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?eB[r.property]||r.property:r.attribute,n]}}function ZB(e,t){try{return $B(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new hr("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=GA+"#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=zS(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=zS(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return tb.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Ou(e)}function Ou(e,t){const n=new hr("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=GA+"#cannot-handle-mdx-estrees-without-createevaluater",n}function eH(e){const t={};let n;for(n in e)tb.call(e,n)&&(t[tH(n)]=e[n]);return t}function tH(e){let t=e.replace(DB,nH);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function nH(e){return"-"+e.toLowerCase()}const og={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"]},rH={};function sH(e,t){const n=rH,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return ZA(e,r,s)}function ZA(e,t,n){if(iH(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 XS(e.children,t,n)}return Array.isArray(e)?XS(e,t,n):""}function XS(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=ZA(e[s],t,n);return r.join("")}function iH(e){return!!(e&&typeof e=="object")}const QS=document.createElement("i");function sb(e){const t="&"+e+";";QS.innerHTML=t;const n=QS.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function ai(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 ps(e,t){return e.length>0?(ai(e,e.length,0,t),e):t}const ZS={}.hasOwnProperty;function oH(e){const t={};let n=-1;for(;++n<e.length;)aH(t,e[n]);return t}function aH(e,t){let n;for(n in t){const s=(ZS.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){ZS.call(s,a)||(s[a]=[]);const l=i[a];lH(s[a],Array.isArray(l)?l:l?[l]:[])}}}function lH(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);ai(e,0,0,r)}function eP(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 Sl(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Zs=Mo(/[A-Za-z]/),Xr=Mo(/[\dA-Za-z]/),cH=Mo(/[#-'*+\--9=?A-Z^-~]/);function ax(e){return e!==null&&(e<32||e===127)}const lx=Mo(/\d/),uH=Mo(/[\dA-Fa-f]/),dH=Mo(/[!-/:-@[-`{-~]/);function ft(e){return e!==null&&e<-2}function zr(e){return e!==null&&(e<0||e===32)}function Ft(e){return e===-2||e===-1||e===32}const fH=Mo(new RegExp("\\p{P}|\\p{S}","u")),pH=Mo(/\s/);function Mo(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Jl(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&Xr(e.charCodeAt(n+1))&&Xr(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 rn(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return Ft(c)?(e.enter(n),l(c)):t(c)}function l(c){return Ft(c)&&i++<s?(e.consume(c),l):(e.exit(n),t(c))}}const hH={tokenize:mH};function mH(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"),rn(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 ft(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),a)}}const gH={tokenize:yH},eN={tokenize:xH};function yH(e){const t=this,n=[];let r=0,s,i,a;return l;function l(x){if(r<n.length){const S=n[r];return t.containerState=S[1],e.attempt(S[0].continuation,c,u)(x)}return u(x)}function c(x){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&k();const S=t.events.length;let C=S,j;for(;C--;)if(t.events[C][0]==="exit"&&t.events[C][1].type==="chunkFlow"){j=t.events[C][1].end;break}g(r);let E=S;for(;E<t.events.length;)t.events[E][1].end={...j},E++;return ai(t.events,C+1,0,t.events.slice(S)),t.events.length=E,u(x)}return l(x)}function u(x){if(r===n.length){if(!s)return d(x);if(s.currentConstruct&&s.currentConstruct.concrete)return y(x);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(eN,p,f)(x)}function p(x){return s&&k(),g(r),d(x)}function f(x){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,y(x)}function d(x){return t.containerState={},e.attempt(eN,h,y)(x)}function h(x){return r++,n.push([t.currentConstruct,t.containerState]),d(x)}function y(x){if(x===null){s&&k(),g(0),e.consume(x);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),w(x)}function w(x){if(x===null){b(e.exit("chunkFlow"),!0),g(0),e.consume(x);return}return ft(x)?(e.consume(x),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(x),w)}function b(x,S){const C=t.sliceStream(x);if(S&&C.push(null),x.previous=i,i&&(i.next=x),i=x,s.defineSkip(x.start),s.write(C),t.parser.lazy[x.start.line]){let j=s.events.length;for(;j--;)if(s.events[j][1].start.offset<a&&(!s.events[j][1].end||s.events[j][1].end.offset>a))return;const E=t.events.length;let A=E,O,W;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){if(O){W=t.events[A][1].end;break}O=!0}for(g(r),j=E;j<t.events.length;)t.events[j][1].end={...W},j++;ai(t.events,A+1,0,t.events.slice(E)),t.events.length=j}}function g(x){let S=n.length;for(;S-- >x;){const C=n[S];t.containerState=C[1],C[0].exit.call(t,e)}n.length=x}function k(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function xH(e,t,n){return rn(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function tN(e){if(e===null||zr(e)||pH(e))return 1;if(fH(e))return 2}function ib(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 cx={name:"attention",resolveAll:wH,tokenize:bH};function wH(e,t){let n=-1,r,s,i,a,l,c,u,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const f={...e[r][1].end},d={...e[n][1].start};nN(f,-c),nN(d,c),a={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:d},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},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=ps(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=ps(u,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",i,t]]),u=ps(u,ib(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=ps(u,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,u=ps(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,ai(e,r-1,n-r+3,u),n=r+u.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function bH(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=tN(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 u=e.exit("attentionSequence"),p=tN(c),f=!p||p===2&&s||n.includes(c),d=!s||s===2&&p||n.includes(r);return u._open=!!(i===42?f:f&&(s||!d)),u._close=!!(i===42?d:d&&(p||!f)),t(c)}}function nN(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const kH={name:"autolink",tokenize:vH};function vH(e,t,n){let r=0;return s;function s(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(h){return Zs(h)?(e.consume(h),a):h===64?n(h):u(h)}function a(h){return h===43||h===45||h===46||Xr(h)?(r=1,l(h)):u(h)}function l(h){return h===58?(e.consume(h),r=0,c):(h===43||h===45||h===46||Xr(h))&&r++<32?(e.consume(h),l):(r=0,u(h))}function c(h){return h===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):h===null||h===32||h===60||ax(h)?n(h):(e.consume(h),c)}function u(h){return h===64?(e.consume(h),p):cH(h)?(e.consume(h),u):n(h)}function p(h){return Xr(h)?f(h):n(h)}function f(h){return h===46?(e.consume(h),r=0,p):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):d(h)}function d(h){if((h===45||Xr(h))&&r++<63){const y=h===45?d:f;return e.consume(h),y}return n(h)}}const $h={partial:!0,tokenize:SH};function SH(e,t,n){return r;function r(i){return Ft(i)?rn(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||ft(i)?t(i):n(i)}}const tP={continuation:{tokenize:jH},exit:CH,name:"blockQuote",tokenize:NH};function NH(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 Ft(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function jH(e,t,n){const r=this;return s;function s(a){return Ft(a)?rn(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(tP,t,n)(a)}}function CH(e){e.exit("blockQuote")}const nP={name:"characterEscape",tokenize:_H};function _H(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 dH(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const rP={name:"characterReference",tokenize:EH};function EH(e,t,n){const r=this;let s=0,i,a;return l;function l(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),c}function c(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,a=Xr,p(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,a=uH,p):(e.enter("characterReferenceValue"),i=7,a=lx,p(f))}function p(f){if(f===59&&s){const d=e.exit("characterReferenceValue");return a===Xr&&!sb(r.sliceSerialize(d))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(f)&&s++<i?(e.consume(f),p):n(f)}}const rN={partial:!0,tokenize:PH},sN={concrete:!0,name:"codeFenced",tokenize:AH};function AH(e,t,n){const r=this,s={partial:!0,tokenize:C};let i=0,a=0,l;return c;function c(j){return u(j)}function u(j){const E=r.events[r.events.length-1];return i=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,l=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(j)}function p(j){return j===l?(a++,e.consume(j),p):a<3?n(j):(e.exit("codeFencedFenceSequence"),Ft(j)?rn(e,f,"whitespace")(j):f(j))}function f(j){return j===null||ft(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(rN,w,S)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),d(j))}function d(j){return j===null||ft(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(j)):Ft(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),rn(e,h,"whitespace")(j)):j===96&&j===l?n(j):(e.consume(j),d)}function h(j){return j===null||ft(j)?f(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(j))}function y(j){return j===null||ft(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(j)):j===96&&j===l?n(j):(e.consume(j),y)}function w(j){return e.attempt(s,S,b)(j)}function b(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),g}function g(j){return i>0&&Ft(j)?rn(e,k,"linePrefix",i+1)(j):k(j)}function k(j){return j===null||ft(j)?e.check(rN,w,S)(j):(e.enter("codeFlowValue"),x(j))}function x(j){return j===null||ft(j)?(e.exit("codeFlowValue"),k(j)):(e.consume(j),x)}function S(j){return e.exit("codeFenced"),t(j)}function C(j,E,A){let O=0;return W;function W(V){return j.enter("lineEnding"),j.consume(V),j.exit("lineEnding"),H}function H(V){return j.enter("codeFencedFence"),Ft(V)?rn(j,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):D(V)}function D(V){return V===l?(j.enter("codeFencedFenceSequence"),R(V)):A(V)}function R(V){return V===l?(O++,j.consume(V),R):O>=a?(j.exit("codeFencedFenceSequence"),Ft(V)?rn(j,T,"whitespace")(V):T(V)):A(V)}function T(V){return V===null||ft(V)?(j.exit("codeFencedFence"),E(V)):A(V)}}}function PH(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 ag={name:"codeIndented",tokenize:TH},IH={partial:!0,tokenize:RH};function TH(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),rn(e,i,"linePrefix",5)(u)}function i(u){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?c(u):ft(u)?e.attempt(IH,a,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||ft(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function RH(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):ft(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):rn(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):ft(a)?s(a):n(a)}}const MH={name:"codeText",previous:LH,resolve:$H,tokenize:OH};function $H(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 LH(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function OH(e,t,n){let r=0,s,i;return a;function a(f){return e.enter("codeText"),e.enter("codeTextSequence"),l(f)}function l(f){return f===96?(e.consume(f),r++,l):(e.exit("codeTextSequence"),c(f))}function c(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),c):f===96?(i=e.enter("codeTextSequence"),s=0,p(f)):ft(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||ft(f)?(e.exit("codeTextData"),c(f)):(e.consume(f),u)}function p(f){return f===96?(e.consume(f),s++,p):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(i.type="codeTextData",u(f))}}class DH{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&&_c(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),_c(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),_c(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);_c(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);_c(this.left,n.reverse())}}}function _c(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 sP(e){const t={};let n=-1,r,s,i,a,l,c,u;const p=new DH(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(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,FH(p,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(a=p.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(p.get(s)[1].type="lineEndingBlank"),a[1].type="lineEnding",s=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;s&&(r[1].end={...p.get(s)[1].start},l=p.slice(s,n),l.unshift(r),p.splice(s,n-s+1,l))}}return ai(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!u}function FH(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=[],u={};let p,f,d=-1,h=n,y=0,w=0;const b=[w];for(;h;){for(;e.get(++s)[1]!==h;);i.push(s),h._tokenizer||(p=r.sliceStream(h),h.next||p.push(null),f&&a.defineSkip(h.start),h._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(p),h._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),f=h,h=h.next}for(h=n;++d<l.length;)l[d][0]==="exit"&&l[d-1][0]==="enter"&&l[d][1].type===l[d-1][1].type&&l[d][1].start.line!==l[d][1].end.line&&(w=d+1,b.push(w),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(a.events=[],h?(h._tokenizer=void 0,h.previous=void 0):b.pop(),d=b.length;d--;){const g=l.slice(b[d],b[d+1]),k=i.pop();c.push([k,k+g.length-1]),e.splice(k,2,g)}for(c.reverse(),d=-1;++d<c.length;)u[y+c[d][0]]=y+c[d][1],y+=c[d][1]-c[d][0]-1;return u}const zH={resolve:HH,tokenize:WH},BH={partial:!0,tokenize:VH};function HH(e){return sP(e),e}function WH(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?i(l):ft(l)?e.check(BH,a,i)(l):(e.consume(l),s)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function a(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function VH(e,t,n){const r=this;return s;function s(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),rn(e,i,"linePrefix")}function i(a){if(a===null||ft(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 iP(e,t,n,r,s,i,a,l,c){const u=c||Number.POSITIVE_INFINITY;let p=0;return f;function f(g){return g===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(g),e.exit(i),d):g===null||g===32||g===41||ax(g)?n(g):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),w(g))}function d(g){return g===62?(e.enter(i),e.consume(g),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===62?(e.exit("chunkString"),e.exit(l),d(g)):g===null||g===60||ft(g)?n(g):(e.consume(g),g===92?y:h)}function y(g){return g===60||g===62||g===92?(e.consume(g),h):h(g)}function w(g){return!p&&(g===null||g===41||zr(g))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(g)):p<u&&g===40?(e.consume(g),p++,w):g===41?(e.consume(g),p--,w):g===null||g===32||g===40||ax(g)?n(g):(e.consume(g),g===92?b:w)}function b(g){return g===40||g===41||g===92?(e.consume(g),w):w(g)}}function oP(e,t,n,r,s,i){const a=this;let l=0,c;return u;function u(h){return e.enter(r),e.enter(s),e.consume(h),e.exit(s),e.enter(i),p}function p(h){return l>999||h===null||h===91||h===93&&!c||h===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(h):h===93?(e.exit(i),e.enter(s),e.consume(h),e.exit(s),e.exit(r),t):ft(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||ft(h)||l++>999?(e.exit("chunkString"),p(h)):(e.consume(h),c||(c=!Ft(h)),h===92?d:f)}function d(h){return h===91||h===92||h===93?(e.consume(h),l++,f):f(h)}}function aP(e,t,n,r,s,i){let a;return l;function l(d){return d===34||d===39||d===40?(e.enter(r),e.enter(s),e.consume(d),e.exit(s),a=d===40?41:d,c):n(d)}function c(d){return d===a?(e.enter(s),e.consume(d),e.exit(s),e.exit(r),t):(e.enter(i),u(d))}function u(d){return d===a?(e.exit(i),c(a)):d===null?n(d):ft(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),rn(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(d))}function p(d){return d===a||d===null||ft(d)?(e.exit("chunkString"),u(d)):(e.consume(d),d===92?f:p)}function f(d){return d===a||d===92?(e.consume(d),p):p(d)}}function su(e,t){let n;return r;function r(s){return ft(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Ft(s)?rn(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const KH={name:"definition",tokenize:qH},UH={partial:!0,tokenize:YH};function qH(e,t,n){const r=this;let s;return i;function i(h){return e.enter("definition"),a(h)}function a(h){return oP.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function l(h){return s=Sl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),c):n(h)}function c(h){return zr(h)?su(e,u)(h):u(h)}function u(h){return iP(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function p(h){return e.attempt(UH,f,f)(h)}function f(h){return Ft(h)?rn(e,d,"whitespace")(h):d(h)}function d(h){return h===null||ft(h)?(e.exit("definition"),r.parser.defined.push(s),t(h)):n(h)}}function YH(e,t,n){return r;function r(l){return zr(l)?su(e,s)(l):n(l)}function s(l){return aP(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Ft(l)?rn(e,a,"whitespace")(l):a(l)}function a(l){return l===null||ft(l)?t(l):n(l)}}const GH={name:"hardBreakEscape",tokenize:JH};function JH(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return ft(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const XH={name:"headingAtx",resolve:QH,tokenize:ZH};function QH(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"},ai(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function ZH(e,t,n){let r=0;return s;function s(p){return e.enter("atxHeading"),i(p)}function i(p){return e.enter("atxHeadingSequence"),a(p)}function a(p){return p===35&&r++<6?(e.consume(p),a):p===null||zr(p)?(e.exit("atxHeadingSequence"),l(p)):n(p)}function l(p){return p===35?(e.enter("atxHeadingSequence"),c(p)):p===null||ft(p)?(e.exit("atxHeading"),t(p)):Ft(p)?rn(e,l,"whitespace")(p):(e.enter("atxHeadingText"),u(p))}function c(p){return p===35?(e.consume(p),c):(e.exit("atxHeadingSequence"),l(p))}function u(p){return p===null||p===35||zr(p)?(e.exit("atxHeadingText"),l(p)):(e.consume(p),u)}}const e6=["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"],iN=["pre","script","style","textarea"],t6={concrete:!0,name:"htmlFlow",resolveTo:s6,tokenize:i6},n6={partial:!0,tokenize:a6},r6={partial:!0,tokenize:o6};function s6(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 i6(e,t,n){const r=this;let s,i,a,l,c;return u;function u($){return p($)}function p($){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume($),f}function f($){return $===33?(e.consume($),d):$===47?(e.consume($),i=!0,w):$===63?(e.consume($),s=3,r.interrupt?t:_):Zs($)?(e.consume($),a=String.fromCharCode($),b):n($)}function d($){return $===45?(e.consume($),s=2,h):$===91?(e.consume($),s=5,l=0,y):Zs($)?(e.consume($),s=4,r.interrupt?t:_):n($)}function h($){return $===45?(e.consume($),r.interrupt?t:_):n($)}function y($){const Q="CDATA[";return $===Q.charCodeAt(l++)?(e.consume($),l===Q.length?r.interrupt?t:D:y):n($)}function w($){return Zs($)?(e.consume($),a=String.fromCharCode($),b):n($)}function b($){if($===null||$===47||$===62||zr($)){const Q=$===47,te=a.toLowerCase();return!Q&&!i&&iN.includes(te)?(s=1,r.interrupt?t($):D($)):e6.includes(a.toLowerCase())?(s=6,Q?(e.consume($),g):r.interrupt?t($):D($)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n($):i?k($):x($))}return $===45||Xr($)?(e.consume($),a+=String.fromCharCode($),b):n($)}function g($){return $===62?(e.consume($),r.interrupt?t:D):n($)}function k($){return Ft($)?(e.consume($),k):W($)}function x($){return $===47?(e.consume($),W):$===58||$===95||Zs($)?(e.consume($),S):Ft($)?(e.consume($),x):W($)}function S($){return $===45||$===46||$===58||$===95||Xr($)?(e.consume($),S):C($)}function C($){return $===61?(e.consume($),j):Ft($)?(e.consume($),C):x($)}function j($){return $===null||$===60||$===61||$===62||$===96?n($):$===34||$===39?(e.consume($),c=$,E):Ft($)?(e.consume($),j):A($)}function E($){return $===c?(e.consume($),c=null,O):$===null||ft($)?n($):(e.consume($),E)}function A($){return $===null||$===34||$===39||$===47||$===60||$===61||$===62||$===96||zr($)?C($):(e.consume($),A)}function O($){return $===47||$===62||Ft($)?x($):n($)}function W($){return $===62?(e.consume($),H):n($)}function H($){return $===null||ft($)?D($):Ft($)?(e.consume($),H):n($)}function D($){return $===45&&s===2?(e.consume($),F):$===60&&s===1?(e.consume($),M):$===62&&s===4?(e.consume($),q):$===63&&s===3?(e.consume($),_):$===93&&s===5?(e.consume($),B):ft($)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(n6,z,R)($)):$===null||ft($)?(e.exit("htmlFlowData"),R($)):(e.consume($),D)}function R($){return e.check(r6,T,z)($)}function T($){return e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),V}function V($){return $===null||ft($)?R($):(e.enter("htmlFlowData"),D($))}function F($){return $===45?(e.consume($),_):D($)}function M($){return $===47?(e.consume($),a="",I):D($)}function I($){if($===62){const Q=a.toLowerCase();return iN.includes(Q)?(e.consume($),q):D($)}return Zs($)&&a.length<8?(e.consume($),a+=String.fromCharCode($),I):D($)}function B($){return $===93?(e.consume($),_):D($)}function _($){return $===62?(e.consume($),q):$===45&&s===2?(e.consume($),_):D($)}function q($){return $===null||ft($)?(e.exit("htmlFlowData"),z($)):(e.consume($),q)}function z($){return e.exit("htmlFlow"),t($)}}function o6(e,t,n){const r=this;return s;function s(a){return ft(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 a6(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt($h,t,n)}}const l6={name:"htmlText",tokenize:c6};function c6(e,t,n){const r=this;let s,i,a;return l;function l(_){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(_),c}function c(_){return _===33?(e.consume(_),u):_===47?(e.consume(_),C):_===63?(e.consume(_),x):Zs(_)?(e.consume(_),A):n(_)}function u(_){return _===45?(e.consume(_),p):_===91?(e.consume(_),i=0,y):Zs(_)?(e.consume(_),k):n(_)}function p(_){return _===45?(e.consume(_),h):n(_)}function f(_){return _===null?n(_):_===45?(e.consume(_),d):ft(_)?(a=f,M(_)):(e.consume(_),f)}function d(_){return _===45?(e.consume(_),h):f(_)}function h(_){return _===62?F(_):_===45?d(_):f(_)}function y(_){const q="CDATA[";return _===q.charCodeAt(i++)?(e.consume(_),i===q.length?w:y):n(_)}function w(_){return _===null?n(_):_===93?(e.consume(_),b):ft(_)?(a=w,M(_)):(e.consume(_),w)}function b(_){return _===93?(e.consume(_),g):w(_)}function g(_){return _===62?F(_):_===93?(e.consume(_),g):w(_)}function k(_){return _===null||_===62?F(_):ft(_)?(a=k,M(_)):(e.consume(_),k)}function x(_){return _===null?n(_):_===63?(e.consume(_),S):ft(_)?(a=x,M(_)):(e.consume(_),x)}function S(_){return _===62?F(_):x(_)}function C(_){return Zs(_)?(e.consume(_),j):n(_)}function j(_){return _===45||Xr(_)?(e.consume(_),j):E(_)}function E(_){return ft(_)?(a=E,M(_)):Ft(_)?(e.consume(_),E):F(_)}function A(_){return _===45||Xr(_)?(e.consume(_),A):_===47||_===62||zr(_)?O(_):n(_)}function O(_){return _===47?(e.consume(_),F):_===58||_===95||Zs(_)?(e.consume(_),W):ft(_)?(a=O,M(_)):Ft(_)?(e.consume(_),O):F(_)}function W(_){return _===45||_===46||_===58||_===95||Xr(_)?(e.consume(_),W):H(_)}function H(_){return _===61?(e.consume(_),D):ft(_)?(a=H,M(_)):Ft(_)?(e.consume(_),H):O(_)}function D(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),s=_,R):ft(_)?(a=D,M(_)):Ft(_)?(e.consume(_),D):(e.consume(_),T)}function R(_){return _===s?(e.consume(_),s=void 0,V):_===null?n(_):ft(_)?(a=R,M(_)):(e.consume(_),R)}function T(_){return _===null||_===34||_===39||_===60||_===61||_===96?n(_):_===47||_===62||zr(_)?O(_):(e.consume(_),T)}function V(_){return _===47||_===62||zr(_)?O(_):n(_)}function F(_){return _===62?(e.consume(_),e.exit("htmlTextData"),e.exit("htmlText"),t):n(_)}function M(_){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),I}function I(_){return Ft(_)?rn(e,B,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):B(_)}function B(_){return e.enter("htmlTextData"),a(_)}}const ob={name:"labelEnd",resolveAll:p6,resolveTo:h6,tokenize:m6},u6={tokenize:g6},d6={tokenize:y6},f6={tokenize:x6};function p6(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&&ai(e,0,e.length,n),e}function h6(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}},u={type:"label",start:{...e[i][1].start},end:{...e[a][1].end}},p={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=ps(l,e.slice(i+1,i+r+3)),l=ps(l,[["enter",p,t]]),l=ps(l,ib(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),l=ps(l,[["exit",p,t],e[a-2],e[a-1],["exit",u,t]]),l=ps(l,e.slice(a+1)),l=ps(l,[["exit",c,t]]),ai(e,i,e.length,l),e}function m6(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(d){return i?i._inactive?f(d):(a=r.parser.defined.includes(Sl(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(d),e.exit("labelMarker"),e.exit("labelEnd"),c):n(d)}function c(d){return d===40?e.attempt(u6,p,a?p:f)(d):d===91?e.attempt(d6,p,a?u:f)(d):a?p(d):f(d)}function u(d){return e.attempt(f6,p,f)(d)}function p(d){return t(d)}function f(d){return i._balanced=!0,n(d)}}function g6(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),s}function s(f){return zr(f)?su(e,i)(f):i(f)}function i(f){return f===41?p(f):iP(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function a(f){return zr(f)?su(e,c)(f):p(f)}function l(f){return n(f)}function c(f){return f===34||f===39||f===40?aP(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):p(f)}function u(f){return zr(f)?su(e,p)(f):p(f)}function p(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function y6(e,t,n){const r=this;return s;function s(l){return oP.call(r,e,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(Sl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function x6(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 w6={name:"labelStartImage",resolveAll:ob.resolveAll,tokenize:b6};function b6(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 k6={name:"labelStartLink",resolveAll:ob.resolveAll,tokenize:v6};function v6(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 lg={name:"lineEnding",tokenize:S6};function S6(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),rn(e,t,"linePrefix")}}const Qf={name:"thematicBreak",tokenize:N6};function N6(e,t,n){let r=0,s;return i;function i(u){return e.enter("thematicBreak"),a(u)}function a(u){return s=u,l(u)}function l(u){return u===s?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||ft(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),Ft(u)?rn(e,l,"whitespace")(u):l(u))}}const Tr={continuation:{tokenize:E6},exit:P6,name:"list",tokenize:_6},j6={partial:!0,tokenize:I6},C6={partial:!0,tokenize:A6};function _6(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return l;function l(h){const y=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:lx(h)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(Qf,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(h)}return n(h)}function c(h){return lx(h)&&++a<10?(e.consume(h),c):(!r.interrupt||a<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):n(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check($h,r.interrupt?n:p,e.attempt(j6,d,f))}function p(h){return r.containerState.initialBlankLine=!0,i++,d(h)}function f(h){return Ft(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),d):n(h)}function d(h){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function E6(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check($h,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,rn(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Ft(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(C6,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,rn(e,e.attempt(Tr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function A6(e,t,n){const r=this;return rn(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 P6(e){e.exit(this.containerState.type)}function I6(e,t,n){const r=this;return rn(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!Ft(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const oN={name:"setextUnderline",resolveTo:T6,tokenize:R6};function T6(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 R6(e,t,n){const r=this;let s;return i;function i(u){let p=r.events.length,f;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){f=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),s=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===s?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),Ft(u)?rn(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||ft(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const M6={tokenize:$6};function $6(e){const t=this,n=e.attempt($h,r,e.attempt(this.parser.constructs.flowInitial,s,rn(e,e.attempt(this.parser.constructs.flow,s,e.attempt(zH,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 L6={resolveAll:cP()},O6=lP("string"),D6=lP("text");function lP(e){return{resolveAll:cP(e==="text"?F6:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,a,l);return a;function a(p){return u(p)?i(p):l(p)}function l(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),c}function c(p){return u(p)?(n.exit("data"),i(p)):(n.consume(p),c)}function u(p){if(p===null)return!0;const f=s[p];let d=-1;if(f)for(;++d<f.length;){const h=f[d];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function cP(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 F6(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 u=s[i];if(typeof u=="string"){for(a=u.length;u.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(u===-2)c=!0,l++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={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={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const z6={42:Tr,43:Tr,45:Tr,48:Tr,49:Tr,50:Tr,51:Tr,52:Tr,53:Tr,54:Tr,55:Tr,56:Tr,57:Tr,62:tP},B6={91:KH},H6={[-2]:ag,[-1]:ag,32:ag},W6={35:XH,42:Qf,45:[oN,Qf],60:t6,61:oN,95:Qf,96:sN,126:sN},V6={38:rP,92:nP},K6={[-5]:lg,[-4]:lg,[-3]:lg,33:w6,38:rP,42:cx,60:[kH,l6],91:k6,92:[GH,nP],93:ob,95:cx,96:MH},U6={null:[cx,L6]},q6={null:[42,95]},Y6={null:[]},G6=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:q6,contentInitial:B6,disable:Y6,document:z6,flow:W6,flowInitial:H6,insideSpan:U6,string:V6,text:K6},Symbol.toStringTag,{value:"Module"}));function J6(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:E(C),check:E(j),consume:k,enter:x,exit:S,interrupt:E(j,{interrupt:!0})},u={code:null,containerState:{},defineSkip:w,events:[],now:y,parser:e,previous:null,sliceSerialize:d,sliceStream:h,write:f};let p=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function f(H){return a=ps(a,H),b(),a[a.length-1]!==null?[]:(A(t,0),u.events=ib(i,u.events,u),u.events)}function d(H,D){return Q6(h(H),D)}function h(H){return X6(a,H)}function y(){const{_bufferIndex:H,_index:D,line:R,column:T,offset:V}=r;return{_bufferIndex:H,_index:D,line:R,column:T,offset:V}}function w(H){s[H.line]=H.column,W()}function b(){let H;for(;r._index<a.length;){const D=a[r._index];if(typeof D=="string")for(H=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===H&&r._bufferIndex<D.length;)g(D.charCodeAt(r._bufferIndex));else g(D)}}function g(H){p=p(H)}function k(H){ft(H)?(r.line++,r.column=1,r.offset+=H===-3?2:1,W()):H!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=H}function x(H,D){const R=D||{};return R.type=H,R.start=y(),u.events.push(["enter",R,u]),l.push(R),R}function S(H){const D=l.pop();return D.end=y(),u.events.push(["exit",D,u]),D}function C(H,D){A(H,D.from)}function j(H,D){D.restore()}function E(H,D){return R;function R(T,V,F){let M,I,B,_;return Array.isArray(T)?z(T):"tokenize"in T?z([T]):q(T);function q(ie){return he;function he(ne){const ce=ne!==null&&ie[ne],re=ne!==null&&ie.null,le=[...Array.isArray(ce)?ce:ce?[ce]:[],...Array.isArray(re)?re:re?[re]:[]];return z(le)(ne)}}function z(ie){return M=ie,I=0,ie.length===0?F:$(ie[I])}function $(ie){return he;function he(ne){return _=O(),B=ie,ie.partial||(u.currentConstruct=ie),ie.name&&u.parser.constructs.disable.null.includes(ie.name)?te():ie.tokenize.call(D?Object.assign(Object.create(u),D):u,c,Q,te)(ne)}}function Q(ie){return H(B,_),V}function te(ie){return _.restore(),++I<M.length?$(M[I]):F}}}function A(H,D){H.resolveAll&&!i.includes(H)&&i.push(H),H.resolve&&ai(u.events,D,u.events.length-D,H.resolve(u.events.slice(D),u)),H.resolveTo&&(u.events=H.resolveTo(u.events,u))}function O(){const H=y(),D=u.previous,R=u.currentConstruct,T=u.events.length,V=Array.from(l);return{from:T,restore:F};function F(){r=H,u.previous=D,u.currentConstruct=R,u.events.length=T,l=V,W()}}function W(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function X6(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 Q6(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 Z6(e){const r={constructs:oH([G6,...(e||{}).extensions||[]]),content:s(hH),defined:[],document:s(gH),flow:s(M6),lazy:{},string:s(O6),text:s(D6)};return r;function s(i){return a;function a(l){return J6(r,i,l)}}}function eW(e){for(;!sP(e););return e}const aN=/[\0\t\n\r]/g;function tW(){let e=1,t="",n=!0,r;return s;function s(i,a,l){const c=[];let u,p,f,d,h;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),f=0,t="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f<i.length;){if(aN.lastIndex=f,u=aN.exec(i),d=u&&u.index!==void 0?u.index:i.length,h=i.charCodeAt(d),!u){t=i.slice(f);break}if(h===10&&f===d&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),f<d&&(c.push(i.slice(f,d)),e+=d-f),h){case 0:{c.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,c.push(-2);e++<p;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}f=d+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const nW=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function rW(e){return e.replace(nW,sW)}function sW(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return eP(n.slice(i?2:1),i?16:10)}return sb(n)||e}const uP={}.hasOwnProperty;function iW(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),oW(n)(eW(Z6(n).document().write(tW()(e,t,!0))))}function oW(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(bt),autolinkProtocol:O,autolinkEmail:O,atxHeading:i(Ye),blockQuote:i(re),characterEscape:O,characterReference:O,codeFenced:i(le),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(le,a),codeText:i(ue,a),codeTextData:O,data:O,codeFlowValue:O,definition:i(Se),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(De),hardBreakEscape:i(Ie),hardBreakTrailing:i(Ie),htmlFlow:i(Je,a),htmlFlowData:O,htmlText:i(Je,a),htmlTextData:O,image:i(Et),label:a,link:i(bt),listItem:i(rt),listItemValue:d,listOrdered:i(Pe,f),listUnordered:i(Pe),paragraph:i(At),reference:$,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(Ye),strong:i(zt),thematicBreak:i(tt)},exit:{atxHeading:c(),atxHeadingSequence:C,autolink:c(),autolinkEmail:ce,autolinkProtocol:ne,blockQuote:c(),characterEscapeValue:W,characterReferenceMarkerHexadecimal:te,characterReferenceMarkerNumeric:te,characterReferenceValue:ie,characterReference:he,codeFenced:c(b),codeFencedFence:w,codeFencedFenceInfo:h,codeFencedFenceMeta:y,codeFlowValue:W,codeIndented:c(g),codeText:c(V),codeTextData:W,data:W,definition:c(),definitionDestinationString:S,definitionLabelString:k,definitionTitleString:x,emphasis:c(),hardBreakEscape:c(D),hardBreakTrailing:c(D),htmlFlow:c(R),htmlFlowData:W,htmlText:c(T),htmlTextData:W,image:c(M),label:B,labelText:I,lineEnding:H,link:c(F),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:Q,resourceDestinationString:_,resourceTitleString:q,resource:z,setextHeading:c(A),setextHeadingLineSequence:E,setextHeadingText:j,strong:c(),thematicBreak:c()}};dP(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(oe){let be={type:"root",children:[]};const ke={stack:[be],tokenStack:[],config:t,enter:l,exit:u,buffer:a,resume:p,data:n},st=[];let Ze=-1;for(;++Ze<oe.length;)if(oe[Ze][1].type==="listOrdered"||oe[Ze][1].type==="listUnordered")if(oe[Ze][0]==="enter")st.push(Ze);else{const kt=st.pop();Ze=s(oe,kt,Ze)}for(Ze=-1;++Ze<oe.length;){const kt=t[oe[Ze][0]];uP.call(kt,oe[Ze][1].type)&&kt[oe[Ze][1].type].call(Object.assign({sliceSerialize:oe[Ze][2].sliceSerialize},ke),oe[Ze][1])}if(ke.tokenStack.length>0){const kt=ke.tokenStack[ke.tokenStack.length-1];(kt[1]||lN).call(ke,void 0,kt[0])}for(be.position={start:no(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:no(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},Ze=-1;++Ze<t.transforms.length;)be=t.transforms[Ze](be)||be;return be}function s(oe,be,ke){let st=be-1,Ze=-1,kt=!1,Bt,Gt,Z,xe;for(;++st<=ke;){const $e=oe[st];switch($e[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{$e[0]==="enter"?Ze++:Ze--,xe=void 0;break}case"lineEndingBlank":{$e[0]==="enter"&&(Bt&&!xe&&!Ze&&!Z&&(Z=st),xe=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:xe=void 0}if(!Ze&&$e[0]==="enter"&&$e[1].type==="listItemPrefix"||Ze===-1&&$e[0]==="exit"&&($e[1].type==="listUnordered"||$e[1].type==="listOrdered")){if(Bt){let Ee=st;for(Gt=void 0;Ee--;){const ut=oe[Ee];if(ut[1].type==="lineEnding"||ut[1].type==="lineEndingBlank"){if(ut[0]==="exit")continue;Gt&&(oe[Gt][1].type="lineEndingBlank",kt=!0),ut[1].type="lineEnding",Gt=Ee}else if(!(ut[1].type==="linePrefix"||ut[1].type==="blockQuotePrefix"||ut[1].type==="blockQuotePrefixWhitespace"||ut[1].type==="blockQuoteMarker"||ut[1].type==="listItemIndent"))break}Z&&(!Gt||Z<Gt)&&(Bt._spread=!0),Bt.end=Object.assign({},Gt?oe[Gt][1].start:$e[1].end),oe.splice(Gt||st,0,["exit",Bt,$e[2]]),st++,ke++}if($e[1].type==="listItemPrefix"){const Ee={type:"listItem",_spread:!1,start:Object.assign({},$e[1].start),end:void 0};Bt=Ee,oe.splice(st,0,["enter",Ee,$e[2]]),st++,ke++,Z=void 0,xe=!0}}}return oe[be][1]._spread=kt,ke}function i(oe,be){return ke;function ke(st){l.call(this,oe(st),st),be&&be.call(this,st)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(oe,be,ke){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([be,ke||void 0]),oe.position={start:no(be.start),end:void 0}}function c(oe){return be;function be(ke){oe&&oe.call(this,ke),u.call(this,ke)}}function u(oe,be){const ke=this.stack.pop(),st=this.tokenStack.pop();if(st)st[0].type!==oe.type&&(be?be.call(this,oe,st[0]):(st[1]||lN).call(this,oe,st[0]));else throw new Error("Cannot close `"+oe.type+"` ("+ru({start:oe.start,end:oe.end})+"): it’s not open");ke.position.end=no(oe.end)}function p(){return sH(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function d(oe){if(this.data.expectingFirstListItemValue){const be=this.stack[this.stack.length-2];be.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function h(){const oe=this.resume(),be=this.stack[this.stack.length-1];be.lang=oe}function y(){const oe=this.resume(),be=this.stack[this.stack.length-1];be.meta=oe}function w(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const oe=this.resume(),be=this.stack[this.stack.length-1];be.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const oe=this.resume(),be=this.stack[this.stack.length-1];be.value=oe.replace(/(\r?\n|\r)$/g,"")}function k(oe){const be=this.resume(),ke=this.stack[this.stack.length-1];ke.label=be,ke.identifier=Sl(this.sliceSerialize(oe)).toLowerCase()}function x(){const oe=this.resume(),be=this.stack[this.stack.length-1];be.title=oe}function S(){const oe=this.resume(),be=this.stack[this.stack.length-1];be.url=oe}function C(oe){const be=this.stack[this.stack.length-1];if(!be.depth){const ke=this.sliceSerialize(oe).length;be.depth=ke}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function E(oe){const be=this.stack[this.stack.length-1];be.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function O(oe){const ke=this.stack[this.stack.length-1].children;let st=ke[ke.length-1];(!st||st.type!=="text")&&(st=Kt(),st.position={start:no(oe.start),end:void 0},ke.push(st)),this.stack.push(st)}function W(oe){const be=this.stack.pop();be.value+=this.sliceSerialize(oe),be.position.end=no(oe.end)}function H(oe){const be=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ke=be.children[be.children.length-1];ke.position.end=no(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(be.type)&&(O.call(this,oe),W.call(this,oe))}function D(){this.data.atHardBreak=!0}function R(){const oe=this.resume(),be=this.stack[this.stack.length-1];be.value=oe}function T(){const oe=this.resume(),be=this.stack[this.stack.length-1];be.value=oe}function V(){const oe=this.resume(),be=this.stack[this.stack.length-1];be.value=oe}function F(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=be,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function M(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const be=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=be,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function I(oe){const be=this.sliceSerialize(oe),ke=this.stack[this.stack.length-2];ke.label=rW(be),ke.identifier=Sl(be).toLowerCase()}function B(){const oe=this.stack[this.stack.length-1],be=this.resume(),ke=this.stack[this.stack.length-1];if(this.data.inReference=!0,ke.type==="link"){const st=oe.children;ke.children=st}else ke.alt=be}function _(){const oe=this.resume(),be=this.stack[this.stack.length-1];be.url=oe}function q(){const oe=this.resume(),be=this.stack[this.stack.length-1];be.title=oe}function z(){this.data.inReference=void 0}function $(){this.data.referenceType="collapsed"}function Q(oe){const be=this.resume(),ke=this.stack[this.stack.length-1];ke.label=be,ke.identifier=Sl(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function te(oe){this.data.characterReferenceType=oe.type}function ie(oe){const be=this.sliceSerialize(oe),ke=this.data.characterReferenceType;let st;ke?(st=eP(be,ke==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):st=sb(be);const Ze=this.stack[this.stack.length-1];Ze.value+=st}function he(oe){const be=this.stack.pop();be.position.end=no(oe.end)}function ne(oe){W.call(this,oe);const be=this.stack[this.stack.length-1];be.url=this.sliceSerialize(oe)}function ce(oe){W.call(this,oe);const be=this.stack[this.stack.length-1];be.url="mailto:"+this.sliceSerialize(oe)}function re(){return{type:"blockquote",children:[]}}function le(){return{type:"code",lang:null,meta:null,value:""}}function ue(){return{type:"inlineCode",value:""}}function Se(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function De(){return{type:"emphasis",children:[]}}function Ye(){return{type:"heading",depth:0,children:[]}}function Ie(){return{type:"break"}}function Je(){return{type:"html",value:""}}function Et(){return{type:"image",title:null,url:"",alt:null}}function bt(){return{type:"link",title:null,url:"",children:[]}}function Pe(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function rt(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function At(){return{type:"paragraph",children:[]}}function zt(){return{type:"strong",children:[]}}function Kt(){return{type:"text",value:""}}function tt(){return{type:"thematicBreak"}}}function no(e){return{line:e.line,column:e.column,offset:e.offset}}function dP(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?dP(e,r):aW(e,r)}}function aW(e,t){let n;for(n in t)if(uP.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 lN(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ru({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ru({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ru({start:t.start,end:t.end})+") is still open")}function lW(e){const t=this;t.parser=n;function n(r){return iW(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function cW(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 uW(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
70
|
-
`}]}function dW(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 fW(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function pW(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function hW(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Jl(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 u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function mW(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 gW(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function fP(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 yW(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return fP(e,t);const s={src:Jl(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 xW(e,t){const n={src:Jl(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 wW(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 bW(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return fP(e,t);const s={href:Jl(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 kW(e,t){const n={href:Jl(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 vW(e,t,n){const r=e.all(t),s=n?SW(n):pP(t),i={},a=[];if(typeof t.checked=="boolean"){const p=r[0];let f;p&&p.type==="element"&&p.tagName==="p"?f=p:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const p=r[l];(s||l!==0||p.type!=="element"||p.tagName!=="p")&&a.push({type:"text",value:`
|
|
72
|
-
`}),p.type==="element"&&p.tagName==="p"&&!s?a.push(...p.children):a.push(p)}const c=r[r.length-1];c&&(s||c.type!=="element"||c.tagName!=="p")&&a.push({type:"text",value:`
|
|
73
|
-
`});const u={type:"element",tagName:"li",properties:i,children:a};return e.patch(t,u),e.applyData(t,u)}function SW(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=pP(n[r])}return t}function pP(e){const t=e.spread;return t??e.children.length>1}function NW(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 jW(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function CW(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function _W(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function EW(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=eb(t.children[1]),c=qA(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 AW(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 u=[];for(;++c<l;){const f=t.children[c],d={},h=a?a[c]:void 0;h&&(d.align=h);let y={type:"element",tagName:i,properties:d,children:[]};f&&(y.children=e.all(f),e.patch(f,y),y=e.applyData(f,y)),u.push(y)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,p),e.applyData(t,p)}function PW(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const cN=9,uN=32;function IW(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(dN(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(dN(t.slice(s),s>0,!1)),i.join("")}function dN(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===cN||i===uN;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===cN||i===uN;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function TW(e,t){const n={type:"text",value:IW(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function RW(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const MW={blockquote:cW,break:uW,code:dW,delete:fW,emphasis:pW,footnoteReference:hW,heading:mW,html:gW,imageReference:yW,image:xW,inlineCode:wW,linkReference:bW,link:kW,listItem:vW,list:NW,paragraph:jW,root:CW,strong:_W,table:EW,tableCell:PW,tableRow:AW,text:TW,thematicBreak:RW,toml:hf,yaml:hf,definition:hf,footnoteDefinition:hf};function hf(){}const hP=-1,Lh=0,iu=1,Fp=2,ab=3,lb=4,cb=5,ub=6,mP=7,gP=8,fN=typeof self=="object"?self:globalThis,$W=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,a]=t[s];switch(i){case Lh:case hP:return n(a,s);case iu:{const l=n([],s);for(const c of a)l.push(r(c));return l}case Fp:{const l=n({},s);for(const[c,u]of a)l[r(c)]=r(u);return l}case ab:return n(new Date(a),s);case lb:{const{source:l,flags:c}=a;return n(new RegExp(l,c),s)}case cb:{const l=n(new Map,s);for(const[c,u]of a)l.set(r(c),r(u));return l}case ub:{const l=n(new Set,s);for(const c of a)l.add(r(c));return l}case mP:{const{name:l,message:c}=a;return n(new fN[l](c),s)}case gP: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 fN[i](a),s)};return r},pN=e=>$W(new Map,e)(0),Va="",{toString:LW}={},{keys:OW}=Object,Ec=e=>{const t=typeof e;if(t!=="object"||!e)return[Lh,t];const n=LW.call(e).slice(8,-1);switch(n){case"Array":return[iu,Va];case"Object":return[Fp,Va];case"Date":return[ab,Va];case"RegExp":return[lb,Va];case"Map":return[cb,Va];case"Set":return[ub,Va];case"DataView":return[iu,n]}return n.includes("Array")?[iu,n]:n.includes("Error")?[mP,n]:[Fp,n]},mf=([e,t])=>e===Lh&&(t==="function"||t==="symbol"),DW=(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]=Ec(a);switch(l){case Lh:{let p=a;switch(c){case"bigint":l=gP,p=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);p=null;break;case"undefined":return s([hP],a)}return s([l,p],a)}case iu:{if(c){let d=a;return c==="DataView"?d=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(d=new Uint8Array(a)),s([c,[...d]],a)}const p=[],f=s([l,p],a);for(const d of a)p.push(i(d));return f}case Fp:{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 p=[],f=s([l,p],a);for(const d of OW(a))(e||!mf(Ec(a[d])))&&p.push([i(d),i(a[d])]);return f}case ab:return s([l,a.toISOString()],a);case lb:{const{source:p,flags:f}=a;return s([l,{source:p,flags:f}],a)}case cb:{const p=[],f=s([l,p],a);for(const[d,h]of a)(e||!(mf(Ec(d))||mf(Ec(h))))&&p.push([i(d),i(h)]);return f}case ub:{const p=[],f=s([l,p],a);for(const d of a)(e||!mf(Ec(d)))&&p.push(i(d));return f}}const{message:u}=a;return s([l,{name:c,message:u}],a)};return i},hN=(e,{json:t,lossy:n}={})=>{const r=[];return DW(!(t||n),!!t,new Map,r)(e),r},zp=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?pN(hN(e,t)):structuredClone(e):(e,t)=>pN(hN(e,t));function FW(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 zW(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function BW(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||FW,r=e.options.footnoteBackLabel||zW,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 u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const p=e.all(u),f=String(u.identifier).toUpperCase(),d=Jl(f.toLowerCase());let h=0;const y=[],w=e.footnoteCounts.get(f);for(;w!==void 0&&++h<=w;){y.length>0&&y.push({type:"text",value:" "});let k=typeof n=="string"?n:n(c,h);typeof k=="string"&&(k={type:"text",value:k}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+d+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,h),className:["data-footnote-backref"]},children:Array.isArray(k)?k:[k]})}const b=p[p.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const k=b.children[b.children.length-1];k&&k.type==="text"?k.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...y)}else p.push(...y);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+d},children:e.wrap(p,!0)};e.patch(u,g),l.push(g)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...zp(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 yP=function(e){if(e==null)return KW;if(typeof e=="function")return Oh(e);if(typeof e=="object")return Array.isArray(e)?HW(e):WW(e);if(typeof e=="string")return VW(e);throw new Error("Expected function, string, or object as test")};function HW(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=yP(e[n]);return Oh(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function WW(e){const t=e;return Oh(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function VW(e){return Oh(t);function t(n){return n&&n.type===e}}function Oh(e){return t;function t(n,r,s){return!!(UW(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function KW(){return!0}function UW(e){return e!==null&&typeof e=="object"&&"type"in e}const xP=[],qW=!0,mN=!1,YW="skip";function GW(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=yP(s),a=r?-1:1;l(e,void 0,[])();function l(c,u,p){const f=c&&typeof c=="object"?c:{};if(typeof f.type=="string"){const h=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(d,"name",{value:"node ("+(c.type+(h?"<"+h+">":""))+")"})}return d;function d(){let h=xP,y,w,b;if((!t||i(c,u,p[p.length-1]||void 0))&&(h=JW(n(c,p)),h[0]===mN))return h;if("children"in c&&c.children){const g=c;if(g.children&&h[0]!==YW)for(w=(r?g.children.length:-1)+a,b=p.concat(g);w>-1&&w<g.children.length;){const k=g.children[w];if(y=l(k,w,b)(),y[0]===mN)return y;w=typeof y[1]=="number"?y[1]:w+a}}return h}}}function JW(e){return Array.isArray(e)?e:typeof e=="number"?[qW,e]:e==null?xP:[e]}function wP(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),GW(e,i,l,s);function l(c,u){const p=u[u.length-1],f=p?p.children.indexOf(c):void 0;return a(c,f,p)}}const ux={}.hasOwnProperty,XW={};function QW(e,t){const n=t||XW,r=new Map,s=new Map,i=new Map,a={...MW,...n.handlers},l={all:u,applyData:e8,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:a,one:c,options:n,patch:ZW,wrap:n8};return wP(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const f=p.type==="definition"?r:s,d=String(p.identifier).toUpperCase();f.has(d)||f.set(d,p)}}),l;function c(p,f){const d=p.type,h=l.handlers[d];if(ux.call(l.handlers,d)&&h)return h(l,p,f);if(l.options.passThrough&&l.options.passThrough.includes(d)){if("children"in p){const{children:w,...b}=p,g=zp(b);return g.children=l.all(p),g}return zp(p)}return(l.options.unknownHandler||t8)(l,p,f)}function u(p){const f=[];if("children"in p){const d=p.children;let h=-1;for(;++h<d.length;){const y=l.one(d[h],p);if(y){if(h&&d[h-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=gN(y.value)),!Array.isArray(y)&&y.type==="element")){const w=y.children[0];w&&w.type==="text"&&(w.value=gN(w.value))}Array.isArray(y)?f.push(...y):f.push(y)}}}return f}}function ZW(e,t){e.position&&(t.position=LB(e))}function e8(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,zp(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function t8(e,t){const n=t.data||{},r="value"in t&&!(ux.call(n,"hProperties")||ux.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 n8(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 gN(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function yN(e,t){const n=QW(e,t),r=n.one(e,void 0),s=BW(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 r8(e,t){return e&&"run"in e?async function(n,r){const s=yN(n,{file:r,...t});await e.run(s,r)}:function(n,r){return yN(n,{file:r,...e||t})}}function xN(e){if(e)throw e}var Zf=Object.prototype.hasOwnProperty,bP=Object.prototype.toString,wN=Object.defineProperty,bN=Object.getOwnPropertyDescriptor,kN=function(t){return typeof Array.isArray=="function"?Array.isArray(t):bP.call(t)==="[object Array]"},vN=function(t){if(!t||bP.call(t)!=="[object Object]")return!1;var n=Zf.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Zf.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||Zf.call(t,s)},SN=function(t,n){wN&&n.name==="__proto__"?wN(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},NN=function(t,n){if(n==="__proto__")if(Zf.call(t,n)){if(bN)return bN(t,n).value}else return;return t[n]},s8=function e(){var t,n,r,s,i,a,l=arguments[0],c=1,u=arguments.length,p=!1;for(typeof l=="boolean"&&(p=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)r=NN(l,n),s=NN(t,n),l!==s&&(p&&s&&(vN(s)||(i=kN(s)))?(i?(i=!1,a=r&&kN(r)?r:[]):a=r&&vN(r)?r:{},SN(l,{name:n,newValue:e(p,a,s)})):typeof s<"u"&&SN(l,{name:n,newValue:s}));return l};const cg=Po(s8);function dx(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 i8(){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,...u){const p=e[++i];let f=-1;if(c){a(c);return}for(;++f<s.length;)(u[f]===null||u[f]===void 0)&&(u[f]=s[f]);s=u,p?o8(p,l)(...u):a(null,...u)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function o8(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(u){const p=u;if(l&&n)throw p;return s(p)}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 qs={basename:a8,dirname:l8,extname:c8,join:u8,sep:"/"};function a8(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');ld(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 l8(e){if(ld(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 c8(e){ld(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 u8(...e){let t=-1,n;for(;++t<e.length;)ld(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":d8(n)}function d8(e){ld(e);const t=e.codePointAt(0)===47;let n=f8(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function f8(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 ld(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const p8={cwd:h8};function h8(){return"/"}function fx(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function m8(e){if(typeof e=="string")e=new URL(e);else if(!fx(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 g8(e)}function g8(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 ug=["history","path","basename","stem","extname","dirname"];class kP{constructor(t){let n;t?fx(t)?n={path:t}:typeof t=="string"||y8(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":p8.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<ug.length;){const i=ug[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)ug.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?qs.basename(this.path):void 0}set basename(t){fg(t,"basename"),dg(t,"basename"),this.path=qs.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?qs.dirname(this.path):void 0}set dirname(t){jN(this.basename,"dirname"),this.path=qs.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?qs.extname(this.path):void 0}set extname(t){if(dg(t,"extname"),jN(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=qs.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){fx(t)&&(t=m8(t)),fg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?qs.basename(this.path,this.extname):void 0}set stem(t){fg(t,"stem"),dg(t,"stem"),this.path=qs.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 hr(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 dg(e,t){if(e&&e.includes(qs.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+qs.sep+"`")}function fg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function jN(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function y8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const x8=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},w8={}.hasOwnProperty;class db extends x8{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=i8()}copy(){const t=new db;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(cg(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(mg("data",this.frozen),this.namespace[t]=n,this):w8.call(this.namespace,t)&&this.namespace[t]||void 0:t?(mg("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=gf(t),r=this.parser||this.Parser;return pg("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),pg("process",this.parser||this.Parser),hg("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,a){const l=gf(t),c=r.parse(l);r.run(c,l,function(p,f,d){if(p||!f||!d)return u(p);const h=f,y=r.stringify(h,d);v8(y)?d.value=y:d.result=y,u(p,d)});function u(p,f){p||!f?a(p):i?i(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),pg("processSync",this.parser||this.Parser),hg("processSync",this.compiler||this.Compiler),this.process(t,s),_N("processSync","process",n),r;function s(i,a){n=!0,xN(i),r=a}}run(t,n,r){CN(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=gf(n);s.run(t,c,u);function u(p,f,d){const h=f||t;p?l(p):a?a(h):r(void 0,h,d)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),_N("runSync","run",r),s;function i(a,l){xN(a),s=l,r=!0}}stringify(t,n){this.freeze();const r=gf(n),s=this.compiler||this.Compiler;return hg("stringify",s),CN(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(mg("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(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[p,...f]=u;c(p,f)}else a(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function a(u){if(!("plugins"in u)&&!("settings"in u))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(u.plugins),u.settings&&(s.settings=cg(!0,s.settings,u.settings))}function l(u){let p=-1;if(u!=null)if(Array.isArray(u))for(;++p<u.length;){const f=u[p];i(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,p){let f=-1,d=-1;for(;++f<r.length;)if(r[f][0]===u){d=f;break}if(d===-1)r.push([u,...p]);else if(p.length>0){let[h,...y]=p;const w=r[d][1];dx(w)&&dx(h)&&(h=cg(!0,w,h)),r[d]=[u,h,...y]}}}}const b8=new db().freeze();function pg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function hg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function mg(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 CN(e){if(!dx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function _N(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function gf(e){return k8(e)?e:new kP(e)}function k8(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function v8(e){return typeof e=="string"||S8(e)}function S8(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const N8="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",EN=[],AN={allowDangerousHtml:!0},j8=/^(https?|ircs?|mailto|xmpp)$/i,C8=[{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 vP(e){const t=_8(e),n=E8(e);return A8(t.runSync(t.parse(n),n),e)}function _8(e){const t=e.rehypePlugins||EN,n=e.remarkPlugins||EN,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...AN}:AN;return b8().use(lW).use(n).use(r8,r).use(t)}function E8(e){const t=e.children||"",n=new kP;return typeof t=="string"&&(n.value=t),n}function A8(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||P8;for(const p of C8)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+N8+p.id,void 0);return wP(e,u),BB(e,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function u(p,f,d){if(p.type==="raw"&&d&&typeof f=="number")return a?d.children.splice(f,1):d.children[f]={type:"text",value:p.value},f;if(p.type==="element"){let h;for(h in og)if(Object.hasOwn(og,h)&&Object.hasOwn(p.properties,h)){const y=p.properties[h],w=og[h];(w===null||w.includes(p.tagName))&&(p.properties[h]=c(String(y||""),h,p))}}if(p.type==="element"){let h=n?!n.includes(p.tagName):i?i.includes(p.tagName):!1;if(!h&&r&&typeof f=="number"&&(h=!r(p,f,d)),h&&d&&typeof f=="number")return l&&p.children?d.children.splice(f,1,...p.children):d.children.splice(f,1),f}}}function P8(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||j8.test(e.slice(0,t))?e:""}const I8=new Set(["echarts"]),T8=new Set(["line","bar","pie","scatter","radar","heatmap","tree","treemap","sunburst","sankey","graph","gauge","funnel"]),R8=new Set(["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","oncontextmenu","onkeydown","onkeyup","onkeypress","onload","onerror"]),M8=["#7c9cff","#a8e66f","#ffcf5c","#68d8d6","#ff8fb3","#b79cff","#f59e73","#8bd17c"];function So(e){return e&&typeof e=="object"&&!Array.isArray(e)}function wa(e,t){if(!So(e))return{...t};const n={...e};for(const[r,s]of Object.entries(t))n[r]==null?n[r]=s:So(n[r])&&So(s)&&(n[r]=wa(n[r],s));return n}function Dh(e,t){return e==null?e:Array.isArray(e)?e.map(n=>So(n)?wa(n,t):n):So(e)?wa(e,t):e}function $8(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 px(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)=>px(n,`${t}[${r}]`));return}if(typeof e=="object")for(const[n,r]of Object.entries(e)){if(/^on[A-Z]/.test(n)||R8.has(n.toLowerCase()))throw new Error(`${t}.${n} is not allowed`);px(r,`${t}.${n}`)}}}function L8(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(!T8.has(r))throw new Error(`series.type "${r||"(empty)"}" is not allowed`)}return t}function O8(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:wa(e,t)}function D8(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(!So(r))return r;const i=s===0&&t&&r.text==null?{...r,text:t}:r;return wa(i,n)}):So(e)?wa(t&&e.text==null?{...e,text:t}:e,n):t?{...n,text:t}:e}function F8(e,t){const n={top:t?42:14,textStyle:{color:"rgba(255, 255, 255, 0.72)"},itemGap:14};return e==null?e:Dh(e,n)}function PN(e,t="rgba(255, 255, 255, 0.62)"){return Dh(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 z8(e,t){const n={left:52,right:42,top:t?78:42,bottom:42,containLabel:!0};return e==null?n:Dh(e,n)}function B8(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:Dh(e,t)}function H8(e,t,n){const r=D8(e.title,n),s=!!(Array.isArray(r)?r:[r]).filter(Boolean).some(a=>So(a)&&a.text),i=e.legend!=null&&e.legend!==!1;return{...e,backgroundColor:e.backgroundColor??"transparent",color:e.color??M8,textStyle:wa(e.textStyle,{color:"rgba(255, 255, 255, 0.78)"}),title:r,tooltip:O8(e.tooltip),legend:F8(e.legend,s),grid:e.xAxis!=null||e.yAxis!=null?z8(e.grid,s||i):e.grid,xAxis:PN(e.xAxis),yAxis:PN(e.yAxis),radar:B8(e.radar),series:t}}function W8(e){const t=$8(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(!I8.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");px(n);const r=L8(n.option.series),s=n.title==null?"":String(n.title),i=H8(n.option,r,s);return{ok:!0,spec:{...n,title:s,option:i}}}catch(n){return{ok:!1,error:String((n==null?void 0:n.message)||n)}}}function _i(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 SP(e){const t=_i(e);return t.length>1&&t.every(n=>/^:?-{3,}:?$/.test(n))}function NP(e){return _i(e).map(t=>t.startsWith(":")&&t.endsWith(":")?"center":t.endsWith(":")?"right":"left")}function V8(e){return/^\s*(sequenceDiagram|flowchart\s+(?:TD|TB|BT|LR|RL)|graph\s+(?:TD|TB|BT|LR|RL))\b/i.test(String(e||""))}function K8(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 u=String(l||"").replace(/[^A-Za-z0-9_]/g,"_")||`N${n.size+1}`;return n.has(u)?c&&(n.get(u).label=c):n.set(u,{id:u,label:c||u}),u},a=l=>{const c=String(l||"").trim().replace(/[;,]+$/,""),u=c.match(/^([A-Za-z][A-Za-z0-9_]*)(?:\[(.+?)\]|\((.+?)\)|\{(.+?)\})?$/);return u?i(u[1],u[2]||u[3]||u[4]||u[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 u=l.match(/^(.+?)\s*-{1,2}>+\s*(.+)$/);if(u){r.push({from:a(u[1]),to:a(u[2])});continue}a(l)}return{nodes:Array.from(n.values()),edges:r,direction:s}}function U8({code:e}){const t=m.useMemo(()=>K8(e),[e]),n=t.direction==="LR"||t.direction==="RL",r=150,s=46,i=n?102:38,a=n?34:72,l=new Map;t.nodes.forEach((p,f)=>{l.set(p.id,{x:28+(n?f*(r+i):f%3*(r+i)),y:28+(n?f%3*(s+a):f*(s+a))})});const c=Math.max(520,...Array.from(l.values()).map(p=>p.x+r+28)),u=Math.max(220,...Array.from(l.values()).map(p=>p.y+s+28));return o.jsxs("svg",{viewBox:`0 0 ${c} ${u}`,role:"img","aria-label":"Mermaid flowchart preview",children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-md-mermaid-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),t.edges.map((p,f)=>{const d=l.get(p.from),h=l.get(p.to);if(!d||!h)return null;const y=n?`M ${d.x+r} ${d.y+s/2} C ${(d.x+h.x+r)/2} ${d.y+s/2}, ${(d.x+h.x+r)/2} ${h.y+s/2}, ${h.x} ${h.y+s/2}`:`M ${d.x+r/2} ${d.y+s} C ${d.x+r/2} ${d.y+s+28}, ${h.x+r/2} ${h.y-28}, ${h.x+r/2} ${h.y}`;return o.jsx("path",{className:"af-md-mermaid-edge",d:y,markerEnd:"url(#af-md-mermaid-arrow)"},`${p.from}-${p.to}-${f}`)}),t.nodes.map(p=>{const f=l.get(p.id);return o.jsxs("g",{children:[o.jsx("rect",{className:"af-md-mermaid-box",x:f.x,y:f.y,width:r,height:s,rx:"8"}),o.jsx("text",{className:"af-md-mermaid-text",x:f.x+r/2,y:f.y+s/2+5,textAnchor:"middle",children:p.label.slice(0,24)})]},p.id)})]})}function q8(e){const t=String(e||"").split(/\r?\n/).map(i=>i.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[],s=(i,a="")=>{const l=String(i||"").trim();l&&(n.has(l)||n.set(l,a||l))};for(const i of t){if(/^sequenceDiagram\b/i.test(i))continue;const a=i.match(/^(participant|actor)\s+([A-Za-z0-9_]+)(?:\s+as\s+(.+))?$/i);if(a){s(a[2],a[3]||a[2]);continue}const l=i.match(/^([A-Za-z0-9_]+)\s*[-=]+>>\+?\s*([A-Za-z0-9_]+)\s*:\s*(.+)$/);if(l){s(l[1]),s(l[2]),r.push({type:"message",from:l[1],to:l[2],text:l[3]});continue}const c=i.match(/^note\s+(?:over|right of|left of)\s+([^:]+):\s*(.+)$/i);r.push({type:"note",text:c?c[2]:i})}return{participants:Array.from(n,([i,a])=>({id:i,label:a})),rows:r}}function Y8({code:e}){const t=m.useMemo(()=>q8(e),[e]),n=t.participants.length?t.participants:[{id:"A",label:"A"},{id:"B",label:"B"}],r=190,s=48,i=26,a=44,l=48,c=Math.max(620,s*2+n.length*r),u=Math.max(220,i+a+Math.max(1,t.rows.length)*l+34),p=f=>{const d=Math.max(0,n.findIndex(h=>h.id===f));return s+d*r+r/2};return o.jsxs("svg",{viewBox:`0 0 ${c} ${u}`,role:"img","aria-label":"Mermaid sequence diagram preview",children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-md-sequence-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),n.map((f,d)=>{const h=s+d*r+r/2;return o.jsxs("g",{children:[o.jsx("rect",{className:"af-md-mermaid-box",x:h-68,y:i,width:"136",height:"34",rx:"8"}),o.jsx("text",{className:"af-md-mermaid-text",x:h,y:i+22,textAnchor:"middle",children:f.label.slice(0,18)}),o.jsx("line",{className:"af-md-sequence-life",x1:h,y1:i+a,x2:h,y2:u-18})]},f.id)}),t.rows.map((f,d)=>{const h=i+a+d*l+24;if(f.type!=="message")return o.jsxs("g",{children:[o.jsx("rect",{className:"af-md-sequence-note",x:s,y:h-17,width:c-s*2,height:"30",rx:"7"}),o.jsx("text",{className:"af-md-mermaid-text",x:s+12,y:h+4,children:f.text.slice(0,120)})]},`note-${d}`);const y=p(f.from),w=p(f.to),b=(y+w)/2;return o.jsxs("g",{children:[o.jsx("line",{className:"af-md-mermaid-edge",x1:y,y1:h,x2:w,y2:h,markerEnd:"url(#af-md-sequence-arrow)"}),o.jsx("text",{className:"af-md-sequence-label",x:b,y:h-8,textAnchor:"middle",children:f.text.slice(0,72)})]},`msg-${d}`)})]})}function jP({code:e}){const t=String(e||"").trim();if(!t)return null;const n=/^sequenceDiagram\b/i.test(t);return o.jsx("div",{className:"af-md-mermaid-preview",children:n?o.jsx(Y8,{code:t}):o.jsx(U8,{code:t})})}function G8(e){const t=String(e||"").replace(/\r\n/g,`
|
|
80
|
-
`).split(`
|
|
81
|
-
`),n=[];let r=[],s=!1;const i=()=>{r.length&&(n.push({type:"markdown",text:r.join(`
|
|
82
|
-
`)}),r=[])};for(let a=0;a<t.length;){const l=t[a]||"",c=l.match(/^\s*```\s*(mermaid|mmd)\s*$/i);if(!s&&c){i();const u=[];for(a++;a<t.length&&!/^\s*```\s*$/.test(t[a]||"");)u.push(t[a]||""),a++;a<t.length&&a++,n.push({type:"mermaid",text:u.join(`
|
|
83
|
-
`)});continue}if(!s&&V8(l)){i();const u=[];for(;a<t.length;){const p=t[a]||"";if(u.length>0&&(!p.trim()||/^-{3,}\s*$/.test(p)||/^#{1,6}\s+/.test(p)))break;u.push(p),a++}n.push({type:"mermaid",text:u.join(`
|
|
84
|
-
`)});continue}if(/^\s*```/.test(l)){s=!s,r.push(l),a++;continue}if(!s&&a+1<t.length&&_i(l).length>1&&SP(t[a+1])){i();const u=_i(l),p=NP(t[a+1]),f=[];for(a+=2;a<t.length&&t[a].trim()&&_i(t[a]).length>1;)f.push(_i(t[a])),a++;n.push({type:"table",headers:u,align:p,rows:f});continue}r.push(l),a++}return i(),n}function IN(e,t=""){const n=String(e||"").trim();if(!n||/^(?:https?:|data:|blob:|file:|javascript:|mailto:|tel:)/i.test(n)||n.startsWith("/")||n.startsWith("#")||!t||n.startsWith("outputs/"))return n;const r=String(t||"").split("/").filter(Boolean);r.pop();const s=[...r,...n.split("/")].filter(Boolean),i=[];for(const a of s)if(a!=="."){if(a===".."){if(i.length===0)return n;i.pop();continue}i.push(a)}return i.join("/")}function CP(e){const t=String(e||"").replace(/\r\n/g,`
|
|
85
|
-
`).split(`
|
|
86
|
-
`);let n=!1;return t.map(r=>{if(/^\s*```/.test(r))return n=!n,r;if(n)return r;let s="",i=0,a=!1;for(;i<r.length;){const l=r[i];if(l==="`"){a=!a,s+=l,i+=1;continue}if(!(!a&&/^https?:\/\//i.test(r.slice(i)))){s+=l,i+=1;continue}if((i>0?r[i-1]:"")==="("){s+=l,i+=1;continue}let p=i;for(;p<r.length&&!/\s|<|>/.test(r[p]);)p+=1;let f=r.slice(i,p),d="";for(;/[.,;:!?)}\]]$/.test(f);)d=f.slice(-1)+d,f=f.slice(0,-1);f?s+=`[${f}](${f})${d}`:s+=r.slice(i,p),i=p}return s}).join(`
|
|
87
|
-
`)}function _P(e,t=!1,n=""){const r=i=>{const a=String(i||"").trim();if(!a)return"";if(/^(?:https?:|data:|blob:|file:|javascript:|mailto:|tel:)/i.test(a)||a.startsWith("#"))return a;const l=IN(a,n);return e?e(l,{kind:"link",download:!0}):l},s=(i,a)=>{const l=r(a);!l||l.startsWith("#")||/^(?:javascript):/i.test(l)||(i.stopPropagation(),!(i.defaultPrevented||i.button!==0)&&(i.preventDefault(),window.open(l,"_blank","noopener,noreferrer")))};return{...t?{p:({children:i})=>o.jsx(o.Fragment,{children:i})}:{},code:({inline:i,className:a,children:l})=>{var p;const c=((p=String(a||"").match(/language-(\w+)/i))==null?void 0:p[1])||"",u=String(l||"").replace(/\n$/,"");return!i&&/^(mermaid|mmd)$/i.test(c)?o.jsx(jP,{code:u}):i?o.jsx("code",{className:a,children:l}):o.jsx("code",{className:a,children:l})},img:({src:i,alt:a})=>o.jsx("img",{src:e?e(IN(i,n)):i||"",alt:a||"",loading:"lazy"}),a:({href:i,children:a})=>o.jsx("a",{href:r(i),target:"_blank",rel:"noopener noreferrer",onClick:l=>s(l,i),children:a})}}function TN({children:e,resolveSrc:t,basePath:n=""}){return o.jsx(vP,{components:_P(t,!0,n),children:CP(e)})}function fb({content:e,resolveSrc:t,basePath:n=""}){const r=m.useMemo(()=>G8(e),[e]),s=m.useMemo(()=>_P(t,!1,n),[n,t]);return o.jsx(o.Fragment,{children:r.map((i,a)=>i.type==="mermaid"?o.jsx(jP,{code:i.text},`mermaid-${a}`):i.type!=="table"?o.jsx(vP,{components:s,children:CP(i.text)},`md-${a}`):o.jsx("div",{className:"af-work-display-table-wrap",children:o.jsxs("table",{className:"af-work-display-table",children:[o.jsx("thead",{children:o.jsx("tr",{children:i.headers.map((l,c)=>o.jsx("th",{style:{textAlign:i.align[c]||"left"},children:o.jsx(TN,{resolveSrc:t,basePath:n,children:l})},c))})}),o.jsx("tbody",{children:i.rows.map((l,c)=>o.jsx("tr",{children:i.headers.map((u,p)=>o.jsx("td",{style:{textAlign:i.align[p]||"left"},children:o.jsx(TN,{resolveSrc:t,basePath:n,children:l[p]||""})},p))},c))})]})},`table-${a}`))})}function J8(e,t=","){const n=[];let r=[],s="",i=!1;const a=String(e||"").replace(/\r\n/g,`
|
|
88
|
-
`);for(let l=0;l<a.length;l+=1){const c=a[l],u=a[l+1];if(i){c==='"'&&u==='"'?(s+='"',l+=1):c==='"'?i=!1:s+=c;continue}c==='"'?i=!0:c===t?(r.push(s.trim()),s=""):c===`
|
|
89
|
-
`?(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 Ks(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 X8(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=>Ks(i[a])))}}if(e.every(Array.isArray)&&e.length>0){const s=e[0].map((i,a)=>Ks(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)=>Ks(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:Ks(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:Ks(s)||`Column ${i+1}`,align:"left"})),{columns:r,rows:n.slice(1).map(s=>r.map((i,a)=>Ks(s[a])))}):{columns:r,rows:n.map(s=>Array.isArray(s)?r.map((i,a)=>Ks(s[a])):s&&typeof s=="object"?r.map(i=>Ks(s[i.key])):r.map((i,a)=>a===0?Ks(s):""))}}function Q8(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=X8(JSON.parse(r));if(l&&l.columns.length)return{...l,error:""}}catch{}const s=r.replace(/\r\n/g,`
|
|
90
|
-
`).split(`
|
|
91
|
-
`).filter(l=>l.trim());if(s.length>=2&&_i(s[0]).length>1&&SP(s[1])){const l=_i(s[0]),c=NP(s[1]);return{columns:l.map((u,p)=>({key:String(p),label:u,align:c[p]||"left"})),rows:s.slice(2).map(u=>_i(u)),error:""}}const i=r.includes(" ")?" ":",",a=J8(r,i);return a.length>0&&a[0].length>1?{columns:a[0].map((c,u)=>c||`Column ${u+1}`).map((c,u)=>({key:String(u),label:c,align:"left"})),rows:a.slice(1),error:""}:{columns:[],rows:[],error:"No table data detected"}}function pb({content:e}){const t=m.useMemo(()=>Q8(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:Ks(n[i])},`${s.key}-${i}`))},r))})]})})}function hb({content:e}){const t=m.useRef(null),n=m.useMemo(()=>W8(e),[e]),[r,s]=m.useState({loading:!1,error:""});return m.useEffect(()=>{if(!n.ok){s({loading:!1,error:n.error||"Invalid chart spec"});return}let i=!1,a=null,l=null,c=null;return s({loading:!0,error:""}),V5(()=>import("./index-DgQRkS4v.js"),[]).then(u=>{i||!t.current||(a=u.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(u=>{i||s({loading:!1,error:String((u==null?void 0:u.message)||u)})}),()=>{var u,p;i=!0,c&&window.removeEventListener("resize",c),(u=l==null?void 0:l.disconnect)==null||u.call(l),(p=a==null?void 0:a.dispose)==null||p.call(a)}},[n]),!n.ok||r.error?o.jsxs("div",{className:"af-work-display-chart-error",children:[o.jsx("strong",{children:"Chart configuration error"}),o.jsx("span",{children:r.error||n.error})]}):o.jsxs("div",{className:"af-work-display-chart",children:[o.jsx("div",{ref:t,className:"af-work-display-chart__canvas"}),r.loading?o.jsx("div",{className:"af-work-display-chart__loading",children:"Loading chart..."}):null]})}/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function EP(e){return typeof e>"u"||e===null}function Z8(e){return typeof e=="object"&&e!==null}function e9(e){return Array.isArray(e)?e:EP(e)?[]:[e]}function t9(e,t){var n,r,s,i;if(t)for(i=Object.keys(t),n=0,r=i.length;n<r;n+=1)s=i[n],e[s]=t[s];return e}function n9(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function r9(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var s9=EP,i9=Z8,o9=e9,a9=n9,l9=r9,c9=t9,mb={isNothing:s9,isObject:i9,toArray:o9,repeat:a9,isNegativeZero:l9,extend:c9};function AP(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+=`
|
|
92
|
-
|
|
93
|
-
`+e.mark.snippet),r+" "+n):r}function Du(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=AP(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Du.prototype=Object.create(Error.prototype);Du.prototype.constructor=Du;Du.prototype.toString=function(t){return this.name+": "+AP(this,t)};var Go=Du,u9=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],d9=["scalar","sequence","mapping"];function f9(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function p9(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(u9.indexOf(n)===-1)throw new Go('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=f9(t.styleAliases||null),d9.indexOf(this.kind)===-1)throw new Go('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var dr=p9;function RN(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 h9(){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 hx(e){return this.extend(e)}hx.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 Go("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(i){if(!(i instanceof dr))throw new Go("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(i.loadKind&&i.loadKind!=="scalar")throw new Go("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 Go("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 Go("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var s=Object.create(hx.prototype);return s.implicit=(this.implicit||[]).concat(n),s.explicit=(this.explicit||[]).concat(r),s.compiledImplicit=RN(s,"implicit"),s.compiledExplicit=RN(s,"explicit"),s.compiledTypeMap=h9(s.compiledImplicit,s.compiledExplicit),s};var m9=hx,g9=new dr("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),y9=new dr("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),x9=new dr("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),w9=new m9({explicit:[g9,y9,x9]});function b9(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function k9(){return null}function v9(e){return e===null}var S9=new dr("tag:yaml.org,2002:null",{kind:"scalar",resolve:b9,construct:k9,predicate:v9,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function N9(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 j9(e){return e==="true"||e==="True"||e==="TRUE"}function C9(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var _9=new dr("tag:yaml.org,2002:bool",{kind:"scalar",resolve:N9,construct:j9,predicate:C9,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 E9(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function A9(e){return 48<=e&&e<=55}function P9(e){return 48<=e&&e<=57}function I9(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(!E9(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}if(s==="o"){for(n++;n<t;n++)if(s=e[n],s!=="_"){if(!A9(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}}if(s==="_")return!1;for(;n<t;n++)if(s=e[n],s!=="_"){if(!P9(e.charCodeAt(n)))return!1;r=!0}return!(!r||s==="_")}function T9(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 R9(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!mb.isNegativeZero(e)}var M9=new dr("tag:yaml.org,2002:int",{kind:"scalar",resolve:I9,construct:T9,predicate:R9,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"]}}),$9=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function L9(e){return!(e===null||!$9.test(e)||e[e.length-1]==="_")}function O9(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 D9=/^[-+]?[0-9]+e/;function F9(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(mb.isNegativeZero(e))return"-0.0";return n=e.toString(10),D9.test(n)?n.replace("e",".e"):n}function z9(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||mb.isNegativeZero(e))}var B9=new dr("tag:yaml.org,2002:float",{kind:"scalar",resolve:L9,construct:O9,predicate:z9,represent:F9,defaultStyle:"lowercase"}),H9=w9.extend({implicit:[S9,_9,M9,B9]}),W9=H9,PP=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),IP=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function V9(e){return e===null?!1:PP.exec(e)!==null||IP.exec(e)!==null}function K9(e){var t,n,r,s,i,a,l,c=0,u=null,p,f,d;if(t=PP.exec(e),t===null&&(t=IP.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]&&(p=+t[10],f=+(t[11]||0),u=(p*60+f)*6e4,t[9]==="-"&&(u=-u)),d=new Date(Date.UTC(n,r,s,i,a,l,c)),u&&d.setTime(d.getTime()-u),d}function U9(e){return e.toISOString()}var q9=new dr("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:V9,construct:K9,instanceOf:Date,represent:U9});function Y9(e){return e==="<<"||e===null}var G9=new dr("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Y9}),gb=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
94
|
-
\r`;function J9(e){if(e===null)return!1;var t,n,r=0,s=e.length,i=gb;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 X9(e){var t,n,r=e.replace(/[\r\n=]/g,""),s=r.length,i=gb,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 Q9(e){var t="",n=0,r,s,i=e.length,a=gb;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 Z9(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var eV=new dr("tag:yaml.org,2002:binary",{kind:"scalar",resolve:J9,construct:X9,predicate:Z9,represent:Q9}),tV=Object.prototype.hasOwnProperty,nV=Object.prototype.toString;function rV(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,nV.call(s)!=="[object Object]")return!1;for(i in s)if(tV.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 sV(e){return e!==null?e:[]}var iV=new dr("tag:yaml.org,2002:omap",{kind:"sequence",resolve:rV,construct:sV}),oV=Object.prototype.toString;function aV(e){if(e===null)return!0;var t,n,r,s,i,a=e;for(i=new Array(a.length),t=0,n=a.length;t<n;t+=1){if(r=a[t],oV.call(r)!=="[object Object]"||(s=Object.keys(r),s.length!==1))return!1;i[t]=[s[0],r[s[0]]]}return!0}function lV(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 cV=new dr("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:aV,construct:lV}),uV=Object.prototype.hasOwnProperty;function dV(e){if(e===null)return!0;var t,n=e;for(t in n)if(uV.call(n,t)&&n[t]!==null)return!1;return!0}function fV(e){return e!==null?e:{}}var pV=new dr("tag:yaml.org,2002:set",{kind:"mapping",resolve:dV,construct:fV});W9.extend({implicit:[q9,G9],explicit:[eV,iV,cV,pV]});function MN(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
|
|
95
|
-
`: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":""}var hV=new Array(256),mV=new Array(256);for(var Ka=0;Ka<256;Ka++)hV[Ka]=MN(Ka)?1:0,mV[Ka]=MN(Ka);const Fu=["requirement","planning","code","test","normal"],$N={普通:"normal",技术规划:"planning",代码执行:"code",测试回归:"test",需求拆解:"requirement"};function yb(e,t){var s,i,a,l,c,u,p,f,d,h,y,w,b,g;const n=k=>{const x={type:(k==null?void 0:k.type)??"node",name:(k==null?void 0:k.name)??"",value:(k==null?void 0:k.value)??(k==null?void 0:k.default)??""};return(k==null?void 0:k.required)===!0&&(x.required=!0),(k==null?void 0:k.description)!=null&&String(k.description).trim()&&(x.description=String(k.description)),(k==null?void 0:k.showOnNode)!=null&&(x.showOnNode=!!k.showOnNode),x},r={};for(const k of e){if((s=k==null?void 0:k.data)!=null&&s.isWorkspaceGroup)continue;const x=t[k.id]&&typeof t[k.id]=="object"?{...t[k.id]}:{},S=((i=k.data)==null?void 0:i.definitionId)||k.id,C=((a=k.data)==null?void 0:a.inputs)??[],j=((l=k.data)==null?void 0:l.outputs)??[],E=((c=k.data)==null?void 0:c.role)!=null?String(k.data.role).trim():"",A=x.role!=null?String(x.role).trim():"",O=$N[E]||E,W=$N[A]||A,H=Fu.includes(O)?O:Fu.includes(W)?W:"normal",D=Array.isArray(C)?C.map(n):Array.isArray(x.input)?x.input.map(te=>n(te)):[],R=Array.isArray(j)?j.map(n):Array.isArray(x.output)?x.output.map(te=>n(te)):[],T=((u=k.data)==null?void 0:u.label)!=null?String(k.data.label):x.label!=null?String(x.label):k.id,V=(p=k.data)==null?void 0:p.body,F=V!=null?String(V):x.body!=null?String(x.body):"";let M=((f=k.data)==null?void 0:f.model)!=null&&String(k.data.model).trim()!==""?String(k.data.model).trim():x.model!=null&&String(x.model).trim()!==""?String(x.model).trim():void 0;(M===""||M==="default")&&(M=void 0);const I={...x,definitionId:S,label:T,role:H,model:M,input:D,output:R},B=((d=k.data)==null?void 0:d.marketplaceRef)||x.marketplaceRef;B?I.marketplaceRef=String(B):delete I.marketplaceRef;const _=((h=k.data)==null?void 0:h.marketplacePackageId)||x.marketplacePackageId;_?I.marketplacePackageId=String(_):delete I.marketplacePackageId;const q=((y=k.data)==null?void 0:y.marketplaceVersion)||x.marketplaceVersion;q?I.marketplaceVersion=String(q):delete I.marketplaceVersion,S.startsWith("provide_")||F.trim()===""?delete I.body:I.body=F;const z=Array.isArray((w=k.data)==null?void 0:w.images)?k.data.images:Array.isArray(x.images)?x.images:[];z.length>0?I.images=z:delete I.images;const $=(b=k.data)==null?void 0:b.script,Q=$!=null?String($):x.script!=null?String(x.script):"";Q.trim()===""?delete I.script:I.script=Q;for(const te of["scriptRef","implementationRef","implementationMode"]){const ie=(g=k.data)==null?void 0:g[te],he=ie!=null?String(ie):x[te]!=null?String(x[te]):"";he.trim()===""?delete I[te]:I[te]=he.trim()}delete I.temperature,delete I.maxTokens,delete I.description,r[k.id]=I}return r}function ou(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function gV(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 yV(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=>ou(a)),edges:i.map(a=>ou(a)),instances:yb(r,n||{})}}function xV(e,t,n,r,s={}){var f;if(!e||!Array.isArray(e.nodes)||e.nodes.length===0)return null;const i=s.offset||{x:48,y:48},a=new Set((t||[]).map(d=>d.id)),l=new Map;for(const d of e.nodes)l.set(d.id,gV(d.id,a));const c=e.nodes.map(d=>{var y,w;const h=l.get(d.id);return{...ou(d),id:h,selected:!0,dragging:!1,position:{x:Number(((y=d.position)==null?void 0:y.x)||0)+i.x,y:Number(((w=d.position)==null?void 0:w.y)||0)+i.y}}}),u=(e.edges||[]).filter(d=>l.has(d.source)&&l.has(d.target)).map((d,h)=>{const y=l.get(d.source),w=l.get(d.target);return{...ou(d),id:`e-${y}-${w}-${Date.now()}-${h}`,source:y,target:w,selected:!1}}),p={...r||{}};for(const[d,h]of l.entries()){const y=(f=e.instances)==null?void 0:f[d];y&&(p[h]={...ou(y),label:y.label!=null?String(y.label):h})}return{nodes:[...(t||[]).map(d=>({...d,selected:!1})),...c],edges:[...(n||[]).map(d=>({...d,selected:!1})),...u],instances:p,pastedNodeIds:c.map(d=>d.id)}}function wn(e){switch(Bp(e)){case"text":return"#2196f3";case"file":return"#4caf50";case"node":return"#ff9800";case"bool":return"#9c27b0";default:return"#9e9e9e"}}function Bp(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 wV(e,t){const n=Bp(e),r=Bp(t);return!n||!r?!1:n==="any"||r==="any"?!0:n===r}const bV=new Set(["knowledgeContext","workspaceContext","skillsContext","mcpContext"]);function mx(e){const t=Bp(e==null?void 0:e.type),n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim();return t==="text"&&bV.has(n)?`${t}+${n}`:t}function kV(e){return mx(e)}function zu(e,t){if(!e||!t||!wV(e.type,t.type))return!1;const n=mx(e),r=mx(t),s=n.includes("+"),i=r.includes("+");return s||i?n===r:!0}function vV(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 gx(e,t,n){var l;const r=n==="source"?"outputs":"inputs",i=vV(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}const Hp=/\[image\s+(\d+)\]/gi;function Fi(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 SV(e){return`image ${Fi(e).length+1}`}function NV(e,t){const n=String(e||""),r=`[${t}]`;return n.trim()?`${n.replace(/[ \t]+$/u,"")} ${r}`:r}function jV(e,t){const n=Fi(e),r=String(t||""),s=new Set;Hp.lastIndex=0;let i;for(;i=Hp.exec(r);)s.add(`image ${i[1]}`.toLowerCase());return s.size===0?[]:n.filter(a=>s.has(String(a.label||"").toLowerCase()))}function CV(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 TP(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 au(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 RP({files:e,body:t,images:n}){const r=Array.from(e||[]);if(r.length===0)return null;let s=String(t||"");const i=Fi(n);for(const a of r){const l=await CV(a),c=SV(i);i.push({id:`${Date.now().toString(36)}-${i.length+1}`,label:c,...l}),s=NV(s,c)}return{body:s,images:i}}function as(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function _V(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 EV(e){return["true","1","yes","on"].includes(String((e==null?void 0:e.value)??(e==null?void 0:e.default)??"").trim().toLowerCase())}function Vt(e){e.stopPropagation()}function AV(e){return String(e||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function PV(e,t){const n=`\\[${AV(t)}\\]`;return String(e||"").replace(new RegExp(`[ \\t]*${n}`,"gi"),"").replace(/[ \t]+\n/g,`
|
|
96
|
-
`).replace(/\n{3,}/g,`
|
|
97
|
-
|
|
98
|
-
`).trimEnd()}function gg(e){return String(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function IV(e){const t=String(e||"");let n="",r=0;Hp.lastIndex=0;let s;for(;s=Hp.exec(t);)n+=gg(t.slice(r,s.index)),n+=`<span class="af-flow-node__image-token">${gg(s[0])}</span>`,r=s.index+s[0].length;return n+=gg(t.slice(r)),n||" "}function TV(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,u=Math.min(Math.max(c,2),8);return Math.ceil(u*r+s+i+a+l)}function RV({data:e,selected:t,id:n,deleteNode:r,onProvideExpand:s,onProvideValueChange:i,onNodeBodyChange:a,onNodeImagesChange:l,modelLists:c,onModelChange:u}){var Pr,Jt;const{t:p}=_r(),f=(e==null?void 0:e.inputs)??[],d=(e==null?void 0:e.outputs)??[],h=((e==null?void 0:e.schemaType)??"agent").toLowerCase(),y=_V(e),w=(e==null?void 0:e.isRunMode)??!1,b=!!(e!=null&&e.readOnly),g=(e==null?void 0:e.isExecuting)??!1,k=(e==null?void 0:e.isDim)??!1,x=(e==null?void 0:e.nodeStatus)??null,S=(e==null?void 0:e.nodeElapsed)??null,C=(e==null?void 0:e.definitionId)||"",j=C.startsWith("provide_"),E=C==="provide_bool",A=C==="provide_str",O=C==="provide_file",W=C==="provide_password",H=C==="agent_subAgent",D=C==="control_agent_toBool",R=(H||D)&&!w,T=E?EV(d[0]):!1,V=j?String(((Pr=d[0])==null?void 0:Pr.value)??((Jt=d[0])==null?void 0:Jt.default)??(e==null?void 0:e.body)??""):"",F=String((e==null?void 0:e.body)||""),M=(e==null?void 0:e.displayLabel)||(e==null?void 0:e.label)||p("flow:node.fallbackLabel"),I=!j&&!R&&(e!=null&&e.showBodyPreview)?String((e==null?void 0:e.body)||"").trim():"",B=Fi(e==null?void 0:e.images),_=E||A||O||W||R||!!I,q=m.useRef(!1),z=m.useRef(!1),$=m.useRef(null),Q=m.useRef(null),te=m.useRef(null),ie=m.useRef(null),he=m.useRef(null),[ne,ce]=m.useState(V),[re,le]=m.useState(!1),[ue,Se]=m.useState(F),[De,Ye]=m.useState(!1),[Ie,Je]=m.useState({visible:!1,top:0,height:100}),[Et,bt]=m.useState(!1),Pe=m.useCallback(()=>{const se=Q.current;if(!se)return;const Ne=Math.max(1,se.scrollHeight),et=Math.max(1,se.clientHeight),mt=Ne>et+1,sn=mt?Math.max(12,et/Ne*100):100,gn=Math.max(0,100-sn),Rn=mt?Math.min(gn,se.scrollTop/Math.max(1,Ne-et)*gn):0;Je({visible:mt,top:Rn,height:sn})},[]);m.useEffect(()=>{q.current||ce(V)},[n,V]),m.useEffect(()=>{z.current||Se(F)},[n,F]),m.useEffect(()=>{const se=Q.current;if(!se)return;if(R){se.style.minHeight="",se.style.height="",te.current&&(te.current.style.minHeight="",te.current.style.height="");return}const Ne=TV(se,ue);se.style.minHeight=`${Ne}px`,se.style.height="",te.current&&(te.current.style.minHeight=`${Ne}px`,te.current.style.height="")},[ue,R]),m.useEffect(()=>{if(!R)return;const se=window.requestAnimationFrame(Pe),Ne=Q.current;if(!Ne||typeof ResizeObserver>"u")return()=>window.cancelAnimationFrame(se);const et=new ResizeObserver(Pe);return et.observe(Ne),()=>{window.cancelAnimationFrame(se),et.disconnect()}},[ue,R,Pe]),m.useEffect(()=>{const se=$.current,Ne=e==null?void 0:e.onNodeContentResize;if(!R||!se||!Ne||typeof ResizeObserver>"u")return;let et=0;const mt=()=>{window.cancelAnimationFrame(et),et=window.requestAnimationFrame(()=>Ne(n))},sn=new ResizeObserver(mt);return sn.observe(se),mt(),()=>{window.cancelAnimationFrame(et),sn.disconnect()}},[e==null?void 0:e.onNodeContentResize,R,n]),m.useEffect(()=>{if(!Et)return;const se=window.setTimeout(()=>{const Ne=he.current;if(!Ne)return;Ne.focus();const et=Ne.value.length;Ne.setSelectionRange(et,et)},0);return()=>window.clearTimeout(se)},[Et]);const rt=Array.isArray(c==null?void 0:c.cursor)?c.cursor:[],At=Array.isArray(c==null?void 0:c.opencode)?c.opencode:[],zt=Array.isArray(c==null?void 0:c.claudeCode)?c.claudeCode:[],Kt=Array.isArray(c==null?void 0:c.codex)?c.codex:[],tt=((e==null?void 0:e.model)??"").trim(),oe=h==="agent"&&!C.startsWith("tool_nodejs"),be=new Set(rt.map(as)),ke=new Set(At.map(as)),st=new Set(zt.map(as)),Ze=new Set(Kt.map(as)),kt=tt?tt.startsWith("cursor:")||tt.startsWith("opencode:")||tt.startsWith("codex:")||tt.startsWith("claude-code:")?tt:st.has(tt)?`claude-code:${tt}`:Ze.has(tt)?`codex:${tt}`:ke.has(tt)?`opencode:${tt}`:be.has(tt)?`cursor:${tt}`:tt:"",Bt=tt&&!kt.startsWith("cursor:")&&!kt.startsWith("opencode:")&&!kt.startsWith("codex:")&&!kt.startsWith("claude-code:")&&!be.has(tt)&&!ke.has(tt)&&!st.has(tt)&&!Ze.has(tt),Gt=tt.startsWith("cursor:")?tt.slice(7):tt.startsWith("opencode:")?tt.slice(9):tt.startsWith("codex:")?tt.slice(6):tt.startsWith("claude-code:")?tt.slice(12):tt,Z=se=>{if(b)return;const Ne=se.target.value;u&&u(n,Ne)},xe=se=>{se.stopPropagation(),!b&&r&&r(n)},$e=se=>{se.stopPropagation(),s&&s()},Ee=se=>{se.stopPropagation(),!b&&(i==null||i(n,se.target.value==="true"?"true":"false"))},ut=se=>{if(se.stopPropagation(),b)return;const Ne=se.target.value;ce(Ne),q.current||i==null||i(n,Ne)},St=se=>{se.stopPropagation(),q.current=!0},ir=se=>{if(se.stopPropagation(),b)return;q.current=!1;const Ne=se.currentTarget.value;ce(Ne),i==null||i(n,Ne)},Er=()=>{b||i==null||i(n,ne)},Xn=se=>{if(se.stopPropagation(),b)return;if(typeof(e==null?void 0:e.onOpenProvideFilePicker)=="function"){e.onOpenProvideFilePicker(n,ne);return}const Ne=window.prompt("文件路径",ne);Ne!=null&&(ce(Ne),i==null||i(n,Ne))},hn=se=>{se.stopPropagation(),le(Ne=>!Ne)},Cn=se=>{if(Se(se),a==null||a(n,se),l){const Ne=jV(B,se);(Ne.length!==B.length||Ne.some((et,mt)=>{var sn;return et.id!==((sn=B[mt])==null?void 0:sn.id)}))&&l(n,Ne)}},_n=se=>{if(se.stopPropagation(),b)return;const Ne=se.target.value;z.current?Se(Ne):Cn(Ne)},mr=se=>{se.stopPropagation(),!b&&(z.current=!0,Ye(!0))},En=se=>{if(se.stopPropagation(),b)return;z.current=!1,Ye(!1);const Ne=se.currentTarget.value;Cn(Ne)},Dn=()=>{b||(z.current=!1,Ye(!1),Cn(ue))},Qn=se=>{se.stopPropagation(),se.preventDefault(),!b&&bt(!0)},Hr=()=>{bt(!1),Dn()},gr=se=>{se.stopPropagation(),se.key==="Escape"&&(se.preventDefault(),Hr())},An=m.useCallback(se=>{const Ne=Q.current;if(!Ne)return;const et=Math.max(0,Ne.scrollHeight-Ne.clientHeight);Ne.scrollTop=Math.min(1,Math.max(0,se))*et,Pe()},[Pe]),ss=m.useCallback((se,Ne=0)=>{const et=ie.current;if(!et)return 0;const mt=et.getBoundingClientRect(),sn=Ie.height/100*mt.height,gn=Math.max(1,mt.height-sn);return(se-mt.top-Ne)/gn},[Ie.height]),or=m.useCallback(se=>{var gt,Bn;if(!Ie.visible)return;se.preventDefault(),se.stopPropagation();const Ne=ie.current;if(!Ne)return;const et=Ne.getBoundingClientRect(),mt=Ie.top/100*et.height,sn=Ie.height/100*et.height,Rn=se.clientY>=et.top+mt&&se.clientY<=et.top+mt+sn?se.clientY-et.top-mt:sn/2;An(ss(se.clientY,Rn));const yr=se.pointerId;(Bn=(gt=se.currentTarget).setPointerCapture)==null||Bn.call(gt,yr);const ot=we=>{we.preventDefault(),An(ss(we.clientY,Rn))},jt=()=>{window.removeEventListener("pointermove",ot),window.removeEventListener("pointerup",jt),window.removeEventListener("pointercancel",jt)};window.addEventListener("pointermove",ot),window.addEventListener("pointerup",jt),window.addEventListener("pointercancel",jt)},[ss,Ie.height,Ie.top,Ie.visible,An]),Ar=async se=>{if(b)return;const Ne=await RP({files:se,body:ue,images:B});Ne&&(Se(Ne.body),a==null||a(n,Ne.body),l==null||l(n,Ne.images))},Fn=(se,Ne)=>{if(se.stopPropagation(),b)return;const et=B.filter(sn=>sn.id!==Ne.id),mt=PV(ue,Ne.label);Se(mt),a==null||a(n,mt),l==null||l(n,et)},mn=se=>{if(b)return;const Ne=TP(se);Ne.length!==0&&(se.preventDefault(),se.stopPropagation(),Ar(Ne).catch(()=>{}))},vn=se=>{if(b)return;const Ne=au(se);Ne.length!==0&&(se.preventDefault(),se.stopPropagation(),Ar(Ne).catch(()=>{}))},zn=()=>{const se=Q.current,Ne=te.current;!se||!Ne||(Ne.scrollTop=se.scrollTop,Ne.scrollLeft=se.scrollLeft)};return o.jsxs("div",{className:"af-flow-node"+(t?" af-flow-node--selected":"")+(g?" af-flow-node--executing":"")+(x==="success"?" af-flow-node--done":"")+(x==="failed"?" af-flow-node--failed":"")+(x==="running"&&!g?" af-flow-node--running-disk":"")+(k?" af-flow-node--dim":"")+(R?" af-flow-node--inline-body-editor":"")+(A?" af-flow-node--provide-text":"")+(W?" af-flow-node--provide-password":"")+" af-flow-node--"+h.replace(/[^a-z0-9_-]/g,""),"data-schema":h,children:[o.jsxs("div",{className:"af-flow-node__chrome",children:[o.jsx("span",{className:"af-flow-node__title af-flow-node__title--chrome",title:`${M}${n?` (${n})`:""}${y?` · ${y}`:""}`,children:M}),!w&&oe&&o.jsxs("div",{className:"af-flow-node__model-wrap nodrag",onPointerDown:Vt,onMouseDown:Vt,onClick:Vt,children:[o.jsxs("select",{className:"af-flow-node__model nodrag",value:kt,onChange:Z,onPointerDown:Vt,onMouseDown:Vt,onClick:Vt,"aria-label":p("flow:node.model"),title:Gt||p("flow:node.defaultModel"),disabled:b,children:[o.jsx("option",{value:"",children:p("flow:node.defaultModel")}),Bt&&o.jsx("option",{value:tt,children:tt}),rt.length>0&&o.jsx("optgroup",{label:"Cursor",children:rt.map(se=>o.jsx("option",{value:`cursor:${as(se)}`,children:as(se)},`c-${se}`))}),At.length>0&&o.jsx("optgroup",{label:"OpenCode",children:At.map(se=>o.jsx("option",{value:`opencode:${as(se)}`,children:as(se)},`o-${se}`))}),Kt.length>0&&o.jsx("optgroup",{label:"Codex",children:Kt.map(se=>o.jsx("option",{value:`codex:${as(se)}`,children:as(se)},`codex-${se}`))}),zt.length>0&&o.jsx("optgroup",{label:"Claude Code",children:zt.map(se=>o.jsx("option",{value:`claude-code:${as(se)}`,children:as(se)},`cc-${se}`))})]}),o.jsx("span",{className:"af-flow-node__model-arrow material-symbols-outlined",children:"expand_more"})]}),g&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--executing",children:"EXECUTING"}),x==="running"&&!g&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--running-disk",title:p("flow:node.diskRunning"),children:"RUNNING"}),x==="success"&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--done",children:S!=null&&String(S).trim()!==""?S:"--"}),x==="failed"&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--failed",children:"FAILED"}),!w&&j&&!E&&!A&&!O&&!W&&o.jsx("button",{type:"button",className:"af-flow-node__expand",onClick:$e,"aria-label":p("flow:node.expandProvide"),title:p("flow:node.expandProvide"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),!w&&o.jsx("button",{type:"button",className:"af-flow-node__delete",disabled:b,onClick:xe,"aria-label":p("flow:node.deleteNode"),title:p("flow:node.deleteNode"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-flow-node__body",children:[o.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--in",children:f.map((se,Ne)=>{if(se.showOnNode===!1)return null;const et=p("flow:node.inputTooltip",{name:se.name||`#${Ne}`,type:se.type})+(se.default!=null&&se.default!==""?p("flow:node.defaultSuffix",{value:se.default}):""),mt=se.name||`#${Ne+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:et,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--in",children:[mt,se.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(Ln,{type:"target",position:Oe.Left,id:`input-${Ne}`,className:"af-flow-node__handle",style:{background:wn(se.type)},title:et})]},`in-${Ne}`)})}),o.jsxs("div",{className:"af-flow-node__title-wrap",children:[E?o.jsxs("select",{className:"af-flow-node__bool-select nodrag"+(T?" af-flow-node__bool-select--true":""),value:T?"true":"false",onChange:Ee,onPointerDown:Vt,onMouseDown:Vt,onClick:Vt,"aria-label":"Boolean value",title:T?"true":"false",disabled:b,children:[o.jsx("option",{value:"false",children:"false"}),o.jsx("option",{value:"true",children:"true"})]}):A?o.jsx("textarea",{className:"af-flow-node__inline-text nodrag",value:ne,onChange:ut,onCompositionStart:St,onCompositionEnd:ir,onBlur:Er,onPointerDown:Vt,onMouseDown:Vt,onClick:Vt,placeholder:"输入文本",rows:2,readOnly:b}):O?o.jsxs("div",{className:"af-flow-node__file-value nodrag",onPointerDown:Vt,onMouseDown:Vt,onClick:Vt,children:[o.jsx("input",{className:"af-flow-node__file-input nodrag",value:ne,onChange:ut,onCompositionStart:St,onCompositionEnd:ir,onBlur:Er,placeholder:"选择或输入文件路径",title:ne||"选择或输入文件路径",readOnly:b}),o.jsx("button",{type:"button",className:"af-flow-node__file-picker nodrag",disabled:b,onClick:Xn,"aria-label":"选择文件",title:"选择文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"folder_open"})})]}):W?o.jsxs("div",{className:"af-flow-node__password-value nodrag",onPointerDown:Vt,onMouseDown:Vt,onClick:Vt,children:[o.jsx("input",{className:"af-flow-node__password-input nodrag",type:re?"text":"password",value:ne,onChange:ut,onCompositionStart:St,onCompositionEnd:ir,onBlur:Er,placeholder:"输入密码或密钥",title:re?ne:"密码已隐藏",autoComplete:"off",readOnly:b}),o.jsx("button",{type:"button",className:"af-flow-node__password-toggle nodrag",disabled:b,onClick:hn,"aria-label":re?"隐藏密码":"预览密码",title:re?"隐藏密码":"预览密码",children:o.jsx("span",{className:"material-symbols-outlined",children:re?"visibility_off":"visibility"})})]}):R?o.jsxs("div",{ref:$,className:"af-flow-node__prompt-stack nodrag"+(De?" af-flow-node__prompt-stack--composing":""),children:[o.jsx("pre",{ref:te,className:"af-flow-node__prompt-backdrop","aria-hidden":"true",dangerouslySetInnerHTML:{__html:IV(ue)+`
|
|
99
|
-
`}}),o.jsx("textarea",{ref:Q,className:"af-flow-node__prompt-editor nodrag",value:ue,onChange:_n,onCompositionStart:mr,onCompositionEnd:En,onBlur:Dn,onPaste:mn,onDrop:vn,onScroll:se=>{zn(),Pe()},onPointerDown:Vt,onMouseDown:Vt,onClick:Vt,onKeyDown:Vt,onDragOver:se=>{au(se).length>0&&se.preventDefault()},placeholder:D?"输入判断条件 / prompt":"输入 prompt",rows:2,readOnly:b}),!b&&o.jsx("button",{type:"button",className:"af-flow-node__prompt-expand nodrag",onPointerDown:Vt,onMouseDown:Vt,onClick:Qn,"aria-label":"放大编辑",title:"放大编辑",children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),o.jsx("div",{ref:ie,className:"af-flow-node__prompt-scrollbar"+(Ie.visible?" af-flow-node__prompt-scrollbar--visible":""),onPointerDown:or,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${Ie.height}%`,top:`${Ie.top}%`}})})]}):null,R&&B.length>0?o.jsx("div",{className:"af-flow-node__image-chips",children:B.map((se,Ne)=>o.jsxs("span",{className:"af-flow-node__image-chip",title:se.name,children:[o.jsx("img",{src:se.dataUrl,alt:""}),o.jsxs("span",{children:["[",se.label||`image ${Ne+1}`,"]"]}),o.jsx("button",{type:"button",className:"af-flow-node__image-remove nodrag",disabled:b,onClick:et=>Fn(et,se),onPointerDown:Vt,onMouseDown:Vt,"aria-label":`删除 ${se.label||`image ${Ne+1}`}`,title:"删除图片",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},se.id||Ne))}):null,I?o.jsx("span",{className:"af-flow-node__prompt-preview",title:I,children:I}):null,_?null:o.jsx("span",{className:"af-flow-node__body-title",title:M,children:M})]}),o.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--out",children:d.map((se,Ne)=>{if(se.showOnNode===!1)return null;const et=p("flow:node.outputTooltip",{name:se.name||`#${Ne}`,type:se.type})+(se.default!=null&&se.default!==""?p("flow:node.defaultSuffix",{value:se.default}):""),mt=se.name||`#${Ne+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:et,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--out",children:[mt,se.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(Ln,{type:"source",position:Oe.Right,id:`output-${Ne}`,className:"af-flow-node__handle",style:{background:wn(se.type)},title:et})]},`out-${Ne}`)})})]}),Et?Sr.createPortal(o.jsx("div",{className:"af-flow-node-full-editor nodrag",onPointerDown:Vt,onMouseDown:Vt,onClick:Vt,onWheel:Vt,children:o.jsxs("div",{className:"af-flow-node-full-editor__panel",children:[o.jsxs("div",{className:"af-flow-node-full-editor__header",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-flow-node-full-editor__title",children:M}),o.jsx("div",{className:"af-flow-node-full-editor__hint",children:"编辑 prompt,Esc 关闭"})]}),o.jsx("button",{type:"button",className:"af-flow-node-full-editor__close",onClick:Hr,"aria-label":"关闭",title:"关闭",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("textarea",{ref:he,className:"af-flow-node-full-editor__textarea",value:ue,onChange:_n,onCompositionStart:mr,onCompositionEnd:En,onPaste:mn,onDrop:vn,onKeyDown:gr,onDragOver:se=>{au(se).length>0&&se.preventDefault()},placeholder:D?"输入判断条件 / prompt":"输入 prompt",readOnly:b})]})}),document.body):null]})}const Nl="flowNode";function yx(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),e.description!=null&&(r.description=String(e.description)),r.showOnNode=n?!!e.showOnNode:!!r.required||String(t).trim().toLowerCase()==="node",r._showOnNodeExplicit=n,r}const MV={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","Load Workspace"],control_delay:["Delay"],control_if:["If Branch"],control_interval_loop:["Interval Loop"],control_load_skills:["Load Skills"],control_load_mcp:["Load MCP"],workspace_scheduled_run:["Scheduled Run"],workspace_run:["Run"],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_set_run_env:["Set Run Env","Set Env"],tool_display_share_link:["Display Share Link","Share Link"],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_password:["Password"],provide_bool:["Boolean"],provide_text:["Text"],provide_str:["Text"],display_markdown:["Markdown Display"],display_react_app:["React App"],display_mermaid:["Mermaid Display"],display_ascii:["ASCII Display"],display_chart:["Chart Display"],display_table:["Table Display"]};function $V(e,t,n){const r=String((n==null?void 0:n.displayName)||"").trim(),s=String(t||"").trim();return!r||!s||r===s?s:(MV[e]||[]).includes(s)?r:s}const LV={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"])},OV={control_cd_workspace:new Set(["mode","label","workspaceContext","cwd","previous"]),control_user_workspace:new Set(["cwd"]),display_markdown:new Set(["prev","next"]),display_mermaid:new Set(["prev","next"]),display_ascii:new Set(["prev","next"]),display_html:new Set(["prev","next"]),display_react_app:new Set(["prev","next"]),display_image:new Set(["prev","next"]),display_chart:new Set(["prev","next"]),display_table:new Set(["prev","next"]),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"])},DV={agent_subAgent:new Set(["knowledgeContext","skillsContext"])},FV=new Set(["display_markdown","display_mermaid","display_ascii","display_html","display_react_app","display_image","display_chart","display_table"]);function zV(e,t){if(!FV.has(String(e||"")))return!1;const n=String((t==null?void 0:t.name)||"");return n==="content"||n==="src"}function BV(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function HV(e,t){const n=String((e==null?void 0:e.baseDefinitionId)||"").trim();return n||t}function MP(e){const t=String(e??"");return/^[A-Za-z0-9_@%+=:,./-]+$/.test(t)?t:"'"+t.replace(/'/g,"'\\''")+"'"}function WV(e,t){const n=String((e==null?void 0:e.language)||"").trim().toLowerCase(),r=String(t||"").trim().toLowerCase();return n.includes("python")||r.endsWith(".py")?"python3":n.includes("shell")||n==="bash"||r.endsWith(".sh")||r.endsWith(".bash")?"bash":"node"}function VV(e){const t=String(e??"").trim();return t?t.includes("${")?t:MP(t):""}function KV(e){if(String((e==null?void 0:e.baseDefinitionId)||"").trim()!=="tool_nodejs")return"";const t=e!=null&&e.runtime&&typeof e.runtime=="object"?e.runtime:{},n=String(t.entry||"").trim().replace(/^\/+/,"");if(n){const r=String((e==null?void 0:e.packageDir)||"").trim().replace(/\/+$/,""),s=r?`${r}/${n}`:`\${flowDir}/${n}`,i=Array.isArray(t.args)?t.args.map(VV).filter(Boolean):[];return[WV(t,n),MP(s),...i].join(" ")}return String(t.command||"").trim()}function LN(e,t,n){return!Array.isArray(t)||!Array.isArray(n)||n.length===0?t:t.map((r,s)=>{var u,p,f;const i=n[s],l=n.find(d=>(d==null?void 0:d.name)&&d.name===r.name)||i;if(!l)return r;const c=r.showOnNode===!1&&l.showOnNode==null&&((u=LV[e])==null?void 0:u.has(r.name));return{...r,...r.required==null&&l.required!=null?{required:!!l.required}:{},...r.description==null&&l.description!=null?{description:String(l.description)}:{},...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&&zV(e,r)?{showOnNode:!0}:{},...(p=DV[e])!=null&&p.has(r.name)?{showOnNode:!0}:{},...(f=OV[e])!=null&&f.has(r.name)?{showOnNode:!1}:{}}})}function UV(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=yx(l);return{type:String(c.type||"node"),name:String(c.name??""),default:String(c.default??""),required:!!c.required,description:String(c.description??""),showOnNode:c.showOnNode!=null?c.showOnNode!==!1:!!c.required||String(c.type||"").trim().toLowerCase()==="node"}});return{inputs:r(t),outputs:r(n)}}function xx(e,t,n,r,s){var I,B,_,q,z,$,Q,te,ie,he,ne,ce,re,le,ue,Se,De,Ye,Ie,Je,Et,bt;const i=((I=e.data)==null?void 0:I.definitionId)||String(e.id).replace(/-\d+$/,""),a=n.find(Pe=>Pe.id===i),l=t[e.id];let c=[],u=[],p=((B=e.data)==null?void 0:B.label)??e.id,f,d,h,y,w;const b=!!l;l&&(Array.isArray(l.input)&&(c=l.input.map(yx)),Array.isArray(l.output)&&(u=l.output.map(yx)),l.label&&(p=String(l.label)),l.role&&typeof l.role=="string"&&(f=l.role),l.model!=null&&(d=String(l.model).trim()),l.body!=null&&(h=String(l.body)),Array.isArray(l.images)&&(y=l.images),l.script!=null&&(w=String(l.script)));const g=f??(typeof((_=e.data)==null?void 0:_.role)=="string"?e.data.role:"普通"),k=d??((q=e.data)==null?void 0:q.model)??void 0,x=(a==null?void 0:a.description)!=null?String(a.description).trim():"",S=x!==""?x:void 0,C=h??((z=e.data)==null?void 0:z.body)??"",j=Array.isArray(y)?y:Array.isArray(($=e.data)==null?void 0:$.images)?e.data.images:[],E=KV(a),A=w!==void 0?w:((Q=e.data)==null?void 0:Q.script)!=null?String(e.data.script):E,O=String(e.id),W=(te=r==null?void 0:r[s])==null?void 0:te[O],H=(ie=W==null?void 0:W.label)==null?void 0:ie.label,D=W==null?void 0:W.body,R=W==null?void 0:W.description;b||(c.length===0&&((he=a==null?void 0:a.inputs)!=null&&he.length)&&(c=a.inputs.map(Pe=>({...Pe}))),u.length===0&&((ne=a==null?void 0:a.outputs)!=null&&ne.length)&&(u=a.outputs.map(Pe=>({...Pe}))));const T=HV(a,(a==null?void 0:a.id)??i),V=(l==null?void 0:l.marketplaceRef)||((ce=e.data)==null?void 0:ce.marketplaceRef)||BV(a);if(T==="agent_subAgent"&&!u.some(Pe=>(Pe==null?void 0:Pe.name)==="result")){const Pe=(re=a==null?void 0:a.outputs)==null?void 0:re.find(rt=>(rt==null?void 0:rt.name)==="result");u=[...u,Pe?{...Pe}:{type:"text",name:"result",default:""}]}if(T==="agent_subAgent"&&!c.some(Pe=>(Pe==null?void 0:Pe.name)==="knowledgeContext")){const Pe=(le=a==null?void 0:a.inputs)==null?void 0:le.find(rt=>(rt==null?void 0:rt.name)==="knowledgeContext");c=[...c,Pe?{...Pe}:{type:"text",name:"knowledgeContext",default:"",showOnNode:!0}]}if((T==="display_markdown"||T==="display_mermaid"||T==="display_ascii"||T==="display_chart"||T==="display_table")&&!u.some(Pe=>(Pe==null?void 0:Pe.name)==="next")){const Pe=(ue=a==null?void 0:a.outputs)==null?void 0:ue.find(rt=>(rt==null?void 0:rt.name)==="next");u=[...u,Pe?{...Pe}:{type:"node",name:"next",default:""}]}if(T==="workspace_run"){if(!c.some(Pe=>(Pe==null?void 0:Pe.name)==="prev")){const Pe=(Se=a==null?void 0:a.inputs)==null?void 0:Se.find(rt=>(rt==null?void 0:rt.name)==="prev");c=[Pe?{...Pe}:{type:"node",name:"prev",default:""},...c]}if(!u.some(Pe=>(Pe==null?void 0:Pe.name)==="next")){const Pe=(De=a==null?void 0:a.outputs)==null?void 0:De.find(rt=>(rt==null?void 0:rt.name)==="next");u=[...u,Pe?{...Pe}:{type:"node",name:"next",default:""}]}}c=LN(T,c,a==null?void 0:a.inputs),u=LN(T,u,a==null?void 0:a.outputs),T.startsWith("provide_")&&u[0]&&String(u[0].default??u[0].value??"").trim()===""&&String(C).trim()!==""&&(u=u.map((Pe,rt)=>rt===0?{...Pe,default:C,value:C}:Pe));const F=$V(T,p,a),M=T==="tool_nodejs"||String(A).trim()!=="";return{...e,type:"flowNode",data:{...e.data,label:H||p,displayLabel:F,definitionDisplayName:a==null?void 0:a.displayName,definitionId:T,...V?{marketplaceRef:V}:{},...l!=null&&l.marketplacePackageId||(Ye=e.data)!=null&&Ye.marketplacePackageId||a!=null&&a.packageId?{marketplacePackageId:(l==null?void 0:l.marketplacePackageId)||((Ie=e.data)==null?void 0:Ie.marketplacePackageId)||(a==null?void 0:a.packageId)}:{},...l!=null&&l.marketplaceVersion||(Je=e.data)!=null&&Je.marketplaceVersion||a!=null&&a.version?{marketplaceVersion:(l==null?void 0:l.marketplaceVersion)||((Et=e.data)==null?void 0:Et.marketplaceVersion)||(a==null?void 0:a.version)}:{},schemaType:((bt=e.data)==null?void 0:bt.schemaType)??e.type??"agent",role:g,model:k,body:D||C,images:j,script:A,inputs:c,outputs:u,description:R||S,originalLabel:p,originalBody:C,...M?{script:A}:{}}}}function qV(e,t){const n=new Map(t.map(r=>[r.id,r]));return e.filter(r=>{var p,f,d,h;const s=n.get(r.source),i=n.get(r.target),a=((f=(p=s==null?void 0:s.data)==null?void 0:p.outputs)==null?void 0:f.length)??0,l=((h=(d=i==null?void 0:i.data)==null?void 0:d.inputs)==null?void 0:h.length)??0,c=r.sourceHandle?parseInt(String(r.sourceHandle).replace("output-",""),10):0,u=r.targetHandle?parseInt(String(r.targetHandle).replace("input-",""),10):0;return s&&i&&c>=0&&c<a&&u>=0&&u<l})}function ON(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 DN(e,t){return!Array.isArray(e)||!e[t]||e[t].showOnNode===!0?e:e.map((n,r)=>r===t?{...n,showOnNode:!0}:n)}function yg(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=ON(t==null?void 0:t.sourceHandle,"output"),i=ON(t==null?void 0:t.targetHandle,"input");let a=!1;const l=(e||[]).map(c=>{var u,p,f,d;if(c.id===n){const h=DN((u=c.data)==null?void 0:u.outputs,s);if(h!==((p=c.data)==null?void 0:p.outputs))return a=!0,{...c,data:{...c.data,outputs:h}}}if(c.id===r){const h=DN((f=c.data)==null?void 0:f.inputs,i);if(h!==((d=c.data)==null?void 0:d.inputs))return a=!0,{...c,data:{...c.data,inputs:h}}}return c});return a?l:e}function YV(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 FN(e){return e.key==="?"||e.key==="/"&&e.shiftKey}function GV(){return typeof navigator>"u"?!1:/Mac|iPhone|iPod|iPad/i.test(navigator.platform||navigator.userAgent||"")}function JV({children:e}){return o.jsx("kbd",{className:"af-kbd",children:e})}function js({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(JV,{children:t})]},n))})}function XV({open:e,onClose:t}){const{t:n}=_r(),r=m.useRef(null);if(m.useEffect(()=>{if(!e)return;const a=requestAnimationFrame(()=>{var l;return(l=r.current)==null?void 0:l.focus()});return()=>cancelAnimationFrame(a)},[e]),!e)return null;const i=GV()?"⌘":"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(js,{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(js,{keys:["?"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.jumpToNode")}),o.jsx(js,{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(js,{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(js,{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(js,{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(js,{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(js,{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(js,{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(js,{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(js,{keys:[i,"Shift","Z"]})]})]})]})]})]})})}function QV(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 ZV({open:e,onClose:t,onJump:n,nodes:r}){const{t:s}=_r(),[i,a]=m.useState(""),[l,c]=m.useState(0),u=m.useRef(null),p=m.useRef(null);m.useEffect(()=>{if(!e)return;a(""),c(0);const y=requestAnimationFrame(()=>{var w;return(w=u.current)==null?void 0:w.focus()});return()=>cancelAnimationFrame(y)},[e]);const f=m.useMemo(()=>{const y=(r||[]).map(g=>{var k,x,S;return{id:g.id,label:((k=g.data)==null?void 0:k.label)||"",definitionId:((x=g.data)==null?void 0:x.definitionId)||"",schemaType:((S=g.data)==null?void 0:S.schemaType)||""}}),w=i.trim(),b=y.map(g=>({e:g,s:QV(g,w)})).filter(g=>g.s>0);return b.sort((g,k)=>k.s-g.s||g.e.id.localeCompare(k.e.id)),b.slice(0,50).map(g=>g.e)},[r,i]);if(m.useEffect(()=>{l>=f.length&&c(0)},[f.length,l]),m.useEffect(()=>{var w;const y=(w=p.current)==null?void 0:w.querySelector(`[data-idx="${l}"]`);y&&y.scrollIntoView({block:"nearest"})},[l]),!e)return null;const d=y=>{const w=f[y];w&&(n(w.id),t())},h=y=>{if(y.key==="Escape"){y.preventDefault(),t();return}if(y.key==="ArrowDown"){y.preventDefault(),c(w=>Math.min(f.length-1,w+1));return}if(y.key==="ArrowUp"){y.preventDefault(),c(w=>Math.max(0,w-1));return}y.key==="Enter"&&(y.preventDefault(),d(l))};return o.jsx("div",{className:"af-jump-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&t()},children:o.jsxs("div",{className:"af-jump-panel",role:"dialog","aria-modal":"true","aria-label":s("flow:jumpPalette.title"),onMouseDown:y=>y.stopPropagation(),children:[o.jsxs("div",{className:"af-jump-panel__input-wrap",children:[o.jsx("span",{className:"af-jump-panel__icon material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{ref:u,type:"text",className:"af-jump-panel__input",placeholder:s("flow:jumpPalette.placeholder"),value:i,onChange:y=>{a(y.target.value),c(0)},onKeyDown:h,spellCheck:!1,autoComplete:"off"}),o.jsx("span",{className:"af-jump-panel__count",children:f.length})]}),f.length===0?o.jsx("div",{className:"af-jump-panel__empty",children:s("flow:jumpPalette.empty")}):o.jsx("ul",{ref:p,className:"af-jump-panel__list",role:"listbox",children:f.map((y,w)=>o.jsxs("li",{"data-idx":w,role:"option","aria-selected":w===l,className:"af-jump-panel__item"+(w===l?" af-jump-panel__item--active":""),onMouseEnter:()=>c(w),onMouseDown:b=>{b.preventDefault(),d(w)},children:[o.jsx("span",{className:"af-jump-panel__id",children:y.id}),y.label&&y.label!==y.id&&o.jsx("span",{className:"af-jump-panel__label",children:y.label}),y.definitionId&&o.jsx("span",{className:"af-jump-panel__tag",children:y.definitionId})]},y.id))}),o.jsxs("div",{className:"af-jump-panel__hint",children:[o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"↑"}),o.jsx("kbd",{className:"af-kbd",children:"↓"})," ",s("flow:jumpPalette.hintNavigate")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"Enter"})," ",s("flow:jumpPalette.hintJump")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"Esc"})," ",s("flow:jumpPalette.hintClose")]})]})]})})}function zN(e){const t=Number(e||0);if(!Number.isFinite(t)||t<=0)return"-";const n=new Date(t),r=s=>String(s).padStart(2,"0");return`${r(n.getMonth()+1)}-${r(n.getDate())} ${r(n.getHours())}:${r(n.getMinutes())}:${r(n.getSeconds())}`}function eK(e){const t=Number(e||0);if(!Number.isFinite(t)||t<=0)return"-";if(t<1e3)return`${Math.round(t)}ms`;const n=Math.round(t/1e3);if(n<60)return`${n}s`;const r=Math.floor(n/60),s=n%60;return`${r}m${String(s).padStart(2,"0")}s`}function BN(e){if(!e||typeof e!="object")return"";if(e.line)return String(e.line);if(e.text)return String(e.text);if(e.error)return String(e.error);if(e.message)return String(e.message);if(e.status)return String(e.status);if(e.type==="graph"){const n=Array.isArray(e.displayNodeIds)?e.displayNodeIds.join(", "):"";return n?`graph updated: ${n}`:"graph updated"}const t=JSON.stringify(e);return t.length>4e3?`${t.slice(0,4e3)}
|
|
100
|
-
... [truncated]`:t}function xg(e){return String((e==null?void 0:e.nodeId)||(e==null?void 0:e.runNodeId)||"")}function HN(e){const t=String(e||"").toLowerCase();return t.includes("success")?"success":t.includes("fail")||t.includes("error")?"failed":t.includes("skip")||t.includes("disabled")?"skipped":t.includes("running")?"running":t.includes("stop")?"stopped":"idle"}function tK({flowParams:e,scheduleNodeId:t="",runNodeId:n="",lastRunId:r="",label:s="",onClose:i}){const[a,l]=m.useState([]),[c,u]=m.useState(""),[p,f]=m.useState(null),[d,h]=m.useState(!1),[y,w]=m.useState(!1),[b,g]=m.useState(""),[k,x]=m.useState(""),S=m.useCallback(async()=>{if(e!=null&&e.flowId){h(!0),g("");try{const A=new URLSearchParams;A.set("flowId",e.flowId),A.set("flowSource",e.flowSource||"user"),t?A.set("scheduleNodeId",t):n&&A.set("runNodeId",n),A.set("limit","80");const O=await fetch(`/api/workspace/run-logs?${A.toString()}`),W=await O.json().catch(()=>({}));if(!O.ok)throw new Error(W.error||"读取日志失败");const H=Array.isArray(W.runs)?W.runs:[];l(H),u(D=>{const R=H[0]||null;return R&&String(R.status||"")==="running"&&R.runId!==D?R.runId:D&&H.some(T=>T.runId===D)?D:r&&H.some(T=>T.runId===r)?r:(R==null?void 0:R.runId)||""})}catch(A){g(String(A.message||A)),l([])}finally{h(!1)}}},[e==null?void 0:e.flowId,e==null?void 0:e.flowSource,r,n,t]),C=m.useCallback(async A=>{if(!A){f(null);return}w(!0);try{const O=await fetch(`/api/workspace/run-logs/${encodeURIComponent(A)}`),W=await O.json().catch(()=>({}));if(!O.ok)throw new Error(W.error||"读取日志详情失败");f(W)}catch(O){f({error:String(O.message||O),events:[]})}finally{w(!1)}},[]);m.useEffect(()=>{S()},[S]),m.useEffect(()=>{C(c)},[C,c]),m.useEffect(()=>{const A=a.find(W=>W.runId===c),O=window.setInterval(()=>{S(),(!A||A.status==="running")&&c&&C(c)},2e3);return()=>window.clearInterval(O)},[C,S,a,c]);const j=m.useMemo(()=>{const A=Array.isArray(p==null?void 0:p.events)?p.events:[],O=k.trim().toLowerCase();return O?A.filter(W=>String(W.type||"").toLowerCase().includes(O)||xg(W).toLowerCase().includes(O)||BN(W).toLowerCase().includes(O)):A},[p==null?void 0:p.events,k]),E=(p==null?void 0:p.run)||a.find(A=>A.runId===c)||null;return o.jsxs("div",{className:"af-work-run-logs",children:[o.jsxs("div",{className:"af-pipeline-drawer-head",children:[o.jsx("h2",{className:"af-pipeline-drawer-title",children:"执行日志"}),o.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:i,"aria-label":"关闭日志侧栏",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-run-logs__meta",children:[o.jsx("span",{children:s||t||n||"Workspace Run"}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>void S(),title:"刷新日志","aria-label":"刷新日志",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]}),b?o.jsx("div",{className:"af-work-run-logs__error",children:b}):null,o.jsxs("div",{className:"af-work-run-logs__body",children:[o.jsxs("div",{className:"af-work-run-logs__list",children:[o.jsx("div",{className:"af-work-run-logs__section-title",children:"最近执行"}),d?o.jsx("div",{className:"af-work-run-logs__empty",children:"Loading..."}):null,!d&&a.length===0?o.jsx("div",{className:"af-work-run-logs__empty",children:"暂无执行日志"}):null,a.map(A=>o.jsxs("button",{type:"button",className:"af-work-run-logs__run"+(A.runId===c?" af-work-run-logs__run--active":""),onClick:()=>u(A.runId),title:A.runId,children:[o.jsx("span",{className:`af-work-run-logs__status af-work-run-logs__status--${HN(A.status)}`,children:A.status||"unknown"}),o.jsx("span",{className:"af-work-run-logs__run-label",children:A.label||A.runNodeId||A.scheduleNodeId||"Workspace Run"}),o.jsx("span",{children:zN(A.startedAt)}),o.jsx("span",{children:eK(A.durationMs)})]},A.runId))]}),o.jsxs("div",{className:"af-work-run-logs__detail",children:[o.jsxs("div",{className:"af-work-run-logs__detail-head",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-work-run-logs__section-title",children:"详情"}),E!=null&&E.label?o.jsx("div",{className:"af-work-run-logs__detail-label",children:E.label}):null,o.jsx("div",{className:"af-work-run-logs__run-id",children:(E==null?void 0:E.runId)||"-"})]}),E?o.jsx("span",{className:`af-work-run-logs__status af-work-run-logs__status--${HN(E.status)}`,children:E.status}):null]}),o.jsxs("label",{className:"af-work-run-logs__search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{value:k,onChange:A=>x(A.target.value),placeholder:"搜索事件、节点、错误"})]}),y?o.jsx("div",{className:"af-work-run-logs__empty",children:"Loading..."}):null,p!=null&&p.error?o.jsx("div",{className:"af-work-run-logs__error",children:p.error}):null,!y&&!j.length?o.jsx("div",{className:"af-work-run-logs__empty",children:"暂无事件"}):null,o.jsx("div",{className:"af-work-run-logs__events",children:j.map((A,O)=>o.jsxs("div",{className:"af-work-run-logs__event",children:[o.jsx("span",{className:"af-work-run-logs__event-time",children:zN(A.ts)}),o.jsx("span",{className:"af-work-run-logs__event-type",children:A.type||"event"}),xg(A)?o.jsx("span",{className:"af-work-run-logs__event-node",children:xg(A)}):null,o.jsx("pre",{children:BN(A)})]},`${A.ts||O}-${O}`))})]})]})]})}function nK(e){let t=String(e||"").trim();const n=t.match(/```(?:json|jsx|tsx|javascript|js)?\s*\n?([\s\S]*?)```/i);if(n&&n[1])t=n[1].trim();else{const r=t.match(/```(?:json|jsx|tsx|javascript|js)?\s*\n?([\s\S]*)$/i);r&&r[1]&&(t=r[1].trim())}return t.replace(/```\s*$/g,"").trim()}function $P(e){const t=nK(e);if(!t)return{title:"React App",entry:"src/App.jsx",files:{"src/App.jsx":"export default function App() { return <main><h1>React App</h1><p>No project files yet.</p></main>; }"},inputs:{}};try{const n=JSON.parse(t);if(n&&typeof n=="object"&&!Array.isArray(n)){const r=n.files&&typeof n.files=="object"&&!Array.isArray(n.files)?n.files:{};return{title:String(n.title||n.name||"React App"),entry:String(n.entry||n.main||"src/App.jsx"),files:Object.fromEntries(Object.entries(r).map(([s,i])=>[String(s),String(i??"")])),packageJson:n.packageJson&&typeof n.packageJson=="object"?n.packageJson:null,inputs:n.inputs&&typeof n.inputs=="object"&&!Array.isArray(n.inputs)?n.inputs:{}}}}catch{}return{title:"React App",entry:"src/App.jsx",files:{"src/App.jsx":t},inputs:{}}}function rK(e){let t=String(e||"");return t=t.replace(/^\s*import\s+[^;]+;\s*$/gm,""),t=t.replace(/^\s*import\s+["'][^"']+["'];\s*$/gm,""),t=t.replace(/\bexport\s+default\s+function\s+([A-Za-z_$][\w$]*)\s*\(/g,"const __AgentFlowDefault = function $1("),t=t.replace(/\bexport\s+default\s+function\s*\(/g,"const __AgentFlowDefault = function App("),t=t.replace(/\bexport\s+default\s+class\s+([A-Za-z_$][\w$]*)\s+extends/g,"const __AgentFlowDefault = class $1 extends"),t=t.replace(/\bexport\s+default\s+class\s+extends/g,"const __AgentFlowDefault = class extends"),t=t.replace(/\bexport\s+default\s+(\([^)]*\)\s*=>)/g,"const __AgentFlowDefault = $1"),t=t.replace(/\bexport\s+default\s+([A-Za-z_$][\w$]*\s*=>)/g,"const __AgentFlowDefault = $1"),t=t.replace(/\bexport\s+default\s+([A-Za-z_$][\w$]*)\s*;?/g,"const __AgentFlowDefault = $1;"),t=t.replace(/\bexport\s+(const|let|var|function|class)\s+/g,"$1 "),t=t.replace(/^\s*export\s+\{[^}]+\};?\s*$/gm,""),t.trim()}function sK(e){return String(e).replace(/<\/script/gi,"<\\/script")}function Fh(e){const t=$P(e);return JSON.stringify({title:t.title,entry:t.entry,packageJson:t.packageJson||{scripts:{dev:"vite --host 0.0.0.0",build:"vite build"},dependencies:{"@vitejs/plugin-react":"latest",vite:"latest",react:"latest","react-dom":"latest"},devDependencies:{}},files:t.files,inputs:t.inputs},null,2)}function xb(e,t=""){const n=$P(e),r=n.files||{},s=r[n.entry]!=null?n.entry:Object.keys(r).find(d=>/(?:^|\/)App\.[jt]sx$/i.test(d))||Object.keys(r).find(d=>/\.[jt]sx?$/i.test(d))||n.entry,i=rK(r[s]||""),a=Object.entries(r).filter(([d])=>/\.css$/i.test(d)).map(([,d])=>String(d||"")).join(`
|
|
101
|
-
|
|
102
|
-
`),l=String(n.title||"React App"),c=JSON.stringify(String(t||"")),u=JSON.stringify(n.inputs||{}),p=sK(i||"function App() { return <main><h1>React App</h1><p>No entry file content.</p></main>; }"),f=a||`
|
|
103
|
-
* { box-sizing: border-box; }
|
|
104
|
-
body { margin: 0; min-height: 100vh; background: #111112; color: #f4f0ff; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
|
|
105
|
-
main { min-height: 100vh; padding: 24px; }
|
|
106
|
-
button, input, select, textarea { font: inherit; }
|
|
107
|
-
`;return`<!doctype html>
|
|
108
|
-
<html>
|
|
109
|
-
<head>
|
|
110
|
-
<meta charset="utf-8" />
|
|
111
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
112
|
-
<base target="_blank" />
|
|
113
|
-
<title>${l.replace(/[<&>]/g,d=>({"<":"<",">":">","&":"&"})[d])}</title>
|
|
114
|
-
<style>${f.replace(/<\/style/gi,"<\\/style")}</style>
|
|
115
|
-
</head>
|
|
116
|
-
<body>
|
|
117
|
-
<div id="root"></div>
|
|
118
|
-
<script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"><\/script>
|
|
119
|
-
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"><\/script>
|
|
120
|
-
<script crossorigin src="https://unpkg.com/@babel/standalone/babel.min.js"><\/script>
|
|
121
|
-
<script>
|
|
122
|
-
window.AGENTFLOW_INPUTS = ${u};
|
|
123
|
-
window.addEventListener("error", (event) => {
|
|
124
|
-
const root = document.getElementById("root");
|
|
125
|
-
if (root && !root.__agentflowRendered) {
|
|
126
|
-
root.innerHTML = '<pre style="margin:16px;padding:16px;border:1px solid rgba(255,117,117,.35);border-radius:8px;background:rgba(127,29,29,.18);color:#ffb8b8;white-space:pre-wrap;">' + String(event.message || event.error || 'React app failed').replace(/[<>&]/g, (ch) => ({'<':'<','>':'>','&':'&'}[ch])) + '</pre>';
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
document.addEventListener("click", (event) => {
|
|
130
|
-
const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
|
|
131
|
-
if (!link) return;
|
|
132
|
-
const rawHref = String(link.getAttribute("href") || "").trim();
|
|
133
|
-
if (!rawHref || rawHref.startsWith("#")) return;
|
|
134
|
-
if (/^javascript:/i.test(rawHref)) {
|
|
135
|
-
event.preventDefault();
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
event.preventDefault();
|
|
139
|
-
window.open(link.href, "_blank", "noopener,noreferrer");
|
|
140
|
-
}, true);
|
|
141
|
-
<\/script>
|
|
142
|
-
<script type="text/babel">
|
|
143
|
-
const { useCallback, useEffect, useMemo, useRef, useState } = React;
|
|
144
|
-
${p}
|
|
145
|
-
const RootComponent = typeof __AgentFlowDefault !== "undefined" ? __AgentFlowDefault : (typeof App !== "undefined" ? App : function MissingApp() {
|
|
146
|
-
return <main><h1>React App</h1><p>Entry file must export or define an App component.</p></main>;
|
|
147
|
-
});
|
|
148
|
-
ReactDOM.createRoot(document.getElementById("root")).render(<RootComponent inputs={window.AGENTFLOW_INPUTS} />);
|
|
149
|
-
document.getElementById("root").__agentflowRendered = true;
|
|
150
|
-
<\/script>
|
|
151
|
-
<script>
|
|
152
|
-
(() => {
|
|
153
|
-
const frameId = ${c};
|
|
154
|
-
const postSize = () => {
|
|
155
|
-
const doc = document.documentElement;
|
|
156
|
-
const body = document.body;
|
|
157
|
-
const height = Math.ceil(Math.max(
|
|
158
|
-
doc ? doc.scrollHeight : 0,
|
|
159
|
-
doc ? doc.offsetHeight : 0,
|
|
160
|
-
doc ? doc.clientHeight : 0,
|
|
161
|
-
body ? body.scrollHeight : 0,
|
|
162
|
-
body ? body.offsetHeight : 0,
|
|
163
|
-
body ? body.clientHeight : 0,
|
|
164
|
-
window.innerHeight || 0
|
|
165
|
-
));
|
|
166
|
-
window.parent.postMessage({ source: "agentflow-html-display-size", frameId, height }, "*");
|
|
167
|
-
};
|
|
168
|
-
window.addEventListener("load", postSize);
|
|
169
|
-
window.addEventListener("resize", postSize);
|
|
170
|
-
requestAnimationFrame(postSize);
|
|
171
|
-
setTimeout(postSize, 300);
|
|
172
|
-
setTimeout(postSize, 1000);
|
|
173
|
-
if (typeof ResizeObserver !== "undefined") {
|
|
174
|
-
const resizeObserver = new ResizeObserver(postSize);
|
|
175
|
-
resizeObserver.observe(document.documentElement);
|
|
176
|
-
if (document.body) resizeObserver.observe(document.body);
|
|
177
|
-
}
|
|
178
|
-
})();
|
|
179
|
-
<\/script>
|
|
180
|
-
</body>
|
|
181
|
-
</html>`}const LP=new Set(["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"]),iK=["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"];function oK(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 aK(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 WN(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 OP(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(LP.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 DP(e){return{inputNames:WN(e==null?void 0:e.inputs),outputNames:WN(e==null?void 0:e.outputs)}}function lK(e,t,n){const r=DP(t),s=aK(e),i=[];for(const a of s)if(!OP(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=DP(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=OP(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 uK(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function dK(e){return e.map(t=>{const n=uK(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 fK(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 iK)LP.has(r)&&n.push({section:"runtime",insert:r,label:r,subtitle:t("flow:placeholder.runtimeConst")});return n}function pK(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 hK(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),u=Number.isFinite(c)&&c>0?c:l.height||16;return document.body.removeChild(s),{top:l.top,left:l.left,bottom:l.bottom,height:u}}function yf({value:e,onChange:t,disabled:n,placeholder:r,rows:s=8,textareaClassName:i,ioSlots:a,variant:l="drawer",images:c,onImagesChange:u}){const{t:p}=_r(),f=m.useId(),d=m.useRef(null),h=m.useRef(null),[y,w]=m.useState(0),[b,g]=m.useState(0),[k,x]=m.useState(null),S=m.useMemo(()=>Fi(c),[c]),C=m.useMemo(()=>lK(e,a,p),[e,a,p]),j=C.length>0,E=m.useMemo(()=>cK(e,a),[e,a]),A=m.useMemo(()=>dK(E),[E]),O=m.useMemo(()=>n?null:oK(e,y),[e,y,n]),W=m.useMemo(()=>{if(!O)return[];const F=fK(a,p);return pK(F,O.query)},[O,a,p]);m.useEffect(()=>{g(F=>{const M=Math.max(0,W.length-1);return Math.min(Math.max(0,F),M)})},[W.length]);const H=m.useCallback(()=>{const F=d.current;if(!F||!O||W.length===0){x(null);return}const M=hK(F,y);if(!M){x(null);return}const I=4,B=44,_=13.5*16,q=Math.min(W.length*B+8,_);let z=M.bottom+I;z+q>window.innerHeight-8&&(z=Math.max(8,M.top-q-I));const $=288;let Q=M.left;Q=Math.max(8,Math.min(Q,window.innerWidth-$-8)),x({top:z,left:Q})},[O,W.length,y]);m.useLayoutEffect(()=>{if(!O||W.length===0){x(null);return}const F=requestAnimationFrame(()=>H());return()=>cancelAnimationFrame(F)},[O,W.length,y,e,H]),m.useEffect(()=>{if(!O||W.length===0)return;const F=()=>H();return window.addEventListener("scroll",F,!0),window.addEventListener("resize",F),()=>{window.removeEventListener("scroll",F,!0),window.removeEventListener("resize",F)}},[O,W.length,H]);const D=m.useCallback(F=>{if(!O)return;const{atIndex:M}=O,I=e.slice(0,M)+"${"+F+"}"+e.slice(y);t(I);const B=M+F.length+3;queueMicrotask(()=>{const _=d.current;_&&(_.focus(),_.setSelectionRange(B,B)),w(B)})},[O,e,y,t]),R=m.useCallback(()=>{const F=d.current,M=h.current;!F||!M||(M.scrollTop=F.scrollTop,M.scrollLeft=F.scrollLeft,O&&W.length>0&&queueMicrotask(()=>H()))},[O,W.length,H]),T=m.useCallback(F=>{if(!n&&O&&W.length>0&&(F.key==="ArrowDown"||F.key==="ArrowUp"||F.key==="Enter")){if(F.key==="ArrowDown")F.preventDefault(),g(M=>(M+1)%W.length);else if(F.key==="ArrowUp")F.preventDefault(),g(M=>(M-1+W.length)%W.length);else if(F.key==="Enter"&&!F.shiftKey){F.preventDefault();const M=W[b];M&&D(M.insert)}}},[n,O,W,b,D]),V=m.useCallback(async F=>{if(n||typeof u!="function")return!1;const M=await RP({files:F,body:e,images:S});return M?(t(M.body),u(M.images),queueMicrotask(()=>{const I=d.current;if(!I)return;I.focus();const B=M.body.length;I.setSelectionRange(B,B),w(B)}),!0):!1},[n,S,t,u,e]);return o.jsxs("div",{className:"af-body-prompt-editor"+(l==="expand"?" af-body-prompt-editor--expand":""),children:[S.length>0?o.jsx("div",{className:"af-body-image-list","aria-label":"image attachments",children:S.map((F,M)=>o.jsxs("span",{className:"af-body-image-chip",title:F.name,children:[o.jsx("img",{src:F.dataUrl,alt:""}),o.jsxs("span",{children:["[",F.label||`image ${M+1}`,"]"]})]},F.id||M))}):null,o.jsxs("div",{className:"af-body-prompt-stack",children:[o.jsx("pre",{ref:h,className:"af-body-prompt-backdrop "+i,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:A+`
|
|
182
|
-
`}}),o.jsx("textarea",{ref:d,className:"af-body-prompt-textarea "+i,rows:s,value:e,disabled:n,placeholder:r,spellCheck:!1,"aria-invalid":j,"aria-describedby":j?f:void 0,onChange:F=>{t(F.target.value),w(F.target.selectionStart??F.target.value.length)},onSelect:F=>{const M=F.target;M instanceof HTMLTextAreaElement&&w(M.selectionStart??0)},onClick:F=>{const M=F.target;M instanceof HTMLTextAreaElement&&w(M.selectionStart??0)},onKeyUp:F=>{const M=F.target;M instanceof HTMLTextAreaElement&&w(M.selectionStart??M.value.length)},onKeyDown:T,onPaste:F=>{const M=TP(F);M.length!==0&&(F.preventDefault(),V(M).catch(()=>{}))},onDragOver:F=>{au(F).length>0&&F.preventDefault()},onDrop:F=>{const M=au(F);M.length!==0&&(F.preventDefault(),V(M).catch(()=>{}))},onScroll:R})]}),O&&W.length>0&&k?Sr.createPortal(o.jsx("ul",{className:"af-body-ph-menu af-body-ph-menu--pop af-composer-mention-menu",role:"listbox","aria-label":p("flow:nodeProps.placeholderSlots"),style:{position:"fixed",top:k.top,left:k.left,right:"auto",bottom:"auto",margin:0,zIndex:2e4},children:W.map((F,M)=>o.jsx("li",{role:"option","aria-selected":M===b,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+(M===b?" af-composer-mention-item--active":""),onMouseDown:I=>I.preventDefault(),onMouseEnter:()=>g(M),onClick:()=>D(F.insert),children:[o.jsx("span",{className:"af-composer-mention-id",children:`\${${F.insert}}`}),F.subtitle?o.jsx("span",{className:"af-composer-mention-sub",children:F.subtitle}):null]})},`${F.section}-${F.insert}`))}),document.body):null,j?o.jsx("p",{id:f,className:"af-body-ph-issues",role:"status",children:C.map(F=>F.message).join(" · ")}):null]})}const mK=/^[a-zA-Z_][a-zA-Z0-9_-]*$/;function Ac(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function VN({kind:e,label:t,slots:n,onSlotsChange:r,disabled:s,requiredReadonly:i=!0}){const{t:a}=_r(),l=()=>r([...n,{type:"text",name:"",default:"",required:!1,showOnNode:!1}]),c=f=>r(n.filter((d,h)=>h!==f)),u=(f,d,h)=>{const y=n.map((w,b)=>{if(b!==f)return w;const g={...w,[d]:h};return d==="required"&&h===!0&&(g.showOnNode=!0),g});r(y)},p=e==="input"?"input":"output";return o.jsxs("div",{className:"af-node-props-field af-node-props-field--io",children:[o.jsxs("div",{className:"af-node-props-io-head",children:[o.jsx("span",{className:"af-node-props-label",children:t}),o.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-io-add",onClick:l,disabled:s,"aria-label":a("flow:nodeProps.addPinAriaLabel",{label:t}),children:a("flow:nodeProps.addPin")})]}),o.jsx("p",{className:"af-node-props-io-hint",children:a("flow:nodeProps.handleHint",{prefix:p})}),n.length===0?o.jsx("p",{className:"af-node-props-io-empty",children:a(e==="input"?"flow:nodeProps.noInputPins":"flow:nodeProps.noOutputPins")}):null,n.length>0?o.jsxs("div",{className:"af-node-props-io-table",role:"group","aria-label":t,children:[o.jsxs("div",{className:"af-node-props-io-table-head","aria-hidden":!0,children:[o.jsx("span",{children:a("flow:nodeProps.handle")}),o.jsx("span",{children:a("flow:nodeProps.type")}),o.jsx("span",{children:a("flow:nodeProps.name")}),o.jsx("span",{children:a("flow:nodeProps.defaultValue")}),o.jsx("span",{children:a("flow:nodeProps.description")}),o.jsx("span",{children:a("flow:nodeProps.required")}),o.jsx("span",{children:a("flow:nodeProps.showOnNode")}),o.jsx("span",{})]}),n.map((f,d)=>o.jsxs("div",{className:"af-node-props-io-row",children:[o.jsxs("span",{className:"af-node-props-io-handle",title:`${p}-${d}`,children:[p,"-",d]}),o.jsx("select",{className:"af-node-props-input af-node-props-io-cell",value:f.type,onChange:h=>u(d,"type",h.target.value),disabled:s,"aria-label":a("flow:nodeProps.pinTypeAriaLabel",{label:t,index:d}),children:["node","text","file","bool"].map(h=>o.jsx("option",{value:h,children:h},h))}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:f.name,onChange:h=>u(d,"name",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinNameAriaLabel",{label:t,index:d})}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:f.default,onChange:h=>u(d,"default",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinDefaultAriaLabel",{label:t,index:d})}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:f.description||"",onChange:h=>u(d,"description",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinDescriptionAriaLabel",{label:t,index:d})}),o.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.requiredHint"),children:o.jsx("input",{type:"checkbox",checked:!!f.required,onChange:h=>{i||u(d,"required",h.target.checked)},disabled:s||i,"aria-label":a("flow:nodeProps.pinRequiredAriaLabel",{label:t,index:d})})}),o.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.showOnNodeHint"),children:o.jsx("input",{type:"checkbox",checked:f.showOnNode!==!1,onChange:h=>u(d,"showOnNode",h.target.checked),disabled:s,"aria-label":a("flow:nodeProps.pinShowOnNodeAriaLabel",{label:t,index:d})})}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-io-remove",onClick:()=>c(d),disabled:s,"aria-label":a("flow:nodeProps.deletePinAriaLabel",{label:t,index:d}),title:a("flow:nodeProps.deletePin"),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},`${p}-${d}`))]}):null]})}function gK({draft:e,setDraft:t,definitionId:n,systemPromptReadonly:r,modelLists:s,disabled:i,onIdBlur:a,onClose:l,onPublishToMarketplace:c,allowEditRequiredPins:u=!1,error:p,ioSlots:f}){const{t:d}=_r(),[h,y]=m.useState(!1),[w,b]=m.useState(!1),[g,k]=m.useState({status:"idle",message:""}),x=m.useCallback(R=>{t(T=>T&&{...T,...R})},[t]),{cursorList:S,opencodeList:C,claudeCodeList:j,codexList:E,currentNotInLists:A}=m.useMemo(()=>{const R=Array.isArray(s==null?void 0:s.cursor)?s.cursor:[],T=Array.isArray(s==null?void 0:s.opencode)?s.opencode:[],V=Array.isArray(s==null?void 0:s.claudeCode)?s.claudeCode:[],F=Array.isArray(s==null?void 0:s.codex)?s.codex:[],M=new Set([...R,...T,...V,...F].map(Ac)),I=((e==null?void 0:e.model)??"").trim(),B=I.startsWith("cursor:")?I.slice(7):I.startsWith("opencode:")?I.slice(9):I.startsWith("codex:")?I.slice(6):I.startsWith("claude-code:")?I.slice(12):I,_=I&&!M.has(B)?I:"";return{cursorList:R,opencodeList:T,claudeCodeList:V,codexList:F,currentNotInLists:_}},[s,e==null?void 0:e.model]);if(!e)return null;const O=String(e.script??""),W=n==="tool_nodejs"||O.trim()!=="",H=typeof c=="function"&&!i&&(e==null?void 0:e.newId),D=async()=>{if(H){k({status:"running",message:d("flow:nodeProps.publishRunning")});try{const R=await c(e,n);k({status:"success",message:R!=null&&R.definitionId?d("flow:nodeProps.publishSuccessWithId",{id:R.definitionId}):d("flow:nodeProps.publishSuccess")})}catch(R){k({status:"error",message:String((R==null?void 0:R.message)||R)})}}};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-pipeline-drawer-head af-node-props-head",children:[o.jsx("h2",{className:"af-pipeline-drawer-title",children:d("flow:nodeProps.title")}),o.jsxs("div",{className:"af-node-props-head-actions",children:[o.jsxs("button",{type:"button",className:"af-btn-ghost af-node-props-market-btn",onClick:D,disabled:!H||g.status==="running",title:d("flow:nodeProps.publishToMarketplaceHint"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"inventory_2"}),g.status==="running"?d("flow:nodeProps.publishing"):d("flow:nodeProps.publishToMarketplace")]}),o.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-close-secondary",onClick:l,children:d("common:common.close")})]})]}),o.jsxs("div",{className:"af-pipeline-drawer-body af-node-props-body",children:[p?o.jsx("p",{className:"af-err af-node-props-err",children:p}):null,g.message?o.jsx("p",{className:`af-node-props-market-status af-node-props-market-status--${g.status}`,children:g.message}):null,o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:d("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:[d("flow:nodeProps.instanceId"),o.jsx("span",{className:"af-node-props-hint",children:d("flow:node.displayNameHint")})]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.newId,onChange:R=>x({newId:R.target.value}),onBlur:a,disabled:i,spellCheck:!1,autoComplete:"off","aria-label":d("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:[d("flow:node.displayName"),"(LABEL)"]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.label,onChange:R=>x({label:R.target.value}),disabled:i,spellCheck:!1})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[d("flow:node.role"),"(ROLE)"]}),o.jsx("select",{className:"af-node-props-select",value:Fu.includes(e.role)?e.role:d("flow:roles.normal"),onChange:R=>x({role:R.target.value}),disabled:i,children:Fu.map(R=>o.jsx("option",{value:R,children:R},R))})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[d("flow:node.model"),"(MODEL)"]}),o.jsx("span",{className:"af-node-props-sublabel",children:d("flow:node.modelHint")}),o.jsxs("select",{className:"af-node-props-select",value:(()=>{const R=(e.model||"").trim();return R?A||R:""})(),onChange:R=>x({model:R.target.value}),disabled:i,"aria-label":d("flow:nodeProps.modelAriaLabel"),children:[o.jsx("option",{value:"",children:d("flow:node.defaultModel")}),A?o.jsxs("option",{value:A,children:[A,d("flow:nodeProps.yamlValueNotInList")]}):null,S.length>0?o.jsx("optgroup",{label:"Cursor",children:S.map(R=>o.jsx("option",{value:Ac(R),children:R},`c-${R}`))}):null,C.length>0?o.jsx("optgroup",{label:"OpenCode",children:C.map(R=>o.jsx("option",{value:`opencode:${Ac(R)}`,children:R},`o-${R}`))}):null,E.length>0?o.jsx("optgroup",{label:"Codex",children:E.map(R=>o.jsx("option",{value:`codex:${Ac(R)}`,children:R},`codex-${R}`))}):null,j.length>0?o.jsx("optgroup",{label:"Claude Code",children:j.map(R=>o.jsx("option",{value:`claude-code:${Ac(R)}`,children:R},`cc-${R}`))}):null]})]}),o.jsx(VN,{kind:"input",label:d("flow:nodeProps.inputPins"),slots:Array.isArray(e.inputs)?e.inputs:[],onSlotsChange:R=>x({inputs:R}),disabled:i,requiredReadonly:!u}),o.jsx(VN,{kind:"output",label:d("flow:nodeProps.outputPins"),slots:Array.isArray(e.outputs)?e.outputs:[],onSlotsChange:R=>x({outputs:R}),disabled:i,requiredReadonly:!u}),W?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:[d("flow:node.directCommand"),"(script)",o.jsx("span",{className:"af-node-props-hint",children:d("flow:node.scriptHint")})]}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>b(!0),"aria-label":d("flow:nodeProps.expandEditScript"),title:d("flow:nodeProps.expand"),disabled:i,children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(yf,{value:O,onChange:R=>x({script:R}),disabled:i,placeholder:d("flow:nodeProps.scriptPlaceholder"),rows:6,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea af-node-props-script-textarea",ioSlots:f,variant:"drawer"})]}):null,o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:"Script file(scriptRef)"}),o.jsxs("span",{className:"af-node-props-sublabel",children:["Relative path under this flow, for example nodes/",e.id,"/script.mjs"]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.scriptRef||"",onChange:R=>x({scriptRef:R.target.value}),disabled:i,spellCheck:!1,autoComplete:"off"})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:"Implementation file(implementationRef)"}),o.jsxs("span",{className:"af-node-props-sublabel",children:["Relative path under this flow, for example nodes/",e.id,"/implementation.md"]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.implementationRef||"",onChange:R=>x({implementationRef:R.target.value}),disabled:i,spellCheck:!1,autoComplete:"off"})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:"Implementation mode"}),o.jsxs("select",{className:"af-node-props-select",value:e.implementationMode||"",onChange:R=>x({implementationMode:R.target.value}),disabled:i,children:[o.jsx("option",{value:"",children:"auto"}),o.jsx("option",{value:"script",children:"script"}),o.jsx("option",{value:"steps",children:"steps"}),o.jsx("option",{value:"hybrid",children:"hybrid"})]})]}),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:d("flow:node.userPrompt")}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>y(!0),"aria-label":d("flow:nodeProps.expandEdit"),title:d("flow:nodeProps.expand"),disabled:i,children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(yf,{value:e.body,onChange:R=>x({body:R}),images:e.images,onImagesChange:R=>x({images:R}),disabled:i,placeholder:d("flow:nodeProps.bodyPlaceholder"),rows:8,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea",ioSlots:f,variant:"drawer"})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:d("flow:node.systemDescription")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea af-node-props-system-readonly",rows:4,readOnly:!0,value:r||d("flow:nodeProps.noDescription"),spellCheck:!1})]})]}),w?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":d("flow:nodeProps.editScript"),onMouseDown:R=>{R.target===R.currentTarget&&b(!1)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:d("flow:node.directCommand")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>b(!1),"aria-label":d("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx(yf,{value:O,onChange:R=>x({script:R}),disabled:i,placeholder:d("flow:nodeProps.scriptPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:f,variant:"expand"})]})}):null,h?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":d("flow:nodeProps.editUserPrompt"),onMouseDown:R=>{R.target===R.currentTarget&&y(!1)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:d("flow:node.body")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>y(!1),"aria-label":d("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx(yf,{value:e.body,onChange:R=>x({body:R}),images:e.images,onImagesChange:R=>x({images:R}),disabled:i,placeholder:d("flow:nodeProps.bodyPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:f,variant:"expand"})]})}):null]})}function yK({open:e,onClose:t,flowId:n,flowSource:r,onArchived:s}){const{t:i}=_r(),a=m.useId(),l=m.useRef(null),[c,u]=m.useState(""),[p,f]=m.useState(!1),[d,h]=m.useState("");if(m.useEffect(()=>{if(!e)return;u(""),h(""),f(!1);const g=requestAnimationFrame(()=>{var k;return(k=l.current)==null?void 0:k.focus()});return()=>cancelAnimationFrame(g)},[e,n]),!e)return null;const y=c.trim(),w=y===n;async function b(g){if(g.preventDefault(),!(!w||p)){f(!0),h("");try{const k=await fetch("/api/flow/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:y})}),x=await k.json().catch(()=>({}));if(!k.ok){h(typeof x.error=="string"?x.error:i("project:archiveModal.archiveFailed"));return}s()}catch(k){h(String((k==null?void 0:k.message)||k))}finally{f(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&t()},children:o.jsxs("div",{ref:l,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":a,tabIndex:-1,onMouseDown:g=>g.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:a,className:"af-shortcuts-panel__title",children:i("project:archiveModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":i("project:archiveModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:b,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:i("project:archiveModal.lead",{flowId:n})}),o.jsxs("label",{className:"af-new-pipeline-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:i("project:archiveModal.confirmLabel")}),o.jsx("input",{type:"text",className:"af-new-pipeline-input",value:c,onChange:g=>u(g.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":y.length>0&&!w})]}),d?o.jsx("p",{className:"af-err af-new-pipeline-err",children:d}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:p,children:i("project:archiveModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!w||p,children:i(p?"project:archiveModal.archiving":"project:archiveModal.confirmArchive")})]})]})]})})}function xK({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,onDeleted:i}){const{t:a}=_r(),l=m.useId(),c=m.useRef(null),[u,p]=m.useState(""),[f,d]=m.useState(!1),[h,y]=m.useState("");if(m.useEffect(()=>{if(!e)return;p(""),y(""),d(!1);const k=requestAnimationFrame(()=>{var x;return(x=c.current)==null?void 0:x.focus()});return()=>cancelAnimationFrame(k)},[e,n]),!e)return null;const w=u.trim(),b=w===n;async function g(k){if(k.preventDefault(),!b||f)return;d(!0),y("");let x=null;try{const S=new AbortController;x=setTimeout(()=>S.abort(),15e3);const C=await fetch("/api/flow/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:w,flowArchived:s}),signal:S.signal}),j=await C.json().catch(()=>({}));if(!C.ok){y(typeof j.error=="string"?j.error:a("project:deleteModal.deleteFailed"));return}try{for(let E=localStorage.length-1;E>=0;E--){const A=localStorage.key(E);A&&(A.startsWith(`af:composer-sessions:${n}:${r}`)||A.startsWith(`af:composer-active-session:${n}:${r}`)||A.startsWith(`af:workspace-composer:${n}:${r}`))&&localStorage.removeItem(A)}}catch{}await i()}catch(S){if((S==null?void 0:S.name)==="AbortError"){y(a("project:deleteModal.deleteTimeout"));return}y(String((S==null?void 0:S.message)||S))}finally{x&&clearTimeout(x),d(!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:g,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:a("project:deleteModal.lead",{flowId:n})}),o.jsxs("label",{className:"af-new-pipeline-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:a("project:deleteModal.confirmLabel")}),o.jsx("input",{type:"text",className:"af-new-pipeline-input",value:u,onChange:k=>p(k.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":w.length>0&&!b})]}),h?o.jsx("p",{className:"af-err af-new-pipeline-err",children:h}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:f,children:a("project:deleteModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary af-btn-destructive",disabled:!b||f,children:a(f?"project:deleteModal.deleting":"project:deleteModal.confirmDelete")})]})]})]})})}const KN=80,wK=220;function bK(e){if(!e||typeof e!="object")return e;const{selected:t,dragging:n,resizing:r,className:s,positionAbsolute:i,measured:a,internals:l,...c}=e;return c}function kK(e){if(!e||typeof e!="object")return e;const{selected:t,className:n,...r}=e;return r}function xf(e,t,n){const r={nodes:Array.isArray(e)?e.map(bK):[],edges:Array.isArray(t)?t.map(kK):[],extra:n&&typeof n=="object"?n:{}},s=JSON.stringify(r);return{value:JSON.parse(s),signature:s}}function wg(e,t){const n=[...e,t];return n.length>KN?n.slice(n.length-KN):n}function vK({nodes:e,edges:t,extra:n,enabled:r=!0,onRestore:s}){const[i,a]=m.useState(0),l=m.useRef([]),c=m.useRef([]),u=m.useRef(null),p=m.useRef(null),f=m.useRef(null),d=m.useRef(null),h=m.useRef(!1),y=m.useCallback(()=>a(C=>C+1),[]),w=m.useCallback(()=>{d.current&&(window.clearTimeout(d.current),d.current=null)},[]),b=m.useCallback(()=>{w();const C=p.current,j=f.current;return p.current=null,f.current=null,!C||!j||C.signature===j.signature?(j&&(u.current=j),!1):(l.current=wg(l.current,C),c.current=[],u.current=j,y(),!0)},[y,w]),g=m.useCallback((C=[],j=[],E={})=>{w(),l.current=[],c.current=[],p.current=null,f.current=null,u.current=xf(C,j,E),h.current=!1,y()},[y,w]),k=m.useCallback(C=>{h.current=!0,u.current=C,p.current=null,f.current=null,w(),s==null||s(C.value),y()},[y,w,s]),x=m.useCallback(()=>{b();const C=u.current||xf(e,t,n),j=l.current.pop();return j?(c.current=wg(c.current,C),k(j),!0):(y(),!1)},[y,t,n,b,e,k]),S=m.useCallback(()=>{b();const C=u.current||xf(e,t,n),j=c.current.pop();return j?(l.current=wg(l.current,C),k(j),!0):(y(),!1)},[y,t,n,b,e,k]);return m.useEffect(()=>()=>w(),[w]),m.useEffect(()=>{if(!r)return;const C=xf(e,t,n);if(!u.current){u.current=C;return}if(h.current){h.current=!1,u.current=C;return}C.signature!==u.current.signature&&(p.current||(p.current=u.current),f.current=C,w(),d.current=window.setTimeout(()=>{b()},wK))},[w,t,r,n,b,e]),{canUndo:l.current.length>0||!!p.current,canRedo:c.current.length>0,resetHistory:g,undo:x,redo:S,version:i}}const SK="af:workspace-graph:v2",UN="agentflow.workspace.sidebarCollapsed",Ya=["DISPLAY","CONTROL","TOOL","PROVIDE","AGENT"],NK=new Set(["control_start","control_end","control_load_skills","control_load_mcp","control_cd_workspace","control_user_workspace"]),jK={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:""}]},CK={id:"workspace_scheduled_run",displayName:"Scheduled Run",label:"Scheduled Run",description:"Run the downstream workspace subgraph on a schedule.",type:"control",inputs:[{type:"node",name:"prev",default:""}],outputs:[{type:"node",name:"next",default:""}]},_K={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}]},EK={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}]},AK={id:"control_cd_workspace",displayName:"加载知识库",label:"加载知识库",description:"Select one or more knowledge sources and pass knowledgeContext to downstream nodes.",type:"control",inputs:[{type:"node",name:"prev",default:""},{type:"text",name:"path",default:"",showOnNode:!1},{type:"text",name:"label",default:"",showOnNode:!1},{type:"text",name:"knowledgeContext",default:"",showOnNode:!1},{type:"text",name:"workspaceContext",default:"",showOnNode:!1}],outputs:[{type:"node",name:"next",default:""},{type:"text",name:"knowledgeContext",default:"",showOnNode:!0},{type:"text",name:"workspaceContext",default:"",showOnNode:!1},{type:"file",name:"cwd",default:"",showOnNode:!1}]},PK={id:"workspace_one_click_task",displayName:"一键任务",label:"一键任务",description:"输入任务,选择 Skills、workspace 上下文和输出类型后直接运行。",type:"agent",inputs:[{type:"node",name:"prev",default:""},{type:"text",name:"skillKeys",default:"",showOnNode:!1},{type:"bool",name:"includeWorkspaceContext",default:"true",showOnNode:!1},{type:"text",name:"displayType",default:"markdown",showOnNode:!1},{type:"text",name:"knowledgeContext",default:"",showOnNode:!1},{type:"text",name:"workspaceContext",default:"",showOnNode:!1}],outputs:[{type:"node",name:"next",default:""},{type:"text",name:"content",default:"",showOnNode:!0},{type:"text",name:"displayType",default:"markdown",showOnNode:!1}]},IK=new Set(["png","jpg","jpeg","gif","webp","svg"]),FP=320,zP=180,BP=960,Wp=96,HP=900,wx=520,bx=320,wf=52,ba=240,ka=160,kx="display-ref:",Bu="0 9 * * *",TK="Asia/Shanghai",RK="0.1.92";function MK(){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 cs(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 wb(e,t=4e3){const n=String(e??"").trim();return n?n.length>t?`${n.slice(0,t)}
|
|
183
|
-
...[truncated ${n.length-t} chars]`:n:""}function $K(e){const t=wb(e==null?void 0:e.text,4e3);return t?{role:(e==null?void 0:e.role)==="user"?"user":"assistant",...e!=null&&e.kind?{kind:String(e.kind)}:{},text:t,...e!=null&&e.error?{error:!0}:{},at:Number.isFinite(Number(e==null?void 0:e.at))?Number(e.at):Date.now()}:null}function bb(e,t=80){return(Array.isArray(e)?e:[]).map($K).filter(Boolean).slice(-t)}function LK(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n={};for(const[r,s]of Object.entries(t).slice(-80)){const i=String(r||"").trim();if(!i||!s||typeof s!="object")continue;const a=bb(s.messages,40),l=wb(s.draft||"",2e3);!a.length&&!l||(n[i]={sessionId:String(s.sessionId||`nodechat_${i}`),messages:a,...l?{draft:l}:{},candidateContent:"",running:!1,error:""})}return n}function OK(e){return(Array.isArray(e)?e:[]).map(t=>{const n=String((t==null?void 0:t.id)||"").trim();if(!n)return null;const r=bb(t==null?void 0:t.messages,80);if(!r.length)return null;const s=String((t==null?void 0:t.status)||"done");return{id:n,label:wb((t==null?void 0:t.label)||n,120),status:s==="failed"?"failed":"done",messages:r}}).filter(Boolean).slice(-20)}function qN(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n=t.composer&&typeof t.composer=="object"&&!Array.isArray(t.composer)?t.composer:{};return{composer:{activeSessionId:String(n.activeSessionId||"workspace").trim()||"workspace",messages:bb(n.messages,100),runSessions:OK(n.runSessions)},nodeChats:LK(t.nodeChats)}}function Vp(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 IK.has(n)}function Hu(e,t,n={}){const r=String(e||"").trim();if(!r)return"";if(/^(?:https?:|data:|blob:|file:)/i.test(r)||r.startsWith("/"))return r;const s=cs(t||{});return s.set("path",r),n.download&&s.set("download","1"),`/api/workspace/file/raw?${s.toString()}`}function DK(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 FK(e){const t=String((e==null?void 0:e.username)||(e==null?void 0:e.userId)||"").trim();return t?`${UN}:${t}`:UN}function zK(e){try{const t=window.localStorage.getItem(e);if(t==="false")return!1;if(t==="true")return!0}catch{}return!0}function YN(e){return!e||typeof e.closest!="function"?!1:!!e.closest("input, textarea, select, [contenteditable='true']")}function BK(e){var t;if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)return Number(e.selectionStart??0)!==Number(e.selectionEnd??0);if(e instanceof Element&&e.closest('[contenteditable="true"]')){const n=(t=window.getSelection)==null?void 0:t.call(window);return!!(n&&!n.isCollapsed)}return!1}function HK(e){return!e||typeof e.closest!="function"?!1:!!e.closest(".af-flow-node__prompt-stack")&&!BK(e)}function WK(e){const t=String(e||"").trim();if(!t||VK(t))return"";if(/^运行完成/.test(t))return"运行完成";if(/^运行暂停/.test(t))return"运行暂停";if(/^运行停止/.test(t))return"运行停止";if(/^思考中/.test(t))return"模型正在思考";if(/^生成回复中/.test(t))return"模型正在生成回复";if(/^Timing\s+(.+?):\s+(\d+)ms/i.test(t)){const n=t.match(/^Timing\s+(.+?):\s+(\d+)ms/i);return`耗时:${(n==null?void 0:n[1])||"step"} ${(n==null?void 0:n[2])||"0"}ms`}if(/^工具\s+(.+?)(?:\s+\((started|completed)\))?$/i.test(t)){const n=t.match(/^工具\s+(.+?)(?:\s+\((started|completed)\))?$/i),r=String((n==null?void 0:n[1])||"tool").trim(),s=String((n==null?void 0:n[2])||"").toLowerCase();if(r==="thinking")return"模型正在思考";const i=r==="readToolCall"?"读取文件/上下文":r==="grepToolCall"?"搜索代码":r==="editToolCall"?"编辑文件":r;return s==="completed"?`完成:${i}`:`执行:${i}`}return/^\[stderr\]/.test(t)?t:""}function VK(e){return/^\[stderr\]/.test(e)?/Reading additional input from stdin/i.test(e)||/rmcp::transport::worker/i.test(e)||/Transport channel closed/i.test(e)||/http\/request failed/i.test(e)||/AuthRequiredError/i.test(e)||/No access token was provided/i.test(e)||/api\.githubcopilot\.com/i.test(e):!1}function KK(e){const t=String(e||"").trim();return t?/^模型/.test(t)?"model":/^(执行|完成|耗时):/.test(t)?"tool":/^运行/.test(t)?"run":/^\[stderr\]/.test(t)?"error":"other":"other"}function bg(e,t,n,r="Workspace Run"){var c;const s=String(n||"").trim(),i=Array.isArray(e)?e.find(u=>String((u==null?void 0:u.id)||"")===s):null,a=t&&typeof t=="object"?t[s]:null;return String(((c=i==null?void 0:i.data)==null?void 0:c.label)||(a==null?void 0:a.label)||"").trim()||s||r}function kg(e,t,n="Workspace Run"){const r=String(e||"").trim()||n,s=String(t||"").trim();return!s||r===s?r:`${r} (${s})`}function Jo(e){const t=Math.max(0,Number(e)||0);if(t<1e3)return`${t}ms`;if(t<6e4)return`${(t/1e3).toFixed(t<1e4?1:0)}s`;const n=Math.floor(t/6e4),r=Math.round(t%6e4/1e3);return`${n}m${r?`${r}s`:""}`}function UK(e,t){const n=typeof e=="string"?e:String((e==null?void 0:e.text)||""),r=typeof e=="object"?Number(e==null?void 0:e.stepMs):NaN,s=typeof e=="object"?Number(e==null?void 0:e.totalMs):NaN,i=Number.isFinite(r)&&Number.isFinite(s)?`(+${Jo(r)} / 总 ${Jo(s)})`:"";return`${t+1}. ${n}${i}`}function WP(e){if(String((e==null?void 0:e.type)||"")!=="raw")return null;const t=String((e==null?void 0:e.text)||"").trim();if(!t)return null;try{return JSON.parse(t)}catch{return null}}function Ga(...e){for(const t of e){const n=Number(t);if(Number.isFinite(n))return n}return NaN}function qK(e){const t=e!=null&&e.tool_call&&typeof e.tool_call=="object"?e.tool_call:{},n=Object.keys(t).find(r=>/ToolCall$/i.test(r))||"";return n||String((e==null?void 0:e.name)||(e==null?void 0:e.tool)||"tool_call")}function YK(e){const t=e!=null&&e.tool_call&&typeof e.tool_call=="object"?e.tool_call:{},n=Object.keys(t).find(r=>/ToolCall$/i.test(r))||"";return n&&t[n]&&typeof t[n]=="object"?t[n]:{}}function GK(e,t){var s;const n=String(((s=t==null?void 0:t.args)==null?void 0:s.command)||"");return/ck_fetch\.py/.test(n)?"CK 查询":/collect_important_mails\.py|list_mails_by_date\.py|read_mail_content\.py/.test(n)?"邮件脚本":/npm\s+run\s+build|build:web-ui/.test(n)?"前端构建":/python3/.test(n)?"Python 脚本":{shellToolCall:"Shell 命令",readToolCall:"读取文件/上下文",grepToolCall:"搜索代码",globToolCall:"查找文件",editToolCall:"编辑文件",writeToolCall:"写入文件"}[e]||e||"工具调用"}function JK(e){var i,a,l;const t=WP(e);if(!t||typeof t!="object")return null;const n=String(t.type||""),r=String(t.subtype||""),s=Ga(t.timestamp_ms,t.completedAtMs,t.startedAtMs,e==null?void 0:e.ts,Date.now());if(n==="tool_call"&&r==="completed"){const c=YK(t),u=qK(t),p=Ga(t.startedAtMs,c==null?void 0:c.startedAtMs),f=Ga(t.completedAtMs,c==null?void 0:c.completedAtMs),d=((i=c==null?void 0:c.result)==null?void 0:i.success)||((a=c==null?void 0:c.result)==null?void 0:a.failure)||{},h=Number.isFinite(p)&&Number.isFinite(f)?Math.max(0,f-p):Ga(d.executionTime,d.localExecutionTimeMs),y=String(((l=c==null?void 0:c.args)==null?void 0:l.command)||d.command||"").trim(),w=y?y.split(`
|
|
184
|
-
`).find(Boolean)||y:"";return{kind:"tool",label:GK(u,c),durationMs:Number.isFinite(h)?h:null,at:s,detail:w?w.slice(0,90):""}}if(n==="result"){const c=Ga(t.duration_ms,t.duration_api_ms);return{kind:"total",label:"运行总耗时",durationMs:Number.isFinite(c)?c:null,at:s,detail:t.is_error?"失败结束":"成功结束"}}return n==="connection"?{kind:"network",label:r==="reconnecting"?"连接重连":r==="reconnected"?"连接恢复":"连接事件",durationMs:null,at:s,detail:""}:n==="retry"?{kind:"network",label:r==="resuming"?"会话恢复":r==="starting"?"开始重试":"重试事件",durationMs:null,at:s,detail:""}:null}function GN(e,t,n,r){const s=(Array.isArray(e)?e:[]).map(b=>typeof b=="string"?{text:b}:b).filter(b=>b&&String(b.text||"").trim()),i=Array.isArray(t)?t:[],a=[...i].reverse().find(b=>(b==null?void 0:b.kind)==="total"&&Number.isFinite(Number(b.durationMs))),l=[...s].reverse().find(b=>Number.isFinite(Number(b.totalMs))),c=Number.isFinite(Number(r))&&Number.isFinite(Number(n))?Math.max(0,Number(r)-Number(n)):NaN,u=Ga(a==null?void 0:a.durationMs,l==null?void 0:l.totalMs,c),p=s.filter(b=>b.kind==="model").reduce((b,g)=>b+(Number(g.stepMs)||0),0),f=i.filter(b=>(b==null?void 0:b.kind)==="tool"),d=f.reduce((b,g)=>b+(Number(g.durationMs)||0),0),h=i.filter(b=>(b==null?void 0:b.kind)==="network").length,y=[...s.filter(b=>Number(b.stepMs)>=1e3).map(b=>({label:b.text,durationMs:Number(b.stepMs),detail:"Activity 间隔"})),...f.filter(b=>Number(b.durationMs)>=1e3).map(b=>({label:b.label,durationMs:Number(b.durationMs),detail:b.detail||"工具实际执行"}))].sort((b,g)=>g.durationMs-b.durationMs).slice(0,6),w=["耗时概览"];return Number.isFinite(u)&&w.push(`- 当前总耗时:${Jo(u)}`),p>0&&w.push(`- 模型相关间隔:约 ${Jo(p)}(按 Activity 间隔估算)`),f.length>0&&w.push(`- 工具实际执行:${Jo(d)}(${f.length} 次完成事件)`),h>0&&w.push(`- 网络/会话恢复事件:${h} 次`),y.length>0&&(w.push(""),w.push("慢步骤"),y.forEach((b,g)=>{const k=b.detail?` · ${b.detail}`:"";w.push(`${g+1}. ${b.label}:${Jo(b.durationMs)}${k}`)})),s.length>0&&(w.push(""),w.push("最近 Activity"),s.slice(-10).forEach((b,g)=>{w.push(UK(b,g))})),f.length>0&&(w.push(""),w.push("最近工具完成"),f.slice(-8).forEach((b,g)=>{const k=Number.isFinite(Number(b.durationMs))?` ${Jo(b.durationMs)}`:"",x=b.detail?` · ${b.detail}`:"";w.push(`${g+1}. ${b.label}${k}${x}`)})),w.join(`
|
|
185
|
-
`)}function JN(e){if(String((e==null?void 0:e.type)||"")!=="raw"||String((e==null?void 0:e.eventType)||"")!=="thinking")return"";const t=WP(e);if((t==null?void 0:t.type)!=="thinking")return"";const n=String((t==null?void 0:t.subtype)||"");return n&&n!=="delta"?"":String((t==null?void 0:t.text)||(t==null?void 0:t.delta)||(t==null?void 0:t.thinking)||"").trim()}function VP(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 KP(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function kb(e){if(!e)return"";const t=String(e.baseDefinitionId||"").trim();return t||String(e.id||"").trim()}function UP(e){const t=String(e??"");return/^[A-Za-z0-9_@%+=:,./-]+$/.test(t)?t:"'"+t.replace(/'/g,"'\\''")+"'"}function XK(e,t){const n=String((e==null?void 0:e.language)||"").trim().toLowerCase(),r=String(t||"").trim().toLowerCase();return n.includes("python")||r.endsWith(".py")?"python3":n.includes("shell")||n==="bash"||r.endsWith(".sh")||r.endsWith(".bash")?"bash":"node"}function QK(e){const t=String(e??"").trim();return t?t.includes("${")?t:UP(t):""}function qP(e){if(String((e==null?void 0:e.baseDefinitionId)||"").trim()!=="tool_nodejs")return"";const t=e!=null&&e.runtime&&typeof e.runtime=="object"?e.runtime:{},n=String(t.entry||"").trim().replace(/^\/+/,"");if(n){const s=String((e==null?void 0:e.packageDir)||"").trim().replace(/\/+$/,""),i=s?`${s}/${n}`:`\${flowDir}/${n}`,a=Array.isArray(t.args)?t.args.map(QK).filter(Boolean):[];return[XK(t,n),UP(i),...a].join(" ")}return String(t.command||"").trim()}function Bc(e){const t=String(kb(e)||(e==null?void 0:e.id)||"");return t==="workspace_run"||t==="workspace_scheduled_run"?"CONTROL":t.startsWith("display_")?"DISPLAY":/^control/i.test(t)?"CONTROL":/^tool/i.test(t)?"TOOL":/^provide/i.test(t)?"PROVIDE":"AGENT"}function XN(e){return e==="DISPLAY"?"preview":e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function Kp(e){return String((e==null?void 0:e.displayName)||(e==null?void 0:e.label)||(e==null?void 0:e.id)||"Node")}function Hc(e){return Kp(e)}function vx(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function bf(e,t){const n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim(),r=String((e==null?void 0:e.type)||"").trim();return n||r||`#${t+1}`}function QN(e,t,n){const r=String((t==null?void 0:t.name)||(t==null?void 0:t.id)||`#${n+1}`).trim(),s=String((t==null?void 0:t.type)||"").trim(),i=String((t==null?void 0:t.default)??(t==null?void 0:t.value)??"").trim();return[e,r,s?`type: ${s}`:"",i?`default: ${i}`:""].filter(Boolean).join(" · ")}function ZN(e,t){const n=Array.isArray(e)?e:[],r=n.slice(0,4),s=Math.max(0,n.length-r.length);return{list:n,shown:r,hidden:s,kind:t}}function vg(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=gx(s.get(n),e.sourceHandle||"output-0","source"),a=gx(s.get(r),e.targetHandle||"input-0","target");return!!(i&&a&&zu(i,a))}function ZK(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=gx(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:kV(a)}:null}function e7(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"?zu(t.slot,a):zu(a,t.slot)))continue;const c=Bc(n);return{def:n,order:r,category:c,categoryRank:Ya.indexOf(c),slot:a,slotIndex:i,displayLabel:Hc(n),description:vx(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 t7(e,t,n){var i,a,l,c;if(!n)return[];const r=[],s=n.handleType==="source";for(const u of e||[]){if(!u||u.id===n.nodeId)continue;const p=Array.isArray(s?(i=u.data)==null?void 0:i.inputs:(a=u.data)==null?void 0:a.outputs)?s?u.data.inputs:u.data.outputs:[];for(let f=0;f<p.length;f+=1){const d=p[f];if((d==null?void 0:d.showOnNode)===!1||!(s?zu(n.slot,d):zu(d,n.slot)))continue;const y=s?{source:n.nodeId,sourceHandle:n.handleId,target:u.id,targetHandle:`input-${f}`}:{source:u.id,sourceHandle:`output-${f}`,target:n.nodeId,targetHandle:n.handleId},w=(t||[]).some(b=>b.target===y.target&&b.targetHandle===y.targetHandle);r.push({node:u,nodeId:u.id,nodeLabel:((l=u.data)==null?void 0:l.label)||u.id,definitionId:((c=u.data)==null?void 0:c.definitionId)||"",slot:d,slotIndex:f,handleId:s?y.targetHandle:y.sourceHandle,connection:y,occupied:w})}}return r.sort((u,p)=>{var w,b,g,k,x,S,C,j;const f=Number(((b=(w=u.node)==null?void 0:w.position)==null?void 0:b.y)||0),d=Number(((k=(g=p.node)==null?void 0:g.position)==null?void 0:k.y)||0),h=Number(((S=(x=u.node)==null?void 0:x.position)==null?void 0:S.x)||0),y=Number(((j=(C=p.node)==null?void 0:C.position)==null?void 0:j.x)||0);return f-d||h-y||u.slotIndex-p.slotIndex||String(u.nodeId).localeCompare(String(p.nodeId))})}function fl(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 n7(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 r7(e){return(e==null?void 0:e.default)!=null?String(e.default):(e==null?void 0:e.value)!=null?String(e.value):""}function s7(e){const t=Number(e);if(!Number.isFinite(t)||t<=0)return Bu;const n=Math.max(1,Math.min(1440,Math.round(t)));return n<60?`*/${n} * * * *`:n===60?"0 * * * *":n<1440&&n%60===0?`0 */${n/60} * * *`:Bu}function fo(e,t=0,n=0,r=59){const s=Math.max(n,Math.min(r,Number.parseInt(String(e??t),10)||t));return String(s).padStart(2,"0")}function vb(e){const t=String(e||"").trim().match(/^(\d{1,2}):(\d{1,2})$/);return t?`${fo(t[1],9,0,23)}:${fo(t[2],0,0,59)}`:"09:00"}function Wc(e,t,n,r,s){const i=vb(t),[a,l]=i.split(":").map(u=>Number.parseInt(u,10)),c=String(e||"daily");if(c==="weekly"){const u=Math.max(0,Math.min(6,Number.parseInt(String(n??1),10)||1));return`${l} ${a} * * ${u}`}if(c==="monthly"){const u=Math.max(1,Math.min(31,Number.parseInt(String(r??1),10)||1));return`${l} ${a} ${u} * *`}return c==="custom"?String(s||"").trim()||Bu:`${l} ${a} * * *`}function i7(e){const n=String(e||Bu).trim().split(/\s+/);if(n.length!==5)return{scheduleType:"custom",time:"09:00",weekday:1,monthDay:1};const[r,s,i,a,l]=n,c=Number.parseInt(r,10),u=Number.parseInt(s,10),p=Number.isFinite(c)&&Number.isFinite(u)&&r===String(c)&&s===String(u),f=p?`${fo(u,9,0,23)}:${fo(c,0,0,59)}`:"09:00";return p&&i==="*"&&a==="*"&&l==="*"?{scheduleType:"daily",time:f,weekday:1,monthDay:1}:p&&i==="*"&&a==="*"&&/^\d+$/.test(l)?{scheduleType:"weekly",time:f,weekday:Math.max(0,Math.min(6,Number.parseInt(l,10))),monthDay:1}:p&&/^\d+$/.test(i)&&a==="*"&&l==="*"?{scheduleType:"monthly",time:f,weekday:1,monthDay:Math.max(1,Math.min(31,Number.parseInt(i,10)))}:{scheduleType:"custom",time:f,weekday:1,monthDay:1}}function Sb(e){let t={};const n=String(e||"").trim();if(n)try{t=JSON.parse(n)}catch{t={}}const r=Number(t.intervalMinutes),s=s7(r),i=typeof t.cron=="string"&&t.cron.trim()?t.cron.trim():s,a=i7(i),l=["daily","weekly","monthly","custom"].includes(t.scheduleType)?t.scheduleType:a.scheduleType,c=vb(t.time||a.time||"09:00"),u=Math.max(0,Math.min(6,Number.parseInt(String(t.weekday??a.weekday??1),10)||1)),p=Math.max(1,Math.min(31,Number.parseInt(String(t.monthDay??a.monthDay??1),10)||1)),f=Wc(l,c,u,p,i);return{enabled:t.enabled===!0,scheduleType:l,time:c,weekday:u,monthDay:p,cron:f,timezone:TK,targetRunNodeId:typeof t.targetRunNodeId=="string"?t.targetRunNodeId.trim():"",overlapPolicy:"skip"}}function o7(e){const t=Sb(JSON.stringify(e||{}));return JSON.stringify(t)}function a7(e){const t=Number(e||0);return!Number.isFinite(t)||t<=0?"-":new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function l7(e){return e==="weekly"?"每周":e==="monthly"?"每月":e==="custom"?"高级 Cron":"每天"}function ej(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"&&e.trim()){const t=Date.parse(e);if(Number.isFinite(t))return t}return 0}function kf(e){const t={};for(const n of Array.isArray(e)?e:[]){const r=String((n==null?void 0:n.scheduleNodeId)||(n==null?void 0:n.runNodeId)||"").trim();r&&(t[r]={nextAt:ej(n.nextRunAt),lastAt:ej(n.lastTriggeredAt),lastStatus:String(n.lastStatus||(n.enabled?"armed":"disabled")),lastError:String(n.lastError||""),lastRunId:String(n.lastRunId||""),targetRunNodeId:String(n.targetRunNodeId||n.runNodeId||""),cron:String(n.cron||""),timezone:String(n.timezone||"")})}return t}function lu(e){var t;return!!((t=e==null?void 0:e.data)!=null&&t.isWorkspaceGroup)}function Up(e){return e>0?`Group ${e+1}`:"Group"}function c7(e){return(Array.isArray(e)?e:[]).map((n,r)=>{const s=String((n==null?void 0:n.id)||`group_${r+1}`).trim(),i=Number(n==null?void 0:n.x),a=Number(n==null?void 0:n.y),l=Number(n==null?void 0:n.width),c=Number(n==null?void 0:n.height);return!s||!Number.isFinite(i)||!Number.isFinite(a)||!Number.isFinite(l)||!Number.isFinite(c)?null:{id:s,title:String((n==null?void 0:n.title)||Up(r)).trim()||Up(r),color:String((n==null?void 0:n.color)||"purple").trim()||"purple",x:i,y:a,width:Math.max(ba,Math.round(l)),height:Math.max(ka,Math.round(c))}}).filter(Boolean)}function u7(e){var n;return c7((n=e==null?void 0:e.ui)==null?void 0:n.groups).map(r=>({id:r.id,type:Nl,position:{x:r.x,y:r.y},width:r.width,height:r.height,selected:!1,draggable:!0,selectable:!0,zIndex:0,data:{isWorkspaceGroup:!0,label:r.title,title:r.title,color:r.color,nodeSize:{width:r.width,height:r.height}}}))}function Sx(e){const t=Number(e==null?void 0:e.width),n=Number(e==null?void 0:e.height);return!Number.isFinite(t)||!Number.isFinite(n)?null:{width:Math.max(ba,Math.round(t)),height:Math.max(ka,Math.round(n))}}function Vc(e){return(Array.isArray(e)?e:[]).map(t=>({type:(t==null?void 0:t.type)||"node",name:(t==null?void 0:t.name)||"",default:r7(t),required:!!(t!=null&&t.required),description:String((t==null?void 0:t.description)||""),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 YP(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 d7(e){var i,a,l,c;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:{},s=zh(t);return[YP(e),yn(t)||"",s?"has-result":"",(t==null?void 0:t.contextRunResultNonce)||"",Number((e==null?void 0:e.width)||0)||"",Number((e==null?void 0:e.height)||0)||"",Number(((i=e==null?void 0:e.measured)==null?void 0:i.width)||0)||"",Number(((a=e==null?void 0:e.measured)==null?void 0:a.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)||"",(c=(l=t==null?void 0:t.runningRunNodeIds)==null?void 0:l.has)!=null&&c.call(l,e==null?void 0:e.id)?"running-run":""].join("::")}function vf(e,t){var h,y;const n=e!=null&&e.instances&&typeof e.instances=="object"?e.instances:{},r=QP(n),s=Array.isArray(e==null?void 0:e.edges)?e.edges:[],i=(h=e==null?void 0:e.ui)!=null&&h.nodePositions&&typeof e.ui.nodePositions=="object"?e.ui.nodePositions:{},a=(y=e==null?void 0:e.ui)!=null&&y.nodeSizes&&typeof e.ui.nodeSizes=="object"?e.ui.nodeSizes:{},l=new Set(Object.keys(r));for(const w of s)w!=null&&w.source&&l.add(String(w.source)),w!=null&&w.target&&l.add(String(w.target));const u=Array.from(l).map(w=>{const b=r[w]||{},g=b.definitionId||w,k=t.find(D=>D.id===g),x=kb(k)||g,S=t.find(D=>D.id===x)||k,C=b.marketplaceRef||KP(k),j=qP(k),E=i[w]&&typeof i[w].x=="number"&&typeof i[w].y=="number"?i[w]:{x:320+l.size*20,y:180+l.size*12},A=!!yn({definitionId:x,inputs:b.input,outputs:b.output}),O=a[w]&&typeof a[w].width=="number"&&typeof a[w].height=="number"?{width:a[w].width,height:a[w].height}:null,W=aa(O,{display:A}),H=W&&!Ls(x);return{id:w,type:Nl,position:E,...H?{width:W.width,height:W.height}:{},data:{label:b.label||Kp(k)||Kp(S)||w,definitionId:x,...C?{marketplaceRef:C}:{},...k!=null&&k.packageId?{marketplacePackageId:k.packageId}:{},...k!=null&&k.version?{marketplaceVersion:k.version}:{},schemaType:VP(x,S||k),role:b.role||"normal",model:b.model||void 0,body:b.body||"",script:b.script||j||"",scriptRef:b.scriptRef||"",implementationRef:b.implementationRef||"",implementationMode:b.implementationMode||"",displayReloadKey:b.displayReloadKey||"",...H?{nodeSize:W}:{},...A&&H?{displaySize:W}:{}}}}).map(w=>xx(w,r,t)),p=u7(e),f=s.filter(w=>(w==null?void 0:w.source)&&(w==null?void 0:w.target)).filter(w=>!p.some(b=>b.id===String(w.source)||b.id===String(w.target))).map((w,b)=>({id:w.id||`we-${w.source}-${w.target}-${b}`,source:String(w.source),target:String(w.target),sourceHandle:w.sourceHandle??void 0,targetHandle:w.targetHandle??void 0,markerEnd:{type:Qs.ArrowClosed}})),d=[...p,...u];return{nodes:d,edges:qV(f,d),instances:r}}function tj(e){return`${kx}${e}`}function Sg(e){const t=String(e||"");return t.startsWith(kx)?t.slice(kx.length):t}function GP(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 Nx(e,t=[]){const n=new Map((Array.isArray(t)?t:[]).filter(f=>{var d;return va((d=f==null?void 0:f.data)==null?void 0:d.definitionId)}).map(f=>[f.id,f])),r=Array.isArray(e==null?void 0:e.nodeIds)?e.nodeIds:[],s=[],i=new Set;for(const f of r){const d=String(f||"").trim();!d||i.has(d)||!n.has(d)||(i.add(d),s.push(d))}const a={},l=e!=null&&e.nodePositions&&typeof e.nodePositions=="object"?e.nodePositions:{};s.forEach((f,d)=>{const h=l[f];a[f]=h&&typeof h.x=="number"&&typeof h.y=="number"?{x:h.x,y:h.y}:{x:180+d*36,y:120+d*28}});const c={},u=e!=null&&e.nodeSizes&&typeof e.nodeSizes=="object"?e.nodeSizes:{};s.forEach(f=>{const d=aa(u[f],{display:!0});d&&(c[f]=d)});const p=GP(e==null?void 0:e.viewport);return{nodeIds:s,nodePositions:a,nodeSizes:c,...p?{viewport:p}:{}}}function f7(e,t=[]){return Nx(e,t)}const Ng=[{value:"1",label:"1 天"},{value:"7",label:"7 天"},{value:"30",label:"30 天"},{value:"90",label:"90 天"},{value:"365",label:"1 年"},{value:"permanent",label:"永久"}];function jg(e={}){return{title:"",layout:"gallery",nodeIds:[],expiresInDays:30,permanent:!1,...e}}function nj(e={}){return e.permanent?"permanent":String(e.expiresInDays||30)}function rj(e={}){if(e.permanent)return{expiresMode:"permanent",permanent:!0};const t=Number(e.expiresInDays||30);return{expiresMode:"days",expiresInDays:Number.isFinite(t)?t:30}}function p7(e={}){if(!e.expiresAt)return"永久有效";const t=Date.parse(String(e.expiresAt||""));return Number.isFinite(t)?`有效期至 ${new Date(t).toLocaleString()}`:"永久有效"}function sj(e={}){return new URL(e.url||`/display/${e.id||""}`,window.location.origin).href}const JP="af:workspace:canvas-clipboard",XP="agentflow.workspace.canvas-clipboard";function h7(e){return JSON.stringify({type:XP,version:1,clipboard:e})}function m7(e){try{const t=JSON.parse(String(e||""));if((t==null?void 0:t.type)!==XP)return null;const n=t.clipboard;return!n||!Array.isArray(n.nodes)||n.nodes.length===0?null:n}catch{return null}}function g7(e){try{localStorage.setItem(JP,h7(e))}catch{}}function y7(){try{return m7(localStorage.getItem(JP))}catch{return null}}function x7(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}async function ij(e){var n;const t=String(e||"");if(!t)return!1;try{if((n=navigator.clipboard)!=null&&n.writeText)return await navigator.clipboard.writeText(t),!0}catch{}try{const r=document.createElement("textarea");r.value=t,r.setAttribute("readonly",""),r.style.position="fixed",r.style.left="-9999px",r.style.top="0",document.body.appendChild(r),r.focus(),r.select();const s=document.execCommand("copy");return document.body.removeChild(r),s}catch{return!1}}function oj(e,t,n){const r=Number(e);return!Number.isFinite(r)||r<=0?0:Math.min(n,Math.max(t,Math.round(r)))}function aa(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:oj(n,zP,BP)||FP,height:oj(r,Wp,HP)||Wp}}function qp(e){const t=aa(e,{display:!0});return t?{width:Math.max(320,Math.round(t.width)),height:Math.max(180,Math.round(t.height))}:null}function w7(e){const t=String(e||"").trim().toLowerCase();return t==="html"||t==="react"?{width:720,height:520}:t==="table"||t==="chart"?{width:640,height:380}:t==="image"?{width:520,height:360}:{width:wx,height:bx}}function b7(e,t=""){const n=qp(e==null?void 0:e.displaySize);if(n)return n;const r=qp(e==null?void 0:e.nodeSize);if(r)return r;const s=va(t)||cd(_o((e==null?void 0:e.inputs)||(e==null?void 0:e.input)||[],"displayType","markdown"));return w7(s)}function Ja(e){var s,i,a,l,c,u,p,f,d,h,y;if(Ls((s=e==null?void 0:e.data)==null?void 0:s.definitionId))return null;const t=!!yn(e==null?void 0:e.data),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?(u=e==null?void 0:e.measured)==null?void 0:u.width:0)||0),r=Number(((f=(p=e==null?void 0:e.data)==null?void 0:p.displaySize)==null?void 0:f.height)||((h=(d=e==null?void 0:e.data)==null?void 0:d.nodeSize)==null?void 0:h.height)||(e==null?void 0:e.height)||(t?(y=e==null?void 0:e.measured)==null?void 0:y.height:0)||0);return aa({width:n,height:r},{display:t})}function Pc(e,t,n){var p,f,d,h,y,w,b,g,k,x,S,C,j;const r=(e||[]).filter(E=>!lu(E)),s=(e||[]).filter(lu),i=QP(yb(r,n||{})),a=t.map(E=>({source:E.source,target:E.target,sourceHandle:E.sourceHandle??null,targetHandle:E.targetHandle??null})).filter(E=>!s.some(A=>A.id===E.source||A.id===E.target)),l={},c={},u=[];for(const E of r){l[E.id]={x:((p=E.position)==null?void 0:p.x)||0,y:((f=E.position)==null?void 0:f.y)||0};const A=Ja(E);A&&(c[E.id]=A)}for(const E of s){const A=Number(((h=(d=E.data)==null?void 0:d.nodeSize)==null?void 0:h.width)||E.width||((y=E.measured)==null?void 0:y.width)||0),O=Number(((b=(w=E.data)==null?void 0:w.nodeSize)==null?void 0:b.height)||E.height||((g=E.measured)==null?void 0:g.height)||0);u.push({id:E.id,title:String(((k=E.data)==null?void 0:k.title)||((x=E.data)==null?void 0:x.label)||"Group"),color:String(((S=E.data)==null?void 0:S.color)||"purple"),x:Number(((C=E.position)==null?void 0:C.x)||0),y:Number(((j=E.position)==null?void 0:j.y)||0),width:Math.max(ba,Math.round(A||ba)),height:Math.max(ka,Math.round(O||ka))})}return{version:1,instances:i,edges:a,ui:{nodePositions:l,nodeSizes:c,groups:u}}}function QP(e){const t={};for(const[n,r]of Object.entries(e||{})){const s=String((r==null?void 0:r.definitionId)||n);if(!!va(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 va(e){const t=String(e||"");return t==="display_markdown"?"markdown":t==="display_mermaid"?"mermaid":t==="display_ascii"?"ascii":t==="display_html"?"html":t==="display_react_app"?"react":t==="display_image"?"image":t==="display_chart"?"chart":t==="display_table"?"table":""}function yn(e){const t=va(e==null?void 0:e.definitionId);return t||(Ls(e==null?void 0:e.definitionId)&&zh(e)?cd(_o((e==null?void 0:e.inputs)||(e==null?void 0:e.input)||[],"displayType","markdown")):"")}function No(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],n=yn(e),r=Ls(e==null?void 0:e.definitionId),s=n==="image"?"src":"content",i=u=>String((u==null?void 0:u.value)??(u==null?void 0:u.default)??""),a=u=>i(u).trim(),l=t.find(u=>(u==null?void 0:u.name)===s&&a(u))||t.find(u=>(u==null?void 0:u.name)==="filePath"&&a(u))||t.find(u=>(u==null?void 0:u.type)==="text"&&a(u)),c=l?i(l):"";return String(r?c:(e==null?void 0:e.body)||c)}function Sa(e,t=""){const n=String(e||"").trim();if(!n||n.length>260||/[\r\n<>]/.test(n)||/^(?:https?:|data:|blob:|file:|javascript:|mailto:|tel:)/i.test(n))return"";const r=n.replace(/^\/+/,"");if(r.includes("..")||r.startsWith("."))return"";const s=r.split("?")[0].split("#")[0].toLowerCase().split(".").pop()||"";return({html:new Set(["html","htm"]),react:new Set(["json","jsx","tsx","js","txt"]),markdown:new Set(["md","markdown","txt"]),mermaid:new Set(["mmd","mermaid","txt"]),ascii:new Set(["txt","log"]),chart:new Set(["json"]),table:new Set(["json","csv","tsv"])}[t]||new Set(["html","htm","md","markdown","txt","json","csv","tsv"])).has(s)?r:""}function k7(e){let t=String(e||"").replace(/\r\n/g,`
|
|
186
|
-
`).trim();return t.includes(`
|
|
187
|
-
`)||(t=t.replace(/\s+(resultFile|result|outParams|outParams\.[A-Za-z_][A-Za-z0-9_-]*)\s*:/g,`
|
|
188
|
-
$1:`).replace(/(^|\n)outParams:\s+([A-Za-z_][A-Za-z0-9_-]*\s*:)/g,`$1outParams:
|
|
189
|
-
$2`)),t}function Pi(e){const t=String(e||"").trim();if(!t)return String(e||"");const n=t.match(/---agentflow\b([\s\S]*?)---end/i);if(n!=null&&n[1]){const a=k7(n[1]),l=a.match(/^resultFile\s*:\s*["']?([^"'\n]+)["']?/m);if(l!=null&&l[1])return l[1].trim();const c=a.match(/^result\s*:\s*(.*)$/m);if(c){const p=String(c[1]||"").trim();return p==="|"||p===">"?a.slice((c.index||0)+c[0].length).split(`
|
|
190
|
-
`).filter(d=>/^\s+/.test(d)||!d.trim()).map(d=>d.replace(/^\s{2}/,"")).join(`
|
|
191
|
-
`).replace(/\s+$/g,""):p.replace(/^["']|["']$/g,"")}const u=t.replace(n[0],"").trim();if(u)return u}if(!/["']result["']\s*:|["']outParams["']\s*:|["']resultFile["']\s*:/i.test(t))return String(e||"");const r=[t],s=t.indexOf("{"),i=t.lastIndexOf("}");s>=0&&i>s&&r.unshift(t.slice(s,i+1));for(const a of r)try{const l=JSON.parse(a);if(l&&typeof l=="object"&&!Array.isArray(l)&&(Object.prototype.hasOwnProperty.call(l,"result")||Object.prototype.hasOwnProperty.call(l,"resultFile"))){const c=l.resultFile||l.result;return typeof c=="string"?c:JSON.stringify(c,null,2)}}catch{}return String(e||"")}async function Hl(e,t){const n=cs(e);n.set("path",t);const r=await fetch(`/api/workspace/file?${n.toString()}`),s=await r.json().catch(()=>({}));if(!r.ok)throw new Error(s.error||`读取文件失败:${t}`);return String(s.content||"")}async function jx(e,t,n){const r=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,path:t,content:String(n||"")})}),s=await r.json().catch(()=>({}));if(!r.ok)throw new Error(s.error||`写入文件失败:${t}`);return s.path||t}function v7(e,t=[],n=[]){const r=String(e||"");if(!r)return"";const s=new Map(t.map(i=>[i.id,i]));return(Array.isArray(n)?n:[]).filter(i=>String((i==null?void 0:i.target)||"")===r).slice(0,4).map(i=>{const a=s.get(String((i==null?void 0:i.source)||""));if(!a)return"";const l=a.data||{},c=String(l.body||"").trim(),u=[`- upstreamId: ${a.id}`,` label: ${String(l.label||a.id).trim()}`,` definitionId: ${String(l.definitionId||"").trim()}`];return c&&u.push(` task: ${c.slice(0,4e3)}`),u.join(`
|
|
192
|
-
`)}).filter(Boolean).join(`
|
|
193
|
-
|
|
194
|
-
`)}function Xl(e){let t=Pi(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 S7(e){const t=Xl(e);return t.trim()?/<[^>]*$/g.test(t)?"HTML 内容末尾存在未闭合标签,可能是生成或保存时被截断。":/^(?:<!doctype\b|<html\b)/i.test(t)&&!/<\/html\s*>/i.test(t)?"完整 HTML 文档缺少 </html> 结束标签,可能是生成或保存时被截断。":"":""}function ta(e,t){return e==="html"?S7(t):""}function ZP(e,t=""){const n=Xl(e);if(!n.trim())return"";const s=`<base target="_blank"><script data-agentflow-display-link-guard="1">
|
|
195
|
-
(() => {
|
|
196
|
-
const frameId = ${JSON.stringify(String(t||""))};
|
|
197
|
-
const postSize = () => {
|
|
198
|
-
const doc = document.documentElement;
|
|
199
|
-
const body = document.body;
|
|
200
|
-
const height = Math.ceil(Math.max(
|
|
201
|
-
doc ? doc.scrollHeight : 0,
|
|
202
|
-
doc ? doc.offsetHeight : 0,
|
|
203
|
-
doc ? doc.clientHeight : 0,
|
|
204
|
-
body ? body.scrollHeight : 0,
|
|
205
|
-
body ? body.offsetHeight : 0,
|
|
206
|
-
body ? body.clientHeight : 0,
|
|
207
|
-
window.innerHeight || 0
|
|
208
|
-
));
|
|
209
|
-
window.parent.postMessage({ source: "agentflow-html-display-size", frameId, height }, "*");
|
|
210
|
-
};
|
|
211
|
-
document.addEventListener("click", (event) => {
|
|
212
|
-
const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
|
|
213
|
-
if (!link) return;
|
|
214
|
-
const rawHref = String(link.getAttribute("href") || "").trim();
|
|
215
|
-
if (!rawHref || rawHref.startsWith("#")) return;
|
|
216
|
-
if (/^javascript:/i.test(rawHref)) {
|
|
217
|
-
event.preventDefault();
|
|
218
|
-
return;
|
|
219
|
-
}
|
|
220
|
-
event.preventDefault();
|
|
221
|
-
window.open(link.href, "_blank", "noopener,noreferrer");
|
|
222
|
-
}, true);
|
|
223
|
-
window.addEventListener("load", postSize);
|
|
224
|
-
window.addEventListener("resize", postSize);
|
|
225
|
-
requestAnimationFrame(postSize);
|
|
226
|
-
setTimeout(postSize, 60);
|
|
227
|
-
setTimeout(postSize, 300);
|
|
228
|
-
if (typeof ResizeObserver !== "undefined") {
|
|
229
|
-
const resizeObserver = new ResizeObserver(postSize);
|
|
230
|
-
resizeObserver.observe(document.documentElement);
|
|
231
|
-
if (document.body) resizeObserver.observe(document.body);
|
|
232
|
-
}
|
|
233
|
-
if (typeof MutationObserver !== "undefined") {
|
|
234
|
-
const mutationObserver = new MutationObserver(postSize);
|
|
235
|
-
mutationObserver.observe(document.documentElement, { childList: true, subtree: true, attributes: true, characterData: true });
|
|
236
|
-
}
|
|
237
|
-
})();
|
|
238
|
-
<\/script>`;return/data-agentflow-display-link-guard=["']1["']/i.test(n)?n:/<head\b[^>]*>/i.test(n)?n.replace(/<head\b([^>]*)>/i,`<head$1>${s}`):/<html\b[^>]*>/i.test(n)?n.replace(/<html\b([^>]*)>/i,`<html$1><head>${s}</head>`):`<!doctype html><html><head>${s}</head><body>${n}</body></html>`}function N7(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 j7(e,t){const n=document.createElement("a");n.href=e,n.download=t,document.body.appendChild(n),n.click(),n.remove()}function C7(e,t){const n=URL.createObjectURL(e);try{j7(n,t)}finally{window.setTimeout(()=>URL.revokeObjectURL(n),1e3)}}function eI(e){var t;try{return(e==null?void 0:e.contentDocument)||((t=e==null?void 0:e.contentWindow)==null?void 0:t.document)||null}catch{return null}}function _7(e){const t=eI(e);return t!=null&&t.documentElement?`${t.doctype?`<!DOCTYPE ${t.doctype.name}${t.doctype.publicId?` PUBLIC "${t.doctype.publicId}"`:""}${t.doctype.systemId?` "${t.doctype.systemId}"`:""}>`:"<!DOCTYPE html>"}
|
|
239
|
-
${t.documentElement.outerHTML}`:""}function Cg(e){var n;if(!e)return null;const t=(n=e.getBoundingClientRect)==null?void 0:n.call(e);return{rectWidth:t!=null&&t.width?Math.round(t.width):null,rectHeight:t!=null&&t.height?Math.round(t.height):null,clientWidth:e.clientWidth||null,clientHeight:e.clientHeight||null,scrollWidth:e.scrollWidth||null,scrollHeight:e.scrollHeight||null,offsetWidth:e.offsetWidth||null,offsetHeight:e.offsetHeight||null}}function E7(e,t,n,r={}){var b;const s=(b=e==null?void 0:e.getBoundingClientRect)==null?void 0:b.call(e),i=eI(e),a=i==null?void 0:i.documentElement,l=i==null?void 0:i.body,c=(r==null?void 0:r.card)||null,u=(r==null?void 0:r.displayBody)||null,p=(r==null?void 0:r.scroller)||null,f=(r==null?void 0:r.displaySize)||null,d={fallbackWidth:Number(t)||null,fallbackHeight:Number(n)||null,displaySizeWidth:Number((f==null?void 0:f.width)||0)||null,displaySizeHeight:Number((f==null?void 0:f.height)||0)||null,rectWidth:s!=null&&s.width?Math.round(s.width):null,rectHeight:s!=null&&s.height?Math.round(s.height):null,iframeClientWidth:(e==null?void 0:e.clientWidth)||null,iframeClientHeight:(e==null?void 0:e.clientHeight)||null,docScrollWidth:(a==null?void 0:a.scrollWidth)||null,docScrollHeight:(a==null?void 0:a.scrollHeight)||null,bodyScrollWidth:(l==null?void 0:l.scrollWidth)||null,bodyScrollHeight:(l==null?void 0:l.scrollHeight)||null,docOffsetWidth:(a==null?void 0:a.offsetWidth)||null,bodyOffsetWidth:(l==null?void 0:l.offsetWidth)||null,card:Cg(c),displayBody:Cg(u),scroller:Cg(p)},h=[Number(t)||0,Number((f==null?void 0:f.width)||0),Number((c==null?void 0:c.clientWidth)||0),Number((c==null?void 0:c.scrollWidth)||0),Number((u==null?void 0:u.clientWidth)||0),Number((u==null?void 0:u.scrollWidth)||0),Number((p==null?void 0:p.clientWidth)||0),Number((p==null?void 0:p.scrollWidth)||0),Number(s==null?void 0:s.width)||0,Number(e==null?void 0:e.clientWidth)||0,Number((a==null?void 0:a.scrollWidth)||0),Number((l==null?void 0:l.scrollWidth)||0),Number((a==null?void 0:a.offsetWidth)||0),Number((l==null?void 0:l.offsetWidth)||0)].map(g=>Math.ceil(g)).filter(g=>g>0),y=Math.max(1,...h.length?h:[960]),w=Math.max(1,Math.round(Number(n)||(s==null?void 0:s.height)||(e==null?void 0:e.clientHeight)||640),Math.ceil(Number((a==null?void 0:a.scrollHeight)||0)),Math.ceil(Number((l==null?void 0:l.scrollHeight)||0)));return{width:y,height:w,debug:d}}async function A7({flowParams:e,content:t,sourceFilePath:n,iframe:r,width:s,height:i,filename:a,snapshotElements:l,displaySize:c}){const u=E7(r,s,i,{...l||{},displaySize:c}),p=_7(r),f=await fetch("/api/workspace/html-screenshot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,content:p||t,sourceFilePath:n||"",width:u.width,height:u.height,filename:a})});if(!f.ok){const h=await f.json().catch(()=>({}));throw new Error(h.error||"截图失败")}const d=await f.blob();C7(d,a)}function P7(e){const n=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]].find(r=>(r==null?void 0:r.name)==="alt");return String((n==null?void 0:n.value)||(n==null?void 0:n.default)||(e==null?void 0:e.label)||"Image preview")}function tI(e){return e==="mermaid"?"account_tree":e==="ascii"?"notes":e==="html"?"html":e==="react"?"deployed_code":e==="image"?"image":e==="chart"?"bar_chart":e==="table"?"table":"article"}function I7(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 u=String(l||"").replace(/[^A-Za-z0-9_]/g,"_")||`N${n.size+1}`;return n.has(u)?c&&(n.get(u).label=c):n.set(u,{id:u,label:c||u}),u},a=l=>{const c=String(l||"").trim().replace(/[;,]+$/,""),u=c.match(/^([A-Za-z][A-Za-z0-9_]*)(?:\[(.+?)\]|\((.+?)\)|\{(.+?)\})?$/);return u?i(u[1],u[2]||u[3]||u[4]||u[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 u=l.match(/^(.+?)\s*-{1,2}>+\s*(.+)$/);if(u){r.push({from:a(u[1]),to:a(u[2])});continue}a(l)}return{nodes:Array.from(n.values()),edges:r,direction:s}}function nI({code:e}){const t=m.useMemo(()=>I7(e),[e]);if(!String(e||"").trim())return null;const n=t.direction==="LR"||t.direction==="RL",r=142,s=44,i=n?96:32,a=n?30:68,l=new Map;t.nodes.forEach((p,f)=>{l.set(p.id,{x:24+(n?f*(r+i):f%3*(r+i)),y:24+(n?f%3*(s+a):f*(s+a))})});const c=Math.max(360,...Array.from(l.values()).map(p=>p.x+r+24)),u=Math.max(180,...Array.from(l.values()).map(p=>p.y+s+24));return o.jsx("div",{className:"af-work-node__mermaid-preview",children:o.jsxs("svg",{viewBox:`0 0 ${c} ${u}`,role:"img","aria-label":"Mermaid preview",children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-work-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),t.edges.map((p,f)=>{const d=l.get(p.from),h=l.get(p.to);if(!d||!h)return null;const y=n?`M ${d.x+r} ${d.y+s/2} C ${(d.x+h.x+r)/2} ${d.y+s/2}, ${(d.x+h.x+r)/2} ${h.y+s/2}, ${h.x} ${h.y+s/2}`:`M ${d.x+r/2} ${d.y+s} C ${d.x+r/2} ${d.y+s+28}, ${h.x+r/2} ${h.y-28}, ${h.x+r/2} ${h.y}`;return o.jsx("path",{className:"af-work-node__mermaid-edge",d:y,markerEnd:"url(#af-work-arrow)"},`${p.from}-${p.to}-${f}`)}),t.nodes.map(p=>{const f=l.get(p.id);return o.jsxs("g",{children:[o.jsx("rect",{className:"af-work-node__mermaid-box",x:f.x,y:f.y,width:r,height:s,rx:"8"}),o.jsx("text",{className:"af-work-node__mermaid-text",x:f.x+r/2,y:f.y+s/2+5,textAnchor:"middle",children:p.label.slice(0,22)})]},p.id)})]})})}function Vs({className:e="",children:t}){const n=m.useRef(null),r=m.useRef(null),[s,i]=m.useState({visible:!1,top:0,height:100}),a=m.useCallback(()=>{const p=n.current;if(!p)return;const f=Math.max(1,p.scrollHeight),d=Math.max(1,p.clientHeight),h=f>d+1,y=h?Math.max(12,d/f*100):100,w=Math.max(0,100-y),b=h?Math.min(w,p.scrollTop/Math.max(1,f-d)*w):0;i({visible:h,top:b,height:y})},[]);m.useEffect(()=>{const p=requestAnimationFrame(a),f=n.current;if(!f||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(p);const d=new ResizeObserver(a);d.observe(f);for(const h of Array.from(f.children))d.observe(h);return()=>{cancelAnimationFrame(p),d.disconnect()}},[t,a]);const l=m.useCallback(p=>{const f=n.current;if(!f)return;const d=Math.max(0,f.scrollHeight-f.clientHeight);f.scrollTop=Math.min(1,Math.max(0,p))*d,a()},[a]),c=m.useCallback((p,f=0)=>{const d=r.current;if(!d)return 0;const h=d.getBoundingClientRect(),y=s.height/100*h.height,w=Math.max(1,h.height-y);return(p-h.top-f)/w},[s.height]),u=m.useCallback(p=>{var S,C;if(!s.visible)return;p.preventDefault(),p.stopPropagation();const f=r.current;if(!f)return;const d=f.getBoundingClientRect(),h=s.top/100*d.height,y=s.height/100*d.height,b=p.clientY>=d.top+h&&p.clientY<=d.top+h+y?p.clientY-d.top-h:y/2;l(c(p.clientY,b));const g=p.pointerId;(C=(S=p.currentTarget).setPointerCapture)==null||C.call(S,g);const k=j=>{j.preventDefault(),l(c(j.clientY,b))},x=()=>{window.removeEventListener("pointermove",k),window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x)};window.addEventListener("pointermove",k),window.addEventListener("pointerup",x),window.addEventListener("pointercancel",x)},[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:u,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${s.height}%`,top:`${s.top}%`}})})]})}function rI({data:e,flowParams:t,htmlFrameRef:n,htmlFrameVersion:r=0}){const s=yn(e),i=No(e),a=s==="image"?i:Pi(i),l=s==="image"?"":Sa(a,s),[c,u]=m.useState(""),[p,f]=m.useState(""),[d,h]=m.useState(!1);m.useEffect(()=>{let k=!1;return l?(h(!0),f(""),u(""),Hl(t,l).then(x=>{k||u(x)}).catch(x=>{k||f(String(x.message||x))}).finally(()=>{k||h(!1)}),()=>{k=!0}):(u(""),f(""),h(!1),()=>{k=!0})},[l,t==null?void 0:t.flowId,t==null?void 0:t.flowSource,t==null?void 0:t.archived,e==null?void 0:e.displayReloadKey]);const y=l?c:a,w=s==="html"?Xl(y):s==="react"?Fh(y):Pi(y),b=m.useRef("");if(b.current||(b.current=`html-display-${Math.random().toString(36).slice(2,10)}`),!s)return null;const g=ta(s,w);if(d)return o.jsxs(Vs,{className:"af-work-display-empty",children:["Loading ",l,"..."]});if(p)return o.jsx(Vs,{className:"af-work-display-empty",children:p});if(g)return o.jsx(Vs,{className:"af-work-display-empty",children:g});if(!w.trim())return o.jsx(Vs,{className:"af-work-display-empty",children:"No display content"});if(s==="html"||s==="react")return o.jsx("div",{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)||(s==="react"?"React app preview":"HTML preview"),sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox",srcDoc:s==="react"?xb(w,b.current):ZP(w,b.current)},r)});if(s==="image"){const k=Hu(w,t);return o.jsx(Vs,{className:"af-work-display-body af-work-display-body--image",children:o.jsx("img",{className:"af-work-display-image",src:k,alt:P7(e),loading:"lazy"})})}return s==="markdown"?o.jsx(Vs,{className:"af-work-display-body af-work-display-body--markdown",children:o.jsx(fb,{content:w,basePath:l,resolveSrc:(k,x)=>Hu(k,t,x)})}):s==="chart"?o.jsx(Vs,{className:"af-work-display-body af-work-display-body--chart",children:o.jsx(hb,{content:w})}):s==="table"?o.jsx(Vs,{className:"af-work-display-body af-work-display-body--table",children:o.jsx(pb,{content:w})}):s==="mermaid"?o.jsxs(Vs,{className:"af-work-display-body",children:[o.jsx(nI,{code:w}),o.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--mermaid",children:w})]}):o.jsx(Vs,{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:w})})}function T7({node:e,onClose:t}){var i,a;const n=m.useRef(null),r=yn(e==null?void 0:e.data),s=((i=e==null?void 0:e.data)==null?void 0:i.label)||(r==="html"?"HTML 展示":r==="markdown"?"Markdown 展示":"Display 预览");return m.useEffect(()=>{const l=c=>{c.key==="Escape"&&(t==null||t())};return window.addEventListener("keydown",l),()=>window.removeEventListener("keydown",l)},[t]),e?Sr.createPortal(o.jsx("div",{className:"af-display-preview-overlay",role:"dialog","aria-modal":"true","aria-label":"全屏预览",children:o.jsxs("div",{className:"af-display-preview-shell",children:[o.jsxs("div",{className:"af-display-preview-head",children:[o.jsxs("div",{className:"af-display-preview-title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:tI(r)}),o.jsx("strong",{children:s}),o.jsx("span",{children:e.id})]}),o.jsx("button",{type:"button",className:"af-display-preview-close",onClick:t,"aria-label":"关闭全屏预览",title:"关闭",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsx("div",{className:"af-display-preview-content",children:o.jsx(rI,{data:e.data,flowParams:(a=e.data)==null?void 0:a.flowParams,htmlFrameRef:n})})]})}),document.body):null}function R7({node:e}){var d,h,y,w,b,g,k,x,S,C;const t=yn(e==null?void 0:e.data),n=No(e==null?void 0:e.data),r=t==="image"?n:Pi(n),s=t==="image"?"":Sa(r,t),[i,a]=m.useState(""),[l,c]=m.useState(!1);m.useEffect(()=>{var E;let j=!1;return s?(c(!0),a(""),Hl(((E=e==null?void 0:e.data)==null?void 0:E.flowParams)||{},s).then(A=>{j||a(A)}).catch(()=>{j||a("")}).finally(()=>{j||c(!1)}),()=>{j=!0}):(a(""),c(!1),()=>{j=!0})},[s,(h=(d=e==null?void 0:e.data)==null?void 0:d.flowParams)==null?void 0:h.flowId,(w=(y=e==null?void 0:e.data)==null?void 0:y.flowParams)==null?void 0:w.flowSource,(g=(b=e==null?void 0:e.data)==null?void 0:b.flowParams)==null?void 0:g.archived,(k=e==null?void 0:e.data)==null?void 0:k.displayReloadKey]);const u=s?i:r,p=t==="html"?Xl(u):t==="react"?Fh(u):Pi(u),f=ta(t,p);return l?o.jsx("div",{className:"af-display-picker-preview__empty",children:"Loading"}):f?o.jsx("div",{className:"af-display-picker-preview__empty",children:f}):p.trim()?t==="html"||t==="react"?o.jsx("iframe",{title:((x=e==null?void 0:e.data)==null?void 0:x.label)||(e==null?void 0:e.id),sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox",srcDoc:t==="react"?xb(p):ZP(p)}):t==="image"?o.jsx("img",{src:Hu(p,(S=e==null?void 0:e.data)==null?void 0:S.flowParams),alt:((C=e==null?void 0:e.data)==null?void 0:C.label)||(e==null?void 0:e.id),loading:"lazy"}):t==="markdown"?o.jsx("div",{className:"af-display-picker-preview__markdown",children:o.jsx(fb,{content:p,basePath:s,resolveSrc:(j,E)=>{var A;return Hu(j,(A=e==null?void 0:e.data)==null?void 0:A.flowParams,E)}})}):t==="chart"?o.jsx(hb,{content:p}):t==="table"?o.jsx(pb,{content:p}):t==="mermaid"?o.jsxs("div",{className:"af-display-picker-preview__diagram",children:[o.jsx(nI,{code:p}),o.jsx("pre",{children:p})]}):o.jsx("pre",{className:"af-display-picker-preview__pre",children:p}):o.jsx("div",{className:"af-display-picker-preview__empty",children:"No content"})}function M7({value:e,onChange:t,onUploadImage:n,readOnly:r=!1}){const s=m.useRef(null),i=m.useRef(null),a=m.useRef(null),[l,c]=m.useState(!1),[u,p]=m.useState({visible:!1,top:0,height:100}),f=m.useCallback(()=>{const g=s.current;if(!g)return;const k=Math.max(1,g.scrollHeight),x=Math.max(1,g.clientHeight),S=k>x+1,C=S?Math.max(12,x/k*100):100,j=Math.max(0,100-C),E=S?Math.min(j,g.scrollTop/Math.max(1,k-x)*j):0;p({visible:S,top:E,height:C})},[]);m.useEffect(()=>{const g=requestAnimationFrame(f),k=s.current;if(!k||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(g);const x=new ResizeObserver(f);return x.observe(k),()=>{cancelAnimationFrame(g),x.disconnect()}},[f,e]);const d=m.useCallback(g=>{const k=s.current;if(!k)return;const x=Math.max(0,k.scrollHeight-k.clientHeight);k.scrollTop=Math.min(1,Math.max(0,g))*x,f()},[f]),h=m.useCallback((g,k=0)=>{const x=a.current;if(!x)return 0;const S=x.getBoundingClientRect(),C=u.height/100*S.height,j=Math.max(1,S.height-C);return(g-S.top-k)/j},[u.height]),y=m.useCallback(g=>{if(!u.visible)return;g.preventDefault(),g.stopPropagation();const k=a.current;if(!k)return;const x=k.getBoundingClientRect(),S=u.top/100*x.height,C=u.height/100*x.height,E=g.clientY>=x.top+S&&g.clientY<=x.top+S+C?g.clientY-x.top-S:C/2;d(h(g.clientY,E));const A=W=>{W.preventDefault(),d(h(W.clientY,E))},O=()=>{window.removeEventListener("pointermove",A),window.removeEventListener("pointerup",O),window.removeEventListener("pointercancel",O)};window.addEventListener("pointermove",A),window.addEventListener("pointerup",O),window.addEventListener("pointercancel",O)},[h,d,u.height,u.top,u.visible]),w=m.useCallback(g=>{const k=String(e||""),x=s.current,S=Number((x==null?void 0:x.selectionStart)??k.length),C=Number((x==null?void 0:x.selectionEnd)??S),j=k.slice(0,S),E=k.slice(C),A=j&&!j.endsWith(`
|
|
240
|
-
`)?`
|
|
241
|
-
`:"",O=E&&!E.startsWith(`
|
|
242
|
-
`)?`
|
|
243
|
-
`:"",W=`${j}${A}${g}${O}${E}`;t==null||t(W),window.requestAnimationFrame(()=>{var D,R;const H=j.length+A.length+g.length;(D=s.current)==null||D.focus(),(R=s.current)==null||R.setSelectionRange(H,H)})},[t,e]),b=m.useCallback(async g=>{if(!r&&!(!g||l)){c(!0);try{const k=await(n==null?void 0:n(g)),x=String(k||"").trim();if(x){const S=String(g.name||"image").replace(/\.[^.]+$/g,"").trim()||"image";w(``)}}finally{c(!1)}}},[w,n,r,l]);return o.jsxs("div",{className:"af-work-display-editor nodrag nopan",onClick:g=>g.stopPropagation(),onDragOver:g=>{var x;Array.from(((x=g.dataTransfer)==null?void 0:x.items)||[]).some(S=>String((S==null?void 0:S.type)||"").startsWith("image/"))&&(g.preventDefault(),g.dataTransfer.dropEffect="copy")},onDrop:g=>{var x;const k=Array.from(((x=g.dataTransfer)==null?void 0:x.files)||[]).find(Vp);k&&(g.preventDefault(),b(k))},children:[o.jsxs("div",{className:"af-work-display-editor__toolbar",children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:l||r,onClick:()=>{var g;return(g=i.current)==null?void 0:g.click()},"aria-label":"上传图片",title:"上传图片",children:o.jsx("span",{className:"material-symbols-outlined",children:l?"hourglass_top":"add_photo_alternate"})}),o.jsx("input",{ref:i,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:g=>{var x;const k=(x=g.target.files)==null?void 0:x[0];g.target.value="",k&&b(k)}})]}),o.jsx("textarea",{ref:s,className:"af-work-display-editor__textarea",value:e,onChange:g=>t==null?void 0:t(g.target.value),onScroll:f,onKeyDown:g=>{g.key==="Escape"&&g.stopPropagation()},placeholder:"输入 Markdown 内容",spellCheck:!1,readOnly:r}),o.jsx("div",{ref:a,className:"af-work-display-editor__scrollbar"+(u.visible?" af-work-display-editor__scrollbar--visible":""),onPointerDown:y,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${u.height}%`,top:`${u.top}%`}})})]})}function $7({nodeId:e,data:t}){const n=t==null?void 0:t.nodeChatActive,r=!!(t!=null&&t.selected),s=(t==null?void 0:t.nodeChat)||{},i=Array.isArray(s.messages)?s.messages:[],a=String(s.draft||""),[l,c]=m.useState(a),u=m.useRef(!1),p=String(s.candidateContent||""),f=!!s.running,d=!!(t!=null&&t.readOnly),h=String(s.error||""),y=i.slice(-2);return m.useEffect(()=>{u.current||c(a)},[a]),!n&&!r?null:n?o.jsxs("div",{className:"af-work-node-chat nodrag nopan",onClick:w=>w.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 w;return(w=t==null?void 0:t.onCloseNodeChat)==null?void 0:w.call(t)},"aria-label":"关闭节点微调",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),i.length>0||f||h||p.trim()?o.jsxs("div",{className:"af-work-node-chat__messages",children:[y.map((w,b)=>o.jsxs("div",{className:`af-work-node-chat__msg af-work-node-chat__msg--${w.role==="assistant"?"assistant":"user"}`,children:[o.jsx("span",{children:w.role==="assistant"?"AI":"你"}),o.jsx("p",{children:w.text})]},`${w.at||b}-${b}`)),f?o.jsx("div",{className:"af-work-node-chat__pending",children:"生成中..."}):null,h?o.jsx("div",{className:"af-work-node-chat__error",children:h}):null]}):null,o.jsxs("div",{className:"af-work-node-chat__composer",children:[o.jsx("button",{type:"button",className:"af-work-node-chat__add",disabled:f||d,"aria-label":"添加上下文",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),o.jsx("textarea",{className:"af-work-node-chat__input",rows:2,value:l,disabled:f||d,placeholder:"描述你想怎么调整这个展示",onCompositionStart:()=>{u.current=!0},onCompositionEnd:w=>{var g;u.current=!1;const b=w.currentTarget.value;c(b),(g=t==null?void 0:t.onUpdateNodeChatDraft)==null||g.call(t,e,b)},onChange:w=>{var g;const b=w.target.value;c(b),u.current||(g=t==null?void 0:t.onUpdateNodeChatDraft)==null||g.call(t,e,b)},onKeyDown:w=>{var b,g;w.isComposing||(b=w.nativeEvent)!=null&&b.isComposing||w.keyCode===229||(w.metaKey||w.ctrlKey)&&w.key==="Enter"&&(w.preventDefault(),(g=t==null?void 0:t.onSendNodeChat)==null||g.call(t,e,l))}}),o.jsx("button",{type:"button",className:"af-work-node-chat__send",disabled:f||d||!l.trim(),onClick:()=>{var w;return(w=t==null?void 0:t.onSendNodeChat)==null?void 0:w.call(t,e,l)},"aria-label":"发送",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_upward"})})]}),o.jsxs("div",{className:"af-work-node-chat__actions",children:[o.jsx("button",{type:"button",disabled:f||d||!p.trim(),onClick:()=>{var w;return(w=t==null?void 0:t.onApplyNodeChatCandidate)==null?void 0:w.call(t,e,"replace")},children:"替换当前内容"}),o.jsx("button",{type:"button",disabled:f||d||!p.trim(),onClick:()=>{var w;return(w=t==null?void 0:t.onApplyNodeChatCandidate)==null?void 0:w.call(t,e,"append")},children:"追加"})]})]}):o.jsxs("button",{type:"button",className:"af-work-node-chat-anchor nodrag nopan",onClick:w=>{var b;w.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 L7(e){return e==="mermaid"?"mmd":e==="ascii"?"txt":e==="html"?"html":e==="react"?"json":e==="image"?"txt":e==="chart"||e==="table"?"json":"md"}function O7(e){return String(e).trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)||"display"}function D7(e){return String(e||"node").trim().replace(/[^a-zA-Z0-9._-]+/g,"_").replace(/^_+|_+$/g,"").slice(0,120)||"node"}function aj(e,t=""){const n=Sa(e,t).replace(/^\/+/,"");return n.startsWith("outputs/")?n:""}function F7(e,t){const n=D7(e),r=new Set,s=yn(t)||"";Ls(t==null?void 0:t.definitionId)&&r.add(`outputs/${n}`);const i=aj(No(t),s);return i&&r.add(i),(Array.isArray(t==null?void 0:t.outputs)?t.outputs:[]).some(c=>{const u=String((c==null?void 0:c.value)??(c==null?void 0:c.default)??"").trim().replace(/^\/+/,""),p=aj(u,s);return p&&r.add(p),u===`outputs/${n}`||u.startsWith(`outputs/${n}/`)})&&r.add(`outputs/${n}`),Array.from(r)}function lj(e,t){const n=yn(t)||"markdown";return`outputs/${O7((t==null?void 0:t.label)||e||n)}.${L7(n)}`}function sI({id:e,data:t,selected:n,deleteNode:r}){var he,ne,ce;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],a=(Array.isArray(t==null?void 0:t.outputs)?t.outputs:[]).map((re,le)=>({slot:re,idx:le})).sort((re,le)=>{var Ie,Je,Et,bt;const ue=String(((Ie=re.slot)==null?void 0:Ie.name)||"").trim(),Se=String(((Je=le.slot)==null?void 0:Je.name)||"").trim();if(ue==="next"&&Se!=="next")return-1;if(Se==="next"&&ue!=="next")return 1;const De=String(((Et=re.slot)==null?void 0:Et.type)||"").trim(),Ye=String(((bt=le.slot)==null?void 0:bt.type)||"").trim();return De==="node"&&Ye!=="node"?-1:Ye==="node"&&De!=="node"?1:re.idx-le.idx}),l=yn(t),c=m.useRef(null),u=m.useRef(null),[p,f]=m.useState(0),[d,h]=m.useState(!1),[y,w]=m.useState(!1),[b,g]=m.useState(!1),[k,x]=m.useState(""),[S,C]=m.useState(""),[j,E]=m.useState(!1),[A,O]=m.useState(!1),W=m.useRef(null),H=No(t),D=l==="markdown"?Pi(H):"",R=l==="markdown"?Sa(D,"markdown"):"",T=l==="markdown"?R?S:D:"",V=!!(t!=null&&t.readOnly),F=!!(t!=null&&t.displayPageMode);m.useEffect(()=>{let re=!1;return l!=="markdown"||!R?(C(""),E(!1),()=>{re=!0}):(E(!0),Hl((t==null?void 0:t.flowParams)||{},R).then(le=>{re||C(le)}).catch(le=>{var ue;re||(C(""),(ue=t==null?void 0:t.onStatus)==null||ue.call(t,String(le.message||le)))}).finally(()=>{re||E(!1)}),()=>{re=!0})},[l,R,(he=t==null?void 0:t.flowParams)==null?void 0:he.flowId,(ne=t==null?void 0:t.flowParams)==null?void 0:ne.flowSource,(ce=t==null?void 0:t.flowParams)==null?void 0:ce.archived,t==null?void 0:t.displayReloadKey]),m.useEffect(()=>{if(!y)return;const re=()=>w(!1);return window.addEventListener("pointerup",re,!0),window.addEventListener("pointercancel",re,!0),window.addEventListener("mouseup",re,!0),window.addEventListener("blur",re),()=>{window.removeEventListener("pointerup",re,!0),window.removeEventListener("pointercancel",re,!0),window.removeEventListener("mouseup",re,!0),window.removeEventListener("blur",re)}},[y]),m.useEffect(()=>{b||x(String(T||""))},[T,b]);const M=(t==null?void 0:t.label)||(l==="mermaid"?"Mermaid":l==="ascii"?"ASCII":l==="html"?"HTML":l==="react"?"React App":l==="image"?"Image":l==="chart"?"Chart":l==="table"?"Table":"Markdown"),I=String((t==null?void 0:t.sourceNodeId)||e),B=(t==null?void 0:t.sharingDisplayNodeId)===I,_=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,q=m.useCallback(async()=>{var Pe,rt,At,zt,Kt,tt,oe,be,ke,st;if(l!=="html"||d)return;const re=No(t),le=Sa(re,l);let ue=re;if(le)try{ue=await Hl((t==null?void 0:t.flowParams)||{},le)}catch(Ze){h(!1),console.warn("Failed to read HTML display file before saving image.",Ze);return}const Se=Xl(ue);if(!Se.trim())return;const De=ta(l,Se);if(De){console.warn(De);return}const Ye=(rt=(Pe=u.current)==null?void 0:Pe.getBoundingClientRect)==null?void 0:rt.call(Pe),Ie=(zt=(At=c.current)==null?void 0:At.querySelector)==null?void 0:zt.call(At,".af-work-display-body"),Je=(tt=(Kt=c.current)==null?void 0:Kt.querySelector)==null?void 0:tt.call(Kt,".af-visible-scroll-frame__scroller"),Et=Math.round(Math.max(Number((Ye==null?void 0:Ye.width)||0),Number((_==null?void 0:_.width)||0),Number(((oe=c.current)==null?void 0:oe.clientWidth)||0),Number((Ie==null?void 0:Ie.clientWidth)||0),Number((Je==null?void 0:Je.clientWidth)||0),Math.max(320,Number((_==null?void 0:_.width)||960)-2))),bt=Math.round(Math.max(Number((Ye==null?void 0:Ye.height)||0),Number((_==null?void 0:_.height)||0),Number(((be=c.current)==null?void 0:be.clientHeight)||0),Number((Ie==null?void 0:Ie.clientHeight)||0),Number((Je==null?void 0:Je.clientHeight)||0),Math.max(180,Number((_==null?void 0:_.height)||640)-46)));h(!0);try{await A7({flowParams:(t==null?void 0:t.flowParams)||{},content:Se,sourceFilePath:le,iframe:u.current,width:Et,height:bt,filename:N7((t==null?void 0:t.label)||e||"html-render","png"),snapshotElements:{card:c.current,displayBody:Ie,scroller:Je},displaySize:_}),(ke=t==null?void 0:t.onStatus)==null||ke.call(t,"已导出 HTML 展示截图")}catch(Ze){const kt=String((Ze==null?void 0:Ze.message)||Ze||"截图失败");(st=t==null?void 0:t.onStatus)==null||st.call(t,`HTML 截图失败:${kt}`),console.warn("Failed to save HTML display as PNG.",Ze)}finally{h(!1)}},[t,_==null?void 0:_.height,_==null?void 0:_.width,e,l,d]),z=m.useCallback(re=>{var le;V||!re||l!=="image"||(le=t==null?void 0:t.onUploadImageToDisplayNode)==null||le.call(t,e,re)},[t,e,l,V]),$=m.useCallback(re=>{var le,ue;(le=re==null?void 0:re.stopPropagation)==null||le.call(re),!V&&((ue=t==null?void 0:t.onSetDisplayNodeContent)==null||ue.call(t,e,"","replace",{logChat:!1,reloadDisplay:!0,statusMessage:"已清空 Display 内容"}),l==="markdown"&&(x(""),g(!1)))},[t,e,l,V]),Q=m.useCallback(re=>{var Se,De;V||l!=="image"||!(Array.from(((Se=re.dataTransfer)==null?void 0:Se.files)||[]).some(Vp)||Array.from(((De=re.dataTransfer)==null?void 0:De.items)||[]).some(Ye=>String((Ye==null?void 0:Ye.type)||"").startsWith("image/")))||(re.preventDefault(),re.stopPropagation(),re.dataTransfer.dropEffect="copy",O(!0))},[l,V]),te=m.useCallback(re=>{l==="image"&&(re.currentTarget.contains(re.relatedTarget)||O(!1))},[l]),ie=m.useCallback(re=>{var ue;if(l!=="image")return;const le=Array.from(((ue=re.dataTransfer)==null?void 0:ue.files)||[]).find(Vp);le&&(re.preventDefault(),re.stopPropagation(),O(!1),z(le))},[l,z]);return o.jsxs("div",{className:"af-work-display-card"+(_?" af-work-display-card--sized":"")+(n?" af-work-display-card--selected":"")+(y?" af-work-display-card--resizing":"")+(A?" af-work-display-card--image-drop":"")+(F?" 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:_?{width:_.width,height:_.height}:void 0,ref:c,onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,onDragOver:Q,onDragLeave:te,onDrop:ie,children:[o.jsx(Jw,{className:"af-work-display-resize nodrag",position:"bottom-right",minWidth:320,minHeight:180,onResizeStart:()=>w(!0),onResizeEnd:()=>w(!1),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),s.map((re,le)=>{if(re.showOnNode===!1)return null;const ue=`${4.15+le*1.75}rem`,Se=re.name||`#${le+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:ue},children:Se}),o.jsx(Ln,{type:"target",position:Oe.Left,id:`input-${le}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:ue,background:wn(re.type)},title:`${Se} · ${re.type}`})]},`in-${le}`)}),a.map(({slot:re,idx:le},ue)=>{if(re.showOnNode===!1)return null;const Se=`${4.15+ue*1.75}rem`,De=re.name||`#${le+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:Se},children:De}),o.jsx(Ln,{type:"source",position:Oe.Right,id:`output-${le}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:Se,background:wn(re.type)},title:`${De} · ${re.type}`})]},`out-${le}`)}),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:tI(l)}),o.jsx("strong",{children:M}),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:re=>re.stopPropagation(),children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var re,le,ue,Se;try{(Se=(ue=(le=(re=u.current)==null?void 0:re.contentWindow)==null?void 0:le.history)==null?void 0:ue.back)==null||Se.call(ue)}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 re,le,ue,Se;try{(Se=(ue=(le=(re=u.current)==null?void 0:re.contentWindow)==null?void 0:le.history)==null?void 0:ue.forward)==null||Se.call(ue)}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(re=>re+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:d,onClick:q,"aria-label":"截图另存为图片",title:"截图另存为图片",children:o.jsx("span",{className:"material-symbols-outlined",children:d?"hourglass_empty":"photo_camera"})})]}):null,l==="markdown"?b?o.jsxs("div",{className:"af-work-display-card__html-controls nodrag",onClick:re=>re.stopPropagation(),children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:V||j,onClick:async()=>{var re,le,ue;if(R){try{const Se=await jx((t==null?void 0:t.flowParams)||{},R,k);C(k),(re=t==null?void 0:t.onSetDisplayNodeContent)==null||re.call(t,e,Se,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已更新 ${Se}`}),g(!1)}catch(Se){(le=t==null?void 0:t.onStatus)==null||le.call(t,String(Se.message||Se))}return}(ue=t==null?void 0:t.onSetDisplayNodeContent)==null||ue.call(t,e,k,"replace",{logChat:!1,statusMessage:"已更新 Markdown 内容"}),g(!1)},"aria-label":"保存并预览",title:"保存并预览",children:o.jsx("span",{className:"material-symbols-outlined",children:"done"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{x(String(T||"")),g(!1)},"aria-label":"取消编辑",title:"取消编辑",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}):o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:V||j,onClick:re=>{re.stopPropagation(),x(String(T||"")),g(!0)},"aria-label":"编辑 Markdown",title:"编辑 Markdown",children:o.jsx("span",{className:"material-symbols-outlined",children:"edit"})}):null,l==="image"?o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:W,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:re=>{var ue;const le=(ue=re.target.files)==null?void 0:ue[0];re.target.value="",le&&z(le)}}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:V,onClick:re=>{var le;re.stopPropagation(),(le=W.current)==null||le.click()},"aria-label":"上传图片",title:"上传图片",children:o.jsx("span",{className:"material-symbols-outlined",children:"upload"})})]}):null,o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",onClick:re=>{var le;re.stopPropagation(),(le=t==null?void 0:t.onOpenDisplayPreview)==null||le.call(t,I)},"aria-label":"全屏预览",title:"全屏预览",children:o.jsx("span",{className:"material-symbols-outlined",children:"fullscreen"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:B,onClick:re=>{var le;re.stopPropagation(),(le=t==null?void 0:t.onShareDisplayNode)==null||le.call(t,I)},"aria-label":"分享展示",title:"分享展示",children:o.jsx("span",{className:"material-symbols-outlined",children:B?"hourglass_empty":"ios_share"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:V,onClick:$,"aria-label":"清空内容",title:"清空内容",children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_sweep"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:V,onClick:()=>{var re;return(re=t==null?void 0:t.onSaveDisplayNodeToFile)==null?void 0:re.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:V,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l==="markdown"&&b?o.jsx(M7,{value:k,onChange:x,onUploadImage:t==null?void 0:t.onUploadWorkspaceImage,readOnly:V}):o.jsx(rI,{data:t,flowParams:t==null?void 0:t.flowParams,htmlFrameRef:u,htmlFrameVersion:p}),o.jsx($7,{nodeId:e,data:t})]})}function z7({id:e,data:t,selected:n,deleteNode:r}){var p,f,d;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],i=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],a=((f=(p=t==null?void 0:t.runningRunNodeIds)==null?void 0:p.has)==null?void 0:f.call(p,e))||((d=t==null?void 0:t.runningRunNodeIds)==null?void 0:d[e])===!0||(t==null?void 0:t.isExecuting)||(t==null?void 0:t.nodeStatus)==="running",l=(t==null?void 0:t.optimizingRun)===!0,c=(t==null?void 0:t.nodeStatus)==="stopped",u=!!(t!=null&&t.readOnly);return o.jsxs("div",{className:"af-work-run-card"+(n?" af-work-run-card--selected":"")+(a?" af-work-run-card--running":"")+(t!=null&&t.isExecuting?" af-work-run-card--executing":"")+((t==null?void 0:t.nodeStatus)==="success"?" af-work-run-card--done":"")+((t==null?void 0:t.nodeStatus)==="failed"?" af-work-run-card--failed":"")+(c?" af-work-run-card--stopped":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[s.map((h,y)=>{if(h.showOnNode===!1)return null;const w=`${2.25+y*1.75}rem`,b=h.name||`#${y+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:w},children:b}),o.jsx(Ln,{type:"target",position:Oe.Left,id:`input-${y}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:w,background:wn(h.type)},title:`${b} · ${h.type}`})]},`in-${y}`)}),i.map((h,y)=>{if(h.showOnNode===!1)return null;const w=`${2.25+y*1.75}rem`,b=h.name||`#${y+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:w},children:b}),o.jsx(Ln,{type:"source",position:Oe.Right,id:`output-${y}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:w,background:wn(h.type)},title:`${b} · ${h.type}`})]},`out-${y}`)}),o.jsxs("div",{className:"af-work-run-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"play_circle"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"Run"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"workspace_run"}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",disabled:u,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-run-card__actions",children:[o.jsxs("button",{type:"button",className:"af-work-run-card__button nodrag"+(a?" af-work-run-card__button--stop":""),disabled:u||l,onClick:h=>{var y,w;h.stopPropagation(),a?(y=t==null?void 0:t.onStopWorkspaceNode)==null||y.call(t,e):(w=t==null?void 0:t.onRunWorkspaceNode)==null||w.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"})]}),o.jsx("button",{type:"button",className:"af-work-run-card__button af-work-run-card__optimize nodrag"+(l?" af-work-run-card__optimize--running":""),disabled:u||a||l,title:l?"正在优化":"为下游节点提前生成 implementation","aria-label":l?"正在优化":"优化",onClick:h=>{var y;h.stopPropagation(),(y=t==null?void 0:t.onOptimizeWorkspaceRun)==null||y.call(t,e)},children:o.jsx("span",{className:"material-symbols-outlined",children:l?"sync":"auto_fix_high"})}),o.jsx("button",{type:"button",className:"af-work-run-card__button af-work-run-card__logs nodrag",title:"查看执行日志","aria-label":"查看执行日志",onClick:h=>{var y;h.stopPropagation(),(y=t==null?void 0:t.onOpenWorkspaceRunLogs)==null||y.call(t,{nodeId:e,runNodeId:e,scheduleNodeId:"",label:(t==null?void 0:t.label)||"Run"})},children:o.jsx("span",{className:"material-symbols-outlined",children:"article"})})]})]})}function B7({id:e,data:t,selected:n,deleteNode:r,skills:s,skillCollections:i,workspaces:a}){var be,ke,st,Ze,kt,Bt,Gt;const l=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],c=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],u=nU(t),[p,f]=m.useState(u.task),d=m.useRef(!1),h=m.useRef(u.task),y=((ke=(be=t==null?void 0:t.runningRunNodeIds)==null?void 0:be.has)==null?void 0:ke.call(be,e))||((st=t==null?void 0:t.runningRunNodeIds)==null?void 0:st[e])===!0||(t==null?void 0:t.isExecuting)||(t==null?void 0:t.nodeStatus)==="running",w=(t==null?void 0:t.nodeStatus)==="stopped",b=!!(t!=null&&t.readOnly),g=Array.isArray(s)?s:[],k=Array.isArray(i)?i:[],x=m.useMemo(()=>(Array.isArray(a)?a:[]).map(Z=>({id:String((Z==null?void 0:Z.id)||""),label:String((Z==null?void 0:Z.label)||(Z==null?void 0:Z.name)||"知识库"),kind:(Z==null?void 0:Z.kind)==="git"?"git":"local",path:String((Z==null?void 0:Z.path)||""),repoUrl:String((Z==null?void 0:Z.repoUrl)||""),branch:String((Z==null?void 0:Z.branch)||""),mountPath:String((Z==null?void 0:Z.mountPath)||""),builtin:(Z==null?void 0:Z.builtin)===!0,exists:(Z==null?void 0:Z.exists)!==!1,type:String((Z==null?void 0:Z.type)||"")})).filter(Z=>Z.path),[a]),[S,C]=m.useState(!1),[j,E]=m.useState(""),[A,O]=m.useState(()=>new Set),[W,H]=m.useState(!1),[D,R]=m.useState(""),[T,V]=m.useState("config"),F=zh(t),M=!!F,I=dI(u.displayType),B=m.useMemo(()=>b7(t,I),[t==null?void 0:t.displaySize,t==null?void 0:t.nodeSize,t==null?void 0:t.inputs,t==null?void 0:t.input,I]),_=m.useMemo(()=>({...t,sourceNodeId:e,label:t!=null&&t.label&&t.label!=="Context Run"?t.label:"一键任务",definitionId:I,displaySize:B,nodeSize:B,body:F,inputs:[{type:"text",name:I==="display_image"?"src":"content",value:F,default:F}],outputs:c.length?c:[{type:"node",name:"next",default:""}]}),[t,I,e,F,c,B]),q=Array.isArray((Ze=t==null?void 0:t.modelLists)==null?void 0:Ze.cursor)?t.modelLists.cursor:[],z=Array.isArray((kt=t==null?void 0:t.modelLists)==null?void 0:kt.opencode)?t.modelLists.opencode:[],$=Array.isArray((Bt=t==null?void 0:t.modelLists)==null?void 0:Bt.claudeCode)?t.modelLists.claudeCode:[],Q=Array.isArray((Gt=t==null?void 0:t.modelLists)==null?void 0:Gt.codex)?t.modelLists.codex:[],te=m.useMemo(()=>new Set(q.map(ls)),[q]),ie=m.useMemo(()=>new Set(z.map(ls)),[z]),he=m.useMemo(()=>new Set($.map(ls)),[$]),ne=m.useMemo(()=>new Set(Q.map(ls)),[Q]),ce=u.model,re=m.useMemo(()=>ce?ce.startsWith("cursor:")||ce.startsWith("opencode:")||ce.startsWith("codex:")||ce.startsWith("claude-code:")?ce:he.has(ce)?`claude-code:${ce}`:ne.has(ce)?`codex:${ce}`:ie.has(ce)?`opencode:${ce}`:te.has(ce)?`cursor:${ce}`:ce:"",[he,ne,te,ie,ce]),le=ce.startsWith("cursor:")?ce.slice(7):ce.startsWith("opencode:")?ce.slice(9):ce.startsWith("codex:")?ce.slice(6):ce.startsWith("claude-code:")?ce.slice(12):ce,ue=le,Se=!!ce&&!te.has(ue)&&!ie.has(ue)&&!he.has(ue)&&!ne.has(ue),De=m.useMemo(()=>new Set(u.skillKeys),[u.skillKeys]),Ye=m.useMemo(()=>new Map(g.map(Z=>[Z.key,Z])),[g]),Ie=m.useMemo(()=>{const Z=new Set,xe=k.map(Ee=>{const ut=ha(Ee,g).map(St=>Ye.get(St)).filter(Boolean);for(const St of ut)Z.add(St.key);return{...Ee,skills:ut}}).filter(Ee=>Ee.skills.length>0),$e=g.filter(Ee=>!Z.has(Ee.key));return{collectionGroups:xe,ungrouped:$e}},[k,Ye,g]);m.useEffect(()=>{O(Z=>{let xe=!1;const $e=new Set(Z);for(const Ee of Ie.collectionGroups)$e.has(Ee.id)||($e.add(Ee.id),xe=!0);return xe?$e:Z})},[Ie.collectionGroups]);const Je=m.useMemo(()=>{const Z=j.trim().toLowerCase();if(!Z)return Ie;const xe=Ee=>[Ee==null?void 0:Ee.key,Ee==null?void 0:Ee.name,Ee==null?void 0:Ee.description].map(ut=>String(ut||"").toLowerCase()).join(" ").includes(Z);return{collectionGroups:Ie.collectionGroups.map(Ee=>{const ut=[Ee==null?void 0:Ee.id,Ee==null?void 0:Ee.name,Ee==null?void 0:Ee.description].map(St=>String(St||"").toLowerCase()).join(" ").includes(Z);return{...Ee,skills:ut?Ee.skills:Ee.skills.filter(xe)}}).filter(Ee=>Ee.skills.length>0),ungrouped:Ie.ungrouped.filter(xe)}},[Ie,j]),Et=m.useMemo(()=>{const Z=D.trim().toLowerCase();return Z?x.filter(xe=>[xe.id,xe.label,xe.path,xe.repoUrl,xe.branch,xe.mountPath,xe.type].join(" ").toLowerCase().includes(Z)):x},[x,D]),bt=m.useMemo(()=>mI(u.knowledgeContext),[u.knowledgeContext]),Pe=m.useMemo(()=>new Set(bt.map(Z=>Z.id||Z.path||Z.repoPath).filter(Boolean)),[bt]);m.useEffect(()=>{u.task!==h.current&&(h.current=u.task,d.current||f(u.task))},[u.task]),m.useEffect(()=>{if(!M){V("config");return}y||V("result")},[M,F,y]),m.useEffect(()=>{var xe,$e;if(!(T==="result"&&M))return;(xe=t==null?void 0:t.onEnsureWorkspaceNodeDisplaySize)==null||xe.call(t,e,B),($e=t==null?void 0:t.onRefreshNodeInternals)==null||$e.call(t,e);const Z=window.setTimeout(()=>{var Ee;return(Ee=t==null?void 0:t.onRefreshNodeInternals)==null?void 0:Ee.call(t,e)},120);return()=>window.clearTimeout(Z)},[t==null?void 0:t.onEnsureWorkspaceNodeDisplaySize,t==null?void 0:t.onRefreshNodeInternals,I,M,e,F,B,T]);const rt=Z=>{var xe;(xe=t==null?void 0:t.onChangeContextRunConfig)==null||xe.call(t,e,{...u,task:p,...Z})},At=(Z=p)=>{var $e;const xe=String(Z??"");xe!==u.task&&(h.current=xe,($e=t==null?void 0:t.onChangeContextRunConfig)==null||$e.call(t,e,{...u,task:xe}))},zt=(Z,xe)=>{const $e=new Set(u.skillKeys);for(const Ee of Z){const ut=String(Ee||"").trim();ut&&(xe?$e.add(ut):$e.delete(ut))}rt({skillKeys:Array.from($e)})},Kt=Z=>{O(xe=>{const $e=new Set(xe);return $e.has(Z)?$e.delete(Z):$e.add(Z),$e})},tt=(Z,xe)=>{const $e=(Z==null?void 0:Z.id)||(Z==null?void 0:Z.path)||"";if(!$e)return;const Ee=x.filter(ut=>{const St=ut.id||ut.path||"";return St===$e?xe:Pe.has(St)});rt({knowledgeContext:Bh(Ee)})},oe=()=>{rt({knowledgeContext:null})};return T==="result"&&M?o.jsx(sI,{id:e,data:{..._,selected:t==null?void 0:t.selected,onSelectNodePointerDown:t==null?void 0:t.onSelectNodePointerDown},selected:n,deleteNode:r}):o.jsxs("div",{className:"af-work-context-run-card"+(n?" af-work-context-run-card--selected":"")+(T==="result"&&M?" af-work-context-run-card--result":"")+(y?" af-work-context-run-card--running":"")+((t==null?void 0:t.nodeStatus)==="success"?" af-work-context-run-card--done":"")+((t==null?void 0:t.nodeStatus)==="failed"?" af-work-context-run-card--failed":"")+(w?" af-work-context-run-card--stopped":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[l.map((Z,xe)=>{if(Z.showOnNode===!1)return null;const $e=`${2.25+xe*1.75}rem`,Ee=Z.name||`#${xe+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:$e},children:Ee}),o.jsx(Ln,{type:"target",position:Oe.Left,id:`input-${xe}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:$e,background:wn(Z.type)},title:`${Ee} · ${Z.type}`})]},`in-${xe}`)}),c.map((Z,xe)=>{if(Z.showOnNode===!1)return null;const $e=`${2.25+xe*1.75}rem`,Ee=Z.name||`#${xe+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:$e},children:Ee}),o.jsx(Ln,{type:"source",position:Oe.Right,id:`output-${xe}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:$e,background:wn(Z.type)},title:`${Ee} · ${Z.type}`})]},`out-${xe}`)}),o.jsxs("div",{className:"af-work-context-run-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"automation"}),o.jsx("strong",{children:t!=null&&t.label&&t.label!=="Context Run"?t.label:"一键任务"}),o.jsxs("div",{className:"af-work-context-run-card__model-wrap nodrag",onPointerDown:Z=>Z.stopPropagation(),onMouseDown:Z=>Z.stopPropagation(),onClick:Z=>Z.stopPropagation(),children:[o.jsxs("select",{className:"af-work-context-run-card__model",value:re,disabled:b,"aria-label":"模型",title:le||"默认模型",onChange:Z=>rt({model:Z.target.value}),children:[o.jsx("option",{value:"",children:"默认"}),Se?o.jsx("option",{value:ce,children:ce}):null,q.length?o.jsx("optgroup",{label:"Cursor",children:q.map(Z=>o.jsx("option",{value:`cursor:${ls(Z)}`,children:ls(Z)},`context-cursor-${Z}`))}):null,z.length?o.jsx("optgroup",{label:"OpenCode",children:z.map(Z=>o.jsx("option",{value:`opencode:${ls(Z)}`,children:ls(Z)},`context-opencode-${Z}`))}):null,Q.length?o.jsx("optgroup",{label:"Codex",children:Q.map(Z=>o.jsx("option",{value:`codex:${ls(Z)}`,children:ls(Z)},`context-codex-${Z}`))}):null,$.length?o.jsx("optgroup",{label:"Claude Code",children:$.map(Z=>o.jsx("option",{value:`claude-code:${ls(Z)}`,children:ls(Z)},`context-claude-${Z}`))}):null]}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"expand_more"})]}),o.jsx("span",{className:"af-work-context-run-card__kind",children:Ls(t==null?void 0:t.definitionId)?"workspace_one_click_task":(t==null?void 0:t.definitionId)||"workspace_one_click_task"}),M?o.jsxs("div",{className:"af-work-context-run-card__view-switch nodrag",onClick:Z=>Z.stopPropagation(),children:[o.jsx("button",{type:"button",className:T==="config"?"is-active":"",onClick:()=>V("config"),"aria-label":"切换到任务配置",children:o.jsx("span",{className:"material-symbols-outlined",children:"tune"})}),o.jsx("button",{type:"button",className:T==="result"?"is-active":"",onClick:()=>V("result"),"aria-label":"切换到展示结果",children:o.jsx("span",{className:"material-symbols-outlined",children:"preview"})})]}):null,o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",disabled:b,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-context-run-card__body nodrag",children:[o.jsxs(o.Fragment,{children:[o.jsx("textarea",{value:p,disabled:b,placeholder:"输入任务,例如:基于选中的知识库总结需求并生成展示页",onCompositionStart:()=>{d.current=!0},onCompositionEnd:Z=>{d.current=!1,f(Z.currentTarget.value),At(Z.currentTarget.value)},onChange:Z=>{f(Z.target.value)},onBlur:Z=>At(Z.currentTarget.value)}),o.jsxs("div",{className:"af-work-context-run-card__grid",children:[o.jsxs("div",{className:"af-work-context-run-card__skills",children:[o.jsxs("button",{type:"button",disabled:b,className:"af-work-context-run-card__select",onClick:Z=>{var xe;Z.stopPropagation(),S||(xe=t==null?void 0:t.onRefreshSkills)==null||xe.call(t),C($e=>!$e)},children:[o.jsx("span",{className:"material-symbols-outlined",children:"extension"}),o.jsx("span",{children:u.skillKeys.length?`${u.skillKeys.length} skills`:"Skills"}),o.jsx("span",{className:"material-symbols-outlined",children:"expand_more"})]}),S?o.jsxs("div",{className:"af-work-context-run-card__skills-menu",onClick:Z=>Z.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:j,onChange:Z=>E(Z.target.value),placeholder:"搜索 Skills...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Skills"}),j?o.jsx("button",{type:"button",onClick:()=>E(""),"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 af-work-context-run-card__menu-scroll",children:[Je.collectionGroups.map(Z=>{const xe=Z.skills.map(St=>St.key),$e=xe.filter(St=>De.has(St)).length,Ee=xe.length>0&&$e===xe.length,ut=A.has(Z.id);return o.jsxs("section",{className:"af-work-load-skills-menu__group"+(ut?" 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:Ee,disabled:b,onChange:St=>zt(xe,St.target.checked),"aria-label":`选择 ${Z.name}`}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-toggle",onClick:()=>Kt(Z.id),"aria-expanded":!ut,children:o.jsxs("span",{className:"af-work-load-skills-menu__group-main",children:[o.jsx("span",{children:Z.name}),Z.description?o.jsx("em",{children:Z.description}):null]})}),o.jsxs("small",{children:[$e,"/",xe.length]}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-arrow",onClick:()=>Kt(Z.id),"aria-label":ut?`展开 ${Z.name}`:`收起 ${Z.name}`,children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:ut?"chevron_right":"expand_more"})})]}),ut?null:o.jsx("div",{className:"af-work-load-skills-menu__options",children:Z.skills.map(St=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:De.has(St.key),disabled:b,onChange:ir=>zt([St.key],ir.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:St.name}),St.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:St.description}):null]})]},`${Z.id}:${St.key}`))})]},Z.id)}),Je.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:Je.ungrouped.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:Je.ungrouped.map(Z=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:De.has(Z.key),disabled:b,onChange:xe=>zt([Z.key],xe.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:Z.name}),Z.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:Z.description}):null]})]},`ungrouped:${Z.key}`))})]}):null,Je.collectionGroups.length===0&&Je.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:()=>rt({skillKeys:[]}),children:"清空"})]})]}):null]}),o.jsxs("div",{className:"af-work-context-run-card__workspace",children:[o.jsxs("button",{type:"button",disabled:b,className:"af-work-context-run-card__select",onClick:Z=>{var xe;Z.stopPropagation(),W||(xe=t==null?void 0:t.onRefreshWorkspaces)==null||xe.call(t),H($e=>!$e)},children:[o.jsx("span",{className:"material-symbols-outlined",children:bt.length?"folder_open":"folder_off"}),o.jsx("span",{children:bt.length?`${bt.length} 知识库`:"知识库"}),o.jsx("span",{className:"material-symbols-outlined",children:"expand_more"})]}),W?o.jsxs("div",{className:"af-work-context-run-card__workspace-menu",onClick:Z=>Z.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:D,onChange:Z=>R(Z.target.value),placeholder:"搜索知识库...",spellCheck:!1,autoComplete:"off","aria-label":"搜索知识库"}),D?o.jsx("button",{type:"button",onClick:()=>R(""),"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 af-work-context-run-card__menu-scroll",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:"知识库"}),o.jsx("small",{children:Et.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:Et.map(Z=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:Pe.has(Z.id||Z.path),disabled:b,onChange:xe=>tt(Z,xe.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:Z.label}),o.jsxs("span",{className:"af-work-load-skills-menu__option-desc",children:[Z.kind==="git"&&Z.repoUrl?`${Z.repoUrl}${Z.branch?` · ${Z.branch}`:""}${Z.mountPath?` · ${Z.mountPath}`:""}`:Z.path,Z.exists?"":" · 路径未就绪"]})]})]},`${Z.id}:${Z.path}`))})]}),Et.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的知识库"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:oe,children:"清空知识库"})]})]}):null]}),o.jsxs("select",{value:u.displayType,disabled:b,onChange:Z=>rt({displayType:Z.target.value}),children:[o.jsx("option",{value:"markdown",children:"Markdown"}),o.jsx("option",{value:"html",children:"HTML"}),o.jsx("option",{value:"react",children:"React"}),o.jsx("option",{value:"table",children:"Table"}),o.jsx("option",{value:"chart",children:"Chart"}),o.jsx("option",{value:"ascii",children:"ASCII"}),o.jsx("option",{value:"mermaid",children:"Mermaid"})]})]}),F?o.jsx("pre",{className:"af-work-context-run-card__preview",children:F.slice(0,520)}):null]}),o.jsxs("div",{className:"af-work-context-run-card__actions",children:[o.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-context-run-card__run nodrag"+(y?" af-work-run-card__button--stop":""),disabled:b,onClick:Z=>{var xe,$e;Z.stopPropagation(),At(),y?(xe=t==null?void 0:t.onStopWorkspaceNode)==null||xe.call(t,e):($e=t==null?void 0:t.onRunWorkspaceNode)==null||$e.call(t,e)},children:[o.jsx("span",{className:"material-symbols-outlined",children:y?"stop_circle":"play_arrow"}),o.jsx("span",{children:y?"Stop":"Run"})]}),o.jsx("button",{type:"button",className:"af-work-run-card__button af-work-context-run-card__logs nodrag",onClick:Z=>{var xe;Z.stopPropagation(),(xe=t==null?void 0:t.onOpenWorkspaceRunLogs)==null||xe.call(t,{nodeId:e,runNodeId:e,scheduleNodeId:"",label:t!=null&&t.label&&t.label!=="Context Run"?t.label:"一键任务"})},children:o.jsx("span",{className:"material-symbols-outlined",children:"article"})})]})]})]})}function H7({id:e,data:t,selected:n,deleteNode:r}){var S,C,j;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],i=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],a=Sb((t==null?void 0:t.body)||""),l=(t==null?void 0:t.scheduledRunState)||{},c=((C=(S=t==null?void 0:t.runningRunNodeIds)==null?void 0:S.has)==null?void 0:C.call(S,e))||((j=t==null?void 0:t.runningRunNodeIds)==null?void 0:j[e])===!0||(t==null?void 0:t.isExecuting)||(t==null?void 0:t.nodeStatus)==="running",u=(t==null?void 0:t.optimizingRun)===!0,p=(t==null?void 0:t.nodeStatus)==="stopped",f=!!(t!=null&&t.readOnly),d=E=>{var A;(A=t==null?void 0:t.onChangeScheduledRunConfig)==null||A.call(t,e,{...a,...E})},h=E=>{d({scheduleType:E,cron:Wc(E,a.time,a.weekday,a.monthDay,a.cron)})},y=E=>{d({time:E,cron:Wc(a.scheduleType,E,a.weekday,a.monthDay,a.cron)})},[w,b]=vb(a.time).split(":"),g=(E,A)=>{y(`${fo(E,9,0,23)}:${fo(A,0,0,59)}`)},k=E=>{d({weekday:E,cron:Wc(a.scheduleType,a.time,E,a.monthDay,a.cron)})},x=E=>{d({monthDay:E,cron:Wc(a.scheduleType,a.time,a.weekday,E,a.cron)})};return o.jsxs("div",{className:"af-work-run-card af-work-schedule-card"+(n?" af-work-run-card--selected":"")+(a.enabled?" af-work-schedule-card--enabled":"")+(c?" 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":"")+(p?" af-work-run-card--stopped":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[s.map((E,A)=>{if(E.showOnNode===!1)return null;const O=`${2.25+A*1.75}rem`,W=E.name||`#${A+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:O},children:W}),o.jsx(Ln,{type:"target",position:Oe.Left,id:`input-${A}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:O,background:wn(E.type)},title:`${W} · ${E.type}`})]},`in-${A}`)}),i.map((E,A)=>{if(E.showOnNode===!1)return null;const O=`${2.25+A*1.75}rem`,W=E.name||`#${A+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:O},children:W}),o.jsx(Ln,{type:"source",position:Oe.Right,id:`output-${A}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:O,background:wn(E.type)},title:`${W} · ${E.type}`})]},`out-${A}`)}),o.jsxs("div",{className:"af-work-run-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"event_repeat"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"Scheduled Run"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"workspace_scheduled_run"}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",disabled:f,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-schedule-card__body nodrag",children:[o.jsxs("label",{className:"af-work-schedule-card__toggle",children:[o.jsx("input",{type:"checkbox",checked:a.enabled,disabled:f,onChange:E=>d({enabled:E.target.checked})}),o.jsx("span",{children:a.enabled?"定时开启":"定时关闭"})]}),o.jsxs("label",{className:"af-work-schedule-card__field",children:[o.jsx("span",{children:"频率"}),o.jsxs("select",{value:a.scheduleType,disabled:f,onChange:E=>h(E.target.value),children:[o.jsx("option",{value:"daily",children:"每天"}),o.jsx("option",{value:"weekly",children:"每周"}),o.jsx("option",{value:"monthly",children:"每月"}),o.jsx("option",{value:"custom",children:"高级 Cron"})]})]}),a.scheduleType!=="custom"?o.jsxs("label",{className:"af-work-schedule-card__field",children:[o.jsx("span",{children:"时间"}),o.jsxs("div",{className:"af-work-schedule-time-selects",children:[o.jsx("select",{value:w,disabled:f,"aria-label":"小时",onChange:E=>g(E.target.value,b),children:Array.from({length:24},(E,A)=>fo(A,0,0,23)).map(E=>o.jsxs("option",{value:E,children:[E," 时"]},E))}),o.jsx("select",{value:b,disabled:f,"aria-label":"分钟",onChange:E=>g(w,E.target.value),children:Array.from({length:12},(E,A)=>fo(A*5,0,0,59)).map(E=>o.jsxs("option",{value:E,children:[E," 分"]},E))})]})]}):null,a.scheduleType==="weekly"?o.jsxs("label",{className:"af-work-schedule-card__field",children:[o.jsx("span",{children:"星期"}),o.jsxs("select",{value:a.weekday,disabled:f,onChange:E=>k(E.target.value),children:[o.jsx("option",{value:1,children:"周一"}),o.jsx("option",{value:2,children:"周二"}),o.jsx("option",{value:3,children:"周三"}),o.jsx("option",{value:4,children:"周四"}),o.jsx("option",{value:5,children:"周五"}),o.jsx("option",{value:6,children:"周六"}),o.jsx("option",{value:0,children:"周日"})]})]}):null,a.scheduleType==="monthly"?o.jsxs("label",{className:"af-work-schedule-card__field",children:[o.jsx("span",{children:"日期"}),o.jsx("select",{value:a.monthDay,disabled:f,onChange:E=>x(E.target.value),children:Array.from({length:31},(E,A)=>A+1).map(E=>o.jsxs("option",{value:E,children:[E," 日"]},E))})]}):null,a.scheduleType==="custom"?o.jsxs("label",{className:"af-work-schedule-card__field",children:[o.jsx("span",{children:"Cron"}),o.jsx("input",{type:"text",value:a.cron,disabled:f,spellCheck:!1,placeholder:Bu,onChange:E=>d({cron:E.target.value})})]}):null,o.jsxs("div",{className:"af-work-schedule-card__meta",children:[o.jsxs("span",{children:[l7(a.scheduleType)," ",a.scheduleType==="custom"?"":a.time]}),o.jsxs("span",{children:["Next ",a7(l.nextAt)]}),o.jsx("span",{children:c?"running":l.lastStatus||"idle"})]}),l.lastError?o.jsx("div",{className:"af-work-schedule-card__error",children:l.lastError}):null,o.jsxs("div",{className:"af-work-schedule-card__actions",children:[o.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-schedule-card__run-now nodrag"+(c?" af-work-run-card__button--stop":""),disabled:f||u,onClick:E=>{var A,O;E.stopPropagation(),c?(A=t==null?void 0:t.onStopWorkspaceNode)==null||A.call(t,e):(O=t==null?void 0:t.onRunWorkspaceNode)==null||O.call(t,e)},children:[o.jsx("span",{className:"material-symbols-outlined",children:c?"stop_circle":"play_arrow"}),o.jsx("span",{children:c?"停止":"立即运行"})]}),o.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-schedule-card__optimize nodrag"+(u?" af-work-schedule-card__optimize--running":""),disabled:f||c||u,title:"为下游节点提前生成 implementation",onClick:E=>{var A;E.stopPropagation(),(A=t==null?void 0:t.onOptimizeWorkspaceSchedule)==null||A.call(t,e)},children:[o.jsx("span",{className:"material-symbols-outlined",children:u?"sync":"auto_fix_high"}),o.jsx("span",{children:u?"优化中":"优化"})]}),o.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-schedule-card__logs nodrag",onClick:E=>{var A;E.stopPropagation(),(A=t==null?void 0:t.onOpenWorkspaceRunLogs)==null||A.call(t,{nodeId:e,scheduleNodeId:e,runNodeId:l.targetRunNodeId||e,lastRunId:l.lastRunId||"",label:(t==null?void 0:t.label)||"Scheduled Run"})},children:[o.jsx("span",{className:"material-symbols-outlined",children:"article"}),o.jsx("span",{children:"日志"})]})]})]})]})}function W7({id:e,data:t,selected:n,deleteNode:r}){const{setNodes:s}=Yl(),i=!!(t!=null&&t.readOnly),a=Sx(t==null?void 0:t.nodeSize)||{width:ba,height:ka},l=m.useCallback(c=>{var u,p;c.button!==0||c.metaKey||c.ctrlKey||c.shiftKey||(p=(u=c.target)==null?void 0:u.closest)!=null&&p.call(u,".af-work-group-node__resize, .af-work-group-node__delete")||s(f=>aI(f,e))},[e,s]);return o.jsxs("div",{className:"af-work-group-node"+(n?" af-work-group-node--selected":""),style:{width:a.width,height:a.height},onPointerDownCapture:l,children:[i?null:o.jsx(Jw,{className:"af-work-group-node__resize nodrag",minWidth:ba,minHeight:ka,position:"bottom-right",children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),o.jsxs("div",{className:"af-work-group-node__title nodrag",children:[o.jsx("span",{children:(t==null?void 0:t.title)||(t==null?void 0:t.label)||"Group"}),o.jsx("button",{type:"button",className:"af-work-group-node__delete",disabled:i,onClick:c=>{c.stopPropagation(),r==null||r(e)},"aria-label":"删除分组",title:"删除分组",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})]})}function V7(e){var y,w,b,g,k,x,S,C,j,E,A,O,W,H,D,R,T,V,F,M,I,B,_;const{setEdges:t,setNodes:n}=Yl(),r=(y=e.data)==null?void 0:y.onSyncNodePropDraft,s=!!((w=e.data)!=null&&w.readOnly),[i,a]=m.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=m.useCallback(q=>{var Q,te,ie;if(s)return;(te=(Q=e.data)==null?void 0:Q.onCleanupWorkspaceNodeOutputs)==null||te.call(Q,q,e.data);const z=Ls((ie=e.data)==null?void 0:ie.definitionId)?fI(q):"",$=new Set([q,z].filter(Boolean));n(he=>he.filter(ne=>!$.has(ne.id))),t(he=>he.filter(ne=>!$.has(ne.source)&&!$.has(ne.target)))},[e.data,s,t,n]),u=m.useCallback(q=>{var z,$;q.button!==0||q.metaKey||q.ctrlKey||q.shiftKey||($=(z=q.target)==null?void 0:z.closest)!=null&&$.call(z,".react-flow__handle, .af-work-display-resize")||(n(Q=>aI(Q,e.id)),t(Q=>q7(Q)))},[e.id,t,n]),p=m.useCallback((q,z)=>{s||(n($=>$.map(Q=>Q.id===q?{...Q,data:{...Q.data,model:z}}:Q)),r==null||r(q,{model:z}))},[s,n,r]),f=m.useCallback((q,z)=>{s||(n($=>$.map(Q=>{var ie;if(Q.id!==q)return Q;const te=Array.isArray((ie=Q.data)==null?void 0:ie.outputs)&&Q.data.outputs.length?Q.data.outputs.map((he,ne)=>ne===0?{...he,default:z,value:z}:he):[{type:"bool",name:"value",default:z,value:z}];return{...Q,data:{...Q.data,body:"",outputs:te}}})),r==null||r(q,$=>({body:"",outputs:Array.isArray($==null?void 0:$.outputs)&&$.outputs.length?$.outputs.map((te,ie)=>ie===0?{...te,default:z,value:z}:te):[{type:"bool",name:"value",default:z,value:z}]})))},[s,n,r]),d=m.useCallback((q,z)=>{s||(n($=>$.map(Q=>Q.id===q?{...Q,data:{...Q.data,body:z}}:Q)),r==null||r(q,{body:z}))},[s,n,r]),h=m.useCallback((q,z)=>{if(s)return;const $=Fi(z);n(Q=>Q.map(te=>te.id===q?{...te,data:{...te.data,images:$}}:te)),r==null||r(q,{images:$})},[s,n,r]);return(g=e.data)!=null&&g.isWorkspaceGroup?o.jsx(W7,{...e,deleteNode:c}):va((k=e.data)==null?void 0:k.definitionId)?o.jsx(sI,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):((x=e.data)==null?void 0:x.definitionId)==="workspace_run"?o.jsx(z7,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):((S=e.data)==null?void 0:S.definitionId)==="workspace_scheduled_run"?o.jsx(H7,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):Ls((C=e.data)==null?void 0:C.definitionId)?o.jsx(B7,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,skills:(j=e.data)==null?void 0:j.skills,skillCollections:(E=e.data)==null?void 0:E.skillCollections,workspaces:(A=e.data)==null?void 0:A.workspaceTargets}):((O=e.data)==null?void 0:O.definitionId)==="control_load_skills"?o.jsx(cU,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,skills:(W=e.data)==null?void 0:W.skills,skillCollections:(H=e.data)==null?void 0:H.skillCollections,onChangeSkillKeys:(D=e.data)==null?void 0:D.onChangeLoadSkillKeys}):((R=e.data)==null?void 0:R.definitionId)==="control_load_mcp"?o.jsx(uU,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,servers:(T=e.data)==null?void 0:T.mcpServers,onChangeMcpNames:(V=e.data)==null?void 0:V.onChangeLoadMcpNames}):((F=e.data)==null?void 0:F.definitionId)==="control_cd_workspace"?o.jsx(dU,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,workspaces:(M=e.data)==null?void 0:M.workspaceTargets,onChangeWorkspace:(I=e.data)==null?void 0:I.onChangeLoadWorkspace,onRefreshWorkspaces:(B=e.data)==null?void 0:B.onRefreshWorkspaces}):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,onPointerDownCapture:u,children:[s?null:o.jsx(Jw,{className:"af-work-display-resize af-work-flow-resize nodrag",position:"bottom-right",minWidth:zP,minHeight:Wp,maxWidth:BP,maxHeight:HP,onResizeStart:()=>a(!0),onResizeEnd:()=>a(!1),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),o.jsx(RV,{...e,deleteNode:c,modelLists:(_=e.data)==null?void 0:_.modelLists,onModelChange:p,onProvideValueChange:f,onNodeBodyChange:d,onNodeImagesChange:h})]})}const K7={[Nl]:V7};function Nb(e,t=[]){for(const n of e||[])n.type==="file"&&t.push(n),Array.isArray(n.children)&&Nb(n.children,t);return t}function iI(e,t){const n=String(t||"");if(!n)return null;for(const r of e||[]){if(r.path===n)return r;const s=Array.isArray(r.children)?iI(r.children,n):null;if(s)return s}return null}function U7(e){const t=String(e||"").replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");return!t||!t.includes("/")?"":t.split("/").slice(0,-1).join("/")}function oI(e,t=[]){for(const n of e||[])n.type==="directory"&&(t.push(n.path),Array.isArray(n.children)&&oI(n.children,t));return t}function Sf(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 aI(e,t){const n=String(t||"");let r=!1;const s=(e||[]).map(i=>{const a=i.id===n;return i.selected===a?i:(r=!0,{...i,selected:a})});return r?s:e}function q7(e){let t=!1;const n=(e||[]).map(r=>r.selected?(t=!0,{...r,selected:!1}):r);return t?n:e}function Y7(e){return[...e||[]].sort((t,n)=>t.type!==n.type?t.type==="directory"?-1:1:String(t.name||"").localeCompare(String(n.name||"")))}function G7(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],u=l?`${l}/${c}`:c,p=a===r.length-1;let f=!1;const d=(Array.isArray(i)?i:[]).map(h=>h.name!==c?h:(f=!0,p?{...h,type:"file",name:c,path:u,icon:fl(c),size:n}:{...h,type:"directory",name:c,path:u,icon:fl(c,!0),children:s(h.children||[],a+1,u)}));return f||d.push(p?{type:"file",name:c,path:u,icon:fl(c),size:n}:{type:"directory",name:c,path:u,icon:fl(c,!0),children:s([],a+1,u)}),Y7(d)};return s(e||[],0,"")}function J7(e){const t=Number(e||0);return!Number.isFinite(t)||t<=0?"":t<1024?`${t} B`:t<1024*1024?`${Math.round(t/102.4)/10} KB`:`${Math.round(t/1024/102.4)/10} MB`}function lI({items:e,onOpen:t,selectedPath:n,collapsedDirs:r,onToggleDir:s,onSelect:i,onFileDragStart:a,onDelete:l,onDownload:c}){return o.jsx("ul",{className:"af-work-files",children:(e||[]).map(u=>{var h;const p=u.type==="directory",f=p&&(r==null?void 0:r.has(u.path)),d=n===u.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--"+u.type+(d?" af-work-file--selected":""),draggable:!p,onDragStart:y=>{p||a==null||a(y,u)},onClick:()=>{i==null||i(u),p&&(s==null||s(u.path))},onDoubleClick:()=>{p||t(u)},title:u.path,children:[p?o.jsx("span",{className:"material-symbols-outlined af-work-file__chevron",children:f?"chevron_right":"expand_more"}):null,o.jsx("span",{className:"material-symbols-outlined",children:u.icon||fl(u.name,p)}),o.jsx("span",{children:u.name})]}),d?o.jsxs("div",{className:"af-work-file-actions",children:[p?null:o.jsx("button",{type:"button",className:"af-work-file-action",onClick:y=>{y.stopPropagation(),c==null||c(u)},"aria-label":`下载 ${u.name}`,title:`下载 ${u.path}`,children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"download"})}),o.jsx("button",{type:"button",className:"af-work-file-action af-work-file-action--danger",onClick:y=>{y.stopPropagation(),l==null||l(u)},"aria-label":`删除 ${u.name}`,title:`删除 ${u.path}`,children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"})})]}):null]}),p&&!f&&((h=u.children)!=null&&h.length)?o.jsx(lI,{items:u.children,onOpen:t,selectedPath:n,collapsedDirs:r,onToggleDir:s,onSelect:i,onFileDragStart:a,onDelete:l,onDownload:c}):null]},u.path)})})}function X7({files:e,query:t,onQueryChange:n,onSelect:r,onUpload:s,onClose:i}){const a=m.useMemo(()=>Nb(e),[e]),l=String(t||"").trim().toLowerCase(),c=a.filter(u=>l?`${u.path} ${u.name}`.toLowerCase().includes(l):!0);return o.jsx("div",{className:"af-flow-snippet-modal-overlay",onMouseDown:i,children:o.jsxs("div",{className:"af-flow-snippet-modal af-work-file-picker-modal",role:"dialog","aria-modal":"true","aria-label":"选择文件",onMouseDown:u=>u.stopPropagation(),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",children:"folder_open"}),"选择文件"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:i,"aria-label":"关闭",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-flow-snippet-modal__body",children:[o.jsxs("div",{className:"af-work-file-picker-modal__tools",children:[o.jsx("input",{value:t,onChange:u=>n(u.target.value),placeholder:"搜索文件路径...",autoFocus:!0}),o.jsxs("button",{type:"button",onClick:()=>s==null?void 0:s(""),children:[o.jsx("span",{className:"material-symbols-outlined",children:"upload_file"}),"上传"]})]}),o.jsxs("div",{className:"af-work-file-picker-modal__list",children:[c.map(u=>o.jsxs("button",{type:"button",className:"af-work-file-picker-modal__item",onClick:()=>r(u),children:[o.jsx("span",{className:"material-symbols-outlined",children:u.icon||fl(u.name)}),o.jsxs("span",{className:"af-work-file-picker-modal__main",children:[o.jsx("strong",{children:u.name}),o.jsx("small",{children:u.path})]}),u.size?o.jsx("em",{children:J7(u.size)}):null]},u.path)),c.length===0?o.jsx("div",{className:"af-work-file-picker-modal__empty",children:"没有匹配文件,可先上传或调整搜索词。"}):null]})]})]})})}function cj({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 cI(e){const t=String((e==null?void 0:e.kind)||"");return["run-log","run-summary","activity","prompt","raw","thinking"].includes(t)}function Q7(e,t=!1){const n=Array.isArray(e)?e:[],r=n.filter(i=>!cI(i));if(r.length>0)return r;const s=[...n].reverse().find(i=>(i==null?void 0:i.kind)==="result"||(i==null?void 0:i.kind)==="assistant"||(i==null?void 0:i.error));return s?[s]:n.length>0||t?[{role:"assistant",kind:"assistant",text:t?"正在执行,可以在完成后继续追问或要求调整。":"运行已完成。可以在下方继续追问、要求总结或调整结果。",at:0}]:[]}function Z7(e){return(Array.isArray(e)?e:[]).filter(cI)}function Wu(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 eU(e){const t=Wu((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 Wu((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function tU(e){const n=[...Array.isArray(e==null?void 0:e.inputs)?e.inputs:[],...Array.isArray(e==null?void 0:e.outputs)?e.outputs:[]].find(r=>(r==null?void 0:r.name)==="skillKeys"||(r==null?void 0:r.name)==="skillsContext");return Wu((n==null?void 0:n.default)||(n==null?void 0:n.value)||"")}function uI(e,t,n=1){const r=(Array.isArray(e)?e:[]).map(i=>String(i||"").trim()).filter(Boolean);return r.length?{head:r.slice(0,n).join("、"),extra:r.length>n?`等 ${r.length} 个`:"",title:r.join(", ")}:{head:t,extra:"",title:""}}function uj(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function _o(e,t,n=""){const r=(Array.isArray(e)?e:[]).find(i=>(i==null?void 0:i.name)===t);return String((r==null?void 0:r.value)??(r==null?void 0:r.default)??"").trim()||n}function Yp(e,t){const n=_o(e,t,"");if(!n)return null;try{const r=JSON.parse(n);return r&&typeof r=="object"&&!Array.isArray(r)?r:null}catch{return null}}function cd(e){const t=String(e||"").trim().toLowerCase();return["markdown","html","react","table","chart","ascii","mermaid"].includes(t)?t:"markdown"}function ls(e){const t=String(e||""),n=t.indexOf(" - ");return n>=0?t.slice(0,n).trim():t.trim()}function dI(e){const t=cd(e);return t==="html"?"display_html":t==="react"?"display_react_app":t==="table"?"display_table":t==="chart"?"display_chart":t==="ascii"?"display_ascii":t==="mermaid"?"display_mermaid":"display_markdown"}function fI(e){return`${String(e||"context_run").trim()||"context_run"}__display`}function pI(e){return e==="display_image"?"src":"content"}function dj(e,t,n){const r=pI(t),s=Vc(e);let i=!1;const a=s.map(l=>(l==null?void 0:l.name)===r?(i=!0,{...l,default:n,value:n,showOnNode:l.showOnNode!==!1}):(l==null?void 0:l.name)==="filePath"?{...l,default:"",value:""}:l);return i||a.push({type:"text",name:r,default:n,value:n,required:!0,showOnNode:!0}),a}function fj(e,t,n=[],r=[]){const s=Array.isArray(e)?e:[],i=new Set((Array.isArray(n)?n:[]).map(u=>String(u||"").trim()).filter(Boolean)),a=new Set((Array.isArray(r)?r:[]).map(u=>String(u||"").trim()).filter(Boolean)),l=u=>(u==null?void 0:u.showOnNode)!==!1;let c=s.findIndex(u=>l(u)&&i.has(String((u==null?void 0:u.name)||"").trim()));return c<0&&(c=s.findIndex(u=>i.has(String((u==null?void 0:u.name)||"").trim()))),c<0&&(c=s.findIndex(u=>l(u)&&a.has(String((u==null?void 0:u.type)||"").trim()))),c<0&&(c=s.findIndex(u=>l(u))),c<0&&(c=0),`${t}-${c}`}function pj(e){return(Array.isArray(e)?e:[]).map(t=>(t==null?void 0:t.type)==="node"||(t==null?void 0:t.name)==="next"?t:{...t,default:"",value:""})}function zh(e){const t=Array.isArray(e==null?void 0:e.outputs)?e.outputs:Array.isArray(e==null?void 0:e.output)?e.output:[],n=s=>String((s==null?void 0:s.value)??(s==null?void 0:s.default)??"").trim(),r=t.find(s=>((s==null?void 0:s.name)==="content"||(s==null?void 0:s.name)==="result")&&n(s))||t.find(s=>(s==null?void 0:s.name)==="resultFile"&&n(s))||t.find(s=>(s==null?void 0:s.type)!=="node"&&(s==null?void 0:s.name)!=="next"&&(s==null?void 0:s.name)!=="displayType"&&n(s));return r?n(r):""}function nU(e){const t=Array.isArray(e==null?void 0:e.inputs)?e.inputs:[],n=_o(t,"includeWorkspaceContext","true").toLowerCase(),r=Yp(t,"knowledgeContext"),s=Yp(t,"workspaceContext");return{task:String((e==null?void 0:e.body)||""),skillKeys:tU(e),includeWorkspaceContext:n!=="false"&&n!=="0"&&n!=="off",knowledgeContext:r||(s?Bh([s]):null),workspaceContext:s,displayType:cd(_o(t,"displayType","markdown")),model:String((e==null?void 0:e.model)||"").trim()}}function Ls(e){const t=String(e||"");return t==="workspace_one_click_task"||t==="workspace_context_run"}function rU(e){const t=Wu((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 Wu((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function sU(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function hI(e={},t="context"){const n=String((e==null?void 0:e.cwd)||(e==null?void 0:e.workspaceRoot)||(e==null?void 0:e.path)||"").trim(),r=String((e==null?void 0:e.id)||"").trim(),s=String((e==null?void 0:e.label)||(e==null?void 0:e.name)||"").trim();if(!n&&!r&&!s)return null;const i=String(s||r||"知识库").trim();return{id:r,label:i,kind:(e==null?void 0:e.kind)==="git"?"git":"local",type:String((e==null?void 0:e.type)||""),repoPath:n,path:n,mountPath:String((e==null?void 0:e.mountPath)||r||i).trim(),repoUrl:String((e==null?void 0:e.repoUrl)||"").trim(),branch:String((e==null?void 0:e.branch)||"").trim(),readonly:!0,role:t}}function Bh(e=[]){const t=(Array.isArray(e)?e:[e]).map((n,r)=>hI(n,r===0?"primary":"context")).filter(Boolean);return t.length?{version:1,sources:t}:null}function mI(e){return(e&&typeof e=="object"&&Array.isArray(e.sources)?e.sources:[]).map(n=>hI(n,(n==null?void 0:n.role)||"context")).filter(Boolean)}function iU(e){const t=Array.isArray(e==null?void 0:e.inputs)?e.inputs:[],n=Yp(t,"knowledgeContext"),r=Yp(t,"workspaceContext");return{sources:mI(n||(r?Bh([r]):null)),path:_o(t,"path",""),label:_o(t,"label","")}}function hj(e){var r,s,i,a,l,c,u,p,f;if(!e)return null;const{inputs:t,outputs:n}=UV(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:Fi((l=e.data)==null?void 0:l.images),script:String(((c=e.data)==null?void 0:c.script)??""),scriptRef:String(((u=e.data)==null?void 0:u.scriptRef)??""),implementationRef:String(((p=e.data)==null?void 0:p.implementationRef)??""),implementationMode:String(((f=e.data)==null?void 0:f.implementationMode)??""),inputs:t,outputs:n}}function mj(e,t,n,r=""){var c,u;const s=String(n||"").trim(),i=(Array.isArray(e)?e:[]).find(p=>String((p==null?void 0:p.id)||"")===s),a=String(((c=i==null?void 0:i.data)==null?void 0:c.model)||"").trim();if(a&&a!=="default")return a;const l=String(((u=t==null?void 0:t[s])==null?void 0:u.model)||"").trim();return l&&l!=="default"?l:String(r||"").trim()}function gj(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 oU(e,t,n){var p,f;const r=String(((p=e==null?void 0:e.data)==null?void 0:p.definitionId)??n),s=r.startsWith("provide_"),i=String((t==null?void 0:t.role)||"").trim(),a=Fu.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?[]:Fi(t==null?void 0:t.images),inputs:gj(t==null?void 0:t.inputs),outputs:s&&Array.isArray((f=e.data)==null?void 0:f.outputs)?e.data.outputs:gj(t==null?void 0:t.outputs)},u=String((t==null?void 0:t.script)??"").trim();r==="tool_nodejs"||u!==""?c.script=String((t==null?void 0:t.script)??""):delete c.script;for(const d of["scriptRef","implementationRef","implementationMode"]){const h=String((t==null?void 0:t[d])??"").trim();h?c[d]=h:delete c[d]}return c}function yj({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(!mK.test(c))return{ok:!1,error:"Invalid instance id"};if(e.some(w=>w.id===c&&w.id!==a))return{ok:!1,error:"Duplicate instance id"}}const u=oU(r,s,c),p=r.data||{};if(!(c!==a||p.label!==u.label||p.role!==u.role||p.model!==u.model||p.body!==u.body||JSON.stringify(Fi(p.images))!==JSON.stringify(u.images)||(p.script??void 0)!==(u.script??void 0)||(p.scriptRef??void 0)!==(u.scriptRef??void 0)||(p.implementationRef??void 0)!==(u.implementationRef??void 0)||(p.implementationMode??void 0)!==(u.implementationMode??void 0)||JSON.stringify(p.inputs||[])!==JSON.stringify(u.inputs||[])||JSON.stringify(p.outputs||[])!==JSON.stringify(u.outputs||[])))return{ok:!0,changed:!1,nextId:c,nodes:e,edges:t,instances:n};const d=e.map(w=>w.id===a?{...w,id:c,selected:!0,data:u}:w);let h=t,y=n;if(c!==a){y={...n||{}};const w={...y[a]||{}};delete y[a],y[c]=w,h=t.map((b,g)=>({...b,source:b.source===a?c:b.source,target:b.target===a?c:b.target,id:`we-${b.source===a?c:b.source}-${b.target===a?c:b.target}-${g}`}))}return{ok:!0,changed:!0,nextId:c,nodes:d,edges:h,instances:y}}function aU(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function lU(e,t,n){if(!e||!t||!n)return n;const r={...e};for(const s of["newId","label","role","model","body","images","script","scriptRef","implementationRef","implementationMode","inputs","outputs"])aU(e[s],t[s])&&(r[s]=n[s]);return r}function cU({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:[],u=Array.isArray(s)?s:[],p=Array.isArray(i)?i:[],[f,d]=m.useState(!1),[h,y]=m.useState(""),[w,b]=m.useState(()=>new Set),g=m.useRef(null),k=m.useRef(null),[x,S]=m.useState({visible:!1,top:0,height:100}),C=m.useMemo(()=>new Set(eU(t)),[t]),j=m.useMemo(()=>new Map(u.map(M=>[M.key,M])),[u]),E=m.useMemo(()=>Array.from(C).map(M=>{var I;return((I=j.get(M))==null?void 0:I.name)||M}),[j,C]),A=m.useMemo(()=>uI(E,"选择 Skills"),[E]),O=m.useMemo(()=>{const M=new Set,I=p.map(_=>{const q=ha(_,u).map(z=>j.get(z)).filter(Boolean);for(const z of q)M.add(z.key);return{..._,skills:q}}).filter(_=>_.skills.length>0),B=u.filter(_=>!M.has(_.key));return{collectionGroups:I,ungrouped:B}},[j,p,u]);m.useEffect(()=>{b(M=>{let I=!1;const B=new Set(M);for(const _ of O.collectionGroups)B.has(_.id)||(B.add(_.id),I=!0);return I?B:M})},[O.collectionGroups]);const W=m.useMemo(()=>{const M=h.trim().toLowerCase();if(!M)return O;const I=_=>[_==null?void 0:_.key,_==null?void 0:_.name,_==null?void 0:_.description].map(z=>String(z||"").toLowerCase()).join(" ").includes(M);return{collectionGroups:O.collectionGroups.map(_=>{const z=[_==null?void 0:_.id,_==null?void 0:_.name,_==null?void 0:_.description].map($=>String($||"").toLowerCase()).join(" ").includes(M)?_.skills:_.skills.filter(I);return{..._,skills:z}}).filter(_=>_.skills.length>0),ungrouped:O.ungrouped.filter(I)}},[O,h]),H=m.useCallback((M,I)=>{const B=new Set(C);for(const _ of M)I?B.add(_):B.delete(_);a==null||a(e,Array.from(B))},[e,C,a]),D=m.useCallback(M=>{b(I=>{const B=new Set(I);return B.has(M)?B.delete(M):B.add(M),B})},[]),R=m.useCallback(()=>{const M=g.current;if(!M)return;const I=Math.max(1,M.scrollHeight),B=Math.max(1,M.clientHeight),_=I>B+1,q=_?Math.max(12,B/I*100):100,z=Math.max(0,100-q),$=_?Math.min(z,M.scrollTop/Math.max(1,I-B)*z):0;S({visible:_,top:$,height:q})},[]);m.useEffect(()=>{if(!f)return;const M=requestAnimationFrame(R);return()=>cancelAnimationFrame(M)},[w,W,C.size,f,R]);const T=m.useCallback(M=>{const I=g.current;if(!I)return;const B=Math.max(0,I.scrollHeight-I.clientHeight);I.scrollTop=Math.min(1,Math.max(0,M))*B,R()},[R]),V=m.useCallback((M,I=0)=>{const B=k.current;if(!B)return 0;const _=B.getBoundingClientRect(),q=x.height/100*_.height,z=Math.max(1,_.height-q);return(M-_.top-I)/z},[x.height]),F=m.useCallback(M=>{var he,ne;if(!x.visible)return;M.preventDefault(),M.stopPropagation();const I=k.current;if(!I)return;const B=I.getBoundingClientRect(),_=x.top/100*B.height,q=x.height/100*B.height,$=M.clientY>=B.top+_&&M.clientY<=B.top+_+q?M.clientY-B.top-_:q/2;T(V(M.clientY,$));const Q=M.pointerId;(ne=(he=M.currentTarget).setPointerCapture)==null||ne.call(he,Q);const te=ce=>{ce.preventDefault(),T(V(ce.clientY,$))},ie=()=>{window.removeEventListener("pointermove",te),window.removeEventListener("pointerup",ie),window.removeEventListener("pointercancel",ie)};window.addEventListener("pointermove",te),window.addEventListener("pointerup",ie),window.addEventListener("pointercancel",ie)},[V,T,x.height,x.top,x.visible]);return o.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[l.map((M,I)=>{if(M.showOnNode===!1)return null;const B=`${2.6+I*1.7}rem`,_=M.name||`#${I+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:B},children:_}),o.jsx(Ln,{type:"target",position:Oe.Left,id:`input-${I}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:B,background:wn(M.type)},title:`${_} · ${M.type}`})]},`in-${I}`)}),c.map((M,I)=>{if(M.showOnNode===!1)return null;const B=`${2.6+I*1.7}rem`,_=M.name||`#${I+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:B},children:_}),o.jsx(Ln,{type:"source",position:Oe.Right,id:`output-${I}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:B,background:wn(M.type)},title:`${_} · ${M.type}`})]},`out-${I}`)}),o.jsxs("div",{className:"af-work-load-skills-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"extension"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"Load Skills"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"control_load_skills"}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-load-skills-card__body nodrag",children:[o.jsxs("button",{type:"button",className:"af-work-load-skills-card__select",onClick:M=>{var I;M.stopPropagation(),f||(I=t==null?void 0:t.onRefreshSkills)==null||I.call(t),d(B=>!B)},children:[o.jsxs("span",{className:"af-work-load-skills-card__summary",title:A.title,children:[o.jsx("span",{className:"af-work-load-skills-card__summary-main",children:A.head}),A.extra?o.jsx("span",{className:"af-work-load-skills-card__summary-extra",children:A.extra}):null]}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:f?"expand_less":"expand_more"})]}),f?o.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick:M=>M.stopPropagation(),children:[o.jsxs("div",{className:"af-work-load-skills-search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:h,onChange:M=>y(M.target.value),placeholder:"搜索 Skills...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Skills"}),h?o.jsx("button",{type:"button",onClick:()=>y(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{ref:g,className:"af-work-load-skills-menu",onScroll:R,children:[W.collectionGroups.map(M=>{const I=M.skills.map(z=>z.key),B=I.filter(z=>C.has(z)).length,_=I.length>0&&B===I.length,q=w.has(M.id);return o.jsxs("section",{className:"af-work-load-skills-menu__group"+(q?" 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:z=>H(I,z.target.checked),"aria-label":`选择 ${M.name}`}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-toggle",onClick:()=>D(M.id),"aria-expanded":!q,children:o.jsxs("span",{className:"af-work-load-skills-menu__group-main",children:[o.jsx("span",{children:M.name}),M.description?o.jsx("em",{children:M.description}):null]})}),o.jsxs("small",{children:[B,"/",I.length]}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-arrow",onClick:()=>D(M.id),"aria-label":q?`展开 ${M.name}`:`收起 ${M.name}`,children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:q?"chevron_right":"expand_more"})})]}),q?null:o.jsx("div",{className:"af-work-load-skills-menu__options",children:M.skills.map(z=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:C.has(z.key),onChange:$=>H([z.key],$.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:z.name}),z.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:z.description}):null]})]},`${M.id}:${z.key}`))})]},M.id)}),W.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:W.ungrouped.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:W.ungrouped.map(M=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:C.has(M.key),onChange:I=>H([M.key],I.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:M.name}),M.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:M.description}):null]})]},`ungrouped:${M.key}`))})]}):null,W.collectionGroups.length===0&&W.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"+(x.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:F,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${x.height}%`,top:`${x.top}%`}})})]}):null]})]})}function uU({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,u]=m.useState(!1),[p,f]=m.useState(""),d=m.useMemo(()=>new Set(rU(t)),[t]),h=m.useMemo(()=>(Array.isArray(s)?s:[]).map(b=>({name:String((b==null?void 0:b.name)||""),description:String((b==null?void 0:b.description)||""),detail:String((b==null?void 0:b.url)||[b==null?void 0:b.command,...Array.isArray(b==null?void 0:b.args)?b.args:[]].filter(Boolean).join(" ")||""),type:String((b==null?void 0:b.type)||"")})).filter(b=>b.name),[s]),y=m.useMemo(()=>{const b=p.trim().toLowerCase();return b?h.filter(g=>[g.name,g.description,g.detail,g.type].join(" ").toLowerCase().includes(b)):h},[p,h]),w=m.useCallback((b,g)=>{const k=new Set(d);for(const x of b)g?k.add(x):k.delete(x);i==null||i(e,Array.from(k))},[e,d,i]);return o.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[a.map((b,g)=>{if(b.showOnNode===!1)return null;const k=`${2.6+g*1.7}rem`,x=b.name||`#${g+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:k},children:x}),o.jsx(Ln,{type:"target",position:Oe.Left,id:`input-${g}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:k,background:wn(b.type)},title:`${x} · ${b.type}`})]},`in-${g}`)}),l.map((b,g)=>{if(b.showOnNode===!1)return null;const k=`${2.6+g*1.7}rem`,x=b.name||`#${g+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:k},children:x}),o.jsx(Ln,{type:"source",position:Oe.Right,id:`output-${g}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:k,background:wn(b.type)},title:`${x} · ${b.type}`})]},`out-${g}`)}),o.jsxs("div",{className:"af-work-load-skills-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"hub"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"Load MCP"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"control_load_mcp"}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-load-skills-card__body nodrag",children:[o.jsxs("button",{type:"button",className:"af-work-load-skills-card__select",onClick:b=>{var g;b.stopPropagation(),c||(g=t==null?void 0:t.onRefreshMcps)==null||g.call(t),u(k=>!k)},children:[o.jsx("span",{children:d.size>0?`${d.size} MCP selected`:"选择 MCP"}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:c?"expand_less":"expand_more"})]}),c?o.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick:b=>b.stopPropagation(),children:[o.jsxs("div",{className:"af-work-load-skills-search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:p,onChange:b=>f(b.target.value),placeholder:"搜索 MCP...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 MCP"}),p?o.jsx("button",{type:"button",onClick:()=>f(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{className:"af-work-load-skills-menu",children:[o.jsxs("section",{className:"af-work-load-skills-menu__group",children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[o.jsx("span",{children:"MCP Servers"}),o.jsx("small",{children:y.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:y.map(b=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:d.has(b.name),onChange:g=>w([b.name],g.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:b.name}),b.description||b.detail?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:b.description||b.detail}):null]})]},b.name))})]}),y.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 MCP"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>i==null?void 0:i(e,[]),children:"清空"})]})]}):null]})]})}function dU({id:e,data:t,selected:n,deleteNode:r,workspaces:s=[],onChangeWorkspace:i,onRefreshWorkspaces:a}){const l=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],c=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],[u,p]=m.useState(!1),[f,d]=m.useState(""),h=iU(t),y=m.useMemo(()=>(Array.isArray(s)?s:[]).map(S=>({id:String((S==null?void 0:S.id)||""),label:String((S==null?void 0:S.label)||(S==null?void 0:S.name)||"知识库"),kind:(S==null?void 0:S.kind)==="git"?"git":"local",path:String((S==null?void 0:S.path)||""),repoUrl:String((S==null?void 0:S.repoUrl)||""),branch:String((S==null?void 0:S.branch)||""),mountPath:String((S==null?void 0:S.mountPath)||""),builtin:(S==null?void 0:S.builtin)===!0,exists:(S==null?void 0:S.exists)!==!1})).filter(S=>S.path),[s]),w=m.useMemo(()=>{const S=f.trim().toLowerCase();return S?y.filter(C=>[C.id,C.label,C.path,C.repoUrl,C.branch,C.mountPath].join(" ").toLowerCase().includes(S)):y},[f,y]),b=m.useMemo(()=>new Set((h.sources||[]).map(S=>S.id||S.path||S.repoPath).filter(Boolean)),[h.sources]),g=m.useMemo(()=>(h.sources||[]).map(S=>S.label||S.id||S.mountPath||S.path),[h.sources]),k=m.useMemo(()=>uI(g,"选择知识库"),[g]),x=(S,C)=>{const j=(S==null?void 0:S.id)||(S==null?void 0:S.path)||"",E=y.filter(A=>{const O=A.id||A.path||"";return O===j?C:b.has(O)});i==null||i(e,E)};return o.jsxs("div",{className:"af-work-load-skills-card af-work-load-workspace-card"+(n?" af-work-load-skills-card--selected":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[l.map((S,C)=>{if(S.showOnNode===!1)return null;const j=`${2.6+C*1.7}rem`,E=S.name||`#${C+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:j},children:E}),o.jsx(Ln,{type:"target",position:Oe.Left,id:`input-${C}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:j,background:wn(S.type)},title:`${E} · ${S.type}`})]},`in-${C}`)}),c.map((S,C)=>{if(S.showOnNode===!1)return null;const j=`${2.6+C*1.7}rem`,E=S.name||`#${C+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:j},children:E}),o.jsx(Ln,{type:"source",position:Oe.Right,id:`output-${C}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:j,background:wn(S.type)},title:`${E} · ${S.type}`})]},`out-${C}`)}),o.jsxs("div",{className:"af-work-load-skills-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"folder_managed"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"加载知识库"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"control_cd_workspace"}),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:S=>{S.stopPropagation(),u||a==null||a(),p(C=>!C)},children:[o.jsxs("span",{className:"af-work-load-skills-card__summary",title:k.title,children:[o.jsx("span",{className:"af-work-load-skills-card__summary-main",children:k.head}),k.extra?o.jsx("span",{className:"af-work-load-skills-card__summary-extra",children:k.extra}):null]}),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:S=>S.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:S=>d(S.target.value),placeholder:"搜索知识库...",spellCheck:!1,autoComplete:"off","aria-label":"搜索知识库"}),f?o.jsx("button",{type:"button",onClick:()=>d(""),"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:"知识库"}),o.jsx("small",{children:w.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:w.map(S=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:b.has(S.id||S.path),onChange:C=>x(S,C.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:S.label}),o.jsxs("span",{className:"af-work-load-skills-menu__option-desc",children:[S.kind==="git"&&S.repoUrl?`${S.repoUrl}${S.branch?` · ${S.branch}`:""}${S.mountPath?` · ${S.mountPath}`:""}`:S.path,S.exists?"":" · 路径未就绪"]})]})]},`${S.id}:${S.path}`))})]}),w.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的知识库"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>i==null?void 0:i(e,[]),children:"清空知识库"})]})]}):null]})]})}function fU(){var tv,nv;const{t:e,i18n:t}=_r(),{navigate:n}=li(),r=Yl(),s=h5(),i=m.useMemo(MK,[]),[a,l]=m.useState(()=>new URLSearchParams(window.location.search).get("view")==="display"?"display":"workspace"),[c,u]=m.useState(!1),[p,f]=m.useState(!1),[d,h]=m5([]),[y,w,b]=g5([]),g=m.useRef([]),k=m.useRef([]),x=m.useRef(null),[S,C]=m.useState(()=>Nx(null,[])),j=m.useRef(S),[E,A]=m.useState(null),O=m.useRef(null),[W,H]=m.useState([]),D=m.useRef(new Map),R=m.useRef(new Map),T=m.useRef(null),V=m.useRef(null),F=m.useRef(null),[M,I]=m.useState(null),[B,_]=m.useState({}),q=m.useRef({}),z=m.useRef(!1),$=m.useRef(null),Q=m.useRef(!1),te=m.useRef(null),[ie,he]=m.useState([]),[ne,ce]=m.useState(""),[re,le]=m.useState("nodes"),[ue,Se]=m.useState([]),[De,Ye]=m.useState(!1),[Ie,Je]=m.useState(""),[Et,bt]=m.useState(!1),[Pe,rt]=m.useState({name:"",id:"",description:""}),[At,zt]=m.useState(!1),[Kt,tt]=m.useState(""),[oe,be]=m.useState(""),ke=m.useRef(null),[st,Ze]=m.useState(!1),[kt,Bt]=m.useState(!1),[Gt,Z]=m.useState(""),[xe,$e]=m.useState(null),[Ee,ut]=m.useState(()=>jg()),[St,ir]=m.useState(""),[Er,Xn]=m.useState(!1),[hn,Cn]=m.useState(""),[_n,mr]=m.useState(!1),[En,Dn]=m.useState([]),[Qn,Hr]=m.useState(!1),[gr,An]=m.useState(""),[ss,or]=m.useState(""),[Ar,Fn]=m.useState(""),[mn,vn]=m.useState(!1),[zn,Pr]=m.useState(""),[Jt,se]=m.useState(""),[Ne,et]=m.useState(!1),[mt,sn]=m.useState("nodes"),[gn,Rn]=m.useState(""),[yr,ot]=m.useState(0),[jt,gt]=m.useState(""),Bn=m.useRef(""),[we,Xt]=m.useState(null),di=m.useRef(null),[Bi,ar]=m.useState(""),[ee,je]=m.useState([]),[Le,Ht]=m.useState(""),[me,Sn]=m.useState(!0),[Wr,Zn]=m.useState(""),[is,xr]=m.useState(()=>new Set),[U,fe]=m.useState(""),[Te,Ae]=m.useState({nodeId:"",query:""}),[Xe,Qt]=m.useState(!1),Pt=m.useRef(null),Kn=m.useRef(null),os=m.useRef(""),[fi,$o]=m.useState(()=>{try{const v=Number(window.localStorage.getItem("agentflow.workspace.filesPaneHeight")||0);if(Number.isFinite(v)&&v>=160)return v}catch{}return 360}),[oT,Fb]=m.useState(!1),[Lo,aT]=m.useState({cursor:[],opencode:[],claudeCode:[],codex:[]}),[pi,lT]=m.useState(""),[ws,cT]=m.useState([]),[zb,Bb]=m.useState(!1),[bs,rc]=m.useState([]),[Ea,uT]=m.useState([]),[Hb,dT]=m.useState(!1),[Wb,Vb]=m.useState([]),[Kb,Ub]=m.useState([]),qb=m.useCallback(v=>{ke.current&&window.clearTimeout(ke.current),be(v),ke.current=window.setTimeout(()=>{be(""),ke.current=null},3800)},[]),Hi=m.useCallback(v=>{const N=String(v||"").trim();if(!N)return;const P=()=>s(N);window.requestAnimationFrame(P),window.setTimeout(P,80)},[s]),Yb=m.useCallback((v,N)=>{const P=String(v||"").trim(),L=qp(N);!P||!L||(h(K=>K.map(Y=>{var ae;if(Y.id!==P)return Y;const G=qp((ae=Y.data)==null?void 0:ae.displaySize),J=G&&G.width===L.width&&G.height===L.height,X=Math.round(Number(Y.width||0))===L.width&&Math.round(Number(Y.height||0))===L.height;return J&&X?Y:{...Y,width:L.width,height:L.height,data:{...Y.data,nodeSize:L,displaySize:L}}})),Hi(P))},[Hi,h]);m.useEffect(()=>{try{window.localStorage.setItem("agentflow.workspace.filesPaneHeight",String(Math.round(fi)))}catch{}},[fi]);const Yh=m.useCallback(v=>{const N=Pt.current;if(!N)return;const P=N.getBoundingClientRect(),L=16,K=150,Y=230,G=P.top+L,J=P.bottom-L,X=Math.max(K,J-G-Y),ae=Math.min(Math.max(v-G,K),X);$o(ae)},[]),fT=m.useCallback(v=>{v.preventDefault(),v.stopPropagation(),Fb(!0),Yh(v.clientY);const N=L=>{L.preventDefault(),Yh(L.clientY)},P=()=>{Fb(!1),window.removeEventListener("pointermove",N,!0),window.removeEventListener("pointerup",P,!0),window.removeEventListener("pointercancel",P,!0)};window.addEventListener("pointermove",N,!0),window.addEventListener("pointerup",P,!0),window.addEventListener("pointercancel",P,!0)},[Yh]);m.useEffect(()=>()=>{ke.current&&window.clearTimeout(ke.current),te.current&&window.clearTimeout(te.current)},[]);const[pT,Gb]=m.useState(()=>new Set),[md,Gh]=m.useState(!1),Jh=m.useRef(null),Jb=m.useRef(null),Xb=m.useRef(null),[hT,mT]=m.useState({}),[Oo,Xh]=m.useState(""),[Vr,Qb]=m.useState(!1),[Do,Aa]=m.useState([]),[Fo,er]=m.useState([]),[Wi,Vi]=m.useState("workspace"),[Qh,Pa]=m.useState(!1),[sc,Ia]=m.useState(null),[gT,Zh]=m.useState(!0),[Zb,ek]=m.useState(""),[hi,Ki]=m.useState({}),[wr,tk]=m.useState(null),[nk,rk]=m.useState(!1),Ta=m.useMemo(()=>nk?FK(wr):"",[nk,wr]),[ic,gd]=m.useState(!0);m.useEffect(()=>{Ta&&gd(zK(Ta))},[Ta]),m.useEffect(()=>{if(Ta)try{window.localStorage.setItem(Ta,ic?"true":"false")}catch{}},[ic,Ta]);const[em,yd]=m.useState(!1),[tm,sk]=m.useState(!1),[nm,ik]=m.useState("pan"),[ok,yT]=m.useState({}),oc=m.useRef({}),[ak,zo]=m.useState({}),ac=m.useRef(new Map),Ra=m.useRef(new Set),[lk,Ma]=m.useState(()=>new Set),[rm,$a]=m.useState({}),[ck,uk]=m.useState(""),[xT,ye]=m.useState(""),mi=m.useMemo(()=>DK(i),[i]),[dk,fk]=m.useState(""),xd=i.flowSource||"user",pk=m.useMemo(()=>new Set(Object.values(ok||{}).map(v=>String((v==null?void 0:v.runNodeId)||"").trim()).filter(Boolean)),[ok]),Bo=m.useCallback(v=>{const N=oc.current||{},P=typeof v=="function"?v(N):v,L=P&&typeof P=="object"&&!Array.isArray(P)?P:{};return oc.current=L,yT(L),L},[]),hk=!!(i.flowId&&!i.archived&&(xd==="user"||xd==="workspace"));m.useEffect(()=>{i.flowId&&Q$(i.flowId,i.flowSource||"user","workspace",!!i.archived)},[i]),m.useEffect(()=>{const v=()=>{l(new URLSearchParams(window.location.search).get("view")==="display"?"display":"workspace")};return window.addEventListener("popstate",v),()=>window.removeEventListener("popstate",v)},[]),m.useEffect(()=>{Aa([]),er([]),Vi("workspace"),Zh(!0)},[i]);const Pn=m.useCallback(async()=>{const v=cs(i),N=await fetch(`/api/workspace/files?${v.toString()}`),P=await N.json();if(!N.ok)throw new Error(P.error||"读取 workspace 失败");const L=P.files||[];je(L),xr(new Set(oI(L))),Ht(P.root||"")},[i]),wd=m.useCallback(async()=>{Ye(!0),Je("");try{const v=await fetch("/api/marketplace/flow-snippets"),N=await v.json().catch(()=>({}));if(!v.ok)throw new Error(N.error||"读取流程片段失败");Se(Array.isArray(N.snippets)?N.snippets:[])}catch(v){Je(String(v.message||v)),Se([])}finally{Ye(!1)}},[]),Wt=m.useCallback(async(v=d,N=y)=>{var Y;if(!z.current)return;if(!me)throw ye("Readonly workspace"),new Error("Readonly workspace");const P=Pc(v,N,q.current);P.ui={...P.ui||{},...O.current?{viewport:O.current}:{},displayPage:f7(j.current,v)};const L=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,graph:P})}),K=await L.json();if(!L.ok)throw new Error(K.error||"保存 workspace graph 失败");q.current=((Y=K.graph)==null?void 0:Y.instances)||P.instances,_(q.current),zo(kf(K.workspaceSchedules||[])),ye("Workspace graph saved")},[y,i,d,me]),wT=m.useCallback(v=>{var P;const N=(P=v==null?void 0:v.extra)!=null&&P.instances&&typeof v.extra.instances=="object"?v.extra.instances:{};q.current=N,_(N),h(Array.isArray(v==null?void 0:v.nodes)?v.nodes:[]),w(Array.isArray(v==null?void 0:v.edges)?v.edges:[]),gt(""),I(null)},[w,h]),bT=m.useMemo(()=>({instances:B}),[B]),kT=vK({nodes:d,edges:y,extra:bT,enabled:z.current,onRestore:wT}),{resetHistory:bd,undo:mk,redo:gk}=kT,La=m.useCallback(async()=>{var Me,dt;z.current=!1;const v=cs(i),N=cs(i);N.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const[P,L]=await Promise.all([fetch(`/api/nodes?${N.toString()}`),fetch(`/api/workspace/graph?${v.toString()}`),Pn()]),K=await P.json(),Y=await L.json();if(!P.ok)throw new Error(K.error||"读取节点定义失败");if(!L.ok)throw new Error(Y.error||"读取 workspace graph 失败");const G=[...(Array.isArray(K)?K:K.nodes||[]).filter(Ve=>!NK.has(Ve.id)),PK,AK,_K,EK,jK,CK];he(G);const J=Y.graph||JSON.parse(localStorage.getItem(SK)||"null")||{},X=vf(J,G),ae=Nx((Me=J==null?void 0:J.ui)==null?void 0:Me.displayPage,X.nodes),de=GP((dt=J==null?void 0:J.ui)==null?void 0:dt.viewport);q.current=X.instances,_(X.instances),h(X.nodes),w(X.edges),zo(kf(Y.workspaceSchedules||[])),C(ae),j.current=ae,A(de),O.current=de,H([]),bd(X.nodes,X.edges,{instances:X.instances});const ve=Y.writable!==!1;Sn(ve),ye(ve?"Workspace ready":"Readonly workspace"),z.current=!0},[i,t.language,Pn,bd,w,h]),vT=m.useCallback(async(v,N)=>{const P={packageId:(v==null?void 0:v.newId)||(v==null?void 0:v.id)||(v==null?void 0:v.label),label:(v==null?void 0:v.label)||(v==null?void 0:v.newId)||(v==null?void 0:v.id),version:"1.0.0",definitionId:N,body:(v==null?void 0:v.body)||"",script:(v==null?void 0:v.script)||"",scriptRef:(v==null?void 0:v.scriptRef)||"",implementationRef:(v==null?void 0:v.implementationRef)||"",implementationMode:(v==null?void 0:v.implementationMode)||"",inputs:Array.isArray(v==null?void 0:v.inputs)?v.inputs:[],outputs:Array.isArray(v==null?void 0:v.outputs)?v.outputs:[],flowId:i.flowId,flowSource:i.flowSource||"user",archived:!!i.archived},L=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)}),K=await L.json().catch(()=>({}));if(!L.ok||(K==null?void 0:K.ok)===!1)throw new Error((K==null?void 0:K.error)||"Publish failed");return await La(),ye(`Published node ${K.definitionId||K.id||P.packageId}`),K},[i,La]);m.useCallback((v="workspace")=>{Pa(!0),Ia(null),Xt(null),Vi(v||"workspace")},[]);const yk=m.useCallback((v={})=>{Ia({scheduleNodeId:String(v.scheduleNodeId||""),runNodeId:String(v.runNodeId||v.nodeId||""),lastRunId:String(v.lastRunId||""),label:String(v.label||"")}),Pa(!1),Xt(null),gt("")},[]),sm=m.useCallback(async(v="")=>{const N=String(v||"").trim();if(!(!N||!me)){uk(N),ye(`Optimizing run: ${N}`);try{await Wt(g.current,k.current);const P=Pc(g.current,k.current,q.current),L=mj(g.current,q.current,N,pi),K=await fetch("/api/workspace/run/optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,runNodeId:N,graph:P,model:L})}),Y=await K.json().catch(()=>({}));if(!K.ok||Y.ok===!1)throw new Error(Y.error||"优化失败");const G=Y.graph||P,J=vf(G,ie);q.current=J.instances,_(J.instances),h(J.nodes),w(J.edges),zo(kf(Y.workspaceSchedules||[])),bd(J.nodes,J.edges,{instances:J.instances});const X=Array.isArray(Y.optimized)?Y.optimized.length:0;ye(X>0?`已生成 ${X} 个 implementation`:"没有需要优化的节点")}catch(P){ye(String(P.message||P))}finally{uk("")}}},[pi,k,i,g,ie,bd,Wt,w,h,me]),xk=m.useCallback(async(v="")=>{const N=String(v||"").trim(),P=oc.current||{},L=Object.entries(P).find(([ae,de])=>ae===N||String((de==null?void 0:de.runNodeId)||"")===N)||Object.entries(P)[0]||null,K=(L==null?void 0:L[0])||"",Y=(L==null?void 0:L[1])||null,G=String((Y==null?void 0:Y.runNodeId)||N||"").trim(),J=new Set([G,...Array.isArray(Y==null?void 0:Y.plannedNodeIds)?Y.plannedNodeIds:[]].map(ae=>String(ae||"").trim()).filter(Boolean));K&&Ra.current.add(K);const X=K?ac.current.get(K):null;X&&(X.abort(),ac.current.delete(K)),K&&Bo(ae=>{const de={...ae};return delete de[K],de}),Ma(ae=>{const de=new Set(ae);for(const ve of J)de.delete(ve);return de}),$a(ae=>{var ve;const de={...ae};for(const Me of J)Me&&(!de[Me]||((ve=de[Me])==null?void 0:ve.status)==="running")&&(de[Me]={status:"stopped"});return de}),ye(G?`Workspace run stopped: ${G}`:"Workspace run stopped"),er(ae=>ae.map(de=>(K?de.id===K:!G||de.runNodeId===G)&&de.status==="running"?{...de,status:"stopped",endedAt:Date.now(),messages:[...Array.isArray(de.messages)?de.messages:[],{role:"assistant",kind:"status",text:"Workspace run stopped.",at:Date.now()}].slice(-160)}:de));try{await fetch("/api/workspace/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,runId:K,runNodeId:G})})}catch{}},[i,Bo]),wk=m.useCallback(async()=>{if(i.flowId)try{const v=cs(i),N=await fetch(`/api/workspace/run/status?${v.toString()}`),P=await N.json().catch(()=>({}));if(!N.ok||!P.running)return;const L=Array.isArray(P.runs)&&P.runs.length?P.runs:[{runId:`run-restored-${P.startedAt||Date.now()}`,runNodeId:P.runNodeId||"",startedAt:P.startedAt||Date.now(),plannedNodeIds:[]}],K={},Y=[];for(const G of L){const J=String((G==null?void 0:G.runNodeId)||"").trim(),X=String((G==null?void 0:G.runId)||`run-restored-${(G==null?void 0:G.startedAt)||Date.now()}-${J}`).trim();if(!X)continue;const ae=String((G==null?void 0:G.label)||"").trim()||bg(g.current,q.current,J,"Workspace Run");K[X]={id:X,runNodeId:J,label:ae,plannedNodeIds:Array.isArray(G==null?void 0:G.plannedNodeIds)?G.plannedNodeIds:[],startedAt:(G==null?void 0:G.startedAt)||Date.now()},J&&Y.push(J)}if(!Object.keys(K).length)return;Bo(G=>({...G,...K})),Ma(G=>{const J=new Set(G);for(const X of Y)J.add(X);return J}),$a(G=>{const J={...G};for(const X of Y)J[X]={status:"running"};return J}),ye(Y.length?`Workspace run still running: ${Y.join(", ")}`:"Workspace run still running"),er(G=>{const J=[...G];for(const[X,ae]of Object.entries(K)){if(J.some(Me=>Me.id===X||Me.status==="running"&&Me.runNodeId===ae.runNodeId))continue;const de=String(ae.runNodeId||""),ve=String(ae.label||"").trim()||bg(g.current,q.current,de,"Workspace Run");J.push({id:X,label:kg(ve,de,"Workspace Run"),alias:ve,runNodeId:de,status:"running",startedAt:ae.startedAt||Date.now(),steps:de?[{id:de,label:kg(ve,de,"Workspace Run"),status:"running"}]:[],messages:[{role:"assistant",kind:"run-summary",text:"Workspace run is still running in the background.",at:Date.now()}]})}return[...J.slice(-8)]})}catch{}},[i,g,Bo]),bk=m.useCallback(async v=>{if(!me){ye("Readonly workspace");return}if(!v)return;if(Object.values(oc.current||{}).find(Qe=>String((Qe==null?void 0:Qe.runNodeId)||"")===String(v||""))){ye(`Workspace run already running: ${v}`);return}let P=d,L=y,K=q.current;const Y=di.current;if(Y!=null&&Y.id){const Qe=P.find(Re=>Re.id===Y.id),Ue=yj({nodes:P,edges:L,instances:K,selectedNode:Qe,draft:Y,allowRename:!1});if(Ue!=null&&Ue.error){ar(Ue.error),ye(Ue.error);return}Ue!=null&&Ue.ok&&Ue.changed&&(P=Ue.nodes,L=Ue.edges,K=Ue.instances,q.current=K,_(K),h(P),w(L),Hi(Ue.nextId||Y.id))}const G=Pc(P,L,K),J=`run-${Date.now()}-${String(v).replace(/[^a-z0-9_-]+/gi,"_")}`,X=bg(P,K,v,"Workspace Run"),ae=kg(X,v,"Workspace Run");let de=[v];try{const Qe=await fetch("/api/workspace/run/plan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,graph:G,runNodeId:v})}),Ue=await Qe.json().catch(()=>({}));if(!Qe.ok||(Ue==null?void 0:Ue.ok)===!1)throw new Error(Ue.error||"Workspace run plan failed");de=Array.isArray(Ue.plannedNodeIds)&&Ue.plannedNodeIds.length?Ue.plannedNodeIds.map(Mt=>String(Mt||"").trim()).filter(Boolean):[v],de=Array.from(new Set([v,...de].filter(Boolean)));const Re=Ue.conflict||null;if(Re!=null&&Re.runNodeId||Re!=null&&Re.runId){const Mt=Array.isArray(Re.conflictNodeIds)&&Re.conflictNodeIds.length?`: ${Re.conflictNodeIds.join(", ")}`:"";ye(`Run ${v} conflicts with running ${Re.runNodeId||Re.runId}${Mt}`);return}}catch(Qe){ye(String(Qe.message||Qe));return}const ve=new Set(de),Me=Object.values(oc.current||{}).find(Qe=>(Array.isArray(Qe==null?void 0:Qe.plannedNodeIds)?Qe.plannedNodeIds:[]).some(Ue=>ve.has(String(Ue||"").trim())));if(Me){const Qe=(Array.isArray(Me.plannedNodeIds)?Me.plannedNodeIds:[]).map(Ue=>String(Ue||"").trim()).filter(Ue=>Ue&&ve.has(Ue));ye(`Run ${v} conflicts with running ${Me.runNodeId||"workspace run"}${Qe.length?`: ${Qe.join(", ")}`:""}`);return}const dt=new AbortController;ac.current.set(J,dt),Ra.current.delete(J),Bo(Qe=>({...Qe,[J]:{id:J,runNodeId:v,label:X,plannedNodeIds:de,startedAt:Date.now()}})),Ma(Qe=>new Set([...Qe,v])),$a(Qe=>({...Qe,[v]:{status:"running"}})),ye(`Running ${ae}...`),Vi(J),er(Qe=>[...Qe.slice(-7),{id:J,label:ae,alias:X,runNodeId:v,status:"running",startedAt:Date.now(),steps:[],messages:[{role:"assistant",kind:"run-summary",text:"准备运行...",at:Date.now()}]}]);let Ve=v;const Ke=new Map,We=()=>Ra.current.has(J),Fe=Qe=>{const Ue=new Set((Qe||[]).map(Re=>String(Re||"").trim()).filter(Boolean));Ue.size||Ue.add(String(v||"")),Ma(Re=>{const Mt=new Set(Re);for(const Ge of Ue)Mt.delete(Ge);return Mt})},Dt=(Qe,Ue)=>{const Re=new Set((Qe||[]).map(Mt=>String(Mt||"").trim()).filter(Boolean));Re.size||Re.add(String(v||"")),$a(Mt=>{var pt;const Ge={...Mt};for(const Lt of Re)Lt&&(!Ge[Lt]||((pt=Ge[Lt])==null?void 0:pt.status)==="running")&&(Ge[Lt]={status:Ue});return Ge})};try{await Wt(P,L);const Qe=mj(P,K,v,pi),Ue=await fetch("/api/workspace/run",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},signal:dt.signal,body:JSON.stringify({...i,graph:G,runNodeId:v,runAlias:X,runSessionId:J,model:Qe,selectedSkills:bs,stream:!0})});if(!Ue.ok){const pe=await Ue.json().catch(()=>({}));throw new Error(pe.error||"Workspace run failed")}if(!Ue.body)throw new Error("Workspace run stream unavailable");const Re=Ue.body.getReader(),Mt=new TextDecoder;let Ge="",pt=[],Lt=[];const pm=(pe,qe)=>{var nt,vt;const ze=d.find(It=>It.id===pe),at=String(((nt=ze==null?void 0:ze.data)==null?void 0:nt.label)||pe||"").trim(),ge=String(qe||((vt=ze==null?void 0:ze.data)==null?void 0:vt.definitionId)||"").trim();return ge&&ge!==at?`${at} (${ge})`:at},mc=(pe,qe,ze)=>{const at=String(pe||"").trim();at&&er(ge=>ge.map(nt=>{if(nt.id!==J)return nt;const It=[...Array.isArray(nt.steps)?nt.steps:[]],lt=It.findIndex(en=>en.id===at),yt={id:at,label:pm(at,qe),status:ze};lt>=0?It[lt]={...It[lt],...yt}:It.push(yt);const Zt=It.map((en,Yi)=>{const xi=en.status==="done"?"[done]":en.status==="failed"?"[failed]":"[running]";return`${Yi+1}. ${xi} ${en.label}`}).join(`
|
|
244
|
-
`),Ot=Array.isArray(nt.messages)?nt.messages:[],Ut=Ot.findIndex(en=>en.kind==="run-summary"),on={role:"assistant",kind:"run-summary",text:Zt||"准备运行...",at:Date.now()},Tt=[...Ot];return Ut>=0?Tt[Ut]=on:Tt.unshift(on),{...nt,steps:It,messages:Tt.slice(-160)}}))},hm=(pe,qe)=>{var lv,cv,uv,dv,fv,pv,hv,mv,gv,yv;const ze=String(pe||"").trim(),at=String(qe||"").trim();if(!ze||!at)return;const ge=(lv=q.current)==null?void 0:lv[ze];if(!Ls(ge==null?void 0:ge.definitionId))return;const nt=_o(ge==null?void 0:ge.input,"displayType","markdown"),vt=dI(nt),It=fI(ze),lt=ie.find(kr=>kr.id===vt),yt=dj(lt==null?void 0:lt.inputs,vt,at),Zt=dj(lt==null?void 0:lt.outputs,vt,at),Ot=String((ge==null?void 0:ge.label)||ze||"一键任务").trim(),Ut={...q.current||{},[ze]:{...ge||{},output:pj(ge==null?void 0:ge.output)},[It]:{...((cv=q.current)==null?void 0:cv[It])||{},definitionId:vt,label:Ot,role:"normal",body:at,input:yt,output:Zt,sourceContextRunNodeId:ze,displayReloadKey:String(Date.now())}};q.current=Ut,_(Ut);const on=g.current||[],Tt=on.find(kr=>kr.id===ze),en=on.find(kr=>kr.id===It),Yi=Number(((uv=Tt==null?void 0:Tt.measured)==null?void 0:uv.width)||(Tt==null?void 0:Tt.width)||((fv=(dv=Tt==null?void 0:Tt.data)==null?void 0:dv.nodeSize)==null?void 0:fv.width)||520),xi=(en==null?void 0:en.position)||{x:Number(((pv=Tt==null?void 0:Tt.position)==null?void 0:pv.x)||0)+Yi+120,y:Number(((hv=Tt==null?void 0:Tt.position)==null?void 0:hv.y)||0)},Un=((mv=en==null?void 0:en.data)==null?void 0:mv.displaySize)||((gv=en==null?void 0:en.data)==null?void 0:gv.nodeSize)||{width:wx,height:bx},Hs=xx({id:It,type:Nl,position:xi,width:Number(Un.width)||wx,height:Number(Un.height)||bx,data:{label:Ot,definitionId:vt,role:"normal",body:at,inputs:yt,outputs:Zt,sourceContextRunNodeId:ze,displayReloadKey:Ut[It].displayReloadKey,nodeSize:Un,displaySize:Un}},Ut,ie),Gi=on.map(kr=>{if(kr.id===ze){const{width:Rse,height:Mse,measured:$se,...wR}=kr,{nodeSize:Lse,displaySize:Ose,...Dd}=kr.data||{};return{...wR,data:{...Dd,outputs:pj(Dd==null?void 0:Dd.outputs),contextRunResultNonce:Date.now()}}}return kr.id===It?{...Hs,selected:kr.selected}:kr});en||Gi.push(Hs),g.current=Gi,h(Gi);const Ji=k.current||[],Od=pI(vt),gm=fj((ge==null?void 0:ge.output)||((yv=Tt==null?void 0:Tt.data)==null?void 0:yv.outputs),"output",["content","result"],["text"]),yR=fj(yt,"input",[Od,"content"],["text"]),xR={id:`we-${ze}-${It}`,source:ze,target:It,sourceHandle:gm,targetHandle:yR,markerEnd:{type:Qs.ArrowClosed}},av=[...Ji.filter(kr=>!(kr.source===ze&&kr.target===It)),xR];k.current=av,w(av),window.requestAnimationFrame(()=>{s(ze),s(It)})},Rd=(pe,qe=null)=>{const ze=pe!=null&&pe.instances&&typeof pe.instances=="object"?pe.instances:{},at=qe instanceof Set?qe:null;for(const[ge,nt]of Object.entries(ze)){if(at&&!at.has(ge)||!Ls(nt==null?void 0:nt.definitionId))continue;const vt=zh({outputs:nt.output});vt&&hm(ge,vt)}},rv=pe=>{const qe=String(pe||"").trim();if(!qe)return;const ze=Ve;Ve=qe,Ma(at=>{const ge=new Set(at);return ze&&ze!==qe&&ze!==v&&ge.delete(ze),v&&ge.add(v),ge.add(qe),ge}),$a(at=>{var ge;return{...at,...ze&&ze!==qe&&ze!==v&&((ge=at[ze])==null?void 0:ge.status)==="running"?{[ze]:{status:"success"}}:{},...v?{[v]:{status:"running"}}:{},[qe]:{status:"running"}}})},sv=pe=>{const qe=String(pe||"").trim();qe&&(Ma(ze=>{const at=new Set(ze);return at.delete(qe),at}),$a(ze=>({...ze,[qe]:{status:"success"}})))},iv=(pe,qe)=>{const ze=String(qe||"");if(!ze.trim())return;const at=["assistant","thinking","result","error","prompt"].includes(pe)?pe:"assistant";er(ge=>ge.map(nt=>{if(nt.id!==J)return nt;let vt=Array.isArray(nt.messages)?nt.messages:[];if(at==="result"){const yt=[...vt].reverse().find(Zt=>Zt.kind==="assistant");if(String((yt==null?void 0:yt.text)||"").trim()===ze.trim())return nt}if(at==="assistant"){const yt=vt.findIndex(Zt=>Zt.kind==="result"&&String(Zt.text||"").trim()===ze.trim());yt>=0&&(vt=vt.filter((Zt,Ot)=>Ot!==yt))}const It=[...vt],lt=It[It.length-1];return lt&<.kind===at&&!lt.error?It[It.length-1]={...lt,text:`${lt.text||""}${lt.text?`
|
|
245
|
-
`:""}${ze}`}:It.push({role:"assistant",kind:at,text:ze,...at==="error"?{error:!0}:{},at:Date.now()}),{...nt,messages:It.slice(-160)}}))},Md=pe=>{const qe=String(pe||"");qe.trim()&&er(ze=>ze.map(at=>{var It;if(at.id!==J)return at;const ge=Array.isArray(at.messages)?at.messages:[],nt=ge.findIndex(lt=>lt.kind==="thinking"),vt=[...ge];if(nt>=0){const lt=String(((It=vt[nt])==null?void 0:It.text)||"");vt[nt]={...vt[nt],text:`${lt}${lt&&!lt.endsWith(`
|
|
246
|
-
`),""}${qe}`,at:Date.now()}}else{const lt=vt.findIndex(yt=>yt.kind==="activity");vt.splice(lt>=0?lt+1:vt.length,0,{role:"assistant",kind:"thinking",text:qe,at:Date.now()})}return{...at,messages:vt.slice(-160)}}))},qi=(pe,qe=null)=>{const ze=WK(pe);ze&&er(at=>at.map(ge=>{if(ge.id!==J)return ge;const nt=Number(qe==null?void 0:qe.ts)||Date.now(),vt=Number(ge.startedAt)||nt,It=Number(ge.lastActivityAt)||vt,lt=Math.max(0,nt-It),yt=Number.isFinite(Number(qe==null?void 0:qe.runElapsedMs))?Math.max(0,Number(qe.runElapsedMs)):Math.max(0,nt-vt),Zt=Array.isArray(ge.activities)?ge.activities:[],Ot=Zt[Zt.length-1],on=(typeof Ot=="string"?Ot:String((Ot==null?void 0:Ot.text)||""))===ze?Zt:[...Zt,{text:ze,kind:KK(ze),stepMs:lt,totalMs:yt,at:nt}].slice(-30),Tt=Array.isArray(ge.timingEntries)?ge.timingEntries:[],en=Array.isArray(ge.messages)?ge.messages:[],Yi=en.findIndex(Hs=>Hs.kind==="activity"),xi={role:"assistant",kind:"activity",text:GN(on,Tt,vt,nt),at:Date.now()},Un=[...en];if(Yi>=0)Un[Yi]=xi;else{const Hs=Un.findIndex(Gi=>Gi.kind==="run-summary");Un.splice(Hs>=0?Hs+1:0,0,xi)}return{...ge,activities:on,lastActivityAt:nt,messages:Un.slice(-160)}}))},ov=pe=>{const qe=String((pe==null?void 0:pe.source)||"runner"),ze=String((pe==null?void 0:pe.stream)||""),at=String((pe==null?void 0:pe.eventType)||"event"),ge=String((pe==null?void 0:pe.text)||"").trim();if(!ge)return;const nt=`[${qe}${ze?`:${ze}`:""}] ${at}
|
|
247
|
-
${ge}`,vt=JK(pe);er(It=>It.map(lt=>{if(lt.id!==J)return lt;const Zt=[...Array.isArray(lt.rawTrace)?lt.rawTrace:[],nt].slice(-80),Ot=Array.isArray(lt.timingEntries)?lt.timingEntries:[],Ut=vt?[...Ot,vt].slice(-80):Ot,on=Array.isArray(lt.activities)?lt.activities:[],Tt=Number(lt.startedAt)||Number(pe==null?void 0:pe.ts)||Date.now(),en=Number(vt==null?void 0:vt.at)||Number(pe==null?void 0:pe.ts)||Date.now(),Yi=Array.isArray(lt.messages)?lt.messages:[],xi={role:"assistant",kind:"raw",text:Zt.join(`
|
|
248
|
-
|
|
249
|
-
---
|
|
250
|
-
|
|
251
|
-
`),at:Date.now()},Un=[...Yi],Hs=Un.findIndex(Ji=>Ji.kind==="activity");if(vt){const Ji={role:"assistant",kind:"activity",text:GN(on,Ut,Tt,en),at:Date.now()};if(Hs>=0)Un[Hs]=Ji;else{const Od=Un.findIndex(gm=>gm.kind==="run-summary");Un.splice(Od>=0?Od+1:0,0,Ji)}}const Gi=Un.findIndex(Ji=>Ji.kind==="raw");return Gi>=0?Un[Gi]=xi:Un.push(xi),{...lt,rawTrace:Zt,timingEntries:Ut,messages:Un.slice(-160)}}))},gR=pe=>{er(qe=>qe.map(ze=>ze.id===J?{...ze,status:pe,endedAt:Date.now()}:ze))},$d=pe=>{const qe=new Set,ze=String((pe==null?void 0:pe.nodeId)||"").trim();ze&&qe.add(ze);for(const at of Array.isArray(pe==null?void 0:pe.displayNodeIds)?pe.displayNodeIds:[]){const ge=String(at||"").trim();ge&&qe.add(ge)}for(const at of Array.isArray(pe==null?void 0:pe.touchedNodeIds)?pe.touchedNodeIds:[]){const ge=String(at||"").trim();ge&&qe.add(ge)}if(qe.size===0)for(const at of Array.isArray(pe==null?void 0:pe.order)?pe.order:[]){const ge=String(at||"").trim();ge&&qe.add(ge)}return qe},Ld=(pe,qe=null)=>{const ze=vf(pe||G,ie),at=new Map(ze.nodes.map(lt=>[lt.id,lt])),ge=ze.instances||{},nt=qe instanceof Set?qe:null,vt=(lt,yt)=>{const Zt={...lt||yt};Array.isArray(yt==null?void 0:yt.output)&&(Zt.output=yt.output);for(const Ot of["scriptRef","implementationRef","implementationMode"])(yt==null?void 0:yt[Ot])!=null&&String(yt[Ot]).trim()!==""&&(Zt[Ot]=yt[Ot]);return Zt},It=(lt,yt)=>{const Zt={...lt||{}};Array.isArray(yt==null?void 0:yt.outputs)&&(Zt.outputs=yt.outputs);for(const Ot of["scriptRef","implementationRef","implementationMode"])(yt==null?void 0:yt[Ot])!=null&&String(yt[Ot]).trim()!==""&&(Zt[Ot]=yt[Ot]);return Zt};h(lt=>{const yt=new Set(lt.map(Ut=>Ut.id)),Ot={...Pc(lt,k.current,q.current).instances||{}};for(const[Ut,on]of Object.entries(ge)){if(nt&&!nt.has(Ut)||!yt.has(Ut))continue;const Tt=Ot[Ut];va((on==null?void 0:on.definitionId)||(Tt==null?void 0:Tt.definitionId))?Ot[Ut]=on:Array.isArray(on==null?void 0:on.output)&&(Ot[Ut]=vt(Tt,on))}return q.current=Ot,_(Ot),lt.map(Ut=>{var Tt,en;if(nt&&!nt.has(Ut.id))return Ut;const on=at.get(Ut.id);return on?va(((Tt=on.data)==null?void 0:Tt.definitionId)||((en=Ut.data)==null?void 0:en.definitionId))?{...Ut,data:{...Ut.data,...on.data}}:{...Ut,data:It(Ut.data,on.data)}:Ut})})};for(;;){const{value:pe,done:qe}=await Re.read();if(qe)break;Ge+=Mt.decode(pe,{stream:!0});const ze=Ge.split(`
|
|
252
|
-
`);Ge=ze.pop()||"";for(const at of ze){if(!at.trim())continue;const ge=JSON.parse(at);if(ge.type==="error")throw new Error(ge.error||"Workspace run failed");if(ge.type==="stopped"){Ra.current.add(J),pt=Array.isArray(ge.order)?ge.order:pt,qi("运行停止",ge);continue}if(ge.type==="node-start"&&(ye(`Running ${ge.nodeId}...`),rv(ge.nodeId),mc(ge.nodeId,ge.definitionId,"running")),ge.type==="node-done"){const nt=Ke.get(String(ge.nodeId||"").trim());nt&&hm(ge.nodeId,nt),sv(ge.nodeId),mc(ge.nodeId,ge.definitionId,"done")}if(ge.type==="status"&&qi(ge.line||ge.message||"",ge),ge.type==="paused"&&(Lt=Array.isArray(ge.nodeIds)?ge.nodeIds:[],qi("运行暂停",ge)),ge.type==="natural"&&((ge.kind==="result"||/---agentflow\b|resultFile\s*:|\"resultFile\"\s*:|\"result\"\s*:/i.test(String(ge.text||"")))&&ge.nodeId&&Ke.set(String(ge.nodeId||"").trim(),String(ge.text||"")),ge.kind==="thinking"?Md(ge.text||""):iv(ge.kind,ge.text||"")),ge.type==="raw"){const nt=JN(ge);nt&&Md(nt),ov(ge)}if(ge.type==="graph"&&ge.graph){const nt=$d(ge);Ld(ge.graph,nt),Rd(ge.graph,nt)}if(ge.type==="done"){if(ge.graph){const nt=$d(ge);Ld(ge.graph,nt),Rd(ge.graph,nt)}pt=Array.isArray(ge.order)?ge.order:[],Lt=Array.isArray(ge.pauseNodeIds)?ge.pauseNodeIds:Lt,qi(Lt.length?"运行暂停":"运行完成",ge)}}}if(Ge.trim()){const pe=JSON.parse(Ge);if(pe.type==="error")throw new Error(pe.error||"Workspace run failed");if(pe.type==="stopped"&&(Ra.current.add(J),qi("运行停止",pe)),pe.type==="node-start"&&(ye(`Running ${pe.nodeId}...`),rv(pe.nodeId),mc(pe.nodeId,pe.definitionId,"running")),pe.type==="node-done"){const qe=Ke.get(String(pe.nodeId||"").trim());qe&&hm(pe.nodeId,qe),sv(pe.nodeId),mc(pe.nodeId,pe.definitionId,"done")}if(pe.type==="status"&&qi(pe.line||pe.message||"",pe),pe.type==="paused"&&(Lt=Array.isArray(pe.nodeIds)?pe.nodeIds:[],qi("运行暂停",pe)),pe.type==="natural"&&((pe.kind==="result"||/---agentflow\b|resultFile\s*:|\"resultFile\"\s*:|\"result\"\s*:/i.test(String(pe.text||"")))&&pe.nodeId&&Ke.set(String(pe.nodeId||"").trim(),String(pe.text||"")),pe.kind==="thinking"?Md(pe.text||""):iv(pe.kind,pe.text||"")),pe.type==="raw"){const qe=JN(pe);qe&&Md(qe),ov(pe)}if(pe.type==="graph"&&pe.graph){const qe=$d(pe);Ld(pe.graph,qe),Rd(pe.graph,qe)}if(pe.type==="done"){if(pe.graph){const qe=$d(pe);Ld(pe.graph,qe),Rd(pe.graph,qe)}pt=Array.isArray(pe.order)?pe.order:[],Lt=Array.isArray(pe.pauseNodeIds)?pe.pauseNodeIds:Lt,qi(Lt.length?"运行暂停":"运行完成",pe)}}We()&&(Fe(de),Dt(de,"stopped"));const mm=We()?`Workspace run stopped: ${v}`:Lt.length?`Workspace run paused at ${Lt.join(", ")}`:`Workspace run done: ${pt.length?pt.join(" -> "):v}`;if(ye(mm),We()||Dt(de,Lt.length?"paused":"success"),gR(We()?"stopped":Lt.length?"paused":"done"),!We()){try{await Wt(g.current,k.current),ye(mm)}catch(pe){ye(`${mm},但保存结果失败:${String(pe.message||pe)}`)}await Pn()}}catch(Qe){if(We()||(Qe==null?void 0:Qe.name)==="AbortError"){Fe(de),Dt(de,"stopped"),ye(`Workspace run stopped: ${v}`),er(Ue=>Ue.map(Re=>Re.id===J?{...Re,status:"stopped",endedAt:Date.now()}:Re));return}Fe(de),Dt([v,Ve].filter(Boolean),"failed"),ye(String(Qe.message||Qe)),er(Ue=>Ue.map(Re=>Re.id===J?{...Re,status:"failed",endedAt:Date.now(),messages:[...Array.isArray(Re.messages)?Re.messages:[],{role:"assistant",error:!0,text:String(Qe.message||Qe),at:Date.now()}].slice(-160)}:Re))}finally{ac.current.get(J)===dt&&ac.current.delete(J),Bo(Qe=>{const Ue={...Qe};return delete Ue[J],Ue}),Ra.current.delete(J),Fe(de)}},[pi,y,i,Pn,d,ie,Hi,Wt,bs,w,h,Bo,s,me]),kd=m.useCallback(async()=>{try{const N=await(await fetch("/api/skills")).json().catch(()=>({})),P=Array.isArray(N.skills)?N.skills.map(L=>({key:String(L.key),name:String(L.name||L.id||L.key),description:L.description?String(L.description):"",sourceLabel:L.sourceLabel?String(L.sourceLabel):""})):[];cT(P),Bb(!0)}catch{Bb(!0)}},[]),vd=m.useCallback(async()=>{try{const N=await(await fetch("/api/mcps")).json().catch(()=>({})),P=Array.isArray(N.servers)?N.servers.map(L=>({name:String((L==null?void 0:L.name)||""),type:String((L==null?void 0:L.type)||""),url:String((L==null?void 0:L.url)||""),command:String((L==null?void 0:L.command)||""),args:Array.isArray(L==null?void 0:L.args)?L.args.map(String):[],description:String((L==null?void 0:L.description)||"")})).filter(L=>L.name):[];Vb(P)}catch{Vb([])}},[]),Sd=m.useCallback(async()=>{try{const v=cs(i),P=await(await fetch(`/api/workspaces?${v.toString()}`)).json().catch(()=>({})),L=Array.isArray(P.workspaces)?P.workspaces.map(K=>({id:String((K==null?void 0:K.id)||""),label:String((K==null?void 0:K.label)||(K==null?void 0:K.name)||"知识库"),path:String((K==null?void 0:K.path)||""),kind:(K==null?void 0:K.kind)==="git"?"git":"local",repoUrl:String((K==null?void 0:K.repoUrl)||""),branch:String((K==null?void 0:K.branch)||""),mountPath:String((K==null?void 0:K.mountPath)||""),type:String((K==null?void 0:K.type)||""),builtin:(K==null?void 0:K.builtin)===!0,exists:(K==null?void 0:K.exists)!==!1})).filter(K=>K.path):[];Ub(L)}catch{Ub([])}},[i]),kk=m.useCallback(async()=>{Q.current=!1;try{const v=cs(i),N=await fetch(`/api/workspace/conversations?${v.toString()}`),P=await N.json().catch(()=>({}));if(!N.ok)throw new Error(P.error||`HTTP ${N.status}`);const L=qN(P.conversations||{});Aa(L.composer.messages),er(L.composer.runSessions),Vi(L.composer.activeSessionId||"workspace"),Ki(L.nodeChats)}catch{Aa([]),er([]),Vi("workspace"),Ki({})}finally{Q.current=!0}},[i]),vk=m.useCallback(async()=>{if(!me||i.archived)return;const v=qN({composer:{activeSessionId:Wi,messages:Do,runSessions:Fo},nodeChats:hi});await fetch("/api/workspace/conversations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,conversations:v})}).then(async N=>{if(!N.ok){const P=await N.json().catch(()=>({}));throw new Error(P.error||`HTTP ${N.status}`)}})},[Wi,Do,Fo,i,hi,me]);m.useEffect(()=>{La().catch(v=>ye(String(v.message||v))),kk(),wd(),fetch("/api/model-lists").then(v=>v.json()).then(v=>aT({cursor:Array.isArray(v.cursor)?v.cursor.map(String):[],opencode:Array.isArray(v.opencode)?v.opencode.map(String):[],claudeCode:Array.isArray(v.claudeCode)?v.claudeCode.map(String):[],codex:Array.isArray(v.codex)?v.codex.map(String):[]})).catch(()=>{}),kd(),vd(),Sd(),wk(),fetch("/api/skill-collections").then(v=>v.json()).then(v=>{uT(sa(v)),dT(!0)}).catch(()=>{}),fetch("/api/auth/me").then(v=>v.json()).then(v=>{tk(v.user||null),rk(!0)}).catch(()=>{tk(null),rk(!0)})},[La,kk,wd,vd,kd,wk,Sd,mi]),m.useEffect(()=>{if(fk(""),!(!zb||!Hb)){if(!mi){rc([]);return}rc(uL(mi,"workspace",ws,Ea)),fk(mi)}},[Ea,Hb,ws,zb,mi]),m.useEffect(()=>{if(!(dk!==mi||!mi))try{localStorage.setItem(mi,JSON.stringify(bs))}catch{}},[bs,mi,dk]),m.useEffect(()=>{q.current=B},[B]),m.useEffect(()=>{g.current=d},[d]),m.useEffect(()=>{const v=D.current,N=new Map,P=[];for(const G of d){const J=YP(G);N.set(G.id,J),v.get(G.id)!==J&&P.push(G.id)}if(D.current=N,P.length===0)return;const L=()=>P.forEach(G=>s(G)),K=window.requestAnimationFrame(L),Y=window.setTimeout(L,80);return()=>{window.cancelAnimationFrame(K),window.clearTimeout(Y)}},[d,s]),m.useEffect(()=>{k.current=y},[y]),m.useEffect(()=>{j.current=S},[S]),m.useEffect(()=>{O.current=E},[E]),m.useEffect(()=>{di.current=we},[we]),m.useEffect(()=>{Bn.current=jt},[jt]),m.useEffect(()=>{F.current=M},[M]),m.useEffect(()=>{if(!M)return;const v=P=>{P.key==="Escape"&&I(null)},N=P=>{var L,K;(K=(L=P.target)==null?void 0:L.closest)!=null&&K.call(L,".af-connect-node-menu")||I(null)};return document.addEventListener("keydown",v),document.addEventListener("pointerdown",N),()=>{document.removeEventListener("keydown",v),document.removeEventListener("pointerdown",N)}},[M]),m.useEffect(()=>{if(z.current&&me)return $.current&&window.clearTimeout($.current),$.current=window.setTimeout(()=>{Wt().catch(v=>ye(String(v.message||v)))},650),()=>{$.current&&window.clearTimeout($.current)}},[d,y,S,Wt,me]),m.useEffect(()=>{if(Q.current&&!(!me||i.archived))return te.current&&window.clearTimeout(te.current),te.current=window.setTimeout(()=>{vk().catch(v=>ye(String(v.message||v)))},900),()=>{te.current&&window.clearTimeout(te.current)}},[Wi,Do,Fo,i.archived,hi,vk,me]);const lc=m.useMemo(()=>d.filter(v=>{var N;return((N=v==null?void 0:v.data)==null?void 0:N.definitionId)==="workspace_scheduled_run"}).map(v=>{var N;return{id:v.id,config:Sb(((N=v.data)==null?void 0:N.body)||"")}}),[d]),ST=m.useMemo(()=>lc.map(v=>`${v.id}:${v.config.enabled?"1":"0"}:${v.config.cron}:${v.config.timezone}`).join("|"),[lc]);m.useEffect(()=>{if(!z.current||a!=="workspace"||!i.flowId){zo({});return}if(!lc.length){zo({});return}let v=!1;const N=async()=>{try{const L=cs(i),K=await fetch(`/api/workspace/schedules?${L.toString()}`),Y=await K.json().catch(()=>({}));if(!K.ok)throw new Error(Y.error||"读取 Workspace 定时状态失败");v||zo(kf(Y.schedules||[]))}catch{v||zo(L=>{var Y;const K={};for(const G of lc)K[G.id]={...L[G.id]||{},lastStatus:((Y=L[G.id])==null?void 0:Y.lastStatus)||"unknown"};return K})}};N();const P=window.setInterval(N,5e3);return()=>{v=!0,window.clearInterval(P)}},[i,lc,ST,a]);const Sk=m.useCallback((v,N)=>{if(!me){ye("Readonly workspace");return}const P=uj(N),L=X=>Array.isArray(X)?X.map(ae=>(ae==null?void 0:ae.name)!=="skillKeys"&&(ae==null?void 0:ae.name)!=="skillsContext"&&(ae==null?void 0:ae.type)!=="text"?ae:{...ae,default:P,value:P}):[],K=d.map(X=>{var ae;return X.id!==v?X:{...X,data:{...X.data,body:P,inputs:L((ae=X.data)==null?void 0:ae.inputs)}}}),Y=q.current||{},G=Y[v]&&typeof Y[v]=="object"?Y[v]:{},J={...Y,[v]:{...G,body:P,input:L(G.input)}};q.current=J,h(K),_(J),Xt(X=>!X||X.id!==v?X:{...X,body:P,inputs:L(X.inputs)}),Wt(K,y).catch(X=>ye(String(X.message||X)))},[y,d,Wt,h,me]),Nk=m.useCallback((v,N)=>{if(!me){ye("Readonly workspace");return}const P=sU(N),L=X=>Array.isArray(X)?X.map(ae=>(ae==null?void 0:ae.name)!=="serverNames"&&(ae==null?void 0:ae.name)!=="mcpContext"&&(ae==null?void 0:ae.type)!=="text"?ae:{...ae,default:P,value:P}):[],K=d.map(X=>{var ae;return X.id!==v?X:{...X,data:{...X.data,body:P,inputs:L((ae=X.data)==null?void 0:ae.inputs)}}}),Y=q.current||{},G=Y[v]&&typeof Y[v]=="object"?Y[v]:{},J={...Y,[v]:{...G,body:P,input:L(G.input)}};q.current=J,h(K),_(J),Xt(X=>!X||X.id!==v?X:{...X,body:P,inputs:L(X.inputs)}),Wt(K,y).catch(X=>ye(String(X.message||X)))},[y,d,Wt,h,me]),jk=m.useCallback((v,N)=>{if(!me){ye("Readonly workspace");return}const P=(Array.isArray(N)?N:N?[N]:[]).filter(Ve=>String((Ve==null?void 0:Ve.path)||"").trim()),L=P[0]||null,K=String((L==null?void 0:L.path)||"").trim(),Y=P.length===1?String((L==null?void 0:L.label)||(L==null?void 0:L.id)||"知识库").trim():P.length?`${P.length} 个知识库`:"",G=P.length?JSON.stringify(Bh(P)):"",J=L?JSON.stringify({version:1,id:(L==null?void 0:L.id)||"",label:String((L==null?void 0:L.label)||(L==null?void 0:L.id)||"知识库").trim(),kind:(L==null?void 0:L.kind)||"local",cwd:K,workspaceRoot:K,repoUrl:(L==null?void 0:L.repoUrl)||"",branch:(L==null?void 0:L.branch)||"",mountPath:(L==null?void 0:L.mountPath)||"",type:(L==null?void 0:L.type)||""}):"",X=Ve=>Array.isArray(Ve)?Ve.map(Ke=>(Ke==null?void 0:Ke.name)==="path"?{...Ke,default:K,value:K}:(Ke==null?void 0:Ke.name)==="label"?{...Ke,default:Y,value:Y}:(Ke==null?void 0:Ke.name)==="knowledgeContext"?{...Ke,default:G,value:G}:(Ke==null?void 0:Ke.name)==="workspaceContext"?{...Ke,default:J,value:J}:(Ke==null?void 0:Ke.name)==="mode"?{...Ke,default:"set",value:"set"}:Ke):[],ae=Ve=>Array.isArray(Ve)?Ve.map(Ke=>(Ke==null?void 0:Ke.name)==="knowledgeContext"?{...Ke,default:G,value:G}:(Ke==null?void 0:Ke.name)==="workspaceContext"?{...Ke,default:J,value:J,showOnNode:!1}:(Ke==null?void 0:Ke.name)==="cwd"?{...Ke,default:K,value:K,showOnNode:!1}:Ke):[],de=d.map(Ve=>{var Ke,We,Fe;return Ve.id===v?{...Ve,data:{...Ve.data,label:((Ke=Ve.data)==null?void 0:Ke.label)||"加载知识库",inputs:X((We=Ve.data)==null?void 0:We.inputs),outputs:ae((Fe=Ve.data)==null?void 0:Fe.outputs)}}:Ve}),ve=q.current||{},Me=ve[v]&&typeof ve[v]=="object"?ve[v]:{},dt={...ve,[v]:{...Me,label:Me.label||"加载知识库",input:X(Me.input),output:ae(Me.output)}};q.current=dt,h(de),_(dt),Xt(Ve=>(Ve==null?void 0:Ve.id)===v?{...Ve,inputs:X(Ve.inputs),outputs:ae(Ve.outputs)}:Ve),Wt(de,y).catch(Ve=>ye(String(Ve.message||Ve)))},[y,d,Wt,h,me]),Ck=m.useCallback((v,N)=>{if(!me){ye("Readonly workspace");return}const P=String(v||"");if(!P)return;const L=uj((N==null?void 0:N.skillKeys)||[]),K=cd((N==null?void 0:N.displayType)||"markdown"),Y=String((N==null?void 0:N.model)||"").trim(),G=(N==null?void 0:N.includeWorkspaceContext)===!1?"false":"true",J=N!=null&&N.workspaceContext&&typeof N.workspaceContext=="object"?JSON.stringify(N.workspaceContext):"",X=N!=null&&N.knowledgeContext&&typeof N.knowledgeContext=="object"?JSON.stringify(N.knowledgeContext):"",ae=We=>Array.isArray(We)?We.map(Fe=>(Fe==null?void 0:Fe.name)==="skillKeys"?{...Fe,default:L,value:L}:(Fe==null?void 0:Fe.name)==="displayType"?{...Fe,default:K,value:K}:(Fe==null?void 0:Fe.name)==="includeWorkspaceContext"?{...Fe,default:G,value:G}:(Fe==null?void 0:Fe.name)==="knowledgeContext"?{...Fe,default:X,value:X}:(Fe==null?void 0:Fe.name)==="workspaceContext"?{...Fe,default:J,value:J}:Fe):[],de=We=>Array.isArray(We)?We.map(Fe=>(Fe==null?void 0:Fe.name)==="displayType"?{...Fe,default:K,value:K}:Fe):[],ve=String((N==null?void 0:N.task)??""),Me=d.map(We=>{var Fe,Dt;return We.id===P?{...We,data:{...We.data,body:ve,model:Y,inputs:ae((Fe=We.data)==null?void 0:Fe.inputs),outputs:de((Dt=We.data)==null?void 0:Dt.outputs)}}:We}),dt=q.current||{},Ve=dt[P]&&typeof dt[P]=="object"?dt[P]:{},Ke={...dt,[P]:{...Ve,body:ve,model:Y,input:ae(Ve.input),output:de(Ve.output)}};q.current=Ke,h(Me),_(Ke),Xt(We=>(We==null?void 0:We.id)===P?{...We,body:ve,model:Y,inputs:ae(We.inputs),outputs:de(We.outputs)}:We),Wt(Me,y).catch(We=>ye(String(We.message||We)))},[y,d,Wt,h,me]),_k=m.useCallback((v,N)=>{if(!me){ye("Readonly workspace");return}const P=o7(N),L=d.map(J=>J.id===v?{...J,data:{...J.data,body:P}}:J),K=q.current||{},Y=K[v]&&typeof K[v]=="object"?K[v]:{},G={...K,[v]:{...Y,body:P}};q.current=G,h(L),_(G),Xt(J=>(J==null?void 0:J.id)===v?{...J,body:P}:J),Wt(L,y).catch(J=>ye(String(J.message||J)))},[y,d,Wt,h,me]),Ek=m.useCallback(v=>{const N=String(v||"").trim();N&&(ek(P=>P===N?"":N),Ki(P=>({...P,[N]:P[N]||{sessionId:`nodechat_${Date.now()}_${N.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[],draft:"",candidateContent:"",running:!1,error:""}})))},[]),Ak=m.useCallback((v,N)=>{const P=String(v||"").trim();P&&Ki(L=>({...L,[P]:{...L[P]||{sessionId:`nodechat_${Date.now()}_${P.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[]},draft:String(N||""),error:""}}))},[]),Kr=m.useCallback((v,N,P="replace",L={})=>{var Qe,Ue;if(!me){ye("Readonly workspace");return}const K=String(v||"").trim();if(!K)return;const Y=g.current.find(Re=>Re.id===K),G=yn(Y==null?void 0:Y.data),J=Ls((Qe=Y==null?void 0:Y.data)==null?void 0:Qe.definitionId),X=Pi(N),ae=G==="html"?Xl(X):G==="react"?Fh(X):String(X||""),de=Y?No(Y.data):"",ve=P==="append"&&String(de||"").trim()?`${String(de).replace(/\s+$/g,"")}
|
|
253
|
-
|
|
254
|
-
${ae.trim()}`:ae,Me=G==="image"?"src":"content",dt=L!=null&&L.reloadDisplay?Date.now():(Ue=Y==null?void 0:Y.data)==null?void 0:Ue.displayReloadKey,Ve=Re=>{let Mt=!1;return(Array.isArray(Re)?Re:[]).map(pt=>{const Lt=String((pt==null?void 0:pt.name)||""),pm=String((pt==null?void 0:pt.type)||"");return(J?Lt===Me||Lt==="result"||Lt==="filePath":Lt===Me||Lt==="filePath"||pm==="text")?Mt?{...pt,default:"",value:""}:(Mt=!0,{...pt,default:ve,value:ve}):pt})},Ke=g.current.map(Re=>{var Mt,Ge;return Re.id!==K?Re:{...Re,data:{...Re.data,body:J?Re.data.body:ve,...dt?{displayReloadKey:dt}:{},inputs:Ve((Mt=Re.data)==null?void 0:Mt.inputs),outputs:Ve((Ge=Re.data)==null?void 0:Ge.outputs)}}}),We=q.current||{},Fe=We[K]&&typeof We[K]=="object"?We[K]:{},Dt={...We,[K]:{...Fe,body:J?Fe.body:ve,input:Ve(Fe.input),output:Ve(Fe.output)}};q.current=Dt,h(Ke),_(Dt),Xt(Re=>(Re==null?void 0:Re.id)===K?{...Re,...J?{}:{body:ve}}:Re),(L==null?void 0:L.logChat)!==!1&&Ki(Re=>{var Mt;return{...Re,[K]:{...Re[K]||{},candidateContent:"",messages:[...(Mt=Re[K])!=null&&Mt.messages&&Array.isArray(Re[K].messages)?Re[K].messages:[],{role:"assistant",text:P==="append"?"已追加到当前节点内容。":"已替换当前节点内容。",at:Date.now()}]}}}),Wt(Ke,k.current).catch(Re=>ye(String(Re.message||Re))),ye(String((L==null?void 0:L.statusMessage)||"")||(P==="append"?"已追加节点内容":"已替换节点内容"))},[Wt,h,me]),Nd=m.useCallback(async(v,N="")=>{if(!me)return ye("Readonly workspace"),"";if(!v)return"";try{const P=new FormData;P.set("file",v),P.set("dir",String(N||"")),i.flowId&&P.set("flowId",i.flowId),i.flowSource&&P.set("flowSource",i.flowSource),i.archived&&P.set("archived","1");const L=await fetch("/api/workspace/upload",{method:"POST",body:P}),K=await L.json().catch(()=>({}));if(!L.ok)throw new Error(K.error||"上传文件失败");const Y=String(K.path||"").trim();if(!Y)throw new Error("上传文件失败:未返回路径");return await Pn(),xr(G=>{const J=new Set(G);for(const X of Sf(Y))J.delete(X);return J}),ye(`已上传 ${Y}`),Y}catch(P){return ye(String(P.message||P)),""}},[i,Pn,me]),jd=m.useCallback(async v=>Vp(v)?Nd(v,"img"):(ye("请选择图片文件"),""),[Nd]),Pk=m.useCallback((v="")=>{var N;if(!me){ye("Readonly workspace");return}os.current=String(v||""),(N=Kn.current)==null||N.click()},[me]),NT=m.useCallback(async v=>{const N=Array.from(v.target.files||[]);if(v.target.value="",!N.length)return;const P=os.current||"";Qt(!0);try{let L="";for(const K of N){const Y=await Nd(K,P);Y&&(L=Y)}N.length>1&&ye(`已上传 ${N.length} 个文件${L?`,最后一个:${L}`:""}`)}catch(L){ye(String(L.message||L))}finally{Qt(!1)}},[Nd]),Ik=m.useCallback(async(v,N)=>{const P=String(v||"").trim();if(!P)return;const L=await jd(N);L&&Kr(P,L,"replace",{logChat:!1,statusMessage:`已上传图片 ${L}`})},[Kr,jd]),Tk=m.useCallback((v,N="replace")=>{var K;const P=String(v||"").trim(),L=String(((K=hi[P])==null?void 0:K.candidateContent)||"").trim();!P||!L||Kr(P,L,N)},[hi,Kr]),Rk=m.useCallback(async(v,N=void 0)=>{var Ve,Ke;if(!me){ye("Readonly workspace");return}const P=String(v||"").trim();if(!P)return;const L=hi[P]||{},K=String(N!==void 0?N:L.draft||"").trim();if(!K||L.running)return;const Y=g.current.find(We=>We.id===P);if(!Y)return;const G=yn(Y.data)||"markdown",J=No(Y.data);let X=Sa(J,G),ae=Pi(J);if(X)try{ae=await Hl(i,X)}catch(We){ye(String(We.message||We))}else if(G!=="image"&&String(ae||"").trim()){const We=ta(G,ae);if(We){ye(`${We} 未进入微调。`);return}try{const Fe=await jx(i,lj(P,Y.data),ae);await Pn(),Kr(P,Fe,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已将展示保存为 ${Fe}`}),X=Fe,ae=""}catch(Fe){ye(String(Fe.message||Fe));return}}const de=v7(P,g.current,k.current),ve={role:"user",text:K,at:Date.now()},Me=Array.isArray(L.messages)?L.messages:[],dt=L.sessionId||`nodechat_${Date.now()}_${P.replace(/[^a-z0-9_-]+/gi,"_")}`;Ki(We=>({...We,[P]:{...L,sessionId:dt,messages:[...Me,ve],draft:"",running:!0,error:""}}));try{const We=await fetch("/api/workspace/node-chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,sessionId:dt,node:{id:P,label:((Ve=Y.data)==null?void 0:Ve.label)||P,definitionId:((Ke=Y.data)==null?void 0:Ke.definitionId)||""},nodeKind:G,currentContent:X?"":ae,sourceContext:de,targetFilePath:X,messages:Me,message:K,model:pi})}),Fe=await We.json().catch(()=>({}));if(!We.ok)throw new Error(Fe.error||"节点微调失败");const Dt=String(Fe.candidateContent||Fe.reply||"").trim(),Qe=!!Fe.directFileEdit,Ue=String(Fe.artifactPath||X||"").trim();if(Qe&&Ue){const Re=ta(G,Dt);if(Re)throw new Error(`${Re} 文件已由 agent 修改,请检查 ${Ue}。`);await Pn(),Kr(P,Ue,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已按微调描述更新 ${Ue}`})}else if(Dt){const Re=ta(G,Dt);if(Re)throw new Error(`${Re} 已取消写入,避免覆盖当前展示文件。`);if(X){const Mt=await jx(i,X,Dt);await Pn(),Kr(P,Mt,"replace",{logChat:!1,statusMessage:`已按微调描述更新 ${Mt}`})}else Kr(P,Dt,"replace",{logChat:!1,statusMessage:"已按微调描述更新展示内容"})}Ki(Re=>{var Mt;return{...Re,[P]:{...Re[P]||{},sessionId:String(Fe.sessionId||dt),running:!1,candidateContent:"",messages:[...(Mt=Re[P])!=null&&Mt.messages&&Array.isArray(Re[P].messages)?Re[P].messages:[...Me,ve],{role:"assistant",text:Dt||Qe?Ue?`已更新文件 ${Ue}。`:"已按你的描述更新当前展示。":"没有生成可更新的内容。",at:Date.now()}]}}})}catch(We){const Fe=String(We.message||We);Ki(Dt=>({...Dt,[P]:{...Dt[P]||{},running:!1,error:Fe}})),ye(Fe)}},[pi,i,Pn,hi,Kr,me]),Mk=m.useCallback(async(v,N)=>{if(!me){ye("Readonly workspace");return}const P=yn(N)||"markdown",L=No(N),K=Sa(L,P);let Y=Pi(L);if(K)try{Y=await Hl(i,K)}catch(ae){ye(String(ae.message||ae));return}if(!String(Y||"").trim()){ye("展示节点没有可保存内容");return}const G=ta(P,Y);if(G){ye(`${G} 未保存文件。`);return}const J=lj(v,N),X=window.prompt("保存到 workspace 相对路径",J);if(X)try{const ae=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:X,content:Y})}),de=await ae.json().catch(()=>({}));if(!ae.ok)throw new Error(de.error||"保存文件失败");const ve=de.path||X,Me=cs(i);Me.set("path",ve);const dt=await fetch(`/api/workspace/file?${Me.toString()}`);if(!dt.ok){const Ve=await dt.json().catch(()=>({}));throw new Error(Ve.error||`保存后读取失败:${ve}`)}await Pn(),je(Ve=>G7(Ve,ve,String(Y||"").length)),xr(Ve=>{const Ke=new Set(Ve);for(const We of Sf(ve))Ke.delete(We);return Ke}),Kr(v,ve,"replace",{logChat:!1,statusMessage:`已保存并引用 ${ve}`}),ye(`已保存 ${ve}`)}catch(ae){ye(String(ae.message||ae))}},[i,Pn,Kr,me]),$k=m.useCallback(v=>{var K,Y;const N=String(v||"").trim();if(!N||St)return;const P=g.current.find(G=>G.id===N);if(!P||!yn(P==null?void 0:P.data)){ye("展示节点不可用");return}const L=String(((K=P.data)==null?void 0:K.label)||((Y=P.data)==null?void 0:Y.displayName)||N).trim()||"AgentFlow Display";ut(jg({title:L,layout:"single",nodeIds:[N],mode:"single-node",sourceNodeId:N})),Z(""),$e(null),Ze(!0)},[St]),Cd=m.useCallback((v,N)=>{const P=String(v||"");P&&Xt(L=>{if(!L||L.id!==P)return L;const K=typeof N=="function"?N(L):N;return!K||typeof K!="object"?L:{...L,...K}})},[]),Lk=m.useCallback((v,N)=>{const P=String(v||"");!P||!me||(h(L=>L.map(K=>{var G;if(K.id!==P)return K;const Y=Array.isArray((G=K.data)==null?void 0:G.outputs)&&K.data.outputs.length?K.data.outputs.map((J,X)=>X===0?{...J,default:N,value:N}:J):[{type:"file",name:"value",default:N,value:N}];return{...K,data:{...K.data,body:"",outputs:Y}}})),Cd(P,L=>({body:"",outputs:Array.isArray(L==null?void 0:L.outputs)&&L.outputs.length?L.outputs.map((Y,G)=>G===0?{...Y,default:N,value:N}:Y):[{type:"file",name:"value",default:N,value:N}]})),ye(`已选择文件 ${N}`))},[h,Cd,me]),Ok=m.useCallback(v=>{Ae({nodeId:String(v||""),query:""})},[]),im=m.useCallback(()=>{Ae({nodeId:"",query:""})},[]),jT=m.useCallback(v=>{const N=String((v==null?void 0:v.path)||"").trim();!N||!Te.nodeId||(Lk(Te.nodeId,N),im())},[im,Te.nodeId,Lk]),Dk=m.useCallback(async(v,N)=>{if(!me)return;const P=F7(v,N);if(P.length===0)return;const L=[];try{for(const K of P){const Y=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:K})});if(Y.status===404)continue;const G=await Y.json().catch(()=>({}));if(!Y.ok)throw new Error(G.error||"清理节点输出失败");L.push(G.path||K)}if(L.length===0)return;ye(`已清理 ${L.join(", ")}`),await Pn(),fe(K=>P.some(Y=>K===Y||K.startsWith(`${Y}/`))?"":K)}catch(K){ye(String(K.message||K))}},[i,Pn,me]),ks=m.useMemo(()=>d.map(v=>{var N,P;return{...v,data:{...v.data,selected:v.selected===!0,modelLists:Lo,showBodyPreview:!0,isExecuting:lk.has(v.id),nodeStatus:((N=rm[v.id])==null?void 0:N.status)??null,nodeElapsed:((P=rm[v.id])==null?void 0:P.elapsed)??null,flowParams:i,readOnly:!me,onRunWorkspaceNode:bk,onStopWorkspaceNode:xk,onOpenWorkspaceRunLogs:yk,onOptimizeWorkspaceRun:sm,onOptimizeWorkspaceSchedule:sm,optimizingRun:ck===v.id,runningRunNodeIds:pk,scheduledRunState:ak[v.id]||null,onChangeScheduledRunConfig:_k,onChangeContextRunConfig:Ck,skills:ws,skillCollections:Ea,onChangeLoadSkillKeys:Sk,onRefreshSkills:kd,mcpServers:Wb,onChangeLoadMcpNames:Nk,onRefreshMcps:vd,workspaceTargets:Kb,onChangeLoadWorkspace:jk,onRefreshWorkspaces:Sd,onSaveDisplayNodeToFile:Mk,onShareDisplayNode:$k,onOpenDisplayPreview:se,onRefreshNodeInternals:Hi,onEnsureWorkspaceNodeDisplaySize:Yb,sharingDisplayNodeId:St,onUploadWorkspaceImage:jd,onUploadImageToDisplayNode:Ik,onOpenProvideFilePicker:Ok,onStatus:ye,nodeChatActive:Zb===v.id,nodeChat:hi[v.id]||null,onSetDisplayNodeContent:Kr,onToggleNodeChat:Ek,onCloseNodeChat:()=>ek(""),onUpdateNodeChatDraft:Ak,onSendNodeChat:Rk,onApplyNodeChatCandidate:Tk,onSyncNodePropDraft:Cd,onCleanupWorkspaceNodeOutputs:Dk}}}),[Zb,Tk,Ck,Nk,Sk,jk,_k,Dk,Yb,i,Wb,Lo,hi,d,Ok,yk,sm,ck,vd,Hi,kd,Sd,bk,pk,Mk,ak,Rk,Kr,$k,St,Ea,ws,xk,Cd,Ek,Ak,Ik,jd,lk,rm,Kb,me]),om=m.useMemo(()=>new Map(ks.map(v=>[v.id,v])),[ks]),Fk=Jt?om.get(Jt):null,cc=m.useMemo(()=>{const v=new Set(W);return S.nodeIds.map((N,P)=>{const L=om.get(N);if(!L||!yn(L.data))return null;const K=Ja(L)||{width:520,height:320},Y=aa(S.nodeSizes[N]||K,{display:!0})||K,G=S.nodePositions[N]||{x:180+P*36,y:120+P*28};return{...L,id:tj(N),position:G,selected:v.has(N),width:Y.width,height:Y.height,data:{...L.data,sourceNodeId:N,displayPageMode:!0,readOnly:!0,selected:v.has(N),displaySize:Y,nodeSize:Y}}}).filter(Boolean)},[S,om,W]),Oa=m.useMemo(()=>ks.filter(v=>yn(v==null?void 0:v.data)),[ks]),ct=a==="display";m.useEffect(()=>{if(!ct||!S.viewport)return;const v=S.viewport,N=()=>{try{r.setViewport(v,{duration:0})}catch{}},P=window.requestAnimationFrame(()=>window.requestAnimationFrame(N));return()=>window.cancelAnimationFrame(P)},[S.viewport,ct,r]),m.useEffect(()=>{if(ct||!E)return;const v=E,N=()=>{try{r.setViewport(v,{duration:0})}catch{}},P=window.requestAnimationFrame(()=>window.requestAnimationFrame(N));return()=>window.cancelAnimationFrame(P)},[ct,r,E]),m.useEffect(()=>{const v=R.current,N=new Map,P=[];for(const G of[...ks,...cc]){const J=d7(G);N.set(G.id,J),v.get(G.id)!==J&&P.push(G.id)}if(R.current=N,P.length===0)return;const L=()=>P.forEach(G=>s(G)),K=window.requestAnimationFrame(L),Y=window.setTimeout(L,80);return()=>{window.cancelAnimationFrame(K),window.clearTimeout(Y)}},[cc,ks,s]);const Yt=m.useMemo(()=>d.find(v=>v.id===jt)||null,[d,jt]),am=m.useRef({id:"",draft:null}),CT=m.useMemo(()=>{const v=hj(Yt);return v?JSON.stringify(v):""},[Yt]);m.useEffect(()=>{if(!Yt){am.current={id:"",draft:null},Xt(null),ar("");return}const v=hj(Yt),N=am.current;am.current={id:Yt.id,draft:v},Xt(P=>!P||P.id!==Yt.id||N.id!==Yt.id||!N.draft?v:lU(P,N.draft,v)),ar("")},[Yt==null?void 0:Yt.id,CT]);const lm=m.useCallback((v=!1)=>{if(!we||!Yt)return!1;if(!me)return ar("Readonly workspace"),ye("Readonly workspace"),!1;ar("");const N=yj({nodes:d,edges:y,instances:q.current,selectedNode:Yt,draft:we,allowRename:v});return N!=null&&N.error?(ar(N.error),!1):(!(N!=null&&N.ok)||!N.changed||(q.current=N.instances,_(N.instances),h(N.nodes),w(N.edges),N.nextId!==Yt.id&>(N.nextId),Hi(N.nextId)),!0)},[y,we,d,Yt,w,h,Hi,me]);m.useEffect(()=>{if(!me||!we||!Yt)return;const v=window.setTimeout(()=>{lm(!1)},350);return()=>window.clearTimeout(v)},[we==null?void 0:we.label,we==null?void 0:we.role,we==null?void 0:we.model,we==null?void 0:we.body,JSON.stringify((we==null?void 0:we.images)||[]),we==null?void 0:we.script,we==null?void 0:we.scriptRef,we==null?void 0:we.implementationRef,we==null?void 0:we.implementationMode,JSON.stringify((we==null?void 0:we.inputs)||[]),JSON.stringify((we==null?void 0:we.outputs)||[]),lm,Yt==null?void 0:Yt.id,me]);const _T=m.useMemo(()=>{const v=new Map(ks.map(N=>[N.id,N]));return y.map(N=>{var ae,de,ve,Me;const P=v.get(N.source),L=v.get(N.target),K=/^output-(\d+)$/.exec(N.sourceHandle||""),Y=/^input-(\d+)$/.exec(N.targetHandle||""),G=P&&K?(de=(ae=P.data)==null?void 0:ae.outputs)==null?void 0:de[parseInt(K[1],10)]:null,J=L&&Y?(Me=(ve=L.data)==null?void 0:ve.inputs)==null?void 0:Me[parseInt(Y[1],10)]:null,X=G!=null&&G.type?wn(G.type):J!=null&&J.type?wn(J.type):"";return X?{...N,style:{...N.style||{},stroke:X,strokeWidth:2},markerEnd:{type:Qs.ArrowClosed,color:X}}:N})},[y,ks]),ET=ct?cc:ks,AT=ct?[]:_T,PT=m.useMemo(()=>ct?cc.map(v=>({...v,id:Sg(v.id)})):ks,[cc,ks,ct]),IT=m.useCallback(v=>{const N=String(v||"").trim();if(!N)return;const P=ct?tj(N):N;ct?H([N]):(h(K=>K.map(Y=>({...Y,selected:Y.id===P}))),w(K=>K.map(Y=>({...Y,selected:!1}))),gt(P));const L=()=>{var ae,de,ve;const K=r.getNode(P);if(!K)return;const Y=(ae=r.getInternalNode)==null?void 0:ae.call(r,P),G=((de=Y==null?void 0:Y.measured)==null?void 0:de.width)??(Y==null?void 0:Y.width)??K.width??260,J=((ve=Y==null?void 0:Y.measured)==null?void 0:ve.height)??(Y==null?void 0:Y.height)??K.height??120,{zoom:X}=r.getViewport();r.setCenter(K.position.x+G/2,K.position.y+J/2,{zoom:x7(X),duration:240})};window.requestAnimationFrame(()=>window.requestAnimationFrame(L))},[ct,r,w,h]),zk=m.useCallback(()=>{const v=r.getViewport(),N={x:Number(v.x)||0,y:Number(v.y)||0,zoom:Math.min(Math.max(Number(v.zoom)||1,.1),4)};if(ct){const P={...j.current,viewport:N};j.current=P,C(P),ye("已固定 Display 进入视角")}else O.current=N,A(N),ye("已固定 Workspace 进入视角");Wt(g.current,k.current).catch(P=>ye(String(P.message||P)))},[ct,r,Wt]),cm=m.useMemo(()=>{const v=ne.trim().toLowerCase(),N={DISPLAY:[],CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const P of ie)v&&![P.id,P.label,P.displayName,P.description].some(L=>String(L||"").toLowerCase().includes(v))||N[Bc(P)].push(P);for(const P of Ya)N[P].sort((L,K)=>L.id.localeCompare(K.id));return N},[ie,ne]),uc=m.useMemo(()=>{const v=gn.trim().toLowerCase();return ie.filter(N=>!v||[N.id,N.label,N.displayName,N.description].some(P=>String(P||"").toLowerCase().includes(v))).sort((N,P)=>{const L=Ya.indexOf(Bc(N)),K=Ya.indexOf(Bc(P));return L!==K?L-K:Hc(N).localeCompare(Hc(P))}).slice(0,30)},[ie,gn]),dc=m.useMemo(()=>{const v=gn.trim().toLowerCase();return ue.filter(N=>!v||[N.id,N.version,N.displayName,N.name,N.description,...Array.isArray(N.tags)?N.tags:[]].some(P=>String(P||"").toLowerCase().includes(v))).sort((N,P)=>String(N.displayName||N.name||N.id).localeCompare(String(P.displayName||P.name||P.id))).slice(0,30)},[ue,gn]);m.useEffect(()=>{ot(0)},[gn,Ne,mt]),m.useEffect(()=>{if(!Ne)return;const v=window.setTimeout(()=>{var N;return(N=Xb.current)==null?void 0:N.focus()},0);return()=>window.clearTimeout(v)},[Ne]);const TT=m.useMemo(()=>{const v=Wr.trim().toLowerCase();return v?Nb(ee).filter(N=>N.path.toLowerCase().includes(v)):ee},[Wr,ee]),Ho=m.useMemo(()=>iI(ee,U),[ee,U]),gi=(Ho==null?void 0:Ho.type)==="directory"?Ho.path:U7((Ho==null?void 0:Ho.path)||""),RT=m.useCallback(v=>{var N,P;(P=(N=v.target)==null?void 0:N.closest)!=null&&P.call(N,".af-work-file")||fe("")},[]),MT=[...(Lo.cursor||[]).map(v=>({label:`Cursor · ${v.split(" - ")[0]}`,value:`cursor:${v.split(" - ")[0]}`})),...(Lo.opencode||[]).map(v=>({label:`OpenCode · ${v.split(" - ")[0]}`,value:`opencode:${v.split(" - ")[0]}`})),...(Lo.claudeCode||[]).map(v=>({label:`Claude · ${v.split(" - ")[0]}`,value:`claude-code:${v.split(" - ")[0]}`})),...(Lo.codex||[]).map(v=>({label:`Codex · ${v.split(" - ")[0]}`,value:`codex:${v.split(" - ")[0]}`}))],um=m.useMemo(()=>new Set(bs),[bs]),Da=m.useMemo(()=>{const v=new Map(ws.map(Y=>[Y.key,Y])),N=new Set,P=new Set,L=Ea.map(Y=>{const G=ha(Y,ws).map(J=>v.get(J)).filter(Boolean);for(const J of G)N.add(J.key),P.add(String(J.name||J.id||J.key||"").trim());return{...Y,skills:G}}).filter(Y=>Y.skills.length>0),K=ws.filter(Y=>{const G=String(Y.name||Y.id||Y.key||"").trim();return!N.has(Y.key)&&!P.has(G)});return{groups:L,ungrouped:K}},[Ea,ws]);m.useEffect(()=>{Gb(v=>{let N=!1;const P=new Set(v);for(const L of Da.groups)P.has(L.id)||(P.add(L.id),N=!0);return N?P:v})},[Da.groups]);const Hn=m.useMemo(()=>{const v=d.filter(N=>N.selected);return v.length>0?v:jt?d.filter(N=>N.id===jt):[]},[d,jt]),_d=m.useMemo(()=>Hn.map(v=>v.id),[Hn]),Bk=m.useCallback(()=>{if(ct)return;if(!me){ye("Readonly workspace");return}const v=(g.current||[]).filter(J=>(J==null?void 0:J.selected)&&!lu(J));if(v.length<2){ye("选择至少两个节点后按 G 创建 Group");return}const N=v.reduce((J,X)=>{var dt,Ve,Ke,We,Fe,Dt,Qe,Ue,Re,Mt,Ge,pt;const ae=Number(((dt=X.position)==null?void 0:dt.x)||0),de=Number(((Ve=X.position)==null?void 0:Ve.y)||0),ve=Number(((Ke=X.measured)==null?void 0:Ke.width)||X.width||((Fe=(We=X.data)==null?void 0:We.nodeSize)==null?void 0:Fe.width)||((Qe=(Dt=X.data)==null?void 0:Dt.displaySize)==null?void 0:Qe.width)||FP),Me=Number(((Ue=X.measured)==null?void 0:Ue.height)||X.height||((Mt=(Re=X.data)==null?void 0:Re.nodeSize)==null?void 0:Mt.height)||((pt=(Ge=X.data)==null?void 0:Ge.displaySize)==null?void 0:pt.height)||Wp);return{minX:Math.min(J.minX,ae),minY:Math.min(J.minY,de),maxX:Math.max(J.maxX,ae+ve),maxY:Math.max(J.maxY,de+Me)}},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});if(!Number.isFinite(N.minX)||!Number.isFinite(N.minY))return;const P=new Set((g.current||[]).map(J=>J.id));let L=1,K=`group_${L}`;for(;P.has(K);)L+=1,K=`group_${L}`;const Y=Sx({width:N.maxX-N.minX+wf*2,height:N.maxY-N.minY+wf*2})||{width:ba,height:ka},G={id:K,type:Nl,position:{x:N.minX-wf,y:N.minY-wf},width:Y.width,height:Y.height,selected:!0,draggable:!0,selectable:!0,zIndex:0,data:{isWorkspaceGroup:!0,label:Up(L-1),title:Up(L-1),color:"purple",nodeSize:Y}};h(J=>[G,...J.map(X=>({...X,selected:!1}))]),w(J=>J.map(X=>({...X,selected:!1}))),gt(""),ye(`Created group for ${v.length} nodes`)},[ct,w,h,me]),fc=m.useMemo(()=>d.filter(v=>yn(v==null?void 0:v.data)),[d]),dm=m.useMemo(()=>Hn.filter(v=>yn(v==null?void 0:v.data)).map(v=>v.id),[Hn]),$T=m.useMemo(()=>{const v=String((wr==null?void 0:wr.username)||(wr==null?void 0:wr.userId)||"").trim();return v?v.slice(0,1).toUpperCase():"?"},[wr]),fm=m.useMemo(()=>new Set(_d),[_d]),Ed=m.useMemo(()=>y.filter(v=>fm.has(v.source)&&fm.has(v.target)),[y,fm]),Hk=m.useCallback(v=>{const N=v==="display"?"display":"workspace";l(N),gt(""),H([]),I(null),et(!1),vn(!1);const P=cs(i);N==="display"&&P.set("view","display");const L=`/workspace${P.toString()?`?${P.toString()}`:""}`;window.history.pushState({},"",L)},[i]),Wk=m.useCallback(v=>{const N=String(v||"").trim();if(!N)return;const P=g.current.find(L=>L.id===N);if(!P||!yn(P.data)){ye("展示节点不可用");return}C(L=>{if(L.nodeIds.includes(N))return L;const K=L.nodeIds.length,Y=Ja(P);return{nodeIds:[...L.nodeIds,N],nodePositions:{...L.nodePositions,[N]:{x:180+K*36,y:120+K*28}},nodeSizes:{...L.nodeSizes,...Y?{[N]:Y}:{}}}}),H([N])},[]),Vk=m.useCallback(v=>{const N=String(v||"").trim();N&&(C(P=>{const L=P.nodeIds.filter(G=>G!==N),K={...P.nodePositions},Y={...P.nodeSizes};return delete K[N],delete Y[N],{nodeIds:L,nodePositions:K,nodeSizes:Y}}),H(P=>P.filter(L=>L!==N)))},[]),Kk=m.useCallback(v=>{const N=String(v||"").trim();N&&(j.current.nodeIds.includes(N)?Vk(N):Wk(N))},[Wk,Vk]),Ad=m.useMemo(()=>{const v=zn.trim().toLowerCase();return v?Oa.filter(N=>{var P,L;return[N.id,(P=N.data)==null?void 0:P.label,(L=N.data)==null?void 0:L.definitionId].filter(Boolean).some(K=>String(K).toLowerCase().includes(v))}):Oa},[Oa,zn]),Uk=m.useMemo(()=>{const v=Ad.length,N=v<=1?1:v<=4?2:3,P=Array.from({length:N},()=>({height:0,nodes:[]}));for(const L of Ad){const K=Ja(L)||{width:420,height:260},Y=Math.max(1,Number(K.width)||420),G=Math.max(1,Number(K.height)||260),J=Math.min(26,Math.max(5.5,G/Y*16))+3.2;let X=P[0];for(const ae of P)ae.height<X.height&&(X=ae);X.nodes.push(L),X.height+=J}return P.map(L=>L.nodes)},[Ad]),LT=m.useCallback(v=>{var Y;const N=S.nodeIds.includes(v.id),P=Ja(v)||{width:420,height:260},L=Math.max(1,Math.round(Number(P.width)||420)),K=Math.max(1,Math.round(Number(P.height)||260));return o.jsxs("button",{type:"button",className:"af-display-picker-card"+(N?" af-display-picker-card--selected":""),style:{"--af-display-picker-card-ratio":`${L} / ${K}`},onClick:()=>Kk(v.id),children:[o.jsx("span",{className:"af-display-picker-card__check","aria-hidden":!0,children:o.jsx("input",{type:"checkbox",checked:N,readOnly:!0,tabIndex:-1})}),o.jsx("span",{className:"af-display-picker-card__preview",children:o.jsx(R7,{node:v})}),o.jsxs("span",{className:"af-display-picker-card__meta",children:[o.jsx("strong",{children:((Y=v.data)==null?void 0:Y.label)||v.id}),o.jsxs("small",{children:[yn(v.data)," · ",v.id]})]})]},v.id)},[S.nodeIds,Kk]),qk=m.useMemo(()=>{const v=ne.trim().toLowerCase();return v?ue.filter(N=>[N.id,N.version,N.displayName,N.name,N.description,...Array.isArray(N.tags)?N.tags:[]].filter(Boolean).some(P=>String(P).toLowerCase().includes(v))):ue},[ue,ne]),Yk=m.useCallback((v,N)=>{const P=String(v||"snippet_node").trim().replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"snippet_node";let L=`${P}_${Date.now().toString(36)}`,K=2;for(;N.has(L);)L=`${P}_${Date.now().toString(36)}_${K}`,K+=1;return N.add(L),L},[]),pc=m.useCallback((v,N)=>{var Re,Mt;if(!me){ye("Readonly workspace");return}const P=v!=null&&v.snippet&&typeof v.snippet=="object"?v.snippet:{},L=P.instances&&typeof P.instances=="object"?P.instances:{},K=Object.keys(L);if(K.length===0)return;const Y=new Set(g.current.map(Ge=>Ge.id)),G={};for(const Ge of K)G[Ge]=Yk(Ge,Y);const J=(Re=P.ui)!=null&&Re.nodePositions&&typeof P.ui.nodePositions=="object"?P.ui.nodePositions:{},X=(Mt=P.ui)!=null&&Mt.nodeSizes&&typeof P.ui.nodeSizes=="object"?P.ui.nodeSizes:{},ae=K.map(Ge=>{const pt=J[Ge];return{id:Ge,x:typeof(pt==null?void 0:pt.x)=="number"?pt.x:0,y:typeof(pt==null?void 0:pt.y)=="number"?pt.y:0}}),de=Math.min(...ae.map(Ge=>Ge.x)),ve=Math.min(...ae.map(Ge=>Ge.y));let Me=N||{x:360+g.current.length*24,y:180+g.current.length*18};if(!N){const Ge=document.querySelector(".af-workspace-canvas .react-flow");if(Ge){const pt=Ge.getBoundingClientRect();Me=r.screenToFlowPosition({x:pt.left+pt.width*.48,y:pt.top+pt.height*.32})}}const dt={},Ve={},Ke={};for(const Ge of ae){const pt=G[Ge.id];dt[pt]={...L[Ge.id]||{}},Ve[pt]={x:Me.x+(Ge.x-de),y:Me.y+(Ge.y-ve)};const Lt=X[Ge.id];typeof(Lt==null?void 0:Lt.width)=="number"&&typeof(Lt==null?void 0:Lt.height)=="number"&&(Ke[pt]={width:Lt.width,height:Lt.height})}const We=new Set(K),Fe=(Array.isArray(P.edges)?P.edges:[]).filter(Ge=>We.has(Ge==null?void 0:Ge.source)&&We.has(Ge==null?void 0:Ge.target)).map(Ge=>({source:G[Ge.source],target:G[Ge.target],sourceHandle:Ge.sourceHandle??null,targetHandle:Ge.targetHandle??null})),Dt=vf({instances:dt,edges:Fe,ui:{nodePositions:Ve,nodeSizes:Ke}},ie),Qe=Dt.nodes.map(Ge=>Ge.id),Ue=Dt.nodes.map(Ge=>({...Ge,selected:!0}));q.current={...q.current,...Dt.instances},_(q.current),h(Ge=>[...Ge.map(pt=>({...pt,selected:!1})),...Ue]),w(Ge=>[...Ge.map(pt=>({...pt,selected:!1})),...Dt.edges.map(pt=>({...pt,selected:!1}))]),gt(""),H([]),ye(`已添加流程片段:${v.displayName||v.id}(已选中 ${Qe.length} 个节点)`)},[Yk,ie,r,w,h,me]),OT=m.useCallback(()=>{var P,L;if(Hn.length<2){Je("请先在 workspace 画布上选择至少两个节点。"),le("flows");return}const v=Hn[0],N=Hn.length===2?`${((P=v.data)==null?void 0:P.label)||v.id} 片段`:`${((L=v.data)==null?void 0:L.label)||v.id} 等 ${Hn.length} 个节点`;rt({name:N,id:N.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),tt(""),bt(!0),le("flows")},[Hn]),DT=m.useCallback(async()=>{var K,Y;if(Hn.length<2)return;const v=Pe.name.trim();if(!v){tt("请填写片段名称。");return}const N={},P={};for(const G of Hn){N[G.id]={x:((K=G.position)==null?void 0:K.x)||0,y:((Y=G.position)==null?void 0:Y.y)||0};const J=Ja(G);J&&(P[G.id]=J)}const L=Ed.map(G=>({source:G.source,target:G.target,sourceHandle:G.sourceHandle??null,targetHandle:G.targetHandle??null}));zt(!0),tt("");try{const G=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:Pe.id,name:v,displayName:v,version:"1.0.0",description:Pe.description,snippet:{instances:yb(Hn,q.current),edges:L,ui:{nodePositions:N,nodeSizes:P}}})}),J=await G.json().catch(()=>({}));if(!G.ok||J.ok===!1)throw new Error(J.error||"发布流程片段失败");bt(!1),ye(`流程片段已发布:${J.id||v}`),qb(`流程片段已发布:${J.id||v}`),await wd(),le("flows")}catch(G){tt(String(G.message||G))}finally{zt(!1)}},[wd,Pe,Ed,Hn,qb]);m.useCallback(()=>{if(fc.length===0){ye("当前 workspace 没有 display 节点");return}const v=dm.length>0?dm:fc.map(P=>P.id),N=i.flowId?`${i.flowId} 展示页`:"AgentFlow Display";ut(jg({title:N,layout:"gallery",nodeIds:v,mode:"multi-node"})),Z(""),$e(null),Ze(!0)},[i.flowId,dm,fc]);const FT=m.useCallback(v=>{ut(N=>{const P=Array.isArray(N.nodeIds)?N.nodeIds:[];return P.includes(v)?{...N,nodeIds:P.filter(L=>L!==v)}:{...N,nodeIds:[...P,v]}})},[]),vs=m.useCallback(async()=>{Hr(!0),An("");try{const v=await fetch("/api/display/shares"),N=await v.json().catch(()=>({}));if(!v.ok)throw new Error(N.error||"读取分享列表失败");Dn(Array.isArray(N.shares)?N.shares:[])}catch(v){An(String(v.message||v)),Dn([])}finally{Hr(!1)}},[]),zT=m.useCallback(()=>{mr(!0),Fn(""),vs()},[vs]),BT=m.useCallback(async()=>{var P,L;const v=Ee.title.trim(),N=Array.isArray(Ee.nodeIds)?Ee.nodeIds:[];if(N.length===0){Z("请选择至少一个 display 节点。");return}Bt(!0),Z(""),$e(null);try{await Wt(d,y);const K=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,title:v,layout:Ee.layout,nodeIds:N,...rj(Ee)})}),Y=await K.json().catch(()=>({}));if(!K.ok||Y.ok===!1)throw new Error(Y.error||"发布展示页失败");const G=new URL(Y.url||`/display/${((P=Y.share)==null?void 0:P.id)||""}`,window.location.origin).href;$e({...Y,absoluteUrl:G}),ye((L=Y.share)!=null&&L.expiresAt?"展示页已生成":"展示页已生成:永久有效"),_n&&vs()}catch(K){Z(String(K.message||K))}finally{Bt(!1)}},[Ee,_n,y,i,vs,d,Wt]),HT=m.useCallback(async()=>{var N,P;const v=Array.isArray(S.nodeIds)?S.nodeIds:[];if(v.length===0){Z("请先添加至少一个展示节点。"),ye("请先添加至少一个展示节点"),vn(!0);return}Bt(!0),Z("");try{await Wt(d,y);const L=i.flowId?`${i.flowId} 展示页`:"AgentFlow Display",K=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,title:L,layout:"canvas",nodeIds:v,...rj(Ee)})}),Y=await K.json().catch(()=>({}));if(!K.ok||Y.ok===!1)throw new Error(Y.error||"生成展示链接失败");const G=new URL(Y.url||`/display/${((N=Y.share)==null?void 0:N.id)||""}`,window.location.origin).href;$e({...Y,absoluteUrl:G}),Xn(!0),ye((P=Y.share)!=null&&P.expiresAt?"展示链接已生成":"展示链接已生成:永久有效"),_n&&vs()}catch(L){const K=String(L.message||L);Z(K),ye(K)}finally{Bt(!1)}},[S.nodeIds,Ee,_n,y,i,vs,d,Wt]),Gk=m.useCallback(async()=>{const v=xe==null?void 0:xe.absoluteUrl;if(!v)return;const N=await ij(v);Cn(N?"copied":"failed"),window.setTimeout(()=>Cn(""),1600)},[xe==null?void 0:xe.absoluteUrl]),WT=m.useCallback(async v=>{const N=sj(v),P=await ij(N);Fn(P?String((v==null?void 0:v.id)||""):"failed"),window.setTimeout(()=>Fn(""),1600)},[]),VT=m.useCallback(async(v,N)=>{const P=String((v==null?void 0:v.id)||"");if(P){or(P),An("");try{const L=N==="permanent"?{id:P,expiresMode:"permanent",permanent:!0}:{id:P,expiresMode:"days",expiresInDays:Number(N||30)},K=await fetch("/api/display/share",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(L)}),Y=await K.json().catch(()=>({}));if(!K.ok||Y.ok===!1)throw new Error(Y.error||"更新分享有效期失败");await vs(),ye("分享有效期已更新")}catch(L){An(String(L.message||L))}finally{or("")}}},[vs]),KT=m.useCallback(async v=>{const N=String((v==null?void 0:v.id)||"");if(N){or(N),An("");try{const P=await fetch(`/api/display/share?id=${encodeURIComponent(N)}`,{method:"DELETE"}),L=await P.json().catch(()=>({}));if(!P.ok||L.ok===!1)throw new Error(L.error||"撤销分享失败");await vs(),ye("分享已撤销")}catch(P){An(String(P.message||P))}finally{or("")}}},[vs]),UT=m.useCallback(v=>{h(N=>N.map(P=>P.id===v?{...P,selected:!1}:P)),gt(N=>N===v?"":N)},[h]),Fa=m.useCallback(()=>{const v=Jh.current;if(!v)return;const N=v.getBoundingClientRect(),P=Math.min(420,Math.max(320,N.width+160)),L=12,K=Math.max(180,N.top-L*2),Y=Math.min(560,K);mT({position:"fixed",left:Math.max(12,Math.min(window.innerWidth-P-12,N.left)),top:Math.max(L,N.top-Y-L),width:P,maxHeight:Y,zIndex:1e4})},[]);m.useEffect(()=>{if(!md)return;Fa();const v=P=>{var K,Y;const L=P.target;(K=Jh.current)!=null&&K.contains(L)||(Y=Jb.current)!=null&&Y.contains(L)||Gh(!1)},N=P=>{P.key==="Escape"&&Gh(!1)};return window.addEventListener("pointerdown",v),window.addEventListener("keydown",N),window.addEventListener("resize",Fa),window.addEventListener("scroll",Fa,!0),()=>{window.removeEventListener("pointerdown",v),window.removeEventListener("keydown",N),window.removeEventListener("resize",Fa),window.removeEventListener("scroll",Fa,!0)}},[md,Fa]);const qT=m.useCallback(v=>{var L,K;if(a==="display"){const Y=[];let G=!1;C(J=>{var de,ve;const X={...J.nodePositions},ae={...J.nodeSizes};for(const Me of v||[]){const dt=Sg(Me==null?void 0:Me.id);if(!(!dt||!J.nodeIds.includes(dt))){if(Me.type==="select"){Me.selected&&Y.push(dt);continue}if(Me.type==="position"&&Me.position){X[dt]={x:Me.position.x,y:Me.position.y},G=!0;continue}if(Me.type==="dimensions"&&((de=Me.dimensions)!=null&&de.width)&&((ve=Me.dimensions)!=null&&ve.height)){const Ve=aa({width:Math.round(Number(Me.dimensions.width)),height:Math.round(Number(Me.dimensions.height))},{display:!0});Ve&&(ae[dt]=Ve,G=!0)}}}return G?{...J,nodePositions:X,nodeSizes:ae}:J}),(v||[]).some(J=>(J==null?void 0:J.type)==="select")&&H(Y);return}if(!me){const Y=(v||[]).filter(G=>(G==null?void 0:G.type)==="select");Y.length>0&&h(G=>Op(Y,G));return}const N=new Map;for(const Y of v||[])if((Y==null?void 0:Y.type)==="dimensions"&&((L=Y.dimensions)!=null&&L.width)&&((K=Y.dimensions)!=null&&K.height)){const G=d.find(ve=>ve.id===Y.id),J=lu(G),X=!!yn(G==null?void 0:G.data),ae={width:Math.round(Number(Y.dimensions.width)),height:Math.round(Number(Y.dimensions.height))},de=J?Sx(ae):aa(ae,{display:X});de&&N.set(Y.id,de)}const P=Array.from(N.keys());if(h(Y=>Op(v,Y).map(G=>{const J=N.get(G.id);return J?lu(G)?{...G,width:J.width,height:J.height,data:{...G.data,nodeSize:J}}:yn(G.data)?{...G,width:J.width,height:J.height,data:{...G.data,nodeSize:J,displaySize:J}}:{...G,width:J.width,height:J.height,data:{...G.data,nodeSize:J}}:G})),P.length>0){const Y=()=>P.forEach(G=>s(G));window.requestAnimationFrame(Y),window.setTimeout(Y,80)}},[d,h,s,a,me]),YT=m.useCallback(v=>{if(a!=="display"){if(!me){const N=(v||[]).filter(P=>(P==null?void 0:P.type)==="select");N.length>0&&w(P=>qw(N,P));return}b(v)}},[b,w,a,me]),za=m.useCallback(()=>{const v=document.querySelector(".af-workspace-canvas .react-flow");if(v){const N=v.getBoundingClientRect();return r.screenToFlowPosition({x:N.left+N.width*.48,y:N.top+N.height*.32})}return{x:360+d.length*36,y:180+d.length*28}},[d.length,r]),Pd=m.useCallback(()=>{var v,N,P;if(Yt){const L=Number(((v=Yt.measured)==null?void 0:v.width)||Yt.width||260);return{x:Number(((N=Yt.position)==null?void 0:N.x)||0)+L+140,y:Number(((P=Yt.position)==null?void 0:P.y)||0)}}return za()},[za,Yt]),yi=m.useCallback((v,N={})=>{if(!me)return ye("Readonly workspace"),null;if(!v)return null;const P=kb(v)||v.id,L=KP(v),K=qP(v),Y=N.id||n7(P,d),G=Vc(v.inputs),J=Vc(v.outputs),X={definitionId:P,...L?{marketplaceRef:L}:{},...v.packageId?{marketplacePackageId:v.packageId}:{},...v.version?{marketplaceVersion:v.version}:{},label:N.label||Kp(v),role:"normal",body:N.body||"",...N.script||K?{script:N.script||K}:{},...N.scriptRef?{scriptRef:N.scriptRef}:{},...N.implementationRef?{implementationRef:N.implementationRef}:{},...N.implementationMode?{implementationMode:N.implementationMode}:{},input:N.inputs||G,output:N.outputs||J},ae={id:Y,type:Nl,position:N.position||za(),data:{label:X.label,definitionId:P,...L?{marketplaceRef:L}:{},...v.packageId?{marketplacePackageId:v.packageId}:{},...v.version?{marketplaceVersion:v.version}:{},schemaType:VP(P,v),role:"normal",body:X.body,...X.script?{script:X.script}:{},...X.scriptRef?{scriptRef:X.scriptRef}:{},...X.implementationRef?{implementationRef:X.implementationRef}:{},...X.implementationMode?{implementationMode:X.implementationMode}:{},inputs:X.input,outputs:X.output}},de={...xx(ae,{...q.current,[Y]:X},ie),selected:!0};return h(ve=>[...ve.map(Me=>({...Me,selected:!1})),de]),N.openProperties&>(Y),Y},[za,d,ie,h,me]),GT=m.useCallback(v=>vg(v,g.current),[]),JT=m.useCallback(v=>{if(!me){ye("Readonly workspace");return}if(!vg(v,g.current)){ye("端口类型不匹配,已取消连线");return}I(null),h(N=>yg(N,v)),w(N=>{const P=N.filter(L=>!(L.target===v.target&&L.targetHandle===v.targetHandle));return Xf({...v,markerEnd:{type:Qs.ArrowClosed}},P)})},[w,h,me]),XT=m.useCallback((v,N)=>{if(!me)return;const P=ZK(N,g.current);V.current=P?{...P,preferExisting:!!(v!=null&&v.shiftKey)}:null,I(null)},[me]),QT=m.useCallback((v,N)=>{var We,Fe,Dt,Qe;if(!me)return;const P=V.current;if(V.current=null,!P||N!=null&&N.toNode)return;const L=e7(ie,P),K=t7(g.current,k.current,P);if(L.length===0&&K.length===0){ye(`没有匹配 ${P.slotType} 端口的节点`);return}const G=!!(v!=null&&v.shiftKey||P.preferExisting)?K.length>0?"existing":"create":L.length>0?"create":"existing",J=((Fe=(We=v==null?void 0:v.changedTouches)==null?void 0:We[0])==null?void 0:Fe.clientX)??(v==null?void 0:v.clientX),X=((Qe=(Dt=v==null?void 0:v.changedTouches)==null?void 0:Dt[0])==null?void 0:Qe.clientY)??(v==null?void 0:v.clientY);if(!Number.isFinite(J)||!Number.isFinite(X))return;const ae=document.querySelector(".af-workspace-canvas .react-flow");if(!ae)return;const de=ae.getBoundingClientRect(),ve=320,Me=Math.max(L.length,K.length),dt=Math.min(480,150+Me*58),Ve=Math.max(12,Math.min(J-de.left,de.width-ve-12)),Ke=Math.max(12,Math.min(X-de.top,de.height-dt-12));I({left:Ve,top:Ke,flowPosition:r.screenToFlowPosition({x:J,y:X}),draft:P,candidates:L,existingCandidates:K,mode:G,query:""})},[ie,r,me]),ZT=m.useCallback(v=>{if(!me){ye("Readonly workspace"),I(null);return}const N=F.current;if(!N||!(v!=null&&v.def))return;const P=yi(v.def,{position:N.flowPosition});if(!P)return;const L=N.draft.handleType==="source"?{source:N.draft.nodeId,sourceHandle:N.draft.handleId,target:P,targetHandle:`input-${v.slotIndex}`}:{source:P,sourceHandle:`output-${v.slotIndex}`,target:N.draft.nodeId,targetHandle:N.draft.handleId};h(K=>yg(K,L)),w(K=>{const Y=K.filter(G=>!(G.target===L.target&&G.targetHandle===L.targetHandle));return Xf({...L,markerEnd:{type:Qs.ArrowClosed}},Y)}),I(null)},[yi,w,me]),eR=m.useCallback(v=>{if(!me){ye("Readonly workspace"),I(null);return}const N=v==null?void 0:v.connection;if(!N||!vg(N,g.current)){ye("端口类型不匹配,已取消连线"),I(null);return}h(P=>yg(P,N)),w(P=>{const L=P.filter(K=>!(K.target===N.target&&K.targetHandle===N.targetHandle));return Xf({...N,markerEnd:{type:Qs.ArrowClosed}},L)}),I(null)},[w,h,me]),Jk=m.useCallback(v=>{v&&(yi(v,{position:Pd()}),et(!1),Rn(""))},[yi,Pd]),Xk=m.useCallback(v=>{v&&(pc(v,Pd()),et(!1),Rn(""))},[pc,Pd]),tR=m.useCallback(v=>{var P,L,K;if(ct)return;const N=v==null?void 0:v.target;YN(N)||(P=N==null?void 0:N.closest)!=null&&P.call(N,"button, a, [role='button'], .react-flow__handle")||(K=(L=x.current)==null?void 0:L.focus)==null||K.call(L,{preventScroll:!0})},[ct]);m.useEffect(()=>{const v=N=>{var ae;if(N.defaultPrevented)return;const P=YV(N.target)||YN(N.target);if((N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="s"){N.preventDefault(),Wt().catch(de=>ye(String(de.message||de)));return}if((N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="k"){N.preventDefault(),N.stopPropagation(),sk(de=>!de);return}if(tm)return;if(em){(N.key==="Escape"||FN(N))&&(N.preventDefault(),yd(!1));return}const L=N.key.toLowerCase(),K=(N.metaKey||N.ctrlKey)&&L==="c",Y=(N.metaKey||N.ctrlKey)&&L==="v",G=P&&K&&HK(N.target);if(P&&!G)return;const J=(N.metaKey||N.ctrlKey)&&!N.shiftKey&&L==="z",X=(N.metaKey||N.ctrlKey)&&(N.shiftKey&&L==="z"||L==="y");if(J||X){if(ct){N.preventDefault(),N.stopPropagation(),ye("展示页布局会自动保存");return}if(!me){N.preventDefault(),ye("Readonly workspace");return}N.preventDefault(),N.stopPropagation();const de=J?mk():gk();ye(de?J?"Undo canvas change":"Redo canvas change":J?"Nothing to undo":"Nothing to redo");return}if(K){if(ct)return;const de=Bn.current,ve=(g.current||[]).some(dt=>dt==null?void 0:dt.selected)?g.current:(g.current||[]).map(dt=>de&&dt.id===de?{...dt,selected:!0}:dt),Me=yV(ve,k.current,q.current);Me&&(N.preventDefault(),N.stopPropagation(),T.current=Me,g7(Me),G&&typeof((ae=N.target)==null?void 0:ae.blur)=="function"&&N.target.blur(),ye(`Copied ${Me.nodes.length} node${Me.nodes.length>1?"s":""}`));return}if(Y){if(ct){N.preventDefault(),N.stopPropagation();return}if(!me){N.preventDefault(),ye("Readonly workspace");return}const de=T.current||y7();de&&!T.current&&(T.current=de);const ve=xV(de,g.current,k.current,q.current);ve&&(N.preventDefault(),N.stopPropagation(),q.current=ve.instances,_(ve.instances),h(ve.nodes),w(ve.edges),ye(`Pasted ${ve.pastedNodeIds.length} node${ve.pastedNodeIds.length>1?"s":""}`));return}if(FN(N)&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),yd(!0);return}if(L==="g"&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),Bk();return}if(N.key==="a"||N.key==="A"){if(N.metaKey||N.ctrlKey){N.preventDefault(),ct?H(j.current.nodeIds):(h(de=>de.map(ve=>({...ve,selected:!0}))),w(de=>de.map(ve=>({...ve,selected:!1}))));return}if(N.altKey)return;if(ct){N.preventDefault(),vn(!0);return}if(!me){N.preventDefault(),ye("Readonly workspace");return}N.preventDefault(),et(!0);return}if((N.key==="v"||N.key==="V")&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),ik("select");return}if((N.key==="h"||N.key==="H")&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),ik("pan");return}(N.key==="f"||N.key==="F")&&!N.metaKey&&!N.ctrlKey&&!N.altKey&&(N.preventDefault(),zk())};return window.addEventListener("keydown",v,!0),()=>window.removeEventListener("keydown",v,!0)},[Bk,ct,tm,zk,gk,Wt,em,w,h,mk,me]);const nR=m.useCallback(v=>{xr(N=>{const P=new Set(N);return P.has(v)?P.delete(v):P.add(v),P})},[]),rR=m.useCallback((v,N)=>{v.dataTransfer.effectAllowed="copy",v.dataTransfer.setData("application/x-agentflow-workspace-file",JSON.stringify({path:N.path,name:N.name,type:N.type})),v.dataTransfer.setData("text/plain",N.path)},[]),sR=m.useCallback((v,N)=>{v.dataTransfer.effectAllowed="move",v.dataTransfer.setData("application/agentflow-node",N.id),v.dataTransfer.setData("text/plain",N.id)},[]),Id=m.useCallback(async(v,N)=>{const P=String((v==null?void 0:v.name)||(v==null?void 0:v.path)||"").toLowerCase(),L=P.split(".").pop(),K=["jsx","tsx","js"].includes(L)?"display_react_app":L==="html"?"display_html":L==="csv"||L==="tsv"||L==="json"&&/\b(table|data|rows|report)\b/i.test(P)?"display_table":["png","jpg","jpeg","gif","webp","svg"].includes(L)?"display_image":"display_markdown",Y=ie.find(ve=>ve.id===K);if(!Y){ye("展示节点不可用");return}const G=K==="display_image";let J=String(v.path||"");if(!G){const ve=cs(i);ve.set("path",v.path);const Me=await fetch(`/api/workspace/file?${ve.toString()}`),dt=await Me.json();if(!Me.ok)throw new Error(dt.error||"读取文件失败");J=String(dt.content||"")}const X=K==="display_image"?"src":"content",ae=Vc(Y.inputs).map(ve=>ve.name===X?{...ve,default:J,value:J}:ve),de=Vc(Y.outputs).map(ve=>ve.name===X?{...ve,default:J,value:J}:ve);yi(Y,{label:v.name||"Display",body:J,inputs:ae,outputs:de,position:N}),ye(`已创建展示:${v.path}`)},[yi,i,ie]),iR=m.useCallback(v=>{if(!me){ye("Readonly workspace");return}Id(v,za()).catch(N=>ye(String(N.message||N)))},[Id,za,me]),oR=m.useCallback(v=>{if(!me){v.preventDefault(),ye("Readonly workspace");return}const N=v.dataTransfer.getData("application/x-agentflow-workspace-file");if(N){v.preventDefault();let G;try{G=JSON.parse(N)}catch{return}if(!(G!=null&&G.path))return;const J=r.screenToFlowPosition({x:v.clientX,y:v.clientY});Id(G,J).catch(X=>ye(String(X.message||X)));return}const P=v.dataTransfer.getData("application/agentflow-snippet");if(P){const G=ue.find(X=>`${X.id}@${X.version}`===P);if(!G)return;v.preventDefault();const J=r.screenToFlowPosition({x:v.clientX,y:v.clientY});pc(G,J);return}const L=v.dataTransfer.getData("application/agentflow-node");if(!L)return;const K=ie.find(G=>G.id===L);if(!K)return;v.preventDefault();const Y=r.screenToFlowPosition({x:v.clientX,y:v.clientY});yi(K,{position:Y})},[Id,yi,ue,pc,ie,r,me]),aR=m.useCallback(v=>{if(!me)return;const N=Array.from(v.dataTransfer.types||[]);!N.includes("application/x-agentflow-workspace-file")&&!N.includes("application/agentflow-node")&&!N.includes("application/agentflow-snippet")||(v.preventDefault(),v.dataTransfer.dropEffect=N.includes("application/agentflow-node")||N.includes("application/agentflow-snippet")?"move":"copy")},[me]),lR=m.useCallback(async(v="")=>{if(!me){ye("Readonly workspace");return}const N=window.prompt("新文件名",v?`${v}/notes.md`:"notes.md");if(!N)return;const P=v&&!N.includes("/")?`${v}/${N}`:N;try{const L=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:P,content:""})}),K=await L.json();if(!L.ok)throw new Error(K.error||"创建文件失败");await Pn(),xr(Y=>{const G=new Set(Y);for(const J of Sf(K.path||P))G.delete(J);return G}),ye(`已创建 ${K.path}`)}catch(L){ye(String(L.message||L))}},[i,Pn,me]),cR=m.useCallback(async(v="")=>{if(!me){ye("Readonly workspace");return}const N=window.prompt("新文件夹名",v?`${v}/docs`:"docs");if(!N)return;const P=v&&!N.includes("/")?`${v}/${N}`:N;try{const L=await fetch("/api/workspace/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:P})}),K=await L.json();if(!L.ok)throw new Error(K.error||"创建文件夹失败");await Pn(),xr(Y=>{const G=new Set(Y);for(const J of Sf(K.path||P))G.delete(J);return K.path&&G.delete(K.path),G}),ye(`已创建 ${K.path}`)}catch(L){ye(String(L.message||L))}},[i,Pn,me]),uR=m.useCallback(async v=>{if(!me){ye("Readonly workspace");return}if(!(!(v!=null&&v.path)||!window.confirm(`删除 ${v.path}?`)))try{const N=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:v.path})}),P=await N.json();if(!N.ok)throw new Error(P.error||"删除失败");ye(`已删除 ${P.path}`),await Pn()}catch(N){ye(String(N.message||N))}},[i,Pn,me]),dR=m.useCallback(v=>{if(!(v!=null&&v.path)||v.type==="directory")return;const N=Hu(v.path,i,{download:!0});if(!N)return;const P=document.createElement("a");P.href=N,P.download=v.name||v.path.split("/").pop()||"download",P.rel="noopener",document.body.appendChild(P),P.click(),P.remove()},[i]),Td=m.useCallback(async()=>{if(!me){ye("Readonly workspace");return}const v=Oo.trim(),N=Wi,P=Fo.find(G=>G.id===N)||null;if(!v||Vr||(P==null?void 0:P.status)==="running")return;const L=P?Array.isArray(P.messages)?P.messages:[]:Do,K=Pc(d,y,q.current);Xh(""),Qb(!0),Pa(!0),Ia(null);const Y={role:"user",text:v,at:Date.now()};P?er(G=>G.map(J=>J.id===N?{...J,status:"running",messages:[...Array.isArray(J.messages)?J.messages:[],Y].slice(-180)}:J)):(Vi("workspace"),Aa(G=>[...G,Y]));try{await Wt(d,y);const G=await fetch("/api/workspace/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,prompt:v,outputKind:"markdown",workspaceGraph:K,allowFlowYaml:!1,model:pi,selectedSkills:bs,selectedNodeIds:_d,messages:L})}),J=await G.json();if(!G.ok)throw new Error(J.error||"生成失败");const ae={role:"assistant",kind:"assistant",text:String(J.content||"").trim(),at:Date.now()};P?er(de=>de.map(ve=>ve.id===N?{...ve,status:"done",messages:[...Array.isArray(ve.messages)?ve.messages:[],ae].slice(-180)}:ve)):Aa(de=>[...de,ae]),await La(),ye("AI 生成完成")}catch(G){const J=String(G.message||G),X={role:"assistant",text:J,error:!0,at:Date.now()};P?er(ae=>ae.map(de=>de.id===N?{...de,status:"failed",messages:[...Array.isArray(de.messages)?de.messages:[],X].slice(-180)}:de)):Aa(ae=>[...ae,X]),ye(J)}finally{Qb(!1)}},[Wi,Do,pi,Fo,Vr,Oo,y,i,La,d,Wt,_d,bs,me]),br=Fo.find(v=>v.id===Wi)||null,Qk=br?Array.isArray(br.messages)?br.messages:[]:Do,hc=br&&br.status==="running"||Vr,fR=Q7(Qk,hc),Zk=Z7(Qk),pR=br?br.status==="running"?`${br.label} running`:br.status==="paused"?`${br.label} paused`:br.status==="failed"?`${br.label} failed`:`${br.label} done`:Vr?"Workspace agent running":Do.length>0?"Workspace conversation":"Ready",hR=String(i.flowId||"").trim()||"Workspace",Ui=(Ee==null?void 0:Ee.mode)==="single-node",ev=Ui&&fc.find(v=>{var N;return v.id===Ee.sourceNodeId||((N=Ee.nodeIds)==null?void 0:N.includes(v.id))})||null,mR=Ui&&ev?[ev]:fc;return o.jsxs("div",{className:"af-workspace-page",children:[o.jsxs("header",{className:"af-pipeline-top af-workspace-top",children:[o.jsxs("div",{className:"af-pipeline-top-left",children:[o.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-back",onClick:()=>n("/projects"),"aria-label":"返回",children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),o.jsxs("div",{className:"af-pipeline-brand",title:i.flowId?`${i.flowId} · ${Le}`:Le||"PROJECT",children:[o.jsx("span",{className:"af-pipeline-brand-name",children:hR}),o.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",RK,"-STABLE"]})]}),o.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[o.jsx("button",{type:"button",className:a==="workspace"?"af-view-switch__active":"",onClick:()=>Hk("workspace"),children:"Workspace"}),o.jsx("button",{type:"button",className:a==="display"?"af-view-switch__active":"",onClick:()=>Hk("display"),children:"Display"})]})]}),o.jsxs("div",{className:"af-pipeline-top-right af-workspace-actions",children:[o.jsx("span",{className:"af-workspace-save-status",children:xT}),ct?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:kt||!(xe!=null&&xe.absoluteUrl)&&S.nodeIds.length===0,onClick:()=>{Cn(""),Xn(!0)},title:xe!=null&&xe.absoluteUrl?"查看展示链接":S.nodeIds.length===0?"先添加展示节点":"生成展示链接",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:kt?"hourglass_empty":"ios_share"}),kt?"生成中":xe!=null&&xe.absoluteUrl?"展示链接":"生成链接"]}),o.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:Oa.length===0,onClick:()=>vn(!0),title:Oa.length===0?"当前 workspace 没有 display 节点":"选择展示节点 (A)",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add_to_photos"}),"添加展示"]})]}):null,o.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",onClick:zT,title:"查看我的展示分享",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder_shared"}),"我的分享"]}),o.jsx("button",{type:"button",className:"af-icon-btn",disabled:!hk,onClick:()=>u(!0),"aria-label":e("project:archiveModal.title"),title:e("project:archiveModal.title"),children:o.jsx("span",{className:"material-symbols-outlined",children:"archive"})}),o.jsx("button",{type:"button",className:"af-icon-btn af-icon-btn--danger",disabled:!hk,onClick:()=>f(!0),"aria-label":e("flow:topbar.deletePipeline"),title:e("flow:topbar.deletePipeline"),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_forever"})}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>yd(!0),"aria-label":"快捷键",title:"快捷键 (?)",children:o.jsx("span",{className:"material-symbols-outlined",children:"help"})}),o.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(Qh?" af-composer-topbar-btn--active":"")+(Vr?" af-composer-topbar-btn--running":""),disabled:ct,onClick:()=>{Ia(null),Pa(v=>!v)},children:"AI"}),o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!me,onClick:()=>Wt().catch(v=>ye(String(v.message||v))),children:"Save"})]})]}),oe?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:oe}),o.jsx("button",{type:"button",onClick:()=>be(""),"aria-label":"关闭发布提示",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,o.jsxs("div",{className:"af-workspace-body"+(!ct&&(Qh||we)?" af-workspace-body--drawer":"")+(!ct&&ic?" af-workspace-body--sidebar-collapsed":"")+(ct?" af-workspace-body--display-mode":""),children:[!ct&&ic?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:()=>et(!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:()=>gd(!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:()=>gd(!1),"aria-label":"展开侧边栏",title:(wr==null?void 0:wr.username)||(wr==null?void 0:wr.userId)||"展开侧边栏",children:$T})]})}):null,ct?null:o.jsxs("aside",{ref:Pt,className:"af-workspace-sidebar"+(oT?" af-workspace-sidebar--resizing":""),"aria-hidden":ic,style:{"--af-work-files-pane-height":`${Math.round(fi)}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:()=>gd(!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:()=>lR(gi),"aria-label":"新增文件",title:gi?`在 ${gi} 新增文件`:"新增文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),o.jsx("button",{type:"button",className:"af-icon-btn",disabled:!me,onClick:()=>cR(gi),"aria-label":"新增文件夹",title:gi?`在 ${gi} 新增文件夹`:"新增文件夹",children:o.jsx("span",{className:"material-symbols-outlined",children:"create_new_folder"})}),o.jsx("button",{type:"button",className:"af-icon-btn",disabled:!me||Xe,onClick:()=>Pk(gi),"aria-label":"上传文件",title:gi?`上传到 ${gi}`:"上传文件",children:o.jsx("span",{className:"material-symbols-outlined",children:Xe?"hourglass_top":"upload_file"})}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>void Pn(),"aria-label":"刷新文件",title:"刷新文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})}),o.jsx("input",{ref:Kn,type:"file",multiple:!0,className:"af-visually-hidden",onChange:NT})]})]}),o.jsx("input",{className:"af-workspace-search",value:Wr,onChange:v=>Zn(v.target.value),placeholder:"搜索文件..."}),o.jsx("div",{className:"af-workspace-files-scroll",onClick:RT,children:o.jsx(lI,{items:TT,onOpen:iR,selectedPath:U,collapsedDirs:is,onToggleDir:nR,onSelect:v=>fe(v.path||""),onFileDragStart:rR,onDelete:uR,onDownload:dR})})]}),o.jsx("button",{type:"button",className:"af-workspace-sidebar-resizer",onPointerDown:fT,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:re==="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:ne,onChange:v=>ce(v.target.value),placeholder:re==="flows"?"搜索流程片段...":"搜索节点...","aria-label":re==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsxs("div",{className:"af-palette-tabs",role:"tablist","aria-label":"Palette 类型",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":re==="nodes",className:"af-palette-tab"+(re==="nodes"?" af-palette-tab--active":""),onClick:()=>le("nodes"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),o.jsxs("button",{type:"button",role:"tab","aria-selected":re==="flows",className:"af-palette-tab"+(re==="flows"?" af-palette-tab--active":""),onClick:()=>le("flows"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),"流程"]})]})]}),o.jsx("div",{className:"af-node-palette-scroll af-workspace-node-palette-scroll",children:re==="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:OT,disabled:Hn.length<2,title:Hn.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:["已选 ",Hn.length," 节点 / ",Ed.length," 连线"]})]})}),Ie?o.jsx("p",{className:"af-err af-palette-list-err",children:Ie}):null,De?o.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段..."}):qk.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:qk.map(v=>{const N=`${v.id}@${v.version}`,P=v.displayName||v.name||v.id,L=v.description||`${v.nodeCount||0} 个节点,${v.edgeCount||0} 条连线`;return o.jsxs("button",{type:"button",className:"af-palette-card af-flow-snippet-card",draggable:!0,onDragStart:K=>{K.dataTransfer.effectAllowed="move",K.dataTransfer.setData("application/agentflow-snippet",N),K.dataTransfer.setData("text/plain",N)},onClick:()=>pc(v),title:L,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:P}),o.jsxs("span",{className:"af-palette-card-id",children:[v.id,"@",v.version]})]})]}),L?o.jsx("span",{className:"af-palette-card-desc",children:L}):null,o.jsxs("span",{className:"af-flow-snippet-meta","aria-hidden":!0,children:[o.jsxs("span",{children:[v.nodeCount||0," nodes"]}),o.jsxs("span",{children:[v.edgeCount||0," edges"]})]})]},N)})})]}):o.jsx("p",{className:"af-palette-empty",children:ne.trim()?"没有匹配的流程片段":"暂无流程片段。选择多个节点后发布。"})]}):o.jsxs(o.Fragment,{children:[Ya.map(v=>{var N;return(N=cm[v])!=null&&N.length?o.jsxs("section",{className:`af-palette-section af-flow-palette-section--${v}`,children:[o.jsx("h3",{className:"af-palette-cat",children:v}),o.jsx("div",{className:"af-palette-cards",children:cm[v].map(P=>{const L=ZN(P.inputs,"input"),K=ZN(P.outputs,"output"),Y=vx(P),G=Hc(P);return o.jsxs("button",{type:"button",className:"af-palette-card",draggable:!0,onDragStart:J=>sR(J,P),onClick:()=>yi(P),title:Y||P.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:XN(v)})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:G}),G!==P.id?o.jsx("span",{className:"af-palette-card-id",children:P.id}):null]})]}),Y?o.jsx("span",{className:"af-palette-card-desc",children:Y}):null,o.jsxs("span",{className:"af-palette-card-ports","aria-hidden":!0,children:[o.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--in",children:[o.jsxs("span",{className:"af-palette-card-port-count",children:[L.list.length," IN"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[L.shown.map((J,X)=>o.jsxs("span",{className:"af-palette-card-port",title:QN("input",J,X),children:[o.jsx("span",{className:"af-palette-card-port-dot",style:{background:wn(J==null?void 0:J.type)}}),o.jsx("span",{className:"af-palette-card-port-name",children:bf(J,X)})]},`in-${X}`)),L.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",L.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:[K.list.length," OUT"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[K.shown.map((J,X)=>o.jsxs("span",{className:"af-palette-card-port",title:QN("output",J,X),children:[o.jsx("span",{className:"af-palette-card-port-name",children:bf(J,X)}),o.jsx("span",{className:"af-palette-card-port-dot",style:{background:wn(J==null?void 0:J.type)}})]},`out-${X}`)),K.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",K.hidden]}):null]})]})]})]},P.id)})})]},v):null}),ie.length>0&&ne.trim()&&Ya.every(v=>{var N;return!((N=cm[v])!=null&&N.length)})?o.jsx("p",{className:"af-palette-empty",children:"没有匹配的节点"}):null]})})]})]}),o.jsxs("main",{ref:x,className:"af-workspace-canvas",tabIndex:-1,onPointerDownCapture:tR,children:[o.jsx($A,{className:"af-flow-canvas af-workspace-flow"+(nm==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select")+(ct?" af-workspace-flow--display-mode":""),nodes:ET,edges:AT,nodeTypes:K7,onNodesChange:qT,onEdgesChange:YT,onConnect:ct?void 0:JT,onConnectStart:ct?void 0:XT,onConnectEnd:ct?void 0:QT,isValidConnection:ct?void 0:GT,onNodeClick:(v,N)=>{var P;if(ct){H([Sg(N.id)]);return}if((P=N==null?void 0:N.data)!=null&&P.isWorkspaceGroup){gt("");return}if(v.detail>=3){Pa(!1),h(L=>L.map(K=>({...K,selected:K.id===N.id}))),w(L=>L.map(K=>({...K,selected:!1}))),gt(N.id);return}jt&>(N.id)},onNodeDoubleClick:v=>{v.preventDefault()},onPaneClick:()=>{ct?H([]):gt("")},onDrop:ct?void 0:oR,onDragOver:ct?void 0:aR,nodesDraggable:ct?!0:me,nodesConnectable:ct?!1:me,edgesReconnectable:ct?!1:me,deleteKeyCode:ct?null:me?["Backspace","Delete"]:null,selectionOnDrag:nm==="select",panOnDrag:nm==="pan"?!0:[1,2],panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,children:o.jsx(OA,{color:"rgba(255,255,255,0.12)",gap:22,size:1})}),!ct&&M?(()=>{var J;const v=String(M.query||"").trim().toLowerCase(),N=M.mode==="create"?"create":"existing",P=Array.isArray(M.candidates)?M.candidates:[],L=Array.isArray(M.existingCandidates)?M.existingCandidates:[],K=v?P.filter(X=>{var ae,de,ve;return[(ae=X.def)==null?void 0:ae.id,X.displayLabel,X.description,(de=X.slot)==null?void 0:de.name,(ve=X.slot)==null?void 0:ve.type].filter(Boolean).some(Me=>String(Me).toLowerCase().includes(v))}):P,Y=v?L.filter(X=>{var ae,de;return[X.nodeId,X.nodeLabel,X.definitionId,(ae=X.slot)==null?void 0:ae.name,(de=X.slot)==null?void 0:de.type].filter(Boolean).some(ve=>String(ve).toLowerCase().includes(v))}):L,G=M.draft.handleType==="source"?"IN":"OUT";return o.jsxs("div",{className:"af-connect-node-menu",style:{left:M.left,top:M.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:wn((J=M.draft.slot)==null?void 0:J.type)},"aria-hidden":!0}),o.jsxs("span",{children:["匹配 ",M.draft.slotType," 节点"]})]}),o.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>I(null),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("div",{className:"af-connect-node-menu__tabs",role:"tablist","aria-label":"连接方式",children:[o.jsxs("button",{type:"button",className:N==="existing"?"af-connect-node-menu__tab af-connect-node-menu__tab--active":"af-connect-node-menu__tab",disabled:L.length===0,onClick:()=>I(X=>X&&{...X,mode:"existing",query:""}),children:["连接已有 ",o.jsx("span",{children:L.length})]}),o.jsxs("button",{type:"button",className:N==="create"?"af-connect-node-menu__tab af-connect-node-menu__tab--active":"af-connect-node-menu__tab",disabled:P.length===0,onClick:()=>I(X=>X&&{...X,mode:"create",query:""}),children:["新建节点 ",o.jsx("span",{children:P.length})]})]}),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:M.query,onChange:X=>I(ae=>ae&&{...ae,query:X.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),o.jsxs("div",{className:"af-connect-node-menu__list",children:[N==="create"?K.map(X=>{var ve,Me;const ae=X.displayLabel||((ve=X.def)==null?void 0:ve.id),de=bf(X.slot,X.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>ZT(X),title:X.description||X.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:ae}),ae!==X.def.id?o.jsx("span",{className:"af-connect-node-menu__item-id",children:X.def.id}):null]}),o.jsxs("span",{className:"af-connect-node-menu__port",children:[o.jsx("span",{children:G}),o.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:wn((Me=X.slot)==null?void 0:Me.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:de})]})]},`${X.def.id}-${X.slotIndex}`)}):Y.map(X=>{var ve;const ae=X.nodeLabel||X.nodeId,de=bf(X.slot,X.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>eR(X),title:`${X.definitionId||X.nodeId} · ${de}`,children:[o.jsxs("span",{className:"af-connect-node-menu__item-main",children:[o.jsx("span",{className:"af-connect-node-menu__item-label",children:ae}),o.jsxs("span",{className:"af-connect-node-menu__item-id",children:[X.definitionId?`${X.definitionId} · `:"",X.nodeId]})]}),o.jsxs("span",{className:"af-connect-node-menu__port",children:[o.jsx("span",{children:G}),o.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:wn((ve=X.slot)==null?void 0:ve.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:de}),X.occupied?o.jsx("span",{className:"af-connect-node-menu__port-badge",children:"替换"}):null]})]},`${X.nodeId}-${X.handleId}`)}),(N==="create"?K.length:Y.length)===0?o.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null,!ct&&!gT?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:()=>Zh(!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:Hn.length===0?o.jsx("span",{className:"af-composer-selected-empty",children:"选择画布节点后,可作为本次 Workspace AI 的上下文。"}):Hn.map(v=>{var K,Y;const N=String(((K=v.data)==null?void 0:K.label)??v.id),P=(Y=v.data)!=null&&Y.definitionId?String(v.data.definitionId):"",L=P&&P!==N?`${N} · ${v.id} · ${P}`:`${N} · ${v.id}`;return o.jsxs("div",{className:"af-composer-node-chip",title:L,children:[o.jsx("span",{className:"af-composer-node-chip-kind",children:P||"node"}),o.jsx("span",{className:"af-composer-node-chip-label",children:N}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>UT(v.id),"aria-label":`取消选择 ${v.id}`,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},v.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:Oo,rows:2,onChange:v=>Xh(v.target.value),onKeyDown:v=>{(v.metaKey||v.ctrlKey)&&v.key==="Enter"&&(v.preventDefault(),Td())},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:Jh,type:"button",className:"af-composer-skills-button"+(bs.length>0?" af-composer-skills-button--active":""),disabled:Vr||!me,"aria-haspopup":"listbox","aria-expanded":md,onClick:()=>Gh(v=>!v),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("span",{children:bs.length>0?`Skills ${bs.length}`:"Skills"})]}),md&&!Vr?Sr.createPortal(o.jsx("div",{ref:Jb,className:"af-composer-skills-menu",role:"listbox","aria-label":"Skills",style:hT,children:ws.length===0?o.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):o.jsxs(o.Fragment,{children:[Da.groups.map(v=>{const N=ha(v,ws),P=lL(v,um,ws),L=pT.has(v.id);return o.jsxs("div",{className:"af-composer-skill-group af-composer-skill-group--framed"+(L?" 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:P==="all",disabled:N.length===0,onChange:K=>{const Y=K.target.checked;rc(G=>Y?oL(G,N):aL(G,N))}}),o.jsxs("span",{className:"af-composer-skill-group-title-main",children:[o.jsx("span",{children:v.name}),v.builtin?o.jsx("em",{children:"built-in"}):null,P==="partial"?o.jsx("em",{children:"partial"}):null]})]}),o.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":L?`展开 ${v.name}`:`收起 ${v.name}`,onClick:()=>{Gb(K=>{const Y=new Set(K);return Y.has(v.id)?Y.delete(v.id):Y.add(v.id),Y})},children:[o.jsx("span",{children:v.skills.length}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:L?"expand_more":"expand_less"})]})]}),L?null:o.jsx("div",{className:"af-composer-skill-group-items",children:v.skills.map(K=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:um.has(K.key),onChange:Y=>{const G=Y.target.checked;rc(J=>G?J.includes(K.key)?J:[...J,K.key]:J.filter(X=>X!==K.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:K.name}),K.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:K.description}):null]})]},`${v.id}:${K.key}`))})]},v.id)}),Da.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:Da.ungrouped.length})]}),Da.ungrouped.map(v=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:um.has(v.key),onChange:N=>{const P=N.target.checked;rc(L=>P?L.includes(v.key)?L:[...L,v.key]:L.filter(K=>K!==v.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:v.name}),v.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:v.description}):null]})]},`ungrouped:${v.key}`))]}):null]})}),document.body):null]}),o.jsx("label",{className:"af-composer-model-field",children:o.jsxs("select",{className:"af-composer-model-select",value:pi,onChange:v=>lT(v.target.value),"aria-label":"模型",children:[o.jsx("option",{value:"",children:"默认模型"}),MT.map(v=>o.jsx("option",{value:v.value,children:v.label},v.value))]})}),o.jsx("button",{type:"button",className:"af-composer-send"+(Oo.trim()&&!Vr?" af-composer-send--active":"")+(Vr?" af-composer-send--stop":""),disabled:Vr||!Oo.trim()||!me,"aria-label":Vr?"Running":"Send",onClick:()=>void Td(),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Vr?"sync":"arrow_upward"})})]})]})]})}):ct?null:o.jsx("button",{type:"button",className:"af-workspace-composer-fab",onClick:()=>Zh(!1),"aria-label":"展开 AI 输入框",title:"展开 AI 输入框",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"auto_awesome"})})]}),!ct&&Qh?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:()=>Pa(!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"+(Wi==="workspace"?" af-composer-session-tab--active":""),onClick:()=>Vi("workspace"),children:o.jsx("span",{className:"af-composer-session-label",children:"Workspace"})}),Fo.map(v=>o.jsx("button",{type:"button",className:"af-composer-session-tab"+(Wi===v.id?" af-composer-session-tab--active":"")+(v.status==="running"?" af-composer-session-tab--running":""),onClick:()=>Vi(v.id),title:v.runNodeId||v.label,children:o.jsx("span",{className:"af-composer-session-label",children:v.label})},v.id))]}),o.jsx("div",{className:"af-composer-sidebar-status"+(hc?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:pR}),o.jsxs("div",{className:"af-composer-sidebar-thread",children:[o.jsx(cj,{messages:fR,running:hc,showRunningIndicator:!br}),Zk.length>0?o.jsxs("details",{className:"af-composer-sidebar-log-details",children:[o.jsx("summary",{children:"执行日志"}),o.jsx(cj,{messages:Zk,running:!1,showRunningIndicator:!1})]}):null]}),o.jsxs("div",{className:"af-composer-sidebar-input",children:[o.jsx("textarea",{className:"af-composer-sidebar-textarea",value:Oo,rows:3,onChange:v=>Xh(v.target.value),onKeyDown:v=>{(v.metaKey||v.ctrlKey)&&v.key==="Enter"&&(v.preventDefault(),Td())},placeholder:br?"继续追问、总结或要求调整这次结果":"继续描述你想让 AI 在 workspace 中做什么",disabled:!me||hc}),o.jsx("button",{type:"button",className:"af-composer-sidebar-send",disabled:!me||hc||!Oo.trim(),onClick:()=>void Td(),"aria-label":"发送 AI 对话",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_upward"})})]})]})}):!ct&&we&&Yt?o.jsx("aside",{className:"af-pipeline-drawer af-workspace-node-drawer","aria-label":"Workspace Node Properties",children:o.jsx(gK,{draft:we,setDraft:Xt,definitionId:String(((tv=Yt.data)==null?void 0:tv.definitionId)||Yt.id),systemPromptReadonly:String(((nv=Yt.data)==null?void 0:nv.description)||""),modelLists:Lo,disabled:!me,onIdBlur:()=>lm(!0),onClose:()=>gt(""),onPublishToMarketplace:vT,error:Bi,ioSlots:{inputs:Array.isArray(we==null?void 0:we.inputs)?we.inputs:[],outputs:Array.isArray(we==null?void 0:we.outputs)?we.outputs:[]}})}):null,!ct&&sc?Sr.createPortal(o.jsx("div",{className:"af-workspace-run-logs-overlay",role:"presentation",onMouseDown:()=>Ia(null),children:o.jsx("aside",{className:"af-workspace-run-logs-drawer","aria-label":"Workspace Run Logs",onMouseDown:v=>v.stopPropagation(),children:o.jsx(tK,{flowParams:i,scheduleNodeId:sc.scheduleNodeId,runNodeId:sc.runNodeId,lastRunId:sc.lastRunId,label:sc.label,onClose:()=>Ia(null)})})}),document.body):null,o.jsx(XV,{open:em,onClose:()=>yd(!1)}),o.jsx(ZV,{open:tm,onClose:()=>sk(!1),onJump:IT,nodes:PT}),o.jsx(yK,{open:c,onClose:()=>u(!1),flowId:i.flowId||"",flowSource:xd,onArchived:()=>{u(!1),n("/projects?tab=archived")}}),o.jsx(xK,{open:p&&!!i.flowId,onClose:()=>f(!1),flowId:i.flowId||"",flowSource:xd,flowArchived:!!i.archived,onDeleted:async()=>{f(!1),n("/projects")}}),Et?Sr.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal",role:"dialog","aria-modal":"true","aria-label":"发布流程片段",children:[o.jsxs("div",{className:"af-flow-snippet-modal__head",children:[o.jsxs("span",{className:"af-flow-snippet-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"ios_share"}),"发布流程片段"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>bt(!1),"aria-label":"关闭",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:Pe.name,onChange:v=>{const N=v.target.value;rt(P=>({...P,name:N,id:P.id?P.id:N.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:Pe.id,onChange:v=>rt(N=>({...N,id:v.target.value})),placeholder:"content-cleanup-snippet"})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"说明"}),o.jsx("textarea",{value:Pe.description,onChange:v=>rt(N=>({...N,description:v.target.value})),placeholder:"这段流程适合什么 workspace 场景、需要接哪些上下游。",rows:4})]}),o.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",Hn.length," 个节点和 ",Ed.length," 条内部连线。"]}),Kt?o.jsx("div",{className:"af-flow-snippet-error",children:Kt}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>bt(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:At||!Pe.name.trim(),onClick:()=>void DT(),children:At?"发布中...":"发布"})]})]})}),document.body):null,Fk?o.jsx(T7,{node:Fk,onClose:()=>se("")}):null,st?Sr.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":Ui?"新建分享":"发布展示页",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"}),Ui?"新建分享":"发布展示页"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>Ze(!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:Ee.title,onChange:v=>ut(N=>({...N,title:v.target.value})),placeholder:"展示页标题",autoFocus:!0})]}),Ui?null:o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"布局"}),o.jsxs("select",{className:"af-display-share-select",value:Ee.layout,onChange:v=>ut(N=>({...N,layout:v.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.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"有效期"}),o.jsx("select",{className:"af-display-share-select",value:nj(Ee),onChange:v=>{const N=v.target.value;ut(P=>({...P,permanent:N==="permanent",expiresInDays:N==="permanent"?P.expiresInDays||30:Number(N)}))},children:Ng.map(v=>o.jsx("option",{value:v.value,children:v.label},v.value))})]}),o.jsxs("div",{className:"af-display-share-node-list",role:"group","aria-label":Ui?"分享内容":"选择展示节点",children:[Ui?o.jsx("span",{className:"af-display-share-node-list__label",children:"分享内容"}):null,mR.map(v=>{var P;const N=Array.isArray(Ee.nodeIds)&&Ee.nodeIds.includes(v.id);return o.jsxs("label",{className:"af-display-share-node-row",children:[o.jsx("input",{type:"checkbox",checked:N,disabled:Ui,onChange:()=>FT(v.id)}),o.jsxs("span",{className:"af-display-share-node-row__main",children:[o.jsx("strong",{children:((P=v.data)==null?void 0:P.label)||v.id}),o.jsxs("small",{children:[yn(v.data)," · ",v.id]})]})]},v.id)})]}),xe!=null&&xe.absoluteUrl?o.jsxs("div",{className:"af-display-share-result",children:[o.jsx("input",{type:"text",readOnly:!0,value:xe.absoluteUrl,onFocus:v=>v.target.select()}),o.jsx("button",{type:"button",onClick:()=>window.open(xe.absoluteUrl,"_blank","noopener,noreferrer"),children:"打开"}),o.jsx("button",{type:"button",onClick:()=>void Gk(),children:hn==="copied"?"已复制":hn==="failed"?"复制失败":"复制"})]}):null,Gt?o.jsx("div",{className:"af-flow-snippet-error",children:Gt}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>Ze(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:kt||!Array.isArray(Ee.nodeIds)||Ee.nodeIds.length===0,onClick:()=>void BT(),children:kt?"生成中...":"生成链接"})]})]})}),document.body):null,Er?Sr.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:()=>{Cn(""),Xn(!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:[xe!=null&&xe.absoluteUrl?o.jsxs("div",{className:"af-display-link-modal__url",children:[o.jsx("input",{type:"text",readOnly:!0,value:xe.absoluteUrl,onFocus:v=>v.target.select(),autoFocus:!0}),o.jsxs("button",{type:"button",onClick:()=>window.open(xe.absoluteUrl,"_blank","noopener,noreferrer"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"}),"打开"]}),o.jsxs("button",{type:"button",onClick:()=>void Gk(),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:hn==="copied"?"check":"content_copy"}),hn==="copied"?"已复制":hn==="failed"?"复制失败":"复制"]})]}):o.jsx("div",{className:"af-display-link-modal__empty",children:"还没有生成展示链接"}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"新链接有效期"}),o.jsx("select",{className:"af-display-share-select",value:nj(Ee),onChange:v=>{const N=v.target.value;ut(P=>({...P,permanent:N==="permanent",expiresInDays:N==="permanent"?P.expiresInDays||30:Number(N)}))},children:Ng.map(v=>o.jsx("option",{value:v.value,children:v.label},v.value))})]}),Gt?o.jsx("div",{className:"af-flow-snippet-error",children:Gt}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>{Cn(""),Xn(!1)},children:"关闭"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:kt||S.nodeIds.length===0,onClick:()=>void HT(),children:kt?"生成中...":xe!=null&&xe.absoluteUrl?"更新链接":"生成链接"})]})]})}),document.body):null,_n?Sr.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal af-display-shares-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:"folder_shared"}),"我的分享"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>mr(!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("div",{className:"af-display-shares-toolbar",children:[o.jsx("span",{children:En.length?`${En.length} 个分享`:"暂无分享"}),o.jsxs("button",{type:"button",onClick:()=>void vs(),disabled:Qn,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),"刷新"]})]}),gr?o.jsx("div",{className:"af-flow-snippet-error",children:gr}):null,Qn?o.jsx("div",{className:"af-display-link-modal__empty",children:"Loading..."}):null,!Qn&&En.length===0?o.jsx("div",{className:"af-display-link-modal__empty",children:"还没有创建过展示分享"}):null,o.jsx("div",{className:"af-display-shares-list",children:En.map(v=>{const N=sj(v),P=ss===v.id,L=v.expiresAt?String(v.expiresInDays||30):"permanent";return o.jsxs("article",{className:"af-display-share-item",children:[o.jsxs("div",{className:"af-display-share-item__main",children:[o.jsx("strong",{children:v.title||"AgentFlow Display"}),o.jsxs("span",{children:[v.flowId||"-"," · ",v.layout||"gallery"," · ",Array.isArray(v.nodeIds)?v.nodeIds.length:0," nodes"]}),o.jsx("small",{children:p7(v)})]}),o.jsx("input",{className:"af-display-share-item__url",type:"text",readOnly:!0,value:N,onFocus:K=>K.target.select()}),o.jsx("select",{className:"af-display-share-select",value:L,disabled:P,onChange:K=>void VT(v,K.target.value),"aria-label":"修改分享有效期",children:Ng.map(K=>o.jsx("option",{value:K.value,children:K.label},K.value))}),o.jsxs("div",{className:"af-display-share-item__actions",children:[o.jsxs("button",{type:"button",onClick:()=>window.open(N,"_blank","noopener,noreferrer"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"}),"打开"]}),o.jsxs("button",{type:"button",onClick:()=>void WT(v),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Ar===v.id?"check":"content_copy"}),Ar===v.id?"已复制":"复制"]}),o.jsxs("button",{type:"button",className:"af-display-share-item__danger",disabled:P,onClick:()=>void KT(v),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:P?"hourglass_empty":"link_off"}),"撤销"]})]})]},v.id)})})]})]})}),document.body):null,mn?Sr.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:()=>vn(!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:zn,onChange:v=>Pr(v.target.value),placeholder:"搜索展示节点...",autoFocus:!0})]}),o.jsx("div",{className:"af-display-picker-grid",role:"group","aria-label":"选择展示节点",style:{"--af-display-picker-columns":Uk.length||1},children:Ad.length>0?Uk.map((v,N)=>o.jsx("div",{className:"af-display-picker-column",children:v.map(LT)},`display-picker-column-${N}`)):o.jsx("div",{className:"af-display-picker-empty",children:Oa.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:()=>vn(!1),children:"完成"})})]})}),document.body):null,Te.nodeId?Sr.createPortal(o.jsx(X7,{files:ee,query:Te.query,onQueryChange:v=>Ae(N=>({...N,query:v})),onSelect:jT,onUpload:Pk,onClose:im}),document.body):null,!ct&&Ne?Sr.createPortal(o.jsx("div",{className:"af-workspace-quick-add-backdrop",onMouseDown:()=>et(!1),children:o.jsxs("div",{className:"af-workspace-quick-add",role:"dialog","aria-modal":"true","aria-label":"Add workspace node",onMouseDown:v=>v.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":mt==="nodes",className:"af-workspace-quick-add__tab"+(mt==="nodes"?" af-workspace-quick-add__tab--active":""),onClick:()=>sn("nodes"),children:"节点"}),o.jsx("button",{type:"button",role:"tab","aria-selected":mt==="flows",className:"af-workspace-quick-add__tab"+(mt==="flows"?" af-workspace-quick-add__tab--active":""),onClick:()=>sn("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:Xb,value:gn,onChange:v=>Rn(v.target.value),onKeyDown:v=>{if(v.key==="Escape")v.preventDefault(),et(!1);else if(v.key==="ArrowDown"){v.preventDefault();const N=mt==="flows"?dc.length:uc.length;ot(P=>Math.min(Math.max(0,N-1),P+1))}else v.key==="ArrowUp"?(v.preventDefault(),ot(N=>Math.max(0,N-1))):v.key==="Tab"?(v.preventDefault(),sn(N=>N==="nodes"?"flows":"nodes")):v.key==="Enter"&&(v.preventDefault(),mt==="flows"?Xk(dc[yr]||dc[0]):Jk(uc[yr]||uc[0]))},placeholder:mt==="flows"?"搜索流程片段...":"搜索节点...","aria-label":mt==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsx("div",{className:"af-workspace-quick-add__list",children:mt==="flows"?dc.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:De?"正在加载流程片段...":Ie||"没有匹配的流程片段"}):dc.map((v,N)=>{const P=v.displayName||v.name||v.id,L=v.snippet&&typeof v.snippet=="object"?v.snippet.instances:null,K=v.snippet&&typeof v.snippet=="object"?v.snippet.edges:null,Y=Number.isFinite(Number(v.nodeCount))?Number(v.nodeCount):Object.keys(L||{}).length,G=Number.isFinite(Number(v.edgeCount))?Number(v.edgeCount):Array.isArray(K)?K.length:0;return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(N===yr?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>ot(N),onClick:()=>Xk(v),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:P}),o.jsxs("span",{className:"af-workspace-quick-add__meta",children:[v.id,v.version?` · v${v.version}`:""]}),o.jsx("span",{className:"af-workspace-quick-add__desc",children:v.description||`${Y} 节点 / ${G} 连线`})]}),o.jsx("span",{className:"af-workspace-quick-add__cat",children:"FLOW"})]},`${v.id}@${v.version}`)}):uc.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:"没有匹配的节点"}):uc.map((v,N)=>{const P=Bc(v),L=Hc(v),K=vx(v);return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(N===yr?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>ot(N),onClick:()=>Jk(v),children:[o.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:XN(P)}),o.jsxs("span",{className:"af-workspace-quick-add__main",children:[o.jsx("span",{className:"af-workspace-quick-add__label",children:L}),o.jsx("span",{className:"af-workspace-quick-add__meta",children:v.id}),K?o.jsx("span",{className:"af-workspace-quick-add__desc",children:K}):null]}),o.jsx("span",{className:"af-workspace-quick-add__cat",children:P})]},v.id)})})]})}),document.body):null]})]})}function pU(){return o.jsx(Gw,{children:o.jsx(fU,{})})}function hU(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 mU(e){return e==="mermaid"?"account_tree":e==="ascii"?"notes":e==="html"?"html":e==="react"?"deployed_code":e==="image"?"image":e==="chart"?"bar_chart":e==="table"?"table":"article"}function gU(e){let t=String(e||"").replace(/\r\n/g,`
|
|
255
|
-
`).trim();return t.includes(`
|
|
256
|
-
`)||(t=t.replace(/\s+(resultFile|result|outParams|outParams\.[A-Za-z_][A-Za-z0-9_-]*)\s*:/g,`
|
|
257
|
-
$1:`).replace(/(^|\n)outParams:\s+([A-Za-z_][A-Za-z0-9_-]*\s*:)/g,`$1outParams:
|
|
258
|
-
$2`)),t}function gI(e){const t=String(e||"").trim();if(!t)return String(e||"");const n=t.match(/---agentflow\b([\s\S]*?)---end/i);if(n!=null&&n[1]){const a=gU(n[1]),l=a.match(/^resultFile\s*:\s*["']?([^"'\n]+)["']?/m);if(l!=null&&l[1])return l[1].trim();const c=a.match(/^result\s*:\s*(.*)$/m);if(c){const p=String(c[1]||"").trim();return p==="|"||p===">"?a.slice((c.index||0)+c[0].length).split(`
|
|
259
|
-
`).filter(d=>/^\s+/.test(d)||!d.trim()).map(d=>d.replace(/^\s{2}/,"")).join(`
|
|
260
|
-
`).replace(/\s+$/g,""):p.replace(/^["']|["']$/g,"")}const u=t.replace(n[0],"").trim();if(u)return u}if(!/["']result["']\s*:|["']outParams["']\s*:|["']resultFile["']\s*:/i.test(t))return String(e||"");const r=[t],s=t.indexOf("{"),i=t.lastIndexOf("}");s>=0&&i>s&&r.unshift(t.slice(s,i+1));for(const a of r)try{const l=JSON.parse(a);if(l&&typeof l=="object"&&!Array.isArray(l)&&(Object.prototype.hasOwnProperty.call(l,"result")||Object.prototype.hasOwnProperty.call(l,"resultFile"))){const c=l.resultFile||l.result;return typeof c=="string"?c:JSON.stringify(c,null,2)}}catch{}return String(e||"")}function jb(e){let t=gI(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 yU(e){const t=jb(e);return t.trim()?/<[^>]*$/g.test(t)?"HTML 内容末尾存在未闭合标签,可能是生成或保存时被截断。":/^(?:<!doctype\b|<html\b)/i.test(t)&&!/<\/html\s*>/i.test(t)?"完整 HTML 文档缺少 </html> 结束标签,可能是生成或保存时被截断。":"":""}function xU(e){const t=jb(e);if(!t.trim())return"";const n=`<base target="_blank"><script data-agentflow-display-link-guard="1">
|
|
261
|
-
(() => {
|
|
262
|
-
document.addEventListener("click", (event) => {
|
|
263
|
-
const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
|
|
264
|
-
if (!link) return;
|
|
265
|
-
const rawHref = String(link.getAttribute("href") || "").trim();
|
|
266
|
-
if (!rawHref || rawHref.startsWith("#")) return;
|
|
267
|
-
if (/^javascript:/i.test(rawHref)) {
|
|
268
|
-
event.preventDefault();
|
|
269
|
-
return;
|
|
270
|
-
}
|
|
271
|
-
event.preventDefault();
|
|
272
|
-
window.open(link.href, "_blank", "noopener,noreferrer");
|
|
273
|
-
}, true);
|
|
274
|
-
})();
|
|
275
|
-
<\/script>`;return/data-agentflow-display-link-guard=["']1["']/i.test(t)?t:/<head\b[^>]*>/i.test(t)?t.replace(/<head\b([^>]*)>/i,`<head$1>${n}`):/<html\b[^>]*>/i.test(t)?t.replace(/<html\b([^>]*)>/i,`<html$1><head>${n}</head>`):`<!doctype html><html><head>${n}</head><body>${t}</body></html>`}function yI(e,t,n={}){const r=String(e||"").trim();if(!r)return"";if(/^(?:https?:|data:|blob:|file:)/i.test(r)||r.startsWith("/"))return r;const s=new URLSearchParams;return s.set("id",t),s.set("path",r),n.download&&s.set("download","1"),`/api/display/file/raw?${s.toString()}`}function wU(e,t,n={}){const r=String(e||"").trim();return r?yI(r,t,n):""}function bU({className:e="",children:t}){const n=m.useRef(null),r=m.useRef(null),[s,i]=m.useState({visible:!1,top:0,height:100}),a=m.useCallback(()=>{const p=n.current;if(!p)return;const f=Math.max(1,p.scrollHeight),d=Math.max(1,p.clientHeight),h=f>d+1,y=h?Math.max(12,d/f*100):100,w=Math.max(0,100-y),b=h?Math.min(w,p.scrollTop/Math.max(1,f-d)*w):0;i({visible:h,top:b,height:y})},[]);m.useEffect(()=>{const p=requestAnimationFrame(a),f=n.current;if(!f||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(p);const d=new ResizeObserver(a);d.observe(f);for(const h of Array.from(f.children))d.observe(h);return()=>{cancelAnimationFrame(p),d.disconnect()}},[t,a]);const l=m.useCallback(p=>{const f=n.current;if(!f)return;const d=Math.max(0,f.scrollHeight-f.clientHeight);f.scrollTop=Math.min(1,Math.max(0,p))*d,a()},[a]),c=m.useCallback((p,f=0)=>{const d=r.current;if(!d)return 0;const h=d.getBoundingClientRect(),y=s.height/100*h.height,w=Math.max(1,h.height-y);return(p-h.top-f)/w},[s.height]),u=m.useCallback(p=>{if(!s.visible)return;p.preventDefault(),p.stopPropagation();const f=r.current;if(!f)return;const d=f.getBoundingClientRect(),h=s.top/100*d.height,y=s.height/100*d.height,b=p.clientY>=d.top+h&&p.clientY<=d.top+h+y?p.clientY-d.top-h:y/2;l(c(p.clientY,b));const g=x=>{x.preventDefault(),l(c(x.clientY,b))},k=()=>{window.removeEventListener("pointermove",g),window.removeEventListener("pointerup",k),window.removeEventListener("pointercancel",k)};window.addEventListener("pointermove",g),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:u,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${s.height}%`,top:`${s.top}%`}})})]})}function Cx({node:e,shareId:t,style:n,bare:r=!1}){const s=hU(e),i=e.kind==="html"?jb(s):e.kind==="react"?Fh(s):gI(s),a=e.kind==="html"?yU(i):"",l=`af-public-display-node__body--${e.kind||"unknown"}`;return o.jsxs("section",{className:`af-public-display-node af-public-display-node--${e.kind||"unknown"}${r?" af-public-display-node--bare":""}`,style:n,children:[r?null:o.jsx("div",{className:"af-public-display-node__head",children:o.jsxs("div",{className:"af-public-display-node__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:mU(e.kind)}),o.jsx("strong",{children:e.label||e.id}),o.jsx("em",{children:e.definitionId||e.kind||"display"})]})}),o.jsx(bU,{className:l,children:a?o.jsx("div",{className:"af-public-display-empty",children:a}):i.trim()?o.jsxs(o.Fragment,{children:[e.kind==="html"?o.jsx("iframe",{title:e.label||e.id,sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox",srcDoc:xU(i)}):null,e.kind==="react"?o.jsx("iframe",{title:e.label||e.id,sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox",srcDoc:xb(i)}):null,e.kind==="image"?o.jsx("img",{src:yI(i,t),alt:e.label||e.id,loading:"lazy"}):null,e.kind==="markdown"?o.jsx("div",{className:"af-public-display-markdown",children:o.jsx(fb,{content:i,resolveSrc:(c,u)=>wU(c,t,u)})}):null,e.kind==="chart"?o.jsx(hb,{content:i}):null,e.kind==="table"?o.jsx(pb,{content:i}):null,e.kind==="mermaid"||e.kind==="ascii"?o.jsx("pre",{children:i}):null]}):o.jsx("div",{className:"af-public-display-empty",children:"No display content"})})]})}function kU({data:e}){return o.jsx(Cx,{node:e==null?void 0:e.node,shareId:e==null?void 0:e.shareId})}const vU={publicDisplay:kU};function SU(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 xI(){var l,c,u,p;const{path:e}=li(),t=m.useMemo(()=>SU(e),[e]),[n,r]=m.useState({loading:!0,error:"",share:null,nodes:[]});m.useEffect(()=>{let f=!1;async function d(){if(!t){r({loading:!1,error:"Missing display share id",share:null,nodes:[]});return}r(h=>({...h,loading:!0,error:""}));try{const h=await fetch(`/api/display/share?id=${encodeURIComponent(t)}`),y=await h.json().catch(()=>({}));if(!h.ok)throw new Error(y.error||"展示页不存在");f||r({loading:!1,error:"",share:y.share||null,nodes:Array.isArray(y.nodes)?y.nodes:[]})}catch(h){f||r({loading:!1,error:String((h==null?void 0:h.message)||h),share:null,nodes:[]})}}return d(),()=>{f=!0}},[t]);const s=m.useMemo(()=>(Array.isArray(n.nodes)?n.nodes:[]).map((d,h)=>{const y=d.position&&typeof d.position.x=="number"&&typeof d.position.y=="number"?d.position:{x:120+h*40,y:100+h*32},w=d.size&&typeof d.size.width=="number"&&typeof d.size.height=="number"?d.size:{width:520,height:320};return{id:d.id,type:"publicDisplay",position:y,data:{node:d,shareId:t},selectable:!1,draggable:!1,style:{width:Math.max(1,Number(w.width)||520),height:Math.max(1,Number(w.height)||320)}}}),[t,n.nodes]),i=m.useMemo(()=>{var w;const f=(w=n.share)==null?void 0:w.viewport;if(!f||typeof f!="object")return null;const d=Number(f.x),h=Number(f.y),y=Number(f.zoom);return!Number.isFinite(d)||!Number.isFinite(h)||!Number.isFinite(y)?null:{x:d,y:h,zoom:Math.min(Math.max(y,.1),4)}},[(l=n.share)==null?void 0:l.viewport]);if(n.loading)return o.jsx("main",{className:"af-public-display-page",children:o.jsx("div",{className:"af-public-display-status",children:"Loading..."})});if(n.error)return o.jsx("main",{className:"af-public-display-page",children:o.jsxs("div",{className:"af-public-display-status af-public-display-status--error",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"error"}),o.jsx("span",{children:n.error})]})});const a=String(((c=n.share)==null?void 0:c.layout)||"").trim()||"gallery";if(a!=="canvas"){if(a==="single")return o.jsx("main",{className:"af-public-display-page af-public-display-page--single",children:o.jsx("div",{className:"af-public-display-grid",children:(n.nodes||[]).map(d=>o.jsx(Cx,{node:d,shareId:t,bare:!0},d.id))})});const f=a==="slides"?"af-public-display-page--slides":a==="document"?"af-public-display-page--document":"af-public-display-page--gallery";return o.jsxs("main",{className:`af-public-display-page ${f}`,children:[o.jsxs("header",{className:"af-public-display-hero",children:[o.jsxs("div",{children:[o.jsx("p",{children:"AgentFlow Display"}),o.jsx("h1",{children:((u=n.share)==null?void 0:u.title)||"AgentFlow Display"})]}),o.jsx("span",{children:(p=n.share)!=null&&p.expiresAt?`有效期至 ${new Date(n.share.expiresAt).toLocaleString()}`:"永久有效"})]}),o.jsx("div",{className:"af-public-display-grid",children:(n.nodes||[]).map(d=>o.jsx(Cx,{node:d,shareId:t},d.id))})]})}return o.jsx("main",{className:"af-public-display-page af-public-display-page--canvas",children:o.jsx(Gw,{children:o.jsx($A,{className:"af-public-display-flow",nodes:s,edges:[],nodeTypes:vU,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(OA,{color:"rgba(255,255,255,0.12)",gap:22,size:1})})})})}const ht=e=>typeof e=="string",Ic=()=>{let e,t;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n},xj=e=>e==null?"":""+e,NU=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},jU=/###/g,wj=e=>e&&e.indexOf("###")>-1?e.replace(jU,"."):e,bj=e=>!e||ht(e),cu=(e,t,n)=>{const r=ht(t)?t.split("."):t;let s=0;for(;s<r.length-1;){if(bj(e))return{};const i=wj(r[s]);!e[i]&&n&&(e[i]=new n),Object.prototype.hasOwnProperty.call(e,i)?e=e[i]:e={},++s}return bj(e)?{}:{obj:e,k:wj(r[s])}},kj=(e,t,n)=>{const{obj:r,k:s}=cu(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=cu(e,a,Object);for(;l.obj===void 0&&a.length;)i=`${a[a.length-1]}.${i}`,a=a.slice(0,a.length-1),l=cu(e,a,Object),l&&l.obj&&typeof l.obj[`${l.k}.${i}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${i}`]=n},CU=(e,t,n,r)=>{const{obj:s,k:i}=cu(e,t,Object);s[i]=s[i]||[],s[i].push(n)},Gp=(e,t)=>{const{obj:n,k:r}=cu(e,t);if(n)return n[r]},_U=(e,t,n)=>{const r=Gp(e,n);return r!==void 0?r:Gp(t,n)},wI=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?ht(e[r])||e[r]instanceof String||ht(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):wI(e[r],t[r],n):e[r]=t[r]);return e},Ua=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var EU={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const AU=e=>ht(e)?e.replace(/[&<>"'\/]/g,t=>EU[t]):e;class PU{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 IU=[" ",",","?","!",";"],TU=new PU(20),RU=(e,t,n)=>{t=t||"",n=n||"";const r=IU.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const s=TU.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},_x=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},Jp=e=>e&&e.replace("_","-"),MU={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 Xp{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||MU,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"log","",!0)}warn(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","",!0)}error(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"error","")}deprecate(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this.forward(n,"warn","WARNING DEPRECATED: ",!0)}forward(t,n,r,s){return s&&!this.debug?null:(ht(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Xp(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Xp(this.logger,t)}}var ei=new Xp;class Hh{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 u=0;u<c;u++)l(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(a=>{let[l,c]=a;for(let u=0;u<c;u++)l.apply(l,[t,...r])})}}class vj extends Hh{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,a=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;t.indexOf(".")>-1?l=t.split("."):(l=[t,n],r&&(Array.isArray(r)?l.push(...r):ht(r)&&i?l.push(...r.split(i)):l.push(r)));const c=Gp(this.data,l);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=l[0],n=l[1],r=l.slice(2).join(".")),c||!a||!ht(r)?c:_x(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),kj(this.data,l,s),i.silent||this.emit("added",t,n,r,s)}addResources(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const i in r)(ht(r[i])||Array.isArray(r[i]))&&this.addResource(t,n,i,r[i],{silent:!0});s.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,s,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},l=[t,n];t.indexOf(".")>-1&&(l=t.split("."),s=r,r=n,n=l[1]),this.addNamespaces(n);let c=Gp(this.data,l)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?wI(c,r,i):c={...c,...r},kj(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 bI={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 Sj={};class Qp extends Hh{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),NU(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=ei.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&&!RU(t,r,s);if(a&&!l){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:ht(i)?[i]:i};const u=t.split(r);(r!==s||r===s&&this.options.ns.indexOf(u[0])>-1)&&(i=u.shift()),t=u.join(s)}return{key:t,namespaces:ht(i)?[i]:i}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const s=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(t[t.length-1],n),c=l[l.length-1],u=n.lng||this.language,p=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(p){const S=n.nsSeparator||this.options.nsSeparator;return s?{res:`${c}${S}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${S}${a}`}return s?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:a}const f=this.resolve(t,n);let d=f&&f.res;const h=f&&f.usedKey||a,y=f&&f.exactUsedKey||a,w=Object.prototype.toString.apply(d),b=["[object Number]","[object Function]","[object RegExp]"],g=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,k=!this.i18nFormat||this.i18nFormat.handleAsObject,x=!ht(d)&&typeof d!="boolean"&&typeof d!="number";if(k&&d&&x&&b.indexOf(w)<0&&!(ht(g)&&Array.isArray(d))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const S=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,d,{...n,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return s?(f.res=S,f.usedParams=this.getUsedParamsDetails(n),f):S}if(i){const S=Array.isArray(d),C=S?[]:{},j=S?y:h;for(const E in d)if(Object.prototype.hasOwnProperty.call(d,E)){const A=`${j}${i}${E}`;C[E]=this.translate(A,{...n,joinArrays:!1,ns:l}),C[E]===A&&(C[E]=d[E])}d=C}}else if(k&&ht(g)&&Array.isArray(d))d=d.join(g),d&&(d=this.extendTranslation(d,t,n,r));else{let S=!1,C=!1;const j=n.count!==void 0&&!ht(n.count),E=Qp.hasDefaultValue(n),A=j?this.pluralResolver.getSuffix(u,n.count,n):"",O=n.ordinal&&j?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",W=j&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),H=W&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${A}`]||n[`defaultValue${O}`]||n.defaultValue;!this.isValidLookup(d)&&E&&(S=!0,d=H),this.isValidLookup(d)||(C=!0,d=a);const R=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&C?void 0:d,T=E&&H!==d&&this.options.updateMissing;if(C||S||T){if(this.logger.log(T?"updateKey":"missingKey",u,c,a,T?H:d),i){const I=this.resolve(a,{...n,keySeparator:!1});I&&I.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 V=[];const F=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&F&&F[0])for(let I=0;I<F.length;I++)V.push(F[I]);else this.options.saveMissingTo==="all"?V=this.languageUtils.toResolveHierarchy(n.lng||this.language):V.push(n.lng||this.language);const M=(I,B,_)=>{const q=E&&_!==d?_:R;this.options.missingKeyHandler?this.options.missingKeyHandler(I,c,B,q,T,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(I,c,B,q,T,n),this.emit("missingKey",I,c,B,d)};this.options.saveMissing&&(this.options.saveMissingPlurals&&j?V.forEach(I=>{const B=this.pluralResolver.getSuffixes(I,n);W&&n[`defaultValue${this.options.pluralSeparator}zero`]&&B.indexOf(`${this.options.pluralSeparator}zero`)<0&&B.push(`${this.options.pluralSeparator}zero`),B.forEach(_=>{M([I],a+_,n[`defaultValue${_}`]||H)})}):M(V,a,H))}d=this.extendTranslation(d,t,n,f,r),C&&d===a&&this.options.appendNamespaceToMissingKey&&(d=`${c}:${a}`),(C||S)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?d=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}:${a}`:a,S?d:void 0):d=this.options.parseMissingKeyHandler(d))}return s?(f.res=d,f.usedParams=this.getUsedParamsDetails(n),f):d}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 u=ht(t)&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let p;if(u){const d=t.match(this.interpolator.nestingRegexp);p=d&&d.length}let f=r.replace&&!ht(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(f={...this.options.interpolation.defaultVariables,...f}),t=this.interpolator.interpolate(t,f,r.lng||this.language||s.usedLng,r),u){const d=t.match(this.interpolator.nestingRegexp),h=d&&d.length;p<h&&(r.nest=!1)}!r.lng&&this.options.compatibilityAPI!=="v1"&&s&&s.res&&(r.lng=this.language||s.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var d=arguments.length,h=new Array(d),y=0;y<d;y++)h[y]=arguments[y];return i&&i[0]===h[0]&&!r.context?(a.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${n[0]}`),null):a.translate(...h,n)},r)),r.interpolation&&this.interpolator.reset()}const l=r.postProcess||this.options.postProcess,c=ht(l)?[l]:l;return t!=null&&c&&c.length&&r.applyPostProcessor!==!1&&(t=bI.handle(c,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,s,i,a,l;return ht(t)&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(c,n),p=u.key;s=p;let f=u.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const d=n.count!==void 0&&!ht(n.count),h=d&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),y=n.context!==void 0&&(ht(n.context)||typeof n.context=="number")&&n.context!=="",w=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);f.forEach(b=>{this.isValidLookup(r)||(l=b,!Sj[`${w[0]}-${b}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&(Sj[`${w[0]}-${b}`]=!0,this.logger.warn(`key "${s}" for languages "${w.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!!!")),w.forEach(g=>{if(this.isValidLookup(r))return;a=g;const k=[p];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(k,p,g,b,n);else{let S;d&&(S=this.pluralResolver.getSuffix(g,n.count,n));const C=`${this.options.pluralSeparator}zero`,j=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(d&&(k.push(p+S),n.ordinal&&S.indexOf(j)===0&&k.push(p+S.replace(j,this.options.pluralSeparator)),h&&k.push(p+C)),y){const E=`${p}${this.options.contextSeparator}${n.context}`;k.push(E),d&&(k.push(E+S),n.ordinal&&S.indexOf(j)===0&&k.push(E+S.replace(j,this.options.pluralSeparator)),h&&k.push(E+C))}}let x;for(;x=k.pop();)this.isValidLookup(r)||(i=x,r=this.getResource(g,b,x,n))}))})}),{res:r,usedKey:s,exactUsedKey:i,usedLng:a,usedNS:l}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,s):this.resourceStore.getResource(t,n,r,s)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!ht(t.replace);let s=r?t.replace:t;if(r&&typeof t.count<"u"&&(s.count=t.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!r){s={...s};for(const i of n)delete s[i]}return s}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}const _g=e=>e.charAt(0).toUpperCase()+e.slice(1);class Nj{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ei.create("languageUtils")}getScriptPartFromCode(t){if(t=Jp(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=Jp(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(ht(t)&&t.indexOf("-")>-1){if(typeof Intl<"u"&&typeof Intl.getCanonicalLocales<"u")try{let s=Intl.getCanonicalLocales(t)[0];if(s&&this.options.lowerCaseLng&&(s=s.toLowerCase()),s)return s}catch{}const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(s=>s.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=_g(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]=_g(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=_g(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const s=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(s))&&(n=s)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const s=this.getLanguagePartFromCode(r);if(this.isSupportedCode(s))return n=s;n=this.options.supportedLngs.find(i=>{if(i===s)return i;if(!(i.indexOf("-")<0&&s.indexOf("-")<0)&&(i.indexOf("-")>0&&s.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===s||i.indexOf(s)===0&&s.length>1))return i})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),ht(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),s=[],i=a=>{a&&(this.isSupportedCode(a)?s.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return ht(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(t))):ht(t)&&i(this.formatLanguageCode(t)),r.forEach(a=>{s.indexOf(a)<0&&i(this.formatLanguageCode(a))}),s}}let $U=[{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}],LU={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 OU=["v1","v2","v3"],DU=["v4"],jj={zero:0,one:1,two:2,few:3,many:4,other:5},FU=()=>{const e={};return $U.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:LU[t.fc]}})}),e};class zU{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=ei.create("pluralResolver"),(!this.options.compatibilityJSON||DU.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=FU(),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=Jp(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)=>jj[s]-jj[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!OU.includes(this.options.compatibilityJSON)}}const Cj=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=_U(e,t,n);return!i&&s&&ht(n)&&(i=_x(e,n,r),i===void 0&&(i=_x(t,n,r))),i},Eg=e=>e.replace(/\$/g,"$$$$");class BU{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=ei.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:u,unescapeSuffix:p,unescapePrefix:f,nestingPrefix:d,nestingPrefixEscaped:h,nestingSuffix:y,nestingSuffixEscaped:w,nestingOptionsSeparator:b,maxReplaces:g,alwaysFormat:k}=t.interpolation;this.escape=n!==void 0?n:AU,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=i?Ua(i):a||"{{",this.suffix=l?Ua(l):c||"}}",this.formatSeparator=u||",",this.unescapePrefix=p?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":p||"",this.nestingPrefix=d?Ua(d):h||Ua("$t("),this.nestingSuffix=y?Ua(y):w||Ua(")"),this.nestingOptionsSeparator=b||",",this.maxReplaces=g||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||{},u=h=>{if(h.indexOf(this.formatSeparator)<0){const g=Cj(n,c,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(g,void 0,r,{...s,...n,interpolationkey:h}):g}const y=h.split(this.formatSeparator),w=y.shift().trim(),b=y.join(this.formatSeparator).trim();return this.format(Cj(n,c,w,this.options.keySeparator,this.options.ignoreJSONStructure),b,r,{...s,...n,interpolationkey:w})};this.resetRegExp();const p=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,f=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>Eg(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?Eg(this.escape(h)):Eg(h)}].forEach(h=>{for(l=0;i=h.regex.exec(t);){const y=i[1].trim();if(a=u(y),a===void 0)if(typeof p=="function"){const b=p(t,i,s);a=ht(b)?b:""}else if(s&&Object.prototype.hasOwnProperty.call(s,y))a="";else if(f){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${y} for interpolating ${t}`),a="";else!ht(a)&&!this.useRawValueToEscape&&(a=xj(a));const w=h.safeValue(a);if(t=t.replace(i[0],w),f?(h.regex.lastIndex+=a.length,h.regex.lastIndex-=i[0].length):h.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,i,a;const l=(c,u)=>{const p=this.nestingOptionsSeparator;if(c.indexOf(p)<0)return c;const f=c.split(new RegExp(`${p}[ ]*{`));let d=`{${f[1]}`;c=f[0],d=this.interpolate(d,a);const h=d.match(/'/g),y=d.match(/"/g);(h&&h.length%2===0&&!y||y.length%2!==0)&&(d=d.replace(/'/g,'"'));try{a=JSON.parse(d),u&&(a={...u,...a})}catch(w){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,w),`${c}${p}${d}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,c};for(;s=this.nestingRegexp.exec(t);){let c=[];a={...r},a=a.replace&&!ht(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let u=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){const p=s[1].split(this.formatSeparator).map(f=>f.trim());s[1]=p.shift(),c=p,u=!0}if(i=n(l.call(this,s[1].trim(),a),a),i&&s[0]===t&&!ht(i))return i;ht(i)||(i=xj(i)),i||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),i=""),u&&(i=c.reduce((p,f)=>this.format(p,f,r.lng,{...r,interpolationkey:s[1].trim()}),i.trim())),t=t.replace(s[0],i),this.regexp.lastIndex=0}return t}}const HU=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(":"),u=c.join(":").trim().replace(/^'+|'+$/g,""),p=l.trim();n[p]||(n[p]=u),u==="false"&&(n[p]=!1),u==="true"&&(n[p]=!0),isNaN(u)||(n[p]=parseInt(u,10))}})}return{formatName:t,formatOptions:n}},qa=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(Jp(r),s),t[a]=l),l(n)}};class WU{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=ei.create("formatter"),this.options=t,this.formats={number:qa((n,r)=>{const s=new Intl.NumberFormat(n,{...r});return i=>s.format(i)}),currency:qa((n,r)=>{const s=new Intl.NumberFormat(n,{...r,style:"currency"});return i=>s.format(i)}),datetime:qa((n,r)=>{const s=new Intl.DateTimeFormat(n,{...r});return i=>s.format(i)}),relativetime:qa((n,r)=>{const s=new Intl.RelativeTimeFormat(n,{...r});return i=>s.format(i,r.range||"day")}),list:qa((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()]=qa(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:u,formatOptions:p}=HU(c);if(this.formats[u]){let f=l;try{const d=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},h=d.locale||d.lng||s.locale||s.lng||r;f=this.formats[u](l,h,{...p,...s,...d})}catch(d){this.logger.warn(d)}return f}else this.logger.warn(`there was no format function for ${u}`);return l},t)}}const VU=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class KU extends Hh{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=ei.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(u=>{let p=!0;n.forEach(f=>{const d=`${u}|${f}`;!r.reload&&this.store.hasResourceBundle(u,f)?this.state[d]=2:this.state[d]<0||(this.state[d]===1?a[d]===void 0&&(a[d]=!0):(this.state[d]=1,p=!1,a[d]===void 0&&(a[d]=!0),i[d]===void 0&&(i[d]=!0),c[f]===void 0&&(c[f]=!0)))}),p||(l[u]=!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=>{CU(c.loaded,[i],a),VU(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(u=>{l[u]||(l[u]={});const p=c.loaded[u];p.length&&p.forEach(f=>{l[u][f]===void 0&&(l[u][f]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!t.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:s,wait:i,callback:a});return}this.readingCalls++;const l=(u,p)=>{if(this.readingCalls--,this.waitingReads.length>0){const f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.callback)}if(u&&p&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,s+1,i*2,a)},i);return}a(u,p)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const u=c(t,n);u&&typeof u.then=="function"?u.then(p=>l(null,p)).catch(l):l(null,u)}catch(u){l(u)}return}return c(t,n,l)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();ht(t)&&(t=this.languageUtils.toResolveHierarchy(t)),ht(n)&&(n=[n]);const i=this.queueLoad(t,n,r,s);if(!i.toLoad.length)return i.pending.length||s(),null;i.toLoad.forEach(a=>{this.loadOne(a)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),s=r[0],i=r[1];this.read(s,i,"read",void 0,void 0,(a,l)=>{a&&this.logger.warn(`${n}loading namespace ${i} for language ${s} failed`,a),!a&&l&&this.logger.log(`${n}loaded namespace ${i} for language ${s}`,l),this.loaded(t,a,l)})}saveMissing(t,n,r,s,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},l=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const c={...a,isUpdate:i},u=this.backend.create.bind(this.backend);if(u.length<6)try{let p;u.length===5?p=u(t,n,r,s,c):p=u(t,n,r,s),p&&typeof p.then=="function"?p.then(f=>l(null,f)).catch(l):l(null,p)}catch(p){l(p)}else u(t,n,r,s,l,c)}!t||!t[0]||this.store.addResource(t[0],n,r,s)}}}const _j=()=>({debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:e=>{let t={};if(typeof e[1]=="object"&&(t=e[1]),ht(e[1])&&(t.defaultValue=e[1]),ht(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),Ej=e=>(ht(e.ns)&&(e.ns=[e.ns]),ht(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),ht(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Nf=()=>{},UU=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Vu extends Hh{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=Ej(t),this.services={},this.logger=ei,this.modules={external:[]},UU(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;this.isInitializing=!0,typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(ht(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const s=_j();this.options={...s,...this.options,...Ej(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...s.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const i=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?ei.init(i(this.modules.logger),this.options):ei.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:typeof Intl<"u"&&(p=WU);const f=new Nj(this.options);this.store=new vj(this.options.resources,this.options);const d=this.services;d.logger=ei,d.resourceStore=this.store,d.languageUtils=f,d.pluralResolver=new zU(f,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),p&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(d.formatter=i(p),d.formatter.init(d,this.options),this.options.interpolation.format=d.formatter.format.bind(d.formatter)),d.interpolator=new BU(this.options),d.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},d.backendConnector=new KU(i(this.modules.backend),d.resourceStore,d,this.options),d.backendConnector.on("*",function(h){for(var y=arguments.length,w=new Array(y>1?y-1:0),b=1;b<y;b++)w[b-1]=arguments[b];t.emit(h,...w)}),this.modules.languageDetector&&(d.languageDetector=i(this.modules.languageDetector),d.languageDetector.init&&d.languageDetector.init(d,this.options.detection,this.options)),this.modules.i18nFormat&&(d.i18nFormat=i(this.modules.i18nFormat),d.i18nFormat.init&&d.i18nFormat.init(this)),this.translator=new Qp(this.services,this.options),this.translator.on("*",function(h){for(var y=arguments.length,w=new Array(y>1?y-1:0),b=1;b<y;b++)w[b-1]=arguments[b];t.emit(h,...w)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Nf),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(p=>{this[p]=function(){return t.store[p](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=function(){return t.store[p](...arguments),t}});const c=Ic(),u=()=>{const p=(f,d)=>{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(d),r(f,d)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),c}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Nf;const s=ht(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(s&&s.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const i=[],a=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(u=>{u!=="cimode"&&i.indexOf(u)<0&&i.push(u)})};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=Ic();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=Nf),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"&&bI.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=Ic();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,u)=>{u?(i(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):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 u=ht(c)?c:this.services.languageUtils.getBestMatchFromCodes(c);u&&(this.language||i(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,p=>{a(p,u)})};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 u=arguments.length,p=new Array(u>2?u-2:0),f=2;f<u;f++)p[f-2]=arguments[f];c=s.options.overloadTranslationOptionHandler([a,l].concat(p))}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 d=s.options.keySeparator||".";let h;return c.keyPrefix&&Array.isArray(a)?h=a.map(y=>`${c.keyPrefix}${d}${y}`):h=c.keyPrefix?`${c.keyPrefix}${d}${a}`:a,s.t(h,c)};return ht(t)?i.lng=t:i.lngs=t,i.ns=n,i.keyPrefix=r,i}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(l,c)=>{const u=this.services.backendConnector.state[`${l}|${c}`];return u===-1||u===0||u===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=Ic();return this.options.ns?(ht(t)&&(t=[t]),t.forEach(s=>{this.options.ns.indexOf(s)<0&&this.options.ns.push(s)}),this.loadResources(s=>{r.resolve(),n&&n(s)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=Ic();ht(t)&&(t=[t]);const s=this.options.preload||[],i=t.filter(a=>s.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return i.length?(this.options.preload=s.concat(i),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new Nj(_j());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 Vu(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Nf;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},i=new Vu(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 vj(this.store.data,s),i.services.resourceStore=i.store),i.translator=new Qp(i.services,s),i.translator.on("*",function(l){for(var c=arguments.length,u=new Array(c>1?c-1:0),p=1;p<c;p++)u[p-1]=arguments[p];i.emit(l,...u)}),i.init(s,n),i.translator.options=s,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const sr=Vu.createInstance();sr.createInstance=Vu.createInstance;sr.createInstance;sr.dir;sr.init;sr.loadResources;sr.reloadResources;sr.use;sr.changeLanguage;sr.getFixedT;sr.t;sr.exists;sr.setDefaultNamespace;sr.hasLoadedNamespace;sr.loadNamespaces;sr.loadLanguages;function qU(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ku(e){"@babel/helpers - typeof";return Ku=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},Ku(e)}function YU(e,t){if(Ku(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(Ku(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function GU(e){var t=YU(e,"string");return Ku(t)=="symbol"?t:t+""}function JU(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,GU(r.key),r)}}function XU(e,t,n){return t&&JU(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var kI=[],QU=kI.forEach,ZU=kI.slice;function eq(e){return QU.call(ZU.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var Aj=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,tq=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(!Aj.test(s.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(s.domain)}if(s.path){if(!Aj.test(s.path))throw new TypeError("option path is invalid");a+="; Path=".concat(s.path)}if(s.expires){if(typeof s.expires.toUTCString!="function")throw new TypeError("option expires is invalid");a+="; Expires=".concat(s.expires.toUTCString())}if(s.httpOnly&&(a+="; HttpOnly"),s.secure&&(a+="; Secure"),s.sameSite){var c=typeof s.sameSite=="string"?s.sameSite.toLowerCase():s.sameSite;switch(c){case!0:a+="; SameSite=Strict";break;case"lax":a+="; SameSite=Lax";break;case"strict":a+="; SameSite=Strict";break;case"none":a+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return a},Pj={create:function(t,n,r,s){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+r*60*1e3)),s&&(i.domain=s),document.cookie=tq(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)}},nq={name:"cookie",lookup:function(t){var n;if(t.lookupCookie&&typeof document<"u"){var r=Pj.read(t.lookupCookie);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupCookie&&typeof document<"u"&&Pj.create(n.lookupCookie,t,n.cookieMinutes,n.cookieDomain,n.cookieOptions)}},rq={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}},Tc=null,Ij=function(){if(Tc!==null)return Tc;try{Tc=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Tc=!1}return Tc},sq={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&Ij()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&Ij()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},Rc=null,Tj=function(){if(Rc!==null)return Rc;try{Rc=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Rc=!1}return Rc},iq={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&Tj()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&Tj()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},oq={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}},aq={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}},lq={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}},cq={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]}},vI=!1;try{document.cookie,vI=!0}catch{}var SI=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];vI||SI.splice(1,1);function uq(){return{order:SI,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var NI=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};qU(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return XU(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=eq(r,this.options||{},uq()),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(nq),this.addDetector(rq),this.addDetector(sq),this.addDetector(iq),this.addDetector(oq),this.addDetector(aq),this.addDetector(lq),this.addDetector(cq)}},{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)}))}}])}();NI.type="languageDetector";const dq={name:"AgentFlow",tagline:"AI Workflow Orchestration"},fq={projects:"Projects",nodes:"Nodes",myNodes:"My Nodes",myFlows:"My Flows",skills:"Skills",mcps:"MCP",feedback:"Feedback",flowEditor:"Flow Editor",settings:"Settings",back:"Back"},pq={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"},hq={success:"Success",failed:"Failed",pending:"Pending",running:"Running",skipped:"Skipped"},mq={agent:"Agent",control:"Control",tool:"Tool",start:"Start",end:"End"},gq={online:"Engine Online",offline:"Engine Offline",connecting:"Connecting…"},yq={hub:"AgentFlow Hub",docs:"Documentation",github:"GitHub Repository"},xq={app:dq,nav:fq,common:pq,status:hq,nodeTypes:mq,engine:gq,links:yq},wq="Flow Editor",bq="Nodes",kq="Edges",vq="Properties",Sq={label:"Node Label",type:"Node Type",model:"Model",body:"Body",inputs:"Inputs",outputs:"Outputs",addInput:"Add Input",addOutput:"Add Output",remove:"Remove Node",duplicate:"Duplicate Node",nodeType:"Node Type",displayName:"Display Name",displayNameHint:"(letters, numbers, underscores, hyphens, do not start with a number)",role:"Role",modelHint:"From ~/agentflow/model-lists.json; UI service runs agentflow update-model-lists in background on startup",defaultModel:"Default",userPrompt:"User Prompt (USER PROMPT / body)",systemDescription:"System Description (read-only, from node definition)",directCommand:"Direct Command (script)",scriptHint:"(tool_nodejs: skips AI when script exists, executed by pipeline)",diskRunning:"Disk record shows running",deleteNode:"Delete node",inputTooltip:"Input {{name}} | Type: {{type}}",outputTooltip:"Output {{name}} | Type: {{type}}",defaultSuffix:" | Default: {{value}}",fallbackLabel:"Node",expandProvide:"Edit content"},Nq={title:"Node Properties",noInputPins:"No input pins",noOutputPins:"No output pins",type:"Type",name:"Name",defaultValue:"Default / value",description:"Description / format",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",pinDescriptionAriaLabel:"{{label}} {{index}} format description",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}}"},jq={run:"Run Flow",stop:"Stop",resume:"Resume",validate:"Validate",export:"Export",import:"Import"},Cq={nodeList:"Node List",runHistory:"Run History",validation:"Validation Results"},_q={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"},Eq={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)"},Aq={saving:"Saving...",saved:"Saved",saveFailed:"Save failed",runInTerminal:"Please use terminal to run"},Pq={requirement:"Requirement Analysis",planning:"Technical Planning",code:"Code Execution",test:"Test Regression",normal:"Normal"},Iq={phase:"Phase",allPhasesComplete:"All phases completed",currentPhaseComplete:"Current phase completed, waiting for confirmation..."},Tq={node:"Node",text:"Text",file:"File",bool:"Boolean"},Rq={title:"Node Execution Context",resizeHandle:"Drag to resize node context width",apiConnectError:"Cannot connect to API (please open the page with agentflow ui, or configure /api proxy for Vite dev)",invalidJson:"Response is not valid JSON",requestTimeout:"Request timed out, please retry or check agentflow ui",executingNoArtifacts:"Executing, artifacts not yet written to workspace…",noData:"No data (this run has not reached this node or produced artifacts)",latest:"Latest",detectedContentType:"Detected content type",roundNoContent:"No content in this round",empty:"(empty)",imageTruncated:"Image truncated (exceeds size limit)",statusSuccess:"Success",statusFailed:"Failed",statusRunning:"Running",statusCacheMiss:"Cache miss",statusPending:"Pending"},Mq={title:"Keyboard Shortcuts",general:"General",saveDesc:"Save; when node properties sidebar is open, submit node first then save flow",shortcutsLabel:"Keyboard Shortcuts",jumpToNode:"Jump to node by ID",openNodePalette:"Open node palette",canvas:"Canvas",selectTool:"Select Tool",panTool:"Pan Tool",holdSpacePan:"Hold Space to temporarily pan",saveViewport:"Save current entry view",selectAll:"Select all nodes",undo:"Undo canvas change",redo:"Redo canvas change"},$q={title:"Jump to node",placeholder:"Type node ID or label…",empty:"No matching nodes",hintNavigate:"navigate",hintJump:"jump",hintClose:"close"},Lq={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."},Oq={mainNav:"Main Navigation"},Dq={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'},Fq={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):
|
|
276
|
-
{{summary}}`,step:"Step {{current}}/{{total}}: {{description}}",phaseGeneration:`Phased generation ({{count}} phases): {{labels}}
|
|
277
|
-
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}}"},zq={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"},Bq={nodePalette:"Node Palette",noPipelineSelected:"No pipeline selected",moreRuns:"+{{count}} more",moreFlows:"+{{count}} more flows",runId:"Run ID: {{id}}"},Hq={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}}"},Wq={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"},Vq={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"},Kq={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"},Uq={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"},qq={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"},Yq={invalidPlaceholder:"Invalid placeholder: {{hint}}",empty:"(empty)",inputSubtitle:"Input · {{type}}",inputSubtitleNoType:"Input",outputSubtitle:"Output · {{type}}",outputSubtitleNoType:"Output",runtimeConst:"Runtime constant"},Gq={justNow:"Just now",minutesAgo:"{{n}} min ago",hoursAgo:"{{n}} hr ago",yesterday:"Yesterday",daysAgo:"{{n}} days ago",milliseconds:"{{n}} ms",seconds:"{{n}} s"},Jq={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"},Xq={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."},Qq={title:"Print Output: {{instanceId}}",expand:"Expand",restore:"Restore"},Zq={save:"Save",cancel:"Cancel"},eY={title:"Run with Params",noParams:"No input params in this flow",run:"Run",cancel:"Cancel"},tY={title:"Run with Preset",noPresets:"No presets available",default:"Default run",run:"Run",cancel:"Cancel"},nY={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"},rY={title:wq,nodes:bq,edges:kq,properties:vq,node:Sq,nodeProps:Nq,actions:jq,panel:Cq,palette:_q,pipeline:Eq,status:Aq,roles:Pq,phases:Iq,types:Tq,runContext:Rq,shortcuts:Mq,jumpPalette:$q,emptyCanvas:Lq,sidebar:Oq,validation:Dq,composer:Fq,topbar:zq,palette2:Bq,run:Hq,fileEdit:Wq,settings:Vq,schedule:Kq,history:Uq,nodePropsError:qq,placeholder:Yq,time:Gq,userCheck:Jq,userAsk:Xq,toolPrint:Qq,provideEdit:Zq,runParams:eY,runPreset:tY,runConfig:nY},sY="Settings",iY={engine:"Engine Settings",preferences:"Global Preferences"},oY={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)."},aY={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..."}},lY={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."},cY={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."},uY={title:"Codex CLI",status:{ready:"Ready",notFound:"Not found"},modelPreviewLabel:"Codex model id list",description:"Model list comes from codex debug models --bundled. Run 'codex login' first."},dY={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)"},fY={title:"User Allowlist",description:"Only controls which usernames may register or sign in. Users set their own password on first sign-in.",enabled:"Allowlist enabled",open:"Open registration",refreshing:"Refreshing...",saving:"Saving...",file:"File",fileList:"File allowlist",envList:"Environment allowlist",readonly:"Read-only",userCount:"{{count}} users",remove:"Remove {{username}}",emptyFile:"No file allowlist configured. If env allowlist is also empty, every username can register.",emptyEnv:"AGENTFLOW_USER_WHITELIST / AGENTFLOW_ALLOWED_USERS is not configured",unionHint:"The file allowlist and env allowlist are combined. This only stores usernames, never passwords.",add:"Add"},pY={title:"System Status",normal:"Service normal",abnormal:"Some interfaces abnormal",cursorModels:"Cursor Models",opencodeModels:"OpenCode Models",claudeCodeModels:"Claude Code Models",codexModels:"Codex Models"},hY={title:"Shortcuts",projects:"Projects & Pipelines",flowEditor:"Node Canvas"},mY={title:"Language",description:"Select your preferred language for the interface",options:{zh:"中文",en:"English",ja:"日本語"}},gY={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."},yY={title:sY,crumb:iY,workspace:oY,cursor:aY,opencode:lY,claudeCode:cY,codex:uY,env:dY,allowlist:fY,system:pY,shortcuts:hY,language:mY,onboarding:gY},xY={thinking:"Thinking",result:"Result",reply:"Reply",error:"Error"},wY={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)"},bY={send:"Send",stop:"Stop",expand:"Expand",collapse:"Collapse",clear:"Clear"},kY={conversation:"Chat",conversationWithNumber:"Chat {{num}}",default:"Default"},vY={endSession:"End chat (will stop generation)",closeSession:"Close chat",newSession:"New chat",expandComposer:"Expand chat and output"},SY={hint:"Use the bottom input box for AI chat, with @node mentions, model selection, and more"},NY={aiLabels:xY,placeholders:wY,actions:bY,labels:kY,tooltips:vY,rightPanel:SY},jY="Projects",CY="All",_Y="Archived",EY="Nodes",AY="My Nodes",PY="My Flows",IY="Skills",TY="Active Projects",RY="Archived Pipelines",MY="Global Nodes",$Y="All Nodes",LY="My Nodes",OY="Manage node versions published to the current workspace marketplace, {{count}} total.",DY="Manage flow snippets published to the current workspace marketplace, {{count}} total.",FY="Global Skills",zY="Create New Project",BY="New Pipeline",HY="SEARCH PIPELINES...",WY="SEARCH NODES...",VY="SEARCH FLOW SNIPPETS...",KY="SEARCH SKILLS...",UY="Refresh Resources",qY="Loading pipelines...",YY="Loading global resources...",GY="Filter result: {{count}} items (matching title, description, path and tags)",JY="Archived pipelines can still be opened and edited; files are located in the _archived subdirectory of each pipelines directory.",XY="Manage your distributed node architectures and monitoring pipelines. Drag flow.yaml or .zip into this page to import shared flows.",QY="Review all globally available node definitions, {{count}} total, including built-in, workspace, and marketplace nodes.",ZY="Review Composer-selectable skills, {{count}} total, including AgentFlow built-ins and workspace skills.",eG="Executable building blocks for pipeline runtime",tG="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.",nG="Published local node packages",rG="Only node versions published to this workspace marketplace appear here. Inspect details and delete versions that no flow uses.",sG="Published flow snippets",iG="Flow snippets published from Pipeline or Workspace canvases appear here. Search and inspect them, then load them from the canvas flow palette.",oG="Operating guides for Composer and agents",aG="Skills tell AI which rules to follow for a task, how to change flows, and how to reuse project conventions.",lG="No archived projects.",cG="No active pipelines; archived items are in the Archived tab.",uG="No global nodes available.",dG="No marketplace nodes have been published.",fG="No flow snippets have been published. Select multiple canvas nodes and publish them first.",pG="No skills available.",hG="No description.",mG='No node matches "{{query}}".',gG='No flow snippet matches "{{query}}".',yG='No skill matches "{{query}}".',xG="{{inputs}} in / {{outputs}} out",wG="Flow Snippet",bG="{{nodes}} nodes / {{edges}} edges",kG="Skill",vG="Node detail",SG="Flow snippet detail",NG="Skill detail",jG="Type",CG="Source",_G="Package",EG="Version",AG="Path",PG="Editable",IG="Read only",TG="Editable",RG="Schema",MG="Inputs",$G="Outputs",LG="Runtime",OG="Node Body",DG="Files",FG="Usage",zG="No runtime manifest.",BG="No node body or README.",HG="No previewable files.",WG="Select a file to preview.",VG="Binary file preview is not supported.",KG="Large file; showing the first 256KB only.",UG="No pipelines using this node were found.",qG="Node Management",YG="Delete Node Version",GG="Deleting...",JG="AgentFlow checks all flow references before deleting; installed or used versions are kept.",XG="Delete {{id}}@{{version}}? This cannot be undone.",QG="Deleted {{id}}@{{version}}.",ZG="{{count}} flow(s) still use it.",eJ="Flow Snippet Management",tJ="Delete Flow Snippet",nJ="Deleting...",rJ="Deleting it only removes this reusable marketplace snippet. Nodes already loaded onto canvases are not changed.",sJ="Delete {{id}}@{{version}}? This cannot be undone.",iJ="Deleted {{id}}@{{version}}.",oJ="No slots",aJ="Purpose",lJ="This node is an execution unit in a pipeline. Its schema affects canvas wiring, parameter input, and runtime scheduling.",cJ="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.",uJ="Scale",dJ="Flow Preview",fJ="Edges",pJ="Snippet JSON",hJ="{{count}} more edge(s)",mJ="No previewable nodes.",gJ="This skill is injected into Composer as context for AI, constraining its decisions, edit strategy, and output format.",yJ="SKILL.md Preview",xJ="No preview content available.",wJ="Select a resource to inspect details.",bJ="Failed to load pipeline list.",kJ="No pipelines in current workspace.",vJ="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.",SJ='No pipelines found matching "{{query}}". Try different keywords or clear the search.',NJ="Recent Activity",jJ="No recent activity",CJ="No recent activity matching the keyword",_J="Recent Run",EJ="Recent Open",AJ={builtin:"Built-in",workspace:"Workspace",user:"User"},PJ={flow:"Flow",global:"Global",marketplace:"Marketplace"},IJ={all:"All",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},TJ={overview:"Overview",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},RJ="Open to edit this pipeline in the node canvas.",MJ={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>"},$J={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"},LJ={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"},OJ={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"},DJ={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"},FJ={title:jY,all:CY,archived:_Y,nodes:EY,myNodes:AY,myFlows:PY,skills:IY,activeProjects:TY,archivedPipelines:RY,globalNodes:MY,nodeScopeAll:$Y,nodeScopeMine:LY,myNodesHint:OY,myFlowsHint:DY,globalSkills:FY,createNew:zY,newPipeline:BY,searchPipelines:HY,searchNodes:WY,searchFlows:VY,searchSkills:KY,refreshResources:UY,loadingPipelines:qY,loadingResources:YY,filterResult:GY,archivedHint:JY,activeHint:XY,nodesHint:QY,skillsHint:ZY,nodesPurposeTitle:eG,nodesPurposeDesc:tG,myNodesPurposeTitle:nG,myNodesPurposeDesc:rG,myFlowsPurposeTitle:sG,myFlowsPurposeDesc:iG,skillsPurposeTitle:oG,skillsPurposeDesc:aG,noArchived:lG,noActive:cG,noNodes:uG,noMyNodes:dG,noMyFlows:fG,noSkills:pG,noDescription:hG,noNodeMatch:mG,noFlowSnippetMatch:gG,noSkillMatch:yG,nodeSlots:xG,flowSnippet:wG,flowSnippetNodes:bG,skill:kG,nodeDetail:vG,flowDetail:SG,skillDetail:NG,detailType:jG,detailSource:CG,detailPackage:_G,detailVersion:EG,detailPath:AG,detailEditable:PG,readOnly:IG,editable:TG,nodeSchema:RG,nodeInputs:MG,nodeOutputs:$G,nodeRuntime:LG,nodeBody:OG,nodeFiles:DG,nodeUsage:FG,noRuntimeManifest:zG,noNodeBody:BG,noNodeFiles:HG,selectNodeFile:WG,binaryFile:VG,fileTruncated:KG,noNodeUsage:UG,myNodeManagement:qG,deleteMyNode:YG,deletingMyNode:GG,deleteMyNodeHint:JG,deleteMyNodeConfirm:XG,deleteMyNodeSuccess:QG,deleteMyNodeUsedBy:ZG,myFlowManagement:eJ,deleteMyFlow:tJ,deletingMyFlow:nJ,deleteMyFlowHint:rJ,deleteMyFlowConfirm:sJ,deleteMyFlowSuccess:iJ,noSlots:oJ,resourceMeaning:aJ,nodesMeaning:lJ,myFlowsMeaning:cJ,flowSnippetScale:uJ,flowSnippetPreview:dJ,flowSnippetEdges:fJ,flowSnippetJson:pJ,flowSnippetMoreEdges:hJ,noFlowSnippetPreview:mJ,skillsMeaning:gJ,skillPreview:yJ,skillPreviewEmpty:xJ,selectResource:wJ,loadFailed:bJ,noPipelines:kJ,emptyHint:vJ,noMatch:SJ,recentActivity:NJ,noRecentActivity:jJ,noMatchRecent:CJ,recentRun:_J,recentOpen:EJ,sourceBadge:AJ,resourceSource:PJ,resourceFilter:IJ,nodeDetailTabs:TJ,defaultCardDesc:RJ,hubCard:MJ,newPipelineModal:$J,importModal:LJ,deleteModal:OJ,archiveModal:DJ},zJ="Back",BJ="Next",HJ="Skip",WJ="Done",VJ="Start Creating",KJ={intro:`Welcome to AgentFlow! This is a visual workflow orchestration tool.
|
|
278
|
-
|
|
279
|
-
Click the button below to create your first pipeline.`,hubIntro:`Don't want to start from scratch?
|
|
280
|
-
|
|
281
|
-
Browse ready-made pipelines on AgentFlow Hub — community-shared flows you can install and run in one click.`},UJ={intro:`Now you're in the flow editor.
|
|
282
|
-
|
|
283
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
284
|
-
|
|
285
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`,introEmpty:`The canvas is empty. Start creating your flow!
|
|
286
|
-
|
|
287
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
288
|
-
|
|
289
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`},qJ={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"},YJ={back:zJ,next:BJ,skip:HJ,done:WJ,startCreate:VJ,projects:KJ,flow:UJ,newPipeline:qJ},GJ={name:"AgentFlow",tagline:"AI 工作流编排"},JJ={projects:"项目",nodes:"Nodes",myNodes:"我的 Nodes",myFlows:"我的流程",skills:"Skills",mcps:"MCP",feedback:"意见反馈",flowEditor:"流程编辑器",settings:"设置",back:"返回"},XJ={loading:"加载中…",saving:"保存中…",save:"保存",cancel:"取消",delete:"删除",edit:"编辑",create:"创建",close:"关闭",confirm:"确认",copy:"复制",copied:"已复制!",refresh:"刷新",search:"搜索",filter:"筛选",success:"成功",error:"错误",warning:"警告",info:"信息",done:"完成",pending:"待处理",running:"运行中",notFound:"未找到",required:"必填",optional:"可选"},QJ={success:"成功",failed:"失败",pending:"等待",running:"运行中",skipped:"跳过"},ZJ={agent:"Agent 节点",control:"控制节点",tool:"工具节点",start:"开始",end:"结束"},eX={online:"引擎在线",offline:"引擎离线",connecting:"连接中…"},tX={hub:"AgentFlow Hub",docs:"文档",github:"GitHub 仓库"},nX={app:GJ,nav:JJ,common:XJ,status:QJ,nodeTypes:ZJ,engine:eX,links:tX},rX="流程编辑器",sX="节点",iX="连线",oX="属性",aX={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:"编辑内容"},lX={title:"节点属性",noInputPins:"当前无输入引脚",noOutputPins:"当前无输出引脚",type:"类型",name:"名称",defaultValue:"默认值 / value",description:"描述 / 格式",required:"必填",showOnNode:"卡片",requiredHint:"标记为必填,用于提示用户该槽位必须提供值或连线",showOnNodeHint:"是否在画布节点卡片旁展示这个引脚名称;关闭后仍可连线",pinRequiredAriaLabel:"{{label}} {{index}} 是否必填",pinShowOnNodeAriaLabel:"{{label}} {{index}} 是否在节点卡片展示",pinDescriptionAriaLabel:"{{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}}"},cX={run:"运行流程",stop:"停止",resume:"继续",validate:"校验",export:"导出",import:"导入"},uX={nodeList:"节点列表",runHistory:"运行历史",validation:"校验结果"},dX={workspace:"工作区",loading:"加载中…",archived:"已归档",noPipelines:"暂无流水线",more:"更多",moreFlows:"更多流程",noRuns:"暂无运行记录",searchNodes:"搜索节点",noComponents:"暂无可用组件(检查节点库目录)",noMatch:"无匹配节点,请调整搜索词",selectPipeline:"从上方选择一条流水线以加载组件与画布",validationWarnings:"校验警告(与 agentflow validate 槽位检查一致)",output:"输出",model:"模型",userDir:"用户目录",toggleRecentActivity:"展开或收起最近打开或最近运行"},fX={selectPipeline:"请从顶部下拉选择一条流水线",loadingProps:"加载节点属性…",pipelineId:"流水线 ID",diskPath:"磁盘路径",storageLocation:"存储位置",introduction:"介绍",introductionPlaceholder:"简要描述这条流水线的用途(写入 flow.yaml 的 ui.description)",metadata:"元数据",nodeCount:"节点数",nodesUnit:"个节点",loading:"加载中…",noRuns:"暂无运行记录(终端执行后会在工作区生成运行目录)"},pX={saving:"保存中…",saved:"已保存",saveFailed:"保存失败",runInTerminal:"运行请使用终端"},hX={requirement:"需求拆解",planning:"技术规划",code:"代码执行",test:"测试回归",normal:"普通"},mX={phase:"阶段",allPhasesComplete:"所有阶段完成",currentPhaseComplete:"当前阶段完成,等待确认继续…"},gX={node:"节点",text:"文本",file:"文件",bool:"布尔"},yX={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:"等待"},xX={title:"快捷键",general:"常规",saveDesc:"保存;节点属性侧栏打开时先提交节点再保存 flow",shortcutsLabel:"快捷键",jumpToNode:"按 ID 跳转到节点",openNodePalette:"打开节点面板",canvas:"画布",selectTool:"选择工具",panTool:"平移工具",holdSpacePan:"按住空格临时平移",saveViewport:"保存当前进入视角",selectAll:"全选所有节点",undo:"撤销画布修改",redo:"重做画布修改"},wX={title:"跳转到节点",placeholder:"输入节点 ID 或名称…",empty:"未匹配到节点",hintNavigate:"切换",hintJump:"跳转",hintClose:"关闭"},bX={title:"开始构建你的流程",text:"在下方 AI 输入框中描述你的流程,或从左侧面板拖拽节点到画布",composerHint:"使用 AI Composer 构建 AgentFlow",composerSub:"从左侧拖入节点,或在<strong>下方输入框</strong>中用自然语言描述工作流。<br/>按 <kbd>?</kbd> 查看快捷键。"},kX={mainNav:"主导航"},vX={flowWarningAriaLabel:"流程校验警告",reloadFromServer:"从服务器重新加载流程并刷新校验",reloadFromServerShort:"从服务器重新加载",closeBanner:"关闭校验警告横幅",nodePrefix:"节点",focusNodeAriaLabel:"在画布中选中并定位节点 {{nodeId}}",slotWarningCount:"槽位校验 {{count}} 条(已隐藏)",show:"显示",shortcutHint:"按 ? 查看快捷键",shortcutHintLabel:"快捷键",inputSlotNoEdge:' 的 input 槽位 "{{slotName}}"({{handle}})无对应 edge 连接',outputSlotNoEdge:' 的 output 槽位 "{{slotName}}"({{handle}})无对应 edge 连接'},SX={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}} 步):
|
|
290
|
-
{{summary}}`,step:"步骤 {{current}}/{{total}}: {{description}}",phaseGeneration:`分阶段生成({{count}} 阶段):{{labels}}
|
|
291
|
-
当前:{{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}}"},NX={currentPipeline:"当前流水线",backToEdit:"返回编辑",backToProjects:"返回项目",executionLog:"执行日志",history:"历史",pipelineSettings:"流水线设置",shortcutsLabel:"快捷键",shortcutsTitle:"快捷键 (?)",deletePipeline:"删除流水线",resumeTitle:"在同一 run 目录继续执行(uuid={{uuid}})",resumeTitleNoUuid:"尚未收到 apply-start,将发起新的 run",rerunTitle:"从头开始新的运行",runOptions:"运行选项",runWithParams:"带参数运行",runWithPreset:"指定预设运行",editRun:"编辑运行参数",startRun:"开始执行",stopRun:"停止后台运行"},jX={nodePalette:"节点调色板",noPipelineSelected:"未选择流水线",moreRuns:"+{{count}} 更多",moreFlows:"+{{count}} 更多流程",runId:"运行 ID: {{id}}"},CX={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}} 的分支"},_X={close:"关闭",loading:"加载中…",placeholder:"文件内容",largeFileWarning:"文件较大,编辑器性能可能受影响",reset:"重置",aiEdit:"AI 修改",aiRunning:"AI 处理中…",save:"保存",saving:"保存中…",saved:"已保存"},EX={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:"已复制"},AX={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:"定时配置已保存"},PX={title:"执行历史",summary:"执行结果汇总",successCount:"{{count}} 成功",failedCount:"{{count}} 失败",stoppedCount:"{{count}} 已停止",interruptedCount:"{{count}} 已中断",runningCount:"{{count}} 进行中",success:"成功",failed:"失败",stopped:"已停止",interrupted:"已中断",running:"进行中",unknown:"未知",runLabel:"运行 #{{id}}",enterRunView:"进入该次运行的画布与日志态"},IX={invalidInstanceId:"实例 ID 格式无效:仅允许英文字母、数字、下划线、短横线,且不能以数字开头。",duplicateInstanceId:"该实例 ID 已存在,请换一个。",loadFlowFailed:"读取 flow 失败",loadNodesFailed:"读取节点库失败"},TX={invalidPlaceholder:"无效占位符: {{hint}}",empty:"(空)",inputSubtitle:"输入 · {{type}}",inputSubtitleNoType:"输入",outputSubtitle:"输出 · {{type}}",outputSubtitleNoType:"输出",runtimeConst:"运行时常量"},RX={justNow:"刚刚",minutesAgo:"{{n}} 分钟前",hoursAgo:"{{n}} 小时前",yesterday:"昨天",daysAgo:"{{n}} 天前",milliseconds:"{{n}} 毫秒",seconds:"{{n}} 秒"},MX={title:"用户确认 ({{instanceId}})",edit:"编辑",save:"保存",cancel:"取消",aiEditPlaceholder:"输入 AI 修改指令,如:删除第二项、合并前两项…",aiEditBtn:"AI 修改",aiEditStarted:"AI 正在修改内容…",aiEditDone:"AI 修改完成",aiEditFailed:"AI 修改失败",contentSaved:"内容已保存",saveFailed:"保存失败",close:"关闭",continue:"继续执行",hint:"编辑或使用 AI 修改后点击保存,然后点击「继续执行」恢复流程"},$X={title:"用户选择 ({{instanceId}})",hint:"请从下方选项中选择一项以继续流程",submitting:"提交中…",submitFailed:"提交失败",close:"关闭",noOptions:"该节点未配置选项,请先在编辑器中为 output 槽位添加条目。"},LX={title:"Print 输出: {{instanceId}}",expand:"放大",restore:"还原"},OX={save:"保存",cancel:"取消"},DX={title:"带参数运行",noParams:"此流程无输入参数",run:"运行",cancel:"取消"},FX={title:"指定预设运行",noPresets:"无可用预设",default:"默认运行",run:"运行",cancel:"取消"},zX={preset:"预设",default:"默认",newPreset:"新建预设",deletePreset:"删除预设",presetNamePlaceholder:"预设名称",inputParams:"输入参数",noProvideNodes:"此流程无 provide 节点",filePathPlaceholder:"文件路径…",stringValuePlaceholder:"值…",presetSaved:"预设已保存",presetDeleted:"预设已删除",savePreset:"保存当前预设",expandInput:"编辑内容"},BX={title:rX,nodes:sX,edges:iX,properties:oX,node:aX,nodeProps:lX,actions:cX,panel:uX,palette:dX,pipeline:fX,status:pX,roles:hX,phases:mX,types:gX,runContext:yX,shortcuts:xX,jumpPalette:wX,emptyCanvas:bX,sidebar:kX,validation:vX,composer:SX,topbar:NX,palette2:jX,run:CX,fileEdit:_X,settings:EX,schedule:AX,history:PX,nodePropsError:IX,placeholder:TX,time:RX,userCheck:MX,userAsk:$X,toolPrint:LX,provideEdit:OX,runParams:DX,runPreset:FX,runConfig:zX},HX="设置",WX={engine:"引擎设置",preferences:"全局首选项"},VX={title:"工作区",currentPath:"当前工作区根目录",placeholder:"加载中…",copyPath:"复制路径",description:"流水线与节点清单将相对于此目录解析(由启动 UI 时传入)。"},KX={title:"Cursor CLI",status:{cached:"已缓存",notCached:"未缓存"},modelPreviewLabel:"Cursor 模型名称列表",modelList:{cached:"模型清单已缓存",empty:"暂无模型列表",count:"{{count}} 条",fetchedAt:"更新 {{time}}",never:"尚未拉取",refresh:"刷新清单",fetching:"拉取中…"}},UX={modelPreviewLabel:"OpenCode 模型名称列表",title:"OpenCode CLI",status:{ready:"就绪",notFound:"未找到"},provider:"方案 / Provider 标识",providerPlaceholder:"例如 bailian-coding-plan",saving:"正在保存并更新清单…",description:"对应 CLI opencode models <provider> 的参数;停止输入后会写入用户目录 config 并刷新 model-lists.json。"},qX={title:"Claude Code CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Claude Code 模型名称列表",description:"内置模型列表(Claude Code CLI 无 models 子命令);刷新将探测 claude 二进制是否在 PATH 中。首次使用请先执行 claude /login。"},YX={title:"Codex CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Codex 模型名称列表",description:"模型列表来自 codex debug models --bundled;首次使用请先执行 codex login。"},GX={title:"环境变量",note:"当前登录用户私有,运行时优先于服务全局环境变量",noteAdmin:"可配置个人或全局环境变量;个人同名变量优先于全局",saving:"正在保存...",key:"键",value:"值",scope:"范围",personal:"个人",global:"全局",add:"添加",delete:"删除 {{key}}",invalidKey:"环境变量名必须以字母或下划线开头,且只能包含字母、数字和下划线。",newKey:"新环境变量键",newValue:"值(密钥请谨慎)"},JX={title:"用户白名单",description:"只控制 username 是否允许注册或登录,密码由用户首次登录时自行设置。",enabled:"白名单已启用",open:"开放注册",refreshing:"刷新中...",saving:"保存中...",file:"文件",fileList:"文件白名单",envList:"环境变量白名单",readonly:"只读",userCount:"{{count}} 个用户",remove:"删除 {{username}}",emptyFile:"未配置文件白名单;如果环境变量也为空,则所有用户可注册。",emptyEnv:"未配置 AGENTFLOW_USER_WHITELIST / AGENTFLOW_ALLOWED_USERS",unionHint:"文件白名单与环境变量白名单取并集;这里只会保存用户名,不保存密码。",add:"添加"},XX={title:"系统状态",normal:"服务正常",abnormal:"部分接口异常",cursorModels:"Cursor 模型",opencodeModels:"OpenCode 模型",claudeCodeModels:"Claude Code 模型",codexModels:"Codex 模型"},QX={title:"快捷入口",projects:"项目与流水线",flowEditor:"节点画布"},ZX={title:"语言",description:"选择界面显示语言",options:{zh:"中文",en:"English",ja:"日本語"}},eQ={title:"新手引导",description:"重新启动产品引导流程,了解 AgentFlow 的核心功能。",reset:"重置引导",resetSuccess:"已重置,下次访问将自动启动引导"},tQ={title:HX,crumb:WX,workspace:VX,cursor:KX,opencode:UX,claudeCode:qX,codex:YX,env:GX,allowlist:JX,system:XX,shortcuts:QX,language:ZX,onboarding:eQ},nQ={thinking:"思考",result:"结果",reply:"回复",error:"错误"},rQ={input:"让 AI 协助编辑此节点…",waiting:"等待响应…",selectedEmpty:"在画布上选择节点,或在输入框用 @ 选择实例(Instances)或节点类型(Node)",textarea:"描述你的流程或让 AI 协助编辑(⌘/Ctrl+Enter 发送)"},sQ={send:"发送",stop:"停止",expand:"展开",collapse:"收起",clear:"清空"},iQ={conversation:"对话",conversationWithNumber:"对话 {{num}}",default:"默认"},oQ={endSession:"结束对话(将停止生成)",closeSession:"关闭对话",newSession:"新建对话",expandComposer:"展开对话与输出"},aQ={hint:"使用底部输入框进行 AI 对话,支持 @节点、选择模型等功能"},lQ={aiLabels:nQ,placeholders:rQ,actions:sQ,labels:iQ,tooltips:oQ,rightPanel:aQ},cQ="项目",uQ="全部",dQ="已归档",fQ="Nodes",pQ="我的 Nodes",hQ="我的流程",mQ="Skills",gQ="活跃项目",yQ="已归档流水线",xQ="全局 Nodes",wQ="全部 Nodes",bQ="我的 Nodes",kQ="管理当前工作区已发布到本地 Marketplace 的节点,共 {{count}} 个。",vQ="管理当前工作区已发布到本地 Marketplace 的流程片段,共 {{count}} 个。",SQ="全局 Skills",NQ="创建新项目",jQ="新建流水线",CQ="搜索流水线…",_Q="搜索 nodes…",EQ="搜索流程片段…",AQ="搜索 skills…",PQ="刷新资源",IQ="加载流水线列表…",TQ="加载全局资源…",RQ="筛选结果:{{count}} 条(匹配标题、描述、路径与标签)",MQ="已归档的流水线仍可打开与编辑;文件位于各 pipelines 目录下的 _archived。",$Q="管理分布式节点架构与监控流水线。可将 flow.yaml 或 .zip 拖入本页导入分享流程。",LQ="查看当前可用的全局节点定义,共 {{count}} 个;包含内置、工作区与 marketplace 节点。",OQ="查看当前 Composer 可选择的 skills,共 {{count}} 个;包含 AgentFlow 内置与工作区 skills。",DQ="流程运行时的可执行积木",FQ="Nodes 决定画布上能拖什么、节点有哪些输入输出,以及运行时走 agent、control、provide 或 marketplace 哪类逻辑。",zQ="已发布的本地节点包",BQ="这里仅显示你发布到当前 Workspace Marketplace 的节点版本;可查看详情并删除未被 Flow 使用的版本。",HQ="已发布的流程片段",WQ="这里显示从 Pipeline 或 Workspace 画布发布的流程片段,可搜索、检查内容,并从画布的流程面板中加载复用。",VQ="Composer/Agent 的操作指南",KQ="Skills 告诉 AI 在特定任务里应遵守什么规则、如何修改 flow、如何复用项目约定。",UQ="暂无归档项目。",qQ="暂无未归档流水线;已归档项在 Archived 标签中查看。",YQ="暂无可用全局 nodes。",GQ="暂无已发布的 marketplace nodes。",JQ="暂无已发布的流程片段。可在画布中选中多个节点后发布。",XQ="暂无可用 skills。",QQ="暂无描述。",ZQ="未找到与「{{query}}」匹配的 node。",eZ="未找到与「{{query}}」匹配的流程片段。",tZ="未找到与「{{query}}」匹配的 skill。",nZ="{{inputs}} in / {{outputs}} out",rZ="流程片段",sZ="{{nodes}} 节点 / {{edges}} 连线",iZ="Skill",oZ="Node 详情",aZ="流程片段详情",lZ="Skill 详情",cZ="类型",uZ="来源",dZ="包",fZ="版本",pZ="路径",hZ="可编辑",mZ="只读",gZ="可编辑",yZ="Schema",xZ="输入",wZ="输出",bZ="Runtime",kZ="节点内容",vZ="Files",SZ="Usage",NZ="暂无 runtime manifest。",jZ="暂无节点正文或 README。",CZ="暂无可预览文件。",_Z="请选择文件查看内容。",EZ="二进制文件暂不支持预览。",AZ="文件较大,仅显示前 256KB。",PZ="暂未发现使用此 node 的流水线。",IZ="节点管理",TZ="删除节点版本",RZ="删除中…",MZ="删除前会检查所有 Flow 引用;仍被安装或使用的版本不会被删除。",$Z="确定删除 {{id}}@{{version}}?此操作不可撤销。",LZ="已删除 {{id}}@{{version}}。",OZ="仍有 {{count}} 个 Flow 使用它。",DZ="流程片段管理",FZ="删除流程片段",zZ="删除中…",BZ="删除后不会影响已经加载到画布里的节点,只会移除 Marketplace 中这个可复用片段。",HZ="确定删除 {{id}}@{{version}}?此操作不可撤销。",WZ="已删除 {{id}}@{{version}}。",VZ="无槽位",KZ="作用",UZ="这个 node 是 pipeline 的执行单元。它的 schema 会影响画布连线、参数输入和运行时调度。",qZ="流程片段是固定化流程的一部分。加载时会复制这组节点、连线和布局到当前画布,不覆盖已有内容。",YZ="规模",GZ="流程预览",JZ="连线",XZ="片段 JSON",QZ="还有 {{count}} 条连线",ZZ="暂无可预览节点。",eee="这个 skill 会作为 Composer 的上下文注入给 AI,用于约束 AI 的判断、修改方式和输出口径。",tee="SKILL.md 预览",nee="暂无可预览内容。",ree="请选择一个资源查看详情。",see="未能加载流水线列表。",iee="当前工作区暂无流水线。",oee="在仓库根目录执行 {{code1}} 并确认工作区包含 {{code2}} 或用户目录下的流水线;亦可点击 New Pipeline 新建。",aee="未找到与「{{query}}」匹配的流水线。可尝试其他关键词,或点击清除搜索。",lee="最近打开或最近运行",cee="暂无打开或运行记录",uee="暂无与关键词匹配的最近记录",dee="最近运行",fee="最近打开",pee={builtin:"内置",workspace:"工作区",user:"用户"},hee={flow:"Flow",global:"Global",marketplace:"Marketplace"},mee={all:"全部",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},gee={overview:"概览",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},yee="打开以在节点画布中编辑此流水线。",xee={eyebrow:"AgentFlow Hub",title:"浏览社区流程",desc:"发现并一键安装社区分享的现成流水线。",cta:"前往 Hub",cliHint:"或通过 CLI 安装:agentflow download <slug>"},wee={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:"关闭"},bee={title:"导入流水线",lead:"已选择文件「{{filename}}」。请确认流水线名称与保存位置;ZIP 将保留目录内脚本等文件。",nameLabel:"名称(必填)",namePlaceholder:"例如 my_shared_flow",nameHint:"须以英文字母开头,仅可使用字母、数字、下划线 _ 与连字符 -",locationLabel:"保存位置",userDir:"用户目录(~/agentflow/pipelines)",workspaceDir:"当前工作区(.workspace/agentflow/pipelines)",changeFile:"更换文件…",importFailed:"导入失败",importing:"导入中…",importAndOpen:"导入并打开",cancel:"取消",close:"关闭"},kee={title:"删除流水线",lead:"将永久删除磁盘上的流水线目录(含 flow.yaml、脚本等),无法撤销。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",deleteFailed:"删除失败",deleteTimeout:"删除请求超时,请重试(可先检查终端中的 UI 服务日志)",delete:"删除",deleting:"删除中…",confirmDelete:"确认删除",cancel:"取消",close:"关闭"},vee={title:"归档流水线",lead:"归档后流水线将移入「Archived」列表,仍可从该列表打开与编辑。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",archiveFailed:"归档失败",archive:"归档",archiving:"归档中…",confirmArchive:"确认归档",cancel:"取消",close:"关闭"},See={title:cQ,all:uQ,archived:dQ,nodes:fQ,myNodes:pQ,myFlows:hQ,skills:mQ,activeProjects:gQ,archivedPipelines:yQ,globalNodes:xQ,nodeScopeAll:wQ,nodeScopeMine:bQ,myNodesHint:kQ,myFlowsHint:vQ,globalSkills:SQ,createNew:NQ,newPipeline:jQ,searchPipelines:CQ,searchNodes:_Q,searchFlows:EQ,searchSkills:AQ,refreshResources:PQ,loadingPipelines:IQ,loadingResources:TQ,filterResult:RQ,archivedHint:MQ,activeHint:$Q,nodesHint:LQ,skillsHint:OQ,nodesPurposeTitle:DQ,nodesPurposeDesc:FQ,myNodesPurposeTitle:zQ,myNodesPurposeDesc:BQ,myFlowsPurposeTitle:HQ,myFlowsPurposeDesc:WQ,skillsPurposeTitle:VQ,skillsPurposeDesc:KQ,noArchived:UQ,noActive:qQ,noNodes:YQ,noMyNodes:GQ,noMyFlows:JQ,noSkills:XQ,noDescription:QQ,noNodeMatch:ZQ,noFlowSnippetMatch:eZ,noSkillMatch:tZ,nodeSlots:nZ,flowSnippet:rZ,flowSnippetNodes:sZ,skill:iZ,nodeDetail:oZ,flowDetail:aZ,skillDetail:lZ,detailType:cZ,detailSource:uZ,detailPackage:dZ,detailVersion:fZ,detailPath:pZ,detailEditable:hZ,readOnly:mZ,editable:gZ,nodeSchema:yZ,nodeInputs:xZ,nodeOutputs:wZ,nodeRuntime:bZ,nodeBody:kZ,nodeFiles:vZ,nodeUsage:SZ,noRuntimeManifest:NZ,noNodeBody:jZ,noNodeFiles:CZ,selectNodeFile:_Z,binaryFile:EZ,fileTruncated:AZ,noNodeUsage:PZ,myNodeManagement:IZ,deleteMyNode:TZ,deletingMyNode:RZ,deleteMyNodeHint:MZ,deleteMyNodeConfirm:$Z,deleteMyNodeSuccess:LZ,deleteMyNodeUsedBy:OZ,myFlowManagement:DZ,deleteMyFlow:FZ,deletingMyFlow:zZ,deleteMyFlowHint:BZ,deleteMyFlowConfirm:HZ,deleteMyFlowSuccess:WZ,noSlots:VZ,resourceMeaning:KZ,nodesMeaning:UZ,myFlowsMeaning:qZ,flowSnippetScale:YZ,flowSnippetPreview:GZ,flowSnippetEdges:JZ,flowSnippetJson:XZ,flowSnippetMoreEdges:QZ,noFlowSnippetPreview:ZZ,skillsMeaning:eee,skillPreview:tee,skillPreviewEmpty:nee,selectResource:ree,loadFailed:see,noPipelines:iee,emptyHint:oee,noMatch:aee,recentActivity:lee,noRecentActivity:cee,noMatchRecent:uee,recentRun:dee,recentOpen:fee,sourceBadge:pee,resourceSource:hee,resourceFilter:mee,nodeDetailTabs:gee,defaultCardDesc:yee,hubCard:xee,newPipelineModal:wee,importModal:bee,deleteModal:kee,archiveModal:vee},Nee="返回",jee="下一步",Cee="跳过",_ee="完成",Eee="开始创建",Aee={intro:`欢迎使用 AgentFlow!这是一个可视化流程编排工具。
|
|
292
|
-
|
|
293
|
-
点击下方按钮开始创建你的第一个流水线。`,hubIntro:`不想从零开始?
|
|
294
|
-
|
|
295
|
-
在 AgentFlow Hub 浏览社区分享的现成流水线,一键安装即可运行。`},Pee={intro:`现在进入流程编辑器。
|
|
296
|
-
|
|
297
|
-
在下方输入框用自然语言描述你的需求,AI 会自动生成流程图。
|
|
298
|
-
|
|
299
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`,introEmpty:`画布为空,开始创建你的流程吧!
|
|
300
|
-
|
|
301
|
-
在下方输入框用自然语言描述需求,AI 会自动生成流程图。
|
|
302
|
-
|
|
303
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`},Iee={guideTitle:"首次创建提示",guideDesc:"输入名称和描述后,AI 会自动生成流程图。你可以在编辑器中自由调整节点和连接。",nameHintGuide:"例如:MyFirstFlow(字母开头,支持数字和下划线)",descPlaceholderGuide:"例如:实现用户登录功能,包含注册、验证、授权",descHintGuide:"描述越详细,AI 生成的流程越准确",createGuide:"创建并开始编辑",typeNode:"节点引用类型",typeStr:"字符串类型",typeFile:"文件路径类型",typeBool:"布尔值类型"},Tee={back:Nee,next:jee,skip:Cee,done:_ee,startCreate:Eee,projects:Aee,flow:Pee,newPipeline:Iee},Ree={en:{common:xq,flow:rY,settings:yY,composer:NY,project:FJ,onboarding:YJ},zh:{common:nX,flow:BX,settings:tQ,composer:lQ,project:See,onboarding:Tee}};sr.use(NI).use(o$).init({resources:Ree,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 Mee=[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"en",name:"English",flag:"🇬🇧"}];function $ee(e){return sr.changeLanguage(e)}const Ex="agentflow-settings-opencode-plan-v1",jf="CURSOR_API_KEYS",Cf="AGENTFLOW_CURSOR_API_KEY_COOLDOWN_MINUTES";function Ag(e){if(!e||typeof e!="object")return{cursor:[],opencode:[],claudeCode:[],codex:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null,codexFetchedAt: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):[],codex:Array.isArray(t.codex)?t.codex.map(String):[],cursorFetchedAt:t.cursorFetchedAt??null,opencodeFetchedAt:t.opencodeFetchedAt??null,claudeCodeFetchedAt:t.claudeCodeFetchedAt??null,codexFetchedAt:t.codexFetchedAt??null}}function jl(){return`e_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function Lee(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function qo(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()||jl(),c=String(r.scope??t).trim()==="global"?"global":"user";!s&&!i||n.push({id:a,key:s,value:i,scope:c})}return n}function Rj(e){return qo(e).map(({key:t,value:n})=>({key:t,value:n}))}function Mj(){try{return localStorage.getItem(Ex)??""}catch{return""}}function jI(e){return e?e.length<=6?"•".repeat(e.length):`${"•".repeat(Math.min(20,e.length-4))}${e.slice(-4)}`:""}function Oee(e){const t=String(e||"").trim();if(!t)return[];const n=(r,s)=>{if(typeof r=="string"){const a=r.trim();return a?{id:`legacy_${s}_${a.slice(-6)}`,name:`Key ${s+1}`,key:a,createdAt:""}:null}if(!r||typeof r!="object")return null;const i=String(r.key??"").trim();return i?{id:String(r.id??"").trim()||jl(),name:String(r.name??"").trim()||`Key ${s+1}`,key:i,createdAt:String(r.createdAt??"").trim()}:null};try{const r=JSON.parse(t);if(Array.isArray(r))return r.map(n).filter(Boolean)}catch{}return t.split(",").map((r,s)=>n(r,s)).filter(Boolean)}function $j(e){const t=Array.isArray(e)?e.map((n,r)=>({id:String((n==null?void 0:n.id)||"").trim()||jl(),name:String((n==null?void 0:n.name)||"").trim()||`Key ${r+1}`,key:String((n==null?void 0:n.key)||"").trim(),createdAt:String((n==null?void 0:n.createdAt)||"").trim()||new Date().toISOString()})).filter(n=>n.key):[];return JSON.stringify(t)}function Dee(e){const t=String(e||"").trim();return t?t.length<=10?jI(t):`${t.slice(0,4)}${"•".repeat(Math.min(18,t.length-8))}${t.slice(-4)}`:""}function Cb(e){return String(e||"").trim()||"<AGENTFLOW_TOKEN>"}function CI({baseUrl:e="",token:t=""}){return JSON.stringify({mcpServers:{agentflow:{command:"agentflow",args:["mcp"],env:{AGENTFLOW_BASE_URL:String(e||"http://127.0.0.1:8875"),AGENTFLOW_TOKEN:Cb(t)}}}},null,2)}function _I({baseUrl:e="",token:t=""}){const n=JSON.stringify(String(e||"http://127.0.0.1:8875")),r=JSON.stringify(Cb(t));return["[mcp_servers.agentflow]",'command = "agentflow"','args = ["mcp"]',"","[mcp_servers.agentflow.env]",`AGENTFLOW_BASE_URL = ${n}`,`AGENTFLOW_TOKEN = ${r}`].join(`
|
|
304
|
-
`)}function Fee({baseUrl:e="",token:t=""}){const n=String(e||"http://127.0.0.1:8875"),r=CI({baseUrl:n,token:t}),s=_I({baseUrl:n,token:t});return["你是一个 AI Coding Agent。请帮我把 AgentFlow 配置成当前开发环境可用的 MCP server。","","这是一项配置任务,不是调用任务:请修改 Cursor 或 Codex 的 MCP 配置文件,让它们能连接本机 AgentFlow。","","AgentFlow MCP server 信息:","- server name: agentflow","- command: agentflow",'- args: ["mcp"]',`- env.AGENTFLOW_BASE_URL: ${n}`,`- env.AGENTFLOW_TOKEN: ${Cb(t)}`,"","Cursor 配置片段(合并到 .cursor/mcp.json 或 ~/.cursor/mcp.json):","```json",r,"```","","Codex 配置片段(合并到 ~/.codex/config.toml 的 mcp_servers 配置):","```toml",s,"```","","配置要求:","1. 先判断当前仓库主要使用 Cursor、Codex,还是两者都需要配置。","2. 不要覆盖已有 MCP server;只新增或更新名为 `agentflow` 的 server。","3. 保留已有配置文件里的其他字段、注释和 server。","4. 如果配置文件不存在,请创建父目录和配置文件。","5. 不要把 token 打印到最终回复里;如果需要说明,只写 `AGENTFLOW_TOKEN 已写入配置`。","6. 如果 token 仍是 `<AGENTFLOW_TOKEN>` 占位符,请提醒用户需要在配置文件中替换成真实 token,或回到 AgentFlow 设置页点击“使用当前登录 Token”后重新复制。","","配置后验证:","- 确认 `agentflow` 命令在 PATH 中可用。","- 通过 MCP 客户端刷新或重启后,确认 `agentflow` server 出现在 MCP server 列表。","- 如果可以做工具探测,只验证 `tools/list` 能看到 `agentflow_list_flows`、`agentflow_run_flow`、`agentflow_get_display_outputs`。","","最终回复只需要说明:配置了哪些文件、是否验证成功、如果失败下一步该检查什么。"].join(`
|
|
305
|
-
`)}function zee(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 Bee({authUser:e}){const{t,i18n:n}=_r(["common","settings"]),r=n.language||"zh",[s,i]=m.useState(""),[a,l]=m.useState(""),[c,u]=m.useState({cursor:[],opencode:[],claudeCode:[],codex:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null,codexFetchedAt:null}),[p,f]=m.useState(""),[d,h]=m.useState(!1),[y,w]=m.useState(!1),[b,g]=m.useState(""),[k,x]=m.useState([]),[S,C]=m.useState(""),[j,E]=m.useState(!1),[A,O]=m.useState(""),[W,H]=m.useState(""),[D,R]=m.useState(!1),[T,V]=m.useState(()=>new Set),[F,M]=m.useState(""),[I,B]=m.useState(""),[_,q]=m.useState(!!(e!=null&&e.isAdmin)),[z,$]=m.useState(""),[Q,te]=m.useState([]),[ie,he]=m.useState([]),[ne,ce]=m.useState(""),[re,le]=m.useState(""),[ue,Se]=m.useState(()=>{var ee;return typeof window<"u"&&((ee=window.location)!=null&&ee.origin)?window.location.origin:"http://127.0.0.1:8875"}),[De,Ye]=m.useState(""),[Ie,Je]=m.useState(""),[Et,bt]=m.useState(!1),[Pe,rt]=m.useState(!1),[At,zt]=m.useState(""),[Kt,tt]=m.useState(""),[oe,be]=m.useState(""),[ke,st]=m.useState(null),[Ze,kt]=m.useState(!1),[Bt,Gt]=m.useState(!1),[Z,xe]=m.useState(""),$e=m.useRef(null),Ee=m.useRef(!1),ut=m.useRef(!1),St=m.useRef(""),ir=m.useCallback(async()=>{l("");try{const ee=await fetch("/api/ui-context");if(!ee.ok)throw new Error("HTTP "+ee.status);const je=await ee.json();i(typeof je.workspaceRoot=="string"?je.workspaceRoot:"")}catch(ee){l(String(ee.message||ee)),i("")}},[]),Er=m.useCallback(async()=>{f(""),h(!0);try{const ee=await fetch("/api/model-lists");if(!ee.ok)throw new Error("HTTP "+ee.status);const je=await ee.json();u(Ag(je))}catch(ee){f(String(ee.message||ee))}finally{h(!1)}},[]),Xn=m.useCallback(async()=>{C("");try{const ee=await fetch("/api/user-env"),je=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(typeof je.error=="string"?je.error:"HTTP "+ee.status);const Le=qo(Array.isArray(je.env)?je.env:[],"user").map(Sn=>({...Sn,scope:"user"})),me=[...e!=null&&e.isAdmin?qo(Array.isArray(je.globalEnv)?je.globalEnv:[],"global").map(Sn=>({...Sn,scope:"global"})):[],...Le];St.current=JSON.stringify(me),x(me)}catch(ee){x([]),C(String(ee.message||ee))}finally{ut.current=!0}},[e==null?void 0:e.isAdmin]),hn=m.useCallback(async()=>{if(e!=null&&e.isAdmin){bt(!0),zt("");try{const ee=await fetch("/api/admin/user-allowlist"),je=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(typeof je.error=="string"?je.error:"HTTP "+ee.status);const Le=je.allowlist&&typeof je.allowlist=="object"?je.allowlist:{};te(Array.isArray(Le.fileUsers)?Le.fileUsers.map(String):[]),he(Array.isArray(Le.envUsers)?Le.envUsers.map(String):[]),ce(typeof Le.path=="string"?Le.path:"")}catch(ee){zt(String(ee.message||ee))}finally{bt(!1)}}},[e==null?void 0:e.isAdmin]),Cn=m.useCallback(async ee=>{if(e!=null&&e.isAdmin){rt(!0),zt("");try{const je=await fetch("/api/admin/user-allowlist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({users:ee})}),Le=await je.json().catch(()=>({}));if(!je.ok)throw new Error(typeof Le.error=="string"?Le.error:"HTTP "+je.status);const Ht=Le.allowlist&&typeof Le.allowlist=="object"?Le.allowlist:{};te(Array.isArray(Ht.fileUsers)?Ht.fileUsers.map(String):[]),he(Array.isArray(Ht.envUsers)?Ht.envUsers.map(String):[]),ce(typeof Ht.path=="string"?Ht.path:"")}catch(je){zt(String(je.message||je))}finally{rt(!1)}}},[e==null?void 0:e.isAdmin]),_n=m.useCallback(async()=>{if(e!=null&&e.isAdmin){kt(!0),xe("");try{const ee=await fetch("/api/admin/storage-config"),je=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(typeof je.error=="string"?je.error:"HTTP "+ee.status);const Le=je.config&&typeof je.config=="object"?je.config:{};st(Le),tt(typeof Le.dataRoot=="string"?Le.dataRoot:""),be(typeof Le.skillsRoot=="string"?Le.skillsRoot:"")}catch(ee){xe(String(ee.message||ee))}finally{kt(!1)}}},[e==null?void 0:e.isAdmin]),mr=m.useCallback(async()=>{if(e!=null&&e.isAdmin){Gt(!0),xe("");try{const ee=await fetch("/api/admin/storage-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataRoot:Kt.trim(),skillsRoot:oe.trim(),migrateLegacySkills:!0})}),je=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(typeof je.error=="string"?je.error:"HTTP "+ee.status);const Le=je.config&&typeof je.config=="object"?je.config:{};st(Le),tt(typeof Le.dataRoot=="string"?Le.dataRoot:""),be(typeof Le.skillsRoot=="string"?Le.skillsRoot:"")}catch(ee){xe(String(ee.message||ee))}finally{Gt(!1)}}},[e==null?void 0:e.isAdmin,Kt,oe]),En=m.useCallback(async ee=>{const je=qo(ee),Le=je.filter(me=>me.scope!=="global"),Ht=je.filter(me=>me.scope==="global");E(!0),C("");try{const me=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:Rj(Le),...e!=null&&e.isAdmin?{globalEnv:Rj(Ht)}:{}})}),Sn=await me.json().catch(()=>({}));if(!me.ok)throw new Error(typeof Sn.error=="string"?Sn.error:"HTTP "+me.status);const Wr=qo(Array.isArray(Sn.env)?Sn.env:[],"user").map(xr=>({...xr,scope:"user"})),is=[...e!=null&&e.isAdmin?qo(Array.isArray(Sn.globalEnv)?Sn.globalEnv:[],"global").map(xr=>({...xr,scope:"global"})):[],...Wr];St.current=JSON.stringify(is),x(is)}catch(me){C(String(me.message||me))}finally{E(!1)}},[e==null?void 0:e.isAdmin]),Dn=m.useCallback(async()=>{f(""),h(!0);try{const ee=await fetch("/api/update-model-lists",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:z.trim()})}),je=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(typeof je.error=="string"?je.error:"HTTP "+ee.status);u(Ag(je.modelLists))}catch(ee){f(String(ee.message||ee))}finally{h(!1)}},[z]);m.useEffect(()=>{ir(),Er(),Xn(),e!=null&&e.isAdmin&&(hn(),_n()),(async()=>{try{const ee=await fetch("/api/agentflow-config");if(ee.ok){const je=await ee.json(),Le=typeof je.opencodeProvider=="string"?je.opencodeProvider:"";$(Le),$e.current=Le;try{localStorage.setItem(Ex,Le)}catch{}}else{const je=Mj();$(je),$e.current=je}}catch{const ee=Mj();$(ee),$e.current=ee}finally{Ee.current=!0}})()},[e==null?void 0:e.isAdmin,ir,Er,_n,hn,Xn]),m.useEffect(()=>{if(!ut.current||JSON.stringify(qo(k))===St.current)return;const je=setTimeout(()=>{En(k)},350);return()=>clearTimeout(je)},[k,En]),m.useEffect(()=>{if(!Ee.current)return;const ee=z.trim();if(ee===$e.current)return;const je=setTimeout(()=>{(async()=>{w(!0),g("");try{const Le=await fetch("/api/agentflow-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:ee})}),Ht=await Le.json().catch(()=>({}));if(!Le.ok)throw new Error(typeof Ht.error=="string"?Ht.error:"HTTP "+Le.status);$e.current=ee;try{localStorage.setItem(Ex,ee)}catch{}Ht.modelLists&&u(Ag(Ht.modelLists))}catch(Le){g(String(Le.message||Le))}finally{w(!1)}})()},450);return()=>clearTimeout(je)},[z]);const Qn=c.cursor.length>0,Hr=c.opencode.length>0,gr=c.claudeCode.length>0,An=c.codex.length>0,ss=Q.length>0||ie.length>0,or=m.useMemo(()=>CI({baseUrl:ue,token:De}),[ue,De]),Ar=m.useMemo(()=>_I({baseUrl:ue,token:De}),[ue,De]),Fn=m.useMemo(()=>Fee({baseUrl:ue,token:De}),[ue,De]),mn=e!=null&&e.isAdmin&&_?"global":"user",vn=m.useMemo(()=>k.find(ee=>ee.key===jf&&(ee.scope||"user")===mn)||null,[mn,k]),zn=m.useMemo(()=>Oee((vn==null?void 0:vn.value)||""),[vn==null?void 0:vn.value]),Pr=m.useMemo(()=>k.find(ee=>ee.key===Cf&&(ee.scope||"user")===mn)||null,[mn,k]),Jt=Pr!=null&&Pr.value?String(Pr.value):"30",se=m.useCallback((ee,je,Le)=>{const Ht=String(ee||"").trim();if(!Ht)return;const me=String(je??"");x(Sn=>{const Wr=Sn.find(Zn=>Zn.key===Ht&&(Zn.scope||"user")===Le);return me?Wr?Sn.map(Zn=>Zn.id===Wr.id?{...Zn,value:me,scope:Le}:Zn):[{id:jl(),key:Ht,value:me,scope:Le},...Sn]:Sn.filter(Zn=>!(Zn.key===Ht&&(Zn.scope||"user")===Le))})},[]),Ne=m.useCallback(()=>{const ee=I.trim();if(!ee)return;const je=[...zn,{id:jl(),name:F.trim()||`Key ${zn.length+1}`,key:ee,createdAt:new Date().toISOString()}];se(jf,$j(je),mn),M(""),B("")},[F,zn,mn,I,se]),et=m.useCallback(ee=>{const je=zn.filter(Le=>Le.id!==ee);se(jf,je.length?$j(je):"",mn)},[zn,mn,se]),mt=m.useCallback(ee=>{const je=String(ee||"").replace(/[^\d]/g,"");if(!je){se(Cf,"",mn);return}const Le=Math.min(1440,Math.max(1,Number(je)||30));se(Cf,String(Le),mn)},[mn,se]),sn=m.useCallback(()=>{var ee;s&&((ee=navigator.clipboard)==null||ee.writeText(s))},[s]),gn=m.useCallback(()=>{var ee;Fn&&((ee=navigator.clipboard)==null||ee.writeText(Fn),Je("prompt"),window.setTimeout(()=>Je(""),1200))},[Fn]),Rn=m.useCallback(()=>{var ee;(ee=navigator.clipboard)==null||ee.writeText(or),Je("cursor"),window.setTimeout(()=>Je(""),1200)},[or]),yr=m.useCallback(()=>{var ee;(ee=navigator.clipboard)==null||ee.writeText(Ar),Je("codex"),window.setTimeout(()=>Je(""),1200)},[Ar]),ot=m.useCallback(async()=>{try{const ee=await fetch("/api/auth/session-token"),je=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(typeof je.error=="string"?je.error:"HTTP "+ee.status);Ye(String(je.token||"")),Je("token"),window.setTimeout(()=>Je(""),1200)}catch(ee){Je(""),l(String(ee.message||ee))}},[]),jt=m.useCallback(()=>{const ee=A.trim(),je=W;if(ee){if(!Lee(ee)){C(t("settings:env.invalidKey"));return}x(Le=>[{id:jl(),key:ee,value:je,scope:e!=null&&e.isAdmin&&D?"global":"user"},...Le]),O(""),H("")}},[e==null?void 0:e.isAdmin,D,A,W,t]),gt=m.useCallback(ee=>{x(je=>je.filter(Le=>Le.id!==ee))},[]),Bn=m.useCallback((ee,je)=>{x(Le=>Le.map(Ht=>Ht.id===ee?{...Ht,...je}:Ht))},[]),we=m.useCallback(ee=>{V(je=>{const Le=new Set(je);return Le.has(ee)?Le.delete(ee):Le.add(ee),Le})},[]),Xt=m.useCallback(()=>{const ee=re.trim();if(!ee)return;if(!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(ee)){zt("用户名须以字母开头,仅可使用字母、数字、下划线与连字符,最多 64 字符");return}if(new Set(Q.map(Le=>String(Le||"").trim().toLowerCase())).has(ee.toLowerCase())){le("");return}le(""),Cn([...Q,ee])},[re,Q,Cn]),di=m.useCallback(ee=>{const je=String(ee||"").trim().toLowerCase();je&&Cn(Q.filter(Le=>String(Le||"").trim().toLowerCase()!==je))},[Q,Cn]),Bi=m.useCallback(ee=>{const je=ee.target.value;$ee(je)},[]),ar=ee=>{const je=zee(ee,r);return je?t("settings:cursor.modelList.fetchedAt",{time:je}):t("settings:cursor.modelList.never")};return o.jsxs("div",{className:"af-settings-page",children:[o.jsx("header",{className:"af-settings-top",children:o.jsxs("div",{className:"af-settings-crumb","aria-label":t("settings:title"),children:[o.jsx("span",{className:"af-settings-crumb-muted",children:t("settings:crumb.engine")}),o.jsx("span",{className:"af-settings-crumb-sep","aria-hidden":!0,children:"/"}),o.jsx("span",{className:"af-settings-crumb-active",children:t("settings:crumb.preferences")})]})}),o.jsx("div",{className:"af-settings-body",children:o.jsxs("div",{className:"af-settings-inner",children:[o.jsxs("header",{className:"af-settings-hero",children:[o.jsxs("h1",{className:"af-settings-h1",children:[t("common:app.name")," ",t("settings:title")]}),o.jsx("p",{className:"af-settings-lead",children:t("settings:workspace.description")}),a?o.jsx("p",{className:"af-err af-settings-api-hint",children:a}):null,p?o.jsx("p",{className:"af-err af-settings-api-hint",children:p}):null,S?o.jsx("p",{className:"af-err af-settings-api-hint",children:S}):null,Z?o.jsx("p",{className:"af-err af-settings-api-hint",children:Z}):null]}),o.jsx("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:sn,"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:"当前页面只展示运行时根目录。可被节点加载的代码库和文档目录请在左侧“知识库”里维护。"})]}),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"+(Qn?" af-set-badge--ok":" af-set-badge--muted"),children:t(Qn?"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:Qn?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(Qn?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:Qn?t("settings:cursor.modelList.count",{count:c.cursor.length})+" · "+ar(c.cursorFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),Qn?o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:cursor.modelPreviewLabel"),children:c.cursor.join(`
|
|
306
|
-
`)}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Dn(),disabled:d,children:t(d?"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-cursor-pool",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:"key"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:"Cursor API Key 池"}),o.jsx("p",{className:"af-set-card-subtitle",children:"按请求轮换,遇到 usage limit 或 resource_exhausted 会自动尝试下一个 Key。"})]})]}),o.jsxs("span",{className:"af-set-badge"+(zn.length?" af-set-badge--ok":" af-set-badge--muted"),children:[zn.length," keys"]})]}),o.jsxs("div",{className:"af-set-cursor-pool-controls",children:[e!=null&&e.isAdmin?o.jsxs("div",{className:"af-set-env-scope-switch af-set-cursor-scope",role:"group","aria-label":"Cursor API Key scope",children:[o.jsx("button",{type:"button",className:_?"":"is-active",onClick:()=>q(!1),children:"个人"}),o.jsx("button",{type:"button",className:_?"is-active":"",onClick:()=>q(!0),children:"全局"})]}):null,o.jsxs("label",{className:"af-set-cursor-cooldown",children:[o.jsx("span",{children:"限额冷却"}),o.jsx("input",{className:"af-set-input af-set-input--sm af-set-input--mono",inputMode:"numeric",value:Jt,onChange:ee=>mt(ee.target.value)}),o.jsx("span",{children:"分钟"})]}),o.jsx("span",{className:"af-set-env-note",children:j?"保存中":mn==="global"?"全局配置":"个人配置"})]}),o.jsx("div",{className:"af-set-cursor-key-list",children:zn.length?zn.map(ee=>o.jsxs("div",{className:"af-set-cursor-key-row",children:[o.jsxs("div",{className:"af-set-cursor-key-main",children:[o.jsx("strong",{children:ee.name}),o.jsx("code",{children:Dee(ee.key)})]}),o.jsx("span",{className:"af-set-cursor-key-meta",children:ee.createdAt?new Date(ee.createdAt).toLocaleString():"历史 Key"}),o.jsx("button",{type:"button",className:"af-set-env-del af-set-cursor-key-delete","aria-label":`删除 ${ee.name}`,onClick:()=>et(ee.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})]},ee.id)):o.jsx("div",{className:"af-set-cursor-key-empty",children:"还没有配置 Key。配置后 Cursor CLI runner 会自动轮换使用。"})}),o.jsxs("div",{className:"af-set-cursor-key-add",children:[o.jsx("input",{className:"af-set-input",value:F,onChange:ee=>M(ee.target.value),placeholder:"名称,例如 Team Key 1"}),o.jsx("input",{className:"af-set-input af-set-input--mono",type:"password",value:I,onChange:ee=>B(ee.target.value),placeholder:"Cursor API Key"}),o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:Ne,disabled:!I.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"添加 Key"]})]}),o.jsxs("p",{className:"af-set-hint",children:["保存到 ",jf,";冷却时间保存到 ",Cf,"。个人配置会覆盖全局配置。"]})]}),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"+(Hr?" af-set-badge--ok":" af-set-badge--err"),children:t(Hr?"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:z,onChange:ee=>$(ee.target.value),placeholder:t("settings:opencode.providerPlaceholder"),autoComplete:"off"}),y?o.jsx("p",{className:"af-set-hint af-set-hint--inline","aria-live":"polite",children:t("settings:opencode.saving")}):null,b?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",role:"alert",children:b}):null]}),Hr?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})+" · "+ar(c.opencodeFetchedAt)}),o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:opencode.modelPreviewLabel"),children:c.opencode.join(`
|
|
307
|
-
`)})]}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Dn(),disabled:d,children:t(d?"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"+(gr?" af-set-badge--ok":" af-set-badge--err"),children:t(gr?"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:gr?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(gr?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:gr?t("settings:cursor.modelList.count",{count:c.claudeCode.length})+" · "+ar(c.claudeCodeFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),o.jsx("p",{className:"af-set-p",children:t("settings:claudeCode.description")}),gr?o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:claudeCode.modelPreviewLabel"),children:c.claudeCode.join(`
|
|
308
|
-
`)}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Dn(),disabled:d,children:t(d?"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:codex.title")}),o.jsx("span",{className:"af-set-badge"+(An?" af-set-badge--ok":" af-set-badge--err"),children:t(An?"settings:codex.status.ready":"settings:codex.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:An?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(An?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:An?t("settings:cursor.modelList.count",{count:c.codex.length})+" · "+ar(c.codexFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),o.jsx("p",{className:"af-set-p",children:t("settings:codex.description")}),An?o.jsx("pre",{className:"af-set-model-preview","aria-label":t("settings:codex.modelPreviewLabel"),children:c.codex.join(`
|
|
309
|
-
`)}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Dn(),disabled:d,children:t(d?"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-mcp-personal",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:"lan"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:"AgentFlow MCP 接入"}),o.jsx("p",{className:"af-set-card-subtitle",children:"给 Cursor、Codex 等外部 Agent 配置 AgentFlow MCP,用来运行流程并读取 display 结果。"})]})]}),o.jsx("span",{className:"af-set-badge af-set-badge--ok",children:"AgentFlow as MCP"})]}),o.jsx("p",{className:"af-set-hint",children:"这里不是展示 AgentFlow 已接入的外部 MCP server;那些在 MCP tab 管理。这里生成的是让其他 Agent 连接本平台的配置。"}),o.jsxs("div",{className:"af-set-mcp-connect-grid",children:[o.jsxs("label",{className:"af-set-mcp-field",children:[o.jsx("span",{children:"Base URL"}),o.jsx("input",{className:"af-set-input af-set-input--mono",value:ue,onChange:ee=>Se(ee.target.value),placeholder:"http://127.0.0.1:8875"})]}),o.jsxs("label",{className:"af-set-mcp-field",children:[o.jsx("span",{children:"Token"}),o.jsxs("div",{className:"af-set-mcp-token-row",children:[o.jsx("input",{className:"af-set-input af-set-input--mono",type:"password",value:De,onChange:ee=>Ye(ee.target.value),placeholder:"<AGENTFLOW_TOKEN>"}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:ot,children:Ie==="token"?"已填入":"使用当前登录 Token"})]})]})]}),o.jsxs("div",{className:"af-set-mcp-snippet-grid",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"af-set-mcp-snippet-head",children:[o.jsx("span",{children:"Cursor mcp.json"}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:Rn,children:Ie==="cursor"?"已复制":"复制"})]}),o.jsx("pre",{className:"af-set-mcp-code",children:or})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"af-set-mcp-snippet-head",children:[o.jsx("span",{children:"Codex config.toml"}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:yr,children:Ie==="codex"?"已复制":"复制"})]}),o.jsx("pre",{className:"af-set-mcp-code",children:Ar})]})]}),o.jsx("div",{className:"af-set-mcp-copy-row",children:o.jsxs("button",{type:"button",className:"af-set-footer-primary",onClick:gn,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"content_copy"}),Ie==="prompt"?"已复制 Prompt":"复制 AI 使用 Prompt"]})}),o.jsx("label",{className:"af-set-label-sm",htmlFor:"af-mcp-ai-prompt",children:"AI 配置 Prompt"}),o.jsx("textarea",{id:"af-mcp-ai-prompt",className:"af-set-input af-set-input--mono af-set-mcp-prompt",rows:12,readOnly:!0,value:Fn})]}),o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low af-set-env",children:[o.jsxs("div",{className:"af-set-env-head",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("div",{className:"af-set-env-icon-wrap",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"variables"})}),o.jsx("h2",{className:"af-set-h2",children:t("settings:env.title")})]}),o.jsx("span",{className:"af-set-env-note",children:j?t("settings:env.saving"):e!=null&&e.isAdmin?t("settings:env.noteAdmin"):t("settings:env.note")})]}),o.jsxs("div",{className:"af-set-env-rows"+(e!=null&&e.isAdmin?" af-set-env-rows--admin":""),children:[o.jsxs("div",{className:"af-set-env-row af-set-env-row--header","aria-hidden":!0,children:[o.jsx("span",{children:t("settings:env.key")}),e!=null&&e.isAdmin?o.jsx("span",{children:t("settings:env.scope")}):null,o.jsx("span",{children:t("settings:env.value")}),o.jsx("span",{})]}),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:A,onChange:ee=>O(ee.target.value),"aria-label":t("settings:env.newKey")})}),e!=null&&e.isAdmin?o.jsx("div",{className:"af-set-env-cell af-set-env-cell--scope",children:o.jsxs("div",{className:"af-set-env-scope-switch",role:"group","aria-label":t("settings:env.scope"),children:[o.jsx("button",{type:"button",className:D?"":"is-active",onClick:()=>R(!1),children:t("settings:env.personal")}),o.jsx("button",{type:"button",className:D?"is-active":"",onClick:()=>R(!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:W,onChange:ee=>H(ee.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:jt,disabled:!A.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),t("settings:env.add")]})})]}),k.map(ee=>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:ee.key,onChange:je=>Bn(ee.id,{key:je.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:ee.scope!=="global"?"is-active":"",onClick:()=>Bn(ee.id,{scope:"user"}),children:t("settings:env.personal")}),o.jsx("button",{type:"button",className:ee.scope==="global"?"is-active":"",onClick:()=>Bn(ee.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:T.has(ee.id)?"text":"password",value:ee.value,onChange:je=>Bn(ee.id,{value:je.target.value}),placeholder:jI(ee.value)||t("settings:env.newValue"),"aria-label":t("settings:env.value")}),o.jsx("button",{type:"button",className:"af-set-env-value-toggle",onClick:()=>we(ee.id),"aria-label":T.has(ee.id)?"Hide value":"Show value",children:o.jsx("span",{className:"material-symbols-outlined",children:T.has(ee.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:ee.key}),onClick:()=>gt(ee.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})})]},ee.id))]})]}),e!=null&&e.isAdmin?o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low",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:"hard_drive_2"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:"AgentFlow Data Root"}),o.jsx("p",{className:"af-set-card-subtitle",children:"配置整个 AgentFlow 数据目录的位置,保存时会迁移当前数据。"})]})]}),o.jsx("span",{className:"af-set-badge"+(ke!=null&&ke.envLocked?" af-set-badge--err":" af-set-badge--ok"),children:ke!=null&&ke.envLocked?"Env locked":"Configurable"}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void _n(),disabled:Ze||Bt,children:Ze?"刷新中...":"刷新"})]}),Z?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:Z}):null,o.jsx("label",{className:"af-set-label-sm",htmlFor:"af-agentflow-data-root",children:"Data Root"}),o.jsxs("div",{className:"af-set-input-wrap",children:[o.jsx("input",{id:"af-agentflow-data-root",className:"af-set-input af-set-input--mono",type:"text",value:Kt,onChange:ee=>tt(ee.target.value),placeholder:"/data1/services/mengmai/agentflow",autoComplete:"off",disabled:!!(ke!=null&&ke.envLocked)||Bt}),o.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:()=>void mr(),"aria-label":"保存 AgentFlow Data Root",disabled:Bt||!!(ke!=null&&ke.envLocked),children:o.jsx("span",{className:"material-symbols-outlined",children:Bt?"hourglass_empty":"save"})})]}),o.jsxs("p",{className:"af-set-hint",children:["当前目录:",o.jsx("code",{children:(ke==null?void 0:ke.dataRoot)||Kt||"-"}),ke!=null&&ke.configPath?o.jsxs(o.Fragment,{children:[";配置文件:",o.jsx("code",{children:ke.configPath})]}):null]}),o.jsxs("p",{className:"af-set-hint",children:["这个目录包含 ",o.jsx("code",{children:"users/"}),"、",o.jsx("code",{children:"pipelines/"}),"、",o.jsx("code",{children:"runBuild/"}),"、",o.jsx("code",{children:"auth/"})," 和 admin 配置。 保存到新绝对路径时会复制旧目录内容;旧目录不会自动删除。",ke!=null&&ke.envLocked?" 当前设置了 AGENTFLOW_HOME,需要改环境变量才能生效。":""]}),o.jsx("label",{className:"af-set-label-sm",htmlFor:"af-agentflow-skills-root",children:"Skills Root"}),o.jsxs("div",{className:"af-set-input-wrap",children:[o.jsx("input",{id:"af-agentflow-skills-root",className:"af-set-input af-set-input--mono",type:"text",value:oe,onChange:ee=>be(ee.target.value),placeholder:"/data1/services/mengmai/agentflow/skills",autoComplete:"off",disabled:!!(ke!=null&&ke.skillsEnvLocked)||Bt}),o.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:()=>void mr(),"aria-label":"保存 AgentFlow Skills Root",disabled:Bt||!!(ke!=null&&ke.skillsEnvLocked),children:o.jsx("span",{className:"material-symbols-outlined",children:Bt?"hourglass_empty":"save"})})]}),o.jsxs("p",{className:"af-set-hint",children:["当前 Skills:",o.jsx("code",{children:(ke==null?void 0:ke.skillsRoot)||oe||"-"}),ke!=null&&ke.legacySkillsRootExists?o.jsxs(o.Fragment,{children:[";保存时会补迁移旧目录 ",o.jsx("code",{children:ke.legacySkillsRoot})," 中缺失的 skills。"]}):null]}),o.jsxs("p",{className:"af-set-hint",children:["SkillHub 新安装、更新和卸载都作用于 Skills Root;普通用户只通过 Workspace 的 Load Skills 使用。",ke!=null&&ke.skillsEnvLocked?" 当前设置了 AGENTFLOW_SKILLS_ROOT,需要改环境变量才能生效。":""]})]}):null,e!=null&&e.isAdmin?o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--allowlist",children:[o.jsxs("div",{className:"af-set-env-head",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("div",{className:"af-set-env-icon-wrap",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"manage_accounts"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:t("settings:allowlist.title")}),o.jsx("p",{className:"af-set-card-subtitle",children:t("settings:allowlist.description")})]})]}),o.jsx("span",{className:"af-set-badge"+(ss?" af-set-badge--ok":" af-set-badge--muted"),children:t(ss?"settings:allowlist.enabled":"settings:allowlist.open")}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void hn(),disabled:Et,children:t(Et?"settings:allowlist.refreshing":"common:common.refresh")})]}),At?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:At}):null,ne?o.jsxs("p",{className:"af-set-hint af-set-hint--inline",children:[t("settings:allowlist.file"),":",o.jsx("code",{children:ne})]}):null,o.jsxs("div",{className:"af-allowlist-grid",children:[o.jsxs("div",{className:"af-allowlist-main",children:[o.jsxs("div",{className:"af-allowlist-head",children:[o.jsx("span",{children:t("settings:allowlist.fileList")}),o.jsx("span",{children:Pe?t("settings:allowlist.saving"):t("settings:allowlist.userCount",{count:Q.length})})]}),o.jsx("div",{className:"af-allowlist-list",children:Q.length>0?Q.map(ee=>o.jsxs("div",{className:"af-allowlist-row",children:[o.jsx("span",{className:"af-allowlist-name",children:ee}),o.jsx("button",{type:"button",className:"af-set-env-del",onClick:()=>di(ee),"aria-label":t("settings:allowlist.remove",{username:ee}),disabled:Pe,children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})]},ee)):o.jsx("div",{className:"af-allowlist-empty",children:t("settings:allowlist.emptyFile")})}),o.jsxs("div",{className:"af-allowlist-add",children:[o.jsx("input",{className:"af-set-input af-set-input--sm af-set-input--mono",value:re,onChange:ee=>le(ee.target.value),onKeyDown:ee=>{ee.key==="Enter"&&Xt()},placeholder:"username",autoComplete:"off"}),o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:Xt,disabled:Pe||!re.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),t("settings:allowlist.add")]})]})]}),o.jsxs("div",{className:"af-allowlist-side",children:[o.jsxs("div",{className:"af-allowlist-head",children:[o.jsx("span",{children:t("settings:allowlist.envList")}),o.jsx("span",{children:t("settings:allowlist.readonly")})]}),o.jsx("div",{className:"af-allowlist-env-list",children:ie.length>0?ie.map(ee=>o.jsx("code",{children:ee},ee)):o.jsx("span",{children:t("settings:allowlist.emptyEnv")})}),o.jsx("p",{className:"af-set-hint af-set-hint--inline",children:t("settings:allowlist.unionHint")})]})]})]}):null,o.jsxs("section",{className:"af-settings-rail","aria-label":t("settings:title"),children:[o.jsxs("div",{className:"af-set-rail-card af-set-rail-card--accent",children:[o.jsxs("div",{className:"af-set-rail-inner",children:[o.jsx("h3",{className:"af-set-rail-h3",children:t("settings:system.title")}),o.jsxs("div",{className:"af-set-health-line",children:[o.jsx("span",{className:"af-set-pulse-dot","aria-hidden":!0}),o.jsx("span",{className:"af-set-health-label",children:t(!a&&!p?"settings:system.normal":"settings:system.abnormal")})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.cursorModels")}),o.jsx("span",{children: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.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.codexModels")}),o.jsx("span",{children:c.codex.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.codex.length>0?12+c.codex.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:Bi,"aria-label":t("settings:language.description"),children:Mee.map(ee=>o.jsxs("option",{value:ee.code,children:[ee.flag," ",ee.name]},ee.code))}),o.jsx("p",{className:"af-set-hint",children:t("settings:language.description")})]})]})]})]})})]})})]})}function Ir(e){return new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(Math.max(0,Number(e||0)))}function _f(e){return`${Math.round(Math.max(0,Math.min(1,Number(e||0)))*100)}%`}function Pg(e){const t=Math.max(0,Number(e||0));if(!t)return"-";const n=Math.round(t/1e3);if(n<60)return`${n}s`;const r=Math.round(n/60);if(r<60)return`${r}m`;const s=Math.round(r/60);return s<48?`${s}h`:`${Math.round(s/24)}d`}function Hee(e){const t=String(e||"");return t.includes("-")?t.slice(5):t}function Ig(e){if(!e)return"无运行记录";try{return new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date(Number(e)))}catch{return String(e)}}function Wee(e){const t=String(e||"").trim();return t?t.length>18?t.slice(0,8)+"..."+t.slice(-6):t:"-"}function Vee(e){const t=String(e||"unknown");return t==="success"?"成功":t==="failed"?"失败":t==="running"?"运行中":t==="stopped"?"已停止":t==="interrupted"?"中断":"未知"}function Kee({authUser:e}){const[t,n]=m.useState(null),[r,s]=m.useState(!1),[i,a]=m.useState(""),l=m.useCallback(async()=>{if(e!=null&&e.isAdmin){s(!0),a("");try{const h=await fetch("/api/admin/usage-dashboard"),y=await h.json().catch(()=>({}));if(!h.ok)throw new Error(typeof y.error=="string"?y.error:"HTTP "+h.status);n(y)}catch(h){n(null),a(String((h==null?void 0:h.message)||h))}finally{s(!1)}}},[e==null?void 0:e.isAdmin]);m.useEffect(()=>{l()},[l]);const c=Array.isArray(t==null?void 0:t.dailyTrend)?t.dailyTrend:[],u=m.useMemo(()=>{const w={top:20,right:24,bottom:42,left:42},b=980-w.left-w.right,g=250-w.top-w.bottom,k=c.length>0?c:[],x=Math.max(1,...k.map(O=>Number(O.runs||0))),S=Math.max(1,...k.flatMap(O=>[Number(O.users||0),Number(O.pipelines||0)])),C=O=>w.left+(k.length<=1?b/2:O*b/(k.length-1)),j=O=>w.top+g-Math.max(0,Number(O||0))/x*g,E=O=>w.top+g-Math.max(0,Number(O||0))/S*g,A=O=>k.map((W,H)=>`${H===0?"M":"L"} ${C(H)} ${E(W[O])}`).join(" ");return{width:980,height:250,margin:w,innerHeight:g,rows:k,x:C,yRuns:j,yLine:E,lineUsers:A("users"),linePipelines:A("pipelines"),barWidth:Math.min(34,Math.max(12,b/Math.max(1,k.length)*.44))}},[c]),p=(t==null?void 0:t.usage)||{},f=(t==null?void 0:t.totals)||{},d=Array.isArray(t==null?void 0:t.recentRuns)?t.recentRuns:[];return e!=null&&e.isAdmin?o.jsxs("main",{className:"af-admin-usage-page",children:[o.jsxs("section",{className:"af-admin-usage-hero",children:[o.jsxs("div",{children:[o.jsx("p",{className:"af-admin-usage-eyebrow",children:"Admin / Usage"}),o.jsx("h1",{children:"管理看板"}),o.jsx("p",{children:"重点观察使用率、每日趋势、成功率与各用户流水线活跃度。"})]}),o.jsxs("button",{type:"button",onClick:()=>void l(),disabled:r,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),r?"刷新中":"刷新"]})]}),i?o.jsx("div",{className:"af-project-admin-usage__error",children:i}):null,o.jsxs("section",{className:"af-admin-usage-rate-grid","aria-label":"使用率",children:[o.jsxs("div",{children:[o.jsx("span",{children:"7日活跃用户率"}),o.jsx("strong",{children:_f(p.activeUserRate)}),o.jsxs("em",{children:[Ir(p.activeUsers)," / ",Ir(f.users)," users"]})]}),o.jsxs("div",{children:[o.jsx("span",{children:"7日流水线使用率"}),o.jsx("strong",{children:_f(p.activePipelineRate)}),o.jsxs("em",{children:[Ir(p.activePipelines)," / ",Ir(f.activePipelines)," active"]})]}),o.jsxs("div",{children:[o.jsx("span",{children:"7日 Run"}),o.jsx("strong",{children:Ir(p.runs)}),o.jsxs("em",{children:[Ir(p.avgRunsPerDay)," / day"]})]}),o.jsxs("div",{children:[o.jsx("span",{children:"7日成功率"}),o.jsx("strong",{children:_f(p.successRate)}),o.jsxs("em",{children:["失败率 ",_f(p.failureRate)," · avg ",Pg(p.avgDurationMs)]})]})]}),o.jsxs("section",{className:"af-project-admin-usage af-admin-usage-trend",children:[o.jsx("div",{className:"af-project-admin-usage__head",children:o.jsxs("div",{children:[o.jsx("strong",{children:"每日趋势"}),o.jsx("span",{children:"上方看趋势,下方看最近 50 次具体运行。"})]})}),o.jsxs("div",{className:"af-admin-usage-chart",role:"img","aria-label":"最近 14 天运行趋势",children:[o.jsxs("div",{className:"af-admin-usage-chart__legend",children:[o.jsxs("span",{children:[o.jsx("i",{className:"af-admin-usage-chart__swatch af-admin-usage-chart__swatch--runs"}),"Runs"]}),o.jsxs("span",{children:[o.jsx("i",{className:"af-admin-usage-chart__swatch af-admin-usage-chart__swatch--users"}),"活跃用户"]}),o.jsxs("span",{children:[o.jsx("i",{className:"af-admin-usage-chart__swatch af-admin-usage-chart__swatch--pipelines"}),"活跃流水线"]})]}),o.jsx("div",{className:"af-admin-usage-chart__canvas",children:o.jsxs("svg",{viewBox:`0 0 ${u.width} ${u.height}`,preserveAspectRatio:"xMidYMid meet",children:[o.jsx("line",{className:"af-admin-usage-chart__axis",x1:u.margin.left,y1:u.margin.top+u.innerHeight,x2:u.width-u.margin.right,y2:u.margin.top+u.innerHeight}),[.25,.5,.75,1].map(h=>o.jsx("line",{className:"af-admin-usage-chart__grid",x1:u.margin.left,y1:u.margin.top+u.innerHeight-u.innerHeight*h,x2:u.width-u.margin.right,y2:u.margin.top+u.innerHeight-u.innerHeight*h},h)),u.rows.map((h,y)=>{const w=u.x(y),b=u.yRuns(h.runs),g=u.margin.top+u.innerHeight,k=Math.max(2,g-b);return o.jsxs("g",{children:[o.jsx("rect",{className:"af-admin-usage-chart__run-bar",x:w-u.barWidth/2,y:g-k,width:u.barWidth,height:k,rx:"5",children:o.jsx("title",{children:`${h.date}: ${h.runs} runs`})}),o.jsx("text",{className:"af-admin-usage-chart__value",x:w,y:g+22,children:Ir(h.runs)}),o.jsx("text",{className:"af-admin-usage-chart__date",x:w,y:g+42,children:Hee(h.date)})]},h.date)}),u.rows.length>0?o.jsxs(o.Fragment,{children:[o.jsx("path",{className:"af-admin-usage-chart__line af-admin-usage-chart__line--users",d:u.lineUsers}),o.jsx("path",{className:"af-admin-usage-chart__line af-admin-usage-chart__line--pipelines",d:u.linePipelines}),u.rows.map((h,y)=>{const w=u.x(y);return o.jsxs("g",{children:[o.jsx("circle",{className:"af-admin-usage-chart__point af-admin-usage-chart__point--users",cx:w,cy:u.yLine(h.users),r:"3.5"}),o.jsx("circle",{className:"af-admin-usage-chart__point af-admin-usage-chart__point--pipelines",cx:w,cy:u.yLine(h.pipelines),r:"3.5"})]},`${h.date}-points`)})]}):null]})})]}),o.jsx("div",{className:"af-project-admin-usage__table-wrap",children:o.jsxs("table",{className:"af-project-admin-usage__table af-admin-usage-table--recent",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"用户"}),o.jsx("th",{children:"流水线"}),o.jsx("th",{children:"运行时间"}),o.jsx("th",{children:"状态"}),o.jsx("th",{children:"耗时"}),o.jsx("th",{children:"Run ID"})]})}),o.jsx("tbody",{children:d.length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:6,children:"暂无运行明细"})}):d.map(h=>o.jsxs("tr",{children:[o.jsxs("td",{children:[o.jsx("strong",{children:h.username||h.userId||"-"}),o.jsx("span",{children:h.userId||"-"})]}),o.jsxs("td",{children:[o.jsx("strong",{children:h.flowId||"-"}),o.jsxs("span",{children:[h.runType==="workspace"?"Workspace Run":"Pipeline"," · ",h.flowSource||"user"]})]}),o.jsxs("td",{children:[o.jsx("strong",{children:Ig(h.at)}),h.endedAt?o.jsxs("span",{children:["结束 ",Ig(h.endedAt)]}):o.jsx("span",{children:"未结束"})]}),o.jsx("td",{children:o.jsx("span",{className:"af-project-admin-usage__chips",children:o.jsx("em",{children:Vee(h.status)})})}),o.jsx("td",{children:Pg(h.durationMs)}),o.jsx("td",{children:o.jsx("code",{className:"af-admin-usage-run-id",children:Wee(h.runId)})})]},`${h.userId}:${h.flowSource}:${h.flowId}:${h.runId}:${h.at}`))})]})})]}),o.jsxs("section",{className:"af-project-admin-usage",children:[o.jsx("div",{className:"af-project-admin-usage__head",children:o.jsxs("div",{children:[o.jsx("strong",{children:"用户使用明细"}),o.jsx("span",{children:"按用户汇总 Pipeline 数、Run 次数和最近运行。"})]})}),o.jsx("div",{className:"af-project-admin-usage__table-wrap",children:o.jsxs("table",{className:"af-project-admin-usage__table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"User"}),o.jsx("th",{children:"Pipeline"}),o.jsx("th",{children:"Runs"}),o.jsx("th",{children:"状态"}),o.jsx("th",{children:"最近运行"})]})}),o.jsx("tbody",{children:r&&!t?o.jsx("tr",{children:o.jsx("td",{colSpan:5,children:"正在加载..."})}):((t==null?void 0:t.users)||[]).length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:5,children:"暂无用户数据"})}):((t==null?void 0:t.users)||[]).map(h=>{var y,w,b,g,k,x,S,C,j,E,A;return o.jsxs("tr",{children:[o.jsxs("td",{children:[o.jsx("strong",{children:h.username||h.userId}),o.jsxs("span",{children:[h.userId,h.isAdmin?" · admin":""]})]}),o.jsxs("td",{children:[o.jsx("strong",{children:Ir((y=h.pipelines)==null?void 0:y.total)}),o.jsxs("span",{children:[Ir((w=h.pipelines)==null?void 0:w.active)," active / ",Ir((b=h.pipelines)==null?void 0:b.archived)," archived"]})]}),o.jsxs("td",{children:[o.jsx("strong",{children:Ir((g=h.runs)==null?void 0:g.total)}),o.jsxs("span",{children:["avg ",Pg((k=h.runs)==null?void 0:k.avgDurationMs)]})]}),o.jsx("td",{children:o.jsxs("span",{className:"af-project-admin-usage__chips",children:[o.jsxs("em",{children:["成功 ",Ir((x=h.runs)==null?void 0:x.success)]}),o.jsxs("em",{children:["失败 ",Ir((S=h.runs)==null?void 0:S.failed)]}),o.jsxs("em",{children:["运行中 ",Ir((C=h.runs)==null?void 0:C.running)]})]})}),o.jsx("td",{children:(j=h.runs)!=null&&j.lastRunAt?o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:((E=h.runs)==null?void 0:E.lastRunFlowId)||"-"}),o.jsxs("span",{children:[((A=h.runs)==null?void 0:A.lastRunStatus)||"unknown"," · ",Ig(h.runs.lastRunAt)]})]}):o.jsx("span",{children:"无运行记录"})})]},h.userId)})})]})})]})]}):o.jsx("main",{className:"af-admin-usage-page",children:o.jsx("section",{className:"af-project-admin-usage",children:o.jsx("div",{className:"af-project-admin-usage__head",children:o.jsxs("div",{children:[o.jsx("strong",{children:"管理看板"}),o.jsx("span",{children:"需要管理员权限。"})]})})})})}function Uee(e){if(!e)return"";const t=Date.parse(e);if(Number.isNaN(t))return String(e);try{return new Intl.DateTimeFormat("zh-CN",{dateStyle:"short",timeStyle:"medium"}).format(new Date(t))}catch{return String(e)}}function qee({authUser:e}){const{navigate:t}=li(),[n,r]=m.useState(""),[s,i]=m.useState(""),[a,l]=m.useState(!1),[c,u]=m.useState(""),[p,f]=m.useState(!1),[d,h]=m.useState([]),[y,w]=m.useState(!1),[b,g]=m.useState(""),k=!!(e!=null&&e.isAdmin),x=m.useCallback(async()=>{if(k){w(!0),g("");try{const C=await fetch("/api/feedback"),j=await C.json().catch(()=>({}));if(!C.ok)throw new Error(j.error||"加载失败");h(Array.isArray(j.feedback)?j.feedback:[])}catch(C){g(String(C.message||C)),h([])}finally{w(!1)}}},[k]);m.useEffect(()=>{x()},[x]);const S=async C=>{if(C.preventDefault(),!a){l(!0),u("");try{const j=await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:n,content:s,pageUrl:window.location.href})}),E=await j.json().catch(()=>({}));if(!j.ok)throw new Error(E.error||"提交失败");f(!0),r(""),i("")}catch(j){u(String(j.message||j))}finally{l(!1)}}};return k?o.jsx("main",{className:"af-feedback-page",children:o.jsxs("section",{className:"af-feedback-panel af-feedback-panel--admin",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("div",{className:"af-feedback-admin-actions",children:[o.jsxs("button",{type:"button",className:"af-feedback-back",onClick:()=>void x(),disabled:y,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:y?"hourglass_empty":"refresh"}),y?"刷新中...":"刷新"]}),o.jsxs("button",{type:"button",className:"af-feedback-back",onClick:()=>t("/projects"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),"返回"]})]})]}),b?o.jsx("p",{className:"af-err af-feedback-error",children:b}):null,o.jsx("div",{className:"af-feedback-list af-feedback-list--page",children:d.length>0?d.map(C=>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:C.title||"未命名反馈"}),o.jsxs("p",{children:[o.jsx("span",{children:C.username||C.userId||"unknown"}),o.jsx("span",{children:Uee(C.createdAt)})]})]}),C.contact?o.jsx("span",{className:"af-feedback-item__contact",children:C.contact}):null]}),o.jsx("p",{className:"af-feedback-item__content",children:C.content}),C.pageUrl?o.jsx("code",{className:"af-feedback-item__url",children:C.pageUrl}):null]},C.id)):o.jsx("div",{className:"af-feedback-empty",children:y?"正在加载反馈...":"暂无反馈"})})]})}):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:()=>t("/projects"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),"返回"]})]}),p?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:S,children:[o.jsxs("label",{className:"af-feedback-field",children:[o.jsx("span",{children:"标题"}),o.jsx("input",{value:n,onChange:C=>r(C.target.value),placeholder:"一句话说明问题或建议",maxLength:120,required:!0})]}),o.jsxs("label",{className:"af-feedback-field",children:[o.jsx("span",{children:"反馈内容"}),o.jsx("textarea",{value:s,onChange:C=>i(C.target.value),placeholder:"描述具体场景、期望表现、实际表现或复现步骤",maxLength:5e3,rows:9,required:!0})]}),c?o.jsx("p",{className:"af-err af-feedback-error",children:c}):null,o.jsx("div",{className:"af-feedback-actions",children:o.jsxs("button",{type:"submit",className:"af-feedback-submit",disabled:a||!n.trim()||!s.trim(),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:a?"hourglass_empty":"send"}),a?"提交中...":"提交反馈"]})})]})]})})}function EI(){return`m_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function Lj(e,t=[]){const n=new Set((Array.isArray(t)?t:[]).map(String));return Object.entries(e&&typeof e=="object"?e:{}).map(([r,s])=>({id:EI(),key:r,value:String(s??""),private:n.has(r)}))}function Oj(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 ep(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(`
|
|
310
|
-
`),description:String((e==null?void 0:e.description)||t.description||""),envRows:Lj(t.env||(e==null?void 0:e.env),e==null?void 0:e.privateEnvKeys),headerRows:Lj(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 Tg(){return ep({name:"",raw:{command:""}})}function Yee(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=Oj(e.envRows),s=Oj(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 Dj(e){return e?e.ok?`${e.toolCount||0} tools enabled`:`Error - ${e.error||"Show Output"}`:"未检测"}function Fj(e){return e?e.ok?"ok":"error":"unknown"}function Ax(e){return e==="ok"?"ok":e==="partial"?"partial":e==="unsupported"?"error":"unknown"}function Gee(e,t){return e&&e.label||t}function Jee({server:e}){const t=(e==null?void 0:e.backends)||{},n=[["Cursor",t.cursor],["Codex",t.codex]];return o.jsx("div",{className:"af-mcp-backends",children:n.map(([r,s])=>o.jsxs("div",{className:`af-mcp-backend af-mcp-backend--${Ax(s==null?void 0:s.status)}`,children:[o.jsxs("div",{className:"af-mcp-backend-head",children:[o.jsx("strong",{children:r}),o.jsx("span",{children:Gee(s,"Unknown")})]}),Array.isArray(s==null?void 0:s.reasons)&&s.reasons.length?o.jsx("ul",{children:s.reasons.map(i=>o.jsx("li",{children:i},i))}):o.jsx("p",{children:"当前配置可直接使用。"})]},r))})}function zj({title:e,rows:t,onChange:n,placeholderKey:r="KEY",placeholderValue:s="value"}){const i=(a,l,c)=>n(t.map(u=>u.id===a?{...u,[l]:c}:u));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:EI(),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 Xee(){var D;const[e,t]=m.useState(""),[n,r]=m.useState([]),[s,i]=m.useState(Tg),[a,l]=m.useState(""),[c,u]=m.useState(!1),[p,f]=m.useState(!1),[d,h]=m.useState(!1),[y,w]=m.useState({}),[b,g]=m.useState(""),[k,x]=m.useState(""),S=m.useMemo(()=>n.find(R=>R.name===a)||null,[a,n]),C=S&&y[S.name]||null,j=m.useCallback(async()=>{u(!0),g("");try{const R=await fetch("/api/mcps"),T=await R.json().catch(()=>({}));if(!R.ok)throw new Error(T.error||"MCP HTTP "+R.status);const V=Array.isArray(T.servers)?T.servers:[];t(String(T.path||"")),r(V),a&&V.some(F=>F.name===a)&&i(ep(V.find(F=>F.name===a)))}catch(R){g(String(R.message||R))}finally{u(!1)}},[a]);m.useEffect(()=>{j()},[j]);const E=()=>{l(""),i(Tg()),x(""),g("")},A=R=>{l(R.name),i(ep(R)),x(""),g("")},O=async(R="")=>{h(!0),g(""),x("");try{const T=await fetch("/api/mcps/check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(R?{name:R}:{})}),V=await T.json().catch(()=>({}));if(!T.ok)throw new Error(V.error||"检测 MCP 失败");const F=Array.isArray(V.results)?V.results:[];w(M=>{const I={...M};for(const B of F)B!=null&&B.name&&(I[B.name]=B);return I}),x(R?`已检测 ${R}。`:"已检测所有 MCP。")}catch(T){g(String(T.message||T))}finally{h(!1)}},W=async()=>{f(!0),g(""),x("");try{const R=Yee(s);if(!R.nextName)throw new Error("请填写 MCP 名称");const T=await fetch("/api/mcps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(R)}),V=await T.json().catch(()=>({}));if(!T.ok)throw new Error(V.error||"保存 MCP 失败");const F=Array.isArray(V.servers)?V.servers:[];r(F),t(String(V.path||e)),l(R.nextName),i(ep(F.find(M=>M.name===R.nextName)||null)),w(M=>{const I={...M};return s.originalName&&s.originalName!==R.nextName&&delete I[s.originalName],delete I[R.nextName],I}),x("已保存。Cursor CLI 下次启动时会读取新配置。")}catch(R){g(String(R.message||R))}finally{f(!1)}},H=async R=>{if(R!=null&&R.name&&window.confirm(`删除 MCP "${R.name}"?`)){f(!0),g(""),x("");try{const T=await fetch("/api/mcps/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:R.name})}),V=await T.json().catch(()=>({}));if(!T.ok)throw new Error(V.error||"删除 MCP 失败");r(Array.isArray(V.servers)?V.servers:[]),l(""),i(Tg()),w(F=>{const M={...F};return delete M[R.name],M}),x("已删除。")}catch(T){g(String(T.message||T))}finally{f(!1)}}};return o.jsxs("main",{className:"af-settings-page",children:[o.jsxs("header",{className:"af-settings-top",children:[o.jsxs("div",{className:"af-settings-crumb",children:[o.jsx("span",{className:"af-settings-crumb-muted",children:"AgentFlow"}),o.jsx("span",{className:"af-settings-crumb-sep",children:"/"}),o.jsx("span",{className:"af-settings-crumb-active",children:"MCP"})]}),o.jsxs("div",{className:"af-settings-top-right",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:j,disabled:c||p,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>O(),disabled:d||c||p||n.length===0,children:d?"检测中...":"检测状态"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:E,disabled:p,children:"新增 MCP"})]})]}),o.jsx("div",{className:"af-settings-body",children:o.jsxs("div",{className:"af-settings-inner",children:[o.jsxs("section",{className:"af-settings-hero",children:[o.jsx("h1",{className:"af-settings-h1",children:"MCP 管理"}),o.jsxs("p",{className:"af-settings-lead",children:["新增、编辑和删除 Cursor MCP server。当前配置文件:",o.jsx("span",{className:"af-settings-code",children:e||"~/.cursor/mcp.json"})]})]}),o.jsxs("div",{className:"af-mcp-layout",children:[o.jsxs("section",{className:"af-set-card af-mcp-list-card",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2",children:"Servers"}),o.jsxs("div",{className:"af-mcp-list-head-actions",children:[o.jsx("span",{className:"af-set-badge af-set-badge--muted",children:n.length}),o.jsxs("button",{type:"button",className:"af-set-btn-mini",onClick:E,disabled:p,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:E,disabled:p,children:"新增 MCP Server"})]}):null,o.jsx("div",{className:"af-mcp-server-list",children:n.map(R=>{var T,V,F,M;return o.jsxs("button",{type:"button",className:"af-mcp-server-item"+(a===R.name?" af-mcp-server-item--active":""),onClick:()=>A(R),children:[o.jsx("span",{className:"material-symbols-outlined",children:R.type==="url"?"cloud":"terminal"}),o.jsxs("span",{children:[o.jsxs("span",{className:"af-mcp-server-title",children:[o.jsx("strong",{children:R.name}),o.jsx("small",{className:`af-mcp-server-health af-mcp-server-health--${Fj(y[R.name])}`,children:Dj(y[R.name])})]}),o.jsxs("span",{className:"af-mcp-server-backends",children:[o.jsx("small",{className:`af-mcp-backend-pill af-mcp-backend-pill--${Ax((V=(T=R.backends)==null?void 0:T.cursor)==null?void 0:V.status)}`,children:"Cursor"}),o.jsx("small",{className:`af-mcp-backend-pill af-mcp-backend-pill--${Ax((M=(F=R.backends)==null?void 0:F.codex)==null?void 0:M.status)}`,children:"Codex"})]}),o.jsx("em",{children:R.url||[R.command,...R.args||[]].filter(Boolean).join(" ")})]})]},R.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:S?"编辑 MCP":"新增 MCP"}),o.jsx("p",{className:"af-set-p af-set-p--tight",children:"保存后会写入 Cursor MCP 配置。已运行的 agent 进程不会热更新,下一次启动会读取新配置。"})]}),S?o.jsxs("div",{className:"af-mcp-editor-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>O(S.name),disabled:d||p,children:d?"检测中...":"检测"}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>H(S),disabled:p,children:"删除"})]}):null]}),b?o.jsx("p",{className:"af-mcp-error",children:b}):null,k?o.jsx("p",{className:"af-mcp-status",children:k}):null,S?o.jsx(Jee,{server:S}):null,C?o.jsxs("div",{className:`af-mcp-check af-mcp-check--${Fj(C)}`,children:[o.jsxs("div",{className:"af-mcp-check-head",children:[o.jsx("strong",{children:Dj(C)}),o.jsxs("span",{children:[C.elapsedMs||0,"ms"]})]}),C.error?o.jsx("p",{children:C.error}):null,(D=C.tools)!=null&&D.length?o.jsx("div",{className:"af-mcp-tools-list",children:C.tools.map(R=>o.jsxs("div",{className:"af-mcp-tool-row",children:[o.jsx("strong",{children:R.name}),R.description?o.jsx("span",{children:R.description}):null]},R.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:R=>i(T=>({...T,name:R.target.value})),placeholder:"github"})]}),o.jsxs("label",{className:"af-set-label",children:["类型",o.jsxs("select",{className:"af-set-input",value:s.type,onChange:R=>i(T=>({...T,type:R.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:R=>i(T=>({...T,url:R.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:R=>i(T=>({...T,command:R.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:R=>i(T=>({...T,argsText:R.target.value})),placeholder:`mcp-server-example
|
|
311
|
-
--flag`})]})]}),o.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["描述",o.jsx("input",{className:"af-set-input",value:s.description,onChange:R=>i(T=>({...T,description:R.target.value})),placeholder:"这个 MCP 提供什么能力"})]}),o.jsx(zj,{title:"Headers",rows:s.headerRows,onChange:R=>i(T=>({...T,headerRows:R})),placeholderKey:"Authorization",placeholderValue:"Bearer ..."}),o.jsx(zj,{title:"Env",rows:s.envRows,onChange:R=>i(T=>({...T,envRows:R})),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:R=>i(T=>({...T,extraJson:R.target.value}))})]})]}),o.jsxs("div",{className:"af-mcp-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:E,disabled:p,children:"清空"}),o.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:W,disabled:p,children:p?"保存中...":"保存 MCP"})]})]})]})]})})]})}function Bj(e){if(!e)return"-";const t=typeof e=="number"?e:Date.parse(String(e));return Number.isFinite(t)?new Date(t).toLocaleString():String(e)}function Qee(e){return(e==null?void 0:e.kind)==="workspace"?"Workspace":"Pipeline"}function Zee(e){if(e!=null&&e.running)return"运行中";if(!(e!=null&&e.enabled))return"已停用";const t=String((e==null?void 0:e.lastStatus)||"").trim();return!t||t==="armed"||t==="enabled"?"已启用":t==="success"?"上次成功":t==="failed"?"上次失败":t==="invalid"?"配置异常":t.startsWith("skipped")?"已跳过":t}function ete(){const[e,t]=m.useState([]),[n,r]=m.useState(!1),[s,i]=m.useState(""),[a,l]=m.useState(""),c=m.useCallback(async()=>{r(!0),i("");try{const f=await fetch("/api/schedules"),d=await f.json().catch(()=>({}));if(!f.ok)throw new Error(d.error||"读取定时任务失败");t(Array.isArray(d.schedules)?d.schedules:[])}catch(f){i(String(f.message||f)),t([])}finally{r(!1)}},[]);m.useEffect(()=>{c()},[c]);const u=m.useCallback(async f=>{const d=`${f.kind}:${f.flowSource||"user"}:${f.flowId||""}:${f.scheduleNodeId||""}`;l(d),i("");try{const h=await fetch("/api/schedule/toggle",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:f.kind,flowId:f.flowId,flowSource:f.flowSource||"user",scheduleNodeId:f.scheduleNodeId||"",enabled:!f.enabled})}),y=await h.json().catch(()=>({}));if(!h.ok||y.success===!1)throw new Error(y.error||"更新定时任务失败");await c()}catch(h){i(String(h.message||h))}finally{l("")}},[c]),p=m.useMemo(()=>{const f=e.filter(h=>h.enabled).length,d=e.filter(h=>h.kind==="workspace").length;return{total:e.length,enabled:f,workspace:d,pipeline:e.length-d}},[e]);return o.jsxs("div",{className:"af-settings-page af-schedules-page",children:[o.jsxs("div",{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:"定时任务"})]}),o.jsxs("button",{type:"button",className:"af-schedules-refresh",onClick:()=>void c(),disabled:n,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:n?"hourglass_empty":"refresh"}),"刷新"]})]}),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:"定时任务"}),o.jsx("p",{className:"af-settings-lead",children:"统一查看服务器上的 Pipeline 定时任务和 Workspace Scheduled Run,并在这里快捷启停。"})]}),o.jsxs("div",{className:"af-schedules-summary","aria-label":"定时任务汇总",children:[o.jsxs("div",{children:[o.jsx("span",{children:"全部"}),o.jsx("strong",{children:p.total})]}),o.jsxs("div",{children:[o.jsx("span",{children:"启用中"}),o.jsx("strong",{children:p.enabled})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Workspace"}),o.jsx("strong",{children:p.workspace})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Pipeline"}),o.jsx("strong",{children:p.pipeline})]})]}),s?o.jsx("div",{className:"af-schedules-error",children:s}):null,n?o.jsx("div",{className:"af-schedules-empty",children:"Loading..."}):null,!n&&e.length===0?o.jsx("div",{className:"af-schedules-empty",children:"暂无定时任务"}):null,o.jsx("div",{className:"af-schedules-list",children:e.map(f=>{const d=`${f.kind}:${f.flowSource||"user"}:${f.flowId||""}:${f.scheduleNodeId||""}`,h=a===d;return o.jsxs("article",{className:"af-schedule-card",children:[o.jsxs("div",{className:"af-schedule-card__main",children:[o.jsxs("div",{className:"af-schedule-card__title-row",children:[o.jsx("strong",{children:f.label||f.flowId||"-"}),o.jsx("span",{className:`af-schedule-badge af-schedule-badge--${f.kind||"pipeline"}`,children:Qee(f)}),o.jsx("span",{className:`af-schedule-state ${f.enabled?"af-schedule-state--on":"af-schedule-state--off"}`,children:Zee(f)})]}),o.jsxs("div",{className:"af-schedule-card__meta",children:[o.jsx("span",{children:f.flowId||"-"}),o.jsx("span",{children:f.flowSource||"user"}),f.scheduleNodeId?o.jsx("span",{children:f.scheduleNodeId}):null]}),o.jsxs("div",{className:"af-schedule-card__grid",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Cron"}),o.jsx("strong",{children:f.cron||"-"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"时区"}),o.jsx("strong",{children:f.timezone||"Asia/Shanghai"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"下次执行"}),o.jsx("strong",{children:Bj(f.nextRunAt)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"最近执行"}),o.jsx("strong",{children:Bj(f.lastTriggeredAt)})]})]}),f.lastError?o.jsx("p",{className:"af-schedule-card__error",children:f.lastError}):null]}),o.jsx("div",{className:"af-schedule-card__actions",children:o.jsxs("button",{type:"button",className:f.enabled?"af-schedule-toggle af-schedule-toggle--on":"af-schedule-toggle af-schedule-toggle--off",disabled:h,"aria-pressed":f.enabled,title:f.enabled?"点击停用":"点击启用",onClick:()=>void u(f),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:h?"hourglass_empty":f.enabled?"toggle_on":"toggle_off"}),f.enabled?"已启用":"已停用"]})})]},d)})})]})})]})}const Hj={id:"",title:"Untitled Node",definitionId:"",agentMessages:[],promptDraft:"",manifest:{id:"",version:"1.0.0",name:"",runtime:{type:"agent_subAgent"},inputs:[],outputs:[],configSchema:{fields:[]},ui:{card:{icon:"extension",variant:"default",actions:[]}}},config:{},files:{},test:{inputs:{},log:[],status:"not run"}};function Wj(e){const t=(e==null?void 0:e.manifest)||{};return(e==null?void 0:e.definitionId)||`marketplace:${t.id||(e==null?void 0:e.id)||"node"}@${t.version||"1.0.0"}`}function tte(e){var c,u,p,f,d,h,y,w,b,g,k,x;const t=(e==null?void 0:e.manifest)||{},n=(e==null?void 0:e.files)||{},r=Array.isArray(t.inputs)?t.inputs:[],s=Array.isArray(t.outputs)?t.outputs:[],i=Array.isArray((c=t.configSchema)==null?void 0:c.fields)?t.configSchema.fields:[],a=Array.isArray((p=(u=t.ui)==null?void 0:u.card)==null?void 0:p.actions)?t.ui.card.actions:[],l=(f=e==null?void 0:e.test)!=null&&f.inputs&&typeof e.test.inputs=="object"?e.test.inputs:{};return[{id:"contract",label:"Contract",icon:"account_tree",rows:[...r.map(S=>[`input.${S.name||"-"}`,`${S.type||"text"}${S.required?" · required":""}${S.default?` · default: ${S.default}`:""}`]),...s.map(S=>[`output.${S.name||"-"}`,S.type||"text"]),...i.map(S=>[`config.${S.key||"-"}`,S.type||"text"])]},{id:"runtime",label:"Runtime",icon:"terminal",rows:[["runtime.type",((d=t.runtime)==null?void 0:d.type)||t.baseDefinitionId||"tool_nodejs"],["runtime.entry",((h=t.runtime)==null?void 0:h.entry)||"scripts/run.mjs"],["prompt.md",n["prompt.md"]||"-"],["implementation.md",n["implementation.md"]||"-"]]},{id:"ui",label:"UI",icon:"dashboard_customize",rows:[["card.variant",((w=(y=t.ui)==null?void 0:y.card)==null?void 0:w.variant)||"default"],["card.icon",((g=(b=t.ui)==null?void 0:b.card)==null?void 0:g.icon)||"extension"],...a.map(S=>[`action.${S.id||S.label||"-"}`,S.variant||S.label||"secondary"])]},{id:"tests",label:"Tests",icon:"science",rows:[...Object.entries(l).map(([S,C])=>[`sample.${S}`,String(C)]),["last run",`${((k=e==null?void 0:e.test)==null?void 0:k.status)||"not run"}${(x=e==null?void 0:e.test)!=null&&x.durationMs?` · ${e.test.durationMs}ms`:""}`]]}]}function nte(){var R,T,V,F,M,I,B;const[e,t]=m.useState(null),[n,r]=m.useState("runtime"),[s,i]=m.useState(!1),[a,l]=m.useState(!0),[c,u]=m.useState(""),[p,f]=m.useState(!1),[d,h]=m.useState(""),y=e||Hj,w=m.useMemo(()=>tte(y),[y]),b=m.useMemo(()=>w.find(_=>_.id===n)||w[1],[n,w]),g=(y==null?void 0:y.manifest)||{},k=(y==null?void 0:y.config)||{},x=((R=y==null?void 0:y.test)==null?void 0:R.inputs)||{},S=Array.isArray((T=y==null?void 0:y.test)==null?void 0:T.log)?y.test.log:[],C=((F=(V=g.ui)==null?void 0:V.card)==null?void 0:F.icon)||"event_repeat",j=((I=(M=g.ui)==null?void 0:M.card)==null?void 0:I.variant)||"default",E=k.enabled===!0,A=m.useCallback(async()=>{var _;l(!0),u("");try{const q=await fetch("/api/node-studio/drafts"),z=await q.json().catch(()=>({}));if(!q.ok)throw new Error(z.error||"读取节点草稿失败");const $=Array.isArray(z.drafts)?z.drafts[0]:null;if(!($!=null&&$.id)){t(null),h("");return}const Q=await fetch(`/api/node-studio/draft?id=${encodeURIComponent($.id)}`),te=await Q.json().catch(()=>({}));if(!Q.ok)throw new Error(te.error||"读取节点草稿失败");t(te.draft||null),h(String(((_=te.draft)==null?void 0:_.promptDraft)||""))}catch(q){u(String(q.message||q))}finally{l(!1)}},[]);m.useEffect(()=>{A()},[A]);const O=m.useCallback(async(_={})=>{var q;f(!0),u("");try{const z=await fetch("/api/node-studio/draft",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:(e==null?void 0:e.id)||"untitled_node",..._})}),$=await z.json().catch(()=>({}));if(!z.ok||$.ok===!1)throw new Error($.error||"保存节点草稿失败");t($.draft||e),h(String(((q=$.draft||e)==null?void 0:q.promptDraft)||""))}catch(z){u(String(z.message||z))}finally{f(!1)}},[e]),W=()=>{i(!0),window.setTimeout(()=>i(!1),900)},H=_=>{const q={...k,enabled:_};t(z=>({...z||Hj,config:q})),O({config:{enabled:_}})},D=()=>{O({promptDraft:d,appendUserMessage:!0})};return o.jsxs("div",{className:"af-node-studio-page",children:[o.jsxs("header",{className:"af-node-studio-top",children:[o.jsxs("div",{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:"Node Studio"})]}),o.jsx("h1",{children:"节点编辑器"})]}),o.jsxs("div",{className:"af-node-studio-actions",children:[o.jsxs("button",{type:"button",onClick:()=>void A(),disabled:a,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"visibility"}),a?"Loading":"Preview"]}),o.jsxs("button",{type:"button",onClick:W,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:s?"sync":"science"}),"Test"]}),o.jsxs("button",{type:"button",className:"af-node-studio-actions__primary",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"publish"}),"Publish"]})]})]}),o.jsxs("main",{className:"af-node-studio-shell",children:[o.jsxs("aside",{className:"af-node-studio-agent","aria-label":"AI Agent",children:[o.jsxs("div",{className:"af-node-studio-panel-head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"auto_awesome"}),o.jsx("strong",{children:"AI Agent"})]}),c?o.jsx("div",{className:"af-node-studio-error",children:c}):null,o.jsxs("div",{className:"af-node-studio-thread",children:[e?null:o.jsx("div",{className:"af-node-studio-empty",children:"还没有节点草稿。描述你要创建的节点,发送后会创建一个新的 draft。"}),(Array.isArray(y==null?void 0:y.agentMessages)?y.agentMessages:[]).map((_,q)=>o.jsx("div",{className:_.role==="user"?"af-node-studio-message af-node-studio-message--user":"af-node-studio-message",children:_.text||""},`${_.role||"message"}-${q}`)),o.jsxs("div",{className:"af-node-studio-agent-tools",children:[o.jsxs("button",{type:"button",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"edit"}),"修改 UI"]}),o.jsxs("button",{type:"button",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"code"}),"改脚本"]}),o.jsxs("button",{type:"button",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"bug_report"}),"修复报错"]})]})]}),o.jsxs("label",{className:"af-node-studio-prompt",children:[o.jsx("span",{children:"需求"}),o.jsx("textarea",{value:d,onChange:_=>h(_.target.value)})]}),o.jsxs("button",{type:"button",className:"af-node-studio-send",onClick:D,disabled:p,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:p?"sync":"send"}),p?"Saving":"Send"]})]}),o.jsxs("section",{className:"af-node-studio-preview","aria-label":"Preview and Test",children:[o.jsxs("div",{className:"af-node-studio-panel-head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"view_in_ar"}),o.jsx("strong",{children:"Preview / Test"})]}),o.jsxs("div",{className:"af-node-studio-preview-grid",children:[o.jsx("div",{className:"af-node-studio-preview-stage",children:e?j==="schedule"?o.jsxs("div",{className:"af-node-preview-card",children:[o.jsxs("div",{className:"af-node-preview-card__head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:C}),o.jsx("strong",{children:y.title||g.name||"Untitled Node"}),o.jsx("code",{children:Wj(y)})]}),o.jsxs("label",{className:"af-node-preview-toggle",children:[o.jsx("input",{type:"checkbox",checked:E,onChange:_=>H(_.target.checked)}),o.jsx("span",{children:E?"定时开启":"定时关闭"})]}),o.jsxs("div",{className:"af-node-preview-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"频率"}),o.jsxs("select",{value:k.scheduleType||"daily",onChange:_=>O({config:{scheduleType:_.target.value}}),children:[o.jsx("option",{value:"daily",children:"每天"}),o.jsx("option",{value:"weekly",children:"每周"})]})]}),o.jsxs("label",{children:[o.jsx("span",{children:"时间"}),o.jsxs("div",{children:[o.jsxs("select",{value:k.hour||"09",onChange:_=>O({config:{hour:_.target.value}}),children:[o.jsx("option",{children:"09"}),o.jsx("option",{children:"10"})]}),o.jsxs("select",{value:k.minute||"00",onChange:_=>O({config:{minute:_.target.value}}),children:[o.jsx("option",{children:"00"}),o.jsx("option",{children:"30"})]})]})]})]}),o.jsxs("div",{className:"af-node-preview-meta",children:[o.jsxs("span",{children:[k.scheduleType==="weekly"?"每周":"每天"," ",k.hour||"09",":",k.minute||"00"]}),o.jsx("span",{children:"Next -"}),o.jsx("span",{children:E?"enabled":"disabled"})]}),o.jsxs("div",{className:"af-node-preview-actions",children:[o.jsxs("button",{type:"button",className:"af-node-preview-run",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"play_arrow"}),"立即运行"]}),o.jsxs("button",{type:"button",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"article"}),"日志"]})]})]}):o.jsxs("div",{className:"af-node-preview-card af-node-preview-card--default",children:[o.jsxs("div",{className:"af-node-preview-card__head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:C}),o.jsx("strong",{children:y.title||g.name||"Untitled Node"}),o.jsx("code",{children:Wj(y)})]}),o.jsxs("div",{className:"af-node-preview-default-body",children:[o.jsx("p",{children:g.description||"这个节点还没有描述。AI 生成 runtime、prompt 或 script 后,内部信息会显示在右侧。"}),o.jsxs("div",{children:[o.jsxs("span",{children:[Array.isArray(g.inputs)?g.inputs.length:0," inputs"]}),o.jsxs("span",{children:[Array.isArray(g.outputs)?g.outputs.length:0," outputs"]}),o.jsx("span",{children:((B=g.runtime)==null?void 0:B.type)||g.baseDefinitionId||"agent_subAgent"})]})]})]}):o.jsxs("div",{className:"af-node-preview-empty",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add_box"}),o.jsx("strong",{children:"暂无预览"}),o.jsx("p",{children:"先在左侧描述你要创建的节点,AI 生成 draft 后这里会展示节点卡片。"})]})}),o.jsxs("div",{className:"af-node-studio-test",children:[o.jsxs("div",{className:"af-node-studio-subhead",children:[o.jsx("strong",{children:"Test Inputs"}),o.jsxs("button",{type:"button",onClick:W,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:s?"sync":"play_arrow"}),"Run"]})]}),o.jsxs("div",{className:"af-node-studio-inputs",children:[o.jsxs("label",{children:[o.jsx("span",{children:"project"}),o.jsx("input",{value:x.project||"",readOnly:!0,placeholder:"-"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"date"}),o.jsx("input",{value:x.date||"",readOnly:!0,placeholder:"-"})]})]}),o.jsx("div",{className:"af-node-studio-log",children:(s?["running..."]:S.length?S:["No test run yet."]).map((_,q)=>o.jsx("span",{children:_},`${_}-${q}`))})]})]})]}),o.jsxs("aside",{className:"af-node-studio-internals","aria-label":"Internals",children:[o.jsxs("div",{className:"af-node-studio-panel-head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"fact_check"}),o.jsx("strong",{children:"Internals"})]}),o.jsx("div",{className:"af-node-studio-tabs",role:"tablist","aria-label":"Internals sections",children:w.map(_=>o.jsxs("button",{type:"button",className:_.id===n?"af-node-studio-tab af-node-studio-tab--active":"af-node-studio-tab",onClick:()=>r(_.id),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:_.icon}),_.label]},_.id))}),o.jsx("div",{className:"af-node-studio-internal-list",children:b.rows.map(([_,q])=>o.jsxs("div",{className:"af-node-studio-internal-row",children:[o.jsx("span",{children:_}),o.jsx("strong",{children:q})]},_))}),o.jsx("pre",{className:"af-node-studio-code",children:b.id==="ui"?JSON.stringify(g.ui||{},null,2):b.id==="contract"?JSON.stringify({inputs:g.inputs||[],outputs:g.outputs||[],configSchema:g.configSchema||{}},null,2):b.id==="tests"?JSON.stringify((y==null?void 0:y.test)||{},null,2):JSON.stringify({runtime:g.runtime||{},files:(y==null?void 0:y.files)||{}},null,2)})]})]})]})}function rte(){return`ws_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function ste(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function tp(e){const t=String(e||"").trim();if(!t)return"";let n=t;try{n=new URL(t).pathname}catch{n=t.split("?")[0].split("#")[0]}return(n.replace(/\/+$/,"").split("/").filter(Boolean).pop()||"").replace(/\.git$/i,"").replace(/[^A-Za-z0-9._-]+/g,"_").replace(/^_+|_+$/g,"")}function ite(e={},t={}){return`${String(e.mountPath||t.mountPath||e.label||t.label||e.id||t.id||"workspace").trim().toUpperCase().replace(/[^A-Z0-9]+/g,"_").replace(/^_+|_+$/g,"").slice(0,48)||"WORKSPACE"}_GIT_TOKEN`}function Rg(){return{id:"",label:"",kind:"git",path:"",repoUrl:"",branch:"master",mountPath:"",credentialRef:"",type:"code",description:"",enabled:!0}}function Ef(e={}){return{id:String((e==null?void 0:e.id)||""),label:String((e==null?void 0:e.label)||(e==null?void 0:e.name)||""),kind:(e==null?void 0:e.kind)==="local"?"local":"git",path:String((e==null?void 0:e.path)||""),repoUrl:String((e==null?void 0:e.repoUrl)||""),branch:String((e==null?void 0:e.branch)||"master"),mountPath:String((e==null?void 0:e.mountPath)||""),credentialRef:String((e==null?void 0:e.credentialRef)||""),type:String((e==null?void 0:e.type)||((e==null?void 0:e.kind)==="local"?"local":"code")),description:String((e==null?void 0:e.description)||""),enabled:(e==null?void 0:e.enabled)!==!1}}function ote(e){const t=e.kind==="local"?"local":"git",n=t==="git"?String(e.repoUrl||"").trim():"",r=t==="git"?String(e.mountPath||tp(n)||"").trim():"";return{id:String(e.id||"").trim(),label:String(e.label||"").trim(),kind:t,path:String(e.path||"").trim(),repoUrl:n,branch:t==="git"?String(e.branch||"master").trim()||"master":"",mountPath:r,credentialRef:t==="git"?String(e.credentialRef||"").trim():"",type:String(e.type||(t==="local"?"local":"code")).trim(),description:String(e.description||"").trim(),enabled:e.enabled!==!1}}function bi(e,t=0){return(e==null?void 0:e.id)||(e==null?void 0:e.path)||(e==null?void 0:e.repoUrl)||`workspace-${t}`}function ate({ok:e}){return o.jsx("span",{className:"af-workspaces-dot"+(e?" af-workspaces-dot--ok":""),"aria-hidden":!0})}function Vj({item:e,selected:t,onClick:n,readOnly:r}){return o.jsxs("button",{type:"button",className:"af-workspaces-card"+(t?" af-workspaces-card--selected":""),onClick:n,children:[o.jsxs("div",{className:"af-workspaces-card__head",children:[o.jsx("strong",{children:e.label||"知识库"}),o.jsx("span",{children:e.kind==="git"?"Git":"Local"})]}),o.jsx("p",{children:e.description||e.repoUrl||e.path||"-"}),o.jsxs("div",{className:"af-workspaces-card__meta",children:[o.jsx(ate,{ok:e.exists!==!1}),o.jsx("span",{children:e.exists===!1?"路径未就绪":"路径可用"}),r?o.jsx("em",{children:"内置"}):e.enabled===!1?o.jsx("em",{children:"disabled"}):null]})]})}function lte(){const[e,t]=m.useState(!1),[n,r]=m.useState(!1),[s,i]=m.useState(!1),[a,l]=m.useState(""),[c,u]=m.useState(""),[p,f]=m.useState(""),[d,h]=m.useState([]),[y,w]=m.useState([]),[b,g]=m.useState(Rg),[k,x]=m.useState(""),[S,C]=m.useState([]),[j,E]=m.useState(""),A=m.useMemo(()=>y.findIndex((z,$)=>bi(z,$)===j),[y,j]),W=!!m.useMemo(()=>d.find((z,$)=>bi(z,$)===j)||null,[d,j]),H=m.useMemo(()=>{const z=String(b.credentialRef||"").trim();return z?S.some($=>String(($==null?void 0:$.key)||"").trim()===z&&String(($==null?void 0:$.value)??"")!==""):!1},[b.credentialRef,S]),D=m.useCallback(async()=>{t(!0),l("");try{const[z,$]=await Promise.all([fetch("/api/workspaces"),fetch("/api/user-env")]),Q=await z.json().catch(()=>({})),te=await $.json().catch(()=>({}));if(!$.ok)throw new Error(typeof te.error=="string"?te.error:"ENV HTTP "+$.status);if(!z.ok)throw new Error(typeof Q.error=="string"?Q.error:"HTTP "+z.status);const ie=Array.isArray(Q.workspaces)?Q.workspaces:[],he=Array.isArray(Q.customWorkspaces)?Q.customWorkspaces:[];f(String(Q.path||"")),h(ie.filter(ne=>ne==null?void 0:ne.builtin)),w(he),C(Array.isArray(te.env)?te.env.map(ne=>({key:String((ne==null?void 0:ne.key)||""),value:String((ne==null?void 0:ne.value)??"")})):[])}catch(z){l(String(z.message||z))}finally{t(!1)}},[]);m.useEffect(()=>{D()},[D]);const R=m.useCallback(async(z,$="")=>{r(!0),l(""),u("");try{const Q=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaces:z})}),te=await Q.json().catch(()=>({}));if(!Q.ok)throw new Error(typeof te.error=="string"?te.error:"HTTP "+Q.status);const ie=Array.isArray(te.customWorkspaces)?te.customWorkspaces:z;w(ie),h((Array.isArray(te.workspaces)?te.workspaces:[]).filter(he=>he==null?void 0:he.builtin)),f(String(te.path||p)),$&&E($),u("已保存")}catch(Q){l(String(Q.message||Q))}finally{r(!1)}},[p]),T=m.useCallback(()=>{E(""),g(Rg()),x(""),u(""),l("")},[]),V=m.useCallback((z,$)=>{E(bi(z,$)),g(Ef(z)),x(""),u("")},[]),F=m.useCallback((z,$)=>{E(bi(z,$)),g(Ef(z)),x(""),u("")},[]),M=m.useCallback(async(z,$)=>{const Q=String(z||"").trim(),te=String($??"");if(!Q||!te)return;const ie=S.filter(ce=>String((ce==null?void 0:ce.key)||"").trim()!==Q);ie.push({key:Q,value:te});const he=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:ie})}),ne=await he.json().catch(()=>({}));if(!he.ok)throw new Error(typeof ne.error=="string"?ne.error:"ENV HTTP "+he.status);C(Array.isArray(ne.env)?ne.env.map(ce=>({key:String((ce==null?void 0:ce.key)||""),value:String((ce==null?void 0:ce.value)??"")})):ie)},[S]),I=m.useCallback(()=>{const z=ote({...b,id:b.id||rte()}),$=k.trim();if(z.kind==="git"&&$&&!z.credentialRef&&(z.credentialRef=ite(b,z)),z.kind==="local"&&!z.path){l("本地知识库需要填写路径");return}if(z.kind==="git"&&!z.repoUrl){l("Git 知识库需要填写 repoUrl");return}if(!z.label){l("请填写名称");return}if(z.kind==="git"&&z.credentialRef&&!ste(z.credentialRef)){l("凭证环境变量只能使用字母、数字和下划线,且不能以数字开头");return}const Q=A>=0?y.map((te,ie)=>ie===A?z:te):[z,...y];g(Ef(z)),(async()=>{r(!0);try{$&&await M(z.credentialRef,$),x(""),await R(Q,bi(z))}catch(te){l(String(te.message||te)),r(!1)}})()},[y,b,R,M,A,k]),B=m.useCallback(()=>{if(A<0)return;const z=y.filter(($,Q)=>Q!==A);g(Rg()),E(""),R(z)},[y,R,A]),_=m.useCallback(async()=>{if(!W){if(A<0||!b.id){l("请先保存知识库配置,再拉取更新");return}if(b.kind!=="git"){l("只有 Git 知识库支持拉取更新");return}i(!0),l(""),u("");try{const z=await fetch("/api/workspaces/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:b.id})}),$=await z.json().catch(()=>({}));if(!z.ok)throw new Error(typeof $.error=="string"?$.error:"HTTP "+z.status);const Q=Array.isArray($.customWorkspaces)?$.customWorkspaces:y;w(Q),h((Array.isArray($.workspaces)?$.workspaces:[]).filter(he=>he==null?void 0:he.builtin));const te=Q.find(he=>String((he==null?void 0:he.id)||"")===String(b.id||""));te&&g(Ef(te));const ie=String($.commit||"").trim();u($.changed?`已拉取更新${ie?`:${ie.slice(0,8)}`:""}`:`已是最新${ie?`:${ie.slice(0,8)}`:""}`)}catch(z){l(String(z.message||z))}finally{i(!1)}}},[y,b,W,A]),q=m.useCallback(z=>{g($=>({...$,...z}))},[]);return o.jsxs("div",{className:"af-workspaces-page",children:[o.jsxs("header",{className:"af-settings-top",children:[o.jsxs("div",{className:"af-settings-crumb","aria-label":"知识库",children:[o.jsx("span",{className:"af-settings-crumb-muted",children:"AgentFlow"}),o.jsx("span",{className:"af-settings-crumb-sep","aria-hidden":!0,children:"/"}),o.jsx("span",{className:"af-settings-crumb-active",children:"知识库"})]}),o.jsxs("button",{type:"button",className:"af-schedules-refresh",onClick:D,disabled:e,children:[o.jsx("span",{className:"material-symbols-outlined",children:"refresh"}),"刷新"]})]}),o.jsx("main",{className:"af-settings-body",children:o.jsxs("div",{className:"af-workspaces-inner",children:[o.jsxs("header",{className:"af-settings-hero",children:[o.jsx("h1",{className:"af-settings-h1",children:"知识库"}),o.jsx("p",{className:"af-settings-lead",children:"维护可被加载知识库、一键任务和后续 Agent 使用的只读上下文源。Git 字段与 mengmai 的资源配置保持一致。"}),p?o.jsxs("p",{className:"af-workspaces-config",children:["配置文件:",p]}):null,a?o.jsx("p",{className:"af-err af-settings-api-hint",children:a}):null,c?o.jsx("p",{className:"af-workspaces-status",children:c}):null]}),o.jsxs("section",{className:"af-workspaces-summary",children:[o.jsxs("div",{children:[o.jsx("span",{children:"内置"}),o.jsx("strong",{children:d.length})]}),o.jsxs("div",{children:[o.jsx("span",{children:"自定义"}),o.jsx("strong",{children:y.length})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Git"}),o.jsx("strong",{children:y.filter(z=>z.kind==="git").length})]})]}),o.jsxs("div",{className:"af-workspaces-layout",children:[o.jsxs("section",{className:"af-workspaces-list",children:[o.jsxs("div",{className:"af-workspaces-section-head",children:[o.jsx("h2",{children:"自定义知识库"}),o.jsxs("button",{type:"button",onClick:T,children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新增"]})]}),y.length?y.map((z,$)=>o.jsx(Vj,{item:z,selected:bi(z,$)===j,onClick:()=>V(z,$)},bi(z,$))):o.jsx("div",{className:"af-workspaces-empty",children:"暂无自定义知识库。新增 Git 或本地目录后,画布里的加载知识库和一键任务就可以选择它。"}),o.jsx("div",{className:"af-workspaces-section-head af-workspaces-section-head--sub",children:o.jsx("h2",{children:"内置知识库"})}),d.map((z,$)=>o.jsx(Vj,{item:z,selected:bi(z,$)===j,onClick:()=>F(z,$),readOnly:!0},bi(z,$)))]}),o.jsxs("section",{className:"af-workspaces-editor",children:[o.jsxs("div",{className:"af-workspaces-editor__head",children:[o.jsxs("div",{children:[o.jsx("h2",{children:W?"查看内置知识库":A>=0?"编辑知识库":"新增知识库"}),o.jsx("p",{children:W?"内置项由当前运行环境提供,不能在这里修改。":"本地路径用于读取上下文,Git 字段用于后续同步和上下文挂载。"})]}),o.jsxs("label",{className:"af-workspaces-switch",children:[o.jsx("input",{type:"checkbox",checked:b.enabled!==!1,disabled:W,onChange:z=>q({enabled:z.target.checked})}),o.jsx("span",{children:"启用"})]})]}),o.jsxs("div",{className:"af-workspaces-kind",children:[o.jsxs("button",{type:"button",className:b.kind==="git"?"active":"",disabled:W,onClick:()=>q({kind:"git",type:b.type==="local"?"code":b.type}),children:[o.jsx("span",{className:"material-symbols-outlined",children:"account_tree"}),"Git"]}),o.jsxs("button",{type:"button",className:b.kind==="local"?"active":"",disabled:W,onClick:()=>q({kind:"local",type:"local"}),children:[o.jsx("span",{className:"material-symbols-outlined",children:"folder_open"}),"本地目录"]})]}),o.jsxs("div",{className:"af-workspaces-form",children:[o.jsxs("label",{children:[o.jsx("span",{children:"名称"}),o.jsx("input",{value:b.label,disabled:W,onChange:z=>q({label:z.target.value}),placeholder:"Likee Android"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"类型"}),o.jsxs("select",{value:b.type,disabled:W,onChange:z=>q({type:z.target.value}),children:[o.jsx("option",{value:"code",children:"code"}),o.jsx("option",{value:"docs",children:"docs"}),o.jsx("option",{value:"analytics",children:"analytics"}),o.jsx("option",{value:"config",children:"config"}),o.jsx("option",{value:"local",children:"local"}),o.jsx("option",{value:"other",children:"other"})]})]}),o.jsxs("label",{className:"af-workspaces-form__wide",children:[o.jsx("span",{children:"本地路径"}),o.jsx("input",{value:b.path,disabled:W,onChange:z=>q({path:z.target.value}),placeholder:b.kind==="git"?"可空,默认保存到全局资源目录/repos/<仓库名>":"/Users/.../project"})]}),b.kind==="git"?o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"af-workspaces-form__wide",children:[o.jsx("span",{children:"Git URL"}),o.jsx("input",{value:b.repoUrl,disabled:W,onChange:z=>{const $=z.target.value,Q=tp(b.repoUrl),te=String(b.mountPath||"").trim();q({repoUrl:$,...!te||te===Q?{mountPath:tp($)}:{}})},placeholder:"https://git.example.com/group/repo.git"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"分支"}),o.jsx("input",{value:b.branch,disabled:W,onChange:z=>q({branch:z.target.value}),placeholder:"master"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"挂载目录"}),o.jsx("input",{value:b.mountPath,disabled:W,onChange:z=>q({mountPath:z.target.value}),placeholder:tp(b.repoUrl)||"repo_name"})]}),o.jsxs("label",{className:"af-workspaces-form__wide",children:[o.jsx("span",{children:"凭证环境变量"}),o.jsx("input",{value:b.credentialRef,disabled:W,onChange:z=>q({credentialRef:z.target.value}),placeholder:"LIKEE_GIT_READONLY_TOKEN"})]}),o.jsxs("label",{className:"af-workspaces-form__wide",children:[o.jsx("span",{children:"Token"}),o.jsx("input",{type:"password",value:k,disabled:W,onChange:z=>x(z.target.value),placeholder:H?"已在个人环境变量中配置;留空则不修改":"保存到个人环境变量,不写入 workspace 配置"}),o.jsx("small",{children:"保存后只在知识库配置中保留 credentialRef,token 会写入当前用户的个人环境变量。"})]})]}):null,o.jsxs("label",{className:"af-workspaces-form__wide",children:[o.jsx("span",{children:"说明"}),o.jsx("textarea",{value:b.description,disabled:W,onChange:z=>q({description:z.target.value}),placeholder:"这个知识库包含哪些代码、文档或需求上下文"})]})]}),o.jsxs("div",{className:"af-workspaces-actions",children:[!W&&A>=0?o.jsxs("button",{type:"button",className:"af-workspaces-danger",onClick:B,disabled:n||s,children:[o.jsx("span",{className:"material-symbols-outlined",children:"delete"}),"删除"]}):o.jsx("span",{}),o.jsxs("div",{children:[b.kind==="git"&&A>=0?o.jsxs("button",{type:"button",onClick:_,disabled:W||n||s,children:[o.jsx("span",{className:"material-symbols-outlined",children:s?"sync":"download"}),s?"拉取中":"拉取更新"]}):null,o.jsx("button",{type:"button",onClick:T,disabled:n||s,children:"重置"}),o.jsxs("button",{type:"button",className:"af-workspaces-primary",onClick:I,disabled:W||n||s,children:[o.jsx("span",{className:"material-symbols-outlined",children:"save"}),n?"保存中":"保存"]})]})]})]})]})]})})]})}const cte=[{icon:"campaign",title:"首页 Feed 想加一个广告引导",question:"先判断入口、展示位、用户影响面,再决定弹框、浮层还是页面内引导。",context:["查客户端展示位逻辑","查历史需求与配置","查 m09 / Feed PV"],result:"原型 + PRD + TAPD 更新",tone:"pink"},{icon:"manage_search",title:"接到需求但不知道现有逻辑",question:"不用先找研发问一圈,直接从 Likee 代码、知识库、历史文档里拿上下文。",context:["客户端 / 后台 / 前端知识库","接口与配置链路","相关 Git 文档"],result:"背景结论 + 影响范围",tone:"cyan"},{icon:"query_stats",title:"运营要评估活动或入口价值",question:"先查人群规模、页面访问、历史转化,避免凭经验拍优先级。",context:["CK / Hive 查数","自动生成 SQL","指标口径解释"],result:"数据表 + 图表 + 结论",tone:"green"},{icon:"draw",title:"想快速把方案画给团队看",question:"把一句需求变成客户端或 H5 原型,让评审时先讨论体验,不只讨论文字。",context:["Likee 客户端样式","前端页面结构","交互状态与文案"],result:"HTML 原型 + Display 面板",tone:"amber"},{icon:"sync_alt",title:"需求写完后需要同步多个地方",question:"PRD、TAPD、Git 仓库和评审展示保持一致,减少重复复制和漏改。",context:["需求正文","变更记录","MR / 仓库路径"],result:"TAPD 更新 + Git 提交",tone:"violet"},{icon:"monitoring",title:"上线后要看效果和复盘",question:"沿用需求阶段的口径继续查数,把结果沉淀回下一轮需求线索。",context:["上线后 CK / Hive","分页面 / 分人群指标","实验和版本信息"],result:"复盘结论 + 后续建议",tone:"blue"}],ute=[{label:"Use Case 01",title:"Likee 客户端知识库查询(如广告占位)",images:["/likee-context/usecase-ad-query.png"],trigger:"产品或运营想确认客户端已有逻辑,例如 Likee Android 里有哪些广告占位,以及相关常量和代码位置。",steps:["在「我的流程」加载 Likee Android 流程片段","在子 Agent 节点输入客户端逻辑问题","点击 Run Line,只执行当前链路","在右侧 Markdown Display 查看知识库查询结果"],outputs:["SETTING_ID / PAGE_ID 表格","客户端代码路径与口径说明","可继续用于 PRD 的背景材料"]},{label:"Use Case 02",title:"客户端原型设计",images:["/likee-context/usecase-prototype.png"],trigger:"业务已经明确要在 Likee 首页加入广告引导,需要先把弹框体验画出来给产品、设计、研发评审。",steps:["在 Workspace 打开原型生成流程","加载客户端原型 Skill","在子 Agent 中说明生成一个首页 dialog 弹框","查看 HTML Display 中的手机预览稿"],outputs:["Likee 风格手机原型","弹框文案与按钮状态","可直接用于评审的 Display 面板"]},{label:"Use Case 03",title:"前端 H5 原型设计",images:["/likee-context/usecase-h5-prototype.png"],trigger:"运营活动需要快速产出 Likee 风格 H5 页面,例如幸运转盘、积分排行榜、活动首页或结果页。",steps:["在 Workspace 打开 H5 原型生成流程","加载前端 H5 原型相关 Skill","在子 Agent 中说明活动结构、页面模块和运营规则","查看 HTML Display 中的可交互 H5 原型"],outputs:["Likee 风格 H5 页面","抽奖转盘与排行榜布局","活动规则和状态页","可用于评审的 HTML Display"]},{label:"Use Case 04",title:"CK / Hive 查数与 SQL 生成",images:["/likee-context/usecase-data-query.png"],trigger:"运营或产品需要快速验证一个数据问题,例如找出典型 UID、对比不同日期的视频上传分辨率占比,并保留可复用 SQL。",steps:["在 Workspace 打开查数流程","加载查数相关 Skill","在子 Agent 中说明数据口径、日期和筛选条件","查看 Markdown Display 中的数据结果和查询 SQL"],outputs:["查询结果表格","SQL 语句","口径说明","可继续接入 PRD 或复盘面板的数据结论"]},{label:"Use Case 05",title:"需求文档生成、数据补齐与同步",images:["/likee-context/usecase-prd.png","/likee-context/usecase-sync.png"],trigger:"需求进入评审和落库阶段,需要把 TAPD 信息、Hive 数据、原型内容组织成 PRD,并同步到 TAPD 和 Git 仓库。",steps:["先运行 TAPD / 数据查询节点,拿到迭代、页面 PV 和业务背景","把查询结果和原型 Display 内容接入 PRD 生成子 Agent","在 Markdown Display 查看完整需求文档","把 PRD content 接入 TAPD 更新节点和 Git 仓库提交节点"],outputs:["完整 PRD 文档","项目背景与 Top 页面数据","TAPD 需求更新成功","Git MR 链接"]},{label:"Use Case 06",title:"Display 模式做需求评审面板",images:["/likee-context/usecase-display.png"],trigger:"流程跑完后,需要把 PRD、原型、数据图表、展示位表格放在一个页面里给产品、运营、研发一起看。",steps:["在 Workspace 中完成查数、原型、PRD、同步节点执行","确认 Markdown / HTML / 图表 / 表格展示节点都有结果","切换顶部 DISPLAY 模式","使用生成链接把评审面板发给相关同学"],outputs:["PRD 长文档","客户端原型预览","图表与表格","统一展示链接"]}],dte=[{name:"likee-client-ui",namespace:"智能助手 / 客户端原型",icon:"phone_iphone",mode:"客户端原型设计",usage:"生成 Likee 客户端风格页面、弹框、Feed 引导、个人页、活动入口等原型,适合产品评审前快速对齐体验。",examples:["首页 dialog 弹框","Feed 内引导","客户端红色主品牌视觉","移动端交互态"],tone:"pink"},{name:"tapd-likee",namespace:"智能助手 / TAPD",icon:"sync",mode:"需求系统交互",usage:"和 TAPD 交互,支持创建、同步、更新需求,把工作区生成的 PRD 或 Markdown 内容回写到需求系统。",examples:["创建 TAPD 需求","更新需求正文","同步处理人和链接","把结果回显到 Display"],tone:"green"},{name:"plain-language-response",namespace:"智能助手 / 回答风格",icon:"record_voice_over",mode:"业务化回答",usage:"用于把回答收敛成产品、运营更容易阅读的解释,避免直接把客户端代码库细节、函数调用链和实现细节暴露太多。",examples:["需求背景解释","代码结论转业务语言","评审材料摘要","减少实现细节噪音"],tone:"cyan"},{name:"create-likee-h5-style-html",namespace:"智能助手 / 前端 H5",icon:"language",mode:"H5 原型设计",usage:"创建 Likee H5 风格原型,适合运营活动、抽奖、排行榜、报告页、反馈表单、创作者认证页、订单列表等页面。",examples:["幸运转盘活动","积分排行榜","活动规则页","结果页和空状态"],tone:"amber"},{name:"analytics",namespace:"数据 / CK & Hive",icon:"query_stats",mode:"查数和 SQL 生成",usage:"面向 CK、Hive 的指标查询和 SQL 生成,适合 PV、UV、转化、分国家、分实验组、典型 UID 等数据问题。",examples:["自动生成 SQL","输出查询结果表","解释指标口径","沉淀复盘数据"],tone:"green"}],fte=[["知识库","查客户端、后台、前端逻辑","广告、Feed、会员、增长、配置、接口调用链"],["数据","查 CK / Hive 并输出 SQL","PV、UV、转化、分页面、分国家、分实验组"],["产物","生成原型、PRD、Display 面板","Markdown、HTML 原型、图表、表格、交互预览"],["协作","同步 TAPD 与 Git 仓库","需求正文、变更记录、MR 链接、评审材料"]];function Af({icon:e,title:t,label:n,tone:r="violet"}){return o.jsxs("div",{className:`likee-flow-node likee-flow-node-${r}`,children:[o.jsx("span",{className:"material-symbols-outlined",children:e}),o.jsxs("div",{children:[o.jsx("strong",{children:t}),o.jsx("small",{children:n})]})]})}function pte(){return o.jsxs("div",{className:"likee-workspace-scene","aria-hidden":"true",children:[o.jsx("div",{className:"likee-scene-grid"}),o.jsxs("svg",{className:"likee-scene-lines",viewBox:"0 0 980 560",fill:"none",children:[o.jsx("path",{d:"M96 154 C236 96 330 122 444 194 C552 262 654 260 814 160"}),o.jsx("path",{d:"M118 350 C248 288 344 304 458 372 C578 444 704 420 858 310"}),o.jsx("path",{d:"M472 196 C512 248 524 302 486 372"}),o.jsx("path",{d:"M622 126 C670 198 696 258 682 354"})]}),o.jsx("div",{className:"likee-node-pos likee-node-a",children:o.jsx(Af,{icon:"travel_explore",title:"全局上下文",label:"Likee 业务、代码、数据",tone:"pink"})}),o.jsx("div",{className:"likee-node-pos likee-node-b",children:o.jsx(Af,{icon:"database",title:"CK / Hive",label:"自动 SQL 与指标口径",tone:"cyan"})}),o.jsx("div",{className:"likee-node-pos likee-node-c",children:o.jsx(Af,{icon:"article",title:"需求文档",label:"PRD、变更说明、评审稿",tone:"amber"})}),o.jsx("div",{className:"likee-node-pos likee-node-d",children:o.jsx(Af,{icon:"sync_alt",title:"TAPD / Git",label:"同步需求与版本资产",tone:"green"})}),o.jsxs("div",{className:"likee-phone-preview",children:[o.jsxs("div",{className:"likee-phone-top",children:[o.jsx("span",{children:"关注"}),o.jsx("strong",{children:"推荐"}),o.jsx("span",{children:"直播"})]}),o.jsxs("div",{className:"likee-phone-card",children:[o.jsx("div",{className:"likee-gift",children:"AD"}),o.jsx("h4",{children:"广告个性化引导弹框"}),o.jsx("p",{children:"保持推荐体验,同时解释权益与关闭路径。"}),o.jsx("button",{children:"继续"}),o.jsx("button",{className:"secondary",children:"稍后"})]})]}),o.jsxs("div",{className:"likee-display-panel",children:[o.jsxs("div",{className:"likee-panel-header",children:[o.jsx("span",{children:"DISPLAY"}),o.jsx("strong",{children:"需求资产面板"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"需求"}),o.jsx("strong",{children:"首页广告个性化引导"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"数据"}),o.jsx("strong",{children:"m09 PV Top 1"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"同步"}),o.jsx("strong",{children:"TAPD + Git MR"})]})]})]})}function np({kicker:e,title:t,children:n}){return o.jsxs("div",{className:"likee-section-copy",children:[o.jsx("p",{className:"likee-section-kicker",children:e}),o.jsx("h2",{children:t}),o.jsx("p",{children:n})]})}function hte(){return o.jsx("section",{id:"likee-skills",className:"likee-section likee-section-dark",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-two-column-skills",children:[o.jsx(np,{kicker:"SKILLS",title:"用 Skills 把 Likee 上下文变成可复用能力",children:"Skills 是工作区里可加载的能力包。手动搭建工作区时,只需要按场景加载对应 Skill。"}),o.jsx("div",{className:"likee-skill-grid",children:dte.map(e=>o.jsxs("article",{className:`likee-skill-card likee-skill-${e.tone}`,children:[o.jsxs("div",{className:"likee-skill-head",children:[o.jsx("div",{className:"likee-skill-icon",children:o.jsx("span",{className:"material-symbols-outlined",children:e.icon})}),o.jsxs("div",{children:[o.jsx("h3",{children:e.name}),o.jsx("span",{children:e.namespace})]})]}),o.jsx("div",{className:"likee-skill-mode",children:e.mode}),o.jsx("p",{children:e.usage}),o.jsx("div",{className:"likee-skill-examples",children:e.examples.map(t=>o.jsx("strong",{children:t},t))})]},e.name))})]})})}function AI(){return o.jsxs("div",{className:"likee-page",children:[o.jsx("div",{className:"likee-top-actions",children:o.jsxs("a",{href:"/projects",className:"likee-home-link",children:[o.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"}),"返回首页"]})}),o.jsxs("section",{className:"likee-hero",children:[o.jsx(pte,{}),o.jsxs("div",{className:"likee-hero-content",children:[o.jsx("p",{className:"likee-eyebrow",children:"LIKEE CONTEXT WORKSPACE"}),o.jsx("h1",{children:"Likee Agent 工作台"}),o.jsx("p",{className:"likee-hero-subtitle",children:"提供 Likee 全局上下文,赋能需求挖掘、书写和运营。"}),o.jsxs("div",{className:"likee-signal-row",children:[o.jsx("span",{children:"查业务逻辑"}),o.jsx("span",{children:"查 CK / Hive"}),o.jsx("span",{children:"生成原型"}),o.jsx("span",{children:"生成 PRD"}),o.jsx("span",{children:"同步 TAPD / Git"})]}),o.jsxs("div",{className:"likee-hero-actions",children:[o.jsxs("a",{href:"/projects",className:"likee-primary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"rocket_launch"}),"立即使用"]}),o.jsxs("a",{href:"#likee-scenarios",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"ads_click"}),"按场景查看"]}),o.jsxs("a",{href:"#likee-usecases",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"view_timeline"}),"查看 Use Cases"]}),o.jsxs("a",{href:"#likee-skills",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"extension"}),"查看 Skills"]})]})]})]}),o.jsx("section",{id:"likee-scenarios",className:"likee-section",children:o.jsxs("div",{className:"likee-section-inner",children:[o.jsx(np,{kicker:"SCENARIO TRIGGERS",title:"打造 Likee 团队全景上下文",children:"不要求先会写 Prompt,也不要求知道该找哪个系统。选择一个业务场景,工作台会把需要的 Likee 上下文、数据查询和最终产物组织起来。"}),o.jsx("div",{className:"likee-scenario-grid",children:cte.map(e=>o.jsxs("article",{className:`likee-scenario-card likee-scenario-${e.tone}`,children:[o.jsx("div",{className:"likee-scenario-icon",children:o.jsx("span",{className:"material-symbols-outlined",children:e.icon})}),o.jsxs("div",{children:[o.jsx("h3",{children:e.title}),o.jsx("p",{children:e.question})]}),o.jsx("div",{className:"likee-scenario-context",children:e.context.map(t=>o.jsx("span",{children:t},t))}),o.jsxs("div",{className:"likee-scenario-result",children:[o.jsx("span",{children:"产出"}),o.jsx("strong",{children:e.result})]})]},e.title))})]})}),o.jsx("section",{id:"likee-usecases",className:"likee-section likee-section-muted",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-usecase-layout",children:[o.jsx(np,{kicker:"USE CASES",title:"沉淀 Likee 业务流水线",children:"这里展示的是平台里实际可跑的工作流:加载流程片段,在子 Agent 或 Run 节点输入业务问题,执行当前 line,最终在 Display、TAPD 和 Git 中拿到结果。"}),o.jsx("div",{className:"likee-usecase-stack",children:ute.map(e=>o.jsxs("article",{className:"likee-usecase-card",children:[o.jsx("div",{className:`likee-usecase-media ${e.images.length>1?"likee-usecase-media-split":""}`,children:e.images.map((t,n)=>o.jsx("img",{src:t,alt:`${e.title} 工作区截图 ${n+1}`,loading:"lazy"},t))}),o.jsxs("div",{className:"likee-usecase-body",children:[o.jsx("div",{className:"likee-usecase-label",children:e.label}),o.jsx("h3",{children:e.title}),o.jsx("p",{children:e.trigger}),o.jsx("ol",{className:"likee-usecase-steps",children:e.steps.map(t=>o.jsx("li",{children:t},t))}),o.jsxs("div",{className:"likee-usecase-output",children:[o.jsx("span",{children:"实际产物"}),o.jsx("div",{children:e.outputs.map(t=>o.jsx("strong",{children:t},t))})]})]})]},e.label))})]})}),o.jsx(hte,{}),o.jsx("section",{className:"likee-section",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-capability-layout",children:[o.jsx(np,{kicker:"CAPABILITY MAP",title:"每个场景背后,都连接同一套 Likee 上下文能力",children:"工作台把知识库、CK / Hive、原型、PRD、TAPD 和 Git 放到同一条链路里。用户看到的是业务场景,系统处理的是上下文、产物和同步。"}),o.jsx("div",{className:"likee-capability-table",children:fte.map(([e,t,n])=>o.jsxs("div",{className:"likee-capability-row",children:[o.jsx("span",{children:e}),o.jsx("strong",{children:t}),o.jsx("p",{children:n})]},e))})]})})]})}function PI(e){return t=>typeof t===e}var mte=PI("function"),gte=e=>e===null,Kj=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",Uj=e=>!yte(e)&&!gte(e)&&(mte(e)||typeof e=="object"),yte=PI("undefined");function xte(e,t,n){return jte(n,e,t)?!0:(Cte(n,e,t),e.constructor!==t.constructor?!1:Array.isArray(e)&&Array.isArray(t)?wte(e,t,n):e instanceof Map&&t instanceof Map?vte(e,t,n):e instanceof Set&&t instanceof Set?Nte(e,t):e instanceof WeakMap||e instanceof WeakSet?!1:ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)?bte(e,t):Kj(e)&&Kj(t)?e.source===t.source&&e.flags===t.flags:e instanceof Error&&t instanceof Error?kte(e,t,n):e.valueOf!==Object.prototype.valueOf?e.valueOf()===t.valueOf():e.toString!==Object.prototype.toString?e.toString()===t.toString():Ste(e,t,n))}function ud(e,t,n){return e===t||Number.isNaN(e)&&Number.isNaN(t)?!0:!e||!Uj(e)||!t||!Uj(t)?!1:xte(e,t,n)}function wte(e,t,n){const{length:r}=e;if(r!==t.length)return!1;for(let s=r;s--!==0;)if(!ud(e[s],t[s],n))return!1;return!0}function bte(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 kte(e,t,n){return e.message===t.message&&e.name===t.name&&ud(e.cause,t.cause,n)}function vte(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(!ud(r[1],t.get(r[0]),n))return!1;return!0}function Ste(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)&&!ud(e[i],t[i],n))return!1}return!0}function Nte(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 jte(e,t,n){var r;return((r=e.get(t))==null?void 0:r.has(n))??!1}function Cte(e,t,n){let r=e.get(t);r||(r=new WeakSet,e.set(t,r)),r.add(n)}function _b(e,t){return ud(e,t,new WeakMap)}function Mg(){var e;return!!(typeof window<"u"&&((e=window==null?void 0:window.document)!=null&&e.createElement))}function _te(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}function Ete(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function Ate(){const e=m.useRef(!0);return e.current?(e.current=!1,!0):e.current}function Pte(e,t){const n=Ate();m.useEffect(()=>{if(!n)return e()},t)}function II(e){const t=m.useRef(void 0);return m.useEffect(()=>{t.current=e}),t.current}function Ite(e,t){const n=m.useRef(t);return _b(t,n.current)||(n.current=t),m.useMemo(e,n.current)}function Tte(e){m.useEffect(()=>{e()},[])}function Rte(e=0){const[t,n]=m.useState({height:Mg()?window.innerHeight:0,width:Mg()?window.innerWidth:0}),r=m.useRef(0),s=m.useRef(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(()=>{n({width:window.innerWidth,height:window.innerHeight})},e)});return m.useEffect(()=>{if(!Mg())return()=>{};const i=s.current;return n({height:window.innerHeight,width:window.innerWidth}),Ete(window,"resize",i),()=>{_te(window,"resize",i)}},[]),t}var Mte=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","URL","WeakMap","WeakSet"],$te=["bigint","boolean","null","number","string","symbol","undefined"];function dd(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(Lte(t))return t}function Bs(e){return t=>dd(t)===e}function Lte(e){return Mte.includes(e)}function Ql(e){return t=>typeof t===e}function Ote(e){return $te.includes(e)}var Dte=["innerHTML","ownerDocument","style","attributes","nodeValue"],fd=e=>Array.isArray(e),Fte=e=>dd(e)==="AsyncGeneratorFunction",zte=Bs("AsyncFunction"),Bte=Ql("bigint"),Hte=e=>e===!0||e===!1,Wte=Bs("Date"),Vte=Bs("Error"),Eo=Ql("function"),Kte=Bs("GeneratorFunction"),Ute=e=>typeof e=="number"&&Number.isInteger(e),Px=Bs("Map"),TI=e=>Number.isNaN(e),Eb=e=>e===null,RI=Bs("Function"),qte=Bs("Promise"),Yte=Bs("RegExp"),Ix=Bs("Set"),pd=Ql("string"),Gte=Ql("symbol"),Ab=Ql("undefined"),Jte=Bs("WeakMap"),Xte=Bs("WeakSet"),Pb=e=>Eb(e)||Ab(e),MI=e=>!Ab(e),Qte=e=>Ql("number")(e)&&!TI(e),Zte=e=>pd(e)&&e.trim().length>0,ene=e=>{if(!pd(e)||e.length===0)return!1;const t=e.trim();return t.length>0&&Number.isFinite(Number(t))},Wh=e=>!Pb(e)&&(Eo(e)||typeof e=="object"),$I=e=>{if(dd(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})},tne=e=>Eb(e)||Ote(typeof e),nne=e=>dd(e)==="URL",LI=e=>!Pb(e)&&Eo(e[Symbol.iterator]),rne=e=>LI(e)&&Eo(e.next)&&Eo(e.throw),sne=e=>Eo(e)&&/^class\s/.test(e.toString()),ine=(e,t)=>!fd(e)||!Eo(t)?!1:e.every(n=>t(n)),one=e=>Wh(e)&&!$I(e)&&e.nodeType===1&&pd(e.nodeName)&&Dte.every(t=>t in e),ane=e=>pd(e)&&e.length===0||fd(e)&&e.length===0||Wh(e)&&!Px(e)&&!Ix(e)&&Object.keys(e).length===0||Ix(e)&&e.size===0||Px(e)&&e.size===0,lne=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype,cne=(e,t)=>fd(e)?e.indexOf(t)>-1:!1,une=(e,t,n)=>{if(!Wh(e)||!t)return!1;const r=e[t];return Eo(n)?n(r):MI(r)};function wt(e){if(e===null)return"null";switch(typeof e){case"bigint":return"bigint";case"boolean":return"boolean";case"number":return"number";case"string":return"string";case"symbol":return"symbol";case"undefined":return"undefined"}if(fd(e))return"Array";if(RI(e))return"Function";const t=dd(e);return t||"Object"}wt.array=fd;wt.arrayOf=ine;wt.asyncGeneratorFunction=Fte;wt.asyncFunction=zte;wt.bigint=Bte;wt.boolean=Hte;wt.class=sne;wt.date=Wte;wt.defined=MI;wt.domElement=one;wt.empty=ane;wt.error=Vte;wt.function=Eo;wt.generator=rne;wt.generatorFunction=Kte;wt.instanceOf=lne;wt.integer=Ute;wt.iterable=LI;wt.map=Px;wt.nan=TI;wt.null=Eb;wt.nullOrUndefined=Pb;wt.nonEmptyString=Zte;wt.number=Qte;wt.numericString=ene;wt.object=Wh;wt.oneOf=cne;wt.plainFunction=RI;wt.plainObject=$I;wt.primitive=tne;wt.promise=qte;wt.propertyOf=une;wt.regexp=Yte;wt.set=Ix;wt.string=pd;wt.symbol=Gte;wt.undefined=Ab;wt.url=nne;wt.weakMap=Jte;wt.weakSet=Xte;var fr=wt;/* v8 ignore next -- @preserve */var dne=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},fne=function(e,t){return e+Uu(t)},Uu=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(fne,""):dne(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?Uu(e.props.children):""};Uu.default=Uu;var pne=Uu;const $g=Po(pne);var OI={exports:{}};(function(e){const t=Object.getPrototypeOf({});function n(){return function(i){return typeof i=="object"&&i!==null&&!(i instanceof RegExp)&&!(i instanceof Date)}}function r(s){function i(C){return C!=="constructor"&&C!=="prototype"&&C!=="__proto__"}function a(C){let j=0;const E=C.length,A=new Array(E);for(j;j<E;++j)A[j]=g(C[j]);return A}function l(C){const j={};if(d&&Object.getPrototypeOf(C)!==t)return d(C);const E=f(C);let A,O,W;for(A=0,O=E.length;A<O;++A)i(W=E[A])&&(j[W]=g(C[W]));return j}function c(C,j){const E=C.length,A=j.length;let O=0;const W=new Array(E+A);for(O;O<E;++O)W[O]=g(C[O]);for(O=0;O<A;++O)W[O+E]=g(j[O]);return W}const u=Object.prototype.propertyIsEnumerable;function p(C){const j=Object.keys(C),E=Object.getOwnPropertySymbols(C);for(let A=0,O=E.length;A<O;++A)u.call(C,E[A])&&j.push(E[A]);return j}const f=s!=null&&s.symbols?p:Object.keys,d=typeof(s==null?void 0:s.cloneProtoObject)=="function"?s.cloneProtoObject:void 0,h=typeof(s==null?void 0:s.isMergeableObject)=="function"?s.isMergeableObject:n(),y=(s==null?void 0:s.onlyDefinedProperties)===!0;function w(C){return typeof C!="object"||C===null}const b=s&&typeof s.mergeArray=="function"?s.mergeArray({clone:g,deepmerge:x,getKeys:f,isMergeableObject:h}):c;function g(C){return h(C)?Array.isArray(C)?a(C):l(C):C}function k(C,j){const E={},A=f(C),O=f(j);let W,H,D;for(W=0,H=A.length;W<H;++W)i(D=A[W])&&O.indexOf(D)===-1&&(E[D]=g(C[D]));for(W=0,H=O.length;W<H;++W)if(i(D=O[W]))if(D in C)A.indexOf(D)!==-1&&(d&&h(j[D])&&Object.getPrototypeOf(j[D])!==t?E[D]=d(j[D]):E[D]=x(C[D],j[D]));else{if(y&&typeof j[D]>"u")continue;E[D]=g(j[D])}return E}function x(C,j){if(y&&typeof j>"u")return g(C);const E=Array.isArray(j),A=Array.isArray(C);return w(j)?j:h(C)?E&&A?b(C,j):E!==A?g(j):k(C,j):g(j)}function S(){switch(arguments.length){case 0:return{};case 1:return g(arguments[0]);case 2:return x(arguments[0],arguments[1])}let C;for(let j=0,E=arguments.length;j<E;++j)C=x(C,arguments[j]);return C}return s!=null&&s.all?S:x}e.exports=r,e.exports.default=r,e.exports.deepmerge=r,Object.defineProperty(e.exports,"isMergeableObject",{get:n})})(OI);var hne=OI.exports;const mne=Po(hne);var gne=new Error("Element already at target scroll position"),yne=new Error("Scroll cancelled"),xne=Math.min,qj=Date.now,wne={left:Yj("scrollLeft"),top:Yj("scrollTop")};function Yj(e){return function(n,r,s,i){s=s||{},typeof s=="function"&&(i=s,s={}),typeof i!="function"&&(i=kne);var a=qj(),l=n[e],c=s.ease||bne,u=isNaN(s.duration)?350:+s.duration,p=!1;return l===r?i(gne,n[e]):requestAnimationFrame(d),f;function f(){p=!0}function d(h){if(p)return i(yne,n[e]);var y=qj(),w=xne(1,(y-a)/u),b=c(w);n[e]=b*(r-l)+l,w<1?requestAnimationFrame(d):requestAnimationFrame(function(){i(null,n[e])})}}}function bne(e){return .5*(1-Math.cos(Math.PI*e))}function kne(){}const vne=Po(wne);var DI={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(uu,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})})(DI);var Sne=DI.exports;const FI=Po(Sne),Nne=["top","right","bottom","left"],Gj=["start","end"],Jj=Nne.reduce((e,t)=>e.concat(t,t+"-"+Gj[0],t+"-"+Gj[1]),[]),Wl=Math.min,la=Math.max,Zp=Math.round,Pf=Math.floor,si=e=>({x:e,y:e}),jne={left:"right",right:"left",bottom:"top",top:"bottom"};function Tx(e,t,n){return la(e,Wl(t,n))}function Zl(e,t){return typeof e=="function"?e(t):e}function Li(e){return e.split("-")[0]}function ii(e){return e.split("-")[1]}function zI(e){return e==="x"?"y":"x"}function Ib(e){return e==="y"?"height":"width"}function po(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Tb(e){return zI(po(e))}function BI(e,t,n){n===void 0&&(n=!1);const r=ii(e),s=Tb(e),i=Ib(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=th(a)),[a,th(a)]}function Cne(e){const t=th(e);return[eh(e),t,eh(t)]}function eh(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Xj=["left","right"],Qj=["right","left"],_ne=["top","bottom"],Ene=["bottom","top"];function Ane(e,t,n){switch(e){case"top":case"bottom":return n?t?Qj:Xj:t?Xj:Qj;case"left":case"right":return t?_ne:Ene;default:return[]}}function Pne(e,t,n,r){const s=ii(e);let i=Ane(Li(e),n==="start",r);return s&&(i=i.map(a=>a+"-"+s),t&&(i=i.concat(i.map(eh)))),i}function th(e){const t=Li(e);return jne[t]+e.slice(t.length)}function Ine(e){return{top:0,right:0,bottom:0,left:0,...e}}function HI(e){return typeof e!="number"?Ine(e):{top:e,right:e,bottom:e,left:e}}function nh(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 Zj(e,t,n){let{reference:r,floating:s}=e;const i=po(t),a=Tb(t),l=Ib(a),c=Li(t),u=i==="y",p=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,d=r[l]/2-s[l]/2;let h;switch(c){case"top":h={x:p,y:r.y-s.height};break;case"bottom":h={x:p,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-s.width,y:f};break;default:h={x:r.x,y:r.y}}switch(ii(t)){case"start":h[a]-=d*(n&&u?-1:1);break;case"end":h[a]+=d*(n&&u?-1:1);break}return h}async function Tne(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:a,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:p="viewport",elementContext:f="floating",altBoundary:d=!1,padding:h=0}=Zl(t,e),y=HI(h),b=l[d?f==="floating"?"reference":"floating":f],g=nh(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(b)))==null||n?b:b.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:p,strategy:c})),k=f==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),S=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},C=nh(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:k,offsetParent:x,strategy:c}):k);return{top:(g.top-C.top+y.top)/S.y,bottom:(C.bottom-g.bottom+y.bottom)/S.y,left:(g.left-C.left+y.left)/S.x,right:(C.right-g.right+y.right)/S.x}}const Rne=50,Mne=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:Tne},c=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:p,y:f}=Zj(u,r,c),d=r,h=0;const y={};for(let w=0;w<i.length;w++){const b=i[w];if(!b)continue;const{name:g,fn:k}=b,{x,y:S,data:C,reset:j}=await k({x:p,y:f,initialPlacement:r,placement:d,strategy:s,middlewareData:y,rects:u,platform:l,elements:{reference:e,floating:t}});p=x??p,f=S??f,y[g]={...y[g],...C},j&&h<Rne&&(h++,typeof j=="object"&&(j.placement&&(d=j.placement),j.rects&&(u=j.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):j.rects),{x:p,y:f}=Zj(u,d,c)),w=-1)}return{x:p,y:f,placement:d,strategy:s,middlewareData:y}},$ne=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:u,padding:p=0}=Zl(e,t)||{};if(u==null)return{};const f=HI(p),d={x:n,y:r},h=Tb(s),y=Ib(h),w=await a.getDimensions(u),b=h==="y",g=b?"top":"left",k=b?"bottom":"right",x=b?"clientHeight":"clientWidth",S=i.reference[y]+i.reference[h]-d[h]-i.floating[y],C=d[h]-i.reference[h],j=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let E=j?j[x]:0;(!E||!await(a.isElement==null?void 0:a.isElement(j)))&&(E=l.floating[x]||i.floating[y]);const A=S/2-C/2,O=E/2-w[y]/2-1,W=Wl(f[g],O),H=Wl(f[k],O),D=W,R=E-w[y]-H,T=E/2-w[y]/2+A,V=Tx(D,T,R),F=!c.arrow&&ii(s)!=null&&T!==V&&i.reference[y]/2-(T<D?W:H)-w[y]/2<0,M=F?T<D?T-D:T-R:0;return{[h]:d[h]+M,data:{[h]:V,centerOffset:T-V-M,...F&&{alignmentOffset:M}},reset:F}}});function Lne(e,t,n){return(e?[...n.filter(s=>ii(s)===e),...n.filter(s=>ii(s)!==e)]:n.filter(s=>Li(s)===s)).filter(s=>e?ii(s)===e||(t?eh(s)!==s:!1):!0)}const One=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:u}=t,{crossAxis:p=!1,alignment:f,allowedPlacements:d=Jj,autoAlignment:h=!0,...y}=Zl(e,t),w=f!==void 0||d===Jj?Lne(f||null,h,d):d,b=await c.detectOverflow(t,y),g=((n=a.autoPlacement)==null?void 0:n.index)||0,k=w[g];if(k==null)return{};const x=BI(k,i,await(c.isRTL==null?void 0:c.isRTL(u.floating)));if(l!==k)return{reset:{placement:w[0]}};const S=[b[Li(k)],b[x[0]],b[x[1]]],C=[...((r=a.autoPlacement)==null?void 0:r.overflows)||[],{placement:k,overflows:S}],j=w[g+1];if(j)return{data:{index:g+1,overflows:C},reset:{placement:j}};const E=C.map(W=>{const H=ii(W.placement);return[W.placement,H&&p?W.overflows.slice(0,2).reduce((D,R)=>D+R,0):W.overflows[0],W.overflows]}).sort((W,H)=>W[1]-H[1]),O=((s=E.filter(W=>W[2].slice(0,ii(W[0])?2:3).every(H=>H<=0))[0])==null?void 0:s[0])||E[0][0];return O!==l?{data:{index:g+1,overflows:C},reset:{placement:O}}:{}}}},Dne=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:u}=t,{mainAxis:p=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:w=!0,...b}=Zl(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const g=Li(s),k=po(l),x=Li(l)===l,S=await(c.isRTL==null?void 0:c.isRTL(u.floating)),C=d||(x||!w?[th(l)]:Cne(l)),j=y!=="none";!d&&j&&C.push(...Pne(l,w,y,S));const E=[l,...C],A=await c.detectOverflow(t,b),O=[];let W=((r=i.flip)==null?void 0:r.overflows)||[];if(p&&O.push(A[g]),f){const T=BI(s,a,S);O.push(A[T[0]],A[T[1]])}if(W=[...W,{placement:s,overflows:O}],!O.every(T=>T<=0)){var H,D;const T=(((H=i.flip)==null?void 0:H.index)||0)+1,V=E[T];if(V&&(!(f==="alignment"?k!==po(V):!1)||W.every(I=>po(I.placement)===k?I.overflows[0]>0:!0)))return{data:{index:T,overflows:W},reset:{placement:V}};let F=(D=W.filter(M=>M.overflows[0]<=0).sort((M,I)=>M.overflows[1]-I.overflows[1])[0])==null?void 0:D.placement;if(!F)switch(h){case"bestFit":{var R;const M=(R=W.filter(I=>{if(j){const B=po(I.placement);return B===k||B==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(B=>B>0).reduce((B,_)=>B+_,0)]).sort((I,B)=>I[1]-B[1])[0])==null?void 0:R[0];M&&(F=M);break}case"initialPlacement":F=l;break}if(s!==F)return{reset:{placement:F}}}return{}}}},Fne=new Set(["left","top"]);async function zne(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=Li(n),l=ii(n),c=po(n)==="y",u=Fne.has(a)?-1:1,p=i&&c?-1:1,f=Zl(t,e);let{mainAxis:d,crossAxis:h,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof y=="number"&&(h=l==="end"?y*-1:y),c?{x:h*p,y:d*u}:{x:d*u,y:h*p}}const Bne=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 zne(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}}}}},Hne=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:g=>{let{x:k,y:x}=g;return{x:k,y:x}}},...u}=Zl(e,t),p={x:n,y:r},f=await i.detectOverflow(t,u),d=po(Li(s)),h=zI(d);let y=p[h],w=p[d];if(a){const g=h==="y"?"top":"left",k=h==="y"?"bottom":"right",x=y+f[g],S=y-f[k];y=Tx(x,y,S)}if(l){const g=d==="y"?"top":"left",k=d==="y"?"bottom":"right",x=w+f[g],S=w-f[k];w=Tx(x,w,S)}const b=c.fn({...t,[h]:y,[d]:w});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[h]:a,[d]:l}}}}}};function Vh(){return typeof window<"u"}function ec(e){return WI(e)?(e.nodeName||"").toLowerCase():"#document"}function Zr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ui(e){var t;return(t=(WI(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function WI(e){return Vh()?e instanceof Node||e instanceof Zr(e).Node:!1}function Ds(e){return Vh()?e instanceof Element||e instanceof Zr(e).Element:!1}function zi(e){return Vh()?e instanceof HTMLElement||e instanceof Zr(e).HTMLElement:!1}function e1(e){return!Vh()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Zr(e).ShadowRoot}function hd(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Fs(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function Wne(e){return/^(table|td|th)$/.test(ec(e))}function Kh(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Vne=/transform|translate|scale|rotate|perspective|filter/,Kne=/paint|layout|strict|content/,Wo=e=>!!e&&e!=="none";let Lg;function Rb(e){const t=Ds(e)?Fs(e):e;return Wo(t.transform)||Wo(t.translate)||Wo(t.scale)||Wo(t.rotate)||Wo(t.perspective)||!Mb()&&(Wo(t.backdropFilter)||Wo(t.filter))||Vne.test(t.willChange||"")||Kne.test(t.contain||"")}function Une(e){let t=Ao(e);for(;zi(t)&&!Vl(t);){if(Rb(t))return t;if(Kh(t))return null;t=Ao(t)}return null}function Mb(){return Lg==null&&(Lg=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Lg}function Vl(e){return/^(html|body|#document)$/.test(ec(e))}function Fs(e){return Zr(e).getComputedStyle(e)}function Uh(e){return Ds(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ao(e){if(ec(e)==="html")return e;const t=e.assignedSlot||e.parentNode||e1(e)&&e.host||ui(e);return e1(t)?t.host:t}function VI(e){const t=Ao(e);return Vl(t)?e.ownerDocument?e.ownerDocument.body:e.body:zi(t)&&hd(t)?t:VI(t)}function qu(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=VI(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),a=Zr(s);if(i){const l=Rx(a);return t.concat(a,a.visualViewport||[],hd(s)?s:[],l&&n?qu(l):[])}else return t.concat(s,qu(s,[],n))}function Rx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function KI(e){const t=Fs(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=zi(e),i=s?e.offsetWidth:n,a=s?e.offsetHeight:r,l=Zp(n)!==i||Zp(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function $b(e){return Ds(e)?e:e.contextElement}function Cl(e){const t=$b(e);if(!zi(t))return si(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=KI(t);let a=(i?Zp(n.width):n.width)/r,l=(i?Zp(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const qne=si(0);function UI(e){const t=Zr(e);return!Mb()||!t.visualViewport?qne:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Yne(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Zr(e)?!1:t}function Na(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=$b(e);let a=si(1);t&&(r?Ds(r)&&(a=Cl(r)):a=Cl(e));const l=Yne(i,n,r)?UI(i):si(0);let c=(s.left+l.x)/a.x,u=(s.top+l.y)/a.y,p=s.width/a.x,f=s.height/a.y;if(i){const d=Zr(i),h=r&&Ds(r)?Zr(r):r;let y=d,w=Rx(y);for(;w&&r&&h!==y;){const b=Cl(w),g=w.getBoundingClientRect(),k=Fs(w),x=g.left+(w.clientLeft+parseFloat(k.paddingLeft))*b.x,S=g.top+(w.clientTop+parseFloat(k.paddingTop))*b.y;c*=b.x,u*=b.y,p*=b.x,f*=b.y,c+=x,u+=S,y=Zr(w),w=Rx(y)}}return nh({width:p,height:f,x:c,y:u})}function qh(e,t){const n=Uh(e).scrollLeft;return t?t.left+n:Na(ui(e)).left+n}function qI(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-qh(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Gne(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",a=ui(r),l=t?Kh(t.floating):!1;if(r===a||l&&i)return n;let c={scrollLeft:0,scrollTop:0},u=si(1);const p=si(0),f=zi(r);if((f||!f&&!i)&&((ec(r)!=="body"||hd(a))&&(c=Uh(r)),f)){const h=Na(r);u=Cl(r),p.x=h.x+r.clientLeft,p.y=h.y+r.clientTop}const d=a&&!f&&!i?qI(a,c):si(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+p.x+d.x,y:n.y*u.y-c.scrollTop*u.y+p.y+d.y}}function Jne(e){return Array.from(e.getClientRects())}function Xne(e){const t=ui(e),n=Uh(e),r=e.ownerDocument.body,s=la(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=la(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+qh(e);const l=-n.scrollTop;return Fs(r).direction==="rtl"&&(a+=la(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:a,y:l}}const t1=25;function Qne(e,t){const n=Zr(e),r=ui(e),s=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,c=0;if(s){i=s.width,a=s.height;const p=Mb();(!p||p&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const u=qh(r);if(u<=0){const p=r.ownerDocument,f=p.body,d=getComputedStyle(f),h=p.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,y=Math.abs(r.clientWidth-f.clientWidth-h);y<=t1&&(i-=y)}else u<=t1&&(i+=u);return{width:i,height:a,x:l,y:c}}function Zne(e,t){const n=Na(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=zi(e)?Cl(e):si(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,c=s*i.x,u=r*i.y;return{width:a,height:l,x:c,y:u}}function n1(e,t,n){let r;if(t==="viewport")r=Qne(e,n);else if(t==="document")r=Xne(ui(e));else if(Ds(t))r=Zne(t,n);else{const s=UI(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return nh(r)}function YI(e,t){const n=Ao(e);return n===t||!Ds(n)||Vl(n)?!1:Fs(n).position==="fixed"||YI(n,t)}function ere(e,t){const n=t.get(e);if(n)return n;let r=qu(e,[],!1).filter(l=>Ds(l)&&ec(l)!=="body"),s=null;const i=Fs(e).position==="fixed";let a=i?Ao(e):e;for(;Ds(a)&&!Vl(a);){const l=Fs(a),c=Rb(a);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||hd(a)&&!c&&YI(e,a))?r=r.filter(p=>p!==a):s=l,a=Ao(a)}return t.set(e,r),r}function tre(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?Kh(t)?[]:ere(t,this._c):[].concat(n),r],l=n1(t,a[0],s);let c=l.top,u=l.right,p=l.bottom,f=l.left;for(let d=1;d<a.length;d++){const h=n1(t,a[d],s);c=la(h.top,c),u=Wl(h.right,u),p=Wl(h.bottom,p),f=la(h.left,f)}return{width:u-f,height:p-c,x:f,y:c}}function nre(e){const{width:t,height:n}=KI(e);return{width:t,height:n}}function rre(e,t,n){const r=zi(t),s=ui(t),i=n==="fixed",a=Na(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=si(0);function u(){c.x=qh(s)}if(r||!r&&!i)if((ec(t)!=="body"||hd(s))&&(l=Uh(t)),r){const h=Na(t,!0,i,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else s&&u();i&&!r&&s&&u();const p=s&&!r&&!i?qI(s,l):si(0),f=a.left+l.scrollLeft-c.x-p.x,d=a.top+l.scrollTop-c.y-p.y;return{x:f,y:d,width:a.width,height:a.height}}function Og(e){return Fs(e).position==="static"}function r1(e,t){if(!zi(e)||Fs(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ui(e)===n&&(n=n.ownerDocument.body),n}function GI(e,t){const n=Zr(e);if(Kh(e))return n;if(!zi(e)){let s=Ao(e);for(;s&&!Vl(s);){if(Ds(s)&&!Og(s))return s;s=Ao(s)}return n}let r=r1(e,t);for(;r&&Wne(r)&&Og(r);)r=r1(r,t);return r&&Vl(r)&&Og(r)&&!Rb(r)?n:r||Une(e)||n}const sre=async function(e){const t=this.getOffsetParent||GI,n=this.getDimensions,r=await n(e.floating);return{reference:rre(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ire(e){return Fs(e).direction==="rtl"}const ore={convertOffsetParentRelativeRectToViewportRelativeRect:Gne,getDocumentElement:ui,getClippingRect:tre,getOffsetParent:GI,getElementRects:sre,getClientRects:Jne,getDimensions:nre,getScale:Cl,isElement:Ds,isRTL:ire};function JI(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function are(e,t){let n=null,r;const s=ui(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 u=e.getBoundingClientRect(),{left:p,top:f,width:d,height:h}=u;if(l||t(),!d||!h)return;const y=Pf(f),w=Pf(s.clientWidth-(p+d)),b=Pf(s.clientHeight-(f+h)),g=Pf(p),x={rootMargin:-y+"px "+-w+"px "+-b+"px "+-g+"px",threshold:la(0,Wl(1,c))||1};let S=!0;function C(j){const E=j[0].intersectionRatio;if(E!==c){if(!S)return a();E?a(!1,E):r=setTimeout(()=>{a(!1,1e-7)},1e3)}E===1&&!JI(u,e.getBoundingClientRect())&&a(),S=!1}try{n=new IntersectionObserver(C,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(C,x)}n.observe(e)}return a(!0),i}function s1(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,u=$b(e),p=s||i?[...u?qu(u):[],...t?qu(t):[]]:[];p.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),i&&g.addEventListener("resize",n)});const f=u&&l?are(u,n):null;let d=-1,h=null;a&&(h=new ResizeObserver(g=>{let[k]=g;k&&k.target===u&&h&&t&&(h.unobserve(t),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var x;(x=h)==null||x.observe(t)})),n()}),u&&!c&&h.observe(u),t&&h.observe(t));let y,w=c?Na(e):null;c&&b();function b(){const g=Na(e);w&&!JI(w,g)&&n(),w=g,y=requestAnimationFrame(b)}return n(),()=>{var g;p.forEach(k=>{s&&k.removeEventListener("scroll",n),i&&k.removeEventListener("resize",n)}),f==null||f(),(g=h)==null||g.disconnect(),h=null,c&&cancelAnimationFrame(y)}}const lre=Bne,cre=One,ure=Hne,dre=Dne,i1=$ne,fre=(e,t,n)=>{const r=new Map,s={platform:ore,...n},i={...s.platform,_c:r};return Mne(e,t,{...s,platform:i})};var pre=typeof document<"u",hre=function(){},rp=pre?m.useLayoutEffect:hre;function rh(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(!rh(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)&&!rh(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function XI(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function o1(e,t){const n=XI(e);return Math.round(t*n)/n}function Dg(e){const t=m.useRef(e);return rp(()=>{t.current=e}),t}function a1(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:u}=e,[p,f]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[d,h]=m.useState(r);rh(d,r)||h(r);const[y,w]=m.useState(null),[b,g]=m.useState(null),k=m.useCallback(I=>{I!==j.current&&(j.current=I,w(I))},[]),x=m.useCallback(I=>{I!==E.current&&(E.current=I,g(I))},[]),S=i||y,C=a||b,j=m.useRef(null),E=m.useRef(null),A=m.useRef(p),O=c!=null,W=Dg(c),H=Dg(s),D=Dg(u),R=m.useCallback(()=>{if(!j.current||!E.current)return;const I={placement:t,strategy:n,middleware:d};H.current&&(I.platform=H.current),fre(j.current,E.current,I).then(B=>{const _={...B,isPositioned:D.current!==!1};T.current&&!rh(A.current,_)&&(A.current=_,Sr.flushSync(()=>{f(_)}))})},[d,t,n,H,D]);rp(()=>{u===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,f(I=>({...I,isPositioned:!1})))},[u]);const T=m.useRef(!1);rp(()=>(T.current=!0,()=>{T.current=!1}),[]),rp(()=>{if(S&&(j.current=S),C&&(E.current=C),S&&C){if(W.current)return W.current(S,C,R);R()}},[S,C,R,W,O]);const V=m.useMemo(()=>({reference:j,floating:E,setReference:k,setFloating:x}),[k,x]),F=m.useMemo(()=>({reference:S,floating:C}),[S,C]),M=m.useMemo(()=>{const I={position:n,left:0,top:0};if(!F.floating)return I;const B=o1(F.floating,p.x),_=o1(F.floating,p.y);return l?{...I,transform:"translate("+B+"px, "+_+"px)",...XI(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:B,top:_}},[n,l,F.floating,p.x,p.y]);return m.useMemo(()=>({...p,update:R,refs:V,elements:F,floatingStyles:M}),[p,R,V,F,M])}const mre=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?i1({element:r.current,padding:s}).fn(n):{}:r?i1({element:r,padding:s}).fn(n):{}}}},l1=(e,t)=>{const n=lre(e);return{name:n.name,fn:n.fn,options:[e,t]}},gre=(e,t)=>{const n=ure(e);return{name:n.name,fn:n.fn,options:[e,t]}},yre=(e,t)=>{const n=dre(e);return{name:n.name,fn:n.fn,options:[e,t]}},xre=(e,t)=>{const n=cre(e);return{name:n.name,fn:n.fn,options:[e,t]}},wre=(e,t)=>{const n=mre(e);return{name:n.name,fn:n.fn,options:[e,t]}},bre={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},kre={beaconOptions:{offset:-18}},QI={back:"Back",close:"Close",last:"Last",next:"Next",nextWithProgress:"Next ({current} of {total})",open:"Open the dialog",skip:"Skip"},vre={isFixed:!1,locale:QI,placement:"bottom"},Sre={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"},qn={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"},Gs={BUTTON_BACK:"button_back",BUTTON_CLOSE:"button_close",BUTTON_PRIMARY:"button_primary",BUTTON_SKIP:"button_skip",KEYBOARD:"keyboard",OVERLAY:"overlay"},Nt={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"},Nre="react-joyride-portal";function jre(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function pl(...e){return mne({all:!0,isMergeableObject:t=>!(!fr.plainObject(t)||m.isValidElement(t))})(...e)}function ZI(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function Si(e,t={}){const{defaultValue:n,step:r,steps:s}=t;let i=$g(e);if(i)(i.includes("{current}")||i.includes("{total}"))&&r&&s&&(i=i.replace("{current}",r.toString()).replace("{total}",s.toString()));else if(m.isValidElement(e)&&!Object.values(e.props).length&&ZI(e.type)==="function")try{i=Si(e.type({}),t)}catch{i=$g(n)}else i=$g(n);return i}function Gn(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 Cre(e,t){const n=jre(t);return{...e,...n}}function Yu(){}function _re(e){return Object.keys(e)}function sh(e,...t){if(!fr.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 c1(e,...t){if(!fr.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 Mx(e,t,n){const r=i=>i.replace("{current}",String(t)).replace("{total}",String(n));if(ZI(e)==="string")return r(e);if(!m.isValidElement(e))return e;const{children:s}=e.props;if(fr.string(s)&&s.includes("{current}"))return m.cloneElement(e,{children:r(s)});if(Array.isArray(s))return m.cloneElement(e,{children:s.map(i=>typeof i=="string"?r(i):Mx(i,t,n))});if(fr.function(e.type)&&!Object.values(e.props).length)try{return Mx(e.type({}),t,n)}catch{return e}return e}function u1(e){return _re(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})}function Lb(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function d1(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 Ob(e){return e?e.getBoundingClientRect():null}function Ere(e=!1){const{body:t,documentElement:n}=document;if(!t||!n)return 0;if(e){const r=[t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight].sort((i,a)=>i-a),s=Math.floor(r.length/2);return r.length%2===0?(r[s-1]+r[s])/2:r[s]}return Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)}function hs(e){if(!e)return null;if(typeof e=="function")try{return e()}catch{return null}if(typeof e=="object"&&"current"in e)return e.current;if(typeof e=="string")try{return document.querySelector(e)}catch{return null}return e}function Are(e,t,n){const r=Ob(e),s=tc(e),i=s?!s.isSameNode(Lr()):!1,a=n??nc(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(Lr())||(c+=Lr().scrollTop)),Math.floor(c-t)}function tc(e,t){if(!e)return Lr();const n=FI(e);if(n){if(n.isSameNode(Lr()))return t?document:Lr();if(!(n.scrollHeight>n.offsetHeight))return Lr()}return n}function Pre(e){const t=e.getBoundingClientRect(),n=Lr(),r=t.top+t.height/2,s=window.innerHeight/2;return Math.max(0,n.scrollTop+r-s)}function Ire(e,t){if(!e)return 0;const n=FI(e)??Lr(),r=parseFloat(getComputedStyle(e).scrollMarginTop)||0,s=Ob(n),i=n.scrollTop??0,{offsetTop:a=0,scrollTop:l=0}=n;let c=e.getBoundingClientRect().top+l;if(a&&(eT(e)||Tre(e))){const p=e.getBoundingClientRect(),f=p.top-((s==null?void 0:s.top)??0),d=f+p.height,h=n.clientHeight,y=h*.2;f>=y&&d<=h-y?c=i:c=f+i}const u=Math.floor(c-t-r);return u<0?0:u}function Tre(e){return e.offsetParent!==document.body}function eT(e){if(!e)return!1;const t=tc(e);return t?!t.isSameNode(Lr()):!1}function nc(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?nc(e.parentNode,t):!1}function If(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 f1(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?tc(s):Lr(),l=a?!a.isSameNode(Lr()):!1;return(r.isFixed||nc(s))&&!l?!1:a.scrollHeight>a.clientHeight}function Lr(){return document.scrollingElement??document.documentElement}function p1(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=vne.top(r,e,{duration:c<100?50:n},()=>{a()})});return{cancel:s,promise:i}}function Rre(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 tT={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555555",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,WebkitAppearance:"none"},Tf={...tT,borderRadius:4,padding:8};function Mre(e,t){const{styles:n}=e,r=pl(n??{},t.styles??{});let{width:s}=t;Lb()&&(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 pl({arrow:{alignItems:"center",color:t.arrowColor,display:"inline-flex",justifyContent:"center",position:"absolute"},beaconWrapper:{...tT,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(${Rre(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:{...Tf,color:t.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{...Tf,color:t.textColor,height:12,padding:8,position:"absolute",right:0,top:0,width:12},buttonPrimary:{...Tf,backgroundColor:t.primaryColor,color:t.backgroundColor},buttonSkip:{...Tf,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 $re=["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 Db(e,t){if(!t)return null;const n=pl(vre,c1(e,"arrowComponent","beaconComponent","floatingOptions","loaderComponent","locale","styles","tooltipComponent"),t),r=pl(bre,e.options??{},c1(t,...$re)),s=Mre(e,{...n,...r}),i=pl(kre,e.floatingOptions??{},n.floatingOptions??{});return{...n,...r,locale:pl(QI,e.locale??{},n.locale||{}),floatingOptions:i,spotlightPadding:Lre(r.spotlightPadding),styles:s}}function Lre(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 Ore(e,t,n){const{action:r}=t,s=n&&[_t.PREV,_t.NEXT].includes(r);return e.skipBeacon||e.placement==="center"||s}function nT(e,t=!1){return fr.plainObject(e)?e.target?!0:(Gn(t,"tour","target is missing from the step"),!1):(Gn(t,"tour","step must be an object"),!1)}function rT(e,t=!1){return fr.array(e)?e.every(n=>nT(n,t)):(Gn(t,"tour","steps must be an array"),!1)}var Dre=class{constructor(e){Nn(this,"beaconPosition",null);Nn(this,"debug");Nn(this,"eventListeners",new Map);Nn(this,"listeners",new Set);Nn(this,"props");Nn(this,"snapshot");Nn(this,"state");Nn(this,"steps");Nn(this,"tooltipPosition",null);Nn(this,"cleanupPositionData",()=>{this.beaconPosition=null,this.tooltipPosition=null});Nn(this,"getPositionData",e=>e==="beacon"?this.beaconPosition:this.tooltipPosition);Nn(this,"getServerSnapshot",()=>this.snapshot);Nn(this,"getSnapshot",()=>this.snapshot);Nn(this,"getEventState",()=>sh(this.snapshot,"positioned"));Nn(this,"getState",()=>sh(this.snapshot,"positioned"));Nn(this,"setPositionData",(e,t)=>{var r,s,i;((r=e==="beacon"?this.beaconPosition:this.tooltipPosition)==null?void 0:r.placement)!==t.placement&&Gn(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)});Nn(this,"setSteps",e=>{this.steps=e,this.updateState({size:e.length})});Nn(this,"dispatch",(e,t)=>{const n=this.eventListeners.get(e.type);if(n)for(const r of n)try{r(e,t)}catch{}});Nn(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)}});Nn(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));Nn(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,!_b(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=fr.number(n);let i=0;this.debug=(e==null?void 0:e.debug)??!1,s?(i=n,fr.number(t)&&Gn(this.debug,"tour","initialStepIndex is ignored in controlled mode")):fr.number(t)&&(t>=0&&t<r.length?i=t:r.length>0&&Gn(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?Nt.READY:Nt.IDLE,waiting:!1},this.snapshot=Object.freeze({...this.state})}applyTransitions(e){return e.status===Nt.WAITING&&e.size>0?{...e,status:Nt.RUNNING}:e}getStep(e){return Db(this.props,this.steps[e??this.state.index])}};function Fre(e){return new Dre(e)}function h1(e,t){return Math.min(Math.max(e,0),t)}function zre(e,t,n){const r=m.useRef(t),s=m.useRef(n);return r.current=t,s.current=n,m.useMemo(()=>{const i=()=>e.current.getSnapshot();return{close:(b=null)=>{const{index:g,status:k}=i();k===Nt.RUNNING&&e.current.updateState({action:_t.CLOSE,index:g+1,origin:b,lifecycle:Be.COMPLETE,positioned:!1,scrolling:!1,waiting:!1})},go:b=>{const{controlled:g,size:k,status:x}=i();if(g){Gn(r.current,"tour","go() is not supported in controlled mode");return}x===Nt.RUNNING&&e.current.updateState({action:_t.GO,index:b,lifecycle:Be.COMPLETE,positioned:!1,scrolling:!1,status:b<k?x:Nt.FINISHED,waiting:!1})},info:()=>sh(e.current.getSnapshot(),"positioned"),next:b=>{const{index:g,size:k,status:x}=i();x===Nt.RUNNING&&e.current.updateState({action:_t.NEXT,index:h1(g+1,k),lifecycle:Be.COMPLETE,origin:b,positioned:!1,scrolling:!1,waiting:!1})},open:()=>{const{status:b}=i();b===Nt.RUNNING&&e.current.updateState({action:_t.UPDATE,lifecycle:Be.TOOLTIP_BEFORE,positioned:!1,scrolling:!1,waiting:!1})},prev:b=>{const{index:g,size:k,status:x}=i();x===Nt.RUNNING&&e.current.updateState({action:_t.PREV,index:h1(g-1,k),lifecycle:Be.COMPLETE,origin:b,positioned:!1,scrolling:!1,waiting:!1})},reset:(b=!1)=>{const{controlled:g}=i();if(g){Gn(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:b?Nt.RUNNING:Nt.READY,waiting:!1})},skip:b=>{const{status:g}=i();g===Nt.RUNNING&&e.current.updateState({action:_t.SKIP,lifecycle:Be.COMPLETE,origin:b,positioned:!1,scrolling:!1,status:Nt.SKIPPED,waiting:!1})},start:b=>{const{index:g,size:k}=i();s.current(),e.current.updateState({action:_t.START,index:fr.number(b)?b:g,lifecycle:Be.INIT,positioned:!1,scrolling:!1,status:k?Nt.RUNNING:Nt.WAITING,waiting:!1},!0)},stop:(b=!1)=>{const{index:g,status:k}=i();[Nt.FINISHED,Nt.SKIPPED].includes(k)||e.current.updateState({action:_t.STOP,index:g+(b?1:0),lifecycle:Be.COMPLETE,positioned:!1,scrolling:!1,status:Nt.PAUSED,waiting:!1})}}},[e])}const Bre=new Set(["origin","positioned"]);function Hre(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!t)return;const r=e.current.getSnapshot();return Gn(!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]&&!Bre.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||Gn(!0,l?"tour":`step:${s.index}`,"state",a))})},[t,e])}function Wre(e,t,n){const r=m.useRef(e),s=m.useRef(t);return r.current=e,s.current=t,m.useCallback((i,a,l)=>{var u;const c={...n.current.getEventState(),error:null,scroll:null,step:a,type:i,...l};(u=r.current)==null||u.call(r,c,s.current),n.current.dispatch(c,s.current)},[n])}function io(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 Vre(e){const{addFailure:t,controls:n,emitEvent:r,previousState:s,props:i,state:a,step:l,store:c}=e,{action:u,index:p,lifecycle:f,positioned:d,scrolling:h,size:y,status:w}=a,b=II(l)??null,g=m.useRef(null),k=m.useRef(i),x=m.useRef(a),S=m.useRef(s),C=m.useRef(l),j=m.useRef(b),E=m.useRef(n),A=m.useRef(null),O=m.useRef(null),W=m.useRef(null);k.current=i,x.current=a,S.current=s,C.current=l,j.current=b,E.current=n;const H=()=>{A.current&&(clearInterval(A.current),A.current=null),O.current=null,W.current&&(W.current.cancel(),W.current=null)};m.useEffect(()=>{if(!S.current)return;const{hasChangedTo:D}=io(x.current,S.current);(D("action",[_t.NEXT,_t.PREV,_t.SKIP,_t.CLOSE])||g.current===_t.CLOSE&&u===_t.START)&&(g.current=u)},[u]),m.useEffect(()=>{if(!S.current)return()=>{H()};const{hasChanged:D}=io(x.current,S.current),R=C.current;if(D("index")&&H(),w!==Nt.RUNNING||!R||f!==Be.INIT)return()=>{H()};const{hasChangedTo:T}=io(x.current,S.current);T("status",Nt.RUNNING)&&[Nt.IDLE,Nt.READY,Nt.PAUSED].includes(S.current.status)&&r(qn.TOUR_START,R),c.current.cleanupPositionData();const{debug:V}=k.current;if(R.before&&!W.current){Gn(V,`step:${p}`,"before()",R),W.current={cancel:()=>{}},c.current.updateState({waiting:!0}),r(qn.STEP_BEFORE_HOOK,R,{action:g.current??x.current.action});const F=()=>{W.current=null,c.current.updateState({action:g.current??x.current.action,waiting:!1,lifecycle:Be.READY})},M=new AbortController,I=R.beforeTimeout;W.current={cancel:()=>M.abort()};const B=I?setTimeout(()=>{M.signal.aborted||(Gn(V,`step:${p}`,"before()","timed out",`${I}ms`),M.abort(),t(R,"before_hook"),r(qn.ERROR,R,{error:new Error("Step before hook timed out")}),F())},I):null;R.before({...c.current.getState(),action:g.current??c.current.getState().action,step:R}).then(()=>{M.signal.aborted||(B&&clearTimeout(B),F())}).catch(_=>{M.signal.aborted||(B&&clearTimeout(B),t(R,"before_hook"),r(qn.ERROR,R,{error:_ instanceof Error?_:new Error(String(_))}),F())})}else if(!W.current){A.current&&O.current!==R.target&&H();const F=hs(R.target);if(F&&If(F))H(),c.current.updateState({action:g.current??_t.UPDATE,lifecycle:Be.READY,waiting:!1});else if(R.targetWaitTimeout===0)c.current.updateState({action:g.current??_t.UPDATE,lifecycle:Be.READY,waiting:!1});else if(!A.current){const{targetWaitTimeout:M}=R,I=Date.now();O.current=R.target,Gn(V,`step:${p}`,"polling","started",`${M}ms`),c.current.updateState({waiting:!0}),A.current=setInterval(()=>{const B=hs(R.target),_=Date.now()-I,q=_>=M;(B&&If(B)||q)&&(Gn(V,`step:${p}`,"polling",B&&If(B)?"found":"timed out",`${_}ms`),H(),c.current.updateState({action:g.current??_t.UPDATE,lifecycle:Be.READY,waiting:!1}))},100)}}return()=>{H()}},[t,r,p,f,w,c]),m.useEffect(()=>{if(!S.current)return;const{hasChanged:D,hasChangedTo:R,previous:T}=io(x.current,S.current),V=C.current;if(!V)return;const F=hs(V.target),M=!!F;if(M&&If(F)){if(R("lifecycle",Be.READY)&&T.lifecycle===Be.INIT&&r(qn.STEP_BEFORE,V,{action:g.current??x.current.action}),R("lifecycle",Be.READY)){const I=x.current,B=Ore(V,I,k.current.continuous)?Be.TOOLTIP:Be.BEACON,_=hs(V.scrollTarget??V.spotlightTarget??V.target),q=f1({isFirstStep:I.index===0,scrollToFirstStep:k.current.scrollToFirstStep,step:V,target:_,targetLifecycle:B}),z=B===Be.TOOLTIP?Be.TOOLTIP_BEFORE:Be.BEACON_BEFORE;Gn(k.current.debug,`step:${p}`,"scroll",q?"needed":"skipped"),c.current.updateState({action:_t.UPDATE,lifecycle:z,scrolling:q})}}else if(x.current.status===Nt.RUNNING&&f!==Be.INIT&&f!==Be.COMPLETE&&D("lifecycle")){Gn(k.current.debug,`step:${p}`,M?"Target not visible":"Target not mounted",V),t(V,"target_not_found"),r(qn.TARGET_NOT_FOUND,V);const I=x.current;I.controlled||c.current.updateState({action:_t.UPDATE,index:I.index+(I.action===_t.PREV?-1:1),lifecycle:Be.INIT})}},[t,r,p,f,c]),m.useEffect(()=>{if(!S.current)return;const{hasChangedTo:D,previous:R}=io(x.current,S.current),T=C.current,V=j.current;if(T&&D("lifecycle",Be.TOOLTIP_BEFORE)&&R.lifecycle===Be.BEACON){const I=hs(T.scrollTarget??T.spotlightTarget??T.target);if(f1({isFirstStep:x.current.index===0,scrollToFirstStep:k.current.scrollToFirstStep,step:T,target:I,targetLifecycle:Be.TOOLTIP})){c.current.updateState({scrolling:!0,positioned:!1});return}}const F=f===Be.BEACON_BEFORE||f===Be.TOOLTIP_BEFORE;if(T&&F&&!h){const I=f===Be.TOOLTIP_BEFORE?Be.TOOLTIP:Be.BEACON;c.current.updateState({action:_t.UPDATE,lifecycle:I})}T&&D("lifecycle",Be.BEACON)&&r(qn.BEACON,T),T&&D("lifecycle",Be.TOOLTIP)&&r(qn.TOOLTIP,T);const M=x.current;if((M.status===Nt.RUNNING||M.controlled&&M.status===Nt.PAUSED&&T)&&V&&D("lifecycle",Be.COMPLETE)&&R.lifecycle===Be.TOOLTIP&&(r(qn.STEP_AFTER,V,{action:g.current??_t.UPDATE,index:R.index??M.index,lifecycle:M.lifecycle}),V.after)){r(qn.STEP_AFTER_HOOK,V,{action:g.current??_t.UPDATE,index:R.index??M.index,lifecycle:M.lifecycle});try{V.after({...c.current.getState(),action:g.current??_t.UPDATE,index:R.index??M.index,lifecycle:M.lifecycle,step:V})}catch{}}},[r,f,d,h,c]),m.useEffect(()=>{if(!S.current)return;const{hasChangedTo:D,previous:R}=io(x.current,S.current),T=C.current,V=j.current;y&&!T&&f===Be.INIT&&c.current.updateState({action:_t.UPDATE,lifecycle:Be.COMPLETE,status:Nt.FINISHED}),!x.current.controlled&&w===Nt.RUNNING&&D("lifecycle",Be.COMPLETE)&&p<y&&c.current.updateState({action:_t.UPDATE,lifecycle:Be.INIT}),D("lifecycle",Be.COMPLETE)&&p>=y&&c.current.updateState({action:_t.UPDATE,lifecycle:Be.COMPLETE,status:Nt.FINISHED});const F=T??V??Db(k.current,k.current.steps[p-1]);if(F&&D("status",[Nt.FINISHED,Nt.SKIPPED])){let M;T?M=p:V?M=R.index??p:M=p-1,r(qn.TOUR_END,F,{index:M}),x.current.controlled||E.current.reset(),g.current=null}T&&D("action",_t.STOP)&&(g.current=null,r(qn.TOUR_STATUS,T)),T&&D("action",_t.RESET)&&(r(qn.TOUR_STATUS,T),g.current=null)},[u,r,p,f,y,w,c])}function Kre({controls:e,emitEvent:t,props:n,state:r,store:s}){const{debug:i,initialStepIndex:a,run:l,stepIndex:c,steps:u}=n,p=m.useRef(void 0),f=m.useRef(r),d=m.useRef(e);f.current=r,d.current=e,m.useEffect(()=>{const h=p.current;if(p.current=n,!h||n===h)return;const{hasChanged:y}=io(n,h);if(_b(h.steps,u)||(rT(u,i)?s.current.setSteps(u):(Gn(i,"tour","Steps are not valid",u),t(qn.ERROR,u[0]??{target:"",content:""},{error:new Error("Steps are not valid")}))),y("run"))l?s.current.getState().size&&d.current.start(c??a):d.current.stop();else if(fr.number(c)&&y("stepIndex")){const w=fr.number(h.stepIndex)&&h.stepIndex<c?_t.NEXT:_t.PREV;[Nt.FINISHED,Nt.SKIPPED].includes(f.current.status)||s.current.updateState({action:w,index:c,lifecycle:Be.INIT,positioned:!1},!0)}},[i,t,a,n,l,c,u,s])}function Ure(e,t){var l,c,u,p;const{beaconPosition:n,lifecycle:r,scrollOffset:s,step:i}=t;if(i.scrollTarget||i.spotlightTarget)return Math.max(0,e);let a=e-i.spotlightPadding.top;if(r===Be.BEACON_BEFORE&&(n!=null&&n.placement)){const f=qre(n);["bottom"].includes(n.placement)||(a+=Math.floor(f-s))}else if(r===Be.TOOLTIP_BEFORE){const{placement:f}=i;if(f==="top"){const d=((l=document.querySelector(".react-joyride__floater"))==null?void 0:l.getBoundingClientRect().height)??0,h=(c=i.floatingOptions)!=null&&c.hideArrow?0:i.arrowSize,y=i.offset+i.spotlightPadding.top+h;a-=d+y}else if(f==="left"||f==="right"){const d=((u=document.querySelector(".react-joyride__floater"))==null?void 0:u.getBoundingClientRect().height)??0,h=((p=hs(i.target))==null?void 0:p.getBoundingClientRect().height)??0,y=s+i.spotlightPadding.top+h/2-d/2;y<s&&(a-=s-y)}}return Math.max(0,a)}function qre(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 Yre({emitEvent:e,previousState:t,props:n,state:r,step:s,store:i}){const{index:a,lifecycle:l,positioned:c,scrolling:u,status:p}=r,f=m.useRef(null),d=m.useRef(r),h=m.useRef(t),y=m.useRef(n),w=m.useRef(s);d.current=r,h.current=t,y.current=n,w.current=s,m.useEffect(()=>()=>{var b;(b=f.current)==null||b.call(f)},[]),m.useEffect(()=>{var C;if(!h.current||!w.current)return;const{hasChangedTo:b}=io(d.current,h.current),g=w.current,{debug:k}=y.current,{scrollDuration:x}=g,S=l===Be.BEACON_BEFORE||l===Be.TOOLTIP_BEFORE;if(p===Nt.RUNNING&&S&&u&&b("positioned",!0)){const j=hs(g.scrollTarget??g.spotlightTarget??g.target),E=i.current.getPositionData("beacon"),A=tc(j),O=A?!A.isSameNode(Lr()):!1;(C=f.current)==null||C.call(f),(async()=>{if(O&&!nc(A)){const M=Lr(),I=Pre(A),B={initial:M.scrollTop,target:I,element:M,duration:x};e(qn.SCROLL_START,g,{scroll:B});const{cancel:_,promise:q}=p1(I,{element:M,duration:x});f.current=_,await q,e(qn.SCROLL_END,g,{scroll:B})}const H=Math.floor(Ire(j,g.scrollOffset))||0,D=O?H:Ure(H,{beaconPosition:E,lifecycle:l,scrollOffset:g.scrollOffset,step:g});Gn(k,`step:${a}`,"scroll",O?"custom":"document",`${H} → ${D}`);const R=A,T={initial:R.scrollTop,target:D,element:R,duration:x};e(qn.SCROLL_START,g,{scroll:T});const{cancel:V,promise:F}=p1(D,{element:R,duration:x});f.current=V,await F,e(qn.SCROLL_END,g,{scroll:T}),i.current.updateState({scrolling:!1})})().catch(()=>{i.current.updateState({scrolling:!1})})}},[e,a,l,c,u,p,i])}function Gre(e){const t=Ite(()=>Cre(Sre,e),[e]),{debug:n,initialStepIndex:r,onEvent:s,run:i,stepIndex:a,steps:l}=t,c=m.useRef(Fre(t)),u=sA.useSyncExternalStore(c.current.subscribe,c.current.getSnapshot,c.current.getServerSnapshot),[p,f]=m.useState([]),d=m.useCallback((C,j)=>{f(E=>[...E,{reason:j,step:C}])},[]),h=m.useCallback(()=>{f([])},[]);Hre(c,n);const y=zre(c,n,h),w=Wre(s,y,c),{index:b,size:g,status:k}=u,x=II(u),S=m.useMemo(()=>Db(t,l[b]),[b,t,l]);return Tte(()=>{i&&g&&rT(l,n)&&y.start(a??r)}),Pte(()=>{i&&g&&k===Nt.IDLE&&c.current.updateState({status:Nt.READY})},[i,g,k]),Kre({controls:y,emitEvent:w,props:t,state:u,store:c}),Vre({addFailure:d,controls:y,emitEvent:w,previousState:x,props:t,state:u,step:S,store:c}),Yre({emitEvent:w,previousState:x,props:t,state:u,step:S,store:c}),{controls:y,failures:p,mergedProps:t,state:u,step:S,store:c}}function Jre(e){const[t,n]=m.useState(null);return m.useEffect(()=>{let r=null,s=!1;if(e)if(fr.domElement(e))r=e,s=!0;else{const i=document.querySelector(e);i&&(r=i)}else{const i=document.createElement("div");i.id=Nre,document.body.appendChild(i),r=i}return n(r),()=>{!r||s||r.parentNode===document.body&&document.body.removeChild(r)}},[e]),t}const Xre={animation:"joyride-loader-spin 1s linear infinite",border:"5px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",borderTopColor:"#555"};function Qre({nonce:e,step:t}){const{loaderComponent:n}=t,r=!!n;if(m.useEffect(()=>{if(r||document.getElementById("joyride-loader-animation"))return Yu;const c=document.createElement("style");return c.id="joyride-loader-animation",e&&c.setAttribute("nonce",e),c.appendChild(document.createTextNode(`
|
|
312
|
-
@keyframes joyride-loader-spin {
|
|
313
|
-
to { transform: rotate(360deg); }
|
|
314
|
-
}
|
|
315
|
-
`)),document.head.appendChild(c),()=>{const u=document.getElementById("joyride-loader-animation");u!=null&&u.parentNode&&u.parentNode.removeChild(u)}},[r,e]),n===null)return null;const{height:s,width:i,...a}=t.styles.loader;let l;if(n){const c=n;l=it.createElement(c,{step:t})}else l=it.createElement("div",{style:{...Xre,height:s,width:i,borderTopColor:t.primaryColor}});return it.createElement("div",{className:"react-joyride__loader","data-testid":"loader",style:a},l)}const Zre={height:0,isFixed:!1,left:0,top:0,width:0};function Mc(e,t){const n=hs(e);if(!n)return Zre;const r=Ob(n),s=nc(n),i=Are(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 ese(e,t,n){const[r,s]=m.useState(()=>Mc(e,t)),i=m.useRef(void 0),a=m.useRef(null),l=m.useRef(n),c=m.useRef(null),u=m.useCallback(()=>{clearTimeout(i.current),i.current=window.setTimeout(()=>{s(f=>{const d=Mc(e,t);return f.top===d.top&&f.left===d.left&&f.width===d.width&&f.height===d.height&&f.isFixed===d.isFixed?f:d})},100)},[e,t]);m.useEffect(()=>{let f=null;const d=y=>{a.current=tc(y,!0),a.current&&a.current.addEventListener("scroll",u,{passive:!0}),window.addEventListener("scroll",u,{passive:!0}),window.addEventListener("resize",u),typeof ResizeObserver<"u"&&(c.current=new ResizeObserver(u),c.current.observe(y)),s(Mc(e,t))},h=hs(e);return h?d(h):(f=new MutationObserver(()=>{const y=hs(e);y&&(f==null||f.disconnect(),f=null,d(y))}),f.observe(document.body,{childList:!0,subtree:!0})),()=>{var y;f==null||f.disconnect(),a.current&&a.current.removeEventListener("scroll",u),window.removeEventListener("scroll",u),window.removeEventListener("resize",u),(y=c.current)==null||y.disconnect(),clearTimeout(i.current)}},[e,t,u]),m.useEffect(()=>{l.current&&!n&&s(Mc(e,t)),l.current=n},[n,e,t]);let p=r;return l.current&&!n&&(p=Mc(e,t)),p}function tse(e,t,n){let r=`M0 0H${e}V${t}H0Z`;return n&&(r+=` ${n}`),r}function m1(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 nse=[Be.BEACON_BEFORE,Be.BEACON];function rse(e){var F,M;const{blockTargetInteraction:t,continuous:n,hideOverlay:r,lifecycle:s,onClickOverlay:i,overlayClickAction:a,placement:l,portalElement:c,scrolling:u,spotlightPadding:p,spotlightRadius:f,spotlightTarget:d,styles:h,target:y,waiting:w}=e,b=Rte(),g=ese(d??y,p,u||w),k=m.useRef(null),x=(s===Be.TOOLTIP||s===Be.TOOLTIP_BEFORE)&&l!=="center",[S,C]=m.useState(!1),j=c?(F=k.current)==null?void 0:F.offsetParent:null,E=(j==null?void 0:j.clientWidth)??b.width,A=(j==null?void 0:j.clientHeight)??Ere()??b.height,O=((M=h.overlay)==null?void 0:M.backgroundColor)??"rgba(0, 0, 0, 0.5)",W=m.useMemo(()=>{const{backgroundColor:I,mixBlendMode:B,..._}=h.overlay;return{height:A,pointerEvents:"none",..._}},[A,h.overlay]),H=x&&!u&&!w;m.useEffect(()=>{H?requestAnimationFrame(()=>C(!0)):C(!1)},[H]);const D=n&&nse.includes(s),R=!n&&s!==Be.TOOLTIP;if(r||!w&&(D||R))return null;let T="";if(H)if(c&&j){const I=hs(d??y);if(I){const B=d1(I),_=d1(j);T=m1(B.left-_.left-p.left,B.top-_.top-p.top,I.offsetWidth+p.left+p.right,I.offsetHeight+p.top+p.bottom,f)}}else T=m1(g.left,g.top,g.width,g.height,f);const V=tse(E,A,T);return it.createElement("div",{ref:k,"aria-hidden":"true",className:"react-joyride__overlay","data-testid":"overlay",style:W},it.createElement("svg",{className:"react-joyride__spotlight","data-testid":"spotlight",style:{height:A,left:0,position:g.isFixed?"fixed":"absolute",top:0,width:E}},it.createElement("path",{d:V,fill:O,fillRule:"evenodd",onClick:i,style:{cursor:a?"pointer":"default",pointerEvents:"auto"}}),T&&it.createElement("path",{d:T,fill:O,style:{opacity:S?0:1,pointerEvents:t?"auto":"none",transition:"opacity 0.2s"}}),T&&Object.keys(h.spotlight).length>0&&it.createElement("path",{d:T,fill:"none",style:{pointerEvents:"none"},...h.spotlight})))}function sT(e){const{children:t,element:n}=e;return n?Sr.createPortal(t,n):null}const sse='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), area[href], [tabindex]:not([tabindex="-1"]), [contenteditable]';function ise(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!e)return Yu;n.current=document.activeElement;const r=i=>{if(i.key!=="Tab")return;const a=[...e.querySelectorAll(sse)],{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 Ei(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 ose(e,t,n){const[r]=e.split("-");switch(r){case"top":return{points:`0,0 ${t/2},${n} ${t},0`,...Ei(e,t,n)};case"bottom":return{points:`${t},${n} ${t/2},0 0,${n}`,...Ei(e,t,n)};case"left":return{points:`0,0 ${n},${t/2} 0,${t}`,...Ei(e,t,n)};case"right":return{points:`${n},${t} ${n},0 0,${t/2}`,...Ei(e,t,n)};default:return null}}function ase(e,t,n,r){if(!t)return{};const[s]=e.split("-");switch(s){case"top":return{bottom:-n,left:t.x??0,...Ei(e,r,n)};case"bottom":return{top:-n,left:t.x??0,...Ei(e,r,n)};case"left":return{right:-n,top:t.y??0,...Ei(e,r,n)};case"right":return{left:-n,top:t.y??0,...Ei(e,r,n)};default:return{}}}function lse({arrowComponent:e,arrowRef:t,base:n,placement:r,position:s,size:i,styles:a}){const l=e;let c=null;if(l){if(!Ei(r,n,i))return null;c=it.createElement("span",{style:{flexShrink:0}},it.createElement(l,{base:n,placement:r,size:i}))}else{const u=ose(r,n,i);if(!u)return null;c=it.createElement("svg",{height:u.height,width:u.width,xmlns:"http://www.w3.org/2000/svg"},it.createElement("polygon",{fill:"currentColor",points:u.points}))}return it.createElement("span",{ref:t,className:"react-joyride__arrow","data-testid":"arrow",style:{...a,...ase(r,s,i,n),...s?{}:{visibility:"hidden"}}},c)}function cse(e){const{beaconComponent:t,continuous:n,index:r,isLastStep:s,locale:i,nonce:a,onInteract:l,shouldFocus:c,size:u,step:p,styles:f}=e,d=m.useRef(null),h=!!t;m.useEffect(()=>{if(h||document.getElementById("joyride-beacon-animation"))return Yu;const b=document.createElement("style");b.id="joyride-beacon-animation",a&&b.setAttribute("nonce",a),b.appendChild(document.createTextNode(`
|
|
316
|
-
@keyframes joyride-beacon-inner {
|
|
317
|
-
20% {
|
|
318
|
-
opacity: 0.9;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
90% {
|
|
322
|
-
opacity: 0.7;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
@keyframes joyride-beacon-outer {
|
|
327
|
-
0% {
|
|
328
|
-
transform: scale(1);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
45% {
|
|
332
|
-
opacity: 0.7;
|
|
333
|
-
transform: scale(0.75);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
100% {
|
|
337
|
-
opacity: 0.9;
|
|
338
|
-
transform: scale(1);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
`)),document.head.appendChild(b);const g=setTimeout(()=>{fr.domElement(d.current)&&c&&d.current.focus()},0);return()=>{clearTimeout(g);const k=document.getElementById("joyride-beacon-animation");k!=null&&k.parentNode&&k.parentNode.removeChild(k)}},[h,a,c]);const y=Si(i.open);let w;if(t){const b=t;w=it.createElement(b,{continuous:n,index:r,isLastStep:s,size:u,step:p})}else w=it.createElement("span",{style:f.beacon},it.createElement("span",{style:f.beaconOuter}),it.createElement("span",{style:f.beaconInner}));return it.createElement("button",{ref:d,"aria-label":y,className:"react-joyride__beacon","data-testid":"button-beacon",onClick:l,onMouseEnter:l,style:f.beaconWrapper,title:y,type:"button"},w)}function use({styles:e,...t}){const{color:n,height:r,width:s,...i}=e;return it.createElement("button",{style:i,type:"button",...t},it.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"},it.createElement("g",null,it.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 dse(e){const{backProps:t,closeProps:n,index:r,isLastStep:s,primaryProps:i,skipProps:a,step:l,tooltipProps:c}=e,{buttons:u,content:p,styles:f,title:d}=l,h={};u.includes("primary")&&(h.primary=it.createElement("button",{"data-testid":"button-primary",style:f.buttonPrimary,type:"button",...i})),u.includes("skip")&&!s&&(h.skip=it.createElement("button",{"aria-live":"off","data-testid":"button-skip",style:f.buttonSkip,type:"button",...a})),u.includes("back")&&r>0&&(h.back=it.createElement("button",{"data-testid":"button-back",style:f.buttonBack,type:"button",...t})),h.close=u.includes("close")&&it.createElement(use,{"data-testid":"button-close",styles:f.buttonClose,...n});const y=d?{"aria-labelledby":"joyride-tooltip-title","aria-describedby":"joyride-tooltip-content"}:{"aria-label":Si(p),"aria-describedby":"joyride-tooltip-content"};return it.createElement("div",{key:"JoyrideTooltip",className:"react-joyride__tooltip","data-joyride-step":r,...l.id&&{"data-joyride-id":l.id},style:f.tooltip,...c,...y},it.createElement("div",{style:f.tooltipContainer},d&&it.createElement("h4",{id:"joyride-tooltip-title",style:f.tooltipTitle},d),it.createElement("div",{id:"joyride-tooltip-content",style:f.tooltipContent},p)),u.some(w=>w==="back"||w==="primary"||w==="skip")&&it.createElement("div",{style:f.tooltipFooter},it.createElement("div",{style:f.tooltipFooterSpacer},h.skip),h.back,h.primary),h.close)}function fse(e){const{continuous:t,controls:n,index:r,isLastStep:s,size:i,step:a}=e,l=g=>{g.preventDefault(),n.prev(Gs.BUTTON_BACK)},c=g=>{g.preventDefault(),a.closeButtonAction==="skip"?n.skip(Gs.BUTTON_CLOSE):n.close(Gs.BUTTON_CLOSE)},u=g=>{if(g.preventDefault(),!t){n.close(Gs.BUTTON_PRIMARY);return}n.next(Gs.BUTTON_PRIMARY)},p=g=>{g.preventDefault(),n.skip(Gs.BUTTON_SKIP)},f=()=>{const{back:g,close:k,last:x,next:S,nextWithProgress:C,skip:j}=a.locale,E=Si(g),A=Si(k),O=Si(x),W=Si(S),H=Si(j);let D=k,R=A;if(t){if(D=S,R=W,a.showProgress&&!s){const T=Si(C,{step:r+1,steps:i});D=Mx(C,r+1,i),R=T}s&&(D=x,R=O)}return{backProps:{"aria-label":E,children:g,"data-action":"back",onClick:l,role:"button",title:E},closeProps:{"aria-label":A,children:k,"data-action":"close",onClick:c,role:"button",title:A},primaryProps:{"aria-label":R,children:D,"data-action":"primary",onClick:u,role:"button",title:R},skipProps:{"aria-label":H,children:j,"data-action":"skip",onClick:p,role:"button",title:H},tooltipProps:{"aria-modal":!0,role:"alertdialog"}}},{arrowComponent:d,beaconComponent:h,tooltipComponent:y,...w}=a;let b;if(y){const g=y;b=it.createElement(g,{...f(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:w})}else b=it.createElement(dse,{...f(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:w});return b}function pse(e){if(e.startsWith("left"))return["top","bottom"];if(e.startsWith("right"))return["bottom","top"]}function hse(e,t,n){var r,s;return e?[xre()]:((r=t.floatingOptions)==null?void 0:r.flipOptions)===!1?[]:[yre({crossAxis:!1,fallbackPlacements:pse(n),padding:20,...(s=t.floatingOptions)==null?void 0:s.flipOptions})]}function mse(e){var B,_,q,z,$;const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:a,portalElement:l,setPositionData:c,setTooltipRef:u,shouldScroll:p,size:f,step:d,target:h,updateState:y}=e,w=m.useRef(null),b=m.useRef({}),g=m.useRef({}),k=d.placement==="center",x=d.placement==="auto",S=m.useMemo(()=>({getBoundingClientRect:()=>({x:window.innerWidth/2,y:window.innerHeight/2,top:window.innerHeight/2,left:window.innerWidth/2,bottom:window.innerHeight/2,right:window.innerWidth/2,width:0,height:0})}),[]),C=m.useMemo(()=>eT(h)?tc(h):void 0,[h]),j=m.useMemo(()=>nc(h),[h]),E=m.useMemo(()=>C?{boundary:C,rootBoundary:"viewport"}:{},[C]),A=k||x?"bottom":d.placement,O=k?"fixed":((B=d.floatingOptions)==null?void 0:B.strategy)??(d.isFixed||j?"fixed":"absolute"),W=m.useMemo(()=>{var Q,te,ie,he;return k?[{name:"center",fn:({rects:ne})=>({x:(window.innerWidth-ne.floating.width)/2,y:(window.innerHeight-ne.floating.height)/2})}]:[l1(({placement:ne})=>{var le;let ce="right";ne.startsWith("top")?ce="top":ne.startsWith("bottom")?ce="bottom":ne.startsWith("left")&&(ce="left");const re=d.spotlightTarget?0:d.spotlightPadding[ce];return d.offset+re+((le=d.floatingOptions)!=null&&le.hideArrow?0:d.arrowSize)},[d.offset,d.spotlightPadding,d.spotlightTarget,d.arrowSize,(Q=d.floatingOptions)==null?void 0:Q.hideArrow]),...hse(x,d,A),gre({padding:10,...E,...(te=d.floatingOptions)==null?void 0:te.shiftOptions}),...(ie=d.floatingOptions)!=null&&ie.hideArrow?[]:[wre({element:w,padding:d.arrowSpacing},[d.arrowSpacing,d.arrowBase])],...((he=d.floatingOptions)==null?void 0:he.middleware)??[]]},[k,d,x,A,E]),H=a1({...k?{elements:{reference:S}}:{},placement:A,strategy:O,middleware:W}),D=a1({strategy:O,placement:d.beaconPlacement??(x||k?"bottom":d.placement),middleware:m.useMemo(()=>{var Q,te;return[l1(((te=(Q=d.floatingOptions)==null?void 0:Q.beaconOptions)==null?void 0:te.offset)??-18)]},[(q=(_=d.floatingOptions)==null?void 0:_.beaconOptions)==null?void 0:q.offset]),whileElementsMounted:s1});g.current=H.middlewareData,b.current=D.middlewareData,m.useEffect(()=>{var ie;const{floating:Q,reference:te}=H.elements;if(!(!te||!Q||s!==Be.TOOLTIP))return s1(te,Q,H.update,(ie=d.floatingOptions)==null?void 0:ie.autoUpdate)},[s,H.update,(z=d.floatingOptions)==null?void 0:z.autoUpdate,d.target,H.elements]),m.useEffect(()=>{!k&&h&&H.refs.setReference(h),h&&D.refs.setReference(h)},[D.refs,k,h,H.refs]),m.useEffect(()=>{H.isPositioned&&c("tooltip",{placement:H.placement,x:H.x??0,y:H.y??0,middlewareData:g.current})},[c,H.isPositioned,H.placement,H.x,H.y]),m.useEffect(()=>{D.isPositioned&&c("beacon",{placement:D.placement,x:D.x??0,y:D.y??0,middlewareData:b.current})},[c,D.isPositioned,D.placement,D.x,D.y]);const R=d.zIndex+100,T=m.useCallback(Q=>{Q.type==="mouseenter"&&d.beaconTrigger!=="hover"||y({lifecycle:Be.TOOLTIP_BEFORE,positioned:!1})},[d.beaconTrigger,y]),V=m.useCallback(Q=>{Q&&(H.refs.setFloating(Q),u(Q))},[H.refs,u]),{arrow:F,floater:M}=d.styles;let I=null;if(s===Be.TOOLTIP||s===Be.TOOLTIP_BEFORE){const Q=u1({...M,...H.floatingStyles,zIndex:R,opacity:a&&H.isPositioned?1:0,...!a&&{transition:"none"}});I=it.createElement("div",{ref:V,className:"react-joyride__floater","data-testid":"floater",id:`react-joyride-step-${r}`,style:Q},it.createElement(fse,{continuous:t,controls:n,index:r,isLastStep:r+1===f,size:f,step:d}),!k&&!(($=d.floatingOptions)!=null&&$.hideArrow)&&it.createElement(lse,{arrowComponent:d.arrowComponent,arrowRef:w,base:d.arrowBase,placement:H.placement,position:H.middlewareData.arrow,size:d.arrowSize,styles:F}))}else(s===Be.BEACON||s===Be.BEACON_BEFORE)&&(I=it.createElement("div",{ref:D.refs.setFloating,className:"react-joyride__floater","data-testid":"floater-beacon",id:`react-joyride-step-${r}-beacon`,style:u1({...D.floatingStyles,zIndex:R})},it.createElement(cse,{beaconComponent:d.beaconComponent,continuous:t,index:r,isLastStep:r+1===f,locale:d.locale,nonce:i,onInteract:T,shouldFocus:p,size:f,step:d,styles:d.styles})));return it.createElement(sT,{element:l},I)}function gse(e){const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,portalElement:a,setPositionData:l,shouldScroll:c,size:u,step:p,updateState:f}=e,[d,h]=m.useState(null);ise(p.disableFocusTrap?null:d,"[data-action=primary]");const y=hs(p.target),w=s===Be.TOOLTIP;return!nT(p)||!fr.domElement(y)?null:it.createElement(mse,{key:`JoyrideStep-${r}`,continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:w,portalElement:a,setPositionData:l,setTooltipRef:h,shouldScroll:c,size:u,step:p,target:y,updateState:f})}function yse({controls:e,mergedProps:t,state:n,step:r,store:s}){const{continuous:i,debug:a,nonce:l,portalElement:c,scrollToFirstStep:u}=t,p=Jre(c),{index:f,lifecycle:d,status:h}=n,y=h===Nt.RUNNING,[w,b]=m.useState(!1),g=m.useRef(null),k=(r==null?void 0:r.loaderDelay)??0;m.useEffect(()=>(n.waiting?k===0?b(!0):g.current=setTimeout(()=>{b(!0)},k):b(!1),()=>{g.current&&(clearTimeout(g.current),g.current=null)}),[k,n.waiting]),m.useEffect(()=>{if(!y)return;const C=j=>{!r||d!==Be.TOOLTIP||j.key==="Escape"&&r.dismissKeyAction&&(r.dismissKeyAction==="next"?e.next(Gs.KEYBOARD):e.close(Gs.KEYBOARD))};return document.body.addEventListener("keydown",C,{passive:!0}),()=>{document.body.removeEventListener("keydown",C)}},[e,y,d,r]);const x=m.useCallback(()=>{(r==null?void 0:r.overlayClickAction)==="close"?e.close(Gs.OVERLAY):(r==null?void 0:r.overlayClickAction)==="next"&&e.next(Gs.OVERLAY)},[e,r==null?void 0:r.overlayClickAction]);if(!r||!y)return null;const S=n.action===_t.START&&!r.skipBeacon&&r.placement!=="center";return it.createElement(it.Fragment,null,d!==Be.INIT&&it.createElement(gse,{...n,continuous:i,controls:e,debug:a,nonce:l,portalElement:p,setPositionData:s.current.setPositionData,shouldScroll:!r.skipScroll&&(f!==0||u),step:r,updateState:s.current.updateState}),it.createElement(sT,{element:p},it.createElement(it.Fragment,null,w&&it.createElement(Qre,{nonce:l,step:r}),!S&&it.createElement(rse,{...r,continuous:i,lifecycle:d,onClickOverlay:x,portalElement:c?p:null,scrolling:n.scrolling,waiting:n.waiting}))))}function xse(e){const{controls:t,failures:n,mergedProps:r,state:s,step:i,store:a}=Gre(e);return{controls:t,failures:n,on:m.useCallback((l,c)=>a.current.on(l,c),[a]),state:m.useMemo(()=>sh(s,"positioned"),[s]),step:i,Tour:Lb()?it.createElement(yse,{controls:t,mergedProps:r,state:s,step:i,store:a}):null}}function wse(e){const{Tour:t}=xse(e);return t}function bse(e){return Lb()?it.createElement(wse,e):null}function kse(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 vse(e){return[{target:"body",content:e("onboarding:flow.intro"),disableBeacon:!0,placement:"center"}]}function Sse(e){return[{target:"body",content:e("onboarding:flow.introEmpty"),disableBeacon:!0,placement:"center"}]}const Rf="af:onboarding";function Nse({page:e,hasNodes:t=!1}){const{t:n}=_r(),[r,s]=m.useState(!1),[i,a]=m.useState([]),l=m.useRef(null),c=m.useMemo(()=>e==="projects"?kse(n):t?vse(n):Sse(n),[e,t,n]);return m.useEffect(()=>{const u=localStorage.getItem(Rf),p=u?JSON.parse(u):{};if(p.completed||p[e]){s(!1),a([]);return}localStorage.setItem(Rf,JSON.stringify({...p,[e]:!0})),a(c),s(!0)},[e,t,c]),m.useEffect(()=>{if(!r)return;const u=p=>{var y;const f=p.target.closest("button");if(!f||!f.closest(".react-joyride__tooltip"))return;const h=(y=f.textContent)==null?void 0:y.trim();if(h===n("onboarding:done")||h===n("onboarding:startCreate")||h===n("onboarding:skip")){const w=localStorage.getItem(Rf)||"{}",b=JSON.parse(w);h===n("onboarding:skip")?(b.projects=!0,b.flow=!0,b.completed=!0):b[e]=!0,localStorage.setItem(Rf,JSON.stringify(b)),a([]),s(!1),e==="projects"&&(h===n("onboarding:done")||h===n("onboarding:startCreate"))&&(localStorage.setItem("af:newPipelineGuide","true"),setTimeout(()=>{const g=document.querySelector(".af-create-btn");g&&g.click()},500))}};return document.addEventListener("click",u,!0),()=>document.removeEventListener("click",u,!0)},[r,e,n]),!r||i.length===0?null:o.jsx(bse,{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 jse(){const{navigate:e,path:t}=li(),[n,r]=m.useState([]),[s,i]=m.useState(!1);if(m.useEffect(()=>{let p=!1;const f=async()=>{try{const h=await fetch("/api/pipeline-recent-runs");if(!h.ok)return;const y=await h.json();if(p)return;const w=Array.isArray(y.runs)?y.runs:[];r(w.filter(b=>b&&b.status==="running"))}catch{}};f();const d=window.setInterval(f,3e3);return()=>{p=!0,window.clearInterval(d)}},[]),n.length===0)return null;const a=p=>{const f=new URLSearchParams({flowId:p.flowId,flowSource:p.flowSource||"workspace"});e(`/flow?${f.toString()}`),i(!1)},l=t==="/flow"?new URLSearchParams(window.location.search):null,c=(l==null?void 0:l.get("flowId"))||"",u=n.length===1;return o.jsxs("div",{className:"af-run-indicator",role:"status","aria-live":"polite",children:[s&&!u&&o.jsx("div",{className:"af-run-indicator__menu",onMouseLeave:()=>i(!1),children:n.map(p=>o.jsxs("button",{type:"button",className:"af-run-indicator__item"+(p.flowId===c?" af-run-indicator__item--current":""),onClick:()=>a(p),title:`${p.flowId} · ${p.runId}`,children:[o.jsx("span",{className:"af-run-indicator__dot"}),o.jsx("span",{className:"af-run-indicator__flow",children:p.flowId}),o.jsx("span",{className:"af-run-indicator__run",children:p.runId.slice(0,12)})]},`${p.flowId}:${p.runId}`))}),o.jsxs("button",{type:"button",className:"af-run-indicator__btn",onClick:()=>u?a(n[0]):i(p=>!p),title:u?`${n[0].flowId} 运行中,点击跳转`:`${n.length} 个 pipeline 运行中`,children:[o.jsx("span",{className:"af-run-indicator__pulse"}),o.jsx("span",{className:"af-run-indicator__label",children:u?n[0].flowId:`${n.length} running`})]})]})}function iT(e){return e==="/likee-context"||e==="/likee_context"}function Cse(){const{navigate:e}=li();return m.useEffect(()=>{const t=new URLSearchParams(window.location.search),n=new URLSearchParams,r=t.get("flowId")||"",s=t.get("flowSource")||"";r&&n.set("flowId",r),s&&n.set("flowSource",s),t.get("flowArchived")&&n.set("archived",t.get("flowArchived")),e(`/workspace${n.toString()?`?${n.toString()}`:""}`)},[e]),null}class _se extends m.Component{constructor(t){super(t),this.state={error:null,info:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){console.error("[AgentFlow UI render error]",t,n),this.setState({error:t,info:n})}render(){var r,s,i;if(!this.state.error)return this.props.children;const t=String(((r=this.state.error)==null?void 0:r.stack)||((s=this.state.error)==null?void 0:s.message)||this.state.error),n=String(((i=this.state.info)==null?void 0:i.componentStack)||"");return o.jsx("div",{className:"af-auth-screen",children:o.jsxs("div",{className:"af-auth-panel af-ui-error-panel",children:[o.jsxs("div",{className:"af-auth-brand",children:[o.jsx("span",{className:"material-symbols-outlined",children:"error"}),o.jsxs("div",{children:[o.jsx("h1",{children:"AgentFlow UI Error"}),o.jsx("p",{children:"页面渲染失败,下面是调试堆栈。"})]})]}),o.jsx("pre",{children:t}),n?o.jsx("pre",{children:n}):null]})})}}function Ese({authUser:e}){const{path:t}=li();return t==="/projects"||t==="/"?o.jsx(Ha,{authUser:e}):t==="/nodes"?o.jsx(Ha,{authUser:e,resourceKind:"nodes"}):t==="/my-nodes"?o.jsx(Ha,{authUser:e,resourceKind:"my-nodes"}):t==="/my-flows"?o.jsx(Ha,{authUser:e,resourceKind:"my-flows"}):t==="/skills"?o.jsx(Ha,{authUser:e,resourceKind:"skills"}):t==="/workspaces"?o.jsx(lte,{authUser:e}):t==="/mcps"?o.jsx(Xee,{}):t==="/schedules"?o.jsx(ete,{}):t==="/node-studio"?o.jsx(nte,{}):t==="/flow"?o.jsx(Cse,{}):t==="/workspace"?o.jsx(pU,{}):t.startsWith("/display")?o.jsx(xI,{}):t==="/settings"?o.jsx(Bee,{authUser:e}):t==="/admin/usage"?o.jsx(Kee,{authUser:e}):t==="/feedback"?o.jsx(qee,{authUser:e}):iT(t)?o.jsx(AI,{}):o.jsx(Ha,{})}function Ase({children:e}){const[t,n]=m.useState({loading:!0,authenticated:!1,user:null,setupRequired:!1}),[r,s]=m.useState(""),[i,a]=m.useState(""),[l,c]=m.useState(!1),[u,p]=m.useState(""),f=async()=>{try{const y=await(await fetch("/api/auth/me")).json().catch(()=>({}));n({loading:!1,authenticated:!!y.authenticated,user:y.user||null,setupRequired:!!y.setupRequired}),p(y.error?String(y.error):"")}catch(h){n({loading:!1,authenticated:!1,user:null,setupRequired:!1}),p(String(h.message||h))}};m.useEffect(()=>{f()},[]);const d=async h=>{h.preventDefault(),c(!0),p("");try{const y=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,password:i})}),w=await y.json().catch(()=>({}));if(!y.ok)throw new Error(w.error||"登录失败");n({loading:!1,authenticated:!0,user:w.user||null,setupRequired:!1})}catch(y){p(String(y.message||y))}finally{c(!1)}};return t.loading?o.jsx("div",{className:"af-auth-screen",children:o.jsx("div",{className:"af-auth-panel",children:"Loading..."})}):t.authenticated?e({user:t.user,onLogout:async()=>{await fetch("/api/auth/logout",{method:"POST"}).catch(()=>{}),n({loading:!1,authenticated:!1,user:null,setupRequired:!1})}}):o.jsx("div",{className:"af-auth-screen",children:o.jsxs("form",{className:"af-auth-panel",onSubmit:d,children:[o.jsxs("div",{className:"af-auth-brand",children:[o.jsx("span",{className:"material-symbols-outlined",children:"account_circle"}),o.jsxs("div",{children:[o.jsx("h1",{children:"AgentFlow"}),o.jsx("p",{children:t.setupRequired?"初始化管理员账号":"登录或创建用户"})]})]}),o.jsxs("label",{className:"af-auth-field",children:[o.jsx("span",{children:"用户名"}),o.jsx("input",{value:r,onChange:h=>s(h.target.value),autoComplete:"username",autoFocus:!0})]}),o.jsxs("label",{className:"af-auth-field",children:[o.jsx("span",{children:"密码"}),o.jsx("input",{type:"password",value:i,onChange:h=>a(h.target.value),autoComplete:t.setupRequired?"new-password":"current-password"})]}),u?o.jsx("p",{className:"af-auth-error",children:u}):null,o.jsx("button",{className:"af-auth-submit",type:"submit",disabled:l||!r.trim()||i.length<4,children:l?"处理中...":t.setupRequired?"创建并登录":"登录"})]})})}function Pse({authUser:e,onLogout:t}){const{path:n}=li(),r=n==="/flow"||n==="/workspace";return o.jsxs("div",{className:"af-app",children:[n!=="/settings"?o.jsx(Nse,{page:r?"flow":"projects"}):null,r?null:o.jsx(p$,{authUser:e,onLogout:t}),o.jsx("div",{className:r?"af-main af-main--pipeline":"af-main",children:o.jsx(Ese,{authUser:e})}),o.jsx(jse,{})]})}function Ise(){return o.jsx(_se,{children:o.jsx(Y2,{children:o.jsx(Tse,{})})})}function Tse(){const{path:e}=li();return e.startsWith("/display")?o.jsx(xI,{}):iT(e)?o.jsx(AI,{}):o.jsx(Ase,{children:({user:t,onLogout:n})=>o.jsx(Pse,{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 g1=document.querySelector('link[rel="icon"]');g1&&(g1.href=T_);Fg.createRoot(document.getElementById("root")).render(o.jsx(it.StrictMode,{children:o.jsx(Ise,{})}));
|