@fieldwangai/agentflow 0.1.105 → 0.1.106
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.
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
var i2=Object.defineProperty;var o2=(e,t,n)=>t in e?i2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Rn=(e,t,n)=>o2(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 o of s)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerPolicy&&(o.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?o.credentials="include":s.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(s){if(s.ep)return;s.ep=!0;const o=n(s);fetch(s.href,o)}})();var rd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Zo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var j_={exports:{}},hm={},C_={exports:{}},At={};/**
|
|
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 Vd=Symbol.for("react.element"),a2=Symbol.for("react.portal"),l2=Symbol.for("react.fragment"),c2=Symbol.for("react.strict_mode"),u2=Symbol.for("react.profiler"),d2=Symbol.for("react.provider"),f2=Symbol.for("react.context"),p2=Symbol.for("react.forward_ref"),h2=Symbol.for("react.suspense"),m2=Symbol.for("react.memo"),g2=Symbol.for("react.lazy"),h0=Symbol.iterator;function y2(e){return e===null||typeof e!="object"?null:(e=h0&&e[h0]||e["@@iterator"],typeof e=="function"?e:null)}var __={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E_=Object.assign,A_={};function Ac(e,t,n){this.props=e,this.context=t,this.refs=A_,this.updater=n||__}Ac.prototype.isReactComponent={};Ac.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")};Ac.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function P_(){}P_.prototype=Ac.prototype;function db(e,t,n){this.props=e,this.context=t,this.refs=A_,this.updater=n||__}var fb=db.prototype=new P_;fb.constructor=db;E_(fb,Ac.prototype);fb.isPureReactComponent=!0;var m0=Array.isArray,I_=Object.prototype.hasOwnProperty,pb={current:null},R_={key:!0,ref:!0,__self:!0,__source:!0};function T_(e,t,n){var r,s={},o=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(o=""+t.key),t)I_.call(t,r)&&!R_.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:Vd,type:e,key:o,ref:a,props:s,_owner:pb.current}}function w2(e,t){return{$$typeof:Vd,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function hb(e){return typeof e=="object"&&e!==null&&e.$$typeof===Vd}function x2(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var g0=/\/+/g;function Hg(e,t){return typeof e=="object"&&e!==null&&e.key!=null?x2(""+e.key):t.toString(36)}function $p(e,t,n,r,s){var o=typeof e;(o==="undefined"||o==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(o){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Vd:case a2:a=!0}}if(a)return a=e,s=s(a),e=r===""?"."+Hg(a,0):r,m0(s)?(n="",e!=null&&(n=e.replace(g0,"$&/")+"/"),$p(s,t,n,"",function(u){return u})):s!=null&&(hb(s)&&(s=w2(s,n+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(g0,"$&/")+"/")+e)),t.push(s)),1;if(a=0,r=r===""?".":r+":",m0(e))for(var l=0;l<e.length;l++){o=e[l];var c=r+Hg(o,l);a+=$p(o,t,n,c,s)}else if(c=y2(e),typeof c=="function")for(e=c.call(e),l=0;!(o=e.next()).done;)o=o.value,c=r+Hg(o,l++),a+=$p(o,t,n,c,s);else if(o==="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 zf(e,t,n){if(e==null)return e;var r=[],s=0;return $p(e,r,"","",function(o){return t.call(n,o,s++)}),r}function b2(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 Mr={current:null},Lp={transition:null},k2={ReactCurrentDispatcher:Mr,ReactCurrentBatchConfig:Lp,ReactCurrentOwner:pb};function M_(){throw Error("act(...) is not supported in production builds of React.")}At.Children={map:zf,forEach:function(e,t,n){zf(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return zf(e,function(){t++}),t},toArray:function(e){return zf(e,function(t){return t})||[]},only:function(e){if(!hb(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};At.Component=Ac;At.Fragment=l2;At.Profiler=u2;At.PureComponent=db;At.StrictMode=c2;At.Suspense=h2;At.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=k2;At.act=M_;At.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=E_({},e.props),s=e.key,o=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,a=pb.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)I_.call(t,c)&&!R_.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:Vd,type:e.type,key:s,ref:o,props:r,_owner:a}};At.createContext=function(e){return e={$$typeof:f2,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:d2,_context:e},e.Consumer=e};At.createElement=T_;At.createFactory=function(e){var t=T_.bind(null,e);return t.type=e,t};At.createRef=function(){return{current:null}};At.forwardRef=function(e){return{$$typeof:p2,render:e}};At.isValidElement=hb;At.lazy=function(e){return{$$typeof:g2,_payload:{_status:-1,_result:e},_init:b2}};At.memo=function(e,t){return{$$typeof:m2,type:e,compare:t===void 0?null:t}};At.startTransition=function(e){var t=Lp.transition;Lp.transition={};try{e()}finally{Lp.transition=t}};At.unstable_act=M_;At.useCallback=function(e,t){return Mr.current.useCallback(e,t)};At.useContext=function(e){return Mr.current.useContext(e)};At.useDebugValue=function(){};At.useDeferredValue=function(e){return Mr.current.useDeferredValue(e)};At.useEffect=function(e,t){return Mr.current.useEffect(e,t)};At.useId=function(){return Mr.current.useId()};At.useImperativeHandle=function(e,t,n){return Mr.current.useImperativeHandle(e,t,n)};At.useInsertionEffect=function(e,t){return Mr.current.useInsertionEffect(e,t)};At.useLayoutEffect=function(e,t){return Mr.current.useLayoutEffect(e,t)};At.useMemo=function(e,t){return Mr.current.useMemo(e,t)};At.useReducer=function(e,t,n){return Mr.current.useReducer(e,t,n)};At.useRef=function(e){return Mr.current.useRef(e)};At.useState=function(e){return Mr.current.useState(e)};At.useSyncExternalStore=function(e,t,n){return Mr.current.useSyncExternalStore(e,t,n)};At.useTransition=function(){return Mr.current.useTransition()};At.version="18.3.1";C_.exports=At;var m=C_.exports;const dt=Zo(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 v2=m,S2=Symbol.for("react.element"),N2=Symbol.for("react.fragment"),j2=Object.prototype.hasOwnProperty,C2=v2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,_2={key:!0,ref:!0,__self:!0,__source:!0};function $_(e,t,n){var r,s={},o=null,a=null;n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)j2.call(t,r)&&!_2.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:S2,type:e,key:o,ref:a,props:s,_owner:C2.current}}hm.Fragment=N2;hm.jsx=$_;hm.jsxs=$_;j_.exports=hm;var i=j_.exports,dw={},L_={exports:{}},ds={},O_={exports:{}},D_={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.min.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/(function(e){function t(R,z){var E=R.length;R.push(z);e:for(;0<E;){var Q=E-1>>>1,V=R[Q];if(0<s(V,z))R[Q]=z,R[E]=V,E=Q;else break e}}function n(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var z=R[0],E=R.pop();if(E!==z){R[0]=E;e:for(var Q=0,V=R.length,$=V>>>1;Q<$;){var ne=2*(Q+1)-1,ce=R[ne],X=ne+1,re=R[X];if(0>s(ce,E))X<V&&0>s(re,ce)?(R[Q]=re,R[X]=E,Q=X):(R[Q]=ce,R[ne]=E,Q=ne);else if(X<V&&0>s(re,E))R[Q]=re,R[X]=E,Q=X;else break e}}return z}function s(R,z){var E=R.sortIndex-z.sortIndex;return E!==0?E:R.id-z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var c=[],u=[],d=1,p=null,f=3,h=!1,g=!1,k=!1,b=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(R){for(var z=n(u);z!==null;){if(z.callback===null)r(u);else if(z.startTime<=R)r(u),z.sortIndex=z.expirationTime,t(c,z);else break;z=n(u)}}function C(R){if(k=!1,w(R),!g)if(n(c)!==null)g=!0,H(N);else{var z=n(u);z!==null&&L(C,z.startTime-R)}}function N(R,z){g=!1,k&&(k=!1,y(I),I=-1),h=!0;var E=f;try{for(w(z),p=n(c);p!==null&&(!(p.expirationTime>z)||R&&!W());){var Q=p.callback;if(typeof Q=="function"){p.callback=null,f=p.priorityLevel;var V=Q(p.expirationTime<=z);z=e.unstable_now(),typeof V=="function"?p.callback=V:p===n(c)&&r(c),w(z)}else r(c);p=n(c)}if(p!==null)var $=!0;else{var ne=n(u);ne!==null&&L(C,ne.startTime-z),$=!1}return $}finally{p=null,f=E,h=!1}}var j=!1,A=null,I=-1,D=5,B=-1;function W(){return!(e.unstable_now()-B<D)}function F(){if(A!==null){var R=e.unstable_now();B=R;var z=!0;try{z=A(!0,R)}finally{z?T():(j=!1,A=null)}}else j=!1}var T;if(typeof v=="function")T=function(){v(F)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,q=M.port2;M.port1.onmessage=F,T=function(){q.postMessage(null)}}else T=function(){b(F,0)};function H(R){A=R,j||(j=!0,T())}function L(R,z){I=b(function(){R(e.unstable_now())},z)}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(R){R.callback=null},e.unstable_continueExecution=function(){g||h||(g=!0,H(N))},e.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<R?Math.floor(1e3/R):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(R){switch(f){case 1:case 2:case 3:var z=3;break;default:z=f}var E=f;f=z;try{return R()}finally{f=E}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(R,z){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var E=f;f=R;try{return z()}finally{f=E}},e.unstable_scheduleCallback=function(R,z,E){var Q=e.unstable_now();switch(typeof E=="object"&&E!==null?(E=E.delay,E=typeof E=="number"&&0<E?Q+E:Q):E=Q,R){case 1:var V=-1;break;case 2:V=250;break;case 5:V=1073741823;break;case 4:V=1e4;break;default:V=5e3}return V=E+V,R={id:d++,callback:z,priorityLevel:R,startTime:E,expirationTime:V,sortIndex:-1},E>Q?(R.sortIndex=E,t(u,R),n(c)===null&&R===n(u)&&(k?(y(I),I=-1):k=!0,L(C,E-Q))):(R.sortIndex=V,t(c,R),g||h||(g=!0,H(N))),R},e.unstable_shouldYield=W,e.unstable_wrapCallback=function(R){var z=f;return function(){var E=f;f=z;try{return R.apply(this,arguments)}finally{f=E}}}})(D_);O_.exports=D_;var E2=O_.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 A2=m,cs=E2;function Ee(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 F_=new Set,sd={};function tl(e,t){dc(e,t),dc(e+"Capture",t)}function dc(e,t){for(sd[e]=t,e=0;e<t.length;e++)F_.add(t[e])}var Qi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fw=Object.prototype.hasOwnProperty,P2=/^[: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]*$/,y0={},w0={};function I2(e){return fw.call(w0,e)?!0:fw.call(y0,e)?!1:P2.test(e)?w0[e]=!0:(y0[e]=!0,!1)}function R2(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 T2(e,t,n,r){if(t===null||typeof t>"u"||R2(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 $r(e,t,n,r,s,o,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=o,this.removeEmptyString=a}var hr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){hr[e]=new $r(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];hr[t]=new $r(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){hr[e]=new $r(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){hr[e]=new $r(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){hr[e]=new $r(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){hr[e]=new $r(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){hr[e]=new $r(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){hr[e]=new $r(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){hr[e]=new $r(e,5,!1,e.toLowerCase(),null,!1,!1)});var mb=/[\-:]([a-z])/g;function gb(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(mb,gb);hr[t]=new $r(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(mb,gb);hr[t]=new $r(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(mb,gb);hr[t]=new $r(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){hr[e]=new $r(e,1,!1,e.toLowerCase(),null,!1,!1)});hr.xlinkHref=new $r("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){hr[e]=new $r(e,1,!1,e.toLowerCase(),null,!0,!0)});function yb(e,t,n,r){var s=hr.hasOwnProperty(t)?hr[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(T2(t,n,s,r)&&(n=null),r||s===null?I2(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 io=A2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Bf=Symbol.for("react.element"),$l=Symbol.for("react.portal"),Ll=Symbol.for("react.fragment"),wb=Symbol.for("react.strict_mode"),pw=Symbol.for("react.profiler"),z_=Symbol.for("react.provider"),B_=Symbol.for("react.context"),xb=Symbol.for("react.forward_ref"),hw=Symbol.for("react.suspense"),mw=Symbol.for("react.suspense_list"),bb=Symbol.for("react.memo"),Co=Symbol.for("react.lazy"),H_=Symbol.for("react.offscreen"),x0=Symbol.iterator;function cu(e){return e===null||typeof e!="object"?null:(e=x0&&e[x0]||e["@@iterator"],typeof e=="function"?e:null)}var Pn=Object.assign,Wg;function Eu(e){if(Wg===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Wg=t&&t[1]||""}return`
|
|
34
|
-
`+Wg+e}var Vg=!1;function Kg(e,t){if(!e||Vg)return"";Vg=!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
|
-
`),o=r.stack.split(`
|
|
36
|
-
`),a=s.length-1,l=o.length-1;1<=a&&0<=l&&s[a]!==o[l];)l--;for(;1<=a&&0<=l;a--,l--)if(s[a]!==o[l]){if(a!==1||l!==1)do if(a--,l--,0>l||s[a]!==o[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{Vg=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Eu(e):""}function M2(e){switch(e.tag){case 5:return Eu(e.type);case 16:return Eu("Lazy");case 13:return Eu("Suspense");case 19:return Eu("SuspenseList");case 0:case 2:case 15:return e=Kg(e.type,!1),e;case 11:return e=Kg(e.type.render,!1),e;case 1:return e=Kg(e.type,!0),e;default:return""}}function gw(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 Ll:return"Fragment";case $l:return"Portal";case pw:return"Profiler";case wb:return"StrictMode";case hw:return"Suspense";case mw:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case B_:return(e.displayName||"Context")+".Consumer";case z_:return(e._context.displayName||"Context")+".Provider";case xb:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case bb:return t=e.displayName||null,t!==null?t:gw(e.type)||"Memo";case Co:t=e._payload,e=e._init;try{return gw(e(t))}catch{}}return null}function $2(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 gw(t);case 8:return t===wb?"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 qo(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function W_(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function L2(e){var t=W_(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,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(a){r=""+a,o.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 Hf(e){e._valueTracker||(e._valueTracker=L2(e))}function V_(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=W_(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ah(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 yw(e,t){var n=t.checked;return Pn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function b0(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=qo(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 K_(e,t){t=t.checked,t!=null&&yb(e,"checked",t,!1)}function ww(e,t){K_(e,t);var n=qo(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")?xw(e,t.type,n):t.hasOwnProperty("defaultValue")&&xw(e,t.type,qo(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function k0(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 xw(e,t,n){(t!=="number"||ah(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Au=Array.isArray;function Ql(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=""+qo(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 bw(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Ee(91));return Pn({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function v0(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Ee(92));if(Au(n)){if(1<n.length)throw Error(Ee(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:qo(n)}}function q_(e,t){var n=qo(t.value),r=qo(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 S0(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function U_(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 kw(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?U_(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Wf,Y_=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(Wf=Wf||document.createElement("div"),Wf.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Wf.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function id(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Du={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},O2=["Webkit","ms","Moz","O"];Object.keys(Du).forEach(function(e){O2.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Du[t]=Du[e]})});function G_(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Du.hasOwnProperty(e)&&Du[e]?(""+t).trim():t+"px"}function J_(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=G_(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var D2=Pn({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 vw(e,t){if(t){if(D2[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Ee(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Ee(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Ee(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Ee(62))}}function Sw(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 Nw=null;function kb(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var jw=null,Zl=null,ec=null;function N0(e){if(e=Ud(e)){if(typeof jw!="function")throw Error(Ee(280));var t=e.stateNode;t&&(t=xm(t),jw(e.stateNode,e.type,t))}}function X_(e){Zl?ec?ec.push(e):ec=[e]:Zl=e}function Q_(){if(Zl){var e=Zl,t=ec;if(ec=Zl=null,N0(e),t)for(e=0;e<t.length;e++)N0(t[e])}}function Z_(e,t){return e(t)}function eE(){}var qg=!1;function tE(e,t,n){if(qg)return e(t,n);qg=!0;try{return Z_(e,t,n)}finally{qg=!1,(Zl!==null||ec!==null)&&(eE(),Q_())}}function od(e,t){var n=e.stateNode;if(n===null)return null;var r=xm(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(Ee(231,t,typeof n));return n}var Cw=!1;if(Qi)try{var uu={};Object.defineProperty(uu,"passive",{get:function(){Cw=!0}}),window.addEventListener("test",uu,uu),window.removeEventListener("test",uu,uu)}catch{Cw=!1}function F2(e,t,n,r,s,o,a,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(d){this.onError(d)}}var Fu=!1,lh=null,ch=!1,_w=null,z2={onError:function(e){Fu=!0,lh=e}};function B2(e,t,n,r,s,o,a,l,c){Fu=!1,lh=null,F2.apply(z2,arguments)}function H2(e,t,n,r,s,o,a,l,c){if(B2.apply(this,arguments),Fu){if(Fu){var u=lh;Fu=!1,lh=null}else throw Error(Ee(198));ch||(ch=!0,_w=u)}}function nl(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 nE(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 j0(e){if(nl(e)!==e)throw Error(Ee(188))}function W2(e){var t=e.alternate;if(!t){if(t=nl(e),t===null)throw Error(Ee(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var o=s.alternate;if(o===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===o.child){for(o=s.child;o;){if(o===n)return j0(s),e;if(o===r)return j0(s),t;o=o.sibling}throw Error(Ee(188))}if(n.return!==r.return)n=s,r=o;else{for(var a=!1,l=s.child;l;){if(l===n){a=!0,n=s,r=o;break}if(l===r){a=!0,r=s,n=o;break}l=l.sibling}if(!a){for(l=o.child;l;){if(l===n){a=!0,n=o,r=s;break}if(l===r){a=!0,r=o,n=s;break}l=l.sibling}if(!a)throw Error(Ee(189))}}if(n.alternate!==r)throw Error(Ee(190))}if(n.tag!==3)throw Error(Ee(188));return n.stateNode.current===n?e:t}function rE(e){return e=W2(e),e!==null?sE(e):null}function sE(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=sE(e);if(t!==null)return t;e=e.sibling}return null}var iE=cs.unstable_scheduleCallback,C0=cs.unstable_cancelCallback,V2=cs.unstable_shouldYield,K2=cs.unstable_requestPaint,Dn=cs.unstable_now,q2=cs.unstable_getCurrentPriorityLevel,vb=cs.unstable_ImmediatePriority,oE=cs.unstable_UserBlockingPriority,uh=cs.unstable_NormalPriority,U2=cs.unstable_LowPriority,aE=cs.unstable_IdlePriority,mm=null,bi=null;function Y2(e){if(bi&&typeof bi.onCommitFiberRoot=="function")try{bi.onCommitFiberRoot(mm,e,void 0,(e.current.flags&128)===128)}catch{}}var Ys=Math.clz32?Math.clz32:X2,G2=Math.log,J2=Math.LN2;function X2(e){return e>>>=0,e===0?32:31-(G2(e)/J2|0)|0}var Vf=64,Kf=4194304;function Pu(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 dh(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,o=e.pingedLanes,a=n&268435455;if(a!==0){var l=a&~s;l!==0?r=Pu(l):(o&=a,o!==0&&(r=Pu(o)))}else a=n&~s,a!==0?r=Pu(a):o!==0&&(r=Pu(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,o=t&-t,s>=o||s===16&&(o&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-Ys(t),s=1<<n,r|=e[n],t&=~s;return r}function Q2(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 Z2(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,o=e.pendingLanes;0<o;){var a=31-Ys(o),l=1<<a,c=s[a];c===-1?(!(l&n)||l&r)&&(s[a]=Q2(l,t)):c<=t&&(e.expiredLanes|=l),o&=~l}}function Ew(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function lE(){var e=Vf;return Vf<<=1,!(Vf&4194240)&&(Vf=64),e}function Ug(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Kd(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Ys(t),e[t]=n}function eL(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-Ys(n),o=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~o}}function Sb(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Ys(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var Qt=0;function cE(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var uE,Nb,dE,fE,pE,Aw=!1,qf=[],Lo=null,Oo=null,Do=null,ad=new Map,ld=new Map,Ao=[],tL="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function _0(e,t){switch(e){case"focusin":case"focusout":Lo=null;break;case"dragenter":case"dragleave":Oo=null;break;case"mouseover":case"mouseout":Do=null;break;case"pointerover":case"pointerout":ad.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":ld.delete(t.pointerId)}}function du(e,t,n,r,s,o){return e===null||e.nativeEvent!==o?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:o,targetContainers:[s]},t!==null&&(t=Ud(t),t!==null&&Nb(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function nL(e,t,n,r,s){switch(t){case"focusin":return Lo=du(Lo,e,t,n,r,s),!0;case"dragenter":return Oo=du(Oo,e,t,n,r,s),!0;case"mouseover":return Do=du(Do,e,t,n,r,s),!0;case"pointerover":var o=s.pointerId;return ad.set(o,du(ad.get(o)||null,e,t,n,r,s)),!0;case"gotpointercapture":return o=s.pointerId,ld.set(o,du(ld.get(o)||null,e,t,n,r,s)),!0}return!1}function hE(e){var t=Na(e.target);if(t!==null){var n=nl(t);if(n!==null){if(t=n.tag,t===13){if(t=nE(n),t!==null){e.blockedOn=t,pE(e.priority,function(){dE(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 Op(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Pw(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Nw=r,n.target.dispatchEvent(r),Nw=null}else return t=Ud(n),t!==null&&Nb(t),e.blockedOn=n,!1;t.shift()}return!0}function E0(e,t,n){Op(e)&&n.delete(t)}function rL(){Aw=!1,Lo!==null&&Op(Lo)&&(Lo=null),Oo!==null&&Op(Oo)&&(Oo=null),Do!==null&&Op(Do)&&(Do=null),ad.forEach(E0),ld.forEach(E0)}function fu(e,t){e.blockedOn===t&&(e.blockedOn=null,Aw||(Aw=!0,cs.unstable_scheduleCallback(cs.unstable_NormalPriority,rL)))}function cd(e){function t(s){return fu(s,e)}if(0<qf.length){fu(qf[0],e);for(var n=1;n<qf.length;n++){var r=qf[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Lo!==null&&fu(Lo,e),Oo!==null&&fu(Oo,e),Do!==null&&fu(Do,e),ad.forEach(t),ld.forEach(t),n=0;n<Ao.length;n++)r=Ao[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Ao.length&&(n=Ao[0],n.blockedOn===null);)hE(n),n.blockedOn===null&&Ao.shift()}var tc=io.ReactCurrentBatchConfig,fh=!0;function sL(e,t,n,r){var s=Qt,o=tc.transition;tc.transition=null;try{Qt=1,jb(e,t,n,r)}finally{Qt=s,tc.transition=o}}function iL(e,t,n,r){var s=Qt,o=tc.transition;tc.transition=null;try{Qt=4,jb(e,t,n,r)}finally{Qt=s,tc.transition=o}}function jb(e,t,n,r){if(fh){var s=Pw(e,t,n,r);if(s===null)ry(e,t,r,ph,n),_0(e,r);else if(nL(s,e,t,n,r))r.stopPropagation();else if(_0(e,r),t&4&&-1<tL.indexOf(e)){for(;s!==null;){var o=Ud(s);if(o!==null&&uE(o),o=Pw(e,t,n,r),o===null&&ry(e,t,r,ph,n),o===s)break;s=o}s!==null&&r.stopPropagation()}else ry(e,t,r,null,n)}}var ph=null;function Pw(e,t,n,r){if(ph=null,e=kb(r),e=Na(e),e!==null)if(t=nl(e),t===null)e=null;else if(n=t.tag,n===13){if(e=nE(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 ph=e,null}function mE(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(q2()){case vb:return 1;case oE:return 4;case uh:case U2:return 16;case aE:return 536870912;default:return 16}default:return 16}}var Ro=null,Cb=null,Dp=null;function gE(){if(Dp)return Dp;var e,t=Cb,n=t.length,r,s="value"in Ro?Ro.value:Ro.textContent,o=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[o-r];r++);return Dp=s.slice(e,1<r?1-r:void 0)}function Fp(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Uf(){return!0}function A0(){return!1}function fs(e){function t(n,r,s,o,a){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=o,this.target=a,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(o):o[l]);return this.isDefaultPrevented=(o.defaultPrevented!=null?o.defaultPrevented:o.returnValue===!1)?Uf:A0,this.isPropagationStopped=A0,this}return Pn(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=Uf)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Uf)},persist:function(){},isPersistent:Uf}),t}var Pc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},_b=fs(Pc),qd=Pn({},Pc,{view:0,detail:0}),oL=fs(qd),Yg,Gg,pu,gm=Pn({},qd,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Eb,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!==pu&&(pu&&e.type==="mousemove"?(Yg=e.screenX-pu.screenX,Gg=e.screenY-pu.screenY):Gg=Yg=0,pu=e),Yg)},movementY:function(e){return"movementY"in e?e.movementY:Gg}}),P0=fs(gm),aL=Pn({},gm,{dataTransfer:0}),lL=fs(aL),cL=Pn({},qd,{relatedTarget:0}),Jg=fs(cL),uL=Pn({},Pc,{animationName:0,elapsedTime:0,pseudoElement:0}),dL=fs(uL),fL=Pn({},Pc,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),pL=fs(fL),hL=Pn({},Pc,{data:0}),I0=fs(hL),mL={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gL={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},yL={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function wL(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=yL[e])?!!t[e]:!1}function Eb(){return wL}var xL=Pn({},qd,{key:function(e){if(e.key){var t=mL[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Fp(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?gL[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Eb,charCode:function(e){return e.type==="keypress"?Fp(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Fp(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),bL=fs(xL),kL=Pn({},gm,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),R0=fs(kL),vL=Pn({},qd,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Eb}),SL=fs(vL),NL=Pn({},Pc,{propertyName:0,elapsedTime:0,pseudoElement:0}),jL=fs(NL),CL=Pn({},gm,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),_L=fs(CL),EL=[9,13,27,32],Ab=Qi&&"CompositionEvent"in window,zu=null;Qi&&"documentMode"in document&&(zu=document.documentMode);var AL=Qi&&"TextEvent"in window&&!zu,yE=Qi&&(!Ab||zu&&8<zu&&11>=zu),T0=" ",M0=!1;function wE(e,t){switch(e){case"keyup":return EL.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xE(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Ol=!1;function PL(e,t){switch(e){case"compositionend":return xE(t);case"keypress":return t.which!==32?null:(M0=!0,T0);case"textInput":return e=t.data,e===T0&&M0?null:e;default:return null}}function IL(e,t){if(Ol)return e==="compositionend"||!Ab&&wE(e,t)?(e=gE(),Dp=Cb=Ro=null,Ol=!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 yE&&t.locale!=="ko"?null:t.data;default:return null}}var RL={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 $0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!RL[e.type]:t==="textarea"}function bE(e,t,n,r){X_(r),t=hh(t,"onChange"),0<t.length&&(n=new _b("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var Bu=null,ud=null;function TL(e){IE(e,0)}function ym(e){var t=zl(e);if(V_(t))return e}function ML(e,t){if(e==="change")return t}var kE=!1;if(Qi){var Xg;if(Qi){var Qg="oninput"in document;if(!Qg){var L0=document.createElement("div");L0.setAttribute("oninput","return;"),Qg=typeof L0.oninput=="function"}Xg=Qg}else Xg=!1;kE=Xg&&(!document.documentMode||9<document.documentMode)}function O0(){Bu&&(Bu.detachEvent("onpropertychange",vE),ud=Bu=null)}function vE(e){if(e.propertyName==="value"&&ym(ud)){var t=[];bE(t,ud,e,kb(e)),tE(TL,t)}}function $L(e,t,n){e==="focusin"?(O0(),Bu=t,ud=n,Bu.attachEvent("onpropertychange",vE)):e==="focusout"&&O0()}function LL(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ym(ud)}function OL(e,t){if(e==="click")return ym(t)}function DL(e,t){if(e==="input"||e==="change")return ym(t)}function FL(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Xs=typeof Object.is=="function"?Object.is:FL;function dd(e,t){if(Xs(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(!fw.call(t,s)||!Xs(e[s],t[s]))return!1}return!0}function D0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function F0(e,t){var n=D0(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=D0(n)}}function SE(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?SE(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function NE(){for(var e=window,t=ah();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ah(e.document)}return t}function Pb(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 zL(e){var t=NE(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&SE(n.ownerDocument.documentElement,n)){if(r!==null&&Pb(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,o=Math.min(r.start,s);r=r.end===void 0?o:Math.min(r.end,s),!e.extend&&o>r&&(s=r,r=o,o=s),s=F0(n,o);var a=F0(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(),o>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 BL=Qi&&"documentMode"in document&&11>=document.documentMode,Dl=null,Iw=null,Hu=null,Rw=!1;function z0(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Rw||Dl==null||Dl!==ah(r)||(r=Dl,"selectionStart"in r&&Pb(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}),Hu&&dd(Hu,r)||(Hu=r,r=hh(Iw,"onSelect"),0<r.length&&(t=new _b("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Dl)))}function Yf(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Fl={animationend:Yf("Animation","AnimationEnd"),animationiteration:Yf("Animation","AnimationIteration"),animationstart:Yf("Animation","AnimationStart"),transitionend:Yf("Transition","TransitionEnd")},Zg={},jE={};Qi&&(jE=document.createElement("div").style,"AnimationEvent"in window||(delete Fl.animationend.animation,delete Fl.animationiteration.animation,delete Fl.animationstart.animation),"TransitionEvent"in window||delete Fl.transitionend.transition);function wm(e){if(Zg[e])return Zg[e];if(!Fl[e])return e;var t=Fl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in jE)return Zg[e]=t[n];return e}var CE=wm("animationend"),_E=wm("animationiteration"),EE=wm("animationstart"),AE=wm("transitionend"),PE=new Map,B0="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 ea(e,t){PE.set(e,t),tl(t,[e])}for(var ey=0;ey<B0.length;ey++){var ty=B0[ey],HL=ty.toLowerCase(),WL=ty[0].toUpperCase()+ty.slice(1);ea(HL,"on"+WL)}ea(CE,"onAnimationEnd");ea(_E,"onAnimationIteration");ea(EE,"onAnimationStart");ea("dblclick","onDoubleClick");ea("focusin","onFocus");ea("focusout","onBlur");ea(AE,"onTransitionEnd");dc("onMouseEnter",["mouseout","mouseover"]);dc("onMouseLeave",["mouseout","mouseover"]);dc("onPointerEnter",["pointerout","pointerover"]);dc("onPointerLeave",["pointerout","pointerover"]);tl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));tl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));tl("onBeforeInput",["compositionend","keypress","textInput","paste"]);tl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));tl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));tl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Iu="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(" "),VL=new Set("cancel close invalid load scroll toggle".split(" ").concat(Iu));function H0(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,H2(r,t,void 0,e),e.currentTarget=null}function IE(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 o=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!==o&&s.isPropagationStopped())break e;H0(s,l,u),o=c}else for(a=0;a<r.length;a++){if(l=r[a],c=l.instance,u=l.currentTarget,l=l.listener,c!==o&&s.isPropagationStopped())break e;H0(s,l,u),o=c}}}if(ch)throw e=_w,ch=!1,_w=null,e}function mn(e,t){var n=t[Ow];n===void 0&&(n=t[Ow]=new Set);var r=e+"__bubble";n.has(r)||(RE(t,e,2,!1),n.add(r))}function ny(e,t,n){var r=0;t&&(r|=4),RE(n,e,r,t)}var Gf="_reactListening"+Math.random().toString(36).slice(2);function fd(e){if(!e[Gf]){e[Gf]=!0,F_.forEach(function(n){n!=="selectionchange"&&(VL.has(n)||ny(n,!1,e),ny(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Gf]||(t[Gf]=!0,ny("selectionchange",!1,t))}}function RE(e,t,n,r){switch(mE(t)){case 1:var s=sL;break;case 4:s=iL;break;default:s=jb}n=s.bind(null,t,n,e),s=void 0,!Cw||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 ry(e,t,n,r,s){var o=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=Na(l),a===null)return;if(c=a.tag,c===5||c===6){r=o=a;continue e}l=l.parentNode}}r=r.return}tE(function(){var u=o,d=kb(n),p=[];e:{var f=PE.get(e);if(f!==void 0){var h=_b,g=e;switch(e){case"keypress":if(Fp(n)===0)break e;case"keydown":case"keyup":h=bL;break;case"focusin":g="focus",h=Jg;break;case"focusout":g="blur",h=Jg;break;case"beforeblur":case"afterblur":h=Jg;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=P0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=lL;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=SL;break;case CE:case _E:case EE:h=dL;break;case AE:h=jL;break;case"scroll":h=oL;break;case"wheel":h=_L;break;case"copy":case"cut":case"paste":h=pL;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=R0}var k=(t&4)!==0,b=!k&&e==="scroll",y=k?f!==null?f+"Capture":null:f;k=[];for(var v=u,w;v!==null;){w=v;var C=w.stateNode;if(w.tag===5&&C!==null&&(w=C,y!==null&&(C=od(v,y),C!=null&&k.push(pd(v,C,w)))),b)break;v=v.return}0<k.length&&(f=new h(f,g,null,n,d),p.push({event:f,listeners:k}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",f&&n!==Nw&&(g=n.relatedTarget||n.fromElement)&&(Na(g)||g[Zi]))break e;if((h||f)&&(f=d.window===d?d:(f=d.ownerDocument)?f.defaultView||f.parentWindow:window,h?(g=n.relatedTarget||n.toElement,h=u,g=g?Na(g):null,g!==null&&(b=nl(g),g!==b||g.tag!==5&&g.tag!==6)&&(g=null)):(h=null,g=u),h!==g)){if(k=P0,C="onMouseLeave",y="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(k=R0,C="onPointerLeave",y="onPointerEnter",v="pointer"),b=h==null?f:zl(h),w=g==null?f:zl(g),f=new k(C,v+"leave",h,n,d),f.target=b,f.relatedTarget=w,C=null,Na(d)===u&&(k=new k(y,v+"enter",g,n,d),k.target=w,k.relatedTarget=b,C=k),b=C,h&&g)t:{for(k=h,y=g,v=0,w=k;w;w=vl(w))v++;for(w=0,C=y;C;C=vl(C))w++;for(;0<v-w;)k=vl(k),v--;for(;0<w-v;)y=vl(y),w--;for(;v--;){if(k===y||y!==null&&k===y.alternate)break t;k=vl(k),y=vl(y)}k=null}else k=null;h!==null&&W0(p,f,h,k,!1),g!==null&&b!==null&&W0(p,b,g,k,!0)}}e:{if(f=u?zl(u):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var N=ML;else if($0(f))if(kE)N=DL;else{N=LL;var j=$L}else(h=f.nodeName)&&h.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(N=OL);if(N&&(N=N(e,u))){bE(p,N,n,d);break e}j&&j(e,f,u),e==="focusout"&&(j=f._wrapperState)&&j.controlled&&f.type==="number"&&xw(f,"number",f.value)}switch(j=u?zl(u):window,e){case"focusin":($0(j)||j.contentEditable==="true")&&(Dl=j,Iw=u,Hu=null);break;case"focusout":Hu=Iw=Dl=null;break;case"mousedown":Rw=!0;break;case"contextmenu":case"mouseup":case"dragend":Rw=!1,z0(p,n,d);break;case"selectionchange":if(BL)break;case"keydown":case"keyup":z0(p,n,d)}var A;if(Ab)e:{switch(e){case"compositionstart":var I="onCompositionStart";break e;case"compositionend":I="onCompositionEnd";break e;case"compositionupdate":I="onCompositionUpdate";break e}I=void 0}else Ol?wE(e,n)&&(I="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(I="onCompositionStart");I&&(yE&&n.locale!=="ko"&&(Ol||I!=="onCompositionStart"?I==="onCompositionEnd"&&Ol&&(A=gE()):(Ro=d,Cb="value"in Ro?Ro.value:Ro.textContent,Ol=!0)),j=hh(u,I),0<j.length&&(I=new I0(I,e,null,n,d),p.push({event:I,listeners:j}),A?I.data=A:(A=xE(n),A!==null&&(I.data=A)))),(A=AL?PL(e,n):IL(e,n))&&(u=hh(u,"onBeforeInput"),0<u.length&&(d=new I0("onBeforeInput","beforeinput",null,n,d),p.push({event:d,listeners:u}),d.data=A))}IE(p,t)})}function pd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function hh(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,o=s.stateNode;s.tag===5&&o!==null&&(s=o,o=od(e,n),o!=null&&r.unshift(pd(e,o,s)),o=od(e,t),o!=null&&r.push(pd(e,o,s))),e=e.return}return r}function vl(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function W0(e,t,n,r,s){for(var o=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=od(n,o),c!=null&&a.unshift(pd(n,c,l))):s||(c=od(n,o),c!=null&&a.push(pd(n,c,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var KL=/\r\n?/g,qL=/\u0000|\uFFFD/g;function V0(e){return(typeof e=="string"?e:""+e).replace(KL,`
|
|
38
|
-
`).replace(qL,"")}function Jf(e,t,n){if(t=V0(t),V0(e)!==t&&n)throw Error(Ee(425))}function mh(){}var Tw=null,Mw=null;function $w(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 Lw=typeof setTimeout=="function"?setTimeout:void 0,UL=typeof clearTimeout=="function"?clearTimeout:void 0,K0=typeof Promise=="function"?Promise:void 0,YL=typeof queueMicrotask=="function"?queueMicrotask:typeof K0<"u"?function(e){return K0.resolve(null).then(e).catch(GL)}:Lw;function GL(e){setTimeout(function(){throw e})}function sy(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),cd(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);cd(t)}function Fo(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 q0(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 Ic=Math.random().toString(36).slice(2),hi="__reactFiber$"+Ic,hd="__reactProps$"+Ic,Zi="__reactContainer$"+Ic,Ow="__reactEvents$"+Ic,JL="__reactListeners$"+Ic,XL="__reactHandles$"+Ic;function Na(e){var t=e[hi];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Zi]||n[hi]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=q0(e);e!==null;){if(n=e[hi])return n;e=q0(e)}return t}e=n,n=e.parentNode}return null}function Ud(e){return e=e[hi]||e[Zi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function zl(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Ee(33))}function xm(e){return e[hd]||null}var Dw=[],Bl=-1;function ta(e){return{current:e}}function yn(e){0>Bl||(e.current=Dw[Bl],Dw[Bl]=null,Bl--)}function cn(e,t){Bl++,Dw[Bl]=e.current,e.current=t}var Uo={},jr=ta(Uo),qr=ta(!1),Oa=Uo;function fc(e,t){var n=e.type.contextTypes;if(!n)return Uo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},o;for(o in n)s[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Ur(e){return e=e.childContextTypes,e!=null}function gh(){yn(qr),yn(jr)}function U0(e,t,n){if(jr.current!==Uo)throw Error(Ee(168));cn(jr,t),cn(qr,n)}function TE(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(Ee(108,$2(e)||"Unknown",s));return Pn({},n,r)}function yh(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Uo,Oa=jr.current,cn(jr,e),cn(qr,qr.current),!0}function Y0(e,t,n){var r=e.stateNode;if(!r)throw Error(Ee(169));n?(e=TE(e,t,Oa),r.__reactInternalMemoizedMergedChildContext=e,yn(qr),yn(jr),cn(jr,e)):yn(qr),cn(qr,n)}var Bi=null,bm=!1,iy=!1;function ME(e){Bi===null?Bi=[e]:Bi.push(e)}function QL(e){bm=!0,ME(e)}function na(){if(!iy&&Bi!==null){iy=!0;var e=0,t=Qt;try{var n=Bi;for(Qt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Bi=null,bm=!1}catch(s){throw Bi!==null&&(Bi=Bi.slice(e+1)),iE(vb,na),s}finally{Qt=t,iy=!1}}return null}var Hl=[],Wl=0,wh=null,xh=0,ks=[],vs=0,Da=null,Wi=1,Vi="";function ya(e,t){Hl[Wl++]=xh,Hl[Wl++]=wh,wh=e,xh=t}function $E(e,t,n){ks[vs++]=Wi,ks[vs++]=Vi,ks[vs++]=Da,Da=e;var r=Wi;e=Vi;var s=32-Ys(r)-1;r&=~(1<<s),n+=1;var o=32-Ys(t)+s;if(30<o){var a=s-s%5;o=(r&(1<<a)-1).toString(32),r>>=a,s-=a,Wi=1<<32-Ys(t)+s|n<<s|r,Vi=o+e}else Wi=1<<o|n<<s|r,Vi=e}function Ib(e){e.return!==null&&(ya(e,1),$E(e,1,0))}function Rb(e){for(;e===wh;)wh=Hl[--Wl],Hl[Wl]=null,xh=Hl[--Wl],Hl[Wl]=null;for(;e===Da;)Da=ks[--vs],ks[vs]=null,Vi=ks[--vs],ks[vs]=null,Wi=ks[--vs],ks[vs]=null}var as=null,is=null,bn=!1,Ws=null;function LE(e,t){var n=js(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 G0(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,as=e,is=Fo(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,as=e,is=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Da!==null?{id:Wi,overflow:Vi}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=js(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,as=e,is=null,!0):!1;default:return!1}}function Fw(e){return(e.mode&1)!==0&&(e.flags&128)===0}function zw(e){if(bn){var t=is;if(t){var n=t;if(!G0(e,t)){if(Fw(e))throw Error(Ee(418));t=Fo(n.nextSibling);var r=as;t&&G0(e,t)?LE(r,n):(e.flags=e.flags&-4097|2,bn=!1,as=e)}}else{if(Fw(e))throw Error(Ee(418));e.flags=e.flags&-4097|2,bn=!1,as=e}}}function J0(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;as=e}function Xf(e){if(e!==as)return!1;if(!bn)return J0(e),bn=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!$w(e.type,e.memoizedProps)),t&&(t=is)){if(Fw(e))throw OE(),Error(Ee(418));for(;t;)LE(e,t),t=Fo(t.nextSibling)}if(J0(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Ee(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){is=Fo(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}is=null}}else is=as?Fo(e.stateNode.nextSibling):null;return!0}function OE(){for(var e=is;e;)e=Fo(e.nextSibling)}function pc(){is=as=null,bn=!1}function Tb(e){Ws===null?Ws=[e]:Ws.push(e)}var ZL=io.ReactCurrentBatchConfig;function hu(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(Ee(309));var r=n.stateNode}if(!r)throw Error(Ee(147,e));var s=r,o=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===o?t.ref:(t=function(a){var l=s.refs;a===null?delete l[o]:l[o]=a},t._stringRef=o,t)}if(typeof e!="string")throw Error(Ee(284));if(!n._owner)throw Error(Ee(290,e))}return e}function Qf(e,t){throw e=Object.prototype.toString.call(t),Error(Ee(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function X0(e){var t=e._init;return t(e._payload)}function DE(e){function t(y,v){if(e){var w=y.deletions;w===null?(y.deletions=[v],y.flags|=16):w.push(v)}}function n(y,v){if(!e)return null;for(;v!==null;)t(y,v),v=v.sibling;return null}function r(y,v){for(y=new Map;v!==null;)v.key!==null?y.set(v.key,v):y.set(v.index,v),v=v.sibling;return y}function s(y,v){return y=Wo(y,v),y.index=0,y.sibling=null,y}function o(y,v,w){return y.index=w,e?(w=y.alternate,w!==null?(w=w.index,w<v?(y.flags|=2,v):w):(y.flags|=2,v)):(y.flags|=1048576,v)}function a(y){return e&&y.alternate===null&&(y.flags|=2),y}function l(y,v,w,C){return v===null||v.tag!==6?(v=fy(w,y.mode,C),v.return=y,v):(v=s(v,w),v.return=y,v)}function c(y,v,w,C){var N=w.type;return N===Ll?d(y,v,w.props.children,C,w.key):v!==null&&(v.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Co&&X0(N)===v.type)?(C=s(v,w.props),C.ref=hu(y,v,w),C.return=y,C):(C=qp(w.type,w.key,w.props,null,y.mode,C),C.ref=hu(y,v,w),C.return=y,C)}function u(y,v,w,C){return v===null||v.tag!==4||v.stateNode.containerInfo!==w.containerInfo||v.stateNode.implementation!==w.implementation?(v=py(w,y.mode,C),v.return=y,v):(v=s(v,w.children||[]),v.return=y,v)}function d(y,v,w,C,N){return v===null||v.tag!==7?(v=Pa(w,y.mode,C,N),v.return=y,v):(v=s(v,w),v.return=y,v)}function p(y,v,w){if(typeof v=="string"&&v!==""||typeof v=="number")return v=fy(""+v,y.mode,w),v.return=y,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Bf:return w=qp(v.type,v.key,v.props,null,y.mode,w),w.ref=hu(y,null,v),w.return=y,w;case $l:return v=py(v,y.mode,w),v.return=y,v;case Co:var C=v._init;return p(y,C(v._payload),w)}if(Au(v)||cu(v))return v=Pa(v,y.mode,w,null),v.return=y,v;Qf(y,v)}return null}function f(y,v,w,C){var N=v!==null?v.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return N!==null?null:l(y,v,""+w,C);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Bf:return w.key===N?c(y,v,w,C):null;case $l:return w.key===N?u(y,v,w,C):null;case Co:return N=w._init,f(y,v,N(w._payload),C)}if(Au(w)||cu(w))return N!==null?null:d(y,v,w,C,null);Qf(y,w)}return null}function h(y,v,w,C,N){if(typeof C=="string"&&C!==""||typeof C=="number")return y=y.get(w)||null,l(v,y,""+C,N);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case Bf:return y=y.get(C.key===null?w:C.key)||null,c(v,y,C,N);case $l:return y=y.get(C.key===null?w:C.key)||null,u(v,y,C,N);case Co:var j=C._init;return h(y,v,w,j(C._payload),N)}if(Au(C)||cu(C))return y=y.get(w)||null,d(v,y,C,N,null);Qf(v,C)}return null}function g(y,v,w,C){for(var N=null,j=null,A=v,I=v=0,D=null;A!==null&&I<w.length;I++){A.index>I?(D=A,A=null):D=A.sibling;var B=f(y,A,w[I],C);if(B===null){A===null&&(A=D);break}e&&A&&B.alternate===null&&t(y,A),v=o(B,v,I),j===null?N=B:j.sibling=B,j=B,A=D}if(I===w.length)return n(y,A),bn&&ya(y,I),N;if(A===null){for(;I<w.length;I++)A=p(y,w[I],C),A!==null&&(v=o(A,v,I),j===null?N=A:j.sibling=A,j=A);return bn&&ya(y,I),N}for(A=r(y,A);I<w.length;I++)D=h(A,y,I,w[I],C),D!==null&&(e&&D.alternate!==null&&A.delete(D.key===null?I:D.key),v=o(D,v,I),j===null?N=D:j.sibling=D,j=D);return e&&A.forEach(function(W){return t(y,W)}),bn&&ya(y,I),N}function k(y,v,w,C){var N=cu(w);if(typeof N!="function")throw Error(Ee(150));if(w=N.call(w),w==null)throw Error(Ee(151));for(var j=N=null,A=v,I=v=0,D=null,B=w.next();A!==null&&!B.done;I++,B=w.next()){A.index>I?(D=A,A=null):D=A.sibling;var W=f(y,A,B.value,C);if(W===null){A===null&&(A=D);break}e&&A&&W.alternate===null&&t(y,A),v=o(W,v,I),j===null?N=W:j.sibling=W,j=W,A=D}if(B.done)return n(y,A),bn&&ya(y,I),N;if(A===null){for(;!B.done;I++,B=w.next())B=p(y,B.value,C),B!==null&&(v=o(B,v,I),j===null?N=B:j.sibling=B,j=B);return bn&&ya(y,I),N}for(A=r(y,A);!B.done;I++,B=w.next())B=h(A,y,I,B.value,C),B!==null&&(e&&B.alternate!==null&&A.delete(B.key===null?I:B.key),v=o(B,v,I),j===null?N=B:j.sibling=B,j=B);return e&&A.forEach(function(F){return t(y,F)}),bn&&ya(y,I),N}function b(y,v,w,C){if(typeof w=="object"&&w!==null&&w.type===Ll&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case Bf:e:{for(var N=w.key,j=v;j!==null;){if(j.key===N){if(N=w.type,N===Ll){if(j.tag===7){n(y,j.sibling),v=s(j,w.props.children),v.return=y,y=v;break e}}else if(j.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Co&&X0(N)===j.type){n(y,j.sibling),v=s(j,w.props),v.ref=hu(y,j,w),v.return=y,y=v;break e}n(y,j);break}else t(y,j);j=j.sibling}w.type===Ll?(v=Pa(w.props.children,y.mode,C,w.key),v.return=y,y=v):(C=qp(w.type,w.key,w.props,null,y.mode,C),C.ref=hu(y,v,w),C.return=y,y=C)}return a(y);case $l:e:{for(j=w.key;v!==null;){if(v.key===j)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){n(y,v.sibling),v=s(v,w.children||[]),v.return=y,y=v;break e}else{n(y,v);break}else t(y,v);v=v.sibling}v=py(w,y.mode,C),v.return=y,y=v}return a(y);case Co:return j=w._init,b(y,v,j(w._payload),C)}if(Au(w))return g(y,v,w,C);if(cu(w))return k(y,v,w,C);Qf(y,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(n(y,v.sibling),v=s(v,w),v.return=y,y=v):(n(y,v),v=fy(w,y.mode,C),v.return=y,y=v),a(y)):n(y,v)}return b}var hc=DE(!0),FE=DE(!1),bh=ta(null),kh=null,Vl=null,Mb=null;function $b(){Mb=Vl=kh=null}function Lb(e){var t=bh.current;yn(bh),e._currentValue=t}function Bw(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 nc(e,t){kh=e,Mb=Vl=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Wr=!0),e.firstContext=null)}function _s(e){var t=e._currentValue;if(Mb!==e)if(e={context:e,memoizedValue:t,next:null},Vl===null){if(kh===null)throw Error(Ee(308));Vl=e,kh.dependencies={lanes:0,firstContext:e}}else Vl=Vl.next=e;return t}var ja=null;function Ob(e){ja===null?ja=[e]:ja.push(e)}function zE(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Ob(t)):(n.next=s.next,s.next=n),t.interleaved=n,eo(e,r)}function eo(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 _o=!1;function Db(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function BE(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 Yi(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function zo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Bt&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,eo(e,n)}return s=r.interleaved,s===null?(t.next=t,Ob(r)):(t.next=s.next,s.next=t),r.interleaved=t,eo(e,n)}function zp(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Sb(e,n)}}function Q0(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,o=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};o===null?s=o=a:o=o.next=a,n=n.next}while(n!==null);o===null?s=o=t:o=o.next=t}else s=o=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function vh(e,t,n,r){var s=e.updateQueue;_o=!1;var o=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?o=u:a.next=u,a=c;var d=e.alternate;d!==null&&(d=d.updateQueue,l=d.lastBaseUpdate,l!==a&&(l===null?d.firstBaseUpdate=u:l.next=u,d.lastBaseUpdate=c))}if(o!==null){var p=s.baseState;a=0,d=u=c=null,l=o;do{var f=l.lane,h=l.eventTime;if((r&f)===f){d!==null&&(d=d.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,k=l;switch(f=t,h=n,k.tag){case 1:if(g=k.payload,typeof g=="function"){p=g.call(h,p,f);break e}p=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=k.payload,f=typeof g=="function"?g.call(h,p,f):g,f==null)break e;p=Pn({},p,f);break e;case 2:_o=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=s.effects,f===null?s.effects=[l]:f.push(l))}else h={eventTime:h,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=h,c=p):d=d.next=h,a|=f;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;f=l,l=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(d===null&&(c=p),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=d,t=s.shared.interleaved,t!==null){s=t;do a|=s.lane,s=s.next;while(s!==t)}else o===null&&(s.shared.lanes=0);za|=a,e.lanes=a,e.memoizedState=p}}function Z0(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(Ee(191,s));s.call(r)}}}var Yd={},ki=ta(Yd),md=ta(Yd),gd=ta(Yd);function Ca(e){if(e===Yd)throw Error(Ee(174));return e}function Fb(e,t){switch(cn(gd,t),cn(md,e),cn(ki,Yd),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:kw(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=kw(t,e)}yn(ki),cn(ki,t)}function mc(){yn(ki),yn(md),yn(gd)}function HE(e){Ca(gd.current);var t=Ca(ki.current),n=kw(t,e.type);t!==n&&(cn(md,e),cn(ki,n))}function zb(e){md.current===e&&(yn(ki),yn(md))}var _n=ta(0);function Sh(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 oy=[];function Bb(){for(var e=0;e<oy.length;e++)oy[e]._workInProgressVersionPrimary=null;oy.length=0}var Bp=io.ReactCurrentDispatcher,ay=io.ReactCurrentBatchConfig,Fa=0,An=null,Zn=null,ir=null,Nh=!1,Wu=!1,yd=0,eO=0;function br(){throw Error(Ee(321))}function Hb(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Xs(e[n],t[n]))return!1;return!0}function Wb(e,t,n,r,s,o){if(Fa=o,An=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Bp.current=e===null||e.memoizedState===null?sO:iO,e=n(r,s),Wu){o=0;do{if(Wu=!1,yd=0,25<=o)throw Error(Ee(301));o+=1,ir=Zn=null,t.updateQueue=null,Bp.current=oO,e=n(r,s)}while(Wu)}if(Bp.current=jh,t=Zn!==null&&Zn.next!==null,Fa=0,ir=Zn=An=null,Nh=!1,t)throw Error(Ee(300));return e}function Vb(){var e=yd!==0;return yd=0,e}function ui(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ir===null?An.memoizedState=ir=e:ir=ir.next=e,ir}function Es(){if(Zn===null){var e=An.alternate;e=e!==null?e.memoizedState:null}else e=Zn.next;var t=ir===null?An.memoizedState:ir.next;if(t!==null)ir=t,Zn=e;else{if(e===null)throw Error(Ee(310));Zn=e,e={memoizedState:Zn.memoizedState,baseState:Zn.baseState,baseQueue:Zn.baseQueue,queue:Zn.queue,next:null},ir===null?An.memoizedState=ir=e:ir=ir.next=e}return ir}function wd(e,t){return typeof t=="function"?t(e):t}function ly(e){var t=Es(),n=t.queue;if(n===null)throw Error(Ee(311));n.lastRenderedReducer=e;var r=Zn,s=r.baseQueue,o=n.pending;if(o!==null){if(s!==null){var a=s.next;s.next=o.next,o.next=a}r.baseQueue=s=o,n.pending=null}if(s!==null){o=s.next,r=r.baseState;var l=a=null,c=null,u=o;do{var d=u.lane;if((Fa&d)===d)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 p={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=p,a=r):c=c.next=p,An.lanes|=d,za|=d}u=u.next}while(u!==null&&u!==o);c===null?a=r:c.next=l,Xs(r,t.memoizedState)||(Wr=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do o=s.lane,An.lanes|=o,za|=o,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function cy(e){var t=Es(),n=t.queue;if(n===null)throw Error(Ee(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,o=t.memoizedState;if(s!==null){n.pending=null;var a=s=s.next;do o=e(o,a.action),a=a.next;while(a!==s);Xs(o,t.memoizedState)||(Wr=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function WE(){}function VE(e,t){var n=An,r=Es(),s=t(),o=!Xs(r.memoizedState,s);if(o&&(r.memoizedState=s,Wr=!0),r=r.queue,Kb(UE.bind(null,n,r,e),[e]),r.getSnapshot!==t||o||ir!==null&&ir.memoizedState.tag&1){if(n.flags|=2048,xd(9,qE.bind(null,n,r,s,t),void 0,null),ar===null)throw Error(Ee(349));Fa&30||KE(n,t,s)}return s}function KE(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=An.updateQueue,t===null?(t={lastEffect:null,stores:null},An.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function qE(e,t,n,r){t.value=n,t.getSnapshot=r,YE(t)&&GE(e)}function UE(e,t,n){return n(function(){YE(t)&&GE(e)})}function YE(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Xs(e,n)}catch{return!0}}function GE(e){var t=eo(e,1);t!==null&&Gs(t,e,1,-1)}function eN(e){var t=ui();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:wd,lastRenderedState:e},t.queue=e,e=e.dispatch=rO.bind(null,An,e),[t.memoizedState,e]}function xd(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=An.updateQueue,t===null?(t={lastEffect:null,stores:null},An.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 JE(){return Es().memoizedState}function Hp(e,t,n,r){var s=ui();An.flags|=e,s.memoizedState=xd(1|t,n,void 0,r===void 0?null:r)}function km(e,t,n,r){var s=Es();r=r===void 0?null:r;var o=void 0;if(Zn!==null){var a=Zn.memoizedState;if(o=a.destroy,r!==null&&Hb(r,a.deps)){s.memoizedState=xd(t,n,o,r);return}}An.flags|=e,s.memoizedState=xd(1|t,n,o,r)}function tN(e,t){return Hp(8390656,8,e,t)}function Kb(e,t){return km(2048,8,e,t)}function XE(e,t){return km(4,2,e,t)}function QE(e,t){return km(4,4,e,t)}function ZE(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 eA(e,t,n){return n=n!=null?n.concat([e]):null,km(4,4,ZE.bind(null,t,e),n)}function qb(){}function tA(e,t){var n=Es();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Hb(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function nA(e,t){var n=Es();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Hb(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function rA(e,t,n){return Fa&21?(Xs(n,t)||(n=lE(),An.lanes|=n,za|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Wr=!0),e.memoizedState=n)}function tO(e,t){var n=Qt;Qt=n!==0&&4>n?n:4,e(!0);var r=ay.transition;ay.transition={};try{e(!1),t()}finally{Qt=n,ay.transition=r}}function sA(){return Es().memoizedState}function nO(e,t,n){var r=Ho(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},iA(e))oA(t,n);else if(n=zE(e,t,n,r),n!==null){var s=Tr();Gs(n,e,r,s),aA(n,t,r)}}function rO(e,t,n){var r=Ho(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(iA(e))oA(t,s);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var a=t.lastRenderedState,l=o(a,n);if(s.hasEagerState=!0,s.eagerState=l,Xs(l,a)){var c=t.interleaved;c===null?(s.next=s,Ob(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=zE(e,t,s,r),n!==null&&(s=Tr(),Gs(n,e,r,s),aA(n,t,r))}}function iA(e){var t=e.alternate;return e===An||t!==null&&t===An}function oA(e,t){Wu=Nh=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function aA(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Sb(e,n)}}var jh={readContext:_s,useCallback:br,useContext:br,useEffect:br,useImperativeHandle:br,useInsertionEffect:br,useLayoutEffect:br,useMemo:br,useReducer:br,useRef:br,useState:br,useDebugValue:br,useDeferredValue:br,useTransition:br,useMutableSource:br,useSyncExternalStore:br,useId:br,unstable_isNewReconciler:!1},sO={readContext:_s,useCallback:function(e,t){return ui().memoizedState=[e,t===void 0?null:t],e},useContext:_s,useEffect:tN,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Hp(4194308,4,ZE.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Hp(4194308,4,e,t)},useInsertionEffect:function(e,t){return Hp(4,2,e,t)},useMemo:function(e,t){var n=ui();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ui();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=nO.bind(null,An,e),[r.memoizedState,e]},useRef:function(e){var t=ui();return e={current:e},t.memoizedState=e},useState:eN,useDebugValue:qb,useDeferredValue:function(e){return ui().memoizedState=e},useTransition:function(){var e=eN(!1),t=e[0];return e=tO.bind(null,e[1]),ui().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=An,s=ui();if(bn){if(n===void 0)throw Error(Ee(407));n=n()}else{if(n=t(),ar===null)throw Error(Ee(349));Fa&30||KE(r,t,n)}s.memoizedState=n;var o={value:n,getSnapshot:t};return s.queue=o,tN(UE.bind(null,r,o,e),[e]),r.flags|=2048,xd(9,qE.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=ui(),t=ar.identifierPrefix;if(bn){var n=Vi,r=Wi;n=(r&~(1<<32-Ys(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=yd++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=eO++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},iO={readContext:_s,useCallback:tA,useContext:_s,useEffect:Kb,useImperativeHandle:eA,useInsertionEffect:XE,useLayoutEffect:QE,useMemo:nA,useReducer:ly,useRef:JE,useState:function(){return ly(wd)},useDebugValue:qb,useDeferredValue:function(e){var t=Es();return rA(t,Zn.memoizedState,e)},useTransition:function(){var e=ly(wd)[0],t=Es().memoizedState;return[e,t]},useMutableSource:WE,useSyncExternalStore:VE,useId:sA,unstable_isNewReconciler:!1},oO={readContext:_s,useCallback:tA,useContext:_s,useEffect:Kb,useImperativeHandle:eA,useInsertionEffect:XE,useLayoutEffect:QE,useMemo:nA,useReducer:cy,useRef:JE,useState:function(){return cy(wd)},useDebugValue:qb,useDeferredValue:function(e){var t=Es();return Zn===null?t.memoizedState=e:rA(t,Zn.memoizedState,e)},useTransition:function(){var e=cy(wd)[0],t=Es().memoizedState;return[e,t]},useMutableSource:WE,useSyncExternalStore:VE,useId:sA,unstable_isNewReconciler:!1};function zs(e,t){if(e&&e.defaultProps){t=Pn({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Hw(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Pn({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var vm={isMounted:function(e){return(e=e._reactInternals)?nl(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Tr(),s=Ho(e),o=Yi(r,s);o.payload=t,n!=null&&(o.callback=n),t=zo(e,o,s),t!==null&&(Gs(t,e,s,r),zp(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Tr(),s=Ho(e),o=Yi(r,s);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=zo(e,o,s),t!==null&&(Gs(t,e,s,r),zp(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Tr(),r=Ho(e),s=Yi(n,r);s.tag=2,t!=null&&(s.callback=t),t=zo(e,s,r),t!==null&&(Gs(t,e,r,n),zp(t,e,r))}};function nN(e,t,n,r,s,o,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,o,a):t.prototype&&t.prototype.isPureReactComponent?!dd(n,r)||!dd(s,o):!0}function lA(e,t,n){var r=!1,s=Uo,o=t.contextType;return typeof o=="object"&&o!==null?o=_s(o):(s=Ur(t)?Oa:jr.current,r=t.contextTypes,o=(r=r!=null)?fc(e,s):Uo),t=new t(n,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=vm,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=o),t}function rN(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&&vm.enqueueReplaceState(t,t.state,null)}function Ww(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},Db(e);var o=t.contextType;typeof o=="object"&&o!==null?s.context=_s(o):(o=Ur(t)?Oa:jr.current,s.context=fc(e,o)),s.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(Hw(e,t,o,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&&vm.enqueueReplaceState(s,s.state,null),vh(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function gc(e,t){try{var n="",r=t;do n+=M2(r),r=r.return;while(r);var s=n}catch(o){s=`
|
|
39
|
-
Error generating stack: `+o.message+`
|
|
40
|
-
`+o.stack}return{value:e,source:t,stack:s,digest:null}}function uy(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Vw(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var aO=typeof WeakMap=="function"?WeakMap:Map;function cA(e,t,n){n=Yi(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){_h||(_h=!0,ex=r),Vw(e,t)},n}function uA(e,t,n){n=Yi(-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(){Vw(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){Vw(e,t),typeof r!="function"&&(Bo===null?Bo=new Set([this]):Bo.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function sN(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new aO;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=kO.bind(null,e,t,n),t.then(e,e))}function iN(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 oN(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=Yi(-1,1),t.tag=2,zo(n,t,1))),n.lanes|=1),e)}var lO=io.ReactCurrentOwner,Wr=!1;function Rr(e,t,n,r){t.child=e===null?FE(t,null,n,r):hc(t,e.child,n,r)}function aN(e,t,n,r,s){n=n.render;var o=t.ref;return nc(t,s),r=Wb(e,t,n,r,o,s),n=Vb(),e!==null&&!Wr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,to(e,t,s)):(bn&&n&&Ib(t),t.flags|=1,Rr(e,t,r,s),t.child)}function lN(e,t,n,r,s){if(e===null){var o=n.type;return typeof o=="function"&&!ek(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,dA(e,t,o,r,s)):(e=qp(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(o=e.child,!(e.lanes&s)){var a=o.memoizedProps;if(n=n.compare,n=n!==null?n:dd,n(a,r)&&e.ref===t.ref)return to(e,t,s)}return t.flags|=1,e=Wo(o,r),e.ref=t.ref,e.return=t,t.child=e}function dA(e,t,n,r,s){if(e!==null){var o=e.memoizedProps;if(dd(o,r)&&e.ref===t.ref)if(Wr=!1,t.pendingProps=r=o,(e.lanes&s)!==0)e.flags&131072&&(Wr=!0);else return t.lanes=e.lanes,to(e,t,s)}return Kw(e,t,n,r,s)}function fA(e,t,n){var r=t.pendingProps,s=r.children,o=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},cn(ql,ns),ns|=n;else{if(!(n&1073741824))return e=o!==null?o.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,cn(ql,ns),ns|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,cn(ql,ns),ns|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,cn(ql,ns),ns|=r;return Rr(e,t,s,n),t.child}function pA(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Kw(e,t,n,r,s){var o=Ur(n)?Oa:jr.current;return o=fc(t,o),nc(t,s),n=Wb(e,t,n,r,o,s),r=Vb(),e!==null&&!Wr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,to(e,t,s)):(bn&&r&&Ib(t),t.flags|=1,Rr(e,t,n,s),t.child)}function cN(e,t,n,r,s){if(Ur(n)){var o=!0;yh(t)}else o=!1;if(nc(t,s),t.stateNode===null)Wp(e,t),lA(t,n,r),Ww(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=_s(u):(u=Ur(n)?Oa:jr.current,u=fc(t,u));var d=n.getDerivedStateFromProps,p=typeof d=="function"||typeof a.getSnapshotBeforeUpdate=="function";p||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||c!==u)&&rN(t,a,r,u),_o=!1;var f=t.memoizedState;a.state=f,vh(t,r,a,s),c=t.memoizedState,l!==r||f!==c||qr.current||_o?(typeof d=="function"&&(Hw(t,n,d,r),c=t.memoizedState),(l=_o||nN(t,n,l,r,f,c,u))?(p||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,BE(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:zs(t.type,l),a.props=u,p=t.pendingProps,f=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=_s(c):(c=Ur(n)?Oa:jr.current,c=fc(t,c));var h=n.getDerivedStateFromProps;(d=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==p||f!==c)&&rN(t,a,r,c),_o=!1,f=t.memoizedState,a.state=f,vh(t,r,a,s);var g=t.memoizedState;l!==p||f!==g||qr.current||_o?(typeof h=="function"&&(Hw(t,n,h,r),g=t.memoizedState),(u=_o||nN(t,n,u,r,f,g,c)||!1)?(d||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,g,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,g,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),a.props=r,a.state=g,a.context=c,r=u):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return qw(e,t,n,r,o,s)}function qw(e,t,n,r,s,o){pA(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return s&&Y0(t,n,!1),to(e,t,o);r=t.stateNode,lO.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=hc(t,e.child,null,o),t.child=hc(t,null,l,o)):Rr(e,t,l,o),t.memoizedState=r.state,s&&Y0(t,n,!0),t.child}function hA(e){var t=e.stateNode;t.pendingContext?U0(e,t.pendingContext,t.pendingContext!==t.context):t.context&&U0(e,t.context,!1),Fb(e,t.containerInfo)}function uN(e,t,n,r,s){return pc(),Tb(s),t.flags|=256,Rr(e,t,n,r),t.child}var Uw={dehydrated:null,treeContext:null,retryLane:0};function Yw(e){return{baseLanes:e,cachePool:null,transitions:null}}function mA(e,t,n){var r=t.pendingProps,s=_n.current,o=!1,a=(t.flags&128)!==0,l;if((l=a)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(o=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),cn(_n,s&1),e===null)return zw(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,o?(r=t.mode,o=t.child,a={mode:"hidden",children:a},!(r&1)&&o!==null?(o.childLanes=0,o.pendingProps=a):o=jm(a,r,0,null),e=Pa(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=Yw(n),t.memoizedState=Uw,e):Ub(t,a));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return cO(e,t,a,r,l,s,n);if(o){o=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=Wo(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?o=Wo(l,o):(o=Pa(o,a,n,null),o.flags|=2),o.return=t,r.return=t,r.sibling=o,t.child=r,r=o,o=t.child,a=e.child.memoizedState,a=a===null?Yw(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},o.memoizedState=a,o.childLanes=e.childLanes&~n,t.memoizedState=Uw,r}return o=e.child,e=o.sibling,r=Wo(o,{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 Ub(e,t){return t=jm({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Zf(e,t,n,r){return r!==null&&Tb(r),hc(t,e.child,null,n),e=Ub(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function cO(e,t,n,r,s,o,a){if(n)return t.flags&256?(t.flags&=-257,r=uy(Error(Ee(422))),Zf(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,s=t.mode,r=jm({mode:"visible",children:r.children},s,0,null),o=Pa(o,s,a,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,t.mode&1&&hc(t,e.child,null,a),t.child.memoizedState=Yw(a),t.memoizedState=Uw,o);if(!(t.mode&1))return Zf(e,t,a,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,o=Error(Ee(419)),r=uy(o,r,void 0),Zf(e,t,a,r)}if(l=(a&e.childLanes)!==0,Wr||l){if(r=ar,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!==o.retryLane&&(o.retryLane=s,eo(e,s),Gs(r,e,s,-1))}return Zb(),r=uy(Error(Ee(421))),Zf(e,t,a,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=vO.bind(null,e),s._reactRetry=t,null):(e=o.treeContext,is=Fo(s.nextSibling),as=t,bn=!0,Ws=null,e!==null&&(ks[vs++]=Wi,ks[vs++]=Vi,ks[vs++]=Da,Wi=e.id,Vi=e.overflow,Da=t),t=Ub(t,r.children),t.flags|=4096,t)}function dN(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Bw(e.return,t,n)}function dy(e,t,n,r,s){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=s)}function gA(e,t,n){var r=t.pendingProps,s=r.revealOrder,o=r.tail;if(Rr(e,t,r.children,n),r=_n.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&&dN(e,n,t);else if(e.tag===19)dN(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(cn(_n,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&&Sh(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),dy(t,!1,s,n,o);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&Sh(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}dy(t,!0,n,null,o);break;case"together":dy(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Wp(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function to(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),za|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(Ee(153));if(t.child!==null){for(e=t.child,n=Wo(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Wo(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function uO(e,t,n){switch(t.tag){case 3:hA(t),pc();break;case 5:HE(t);break;case 1:Ur(t.type)&&yh(t);break;case 4:Fb(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;cn(bh,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(cn(_n,_n.current&1),t.flags|=128,null):n&t.child.childLanes?mA(e,t,n):(cn(_n,_n.current&1),e=to(e,t,n),e!==null?e.sibling:null);cn(_n,_n.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return gA(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),cn(_n,_n.current),r)break;return null;case 22:case 23:return t.lanes=0,fA(e,t,n)}return to(e,t,n)}var yA,Gw,wA,xA;yA=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}};Gw=function(){};wA=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,Ca(ki.current);var o=null;switch(n){case"input":s=yw(e,s),r=yw(e,r),o=[];break;case"select":s=Pn({},s,{value:void 0}),r=Pn({},r,{value:void 0}),o=[];break;case"textarea":s=bw(e,s),r=bw(e,r),o=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=mh)}vw(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"&&(sd.hasOwnProperty(u)?o||(o=[]):(o=o||[]).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||(o||(o=[]),o.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(o=o||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(o=o||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(sd.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&mn("scroll",e),o||l===c||(o=[])):(o=o||[]).push(u,c))}n&&(o=o||[]).push("style",n);var u=o;(t.updateQueue=u)&&(t.flags|=4)}};xA=function(e,t,n,r){n!==r&&(t.flags|=4)};function mu(e,t){if(!bn)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 kr(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 dO(e,t,n){var r=t.pendingProps;switch(Rb(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return kr(t),null;case 1:return Ur(t.type)&&gh(),kr(t),null;case 3:return r=t.stateNode,mc(),yn(qr),yn(jr),Bb(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Xf(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ws!==null&&(rx(Ws),Ws=null))),Gw(e,t),kr(t),null;case 5:zb(t);var s=Ca(gd.current);if(n=t.type,e!==null&&t.stateNode!=null)wA(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(Ee(166));return kr(t),null}if(e=Ca(ki.current),Xf(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[hi]=t,r[hd]=o,e=(t.mode&1)!==0,n){case"dialog":mn("cancel",r),mn("close",r);break;case"iframe":case"object":case"embed":mn("load",r);break;case"video":case"audio":for(s=0;s<Iu.length;s++)mn(Iu[s],r);break;case"source":mn("error",r);break;case"img":case"image":case"link":mn("error",r),mn("load",r);break;case"details":mn("toggle",r);break;case"input":b0(r,o),mn("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},mn("invalid",r);break;case"textarea":v0(r,o),mn("invalid",r)}vw(n,o),s=null;for(var a in o)if(o.hasOwnProperty(a)){var l=o[a];a==="children"?typeof l=="string"?r.textContent!==l&&(o.suppressHydrationWarning!==!0&&Jf(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(o.suppressHydrationWarning!==!0&&Jf(r.textContent,l,e),s=["children",""+l]):sd.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&mn("scroll",r)}switch(n){case"input":Hf(r),k0(r,o,!0);break;case"textarea":Hf(r),S0(r);break;case"select":case"option":break;default:typeof o.onClick=="function"&&(r.onclick=mh)}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=U_(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[hi]=t,e[hd]=r,yA(e,t,!1,!1),t.stateNode=e;e:{switch(a=Sw(n,r),n){case"dialog":mn("cancel",e),mn("close",e),s=r;break;case"iframe":case"object":case"embed":mn("load",e),s=r;break;case"video":case"audio":for(s=0;s<Iu.length;s++)mn(Iu[s],e);s=r;break;case"source":mn("error",e),s=r;break;case"img":case"image":case"link":mn("error",e),mn("load",e),s=r;break;case"details":mn("toggle",e),s=r;break;case"input":b0(e,r),s=yw(e,r),mn("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=Pn({},r,{value:void 0}),mn("invalid",e);break;case"textarea":v0(e,r),s=bw(e,r),mn("invalid",e);break;default:s=r}vw(n,s),l=s;for(o in l)if(l.hasOwnProperty(o)){var c=l[o];o==="style"?J_(e,c):o==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Y_(e,c)):o==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&id(e,c):typeof c=="number"&&id(e,""+c):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(sd.hasOwnProperty(o)?c!=null&&o==="onScroll"&&mn("scroll",e):c!=null&&yb(e,o,c,a))}switch(n){case"input":Hf(e),k0(e,r,!1);break;case"textarea":Hf(e),S0(e);break;case"option":r.value!=null&&e.setAttribute("value",""+qo(r.value));break;case"select":e.multiple=!!r.multiple,o=r.value,o!=null?Ql(e,!!r.multiple,o,!1):r.defaultValue!=null&&Ql(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=mh)}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 kr(t),null;case 6:if(e&&t.stateNode!=null)xA(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Ee(166));if(n=Ca(gd.current),Ca(ki.current),Xf(t)){if(r=t.stateNode,n=t.memoizedProps,r[hi]=t,(o=r.nodeValue!==n)&&(e=as,e!==null))switch(e.tag){case 3:Jf(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Jf(r.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[hi]=t,t.stateNode=r}return kr(t),null;case 13:if(yn(_n),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(bn&&is!==null&&t.mode&1&&!(t.flags&128))OE(),pc(),t.flags|=98560,o=!1;else if(o=Xf(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(Ee(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(Ee(317));o[hi]=t}else pc(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;kr(t),o=!1}else Ws!==null&&(rx(Ws),Ws=null),o=!0;if(!o)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||_n.current&1?er===0&&(er=3):Zb())),t.updateQueue!==null&&(t.flags|=4),kr(t),null);case 4:return mc(),Gw(e,t),e===null&&fd(t.stateNode.containerInfo),kr(t),null;case 10:return Lb(t.type._context),kr(t),null;case 17:return Ur(t.type)&&gh(),kr(t),null;case 19:if(yn(_n),o=t.memoizedState,o===null)return kr(t),null;if(r=(t.flags&128)!==0,a=o.rendering,a===null)if(r)mu(o,!1);else{if(er!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Sh(e),a!==null){for(t.flags|=128,mu(o,!1),r=a.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)o=n,e=r,o.flags&=14680066,a=o.alternate,a===null?(o.childLanes=0,o.lanes=e,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=a.childLanes,o.lanes=a.lanes,o.child=a.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=a.memoizedProps,o.memoizedState=a.memoizedState,o.updateQueue=a.updateQueue,o.type=a.type,e=a.dependencies,o.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return cn(_n,_n.current&1|2),t.child}e=e.sibling}o.tail!==null&&Dn()>yc&&(t.flags|=128,r=!0,mu(o,!1),t.lanes=4194304)}else{if(!r)if(e=Sh(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),mu(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!bn)return kr(t),null}else 2*Dn()-o.renderingStartTime>yc&&n!==1073741824&&(t.flags|=128,r=!0,mu(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(n=o.last,n!==null?n.sibling=a:t.child=a,o.last=a)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Dn(),t.sibling=null,n=_n.current,cn(_n,r?n&1|2:n&1),t):(kr(t),null);case 22:case 23:return Qb(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ns&1073741824&&(kr(t),t.subtreeFlags&6&&(t.flags|=8192)):kr(t),null;case 24:return null;case 25:return null}throw Error(Ee(156,t.tag))}function fO(e,t){switch(Rb(t),t.tag){case 1:return Ur(t.type)&&gh(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return mc(),yn(qr),yn(jr),Bb(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return zb(t),null;case 13:if(yn(_n),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ee(340));pc()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return yn(_n),null;case 4:return mc(),null;case 10:return Lb(t.type._context),null;case 22:case 23:return Qb(),null;case 24:return null;default:return null}}var ep=!1,vr=!1,pO=typeof WeakSet=="function"?WeakSet:Set,Qe=null;function Kl(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Tn(e,t,r)}else n.current=null}function Jw(e,t,n){try{n()}catch(r){Tn(e,t,r)}}var fN=!1;function hO(e,t){if(Tw=fh,e=NE(),Pb(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,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var a=0,l=-1,c=-1,u=0,d=0,p=e,f=null;t:for(;;){for(var h;p!==n||s!==0&&p.nodeType!==3||(l=a+s),p!==o||r!==0&&p.nodeType!==3||(c=a+r),p.nodeType===3&&(a+=p.nodeValue.length),(h=p.firstChild)!==null;)f=p,p=h;for(;;){if(p===e)break t;if(f===n&&++u===s&&(l=a),f===o&&++d===r&&(c=a),(h=p.nextSibling)!==null)break;p=f,f=p.parentNode}p=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Mw={focusedElem:e,selectionRange:n},fh=!1,Qe=t;Qe!==null;)if(t=Qe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Qe=e;else for(;Qe!==null;){t=Qe;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var k=g.memoizedProps,b=g.memoizedState,y=t.stateNode,v=y.getSnapshotBeforeUpdate(t.elementType===t.type?k:zs(t.type,k),b);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ee(163))}}catch(C){Tn(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,Qe=e;break}Qe=t.return}return g=fN,fN=!1,g}function Vu(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 o=s.destroy;s.destroy=void 0,o!==void 0&&Jw(t,n,o)}s=s.next}while(s!==r)}}function Sm(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Xw(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 bA(e){var t=e.alternate;t!==null&&(e.alternate=null,bA(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[hi],delete t[hd],delete t[Ow],delete t[JL],delete t[XL])),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 kA(e){return e.tag===5||e.tag===3||e.tag===4}function pN(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||kA(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 Qw(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=mh));else if(r!==4&&(e=e.child,e!==null))for(Qw(e,t,n),e=e.sibling;e!==null;)Qw(e,t,n),e=e.sibling}function Zw(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(Zw(e,t,n),e=e.sibling;e!==null;)Zw(e,t,n),e=e.sibling}var fr=null,Bs=!1;function bo(e,t,n){for(n=n.child;n!==null;)vA(e,t,n),n=n.sibling}function vA(e,t,n){if(bi&&typeof bi.onCommitFiberUnmount=="function")try{bi.onCommitFiberUnmount(mm,n)}catch{}switch(n.tag){case 5:vr||Kl(n,t);case 6:var r=fr,s=Bs;fr=null,bo(e,t,n),fr=r,Bs=s,fr!==null&&(Bs?(e=fr,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):fr.removeChild(n.stateNode));break;case 18:fr!==null&&(Bs?(e=fr,n=n.stateNode,e.nodeType===8?sy(e.parentNode,n):e.nodeType===1&&sy(e,n),cd(e)):sy(fr,n.stateNode));break;case 4:r=fr,s=Bs,fr=n.stateNode.containerInfo,Bs=!0,bo(e,t,n),fr=r,Bs=s;break;case 0:case 11:case 14:case 15:if(!vr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var o=s,a=o.destroy;o=o.tag,a!==void 0&&(o&2||o&4)&&Jw(n,t,a),s=s.next}while(s!==r)}bo(e,t,n);break;case 1:if(!vr&&(Kl(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Tn(n,t,l)}bo(e,t,n);break;case 21:bo(e,t,n);break;case 22:n.mode&1?(vr=(r=vr)||n.memoizedState!==null,bo(e,t,n),vr=r):bo(e,t,n);break;default:bo(e,t,n)}}function hN(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new pO),t.forEach(function(r){var s=SO.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Os(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var o=e,a=t,l=a;e:for(;l!==null;){switch(l.tag){case 5:fr=l.stateNode,Bs=!1;break e;case 3:fr=l.stateNode.containerInfo,Bs=!0;break e;case 4:fr=l.stateNode.containerInfo,Bs=!0;break e}l=l.return}if(fr===null)throw Error(Ee(160));vA(o,a,s),fr=null,Bs=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){Tn(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)SA(t,e),t=t.sibling}function SA(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Os(t,e),ai(e),r&4){try{Vu(3,e,e.return),Sm(3,e)}catch(k){Tn(e,e.return,k)}try{Vu(5,e,e.return)}catch(k){Tn(e,e.return,k)}}break;case 1:Os(t,e),ai(e),r&512&&n!==null&&Kl(n,n.return);break;case 5:if(Os(t,e),ai(e),r&512&&n!==null&&Kl(n,n.return),e.flags&32){var s=e.stateNode;try{id(s,"")}catch(k){Tn(e,e.return,k)}}if(r&4&&(s=e.stateNode,s!=null)){var o=e.memoizedProps,a=n!==null?n.memoizedProps:o,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&o.type==="radio"&&o.name!=null&&K_(s,o),Sw(l,a);var u=Sw(l,o);for(a=0;a<c.length;a+=2){var d=c[a],p=c[a+1];d==="style"?J_(s,p):d==="dangerouslySetInnerHTML"?Y_(s,p):d==="children"?id(s,p):yb(s,d,p,u)}switch(l){case"input":ww(s,o);break;case"textarea":q_(s,o);break;case"select":var f=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!o.multiple;var h=o.value;h!=null?Ql(s,!!o.multiple,h,!1):f!==!!o.multiple&&(o.defaultValue!=null?Ql(s,!!o.multiple,o.defaultValue,!0):Ql(s,!!o.multiple,o.multiple?[]:"",!1))}s[hd]=o}catch(k){Tn(e,e.return,k)}}break;case 6:if(Os(t,e),ai(e),r&4){if(e.stateNode===null)throw Error(Ee(162));s=e.stateNode,o=e.memoizedProps;try{s.nodeValue=o}catch(k){Tn(e,e.return,k)}}break;case 3:if(Os(t,e),ai(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{cd(t.containerInfo)}catch(k){Tn(e,e.return,k)}break;case 4:Os(t,e),ai(e);break;case 13:Os(t,e),ai(e),s=e.child,s.flags&8192&&(o=s.memoizedState!==null,s.stateNode.isHidden=o,!o||s.alternate!==null&&s.alternate.memoizedState!==null||(Jb=Dn())),r&4&&hN(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(vr=(u=vr)||d,Os(t,e),vr=u):Os(t,e),ai(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(Qe=e,d=e.child;d!==null;){for(p=Qe=d;Qe!==null;){switch(f=Qe,h=f.child,f.tag){case 0:case 11:case 14:case 15:Vu(4,f,f.return);break;case 1:Kl(f,f.return);var g=f.stateNode;if(typeof g.componentWillUnmount=="function"){r=f,n=f.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(k){Tn(r,n,k)}}break;case 5:Kl(f,f.return);break;case 22:if(f.memoizedState!==null){gN(p);continue}}h!==null?(h.return=f,Qe=h):gN(p)}d=d.sibling}e:for(d=null,p=e;;){if(p.tag===5){if(d===null){d=p;try{s=p.stateNode,u?(o=s.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(l=p.stateNode,c=p.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=G_("display",a))}catch(k){Tn(e,e.return,k)}}}else if(p.tag===6){if(d===null)try{p.stateNode.nodeValue=u?"":p.memoizedProps}catch(k){Tn(e,e.return,k)}}else if((p.tag!==22&&p.tag!==23||p.memoizedState===null||p===e)&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===e)break e;for(;p.sibling===null;){if(p.return===null||p.return===e)break e;d===p&&(d=null),p=p.return}d===p&&(d=null),p.sibling.return=p.return,p=p.sibling}}break;case 19:Os(t,e),ai(e),r&4&&hN(e);break;case 21:break;default:Os(t,e),ai(e)}}function ai(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(kA(n)){var r=n;break e}n=n.return}throw Error(Ee(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(id(s,""),r.flags&=-33);var o=pN(e);Zw(e,o,s);break;case 3:case 4:var a=r.stateNode.containerInfo,l=pN(e);Qw(e,l,a);break;default:throw Error(Ee(161))}}catch(c){Tn(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function mO(e,t,n){Qe=e,NA(e)}function NA(e,t,n){for(var r=(e.mode&1)!==0;Qe!==null;){var s=Qe,o=s.child;if(s.tag===22&&r){var a=s.memoizedState!==null||ep;if(!a){var l=s.alternate,c=l!==null&&l.memoizedState!==null||vr;l=ep;var u=vr;if(ep=a,(vr=c)&&!u)for(Qe=s;Qe!==null;)a=Qe,c=a.child,a.tag===22&&a.memoizedState!==null?yN(s):c!==null?(c.return=a,Qe=c):yN(s);for(;o!==null;)Qe=o,NA(o),o=o.sibling;Qe=s,ep=l,vr=u}mN(e)}else s.subtreeFlags&8772&&o!==null?(o.return=s,Qe=o):mN(e)}}function mN(e){for(;Qe!==null;){var t=Qe;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:vr||Sm(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!vr)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:zs(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&Z0(t,o,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}Z0(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 d=u.memoizedState;if(d!==null){var p=d.dehydrated;p!==null&&cd(p)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Ee(163))}vr||t.flags&512&&Xw(t)}catch(f){Tn(t,t.return,f)}}if(t===e){Qe=null;break}if(n=t.sibling,n!==null){n.return=t.return,Qe=n;break}Qe=t.return}}function gN(e){for(;Qe!==null;){var t=Qe;if(t===e){Qe=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Qe=n;break}Qe=t.return}}function yN(e){for(;Qe!==null;){var t=Qe;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Sm(4,t)}catch(c){Tn(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){Tn(t,s,c)}}var o=t.return;try{Xw(t)}catch(c){Tn(t,o,c)}break;case 5:var a=t.return;try{Xw(t)}catch(c){Tn(t,a,c)}}}catch(c){Tn(t,t.return,c)}if(t===e){Qe=null;break}var l=t.sibling;if(l!==null){l.return=t.return,Qe=l;break}Qe=t.return}}var gO=Math.ceil,Ch=io.ReactCurrentDispatcher,Yb=io.ReactCurrentOwner,Cs=io.ReactCurrentBatchConfig,Bt=0,ar=null,Wn=null,pr=0,ns=0,ql=ta(0),er=0,bd=null,za=0,Nm=0,Gb=0,Ku=null,Br=null,Jb=0,yc=1/0,zi=null,_h=!1,ex=null,Bo=null,tp=!1,To=null,Eh=0,qu=0,tx=null,Vp=-1,Kp=0;function Tr(){return Bt&6?Dn():Vp!==-1?Vp:Vp=Dn()}function Ho(e){return e.mode&1?Bt&2&&pr!==0?pr&-pr:ZL.transition!==null?(Kp===0&&(Kp=lE()),Kp):(e=Qt,e!==0||(e=window.event,e=e===void 0?16:mE(e.type)),e):1}function Gs(e,t,n,r){if(50<qu)throw qu=0,tx=null,Error(Ee(185));Kd(e,n,r),(!(Bt&2)||e!==ar)&&(e===ar&&(!(Bt&2)&&(Nm|=n),er===4&&Po(e,pr)),Yr(e,r),n===1&&Bt===0&&!(t.mode&1)&&(yc=Dn()+500,bm&&na()))}function Yr(e,t){var n=e.callbackNode;Z2(e,t);var r=dh(e,e===ar?pr:0);if(r===0)n!==null&&C0(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&C0(n),t===1)e.tag===0?QL(wN.bind(null,e)):ME(wN.bind(null,e)),YL(function(){!(Bt&6)&&na()}),n=null;else{switch(cE(r)){case 1:n=vb;break;case 4:n=oE;break;case 16:n=uh;break;case 536870912:n=aE;break;default:n=uh}n=RA(n,jA.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function jA(e,t){if(Vp=-1,Kp=0,Bt&6)throw Error(Ee(327));var n=e.callbackNode;if(rc()&&e.callbackNode!==n)return null;var r=dh(e,e===ar?pr:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Ah(e,r);else{t=r;var s=Bt;Bt|=2;var o=_A();(ar!==e||pr!==t)&&(zi=null,yc=Dn()+500,Aa(e,t));do try{xO();break}catch(l){CA(e,l)}while(!0);$b(),Ch.current=o,Bt=s,Wn!==null?t=0:(ar=null,pr=0,t=er)}if(t!==0){if(t===2&&(s=Ew(e),s!==0&&(r=s,t=nx(e,s))),t===1)throw n=bd,Aa(e,0),Po(e,r),Yr(e,Dn()),n;if(t===6)Po(e,r);else{if(s=e.current.alternate,!(r&30)&&!yO(s)&&(t=Ah(e,r),t===2&&(o=Ew(e),o!==0&&(r=o,t=nx(e,o))),t===1))throw n=bd,Aa(e,0),Po(e,r),Yr(e,Dn()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(Ee(345));case 2:wa(e,Br,zi);break;case 3:if(Po(e,r),(r&130023424)===r&&(t=Jb+500-Dn(),10<t)){if(dh(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){Tr(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Lw(wa.bind(null,e,Br,zi),t);break}wa(e,Br,zi);break;case 4:if(Po(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var a=31-Ys(r);o=1<<a,a=t[a],a>s&&(s=a),r&=~o}if(r=s,r=Dn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*gO(r/1960))-r,10<r){e.timeoutHandle=Lw(wa.bind(null,e,Br,zi),r);break}wa(e,Br,zi);break;case 5:wa(e,Br,zi);break;default:throw Error(Ee(329))}}}return Yr(e,Dn()),e.callbackNode===n?jA.bind(null,e):null}function nx(e,t){var n=Ku;return e.current.memoizedState.isDehydrated&&(Aa(e,t).flags|=256),e=Ah(e,t),e!==2&&(t=Br,Br=n,t!==null&&rx(t)),e}function rx(e){Br===null?Br=e:Br.push.apply(Br,e)}function yO(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],o=s.getSnapshot;s=s.value;try{if(!Xs(o(),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 Po(e,t){for(t&=~Gb,t&=~Nm,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Ys(t),r=1<<n;e[n]=-1,t&=~r}}function wN(e){if(Bt&6)throw Error(Ee(327));rc();var t=dh(e,0);if(!(t&1))return Yr(e,Dn()),null;var n=Ah(e,t);if(e.tag!==0&&n===2){var r=Ew(e);r!==0&&(t=r,n=nx(e,r))}if(n===1)throw n=bd,Aa(e,0),Po(e,t),Yr(e,Dn()),n;if(n===6)throw Error(Ee(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,wa(e,Br,zi),Yr(e,Dn()),null}function Xb(e,t){var n=Bt;Bt|=1;try{return e(t)}finally{Bt=n,Bt===0&&(yc=Dn()+500,bm&&na())}}function Ba(e){To!==null&&To.tag===0&&!(Bt&6)&&rc();var t=Bt;Bt|=1;var n=Cs.transition,r=Qt;try{if(Cs.transition=null,Qt=1,e)return e()}finally{Qt=r,Cs.transition=n,Bt=t,!(Bt&6)&&na()}}function Qb(){ns=ql.current,yn(ql)}function Aa(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,UL(n)),Wn!==null)for(n=Wn.return;n!==null;){var r=n;switch(Rb(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&gh();break;case 3:mc(),yn(qr),yn(jr),Bb();break;case 5:zb(r);break;case 4:mc();break;case 13:yn(_n);break;case 19:yn(_n);break;case 10:Lb(r.type._context);break;case 22:case 23:Qb()}n=n.return}if(ar=e,Wn=e=Wo(e.current,null),pr=ns=t,er=0,bd=null,Gb=Nm=za=0,Br=Ku=null,ja!==null){for(t=0;t<ja.length;t++)if(n=ja[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,o=n.pending;if(o!==null){var a=o.next;o.next=s,r.next=a}n.pending=r}ja=null}return e}function CA(e,t){do{var n=Wn;try{if($b(),Bp.current=jh,Nh){for(var r=An.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Nh=!1}if(Fa=0,ir=Zn=An=null,Wu=!1,yd=0,Yb.current=null,n===null||n.return===null){er=1,bd=t,Wn=null;break}e:{var o=e,a=n.return,l=n,c=t;if(t=pr,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,p=d.tag;if(!(d.mode&1)&&(p===0||p===11||p===15)){var f=d.alternate;f?(d.updateQueue=f.updateQueue,d.memoizedState=f.memoizedState,d.lanes=f.lanes):(d.updateQueue=null,d.memoizedState=null)}var h=iN(a);if(h!==null){h.flags&=-257,oN(h,a,l,o,t),h.mode&1&&sN(o,u,t),t=h,c=u;var g=t.updateQueue;if(g===null){var k=new Set;k.add(c),t.updateQueue=k}else g.add(c);break e}else{if(!(t&1)){sN(o,u,t),Zb();break e}c=Error(Ee(426))}}else if(bn&&l.mode&1){var b=iN(a);if(b!==null){!(b.flags&65536)&&(b.flags|=256),oN(b,a,l,o,t),Tb(gc(c,l));break e}}o=c=gc(c,l),er!==4&&(er=2),Ku===null?Ku=[o]:Ku.push(o),o=a;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var y=cA(o,c,t);Q0(o,y);break e;case 1:l=c;var v=o.type,w=o.stateNode;if(!(o.flags&128)&&(typeof v.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Bo===null||!Bo.has(w)))){o.flags|=65536,t&=-t,o.lanes|=t;var C=uA(o,l,t);Q0(o,C);break e}}o=o.return}while(o!==null)}AA(n)}catch(N){t=N,Wn===n&&n!==null&&(Wn=n=n.return);continue}break}while(!0)}function _A(){var e=Ch.current;return Ch.current=jh,e===null?jh:e}function Zb(){(er===0||er===3||er===2)&&(er=4),ar===null||!(za&268435455)&&!(Nm&268435455)||Po(ar,pr)}function Ah(e,t){var n=Bt;Bt|=2;var r=_A();(ar!==e||pr!==t)&&(zi=null,Aa(e,t));do try{wO();break}catch(s){CA(e,s)}while(!0);if($b(),Bt=n,Ch.current=r,Wn!==null)throw Error(Ee(261));return ar=null,pr=0,er}function wO(){for(;Wn!==null;)EA(Wn)}function xO(){for(;Wn!==null&&!V2();)EA(Wn)}function EA(e){var t=IA(e.alternate,e,ns);e.memoizedProps=e.pendingProps,t===null?AA(e):Wn=t,Yb.current=null}function AA(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=fO(n,t),n!==null){n.flags&=32767,Wn=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{er=6,Wn=null;return}}else if(n=dO(n,t,ns),n!==null){Wn=n;return}if(t=t.sibling,t!==null){Wn=t;return}Wn=t=e}while(t!==null);er===0&&(er=5)}function wa(e,t,n){var r=Qt,s=Cs.transition;try{Cs.transition=null,Qt=1,bO(e,t,n,r)}finally{Cs.transition=s,Qt=r}return null}function bO(e,t,n,r){do rc();while(To!==null);if(Bt&6)throw Error(Ee(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(Ee(177));e.callbackNode=null,e.callbackPriority=0;var o=n.lanes|n.childLanes;if(eL(e,o),e===ar&&(Wn=ar=null,pr=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||tp||(tp=!0,RA(uh,function(){return rc(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=Cs.transition,Cs.transition=null;var a=Qt;Qt=1;var l=Bt;Bt|=4,Yb.current=null,hO(e,n),SA(n,e),zL(Mw),fh=!!Tw,Mw=Tw=null,e.current=n,mO(n),K2(),Bt=l,Qt=a,Cs.transition=o}else e.current=n;if(tp&&(tp=!1,To=e,Eh=s),o=e.pendingLanes,o===0&&(Bo=null),Y2(n.stateNode),Yr(e,Dn()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)s=t[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(_h)throw _h=!1,e=ex,ex=null,e;return Eh&1&&e.tag!==0&&rc(),o=e.pendingLanes,o&1?e===tx?qu++:(qu=0,tx=e):qu=0,na(),null}function rc(){if(To!==null){var e=cE(Eh),t=Cs.transition,n=Qt;try{if(Cs.transition=null,Qt=16>e?16:e,To===null)var r=!1;else{if(e=To,To=null,Eh=0,Bt&6)throw Error(Ee(331));var s=Bt;for(Bt|=4,Qe=e.current;Qe!==null;){var o=Qe,a=o.child;if(Qe.flags&16){var l=o.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(Qe=u;Qe!==null;){var d=Qe;switch(d.tag){case 0:case 11:case 15:Vu(8,d,o)}var p=d.child;if(p!==null)p.return=d,Qe=p;else for(;Qe!==null;){d=Qe;var f=d.sibling,h=d.return;if(bA(d),d===u){Qe=null;break}if(f!==null){f.return=h,Qe=f;break}Qe=h}}}var g=o.alternate;if(g!==null){var k=g.child;if(k!==null){g.child=null;do{var b=k.sibling;k.sibling=null,k=b}while(k!==null)}}Qe=o}}if(o.subtreeFlags&2064&&a!==null)a.return=o,Qe=a;else e:for(;Qe!==null;){if(o=Qe,o.flags&2048)switch(o.tag){case 0:case 11:case 15:Vu(9,o,o.return)}var y=o.sibling;if(y!==null){y.return=o.return,Qe=y;break e}Qe=o.return}}var v=e.current;for(Qe=v;Qe!==null;){a=Qe;var w=a.child;if(a.subtreeFlags&2064&&w!==null)w.return=a,Qe=w;else e:for(a=v;Qe!==null;){if(l=Qe,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Sm(9,l)}}catch(N){Tn(l,l.return,N)}if(l===a){Qe=null;break e}var C=l.sibling;if(C!==null){C.return=l.return,Qe=C;break e}Qe=l.return}}if(Bt=s,na(),bi&&typeof bi.onPostCommitFiberRoot=="function")try{bi.onPostCommitFiberRoot(mm,e)}catch{}r=!0}return r}finally{Qt=n,Cs.transition=t}}return!1}function xN(e,t,n){t=gc(n,t),t=cA(e,t,1),e=zo(e,t,1),t=Tr(),e!==null&&(Kd(e,1,t),Yr(e,t))}function Tn(e,t,n){if(e.tag===3)xN(e,e,n);else for(;t!==null;){if(t.tag===3){xN(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Bo===null||!Bo.has(r))){e=gc(n,e),e=uA(t,e,1),t=zo(t,e,1),e=Tr(),t!==null&&(Kd(t,1,e),Yr(t,e));break}}t=t.return}}function kO(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Tr(),e.pingedLanes|=e.suspendedLanes&n,ar===e&&(pr&n)===n&&(er===4||er===3&&(pr&130023424)===pr&&500>Dn()-Jb?Aa(e,0):Gb|=n),Yr(e,t)}function PA(e,t){t===0&&(e.mode&1?(t=Kf,Kf<<=1,!(Kf&130023424)&&(Kf=4194304)):t=1);var n=Tr();e=eo(e,t),e!==null&&(Kd(e,t,n),Yr(e,n))}function vO(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),PA(e,n)}function SO(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(Ee(314))}r!==null&&r.delete(t),PA(e,n)}var IA;IA=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||qr.current)Wr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Wr=!1,uO(e,t,n);Wr=!!(e.flags&131072)}else Wr=!1,bn&&t.flags&1048576&&$E(t,xh,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Wp(e,t),e=t.pendingProps;var s=fc(t,jr.current);nc(t,n),s=Wb(null,t,r,e,s,n);var o=Vb();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,Ur(r)?(o=!0,yh(t)):o=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Db(t),s.updater=vm,t.stateNode=s,s._reactInternals=t,Ww(t,r,e,n),t=qw(null,t,r,!0,o,n)):(t.tag=0,bn&&o&&Ib(t),Rr(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Wp(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=jO(r),e=zs(r,e),s){case 0:t=Kw(null,t,r,e,n);break e;case 1:t=cN(null,t,r,e,n);break e;case 11:t=aN(null,t,r,e,n);break e;case 14:t=lN(null,t,r,zs(r.type,e),n);break e}throw Error(Ee(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:zs(r,s),Kw(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:zs(r,s),cN(e,t,r,s,n);case 3:e:{if(hA(t),e===null)throw Error(Ee(387));r=t.pendingProps,o=t.memoizedState,s=o.element,BE(e,t),vh(t,r,null,n);var a=t.memoizedState;if(r=a.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){s=gc(Error(Ee(423)),t),t=uN(e,t,r,n,s);break e}else if(r!==s){s=gc(Error(Ee(424)),t),t=uN(e,t,r,n,s);break e}else for(is=Fo(t.stateNode.containerInfo.firstChild),as=t,bn=!0,Ws=null,n=FE(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(pc(),r===s){t=to(e,t,n);break e}Rr(e,t,r,n)}t=t.child}return t;case 5:return HE(t),e===null&&zw(t),r=t.type,s=t.pendingProps,o=e!==null?e.memoizedProps:null,a=s.children,$w(r,s)?a=null:o!==null&&$w(r,o)&&(t.flags|=32),pA(e,t),Rr(e,t,a,n),t.child;case 6:return e===null&&zw(t),null;case 13:return mA(e,t,n);case 4:return Fb(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=hc(t,null,r,n):Rr(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:zs(r,s),aN(e,t,r,s,n);case 7:return Rr(e,t,t.pendingProps,n),t.child;case 8:return Rr(e,t,t.pendingProps.children,n),t.child;case 12:return Rr(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,o=t.memoizedProps,a=s.value,cn(bh,r._currentValue),r._currentValue=a,o!==null)if(Xs(o.value,a)){if(o.children===s.children&&!qr.current){t=to(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var l=o.dependencies;if(l!==null){a=o.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(o.tag===1){c=Yi(-1,n&-n),c.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?c.next=c:(c.next=d.next,d.next=c),u.pending=c}}o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Bw(o.return,n,t),l.lanes|=n;break}c=c.next}}else if(o.tag===10)a=o.type===t.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(Ee(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),Bw(a,n,t),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===t){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}Rr(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,nc(t,n),s=_s(s),r=r(s),t.flags|=1,Rr(e,t,r,n),t.child;case 14:return r=t.type,s=zs(r,t.pendingProps),s=zs(r.type,s),lN(e,t,r,s,n);case 15:return dA(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:zs(r,s),Wp(e,t),t.tag=1,Ur(r)?(e=!0,yh(t)):e=!1,nc(t,n),lA(t,r,s),Ww(t,r,s,n),qw(null,t,r,!0,e,n);case 19:return gA(e,t,n);case 22:return fA(e,t,n)}throw Error(Ee(156,t.tag))};function RA(e,t){return iE(e,t)}function NO(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 js(e,t,n,r){return new NO(e,t,n,r)}function ek(e){return e=e.prototype,!(!e||!e.isReactComponent)}function jO(e){if(typeof e=="function")return ek(e)?1:0;if(e!=null){if(e=e.$$typeof,e===xb)return 11;if(e===bb)return 14}return 2}function Wo(e,t){var n=e.alternate;return n===null?(n=js(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 qp(e,t,n,r,s,o){var a=2;if(r=e,typeof e=="function")ek(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Ll:return Pa(n.children,s,o,t);case wb:a=8,s|=8;break;case pw:return e=js(12,n,t,s|2),e.elementType=pw,e.lanes=o,e;case hw:return e=js(13,n,t,s),e.elementType=hw,e.lanes=o,e;case mw:return e=js(19,n,t,s),e.elementType=mw,e.lanes=o,e;case H_:return jm(n,s,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case z_:a=10;break e;case B_:a=9;break e;case xb:a=11;break e;case bb:a=14;break e;case Co:a=16,r=null;break e}throw Error(Ee(130,e==null?e:typeof e,""))}return t=js(a,n,t,s),t.elementType=e,t.type=r,t.lanes=o,t}function Pa(e,t,n,r){return e=js(7,e,r,t),e.lanes=n,e}function jm(e,t,n,r){return e=js(22,e,r,t),e.elementType=H_,e.lanes=n,e.stateNode={isHidden:!1},e}function fy(e,t,n){return e=js(6,e,null,t),e.lanes=n,e}function py(e,t,n){return t=js(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function CO(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=Ug(0),this.expirationTimes=Ug(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ug(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function tk(e,t,n,r,s,o,a,l,c){return e=new CO(e,t,n,l,c),t===1?(t=1,o===!0&&(t|=8)):t=0,o=js(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Db(o),e}function _O(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:$l,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function TA(e){if(!e)return Uo;e=e._reactInternals;e:{if(nl(e)!==e||e.tag!==1)throw Error(Ee(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Ur(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Ee(171))}if(e.tag===1){var n=e.type;if(Ur(n))return TE(e,n,t)}return t}function MA(e,t,n,r,s,o,a,l,c){return e=tk(n,r,!0,e,s,o,a,l,c),e.context=TA(null),n=e.current,r=Tr(),s=Ho(n),o=Yi(r,s),o.callback=t??null,zo(n,o,s),e.current.lanes=s,Kd(e,s,r),Yr(e,r),e}function Cm(e,t,n,r){var s=t.current,o=Tr(),a=Ho(s);return n=TA(n),t.context===null?t.context=n:t.pendingContext=n,t=Yi(o,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=zo(s,t,a),e!==null&&(Gs(e,s,a,o),zp(e,s,a)),a}function Ph(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 bN(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function nk(e,t){bN(e,t),(e=e.alternate)&&bN(e,t)}function EO(){return null}var $A=typeof reportError=="function"?reportError:function(e){console.error(e)};function rk(e){this._internalRoot=e}_m.prototype.render=rk.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Ee(409));Cm(e,t,null,null)};_m.prototype.unmount=rk.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ba(function(){Cm(null,e,null,null)}),t[Zi]=null}};function _m(e){this._internalRoot=e}_m.prototype.unstable_scheduleHydration=function(e){if(e){var t=fE();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Ao.length&&t!==0&&t<Ao[n].priority;n++);Ao.splice(n,0,e),n===0&&hE(e)}};function sk(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Em(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function kN(){}function AO(e,t,n,r,s){if(s){if(typeof r=="function"){var o=r;r=function(){var u=Ph(a);o.call(u)}}var a=MA(t,r,e,0,null,!1,!1,"",kN);return e._reactRootContainer=a,e[Zi]=a.current,fd(e.nodeType===8?e.parentNode:e),Ba(),a}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var u=Ph(c);l.call(u)}}var c=tk(e,0,!1,null,null,!1,!1,"",kN);return e._reactRootContainer=c,e[Zi]=c.current,fd(e.nodeType===8?e.parentNode:e),Ba(function(){Cm(t,c,n,r)}),c}function Am(e,t,n,r,s){var o=n._reactRootContainer;if(o){var a=o;if(typeof s=="function"){var l=s;s=function(){var c=Ph(a);l.call(c)}}Cm(t,a,e,s)}else a=AO(n,t,e,s,r);return Ph(a)}uE=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Pu(t.pendingLanes);n!==0&&(Sb(t,n|1),Yr(t,Dn()),!(Bt&6)&&(yc=Dn()+500,na()))}break;case 13:Ba(function(){var r=eo(e,1);if(r!==null){var s=Tr();Gs(r,e,1,s)}}),nk(e,1)}};Nb=function(e){if(e.tag===13){var t=eo(e,134217728);if(t!==null){var n=Tr();Gs(t,e,134217728,n)}nk(e,134217728)}};dE=function(e){if(e.tag===13){var t=Ho(e),n=eo(e,t);if(n!==null){var r=Tr();Gs(n,e,t,r)}nk(e,t)}};fE=function(){return Qt};pE=function(e,t){var n=Qt;try{return Qt=e,t()}finally{Qt=n}};jw=function(e,t,n){switch(t){case"input":if(ww(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=xm(r);if(!s)throw Error(Ee(90));V_(r),ww(r,s)}}}break;case"textarea":q_(e,n);break;case"select":t=n.value,t!=null&&Ql(e,!!n.multiple,t,!1)}};Z_=Xb;eE=Ba;var PO={usingClientEntryPoint:!1,Events:[Ud,zl,xm,X_,Q_,Xb]},gu={findFiberByHostInstance:Na,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},IO={bundleType:gu.bundleType,version:gu.version,rendererPackageName:gu.rendererPackageName,rendererConfig:gu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:io.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=rE(e),e===null?null:e.stateNode},findFiberByHostInstance:gu.findFiberByHostInstance||EO,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 np=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!np.isDisabled&&np.supportsFiber)try{mm=np.inject(IO),bi=np}catch{}}ds.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=PO;ds.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!sk(t))throw Error(Ee(200));return _O(e,t,null,n)};ds.createRoot=function(e,t){if(!sk(e))throw Error(Ee(299));var n=!1,r="",s=$A;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=tk(e,1,!1,null,null,n,!1,r,s),e[Zi]=t.current,fd(e.nodeType===8?e.parentNode:e),new rk(t)};ds.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(Ee(188)):(e=Object.keys(e).join(","),Error(Ee(268,e)));return e=rE(t),e=e===null?null:e.stateNode,e};ds.flushSync=function(e){return Ba(e)};ds.hydrate=function(e,t,n){if(!Em(t))throw Error(Ee(200));return Am(null,e,t,!0,n)};ds.hydrateRoot=function(e,t,n){if(!sk(e))throw Error(Ee(405));var r=n!=null&&n.hydratedSources||null,s=!1,o="",a=$A;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=MA(t,null,e,1,n??null,s,!1,o,a),e[Zi]=t.current,fd(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 _m(t)};ds.render=function(e,t,n){if(!Em(t))throw Error(Ee(200));return Am(null,e,t,!1,n)};ds.unmountComponentAtNode=function(e){if(!Em(e))throw Error(Ee(40));return e._reactRootContainer?(Ba(function(){Am(null,null,e,!1,function(){e._reactRootContainer=null,e[Zi]=null})}),!0):!1};ds.unstable_batchedUpdates=Xb;ds.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Em(n))throw Error(Ee(200));if(e==null||e._reactInternals===void 0)throw Error(Ee(38));return Am(e,t,n,!1,r)};ds.version="18.3.1-next-f1338f8080-20240426";function LA(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(LA)}catch(e){console.error(e)}}LA(),L_.exports=ds;var sr=L_.exports,vN=sr;dw.createRoot=vN.createRoot,dw.hydrateRoot=vN.hydrateRoot;const OA=m.createContext(null);function sx(e){let t=e||"/";return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t||"/"}function RO(){const e=sx(window.location.pathname);return e==="/"?(window.history.replaceState({},"","/projects"),"/projects"):e}function TO({children:e}){const[t,n]=m.useState(RO);m.useEffect(()=>{const o=()=>n(sx(window.location.pathname));return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[]);const r=m.useCallback(o=>{const a=o.startsWith("/")?o:`/${o}`;let l;try{l=new URL(a,window.location.origin)}catch{l=new URL("/",window.location.origin)}const c=sx(l.pathname),u=l.search||"";window.history.pushState({},"",c+u),n(c)},[]),s=m.useMemo(()=>({path:t,navigate:r}),[t,r]);return i.jsx(OA.Provider,{value:s,children:e})}function ei(){const e=m.useContext(OA);if(!e)throw new Error("useRoute must be used within RouteProvider");return e}function MO(){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 SN={};function ix(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&SN[t[0]]||(typeof t[0]=="string"&&(SN[t[0]]=new Date),MO(...t))}const DA=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function NN(e,t,n){e.loadNamespaces(t,DA(e,n))}function jN(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,DA(e,r))}function $O(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,o=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(o,e)))}function LO(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(ix("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(s,o)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!o(s.isLanguageChangingTo,e))return!1}}):$O(e,t,n)}const OO=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,DO={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},FO=e=>DO[e],zO=e=>e.replace(OO,FO);let ox={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:zO};function BO(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ox={...ox,...e}}function HO(){return ox}let FA;function WO(e){FA=e}function VO(){return FA}const KO={type:"3rdParty",init(e){BO(e.options.react),WO(e)}},qO=m.createContext();class UO{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const YO=(e,t)=>{const n=m.useRef();return m.useEffect(()=>{n.current=e},[e,t]),n.current};function Lr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:s}=m.useContext(qO)||{},o=n||r||VO();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new UO),!o){ix("You will need to pass in an i18next instance by using initReactI18next");const w=(N,j)=>typeof j=="string"?j:j&&typeof j=="object"&&typeof j.defaultValue=="string"?j.defaultValue:Array.isArray(N)?N[N.length-1]:N,C=[w,{},!1];return C.t=w,C.i18n={},C.ready=!1,C}o.options.react&&o.options.react.wait!==void 0&&ix("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...HO(),...o.options.react,...t},{useSuspense:l,keyPrefix:c}=a;let u=e||s||o.options&&o.options.defaultNS;u=typeof u=="string"?[u]:u||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(u);const d=(o.isInitialized||o.initializedStoreOnce)&&u.every(w=>LO(w,o,a));function p(){return o.getFixedT(t.lng||null,a.nsMode==="fallback"?u:u[0],c)}const[f,h]=m.useState(p);let g=u.join();t.lng&&(g=`${t.lng}${g}`);const k=YO(g),b=m.useRef(!0);m.useEffect(()=>{const{bindI18n:w,bindI18nStore:C}=a;b.current=!0,!d&&!l&&(t.lng?jN(o,t.lng,u,()=>{b.current&&h(p)}):NN(o,u,()=>{b.current&&h(p)})),d&&k&&k!==g&&b.current&&h(p);function N(){b.current&&h(p)}return w&&o&&o.on(w,N),C&&o&&o.store.on(C,N),()=>{b.current=!1,w&&o&&w.split(" ").forEach(j=>o.off(j,N)),C&&o&&C.split(" ").forEach(j=>o.store.off(j,N))}},[o,g]);const y=m.useRef(!0);m.useEffect(()=>{b.current&&!y.current&&h(p),y.current=!1},[o,c]);const v=[f,o,d];if(v.t=f,v.i18n=o,v.ready=d,d||!d&&!l)return v;throw new Promise(w=>{t.lng?jN(o,t.lng,u,()=>w()):NN(o,u,()=>w())})}const zA="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",GO=[{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"}],JO=[{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 XO(e,t){return t==="/projects"?e==="/projects"||e==="/":t==="/nodes"?e==="/nodes"||e==="/my-nodes":e===t||e.startsWith(t+"/")}function QO({authUser:e,onLogout:t}){const{path:n,navigate:r}=ei(),{t:s}=Lr(),[o,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}},[]),i.jsxs("aside",{className:"af-sidebar","aria-label":s("flow:sidebar.mainNav"),children:[i.jsxs("div",{className:"af-brand",children:[i.jsx("div",{className:"af-brand-mark","aria-hidden":!0,children:i.jsx("img",{src:zA,alt:"",width:"36",height:"36",decoding:"async"})}),i.jsxs("div",{children:[i.jsx("h1",{className:"af-brand-title",children:"Agentflow"}),i.jsx("p",{className:"af-brand-tag",children:"Orchestration Engine"})]})]}),i.jsx("nav",{className:"af-nav",children:GO.filter(l=>!l.adminOnly||(e==null?void 0:e.isAdmin)).map(l=>i.jsxs("button",{type:"button",className:"af-nav-link"+(XO(n,l.to)?" af-nav-link--active":""),onClick:()=>r(l.to),children:[i.jsx("span",{className:"material-symbols-outlined",children:l.icon}),i.jsx("span",{children:l.label||s(l.labelKey)})]},l.to))}),i.jsxs("div",{className:"af-sidebar-footer",children:[i.jsxs("div",{className:"af-sidebar-user",title:(e==null?void 0:e.username)||(e==null?void 0:e.userId)||"",children:[i.jsx("span",{className:"material-symbols-outlined",children:"person"}),i.jsx("span",{children:(e==null?void 0:e.username)||(e==null?void 0:e.userId)||""}),e!=null&&e.isAdmin?i.jsx("span",{className:"af-sidebar-admin-badge",children:"Admin"}):null,i.jsx("button",{type:"button",className:"af-sidebar-logout",onClick:t,"aria-label":"Logout",title:"Logout",children:i.jsx("span",{className:"material-symbols-outlined",children:"logout"})})]}),!o&&JO.map(l=>{const c=s(l.labelKey);return i.jsx("a",{className:"af-sidebar-ext",href:l.href,target:"_blank",rel:"noopener noreferrer","aria-label":c,title:c,children:i.jsx("span",{className:"material-symbols-outlined",children:l.icon})},l.href)})]})]})}const ZO="agentflow.pipelineRecent",eD=15;function tD(e){try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function nD(){if(typeof localStorage>"u")return[];const e=localStorage.getItem(ZO);return e?tD(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 rD(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 CN(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 o=Math.floor(s/60);if(o<60)return t("flow:time.minutesAgo",{n:o});const a=Math.floor(o/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 d=Math.floor(a/24);return d<7?t("flow:time.daysAgo",{n:d}):`${l.getMonth()+1}/${l.getDate()}`}function sD(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:rD(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,o)=>o.at-s.at),r.slice(0,eD)}var rs=Uint8Array,Ul=Uint16Array,iD=Int32Array,BA=new rs([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]),HA=new rs([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]),oD=new rs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),WA=function(e,t){for(var n=new Ul(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var s=new iD(n[30]),r=1;r<30;++r)for(var o=n[r];o<n[r+1];++o)s[o]=o-n[r]<<5|r;return{b:n,r:s}},VA=WA(BA,2),KA=VA.b,aD=VA.r;KA[28]=258,aD[258]=28;var lD=WA(HA,0),cD=lD.b,ax=new Ul(32768);for(var gn=0;gn<32768;++gn){var ko=(gn&43690)>>1|(gn&21845)<<1;ko=(ko&52428)>>2|(ko&13107)<<2,ko=(ko&61680)>>4|(ko&3855)<<4,ax[gn]=((ko&65280)>>8|(ko&255)<<8)>>1}var Uu=function(e,t,n){for(var r=e.length,s=0,o=new Ul(t);s<r;++s)e[s]&&++o[e[s]-1];var a=new Ul(t);for(s=1;s<t;++s)a[s]=a[s-1]+o[s-1]<<1;var l;if(n){l=new Ul(1<<t);var c=15-t;for(s=0;s<r;++s)if(e[s])for(var u=s<<4|e[s],d=t-e[s],p=a[e[s]-1]++<<d,f=p|(1<<d)-1;p<=f;++p)l[ax[p]>>c]=u}else for(l=new Ul(r),s=0;s<r;++s)e[s]&&(l[s]=ax[a[e[s]-1]++]>>15-e[s]);return l},Gd=new rs(288);for(var gn=0;gn<144;++gn)Gd[gn]=8;for(var gn=144;gn<256;++gn)Gd[gn]=9;for(var gn=256;gn<280;++gn)Gd[gn]=7;for(var gn=280;gn<288;++gn)Gd[gn]=8;var qA=new rs(32);for(var gn=0;gn<32;++gn)qA[gn]=5;var uD=Uu(Gd,9,1),dD=Uu(qA,5,1),hy=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Ds=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},my=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},fD=function(e){return(e+7)/8|0},ik=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new rs(e.subarray(t,n))},pD=["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"],bs=function(e,t,n){var r=new Error(t||pD[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,bs),!n)throw r;return r},hD=function(e,t,n,r){var s=e.length,o=r?r.length:0;if(!s||t.f&&!t.l)return n||new rs(0);var a=!n,l=a||t.i!=2,c=t.i;a&&(n=new rs(s*3));var u=function(ue){var fe=n.length;if(ue>fe){var be=new rs(Math.max(fe*2,ue));be.set(n),n=be}},d=t.f||0,p=t.p||0,f=t.b||0,h=t.l,g=t.d,k=t.m,b=t.n,y=s*8;do{if(!h){d=Ds(e,p,1);var v=Ds(e,p+1,3);if(p+=3,v)if(v==1)h=uD,g=dD,k=9,b=5;else if(v==2){var j=Ds(e,p,31)+257,A=Ds(e,p+10,15)+4,I=j+Ds(e,p+5,31)+1;p+=14;for(var D=new rs(I),B=new rs(19),W=0;W<A;++W)B[oD[W]]=Ds(e,p+W*3,7);p+=A*3;for(var F=hy(B),T=(1<<F)-1,M=Uu(B,F,1),W=0;W<I;){var q=M[Ds(e,p,T)];p+=q&15;var w=q>>4;if(w<16)D[W++]=w;else{var H=0,L=0;for(w==16?(L=3+Ds(e,p,3),p+=2,H=D[W-1]):w==17?(L=3+Ds(e,p,7),p+=3):w==18&&(L=11+Ds(e,p,127),p+=7);L--;)D[W++]=H}}var R=D.subarray(0,j),z=D.subarray(j);k=hy(R),b=hy(z),h=Uu(R,k,1),g=Uu(z,b,1)}else bs(1);else{var w=fD(p)+4,C=e[w-4]|e[w-3]<<8,N=w+C;if(N>s){c&&bs(0);break}l&&u(f+C),n.set(e.subarray(w,N),f),t.b=f+=C,t.p=p=N*8,t.f=d;continue}if(p>y){c&&bs(0);break}}l&&u(f+131072);for(var E=(1<<k)-1,Q=(1<<b)-1,V=p;;V=p){var H=h[my(e,p)&E],$=H>>4;if(p+=H&15,p>y){c&&bs(0);break}if(H||bs(2),$<256)n[f++]=$;else if($==256){V=p,h=null;break}else{var ne=$-254;if($>264){var W=$-257,ce=BA[W];ne=Ds(e,p,(1<<ce)-1)+KA[W],p+=ce}var X=g[my(e,p)&Q],re=X>>4;X||bs(3),p+=X&15;var z=cD[re];if(re>3){var ce=HA[re];z+=my(e,p)&(1<<ce)-1,p+=ce}if(p>y){c&&bs(0);break}l&&u(f+131072);var Z=f+ne;if(f<z){var ie=o-z,te=Math.min(z,Z);for(ie+f<0&&bs(3);f<te;++f)n[f]=r[ie+f]}for(;f<Z;++f)n[f]=n[f-z]}}t.l=h,t.p=V,t.b=f,t.f=d,h&&(d=1,t.m=k,t.d=g,t.n=b)}while(!d);return f!=n.length&&a?ik(n,0,f):n.subarray(0,f)},mD=new rs(0),mi=function(e,t){return e[t]|e[t+1]<<8},Vs=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},gy=function(e,t){return Vs(e,t)+Vs(e,t+4)*4294967296};function gD(e,t){return hD(e,{i:2},t&&t.out,t&&t.dictionary)}var lx=typeof TextDecoder<"u"&&new TextDecoder,yD=0;try{lx.decode(mD,{stream:!0}),yD=1}catch{}var wD=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:ik(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 xD(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(lx)return lx.decode(e);var s=wD(e),o=s.s,n=s.r;return n.length&&bs(8),o}}var bD=function(e,t){return t+30+mi(e,t+26)+mi(e,t+28)},kD=function(e,t,n){var r=mi(e,t+28),s=xD(e.subarray(t+46,t+46+r),!(mi(e,t+8)&2048)),o=t+46+r,a=Vs(e,t+20),l=n&&a==4294967295?vD(e,o):[a,Vs(e,t+24),Vs(e,t+42)],c=l[0],u=l[1],d=l[2];return[mi(e,t+10),c,u,s,o+mi(e,t+30)+mi(e,t+32),d]},vD=function(e,t){for(;mi(e,t)!=1;t+=4+mi(e,t+2));return[gy(e,t+12),gy(e,t+4),gy(e,t+20)]};function SD(e,t){for(var n={},r=e.length-22;Vs(e,r)!=101010256;--r)(!r||e.length-r>65558)&&bs(13);var s=mi(e,r+8);if(!s)return{};var o=Vs(e,r+16),a=o==4294967295||s==65535;if(a){var l=Vs(e,r-12);a=Vs(e,l)==101075792,a&&(s=Vs(e,l+32),o=Vs(e,l+48))}for(var c=0;c<s;++c){var u=kD(e,o,a),d=u[0],p=u[1],f=u[2],h=u[3],g=u[4],k=u[5],b=bD(e,k);o=g,d?d==8?n[h]=gD(e.subarray(b,b+p),{out:new rs(f)}):bs(14,"unknown compression type "+d):n[h]=ik(e,b,b+p)}return n}const ND=8*1024*1024,jD=500;function CD(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 _D(e){return e?e.split("/").some(n=>n==="__MACOSX"||n.startsWith("._")):!0}function ED(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 AD=/^[a-zA-Z][a-zA-Z0-9_-]*$/;async function PD(e){try{const t=new Uint8Array(await e.arrayBuffer()),n=SD(t),r=new Map;let s=0,o=0;for(const[c,u]of Object.entries(n)){if(c.endsWith("/"))continue;const d=CD(c);if(!d||_D(d))continue;const p=(u==null?void 0:u.length)??0;if(s+=p,s>ND||(o+=1,o>jD))return null;r.set(d,p)}if(r.size===0)return null;const a=new Set;for(const c of r.keys()){const u=ED(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 AD.test(l)?l:null}catch{return null}}const yy=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function ID({file:e,onClose:t,onImported:n}){const{t:r}=Lr(),s=m.useId(),o=m.useRef(null),a=m.useRef(null),[l,c]=m.useState(""),[u,d]=m.useState("user"),[p,f]=m.useState(!1),[h,g]=m.useState(""),[k,b]=m.useState(null),y=k??e;m.useEffect(()=>{const N=requestAnimationFrame(()=>{var j;return(j=o.current)==null?void 0:j.focus()});return()=>cancelAnimationFrame(N)},[]),m.useEffect(()=>{let N=!1;return(async()=>{const j=y.name||"",A=j.toLowerCase();let I="";if(A.endsWith(".zip")){if(I=await PD(y)||"",!I){const D=j.replace(/\.zip$/i,"");yy.test(D)&&(I=D)}}else if(A.endsWith(".yaml")||A.endsWith(".yml")){const D=j.replace(/\.ya?ml$/i,"");yy.test(D)&&(I=D)}N||c(I)})(),()=>{N=!0}},[y]);const v=l.trim(),w=v.length>0&&yy.test(v);async function C(N){if(N.preventDefault(),!(!w||p)){f(!0),g("");try{const j=new FormData;j.set("flowId",v),j.set("targetSpace",u),j.set("file",y,y.name);const A=await fetch("/api/flows/import",{method:"POST",body:j}),I=await A.json().catch(()=>({}));if(!A.ok){g(typeof I.error=="string"?I.error:r("project:importModal.importFailed"));return}n({id:I.flowId,source:I.flowSource??"user"})}catch(j){g(String((j==null?void 0:j.message)||j))}finally{f(!1)}}}return i.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:N=>{N.target===N.currentTarget&&t()},children:i.jsxs("div",{ref:o,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":s,tabIndex:-1,onMouseDown:N=>N.stopPropagation(),children:[i.jsxs("div",{className:"af-shortcuts-panel__head",children:[i.jsx("h2",{id:s,className:"af-shortcuts-panel__title",children:r("project:importModal.title")}),i.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":r("project:importModal.close"),children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),i.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:C,children:[i.jsx("p",{className:"af-new-pipeline-lead",children:r("project:importModal.lead",{filename:y.name})}),i.jsx("input",{ref:a,type:"file",className:"af-import-file-input",accept:".yaml,.yml,.zip,application/zip","aria-hidden":!0,tabIndex:-1,onChange:N=>{var A;const j=(A=N.target.files)==null?void 0:A[0];j&&b(j),N.target.value=""}}),i.jsxs("label",{className:"af-pipeline-drawer-field",children:[i.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:importModal.nameLabel")}),i.jsx("input",{className:"af-new-pipeline-input",type:"text",name:"importFlowId",autoComplete:"off",spellCheck:!1,placeholder:r("project:importModal.namePlaceholder"),value:l,onChange:N=>c(N.target.value),"aria-invalid":v.length>0&&!w}),i.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r("project:importModal.nameHint")})]}),i.jsx("div",{className:"af-import-repick",children:i.jsx("button",{type:"button",className:"af-btn-secondary af-import-repick-btn",onClick:()=>{var N;return(N=a.current)==null?void 0:N.click()},children:r("project:importModal.changeFile")})}),h?i.jsx("p",{className:"af-err af-new-pipeline-err",children:h}):null,i.jsxs("div",{className:"af-new-pipeline-actions",children:[i.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:p,children:r("project:importModal.cancel")}),i.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!w||p,children:r(p?"project:importModal.importing":"project:importModal.importAndOpen")})]})]})]})})}const RD=/^[a-zA-Z][a-zA-Z0-9_-]*$/,_N="af:newPipelineGuide";function TD({open:e,onClose:t,onCreated:n}){const{t:r}=Lr(),s=m.useId(),o=m.useRef(null),[a,l]=m.useState(""),[c,u]=m.useState(""),[d,p]=m.useState("user"),[f,h]=m.useState(!1),[g,k]=m.useState(""),[b,y]=m.useState(!1);m.useEffect(()=>{if(!e)return;l(""),u(""),p("user"),k(""),h(!1),localStorage.getItem(_N)==="true"&&y(!0);const A=requestAnimationFrame(()=>{var I;return(I=o.current)==null?void 0:I.focus()});return()=>cancelAnimationFrame(A)},[e]);const v=()=>{localStorage.removeItem(_N),y(!1)};if(!e)return null;const w=a.trim(),C=w.length>0&&RD.test(w);async function N(j){if(j.preventDefault(),!(!C||f)){h(!0),k(""),v();try{const A=await fetch("/api/flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:w,description:c.trim(),targetSpace:d})}),I=await A.json().catch(()=>({}));if(!A.ok){k(typeof I.error=="string"?I.error:r("project:newPipelineModal.createFailed"));return}n({id:I.flowId,source:I.flowSource??"user"})}catch(A){k(String((A==null?void 0:A.message)||A))}finally{h(!1)}}}return i.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:j=>{j.target===j.currentTarget&&(v(),t())},children:i.jsxs("div",{ref:o,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":s,tabIndex:-1,onMouseDown:j=>j.stopPropagation(),children:[i.jsxs("div",{className:"af-shortcuts-panel__head",children:[i.jsx("h2",{id:s,className:"af-shortcuts-panel__title",children:r("project:newPipelineModal.title")}),i.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:()=>{v(),t()},"aria-label":r("project:newPipelineModal.close"),children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),b?i.jsx("div",{className:"af-new-pipeline-guide",children:i.jsxs("div",{className:"af-new-pipeline-guide-content",children:[i.jsx("span",{className:"material-symbols-outlined af-new-pipeline-guide-icon",children:"lightbulb"}),i.jsxs("div",{className:"af-new-pipeline-guide-text",children:[i.jsx("p",{children:i.jsx("strong",{children:r("onboarding:newPipeline.guideTitle")})}),i.jsx("p",{children:r("onboarding:newPipeline.guideDesc")})]}),i.jsx("button",{type:"button",className:"af-new-pipeline-guide-close",onClick:v,children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})}):null,i.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:N,children:[i.jsx("p",{className:"af-new-pipeline-lead",children:r("project:newPipelineModal.lead")}),i.jsxs("label",{className:"af-pipeline-drawer-field",children:[i.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:newPipelineModal.nameLabel")}),i.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":w.length>0&&!C}),i.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r(b?"onboarding:newPipeline.nameHintGuide":"project:newPipelineModal.nameHint")})]}),i.jsxs("label",{className:"af-pipeline-drawer-field",children:[i.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:newPipelineModal.descLabel")}),i.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?i.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-guide-hint",children:r("onboarding:newPipeline.descHintGuide")}):null]}),g?i.jsx("p",{className:"af-err af-new-pipeline-err",children:g}):null,i.jsxs("div",{className:"af-new-pipeline-actions",children:[i.jsx("button",{type:"button",className:"af-btn-secondary",onClick:()=>{v(),t()},disabled:f,children:r("project:newPipelineModal.cancel")}),i.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!C||f,children:r(f?"project:newPipelineModal.creating":b?"onboarding:newPipeline.createGuide":"project:newPipelineModal.createAndOpen")})]})]})]})})}const UA="agentflow.pipelineViewPreference";function YA(e,t="user",n=!1){return`${String(t||"user")}:${String(e||"")}:${n?"archived":"active"}`}function GA(){if(typeof localStorage>"u")return{};try{const e=JSON.parse(localStorage.getItem(UA)||"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function MD(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(UA,JSON.stringify(e))}catch{}}function ok(e){return e==="display"?"display":"workspace"}function $D(e){const t=String(e||"").toLowerCase();return t==="builtin"||t==="admin"}function JA(e,t){const n=ok(t);return n==="pipeline"&&$D(e==null?void 0:e.source)?"workspace":n}function LD(e){return(e==null?void 0:e.hasPipeline)!==!1&&(e==null?void 0:e.hasFlow)!==!1&&(e==null?void 0:e.flowYaml)!==!1}function OD(e,t,n,r=!1){if(!e)return;const s=GA();s[YA(e,t,r)]={view:ok(n),at:Date.now()},MD(s)}function DD(e,t="workspace"){if(!(e!=null&&e.id))return ok(t);const r=GA()[YA(e.id,e.source??"user",!!e.archived)],s=JA(e,(r==null?void 0:r.view)||t);return s==="pipeline"&&!LD(e)?"workspace":s}function FD(e,t="workspace"){var s;const n=JA(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(s=e.collaboration)!=null&&s.id&&r.set("workspaceId",e.collaboration.id),e.archived&&r.set("archived","1"),n==="display"&&r.set("view","display"),`/workspace?${r.toString()}`}function rp(e,t="workspace"){return FD(e,DD(e,t))}function zD(e,t){const n=String(e||"").split(/[.-]/).map(o=>Number.parseInt(o,10)),r=String(t||"").split(/[.-]/).map(o=>Number.parseInt(o,10)),s=Math.max(n.length,r.length);for(let o=0;o<s;o+=1){const a=Number.isFinite(n[o])?n[o]:0,l=Number.isFinite(r[o])?r[o]:0;if(a!==l)return a>l?1:-1}return 0}function cx(e){return String((e==null?void 0:e.version)||"").trim()}function BD(e){const t=cx(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 HD({onChanged:e,canManage:t=!1}){const[n,r]=m.useState({available:!1,version:"",loggedIn:!1,user:"",error:""}),[s,o]=m.useState([]),[a,l]=m.useState(""),[c,u]=m.useState(""),[d,p]=m.useState("keyword"),[f,h]=m.useState([]),[g,k]=m.useState({}),[b,y]=m.useState(""),[v,w]=m.useState(""),[C,N]=m.useState(""),j=m.useCallback(async()=>{w("");try{const[F,T]=await Promise.all([fetch("/api/skillhub/status"),fetch("/api/skillhub/list?target=agentflow&agent=codex")]),M=await F.json().catch(()=>({}));F.ok&&r({available:!!M.available,version:typeof M.version=="string"?M.version:"",loggedIn:!!M.loggedIn,user:typeof M.user=="string"?M.user:"",error:typeof M.error=="string"?M.error:""});const q=await T.json().catch(()=>({}));if(!T.ok)throw new Error(typeof q.error=="string"?q.error:"HTTP "+T.status);o(Array.isArray(q.skills)?q.skills:[]),l(typeof q.skillsRoot=="string"?q.skillsRoot:""),k({})}catch(F){w(String(F.message||F))}},[]);m.useEffect(()=>{j()},[j]);const A=m.useCallback(async()=>{const F=c.trim();if(F){y("search"),w(""),N("");try{const T=await fetch(`/api/skillhub/search?q=${encodeURIComponent(F)}&mode=${encodeURIComponent(d)}`),M=await T.json().catch(()=>({}));if(!T.ok)throw new Error(typeof M.error=="string"?M.error:"HTTP "+T.status);h(Array.isArray(M.items)?M.items:[])}catch(T){w(String(T.message||T))}finally{y("")}}},[c,d]),I=m.useCallback(async(F,T=!1)=>{if(!t)return;const M=F&&typeof F=="object"?F:null,q=String(M?M.slug||M.name||M.collection||M.skillId||M.id:F||"").trim();if(q){y(`install:${q}`),w(""),N("");try{const H=M?{slug:M.slug||"",skillId:M.skillId||"",collection:M.collection||"",collectionName:M.collection&&M.name||"",target:"agentflow",agent:"codex",force:T}:{slug:q,target:"agentflow",agent:"codex",force:T},L=await fetch("/api/skillhub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(H)}),R=await L.json().catch(()=>({}));if(!L.ok)throw new Error(typeof R.error=="string"?R.error:"HTTP "+L.status);N(T?`已更新 ${q}`:`已安装 ${q}`),await j(),typeof e=="function"&&await e()}catch(H){w(String(H.message||H))}finally{y("")}}},[t,j,e]),D=m.useCallback(async()=>{if(t&&s.length!==0){y("check-updates"),w(""),N("");try{const F=await Promise.all(s.map(async q=>{const H=String(q.name||"").trim();if(!H)return null;try{const L=await fetch(`/api/skillhub/search?q=${encodeURIComponent(H)}&mode=keyword`),R=await L.json().catch(()=>({}));if(!L.ok)throw new Error(typeof R.error=="string"?R.error:"HTTP "+L.status);const z=Array.isArray(R.items)?R.items:[],E=z.find(ne=>ne.slug===H||ne.name===H||ne.id===H)||z[0],Q=cx(q),V=String((E==null?void 0:E.version)||"").trim();let $="unknown";return E?Q&&V?$=zD(Q,V)<0?"update":"current":V&&($="remote-only"):$="missing",[H,{state:$,latestVersion:V,installedVersion:Q,summary:(E==null?void 0:E.summary)||""}]}catch(L){return[H,{state:"error",error:String(L.message||L),installedVersion:cx(q)}]}})),T={};for(const q of F)q&&(T[q[0]]=q[1]);k(T);const M=Object.values(T).filter(q=>q.state==="update").length;N(M>0?`发现 ${M} 个可更新 skill`:"已检查,暂无明确可更新项")}finally{y("")}}},[t,s]),B=m.useCallback(async F=>{if(!t)return;const T=String(F||"").trim();if(T){y(`uninstall:${T}`),w(""),N("");try{const M=await fetch("/api/skillhub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:T,target:"agentflow",agent:"codex"})}),q=await M.json().catch(()=>({}));if(!M.ok)throw new Error(typeof q.error=="string"?q.error:"HTTP "+M.status);N(`已卸载 ${T}`),await j(),typeof e=="function"&&await e()}catch(M){w(String(M.message||M))}finally{y("")}}},[t,j,e]),W=m.useCallback(async()=>{if(t){y("update-cli"),w(""),N("");try{const F=await fetch("/api/skillhub/update",{method:"POST"}),T=await F.json().catch(()=>({}));if(!F.ok)throw new Error(typeof T.error=="string"?T.error:"HTTP "+F.status);N("SkillHub CLI 已更新"),await j()}catch(F){w(String(F.message||F))}finally{y("")}}},[t,j]);return i.jsxs("section",{className:"af-set-card af-set-card--span-all af-set-skillhub",children:[i.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"af-set-h2",children:"SkillHub"}),i.jsx("p",{className:"af-set-p af-set-p--tight",children:t?"搜索、安装、更新和卸载 AgentFlow 共享 skills。":"查看 AgentFlow 共享 skills;使用时在 Workspace 中通过 Load Skills 加载。"}),a?i.jsxs("p",{className:"af-set-hint af-set-hint--inline",children:["Skills Root:",i.jsx("code",{children:a})]}):null]}),i.jsxs("div",{className:"af-set-skillhub-head-actions",children:[i.jsxs("div",{className:"af-set-skillhub-status",children:[i.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:"extension"}),i.jsx("span",{children:n.loggedIn?`已登录 ${n.user}`:"未登录 SkillHub"}),i.jsx("span",{className:"af-set-badge"+(n.available?" af-set-badge--ok":" af-set-badge--err"),children:n.available?`v${n.version}`:"not found"})]}),i.jsxs("div",{className:"af-set-skillhub-toolbar",children:[i.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:j,disabled:!!b,children:"刷新"}),i.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:D,disabled:!t||!!b||s.length===0,children:b==="check-updates"?"检查中…":"检查更新"}),i.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:W,disabled:!t||!!b,children:b==="update-cli"?"更新中…":"更新 CLI"})]})]})]}),i.jsxs("div",{className:"af-set-skillhub-search",children:[i.jsxs("select",{className:"af-set-input af-set-input--sm af-set-skillhub-search-mode",value:d,onChange:F=>{p(F.target.value),h([])},children:[i.jsx("option",{value:"keyword",children:"关键词"}),i.jsx("option",{value:"skillId",children:"Skill ID"}),i.jsx("option",{value:"collectionId",children:"Collection ID"})]}),i.jsx("input",{className:"af-set-input af-set-input--sm",value:c,onChange:F=>u(F.target.value),onKeyDown:F=>{F.key==="Enter"&&A()},placeholder:d==="collectionId"?"输入 collection id,例如 1":d==="skillId"?"输入 skill id":"搜索 skill slug / 关键词,例如 android、issue-tracker"}),i.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:()=>A(),disabled:!c.trim()||b==="search",children:[i.jsx("span",{className:"material-symbols-outlined",children:"search"}),b==="search"?"搜索中…":"搜索"]})]}),v?i.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:v}):null,C?i.jsx("p",{className:"af-set-hint af-set-hint--inline",children:C}):null,i.jsxs("div",{className:"af-set-skillhub-grid",children:[i.jsxs("div",{className:"af-set-skillhub-pane",children:[i.jsxs("div",{className:"af-set-skillhub-pane-head",children:[i.jsx("h3",{children:"已安装"}),i.jsx("span",{children:s.length})]}),i.jsx("div",{className:"af-set-skillhub-list",children:s.length===0?i.jsx("div",{className:"af-set-skillhub-empty",children:"暂无 AgentFlow 共享 skills"}):s.map(F=>{const T=g[F.name],M=!T||T.state==="update"||T.state==="remote-only"||T.state==="unknown"||T.state==="error",q=b===`install:${F.name}`?"更新中…":(T==null?void 0:T.state)==="current"?"已最新":(T==null?void 0:T.state)==="update"&&T.latestVersion?`更新到 v${T.latestVersion}`:(T==null?void 0:T.state)==="remote-only"&&T.latestVersion?`安装 v${T.latestVersion}`:"重装";return i.jsxs("div",{className:"af-set-skillhub-item",children:[i.jsxs("div",{children:[i.jsx("div",{className:"af-set-skillhub-title",children:F.displayName||F.name}),i.jsx("div",{className:"af-set-skillhub-meta",children:BD(F)}),i.jsx("div",{className:"af-set-skillhub-version-row",children:T?T.state==="update"?i.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--warn",children:["可更新 ",T.installedVersion?`v${T.installedVersion} -> `:"","v",T.latestVersion]}):T.state==="current"?i.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--ok",children:["已最新 v",T.latestVersion||T.installedVersion]}):T.state==="remote-only"?i.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:["远端 v",T.latestVersion,",本地版本未知"]}):T.state==="missing"?i.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"未找到远端匹配项"}):T.state==="error"?i.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--err",children:"检查失败"}):i.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"状态未知"}):i.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"未检查远端版本"})})]}),i.jsxs("div",{className:"af-set-skillhub-actions",children:[i.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>I(F.name,!0),disabled:!t||!!b||!M,children:q}),i.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>B(F.name),disabled:!t||!!b,children:"卸载"})]})]},`${F.agent}:${F.path}:${F.name}`)})})]}),i.jsxs("div",{className:"af-set-skillhub-pane",children:[i.jsxs("div",{className:"af-set-skillhub-pane-head",children:[i.jsx("h3",{children:"搜索结果"}),i.jsx("span",{children:f.length})]}),i.jsx("div",{className:"af-set-skillhub-list",children:f.length===0?i.jsx("div",{className:"af-set-skillhub-empty",children:"输入关键词后搜索 SkillHub"}):f.map(F=>{const T=F.slug||F.name,M=F.kind==="collection"||F.collection,q=!M&&s.some(H=>H.name===T||H.name===F.name);return i.jsxs("div",{className:"af-set-skillhub-item",children:[i.jsxs("div",{children:[i.jsx("div",{className:"af-set-skillhub-title",children:F.name||T}),i.jsxs("div",{className:"af-set-skillhub-meta",children:[M?`collection:${F.collection}`:T,F.skillId?` · id:${F.skillId}`:"",F.version?` · ${F.version}`:""]}),F.summary?i.jsx("p",{className:"af-set-skillhub-summary",children:F.summary}):null]}),i.jsx("button",{type:"button",className:q?"af-set-btn-mini":"af-set-btn-add af-set-btn-add--compact",onClick:()=>I(F,q),disabled:!t||!!b,children:q?"更新":M?"安装合集":"安装"})]},F.id||T)})})]})]})]})}function Ia(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 WD(e){return{version:1,collections:Ia({collections:e})}}function VD(e){const t=String(e||"").trim(),n=t.indexOf(":");return n>=0?t.slice(n+1).trim():t}function XA(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(VD(s)))||""}}function Yo(e,t){const n=XA(t);return Array.from(new Set((Array.isArray(e==null?void 0:e.skillKeys)?e.skillKeys:[]).map(r=>n(r)).filter(Boolean)))}function KD(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 qD(e,t){const n=new Set(Array.isArray(t)?t:[]);return(Array.isArray(e)?e:[]).filter(r=>!n.has(r))}function UD(e,t,n){const r=Yo(e,n);if(r.length===0)return"empty";const s=r.filter(o=>t.has(o)).length;return s===0?"none":s===r.length?"all":"partial"}function YD(e,t,n){const r=String(e).trim().toLowerCase(),s=Ia({collections:n}).find(o=>o.id===r||o.name.toLowerCase()===r);return Yo(s,t)}function GD(e,t,n,r){const s=(Array.isArray(n)?n:[]).map(u=>u.key).filter(Boolean),o=String(t).trim().toLowerCase(),a=Ia({collections:r}),l=YD(t,n,r),c=l.length>0?l:s;if(!e)return c;try{const u=localStorage.getItem(e);if(u!==null){const d=JSON.parse(u);if(Array.isArray(d)){const p=XA(n),f=Array.from(new Set(d.map(p).filter(Boolean)));if(s.length>0&&f.length===s.length)return c;const h=new Set(f),g=new Set(l),k=l.length>0&&l.every(y=>h.has(y)),b=a.some(y=>{if(!y.builtin||y.id===o||y.name.toLowerCase()===o)return!1;const v=Yo(y,n);return v.length>0&&v.every(w=>h.has(w))});return l.length>0&&b&&!k?c:f}}}catch{}return c}function Sl(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 JD(e){const t=e??"user";return t==="builtin"||t==="admin"?"af-project-card af-project-card--builtin":"af-project-card"}function XD(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 ux(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 QA(e){var n;if((n=e.collaboration)!=null&&n.role&&e.collaboration.role!=="owner")return`共享 Project / ${e.collaboration.ownerUsername||e.collaboration.ownerId} / ${e.id}`;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 QD="project:defaultCardDesc";function ZA(e,t){const n=e.description!=null?String(e.description).trim():"";return n!==""?n:t(QD)}function ZD(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ln({children:e,className:t="",query:n}){const r=n.trim(),s=String(e);if(!r)return i.jsx("span",{className:t,children:s});const o=new RegExp(`(${ZD(r)})`,"gi"),a=s.split(o);return i.jsx("span",{className:t,children:a.map((l,c)=>c%2===1?i.jsx("mark",{className:"af-search-hit",children:l},c):i.jsx("span",{children:l},c))})}function eF(e,t,n){const r=[String(e.id),ZA(e,n),QA(e),ux(e.source,n).label];return e.archived&&r.push(n("project:archived")),r.join(`
|
|
41
|
-
`).toLowerCase()}function tF(e,t,n){return t?eF(e,t,n).includes(t):!0}function nF(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 wy(e,t){const n=e.trim().toLowerCase();return n?t.filter(Boolean).join(`
|
|
42
|
-
`).toLowerCase().includes(n):!0}function EN(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 AN(e){return e!=null&&e.packageDir?e.packageDir:`marketplace/flow-snippets / ${(e==null?void 0:e.id)||""}`}const rF=["all","agent","control","provide","marketplace"],sF=["all","agent","control","provide"],eP="agentflow.projects.activityPanelOpen",dx="agentflow.projects.activitySelected";function iF(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(eP);return e!=="0"}function PN(e){return`${(e==null?void 0:e.flowSource)||"user"}:${(e==null?void 0:e.flowId)||""}`}function oF(){return typeof localStorage>"u"?"":localStorage.getItem(dx)||""}function sp(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,n])=>({key:t,...n&&typeof n=="object"?n:{}}))}function On(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 aF(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 vo(e){return`${(e==null?void 0:e.id)||""}:${(e==null?void 0:e.version)||""}:${(e==null?void 0:e.packageDir)||""}`}function tP(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 nP(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 fx(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 IN(e,t){return String((e==null?void 0:e.label)||(e==null?void 0:e.displayName)||(e==null?void 0:e.name)||fx(e,t))}function lF(e){return String((e==null?void 0:e.definitionId)||(e==null?void 0:e.type)||(e==null?void 0:e.runtimeType)||"").replace(/^marketplace:/,"")}function RN(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 cF(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 xy(e,t=16){const n=String(e||"").trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function uF(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 dF(e,t){const n=e.map(d=>d.id),r=new Set(n),s=new Map(n.map(d=>[d,0])),o=new Map(n.map(d=>[d,[]]));t.forEach(d=>{var p;!r.has(d.sourceId)||!r.has(d.targetId)||(s.set(d.targetId,(s.get(d.targetId)||0)+1),(p=o.get(d.sourceId))==null||p.push(d.targetId))});const a=new Map,l=n.filter(d=>(s.get(d)||0)===0);l.length===0&&n[0]&&l.push(n[0]),l.forEach(d=>a.set(d,0));for(let d=0;d<l.length;d+=1){const p=l[d],f=(a.get(p)||0)+1;for(const h of o.get(p)||[])(!a.has(h)||f>a.get(h))&&(a.set(h,f),l.push(h))}n.forEach((d,p)=>{a.has(d)||a.set(d,p%3)});const c=new Map,u=new Map;return n.forEach(d=>{const p=a.get(d)||0,f=c.get(p)||0;c.set(p,f+1),u.set(d,{x:p*190,y:f*86})}),u}function fF(e){var k,b,y,v;const t=tP(e),n=nP(e),r=new Map(t.map((w,C)=>[fx(w,C),IN(w,C)])),s=t.map((w,C)=>({id:fx(w,C),title:IN(w,C),meta:lF(w)})),o=n.map((w,C)=>{const N=RN(w,"source"),j=RN(w,"target");return{key:(w==null?void 0:w.id)||`${N}-${j}-${C}`,sourceId:N,targetId:j,source:r.get(N)||N||"?",target:r.get(j)||j||"?",label:cF(w)}}),a=(b=(k=e==null?void 0:e.snippet)==null?void 0:k.ui)!=null&&b.nodePositions&&typeof e.snippet.ui.nodePositions=="object"?e.snippet.ui.nodePositions:{},l=(v=(y=e==null?void 0:e.snippet)==null?void 0:y.ui)!=null&&v.nodeSizes&&typeof e.snippet.ui.nodeSizes=="object"?e.snippet.ui.nodeSizes:{},c=dF(s,o),u=s.map(w=>{const C=uF(a[w.id])||c.get(w.id)||{x:0,y:0},N=l[w.id]&&typeof l[w.id]=="object"?l[w.id]:{},j=Number(N.width),A=Number(N.height),I=Math.max(132,Math.min(210,Number.isFinite(j)?j*.62:150)),D=Math.max(48,Math.min(76,Number.isFinite(A)?A*.46:54));return{...w,x:C.x,y:C.y,width:I,height:D}}),d=new Map(u.map(w=>[w.id,w])),p=o.map(w=>{const C=d.get(w.sourceId),N=d.get(w.targetId);if(!C||!N)return null;const j=C.x+C.width,A=C.y+C.height/2,I=N.x,D=N.y+N.height/2,B=Math.max(48,Math.abs(I-j)*.45);return{...w,path:`M ${j} ${A} C ${j+B} ${A}, ${I-B} ${D}, ${I} ${D}`,labelX:(j+I)/2,labelY:(A+D)/2}}).filter(Boolean),f=u.reduce((w,C)=>({minX:Math.min(w.minX,C.x),minY:Math.min(w.minY,C.y),maxX:Math.max(w.maxX,C.x+C.width),maxY:Math.max(w.maxY,C.y+C.height)}),{minX:0,minY:0,maxX:420,maxY:220}),h=36,g=`${f.minX-h} ${f.minY-h} ${Math.max(360,f.maxX-f.minX+h*2)} ${Math.max(180,f.maxY-f.minY+h*2)}`;return{nodes:s,edges:o,diagram:{nodes:u,edges:p,viewBox:g}}}function Nl({resourceKind:e="",authUser:t=null}){var lt,zt,Mt,Xn,pn,Er;const{t:n}=Lr(),{navigate:r,path:s}=ei(),o=!!(t!=null&&t.isAdmin),[a,l]=m.useState(e||"all"),[c,u]=m.useState([]),[d,p]=m.useState([]),[f,h]=m.useState([]),[g,k]=m.useState([]),[b,y]=m.useState([]),[v,w]=m.useState(""),[C,N]=m.useState(!1),[j,A]=m.useState([]),[I,D]=m.useState(""),[B,W]=m.useState(""),[F,T]=m.useState(!1),[M,q]=m.useState(!1),[H,L]=m.useState(!1),[R,z]=m.useState(null),[E,Q]=m.useState(!1),[V,$]=m.useState(""),[ne,ce]=m.useState(iF),[X,re]=m.useState(oF),[Z,ie]=m.useState("all"),[te,ue]=m.useState(""),[fe,be]=m.useState("overview"),[qe,Ue]=m.useState({}),[Me,rt]=m.useState(""),[gt,bt]=m.useState({}),[oe,je]=m.useState(""),[Ve,tt]=m.useState(""),[Jt,st]=m.useState({}),[de,ve]=m.useState(""),[ze,Ze]=m.useState(""),[Se,Tt]=m.useState(""),[vn,dn]=m.useState(""),[nn,Sn]=m.useState(""),[ee,Ie]=m.useState(!1),[Fe,Je]=m.useState(""),[Pt,jt]=m.useState({hiddenBuiltins:[],promoted:[]}),lr=m.useRef(0),rn=m.useRef(0),gr=m.useRef(0),qn=m.useCallback(async()=>{var he,$e;const K=++rn.current;D("");try{const pe=await fetch("/api/flows");if(K!==rn.current)return;if(!pe.ok)throw new Error("HTTP "+pe.status);const Be=await pe.json();if(K!==rn.current)return;u(Array.isArray(Be)?Be:[])}catch(pe){if(K!==rn.current)return;u([]),D(String(pe.message||pe))}try{const pe=await fetch("/api/pipeline-recent-runs");if(K!==rn.current)return;if(pe.ok){const Be=await pe.json();if(K!==rn.current)return;A(Array.isArray(Be.runs)?Be.runs:[])}else A([])}catch{if(K!==rn.current)return;A([])}if(t!=null&&t.isAdmin)try{const pe=await fetch("/api/admin/builtin-flows");if(K!==rn.current)return;const Be=await pe.json().catch(()=>({}));pe.ok&&jt({hiddenBuiltins:Array.isArray((he=Be==null?void 0:Be.config)==null?void 0:he.hiddenBuiltins)?Be.config.hiddenBuiltins:[],promoted:Array.isArray(($e=Be==null?void 0:Be.config)==null?void 0:$e.promoted)?Be.config.promoted:[]})}catch{if(K!==rn.current)return;jt({hiddenBuiltins:[],promoted:[]})}else jt({hiddenBuiltins:[],promoted:[]});T(!0)},[t==null?void 0:t.isAdmin]),Mn=m.useCallback(async(K,he)=>{if(!(t!=null&&t.isAdmin)||!(K!=null&&K.id))return;const $e=`${he}:${K.source}:${K.id}`;Je($e),D("");try{const pe=await fetch("/api/admin/builtin-flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:he,flowId:K.id,ownerUserId:K.ownerUserId||t.userId})}),Be=await pe.json().catch(()=>({}));if(!pe.ok)throw new Error(Be.error||"更新内置配置失败");await qn()}catch(pe){D(String(pe.message||pe))}finally{Je("")}},[t==null?void 0:t.isAdmin,t==null?void 0:t.userId,qn]),Un=m.useCallback(async()=>{const K=++gr.current;W(""),q(!1);const he="/api/nodes",$e=e==="my-flows"?"/api/marketplace/flow-snippets?scope=owned":"/api/marketplace/flow-snippets";p([]),k([]),ue("");try{const[pe,Be,In,Et]=await Promise.all([fetch(he),fetch("/api/skills"),fetch("/api/skill-collections"),fetch($e)]),Ut=await pe.json().catch(()=>({})),xr=await Be.json().catch(()=>({})),uo=await In.json().catch(()=>({})),fo=await Et.json().catch(()=>({}));if(!pe.ok)throw new Error(Ut.error||"Nodes HTTP "+pe.status);if(!Be.ok)throw new Error(xr.error||"Skills HTTP "+Be.status);if(!In.ok)throw new Error(uo.error||"Collections HTTP "+In.status);if(!Et.ok)throw new Error(fo.error||"Flow snippets HTTP "+Et.status);if(K!==gr.current)return;p(Array.isArray(Ut.nodes)?Ut.nodes:Array.isArray(Ut)?Ut:[]),h(Array.isArray(xr.skills)?xr.skills:[]),y(Ia(uo)),k(Array.isArray(fo.snippets)?fo.snippets:[])}catch(pe){if(K!==gr.current)return;p([]),h([]),k([]),y([]),W(String(pe.message||pe))}finally{if(K!==gr.current)return;q(!0)}},[e]);m.useEffect(()=>{T(!1),qn(),Un()},[qn,Un]),m.useEffect(()=>{try{localStorage.setItem(eP,ne?"1":"0")}catch{}},[ne]),m.useEffect(()=>{try{X?localStorage.setItem(dx,X):localStorage.removeItem(dx)}catch{}},[X]),m.useEffect(()=>{let K=!1;return fetch("/api/ui-context").then(he=>he.json()).then(he=>{K||Ie(!!he.hideCommunityLinks)}).catch(()=>{}),()=>{K=!0}},[]);const Yn=m.useCallback(async K=>{if(!o)return;const he=Ia({collections:K});N(!0),W("");try{const $e=await fetch("/api/skill-collections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(WD(he))}),pe=await $e.json().catch(()=>({}));if(!$e.ok)throw new Error(pe.error||"Collections HTTP "+$e.status);y(Ia(pe))}catch($e){W(String($e.message||$e))}finally{N(!1)}},[o]),cr=m.useCallback(()=>{if(!o)return;const K=v.trim();if(!K)return;const he=K.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"collection",$e=new Set(b.map(Et=>Et.id));let pe=he,Be=2;for(;$e.has(pe);)pe=`${he}-${Be++}`;const In=Date.now();Yn([...b,{id:pe,name:K,skillKeys:[],createdAt:In,updatedAt:In}]),w(""),ie(`collection:${pe}`)},[o,v,Yn,b]),yr=m.useCallback(K=>{if(!o)return;const he=b.find(pe=>pe.id===K);if(he!=null&&he.builtin)return;const $e=b.filter(pe=>pe.id!==K);Z===`collection:${K}`&&ie("all"),Yn($e)},[o,Z,Yn,b]),Xr=m.useCallback((K,he,$e)=>{if(!o)return;const pe=String(he||"").trim();if(!pe)return;const Be=Date.now(),In=b.map(Et=>{if(Et.id!==K)return Et;const Ut=new Set(Et.skillKeys||[]);return $e?Ut.add(pe):Ut.delete(pe),{...Et,skillKeys:Array.from(Ut),updatedAt:Be}});Yn(In)},[o,Yn,b]),Gn=m.useCallback(async K=>{const he=K==null?void 0:K.packageId,$e=K==null?void 0:K.version;if(!he||!$e||!window.confirm(n("project:deleteMyNodeConfirm",{id:he,version:$e})))return;const pe=On(K);Ze(pe),Tt(""),W("");try{const Be=new URLSearchParams({id:he,version:$e}),In=await fetch(`/api/marketplace/node?${Be.toString()}`,{method:"DELETE"}),Et=await In.json().catch(()=>({}));if(!In.ok||(Et==null?void 0:Et.ok)===!1){const Ut=Array.isArray(Et==null?void 0:Et.usage)&&Et.usage.length>0?` ${n("project:deleteMyNodeUsedBy",{count:Et.usage.length})}`:"";throw new Error(((Et==null?void 0:Et.error)||"Delete failed")+Ut)}Tt(n("project:deleteMyNodeSuccess",{id:he,version:$e})),bt(Ut=>{const xr={...Ut};return delete xr[pe],xr}),st(Ut=>{const xr={};for(const[uo,fo]of Object.entries(Ut))uo.startsWith(`${pe}:`)||(xr[uo]=fo);return xr}),ue(""),await Un()}catch(Be){Tt(String(Be.message||Be))}finally{Ze("")}},[Un,n]),mt=m.useCallback(async K=>{const he=K==null?void 0:K.id,$e=(K==null?void 0:K.version)||"1.0.0";if(!he||!$e||!window.confirm(n("project:deleteMyFlowConfirm",{id:he,version:$e})))return;const pe=vo(K);dn(pe),Sn(""),W("");try{const Be=new URLSearchParams({id:he,version:$e}),In=await fetch(`/api/marketplace/flow-snippet?${Be.toString()}`,{method:"DELETE"}),Et=await In.json().catch(()=>({}));if(!In.ok||(Et==null?void 0:Et.ok)===!1)throw new Error((Et==null?void 0:Et.error)||"Delete failed");Sn(n("project:deleteMyFlowSuccess",{id:he,version:$e})),ue(""),await Un()}catch(Be){Sn(String(Be.message||Be))}finally{dn("")}},[Un,n]);m.useEffect(()=>{if(e==="nodes"||e==="my-nodes"||e==="my-flows"||e==="skills"){l(e),ie("all"),ue(""),be("overview");return}l(K=>K==="archived"?"archived":"all")},[e]),m.useEffect(()=>{if(s!=="/projects"&&s!=="/")return;const K=new URLSearchParams(window.location.search),he=K.get("tab");let $e=!1;if(he==="nodes"){r("/nodes");return}if(he==="my-nodes"){r("/my-nodes");return}if(he==="my-flows"){r("/my-flows");return}if(he==="skills"){r("/skills");return}if(he==="archived"?(l("archived"),K.delete("tab"),$e=!0):he&&(l("all"),K.delete("tab"),$e=!0),K.get("new")==="1"&&(L(!0),K.delete("new"),$e=!0),$e){const pe=K.toString();window.history.replaceState({},"",pe?`/projects?${pe}`:"/projects")}},[s,r]);const Fn=m.useMemo(()=>sD(j,nD(),c),[j,c,s]),Ft=m.useMemo(()=>Fn.filter(K=>nF(V,K)),[Fn,V]),fn=V.trim().toLowerCase(),zn=m.useMemo(()=>a==="archived"?c.filter(K=>K.archived):c.filter(K=>!K.archived),[c,a]),ps=m.useMemo(()=>zn.filter(K=>tF(K,fn,n)),[zn,fn,n]),ri=m.useMemo(()=>new Set((Pt.promoted||[]).map(K=>String((K==null?void 0:K.id)||"").trim()).filter(Boolean)),[Pt.promoted]),ur=m.useMemo(()=>(Pt.hiddenBuiltins||[]).map(K=>String(K||"").trim()).filter(Boolean),[Pt.hiddenBuiltins]),Wt=a==="nodes"||a==="my-nodes",ae=a==="my-nodes",ke=a==="my-flows",ot=m.useMemo(()=>d.filter(K=>ae&&!aF(K,t)?!1:(Z==="all"||(Z==="marketplace"?K.source==="marketplace":K.type===Z))&&wy(V,[K.id,K.label,K.displayName,K.description,K.type,K.source,K.packageId,K.version])),[t,d,ae,V,Z]),xt=m.useMemo(()=>{const K=new Map;for(const he of b)K.set(he.id,new Set(Yo(he,f)));return K},[f,b]),xn=m.useMemo(()=>[{id:"all",label:"全部"},...b.map(K=>{var he;return{id:`collection:${K.id}`,label:K.name,count:((he=xt.get(K.id))==null?void 0:he.size)||0,collection:K}}),{id:"ungrouped",label:"未分组"}],[xt,b]),on=m.useMemo(()=>f.filter(K=>{var pe;const he=On(K);let $e=Z==="all";if(Z.startsWith("collection:")){const Be=Z.slice(11);$e=!!((pe=xt.get(Be))!=null&&pe.has(he))}else Z==="ungrouped"&&($e=!Array.from(xt.values()).some(Be=>Be.has(he)));return $e&&wy(V,[K.name,K.id,K.description,K.sourceLabel,K.source,K.path])}),[f,V,Z,xt]),Jn=m.useMemo(()=>g.filter(K=>wy(V,[K.id,K.name,K.displayName,K.description,K.version,K.packageDir,Array.isArray(K.tags)?K.tags.join(" "):""])),[g,V]),Qr=Wt||ke||a==="skills",ct=m.useMemo(()=>ot.find(K=>On(K)===te)||ot[0]||null,[ot,te]),qt=m.useMemo(()=>on.find(K=>On(K)===te)||on[0]||null,[on,te]),Vt=m.useMemo(()=>Jn.find(K=>vo(K)===te)||Jn[0]||null,[Jn,te]),wr=qt?qe[On(qt)]:null,et=ct?gt[On(ct)]:null,_r=ct&&Ve?Jt[`${On(ct)}:${Ve}`]:null,Or=n(Wt?"project:searchNodes":ke?"project:searchFlows":a==="skills"?"project:searchSkills":"project:searchPipelines");m.useEffect(()=>{if(a!=="skills"||!qt)return;const K=On(qt);if(qe[K])return;let he=!1;return rt(K),fetch(`/api/skills/detail?key=${encodeURIComponent(K)}`).then($e=>$e.json().then(pe=>({ok:$e.ok,json:pe}))).then(({ok:$e,json:pe})=>{he||$e&&pe.skill&&Ue(Be=>({...Be,[K]:pe.skill}))}).catch(()=>{}).finally(()=>{he||rt("")}),()=>{he=!0}},[a,qt,qe]),m.useEffect(()=>{if(!Wt||!ct)return;const K=On(ct);if(gt[K])return;let he=!1;return je(K),fetch(`/api/nodes/detail?id=${encodeURIComponent(ct.id)}`).then($e=>$e.json().then(pe=>({ok:$e.ok,json:pe}))).then(({ok:$e,json:pe})=>{he||$e&&bt(Be=>({...Be,[K]:pe}))}).catch(()=>{}).finally(()=>{he||je("")}),()=>{he=!0}},[Wt,ct,gt]),m.useEffect(()=>{if(!Wt)return;const K=Array.isArray(et==null?void 0:et.files)?et.files:[];tt(he=>{var $e;return he&&K.some(pe=>pe.path===he)?he:(($e=K[0])==null?void 0:$e.path)||""})},[Wt,et]),m.useEffect(()=>{if(!Wt||!ct||!Ve)return;const K=`${On(ct)}:${Ve}`;if(Jt[K])return;let he=!1;return ve(K),fetch(`/api/nodes/file?id=${encodeURIComponent(ct.id)}&path=${encodeURIComponent(Ve)}`).then($e=>$e.json().then(pe=>({ok:$e.ok,json:pe}))).then(({ok:$e,json:pe})=>{he||$e&&st(Be=>({...Be,[K]:pe}))}).catch(()=>{}).finally(()=>{he||ve("")}),()=>{he=!0}},[Wt,ct,Ve,Jt]),m.useEffect(()=>{Tt("")},[te,a]);const si=K=>{r(rp(K,"workspace"))},co=K=>{re(PN(K)),r(rp({id:K.flowId,source:K.flowSource,archived:!!K.archived},"workspace"))},As=m.useCallback(K=>{var he,$e;K.preventDefault(),K.stopPropagation(),($e=(he=K.dataTransfer)==null?void 0:he.types)!=null&&$e.includes("Files")&&(lr.current+=1,Q(!0))},[]),se=m.useCallback(K=>{K.preventDefault(),K.stopPropagation(),lr.current-=1,lr.current<=0&&(lr.current=0,Q(!1))},[]),Ne=m.useCallback(K=>{K.preventDefault(),K.stopPropagation()},[]),Pe=m.useCallback(K=>{var pe,Be;K.preventDefault(),K.stopPropagation(),lr.current=0,Q(!1);const he=(Be=(pe=K.dataTransfer)==null?void 0:pe.files)==null?void 0:Be[0];if(!he)return;const $e=he.name.toLowerCase();!$e.endsWith(".yaml")&&!$e.endsWith(".yml")&&!$e.endsWith(".zip")||z(he)},[]);return i.jsxs("div",{className:"af-projects"+(E?" af-projects--drop-target":""),onDragEnter:As,onDragLeave:se,onDragOver:Ne,onDrop:Pe,children:[i.jsxs("header",{className:"af-projects-top",children:[e?i.jsx("div",{className:"af-projects-tabs af-projects-tabs--empty","aria-hidden":!0}):i.jsxs("div",{className:"af-projects-tabs",children:[i.jsx("button",{type:"button",className:a==="all"?"af-tab af-tab--active":"af-tab",onClick:()=>l("all"),children:n("project:all")}),i.jsx("button",{type:"button",className:a==="archived"?"af-tab af-tab--active":"af-tab",onClick:()=>l("archived"),children:n("project:archived")})]}),i.jsxs("div",{className:"af-projects-top-right",children:[i.jsxs("div",{className:"af-search-wrap",children:[i.jsx("span",{className:"material-symbols-outlined af-search-icon",children:"search"}),i.jsx("input",{className:"af-search"+(V.trim()?" af-search--has-clear":""),type:"search",placeholder:Or,"aria-label":Or,autoComplete:"off",value:V,onChange:K=>$(K.target.value),onKeyDown:K=>{K.key==="Escape"&&($(""),K.currentTarget.blur())}}),V.trim()?i.jsx("button",{type:"button",className:"af-search-clear","aria-label":"Clear search",onClick:()=>$(""),children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),Qr?i.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>Un(),children:n("project:refreshResources")}):i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"af-icon-btn"+(ne?" af-icon-btn--active":""),"aria-label":n("flow:palette.toggleRecentActivity"),"aria-expanded":ne,"aria-controls":"af-recent-activity-panel",onClick:()=>ce(K=>!K),children:i.jsx("span",{className:"material-symbols-outlined",children:"notifications"})}),i.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>L(!0),children:n("project:createNew")})]})]})]}),i.jsxs("div",{className:"af-projects-body",children:[i.jsxs("section",{className:"af-projects-main",children:[i.jsxs("header",{className:"af-projects-section-head",children:[i.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")}),i.jsx("p",{className:"af-projects-sub",children:fn?n("project:filterResult",{count:a==="nodes"||a==="my-nodes"?ot.length:a==="my-flows"?Jn.length:a==="skills"?on.length:ps.length}):a==="my-nodes"?n("project:myNodesHint",{count:ot.length}):a==="my-flows"?n("project:myFlowsHint",{count:Jn.length}):a==="nodes"?n("project:nodesHint",{count:d.length}):a==="skills"?n("project:skillsHint",{count:f.length}):n(a==="archived"?"project:archivedHint":"project:activeHint")}),I?i.jsx("p",{className:"af-err af-projects-api-hint",children:I}):null,B&&Qr?i.jsx("p",{className:"af-err af-projects-api-hint",children:B}):null]}),Qr?i.jsxs("div",{className:"af-resource-toolbar",children:[a==="skills"?i.jsx(HD,{onChanged:Un,canManage:!!(t!=null&&t.isAdmin)}):null,i.jsxs("div",{className:"af-resource-purpose",children:[i.jsx("span",{className:"material-symbols-outlined",children:ke?"schema":Wt?ae?"deployed_code":"account_tree":"extension"}),i.jsxs("div",{children:[i.jsx("h3",{children:n(ke?"project:myFlowsPurposeTitle":ae?"project:myNodesPurposeTitle":Wt?"project:nodesPurposeTitle":"project:skillsPurposeTitle")}),i.jsx("p",{children:n(ke?"project:myFlowsPurposeDesc":ae?"project:myNodesPurposeDesc":Wt?"project:nodesPurposeDesc":"project:skillsPurposeDesc")})]})]}),ke?null:i.jsxs(i.Fragment,{children:[Wt?i.jsxs("div",{className:"af-resource-filter-row",children:[i.jsx("button",{type:"button",className:"af-resource-filter"+(ae?"":" af-resource-filter--active"),onClick:()=>{l("nodes"),ie("all"),ue("")},children:n("project:nodeScopeAll")}),i.jsx("button",{type:"button",className:"af-resource-filter"+(ae?" af-resource-filter--active":""),onClick:()=>{l("my-nodes"),ie("all"),ue("")},children:n("project:nodeScopeMine")})]}):null,i.jsx("div",{className:"af-resource-filter-row",children:(Wt?(ae?sF:rF).map(K=>({id:K,label:n(`project:resourceFilter.${K}`)})):xn).map(K=>K.collection?i.jsxs("span",{className:"af-resource-filter-chip"+(Z===K.id?" af-resource-filter-chip--active":""),children:[i.jsxs("button",{type:"button",className:"af-resource-filter af-resource-filter--embedded",onClick:()=>{ie(K.id),ue("")},children:[K.label,i.jsx("em",{children:K.count}),K.collection.builtin?i.jsx("strong",{children:"built-in"}):null]}),o&&!K.collection.builtin?i.jsx("button",{type:"button",className:"af-resource-filter-chip__delete",disabled:C,"aria-label":`删除 ${K.collection.name}`,onClick:()=>yr(K.collection.id),children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})}):null]},K.id):i.jsx("button",{type:"button",className:"af-resource-filter"+(Z===K.id?" af-resource-filter--active":""),onClick:()=>{ie(K.id),ue("")},children:K.label},K.id))})]}),a==="skills"&&o?i.jsx("div",{className:"af-skill-collections-manager",children:i.jsxs("div",{className:"af-skill-collections-create",children:[i.jsx("input",{className:"af-set-input af-set-input--sm",value:v,onChange:K=>w(K.target.value),onKeyDown:K=>{K.key==="Enter"&&cr()},placeholder:"新建 skill collection"}),i.jsxs("button",{type:"button",className:"af-set-btn-add af-set-btn-add--compact",disabled:!v.trim()||C,onClick:()=>cr(),children:[i.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新建"]})]})}):null]}):null,Wt?i.jsx("div",{className:"af-resource-grid",children:ot.length>0?ot.map(K=>i.jsxs("button",{type:"button",className:"af-resource-card"+(ct&&On(K)===On(ct)?" af-resource-card--active":""),onClick:()=>ue(On(K)),children:[i.jsxs("div",{className:"af-resource-card-head",children:[i.jsx("span",{className:Sl(K.type==="control"?"secondary":K.type==="provide"?"primary":"muted"),children:i.jsx(Ln,{query:V,children:K.type||"node"})}),i.jsx("span",{className:"af-resource-source",children:i.jsx(Ln,{query:V,children:EN(K.source,n)})})]}),i.jsx("h3",{className:"af-project-title",children:i.jsx(Ln,{query:V,children:K.label||K.displayName||K.id})}),i.jsx("p",{className:"af-project-desc",children:i.jsx(Ln,{query:V,children:K.description||n("project:noDescription")})}),i.jsxs("div",{className:"af-resource-meta-row",children:[i.jsx("span",{children:i.jsx(Ln,{query:V,children:K.id})}),i.jsx("span",{children:n("project:nodeSlots",{inputs:Object.keys(K.inputs||{}).length,outputs:Object.keys(K.outputs||{}).length})})]}),K.packageId?i.jsxs("div",{className:"af-project-path",children:[i.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"deployed_code"}),i.jsx("span",{className:"af-path-text",children:i.jsx(Ln,{query:V,children:`${K.packageId}${K.version?` / ${K.version}`:""}`})})]}):null]},`${K.id}:${K.source||""}:${K.packageId||""}`)):M?i.jsx("div",{className:"af-projects-empty-block",children:i.jsx("p",{className:"af-projects-empty",children:fn?n("project:noNodeMatch",{query:V.trim()}):n(ae?"project:noMyNodes":"project:noNodes")})}):i.jsx("div",{className:"af-projects-empty-block",children:i.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):ke?i.jsx("div",{className:"af-resource-grid",children:Jn.length>0?Jn.map(K=>{const he=tP(K),$e=nP(K),pe=Number.isFinite(Number(K.nodeCount))?Number(K.nodeCount):he.length,Be=Number.isFinite(Number(K.edgeCount))?Number(K.edgeCount):$e.length;return i.jsxs("button",{type:"button",className:"af-resource-card"+(Vt&&vo(K)===vo(Vt)?" af-resource-card--active":""),onClick:()=>ue(vo(K)),children:[i.jsxs("div",{className:"af-resource-card-head",children:[i.jsx("span",{className:Sl("primary"),children:i.jsx(Ln,{query:V,children:K.version?`v${K.version}`:"flow"})}),i.jsx("span",{className:"af-resource-source",children:n("project:flowSnippet")})]}),i.jsx("h3",{className:"af-project-title",children:i.jsx(Ln,{query:V,children:K.displayName||K.name||K.id})}),i.jsx("p",{className:"af-project-desc",children:i.jsx(Ln,{query:V,children:K.description||n("project:noDescription")})}),i.jsxs("div",{className:"af-resource-meta-row",children:[i.jsx("span",{children:n("project:flowSnippetNodes",{nodes:pe,edges:Be})}),i.jsx("span",{children:i.jsx(Ln,{query:V,children:K.id})})]}),i.jsxs("div",{className:"af-project-path",children:[i.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"schema"}),i.jsx("span",{className:"af-path-text",children:i.jsx(Ln,{query:V,children:AN(K)})})]})]},vo(K))}):M?i.jsx("div",{className:"af-projects-empty-block",children:i.jsx("p",{className:"af-projects-empty",children:fn?n("project:noFlowSnippetMatch",{query:V.trim()}):n("project:noMyFlows")})}):i.jsx("div",{className:"af-projects-empty-block",children:i.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):a==="skills"?i.jsx("div",{className:"af-resource-grid",children:on.length>0?on.map(K=>{const he=On(K),$e=b.filter(pe=>{var Be;return(Be=xt.get(pe.id))==null?void 0:Be.has(he)});return i.jsxs("button",{type:"button",className:"af-resource-card"+(qt&&he===On(qt)?" af-resource-card--active":""),onClick:()=>ue(he),children:[i.jsxs("div",{className:"af-resource-card-head",children:[i.jsx("span",{className:Sl(K.source==="builtin"?"muted":"primary"),children:i.jsx(Ln,{query:V,children:K.sourceLabel||K.source||"skill"})}),i.jsx("span",{className:"af-resource-source",children:n("project:skill")})]}),i.jsx("h3",{className:"af-project-title",children:i.jsx(Ln,{query:V,children:K.name||K.id})}),i.jsx("p",{className:"af-project-desc",children:i.jsx(Ln,{query:V,children:K.description||n("project:noDescription")})}),i.jsxs("div",{className:"af-project-path",children:[i.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"extension"}),i.jsx("span",{className:"af-path-text",children:i.jsx(Ln,{query:V,children:K.path||K.key||""})})]}),i.jsxs("div",{className:"af-skill-card-collections",children:[$e.slice(0,3).map(pe=>i.jsx("span",{children:pe.name},pe.id)),$e.length===0?i.jsx("span",{className:"af-skill-card-collection-empty",children:"未分组"}):null]})]},K.key||`${K.source}:${K.name}`)}):M?i.jsx("div",{className:"af-projects-empty-block",children:i.jsx("p",{className:"af-projects-empty",children:fn?n("project:noSkillMatch",{query:V.trim()}):n("project:noSkills")})}):i.jsx("div",{className:"af-projects-empty-block",children:i.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):i.jsxs(i.Fragment,{children:[t!=null&&t.isAdmin&&a==="all"&&ur.length>0?i.jsxs("div",{className:"af-project-admin-panel",children:[i.jsxs("div",{children:[i.jsx("strong",{children:"已隐藏内置"}),i.jsx("span",{children:"这些包内置流水线不会出现在普通项目列表中。"})]}),i.jsx("div",{className:"af-project-admin-hidden-list",children:ur.map(K=>{const he=Fe===`show-builtin:builtin:${K}`;return i.jsxs("button",{type:"button",disabled:he,onClick:()=>Mn({id:K,source:"builtin"},"show-builtin"),children:[i.jsx("span",{children:K}),i.jsx("em",{children:he?"恢复中":"恢复"})]},K)})})]}):null,i.jsxs("div",{className:"af-project-grid",children:[ps.length>0?ps.map(K=>{var In,Et;const he=(t==null?void 0:t.isAdmin)&&K.source==="user"&&!K.archived&&!ri.has(K.id),$e=(t==null?void 0:t.isAdmin)&&K.source==="admin",pe=(t==null?void 0:t.isAdmin)&&K.source==="builtin",Be=Fe.endsWith(`:${K.source}:${K.id}`);return i.jsx("div",{className:JD(K.source),role:"button",tabIndex:0,onClick:()=>si(K),onKeyDown:Ut=>{(Ut.key==="Enter"||Ut.key===" ")&&(Ut.preventDefault(),si(K))},children:i.jsxs("div",{className:"af-project-card-body",children:[i.jsx("span",{className:Sl(ux(K.source,n).tone),children:i.jsx(Ln,{query:V,children:ux(K.source,n).label})}),K.source==="workspace"&&((In=K.collaboration)!=null&&In.role)?i.jsx("span",{className:Sl(K.collaboration.role==="owner"?"primary":"muted"),children:K.collaboration.role==="owner"?"我创建的":`${K.collaboration.ownerUsername||K.collaboration.ownerId} 分享`}):null,K.archived?i.jsx("span",{className:Sl("muted"),children:i.jsx(Ln,{query:V,children:n("project:archived")})}):null,i.jsx("h3",{className:"af-project-title",children:i.jsx(Ln,{query:V,children:K.id})}),i.jsx("p",{className:"af-project-desc",children:i.jsx(Ln,{query:V,children:ZA(K,n)})}),i.jsxs("div",{className:"af-project-path",children:[i.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"database"}),i.jsx("span",{className:"af-path-text",children:i.jsx(Ln,{query:V,children:QA(K)})})]}),t!=null&&t.isAdmin?i.jsxs("div",{className:"af-project-admin-actions",onClick:Ut=>Ut.stopPropagation(),onKeyDown:Ut=>Ut.stopPropagation(),children:[he?i.jsx("button",{type:"button",disabled:Be,onClick:()=>Mn(K,"promote"),children:"设为内置"}):null,$e?i.jsx("button",{type:"button",disabled:Be,onClick:()=>Mn(K,"unpromote"),children:"取消内置"}):null,pe?i.jsx("button",{type:"button",disabled:Be,onClick:()=>Mn(K,"hide-builtin"),children:"隐藏内置"}):null]}):null]})},`${K.id}:${K.source??"user"}:${K.archived?"a":""}:${((Et=K.collaboration)==null?void 0:Et.id)||"own"}`)}):F?zn.length===0?i.jsxs("div",{className:"af-projects-empty-block",children:[i.jsx("p",{className:"af-projects-empty",children:a==="archived"?n("project:noArchived"):c.length>0?n("project:noActive"):n(I?"project:loadFailed":"project:noPipelines")}),!I&&c.length===0&&a==="all"?i.jsx("p",{className:"af-projects-empty-hint",children:n("project:emptyHint",{code1:"agentflow ui",code2:".agentflow/pipelines"})}):null]}):i.jsx("div",{className:"af-projects-empty-block",children:i.jsx("p",{className:"af-projects-empty",children:n("project:noMatch",{query:V.trim()})})}):i.jsx("div",{className:"af-projects-empty-block",children:i.jsx("p",{className:"af-projects-empty",children:n("project:loadingPipelines")})}),i.jsxs("button",{type:"button",className:"af-project-add",onClick:()=>L(!0),children:[i.jsx("span",{className:"material-symbols-outlined af-project-add-icon",children:"add_circle"}),i.jsx("span",{className:"af-project-add-label",children:n("project:newPipeline")})]}),ee?null:i.jsxs("a",{className:"af-hub-card",href:"https://agentflow-hub.com",target:"_blank",rel:"noopener noreferrer",children:[i.jsx("div",{className:"af-hub-card__glow","aria-hidden":!0}),i.jsxs("span",{className:"af-hub-card__eyebrow",children:[i.jsx("span",{className:"material-symbols-outlined af-hub-card__eyebrow-icon",children:"hub"}),n("project:hubCard.eyebrow")]}),i.jsx("h3",{className:"af-hub-card__title",children:n("project:hubCard.title")}),i.jsx("p",{className:"af-hub-card__desc",children:n("project:hubCard.desc")}),i.jsxs("span",{className:"af-hub-card__cta",children:[n("project:hubCard.cta"),i.jsx("span",{className:"material-symbols-outlined af-hub-card__cta-icon",children:"arrow_outward"})]}),i.jsx("code",{className:"af-hub-card__cli",children:n("project:hubCard.cliHint")})]})]})]})]}),Qr?i.jsx("aside",{className:"af-resource-detail","aria-label":n(Wt?"project:nodeDetail":ke?"project:flowDetail":"project:skillDetail"),children:Wt&&ct?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"af-resource-detail-head",children:[i.jsx("span",{className:"material-symbols-outlined",children:"account_tree"}),i.jsxs("div",{children:[i.jsx("h3",{children:ct.label||ct.displayName||ct.id}),i.jsx("p",{children:ct.id})]})]}),i.jsx("div",{className:"af-resource-detail-tabs",children:["overview","schema","runtime","files","usage"].map(K=>i.jsx("button",{type:"button",className:"af-resource-detail-tab"+(fe===K?" af-resource-detail-tab--active":""),onClick:()=>be(K),children:n(`project:nodeDetailTabs.${K}`)},K))}),oe===On(ct)?i.jsx("p",{className:"af-resource-detail-desc",children:n("project:loadingResources")}):fe==="overview"?i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"af-resource-detail-desc",children:ct.description||((lt=et==null?void 0:et.node)==null?void 0:lt.description)||n("project:noDescription")}),i.jsxs("dl",{className:"af-resource-detail-kv",children:[i.jsxs("div",{children:[i.jsx("dt",{children:n("project:detailType")}),i.jsx("dd",{children:ct.type||((zt=et==null?void 0:et.node)==null?void 0:zt.type)||"node"})]}),i.jsxs("div",{children:[i.jsx("dt",{children:n("project:detailSource")}),i.jsx("dd",{children:EN(ct.source,n)})]}),ct.packageId?i.jsxs("div",{children:[i.jsx("dt",{children:n("project:detailPackage")}),i.jsx("dd",{children:ct.packageId})]}):null,ct.version?i.jsxs("div",{children:[i.jsx("dt",{children:n("project:detailVersion")}),i.jsx("dd",{children:ct.version})]}):null,ct.packageDir||et!=null&&et.baseDir?i.jsxs("div",{children:[i.jsx("dt",{children:n("project:detailPath")}),i.jsx("dd",{children:ct.packageDir||(et==null?void 0:et.baseDir)})]}):null,i.jsxs("div",{children:[i.jsx("dt",{children:n("project:detailEditable")}),i.jsx("dd",{children:(et==null?void 0:et.readOnly)===!1?n("project:editable"):n("project:readOnly")})]})]}),ae&&ct.source==="marketplace"?i.jsxs("div",{className:"af-resource-detail-section af-resource-danger-zone",children:[i.jsx("h4",{children:n("project:myNodeManagement")}),i.jsx("p",{children:n("project:deleteMyNodeHint")}),i.jsxs("button",{type:"button",className:"af-btn-secondary af-btn-danger",disabled:ze===On(ct),onClick:()=>Gn(ct),children:[i.jsx("span",{className:"material-symbols-outlined",children:"delete"}),ze===On(ct)?n("project:deletingMyNode"):n("project:deleteMyNode")]}),Se?i.jsx("p",{className:"af-resource-action-message",children:Se}):null]}):null,i.jsxs("div",{className:"af-resource-detail-section",children:[i.jsx("h4",{children:n("project:resourceMeaning")}),i.jsx("p",{children:n("project:nodesMeaning")})]})]}):fe==="schema"?i.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[i.jsx("h4",{children:n("project:nodeSchema")}),i.jsxs("div",{className:"af-resource-slot-group",children:[i.jsx("span",{children:n("project:nodeInputs")}),sp(((Mt=et==null?void 0:et.node)==null?void 0:Mt.inputs)||ct.inputs).length>0?sp(((Xn=et==null?void 0:et.node)==null?void 0:Xn.inputs)||ct.inputs).map(K=>i.jsxs("code",{children:[K.name||K.key,K.type?`: ${K.type}`:""]},K.key)):i.jsx("em",{children:n("project:noSlots")})]}),i.jsxs("div",{className:"af-resource-slot-group",children:[i.jsx("span",{children:n("project:nodeOutputs")}),sp(((pn=et==null?void 0:et.node)==null?void 0:pn.outputs)||ct.outputs).length>0?sp(((Er=et==null?void 0:et.node)==null?void 0:Er.outputs)||ct.outputs).map(K=>i.jsxs("code",{children:[K.name||K.key,K.type?`: ${K.type}`:""]},K.key)):i.jsx("em",{children:n("project:noSlots")})]})]}):fe==="runtime"?i.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[i.jsx("h4",{children:n("project:nodeRuntime")}),et!=null&&et.runtime?i.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(et.runtime,null,2)}):i.jsx("p",{children:n("project:noRuntimeManifest")}),et!=null&&et.body?i.jsxs(i.Fragment,{children:[i.jsx("h4",{className:"af-resource-detail-subtitle",children:n("project:nodeBody")}),i.jsx("pre",{className:"af-resource-skill-preview",children:et.body})]}):i.jsx("p",{children:n("project:noNodeBody")})]}):fe==="files"?i.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[i.jsx("h4",{children:n("project:nodeFiles")}),Array.isArray(et==null?void 0:et.files)&&et.files.length>0?i.jsxs("div",{className:"af-node-file-browser",children:[i.jsx("div",{className:"af-node-file-list",children:et.files.map(K=>i.jsxs("button",{type:"button",className:"af-node-file-item"+(Ve===K.path?" af-node-file-item--active":""),onClick:()=>tt(K.path),children:[i.jsx("span",{className:"material-symbols-outlined",children:"description"}),i.jsx("span",{children:K.path})]},K.path))}),i.jsxs("pre",{className:"af-resource-skill-preview",children:[de===`${On(ct)}:${Ve}`?n("project:loadingResources"):_r!=null&&_r.binary?n("project:binaryFile"):(_r==null?void 0:_r.content)||n("project:selectNodeFile"),_r!=null&&_r.truncated?`
|
|
43
|
-
|
|
44
|
-
${n("project:fileTruncated")}`:""]})]}):i.jsx("p",{children:n("project:noNodeFiles")})]}):i.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[i.jsx("h4",{children:n("project:nodeUsage")}),Array.isArray(et==null?void 0:et.usage)&&et.usage.length>0?i.jsx("div",{className:"af-node-usage-list",children:et.usage.map(K=>i.jsxs("div",{className:"af-node-usage-item",children:[i.jsx("strong",{children:K.flowId}),i.jsxs("span",{children:[K.flowSource,K.archived?` · ${n("project:archived")}`:""]}),i.jsx("em",{children:K.instances.map(he=>he.label||he.instanceId).join(", ")})]},`${K.flowSource}:${K.flowId}:${K.archived?"a":""}`))}):i.jsx("p",{children:n("project:noNodeUsage")})]})]}):ke&&Vt?(()=>{const K=fF(Vt);return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"af-resource-detail-head",children:[i.jsx("span",{className:"material-symbols-outlined",children:"schema"}),i.jsxs("div",{children:[i.jsx("h3",{children:Vt.displayName||Vt.name||Vt.id}),i.jsx("p",{children:Vt.id})]})]}),i.jsx("p",{className:"af-resource-detail-desc",children:Vt.description||n("project:noDescription")}),i.jsxs("dl",{className:"af-resource-detail-kv",children:[i.jsxs("div",{children:[i.jsx("dt",{children:n("project:detailVersion")}),i.jsx("dd",{children:Vt.version||"1.0.0"})]}),i.jsxs("div",{children:[i.jsx("dt",{children:n("project:detailPath")}),i.jsx("dd",{children:AN(Vt)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:n("project:flowSnippetScale")}),i.jsx("dd",{children:n("project:flowSnippetNodes",{nodes:Number.isFinite(Number(Vt.nodeCount))?Number(Vt.nodeCount):K.nodes.length,edges:Number.isFinite(Number(Vt.edgeCount))?Number(Vt.edgeCount):K.edges.length})})]})]}),i.jsxs("div",{className:"af-resource-detail-section",children:[i.jsx("h4",{children:n("project:resourceMeaning")}),i.jsx("p",{children:n("project:myFlowsMeaning")})]}),i.jsxs("div",{className:"af-resource-detail-section af-resource-danger-zone",children:[i.jsx("h4",{children:n("project:myFlowManagement")}),i.jsx("p",{children:n("project:deleteMyFlowHint")}),i.jsxs("button",{type:"button",className:"af-btn-secondary af-btn-danger",disabled:vn===vo(Vt),onClick:()=>mt(Vt),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"}),vn===vo(Vt)?n("project:deletingMyFlow"):n("project:deleteMyFlow")]}),nn?i.jsx("p",{className:"af-resource-action-message",children:nn}):null]}),i.jsxs("div",{className:"af-resource-detail-section",children:[i.jsx("h4",{children:n("project:flowSnippetPreview")}),K.diagram.nodes.length>0?i.jsx("div",{className:"af-flow-snippet-map",children:i.jsxs("svg",{viewBox:K.diagram.viewBox,role:"img","aria-label":n("project:flowSnippetPreview"),children:[i.jsx("defs",{children:i.jsx("marker",{id:"af-flow-snippet-arrow",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",markerUnits:"strokeWidth",children:i.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z"})})}),i.jsx("g",{className:"af-flow-snippet-map__edges",children:K.diagram.edges.map(he=>i.jsxs("g",{children:[i.jsx("path",{d:he.path}),he.label?i.jsx("text",{x:he.labelX,y:he.labelY-5,textAnchor:"middle",children:xy(he.label,18)}):null]},he.key))}),i.jsx("g",{className:"af-flow-snippet-map__nodes",children:K.diagram.nodes.map((he,$e)=>i.jsxs("g",{transform:`translate(${he.x} ${he.y})`,children:[i.jsx("rect",{width:he.width,height:he.height,rx:"10"}),i.jsx("circle",{cx:"19",cy:he.height/2,r:"12"}),i.jsx("text",{className:"af-flow-snippet-map__node-index",x:"19",y:he.height/2+4,textAnchor:"middle",children:$e+1}),i.jsx("text",{className:"af-flow-snippet-map__node-title",x:"40",y:he.height/2-3,children:xy(he.title)}),i.jsx("text",{className:"af-flow-snippet-map__node-meta",x:"40",y:he.height/2+16,children:xy(he.meta||he.id,20)})]},he.id))})]})}):i.jsx("p",{className:"af-resource-detail-desc",children:n("project:noFlowSnippetPreview")}),i.jsxs("details",{className:"af-flow-snippet-json",children:[i.jsx("summary",{children:n("project:flowSnippetJson")}),i.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(Vt.snippet||{},null,2)})]})]})]})})():a==="skills"&&qt?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"af-resource-detail-head",children:[i.jsx("span",{className:"material-symbols-outlined",children:"extension"}),i.jsxs("div",{children:[i.jsx("h3",{children:qt.name||qt.id}),i.jsx("p",{children:qt.sourceLabel||qt.source})]})]}),i.jsx("p",{className:"af-resource-detail-desc",children:qt.description||n("project:noDescription")}),i.jsxs("dl",{className:"af-resource-detail-kv",children:[i.jsxs("div",{children:[i.jsx("dt",{children:n("project:detailSource")}),i.jsx("dd",{children:qt.sourceLabel||qt.source})]}),i.jsxs("div",{children:[i.jsx("dt",{children:n("project:detailPath")}),i.jsx("dd",{children:qt.path||qt.key})]})]}),i.jsxs("div",{className:"af-resource-detail-section",children:[i.jsx("h4",{children:"Collections"}),b.length===0?i.jsx("p",{children:"暂无 collection。可在左侧新建后再添加。"}):i.jsx("div",{className:"af-skill-detail-collections",children:b.map(K=>{const he=On(qt),$e=xt.get(K.id)||new Set,pe=$e.has(he);return i.jsxs("label",{className:"af-composer-skill-option af-skill-detail-collection-option",children:[i.jsx("input",{type:"checkbox",checked:pe,disabled:C||!o,onChange:Be=>Xr(K.id,he,Be.target.checked)}),i.jsxs("span",{className:"af-composer-skill-option-main",children:[i.jsx("span",{className:"af-composer-skill-option-title",children:K.name}),i.jsxs("span",{className:"af-composer-skill-option-desc",children:[$e.size," skills"]})]})]},K.id)})})]}),i.jsxs("div",{className:"af-resource-detail-section",children:[i.jsx("h4",{children:n("project:resourceMeaning")}),i.jsx("p",{children:n("project:skillsMeaning")})]}),i.jsxs("div",{className:"af-resource-detail-section",children:[i.jsx("h4",{children:n("project:skillPreview")}),i.jsx("pre",{className:"af-resource-skill-preview",children:Me===On(qt)?n("project:loadingResources"):(wr==null?void 0:wr.body)||(wr==null?void 0:wr.content)||n("project:skillPreviewEmpty")})]})]}):i.jsx("p",{className:"af-activity-empty",children:n("project:selectResource")})}):i.jsxs("aside",{id:"af-recent-activity-panel",className:"af-activity"+(ne?"":" af-activity--hidden"),"aria-hidden":!ne,"aria-label":n("project:recentActivity"),children:[i.jsxs("h2",{className:"af-activity-title",children:[i.jsx("span",{className:"af-activity-bullet"}),n("project:recentActivity")]}),i.jsx("div",{className:"af-activity-list",children:Ft.length===0?i.jsx("p",{className:"af-activity-empty",children:Fn.length===0?n("project:noRecentActivity"):n("project:noMatchRecent")}):Ft.map(K=>{const he=X===PN(K);return i.jsxs("button",{type:"button",className:"af-activity-row af-activity-row--action"+(he?" af-activity-row--active":""),"aria-current":he?"page":void 0,onClick:()=>co(K),children:[i.jsxs("div",{className:"af-activity-row-top",children:[i.jsx("h4",{className:"af-activity-name",children:i.jsx(Ln,{query:V,children:K.flowId})}),i.jsx("span",{className:"af-activity-time",children:CN(K.at,n)})]}),i.jsxs("div",{className:"af-activity-meta",children:[i.jsx("span",{className:XD(K.kind),children:K.kind==="executed"?"play_arrow":"visibility"}),i.jsxs("p",{className:"af-activity-text",children:[K.kind==="executed"?n("project:recentRun"):n("project:recentOpen")," · ",CN(K.at,n)]})]})]},`${K.kind}-${K.flowId}-${K.flowSource}-${K.at}`)})})]})]}),i.jsx(TD,{open:H,onClose:()=>L(!1),onCreated:async K=>{L(!1),await qn();const he=K.source??"user";r(rp({id:K.id,source:he},"workspace"))}}),R?i.jsx(ID,{file:R,onClose:()=>z(null),onImported:async K=>{z(null),await qn();const he=K.source??"user";r(rp({id:K.id,source:he},"workspace"))}},`${R.name}-${R.size}-${R.lastModified}`):null]})}function Kn(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=Kn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var pF={value:()=>{}};function Pm(){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 Up(n)}function Up(e){this._=e}function hF(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}})}Up.prototype=Pm.prototype={constructor:Up,on:function(e,t){var n=this._,r=hF(e+"",n),s,o=-1,a=r.length;if(arguments.length<2){for(;++o<a;)if((s=(e=r[o]).type)&&(s=mF(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<a;)if(s=(e=r[o]).type)n[s]=TN(n[s],e.name,t);else if(t==null)for(s in n)n[s]=TN(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 Up(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,o;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,s=o.length;r<s;++r)o[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,o=r.length;s<o;++s)r[s].value.apply(t,n)}};function mF(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function TN(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=pF,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var px="http://www.w3.org/1999/xhtml";const MN={svg:"http://www.w3.org/2000/svg",xhtml:px,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Im(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),MN.hasOwnProperty(t)?{space:MN[t],local:e}:e}function gF(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===px&&t.documentElement.namespaceURI===px?t.createElement(e):t.createElementNS(n,e)}}function yF(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function rP(e){var t=Im(e);return(t.local?yF:gF)(t)}function wF(){}function ak(e){return e==null?wF:function(){return this.querySelector(e)}}function xF(e){typeof e!="function"&&(e=ak(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var o=t[s],a=o.length,l=r[s]=new Array(a),c,u,d=0;d<a;++d)(c=o[d])&&(u=e.call(c,c.__data__,d,o))&&("__data__"in c&&(u.__data__=c.__data__),l[d]=u);return new us(r,this._parents)}function bF(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function kF(){return[]}function sP(e){return e==null?kF:function(){return this.querySelectorAll(e)}}function vF(e){return function(){return bF(e.apply(this,arguments))}}function SF(e){typeof e=="function"?e=vF(e):e=sP(e);for(var t=this._groups,n=t.length,r=[],s=[],o=0;o<n;++o)for(var a=t[o],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 us(r,s)}function iP(e){return function(){return this.matches(e)}}function oP(e){return function(t){return t.matches(e)}}var NF=Array.prototype.find;function jF(e){return function(){return NF.call(this.children,e)}}function CF(){return this.firstElementChild}function _F(e){return this.select(e==null?CF:jF(typeof e=="function"?e:oP(e)))}var EF=Array.prototype.filter;function AF(){return Array.from(this.children)}function PF(e){return function(){return EF.call(this.children,e)}}function IF(e){return this.selectAll(e==null?AF:PF(typeof e=="function"?e:oP(e)))}function RF(e){typeof e!="function"&&(e=iP(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var o=t[s],a=o.length,l=r[s]=[],c,u=0;u<a;++u)(c=o[u])&&e.call(c,c.__data__,u,o)&&l.push(c);return new us(r,this._parents)}function aP(e){return new Array(e.length)}function TF(){return new us(this._enter||this._groups.map(aP),this._parents)}function Ih(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Ih.prototype={constructor:Ih,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 MF(e){return function(){return e}}function $F(e,t,n,r,s,o){for(var a=0,l,c=t.length,u=o.length;a<u;++a)(l=t[a])?(l.__data__=o[a],r[a]=l):n[a]=new Ih(e,o[a]);for(;a<c;++a)(l=t[a])&&(s[a]=l)}function LF(e,t,n,r,s,o,a){var l,c,u=new Map,d=t.length,p=o.length,f=new Array(d),h;for(l=0;l<d;++l)(c=t[l])&&(f[l]=h=a.call(c,c.__data__,l,t)+"",u.has(h)?s[l]=c:u.set(h,c));for(l=0;l<p;++l)h=a.call(e,o[l],l,o)+"",(c=u.get(h))?(r[l]=c,c.__data__=o[l],u.delete(h)):n[l]=new Ih(e,o[l]);for(l=0;l<d;++l)(c=t[l])&&u.get(f[l])===c&&(s[l]=c)}function OF(e){return e.__data__}function DF(e,t){if(!arguments.length)return Array.from(this,OF);var n=t?LF:$F,r=this._parents,s=this._groups;typeof e!="function"&&(e=MF(e));for(var o=s.length,a=new Array(o),l=new Array(o),c=new Array(o),u=0;u<o;++u){var d=r[u],p=s[u],f=p.length,h=FF(e.call(d,d&&d.__data__,u,r)),g=h.length,k=l[u]=new Array(g),b=a[u]=new Array(g),y=c[u]=new Array(f);n(d,p,k,b,y,h,t);for(var v=0,w=0,C,N;v<g;++v)if(C=k[v]){for(v>=w&&(w=v+1);!(N=b[w])&&++w<g;);C._next=N||null}}return a=new us(a,r),a._enter=l,a._exit=c,a}function FF(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function zF(){return new us(this._exit||this._groups.map(aP),this._parents)}function BF(e,t,n){var r=this.enter(),s=this,o=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?o.remove():n(o),r&&s?r.merge(s).order():s}function HF(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,o=r.length,a=Math.min(s,o),l=new Array(s),c=0;c<a;++c)for(var u=n[c],d=r[c],p=u.length,f=l[c]=new Array(p),h,g=0;g<p;++g)(h=u[g]||d[g])&&(f[g]=h);for(;c<s;++c)l[c]=n[c];return new us(l,this._parents)}function WF(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,o=r[s],a;--s>=0;)(a=r[s])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function VF(e){e||(e=KF);function t(p,f){return p&&f?e(p.__data__,f.__data__):!p-!f}for(var n=this._groups,r=n.length,s=new Array(r),o=0;o<r;++o){for(var a=n[o],l=a.length,c=s[o]=new Array(l),u,d=0;d<l;++d)(u=a[d])&&(c[d]=u);c.sort(t)}return new us(s,this._parents).order()}function KF(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function qF(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function UF(){return Array.from(this)}function YF(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,o=r.length;s<o;++s){var a=r[s];if(a)return a}return null}function GF(){let e=0;for(const t of this)++e;return e}function JF(){return!this.node()}function XF(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],o=0,a=s.length,l;o<a;++o)(l=s[o])&&e.call(l,l.__data__,o,s);return this}function QF(e){return function(){this.removeAttribute(e)}}function ZF(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ez(e,t){return function(){this.setAttribute(e,t)}}function tz(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function nz(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function rz(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 sz(e,t){var n=Im(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?ZF:QF:typeof t=="function"?n.local?rz:nz:n.local?tz:ez)(n,t))}function lP(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function iz(e){return function(){this.style.removeProperty(e)}}function oz(e,t,n){return function(){this.style.setProperty(e,t,n)}}function az(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function lz(e,t,n){return arguments.length>1?this.each((t==null?iz:typeof t=="function"?az:oz)(e,t,n??"")):wc(this.node(),e)}function wc(e,t){return e.style.getPropertyValue(t)||lP(e).getComputedStyle(e,null).getPropertyValue(t)}function cz(e){return function(){delete this[e]}}function uz(e,t){return function(){this[e]=t}}function dz(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function fz(e,t){return arguments.length>1?this.each((t==null?cz:typeof t=="function"?dz:uz)(e,t)):this.node()[e]}function cP(e){return e.trim().split(/^|\s+/)}function lk(e){return e.classList||new uP(e)}function uP(e){this._node=e,this._names=cP(e.getAttribute("class")||"")}uP.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 dP(e,t){for(var n=lk(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function fP(e,t){for(var n=lk(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function pz(e){return function(){dP(this,e)}}function hz(e){return function(){fP(this,e)}}function mz(e,t){return function(){(t.apply(this,arguments)?dP:fP)(this,e)}}function gz(e,t){var n=cP(e+"");if(arguments.length<2){for(var r=lk(this.node()),s=-1,o=n.length;++s<o;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?mz:t?pz:hz)(n,t))}function yz(){this.textContent=""}function wz(e){return function(){this.textContent=e}}function xz(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function bz(e){return arguments.length?this.each(e==null?yz:(typeof e=="function"?xz:wz)(e)):this.node().textContent}function kz(){this.innerHTML=""}function vz(e){return function(){this.innerHTML=e}}function Sz(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Nz(e){return arguments.length?this.each(e==null?kz:(typeof e=="function"?Sz:vz)(e)):this.node().innerHTML}function jz(){this.nextSibling&&this.parentNode.appendChild(this)}function Cz(){return this.each(jz)}function _z(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ez(){return this.each(_z)}function Az(e){var t=typeof e=="function"?e:rP(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Pz(){return null}function Iz(e,t){var n=typeof e=="function"?e:rP(e),r=t==null?Pz:typeof t=="function"?t:ak(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Rz(){var e=this.parentNode;e&&e.removeChild(this)}function Tz(){return this.each(Rz)}function Mz(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function $z(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Lz(e){return this.select(e?$z:Mz)}function Oz(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Dz(e){return function(t){e.call(this,t,this.__data__)}}function Fz(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 zz(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,o;n<s;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function Bz(e,t,n){return function(){var r=this.__on,s,o=Dz(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=o,s.options=n),s.value=t;return}}this.addEventListener(e.type,o,n),s={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(s):this.__on=[s]}}function Hz(e,t,n){var r=Fz(e+""),s,o=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,d;c<u;++c)for(s=0,d=l[c];s<o;++s)if((a=r[s]).type===d.type&&a.name===d.name)return d.value}return}for(l=t?Bz:zz,s=0;s<o;++s)this.each(l(r[s],t,n));return this}function pP(e,t,n){var r=lP(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 Wz(e,t){return function(){return pP(this,e,t)}}function Vz(e,t){return function(){return pP(this,e,t.apply(this,arguments))}}function Kz(e,t){return this.each((typeof t=="function"?Vz:Wz)(e,t))}function*qz(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,o=r.length,a;s<o;++s)(a=r[s])&&(yield a)}var hP=[null];function us(e,t){this._groups=e,this._parents=t}function Jd(){return new us([[document.documentElement]],hP)}function Uz(){return this}us.prototype=Jd.prototype={constructor:us,select:xF,selectAll:SF,selectChild:_F,selectChildren:IF,filter:RF,data:DF,enter:TF,exit:zF,join:BF,merge:HF,selection:Uz,order:WF,sort:VF,call:qF,nodes:UF,node:YF,size:GF,empty:JF,each:XF,attr:sz,style:lz,property:fz,classed:gz,text:bz,html:Nz,raise:Cz,lower:Ez,append:Az,insert:Iz,remove:Tz,clone:Lz,datum:Oz,on:Hz,dispatch:Kz,[Symbol.iterator]:qz};function ss(e){return typeof e=="string"?new us([[document.querySelector(e)]],[document.documentElement]):new us([[e]],hP)}function Yz(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Hs(e,t){if(e=Yz(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 Gz={passive:!1},kd={capture:!0,passive:!1};function by(e){e.stopImmediatePropagation()}function sc(e){e.preventDefault(),e.stopImmediatePropagation()}function mP(e){var t=e.document.documentElement,n=ss(e).on("dragstart.drag",sc,kd);"onselectstart"in t?n.on("selectstart.drag",sc,kd):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function gP(e,t){var n=e.document.documentElement,r=ss(e).on("dragstart.drag",null);t&&(r.on("click.drag",sc,kd),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 ip=e=>()=>e;function hx(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:o,x:a,y:l,dx:c,dy:u,dispatch:d}){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:o,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:d}})}hx.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Jz(e){return!e.ctrlKey&&!e.button}function Xz(){return this.parentNode}function Qz(e,t){return t??{x:e.x,y:e.y}}function Zz(){return navigator.maxTouchPoints||"ontouchstart"in this}function yP(){var e=Jz,t=Xz,n=Qz,r=Zz,s={},o=Pm("start","drag","end"),a=0,l,c,u,d,p=0;function f(C){C.on("mousedown.drag",h).filter(r).on("touchstart.drag",b).on("touchmove.drag",y,Gz).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(C,N){if(!(d||!e.call(this,C,N))){var j=w(this,t.call(this,C,N),C,N,"mouse");j&&(ss(C.view).on("mousemove.drag",g,kd).on("mouseup.drag",k,kd),mP(C.view),by(C),u=!1,l=C.clientX,c=C.clientY,j("start",C))}}function g(C){if(sc(C),!u){var N=C.clientX-l,j=C.clientY-c;u=N*N+j*j>p}s.mouse("drag",C)}function k(C){ss(C.view).on("mousemove.drag mouseup.drag",null),gP(C.view,u),sc(C),s.mouse("end",C)}function b(C,N){if(e.call(this,C,N)){var j=C.changedTouches,A=t.call(this,C,N),I=j.length,D,B;for(D=0;D<I;++D)(B=w(this,A,C,N,j[D].identifier,j[D]))&&(by(C),B("start",C,j[D]))}}function y(C){var N=C.changedTouches,j=N.length,A,I;for(A=0;A<j;++A)(I=s[N[A].identifier])&&(sc(C),I("drag",C,N[A]))}function v(C){var N=C.changedTouches,j=N.length,A,I;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),A=0;A<j;++A)(I=s[N[A].identifier])&&(by(C),I("end",C,N[A]))}function w(C,N,j,A,I,D){var B=o.copy(),W=Hs(D||j,N),F,T,M;if((M=n.call(C,new hx("beforestart",{sourceEvent:j,target:f,identifier:I,active:a,x:W[0],y:W[1],dx:0,dy:0,dispatch:B}),A))!=null)return F=M.x-W[0]||0,T=M.y-W[1]||0,function q(H,L,R){var z=W,E;switch(H){case"start":s[I]=q,E=a++;break;case"end":delete s[I],--a;case"drag":W=Hs(R||L,N),E=a;break}B.call(H,C,new hx(H,{sourceEvent:L,subject:M,target:f,identifier:I,active:E,x:W[0]+F,y:W[1]+T,dx:W[0]-z[0],dy:W[1]-z[1],dispatch:B}),A)}}return f.filter=function(C){return arguments.length?(e=typeof C=="function"?C:ip(!!C),f):e},f.container=function(C){return arguments.length?(t=typeof C=="function"?C:ip(C),f):t},f.subject=function(C){return arguments.length?(n=typeof C=="function"?C:ip(C),f):n},f.touchable=function(C){return arguments.length?(r=typeof C=="function"?C:ip(!!C),f):r},f.on=function(){var C=o.on.apply(o,arguments);return C===o?f:C},f.clickDistance=function(C){return arguments.length?(p=(C=+C)*C,f):Math.sqrt(p)},f}function ck(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function wP(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function Xd(){}var vd=.7,Rh=1/vd,ic="\\s*([+-]?\\d+)\\s*",Sd="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",vi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",e3=/^#([0-9a-f]{3,8})$/,t3=new RegExp(`^rgb\\(${ic},${ic},${ic}\\)$`),n3=new RegExp(`^rgb\\(${vi},${vi},${vi}\\)$`),r3=new RegExp(`^rgba\\(${ic},${ic},${ic},${Sd}\\)$`),s3=new RegExp(`^rgba\\(${vi},${vi},${vi},${Sd}\\)$`),i3=new RegExp(`^hsl\\(${Sd},${vi},${vi}\\)$`),o3=new RegExp(`^hsla\\(${Sd},${vi},${vi},${Sd}\\)$`),$N={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};ck(Xd,Ha,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:LN,formatHex:LN,formatHex8:a3,formatHsl:l3,formatRgb:ON,toString:ON});function LN(){return this.rgb().formatHex()}function a3(){return this.rgb().formatHex8()}function l3(){return xP(this).formatHsl()}function ON(){return this.rgb().formatRgb()}function Ha(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=e3.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?DN(t):n===3?new Vr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?op(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?op(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=t3.exec(e))?new Vr(t[1],t[2],t[3],1):(t=n3.exec(e))?new Vr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=r3.exec(e))?op(t[1],t[2],t[3],t[4]):(t=s3.exec(e))?op(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=i3.exec(e))?BN(t[1],t[2]/100,t[3]/100,1):(t=o3.exec(e))?BN(t[1],t[2]/100,t[3]/100,t[4]):$N.hasOwnProperty(e)?DN($N[e]):e==="transparent"?new Vr(NaN,NaN,NaN,0):null}function DN(e){return new Vr(e>>16&255,e>>8&255,e&255,1)}function op(e,t,n,r){return r<=0&&(e=t=n=NaN),new Vr(e,t,n,r)}function c3(e){return e instanceof Xd||(e=Ha(e)),e?(e=e.rgb(),new Vr(e.r,e.g,e.b,e.opacity)):new Vr}function mx(e,t,n,r){return arguments.length===1?c3(e):new Vr(e,t,n,r??1)}function Vr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ck(Vr,mx,wP(Xd,{brighter(e){return e=e==null?Rh:Math.pow(Rh,e),new Vr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?vd:Math.pow(vd,e),new Vr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Vr(Ra(this.r),Ra(this.g),Ra(this.b),Th(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:FN,formatHex:FN,formatHex8:u3,formatRgb:zN,toString:zN}));function FN(){return`#${_a(this.r)}${_a(this.g)}${_a(this.b)}`}function u3(){return`#${_a(this.r)}${_a(this.g)}${_a(this.b)}${_a((isNaN(this.opacity)?1:this.opacity)*255)}`}function zN(){const e=Th(this.opacity);return`${e===1?"rgb(":"rgba("}${Ra(this.r)}, ${Ra(this.g)}, ${Ra(this.b)}${e===1?")":`, ${e})`}`}function Th(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ra(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function _a(e){return e=Ra(e),(e<16?"0":"")+e.toString(16)}function BN(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ks(e,t,n,r)}function xP(e){if(e instanceof Ks)return new Ks(e.h,e.s,e.l,e.opacity);if(e instanceof Xd||(e=Ha(e)),!e)return new Ks;if(e instanceof Ks)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),o=Math.max(t,n,r),a=NaN,l=o-s,c=(o+s)/2;return l?(t===o?a=(n-r)/l+(n<r)*6:n===o?a=(r-t)/l+2:a=(t-n)/l+4,l/=c<.5?o+s:2-o-s,a*=60):l=c>0&&c<1?0:a,new Ks(a,l,c,e.opacity)}function d3(e,t,n,r){return arguments.length===1?xP(e):new Ks(e,t,n,r??1)}function Ks(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ck(Ks,d3,wP(Xd,{brighter(e){return e=e==null?Rh:Math.pow(Rh,e),new Ks(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?vd:Math.pow(vd,e),new Ks(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 Vr(ky(e>=240?e-240:e+120,s,r),ky(e,s,r),ky(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Ks(HN(this.h),ap(this.s),ap(this.l),Th(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Th(this.opacity);return`${e===1?"hsl(":"hsla("}${HN(this.h)}, ${ap(this.s)*100}%, ${ap(this.l)*100}%${e===1?")":`, ${e})`}`}}));function HN(e){return e=(e||0)%360,e<0?e+360:e}function ap(e){return Math.max(0,Math.min(1,e||0))}function ky(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 uk=e=>()=>e;function f3(e,t){return function(n){return e+n*t}}function p3(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 h3(e){return(e=+e)==1?bP:function(t,n){return n-t?p3(t,n,e):uk(isNaN(t)?n:t)}}function bP(e,t){var n=t-e;return n?f3(e,n):uk(isNaN(e)?t:e)}const Mh=function e(t){var n=h3(t);function r(s,o){var a=n((s=mx(s)).r,(o=mx(o)).r),l=n(s.g,o.g),c=n(s.b,o.b),u=bP(s.opacity,o.opacity);return function(d){return s.r=a(d),s.g=l(d),s.b=c(d),s.opacity=u(d),s+""}}return r.gamma=e,r}(1);function m3(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(o){for(s=0;s<n;++s)r[s]=e[s]*(1-o)+t[s]*o;return r}}function g3(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function y3(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,s=new Array(r),o=new Array(n),a;for(a=0;a<r;++a)s[a]=Yu(e[a],t[a]);for(;a<n;++a)o[a]=t[a];return function(l){for(a=0;a<r;++a)o[a]=s[a](l);return o}}function w3(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function fi(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function x3(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]=Yu(e[s],t[s]):r[s]=t[s];return function(o){for(s in n)r[s]=n[s](o);return r}}var gx=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vy=new RegExp(gx.source,"g");function b3(e){return function(){return e}}function k3(e){return function(t){return e(t)+""}}function kP(e,t){var n=gx.lastIndex=vy.lastIndex=0,r,s,o,a=-1,l=[],c=[];for(e=e+"",t=t+"";(r=gx.exec(e))&&(s=vy.exec(t));)(o=s.index)>n&&(o=t.slice(n,o),l[a]?l[a]+=o:l[++a]=o),(r=r[0])===(s=s[0])?l[a]?l[a]+=s:l[++a]=s:(l[++a]=null,c.push({i:a,x:fi(r,s)})),n=vy.lastIndex;return n<t.length&&(o=t.slice(n),l[a]?l[a]+=o:l[++a]=o),l.length<2?c[0]?k3(c[0].x):b3(t):(t=c.length,function(u){for(var d=0,p;d<t;++d)l[(p=c[d]).i]=p.x(u);return l.join("")})}function Yu(e,t){var n=typeof t,r;return t==null||n==="boolean"?uk(t):(n==="number"?fi:n==="string"?(r=Ha(t))?(t=r,Mh):kP:t instanceof Ha?Mh:t instanceof Date?w3:g3(t)?m3:Array.isArray(t)?y3:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?x3:fi)(e,t)}var WN=180/Math.PI,yx={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function vP(e,t,n,r,s,o){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:o,rotate:Math.atan2(t,e)*WN,skewX:Math.atan(c)*WN,scaleX:a,scaleY:l}}var lp;function v3(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?yx:vP(t.a,t.b,t.c,t.d,t.e,t.f)}function S3(e){return e==null||(lp||(lp=document.createElementNS("http://www.w3.org/2000/svg","g")),lp.setAttribute("transform",e),!(e=lp.transform.baseVal.consolidate()))?yx:(e=e.matrix,vP(e.a,e.b,e.c,e.d,e.e,e.f))}function SP(e,t,n,r){function s(u){return u.length?u.pop()+" ":""}function o(u,d,p,f,h,g){if(u!==p||d!==f){var k=h.push("translate(",null,t,null,n);g.push({i:k-4,x:fi(u,p)},{i:k-2,x:fi(d,f)})}else(p||f)&&h.push("translate("+p+t+f+n)}function a(u,d,p,f){u!==d?(u-d>180?d+=360:d-u>180&&(u+=360),f.push({i:p.push(s(p)+"rotate(",null,r)-2,x:fi(u,d)})):d&&p.push(s(p)+"rotate("+d+r)}function l(u,d,p,f){u!==d?f.push({i:p.push(s(p)+"skewX(",null,r)-2,x:fi(u,d)}):d&&p.push(s(p)+"skewX("+d+r)}function c(u,d,p,f,h,g){if(u!==p||d!==f){var k=h.push(s(h)+"scale(",null,",",null,")");g.push({i:k-4,x:fi(u,p)},{i:k-2,x:fi(d,f)})}else(p!==1||f!==1)&&h.push(s(h)+"scale("+p+","+f+")")}return function(u,d){var p=[],f=[];return u=e(u),d=e(d),o(u.translateX,u.translateY,d.translateX,d.translateY,p,f),a(u.rotate,d.rotate,p,f),l(u.skewX,d.skewX,p,f),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,p,f),u=d=null,function(h){for(var g=-1,k=f.length,b;++g<k;)p[(b=f[g]).i]=b.x(h);return p.join("")}}}var N3=SP(v3,"px, ","px)","deg)"),j3=SP(S3,", ",")",")"),C3=1e-12;function VN(e){return((e=Math.exp(e))+1/e)/2}function _3(e){return((e=Math.exp(e))-1/e)/2}function E3(e){return((e=Math.exp(2*e))-1)/(e+1)}const Yp=function e(t,n,r){function s(o,a){var l=o[0],c=o[1],u=o[2],d=a[0],p=a[1],f=a[2],h=d-l,g=p-c,k=h*h+g*g,b,y;if(k<C3)y=Math.log(f/u)/t,b=function(A){return[l+A*h,c+A*g,u*Math.exp(t*A*y)]};else{var v=Math.sqrt(k),w=(f*f-u*u+r*k)/(2*u*n*v),C=(f*f-u*u-r*k)/(2*f*n*v),N=Math.log(Math.sqrt(w*w+1)-w),j=Math.log(Math.sqrt(C*C+1)-C);y=(j-N)/t,b=function(A){var I=A*y,D=VN(N),B=u/(n*v)*(D*E3(t*I+N)-_3(N));return[l+B*h,c+B*g,u*D/VN(t*I+N)]}}return b.duration=y*1e3*t/Math.SQRT2,b}return s.rho=function(o){var a=Math.max(.001,+o),l=a*a,c=l*l;return e(a,l,c)},s}(Math.SQRT2,2,4);var xc=0,Ru=0,yu=0,NP=1e3,$h,Tu,Lh=0,Wa=0,Rm=0,Nd=typeof performance=="object"&&performance.now?performance:Date,jP=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function dk(){return Wa||(jP(A3),Wa=Nd.now()+Rm)}function A3(){Wa=0}function Oh(){this._call=this._time=this._next=null}Oh.prototype=CP.prototype={constructor:Oh,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?dk():+n)+(t==null?0:+t),!this._next&&Tu!==this&&(Tu?Tu._next=this:$h=this,Tu=this),this._call=e,this._time=n,wx()},stop:function(){this._call&&(this._call=null,this._time=1/0,wx())}};function CP(e,t,n){var r=new Oh;return r.restart(e,t,n),r}function P3(){dk(),++xc;for(var e=$h,t;e;)(t=Wa-e._time)>=0&&e._call.call(void 0,t),e=e._next;--xc}function KN(){Wa=(Lh=Nd.now())+Rm,xc=Ru=0;try{P3()}finally{xc=0,R3(),Wa=0}}function I3(){var e=Nd.now(),t=e-Lh;t>NP&&(Rm-=t,Lh=e)}function R3(){for(var e,t=$h,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:$h=n);Tu=e,wx(r)}function wx(e){if(!xc){Ru&&(Ru=clearTimeout(Ru));var t=e-Wa;t>24?(e<1/0&&(Ru=setTimeout(KN,e-Nd.now()-Rm)),yu&&(yu=clearInterval(yu))):(yu||(Lh=Nd.now(),yu=setInterval(I3,NP)),xc=1,jP(KN))}}function qN(e,t,n){var r=new Oh;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var T3=Pm("start","end","cancel","interrupt"),M3=[],_P=0,UN=1,xx=2,Gp=3,YN=4,bx=5,Jp=6;function Tm(e,t,n,r,s,o){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;$3(e,n,{name:t,index:r,group:s,on:T3,tween:M3,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:_P})}function fk(e,t){var n=ti(e,t);if(n.state>_P)throw new Error("too late; already scheduled");return n}function Ai(e,t){var n=ti(e,t);if(n.state>Gp)throw new Error("too late; already running");return n}function ti(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function $3(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=CP(o,0,n.time);function o(u){n.state=UN,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var d,p,f,h;if(n.state!==UN)return c();for(d in r)if(h=r[d],h.name===n.name){if(h.state===Gp)return qN(a);h.state===YN?(h.state=Jp,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[d]):+d<t&&(h.state=Jp,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[d])}if(qN(function(){n.state===Gp&&(n.state=YN,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=xx,n.on.call("start",e,e.__data__,n.index,n.group),n.state===xx){for(n.state=Gp,s=new Array(f=n.tween.length),d=0,p=-1;d<f;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(s[++p]=h);s.length=p+1}}function l(u){for(var d=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=bx,1),p=-1,f=s.length;++p<f;)s[p].call(e,d);n.state===bx&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Jp,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function Xp(e,t){var n=e.__transition,r,s,o=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((r=n[a]).name!==t){o=!1;continue}s=r.state>xx&&r.state<bx,r.state=Jp,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}o&&delete e.__transition}}function L3(e){return this.each(function(){Xp(this,e)})}function O3(e,t){var n,r;return function(){var s=Ai(this,e),o=s.tween;if(o!==n){r=n=o;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 D3(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var o=Ai(this,e),a=o.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)}o.tween=s}}function F3(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=ti(this.node(),n).tween,s=0,o=r.length,a;s<o;++s)if((a=r[s]).name===e)return a.value;return null}return this.each((t==null?O3:D3)(n,e,t))}function pk(e,t,n){var r=e._id;return e.each(function(){var s=Ai(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return ti(s,r).value[t]}}function EP(e,t){var n;return(typeof t=="number"?fi:t instanceof Ha?Mh:(n=Ha(t))?(t=n,Mh):kP)(e,t)}function z3(e){return function(){this.removeAttribute(e)}}function B3(e){return function(){this.removeAttributeNS(e.space,e.local)}}function H3(e,t,n){var r,s=n+"",o;return function(){var a=this.getAttribute(e);return a===s?null:a===r?o:o=t(r=a,n)}}function W3(e,t,n){var r,s=n+"",o;return function(){var a=this.getAttributeNS(e.space,e.local);return a===s?null:a===r?o:o=t(r=a,n)}}function V3(e,t,n){var r,s,o;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?o:(s=c,o=t(r=a,l)))}}function K3(e,t,n){var r,s,o;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?o:(s=c,o=t(r=a,l)))}}function q3(e,t){var n=Im(e),r=n==="transform"?j3:EP;return this.attrTween(e,typeof t=="function"?(n.local?K3:V3)(n,r,pk(this,"attr."+e,t)):t==null?(n.local?B3:z3)(n):(n.local?W3:H3)(n,r,t))}function U3(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Y3(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function G3(e,t){var n,r;function s(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&Y3(e,o)),n}return s._value=t,s}function J3(e,t){var n,r;function s(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&U3(e,o)),n}return s._value=t,s}function X3(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=Im(e);return this.tween(n,(r.local?G3:J3)(r,t))}function Q3(e,t){return function(){fk(this,e).delay=+t.apply(this,arguments)}}function Z3(e,t){return t=+t,function(){fk(this,e).delay=t}}function eB(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Q3:Z3)(t,e)):ti(this.node(),t).delay}function tB(e,t){return function(){Ai(this,e).duration=+t.apply(this,arguments)}}function nB(e,t){return t=+t,function(){Ai(this,e).duration=t}}function rB(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?tB:nB)(t,e)):ti(this.node(),t).duration}function sB(e,t){if(typeof t!="function")throw new Error;return function(){Ai(this,e).ease=t}}function iB(e){var t=this._id;return arguments.length?this.each(sB(t,e)):ti(this.node(),t).ease}function oB(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ai(this,e).ease=n}}function aB(e){if(typeof e!="function")throw new Error;return this.each(oB(this._id,e))}function lB(e){typeof e!="function"&&(e=iP(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var o=t[s],a=o.length,l=r[s]=[],c,u=0;u<a;++u)(c=o[u])&&e.call(c,c.__data__,u,o)&&l.push(c);return new no(r,this._parents,this._name,this._id)}function cB(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,o=Math.min(r,s),a=new Array(r),l=0;l<o;++l)for(var c=t[l],u=n[l],d=c.length,p=a[l]=new Array(d),f,h=0;h<d;++h)(f=c[h]||u[h])&&(p[h]=f);for(;l<r;++l)a[l]=t[l];return new no(a,this._parents,this._name,this._id)}function uB(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 dB(e,t,n){var r,s,o=uB(t)?fk:Ai;return function(){var a=o(this,e),l=a.on;l!==r&&(s=(r=l).copy()).on(t,n),a.on=s}}function fB(e,t){var n=this._id;return arguments.length<2?ti(this.node(),n).on.on(e):this.each(dB(n,e,t))}function pB(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function hB(){return this.on("end.remove",pB(this._id))}function mB(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ak(e));for(var r=this._groups,s=r.length,o=new Array(s),a=0;a<s;++a)for(var l=r[a],c=l.length,u=o[a]=new Array(c),d,p,f=0;f<c;++f)(d=l[f])&&(p=e.call(d,d.__data__,f,l))&&("__data__"in d&&(p.__data__=d.__data__),u[f]=p,Tm(u[f],t,n,f,u,ti(d,n)));return new no(o,this._parents,t,n)}function gB(e){var t=this._name,n=this._id;typeof e!="function"&&(e=sP(e));for(var r=this._groups,s=r.length,o=[],a=[],l=0;l<s;++l)for(var c=r[l],u=c.length,d,p=0;p<u;++p)if(d=c[p]){for(var f=e.call(d,d.__data__,p,c),h,g=ti(d,n),k=0,b=f.length;k<b;++k)(h=f[k])&&Tm(h,t,n,k,f,g);o.push(f),a.push(d)}return new no(o,a,t,n)}var yB=Jd.prototype.constructor;function wB(){return new yB(this._groups,this._parents)}function xB(e,t){var n,r,s;return function(){var o=wc(this,e),a=(this.style.removeProperty(e),wc(this,e));return o===a?null:o===n&&a===r?s:s=t(n=o,r=a)}}function AP(e){return function(){this.style.removeProperty(e)}}function bB(e,t,n){var r,s=n+"",o;return function(){var a=wc(this,e);return a===s?null:a===r?o:o=t(r=a,n)}}function kB(e,t,n){var r,s,o;return function(){var a=wc(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),wc(this,e))),a===c?null:a===r&&c===s?o:(s=c,o=t(r=a,l))}}function vB(e,t){var n,r,s,o="style."+t,a="end."+o,l;return function(){var c=Ai(this,e),u=c.on,d=c.value[o]==null?l||(l=AP(t)):void 0;(u!==n||s!==d)&&(r=(n=u).copy()).on(a,s=d),c.on=r}}function SB(e,t,n){var r=(e+="")=="transform"?N3:EP;return t==null?this.styleTween(e,xB(e,r)).on("end.style."+e,AP(e)):typeof t=="function"?this.styleTween(e,kB(e,r,pk(this,"style."+e,t))).each(vB(this._id,e)):this.styleTween(e,bB(e,r,t),n).on("end.style."+e,null)}function NB(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function jB(e,t,n){var r,s;function o(){var a=t.apply(this,arguments);return a!==s&&(r=(s=a)&&NB(e,a,n)),r}return o._value=t,o}function CB(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,jB(e,t,n??""))}function _B(e){return function(){this.textContent=e}}function EB(e){return function(){var t=e(this);this.textContent=t??""}}function AB(e){return this.tween("text",typeof e=="function"?EB(pk(this,"text",e)):_B(e==null?"":e+""))}function PB(e){return function(t){this.textContent=e.call(this,t)}}function IB(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&PB(s)),t}return r._value=e,r}function RB(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,IB(e))}function TB(){for(var e=this._name,t=this._id,n=PP(),r=this._groups,s=r.length,o=0;o<s;++o)for(var a=r[o],l=a.length,c,u=0;u<l;++u)if(c=a[u]){var d=ti(c,t);Tm(c,e,n,u,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new no(r,this._parents,e,n)}function MB(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(o,a){var l={value:a},c={value:function(){--s===0&&o()}};n.each(function(){var u=Ai(this,r),d=u.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),u.on=t}),s===0&&o()})}var $B=0;function no(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function PP(){return++$B}var Oi=Jd.prototype;no.prototype={constructor:no,select:mB,selectAll:gB,selectChild:Oi.selectChild,selectChildren:Oi.selectChildren,filter:lB,merge:cB,selection:wB,transition:TB,call:Oi.call,nodes:Oi.nodes,node:Oi.node,size:Oi.size,empty:Oi.empty,each:Oi.each,on:fB,attr:q3,attrTween:X3,style:SB,styleTween:CB,text:AB,textTween:RB,remove:hB,tween:F3,delay:eB,duration:rB,ease:iB,easeVarying:aB,end:MB,[Symbol.iterator]:Oi[Symbol.iterator]};function LB(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var OB={time:null,delay:0,duration:250,ease:LB};function DB(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 FB(e){var t,n;e instanceof no?(t=e._id,e=e._name):(t=PP(),(n=OB).time=dk(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,o=0;o<s;++o)for(var a=r[o],l=a.length,c,u=0;u<l;++u)(c=a[u])&&Tm(c,e,t,u,a,n||DB(c,t));return new no(r,this._parents,e,t)}Jd.prototype.interrupt=L3;Jd.prototype.transition=FB;const cp=e=>()=>e;function zB(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 Ki(e,t,n){this.k=e,this.x=t,this.y=n}Ki.prototype={constructor:Ki,scale:function(e){return e===1?this:new Ki(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ki(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 Mm=new Ki(1,0,0);IP.prototype=Ki.prototype;function IP(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Mm;return e.__zoom}function Sy(e){e.stopImmediatePropagation()}function wu(e){e.preventDefault(),e.stopImmediatePropagation()}function BB(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function HB(){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 GN(){return this.__zoom||Mm}function WB(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function VB(){return navigator.maxTouchPoints||"ontouchstart"in this}function KB(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],o=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>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function RP(){var e=BB,t=HB,n=KB,r=WB,s=VB,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Yp,u=Pm("start","zoom","end"),d,p,f,h=500,g=150,k=0,b=10;function y(M){M.property("__zoom",GN).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",B).filter(s).on("touchstart.zoom",W).on("touchmove.zoom",F).on("touchend.zoom touchcancel.zoom",T).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(M,q,H,L){var R=M.selection?M.selection():M;R.property("__zoom",GN),M!==R?N(M,q,H,L):R.interrupt().each(function(){j(this,arguments).event(L).start().zoom(null,typeof q=="function"?q.apply(this,arguments):q).end()})},y.scaleBy=function(M,q,H,L){y.scaleTo(M,function(){var R=this.__zoom.k,z=typeof q=="function"?q.apply(this,arguments):q;return R*z},H,L)},y.scaleTo=function(M,q,H,L){y.transform(M,function(){var R=t.apply(this,arguments),z=this.__zoom,E=H==null?C(R):typeof H=="function"?H.apply(this,arguments):H,Q=z.invert(E),V=typeof q=="function"?q.apply(this,arguments):q;return n(w(v(z,V),E,Q),R,a)},H,L)},y.translateBy=function(M,q,H,L){y.transform(M,function(){return n(this.__zoom.translate(typeof q=="function"?q.apply(this,arguments):q,typeof H=="function"?H.apply(this,arguments):H),t.apply(this,arguments),a)},null,L)},y.translateTo=function(M,q,H,L,R){y.transform(M,function(){var z=t.apply(this,arguments),E=this.__zoom,Q=L==null?C(z):typeof L=="function"?L.apply(this,arguments):L;return n(Mm.translate(Q[0],Q[1]).scale(E.k).translate(typeof q=="function"?-q.apply(this,arguments):-q,typeof H=="function"?-H.apply(this,arguments):-H),z,a)},L,R)};function v(M,q){return q=Math.max(o[0],Math.min(o[1],q)),q===M.k?M:new Ki(q,M.x,M.y)}function w(M,q,H){var L=q[0]-H[0]*M.k,R=q[1]-H[1]*M.k;return L===M.x&&R===M.y?M:new Ki(M.k,L,R)}function C(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function N(M,q,H,L){M.on("start.zoom",function(){j(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){j(this,arguments).event(L).end()}).tween("zoom",function(){var R=this,z=arguments,E=j(R,z).event(L),Q=t.apply(R,z),V=H==null?C(Q):typeof H=="function"?H.apply(R,z):H,$=Math.max(Q[1][0]-Q[0][0],Q[1][1]-Q[0][1]),ne=R.__zoom,ce=typeof q=="function"?q.apply(R,z):q,X=c(ne.invert(V).concat($/ne.k),ce.invert(V).concat($/ce.k));return function(re){if(re===1)re=ce;else{var Z=X(re),ie=$/Z[2];re=new Ki(ie,V[0]-Z[0]*ie,V[1]-Z[1]*ie)}E.zoom(null,re)}})}function j(M,q,H){return!H&&M.__zooming||new A(M,q)}function A(M,q){this.that=M,this.args=q,this.active=0,this.sourceEvent=null,this.extent=t.apply(M,q),this.taps=0}A.prototype={event:function(M){return M&&(this.sourceEvent=M),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(M,q){return this.mouse&&M!=="mouse"&&(this.mouse[1]=q.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=q.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=q.invert(this.touch1[0])),this.that.__zoom=q,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var q=ss(this.that).datum();u.call(M,this.that,new zB(M,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),q)}};function I(M,...q){if(!e.apply(this,arguments))return;var H=j(this,q).event(M),L=this.__zoom,R=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,r.apply(this,arguments)))),z=Hs(M);if(H.wheel)(H.mouse[0][0]!==z[0]||H.mouse[0][1]!==z[1])&&(H.mouse[1]=L.invert(H.mouse[0]=z)),clearTimeout(H.wheel);else{if(L.k===R)return;H.mouse=[z,L.invert(z)],Xp(this),H.start()}wu(M),H.wheel=setTimeout(E,g),H.zoom("mouse",n(w(v(L,R),H.mouse[0],H.mouse[1]),H.extent,a));function E(){H.wheel=null,H.end()}}function D(M,...q){if(f||!e.apply(this,arguments))return;var H=M.currentTarget,L=j(this,q,!0).event(M),R=ss(M.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",$,!0),z=Hs(M,H),E=M.clientX,Q=M.clientY;mP(M.view),Sy(M),L.mouse=[z,this.__zoom.invert(z)],Xp(this),L.start();function V(ne){if(wu(ne),!L.moved){var ce=ne.clientX-E,X=ne.clientY-Q;L.moved=ce*ce+X*X>k}L.event(ne).zoom("mouse",n(w(L.that.__zoom,L.mouse[0]=Hs(ne,H),L.mouse[1]),L.extent,a))}function $(ne){R.on("mousemove.zoom mouseup.zoom",null),gP(ne.view,L.moved),wu(ne),L.event(ne).end()}}function B(M,...q){if(e.apply(this,arguments)){var H=this.__zoom,L=Hs(M.changedTouches?M.changedTouches[0]:M,this),R=H.invert(L),z=H.k*(M.shiftKey?.5:2),E=n(w(v(H,z),L,R),t.apply(this,q),a);wu(M),l>0?ss(this).transition().duration(l).call(N,E,L,M):ss(this).call(y.transform,E,L,M)}}function W(M,...q){if(e.apply(this,arguments)){var H=M.touches,L=H.length,R=j(this,q,M.changedTouches.length===L).event(M),z,E,Q,V;for(Sy(M),E=0;E<L;++E)Q=H[E],V=Hs(Q,this),V=[V,this.__zoom.invert(V),Q.identifier],R.touch0?!R.touch1&&R.touch0[2]!==V[2]&&(R.touch1=V,R.taps=0):(R.touch0=V,z=!0,R.taps=1+!!d);d&&(d=clearTimeout(d)),z&&(R.taps<2&&(p=V[0],d=setTimeout(function(){d=null},h)),Xp(this),R.start())}}function F(M,...q){if(this.__zooming){var H=j(this,q).event(M),L=M.changedTouches,R=L.length,z,E,Q,V;for(wu(M),z=0;z<R;++z)E=L[z],Q=Hs(E,this),H.touch0&&H.touch0[2]===E.identifier?H.touch0[0]=Q:H.touch1&&H.touch1[2]===E.identifier&&(H.touch1[0]=Q);if(E=H.that.__zoom,H.touch1){var $=H.touch0[0],ne=H.touch0[1],ce=H.touch1[0],X=H.touch1[1],re=(re=ce[0]-$[0])*re+(re=ce[1]-$[1])*re,Z=(Z=X[0]-ne[0])*Z+(Z=X[1]-ne[1])*Z;E=v(E,Math.sqrt(re/Z)),Q=[($[0]+ce[0])/2,($[1]+ce[1])/2],V=[(ne[0]+X[0])/2,(ne[1]+X[1])/2]}else if(H.touch0)Q=H.touch0[0],V=H.touch0[1];else return;H.zoom("touch",n(w(E,Q,V),H.extent,a))}}function T(M,...q){if(this.__zooming){var H=j(this,q).event(M),L=M.changedTouches,R=L.length,z,E;for(Sy(M),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),z=0;z<R;++z)E=L[z],H.touch0&&H.touch0[2]===E.identifier?delete H.touch0:H.touch1&&H.touch1[2]===E.identifier&&delete H.touch1;if(H.touch1&&!H.touch0&&(H.touch0=H.touch1,delete H.touch1),H.touch0)H.touch0[1]=this.__zoom.invert(H.touch0[0]);else if(H.end(),H.taps===2&&(E=Hs(E,this),Math.hypot(p[0]-E[0],p[1]-E[1])<b)){var Q=ss(this).on("dblclick.zoom");Q&&Q.apply(this,arguments)}}}return y.wheelDelta=function(M){return arguments.length?(r=typeof M=="function"?M:cp(+M),y):r},y.filter=function(M){return arguments.length?(e=typeof M=="function"?M:cp(!!M),y):e},y.touchable=function(M){return arguments.length?(s=typeof M=="function"?M:cp(!!M),y):s},y.extent=function(M){return arguments.length?(t=typeof M=="function"?M:cp([[+M[0][0],+M[0][1]],[+M[1][0],+M[1][1]]]),y):t},y.scaleExtent=function(M){return arguments.length?(o[0]=+M[0],o[1]=+M[1],y):[o[0],o[1]]},y.translateExtent=function(M){return arguments.length?(a[0][0]=+M[0][0],a[1][0]=+M[1][0],a[0][1]=+M[0][1],a[1][1]=+M[1][1],y):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},y.constrain=function(M){return arguments.length?(n=M,y):n},y.duration=function(M){return arguments.length?(l=+M,y):l},y.interpolate=function(M){return arguments.length?(c=M,y):c},y.on=function(){var M=u.on.apply(u,arguments);return M===u?y:M},y.clickDistance=function(M){return arguments.length?(k=(M=+M)*M,y):Math.sqrt(k)},y.tapDistance=function(M){return arguments.length?(b=+M,y):b},y}const _i={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."},jd=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],TP=["Enter"," ","Escape"],MP={"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 bc;(function(e){e.Strict="strict",e.Loose="loose"})(bc||(bc={}));var Ta;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Ta||(Ta={}));var Cd;(function(e){e.Partial="partial",e.Full="full"})(Cd||(Cd={}));const $P={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Io;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Io||(Io={}));var gi;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(gi||(gi={}));var Ke;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ke||(Ke={}));const JN={[Ke.Left]:Ke.Right,[Ke.Right]:Ke.Left,[Ke.Top]:Ke.Bottom,[Ke.Bottom]:Ke.Top};function LP(e){return e===null?null:e?"valid":"invalid"}const OP=e=>"id"in e&&"source"in e&&"target"in e,qB=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),hk=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Qd=(e,t=[0,0])=>{const{width:n,height:r}=oo(e),s=e.origin??t,o=n*s[0],a=r*s[1];return{x:e.position.x-o,y:e.position.y-a}},UB=(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 o=typeof s=="string";let a=!t.nodeLookup&&!o?s:void 0;t.nodeLookup&&(a=o?t.nodeLookup.get(s):hk(s)?s:t.nodeLookup.get(s.id));const l=a?Dh(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return $m(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Lm(n)},Zd=(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=$m(n,Dh(s)),r=!0)}),r?Lm(n):{x:0,y:0,width:0,height:0}},mk=(e,t,[n,r,s]=[0,0,1],o=!1,a=!1)=>{const l={...tf(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const u of e.values()){const{measured:d,selectable:p=!0,hidden:f=!1}=u;if(a&&!p||f)continue;const h=d.width??u.width??u.initialWidth??null,g=d.height??u.height??u.initialHeight??null,k=_d(l,vc(u)),b=(h??0)*(g??0),y=o&&k>0;(!u.internals.handleBounds||y||k>=b||u.dragging)&&c.push(u)}return c},YB=(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 GB(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 JB({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:o},a){if(e.size===0)return Promise.resolve(!0);const l=GB(e,a),c=Zd(l),u=gk(c,t,n,(a==null?void 0:a.minZoom)??s,(a==null?void 0:a.maxZoom)??o,(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 DP({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:o}){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},d=a.origin??r;let p=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!l)o==null||o("005",_i.error005());else{const h=l.measured.width,g=l.measured.height;h&&g&&(p=[[c,u],[c+h,u+g]])}else l&&Sc(a.extent)&&(p=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const f=Sc(p)?Va(t,p,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(o==null||o("015",_i.error015())),{position:{x:f.x-c+(a.measured.width??0)*d[0],y:f.y-u+(a.measured.height??0)*d[1]},positionAbsolute:f}}async function XB({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const o=new Set(e.map(f=>f.id)),a=[];for(const f of n){if(f.deletable===!1)continue;const h=o.has(f.id),g=!h&&f.parentId&&a.find(k=>k.id===f.parentId);(h||g)&&a.push(f)}const l=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),d=YB(a,c);for(const f of c)l.has(f.id)&&!d.find(g=>g.id===f.id)&&d.push(f);if(!s)return{edges:d,nodes:a};const p=await s({nodes:a,edges:d});return typeof p=="boolean"?p?{edges:d,nodes:a}:{edges:[],nodes:[]}:p}const kc=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Va=(e={x:0,y:0},t,n)=>({x:kc(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:kc(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function FP(e,t,n){const{width:r,height:s}=oo(n),{x:o,y:a}=n.internals.positionAbsolute;return Va(e,[[o,a],[o+r,a+s]],t)}const XN=(e,t,n)=>e<t?kc(Math.abs(e-t),1,t)/t:e>n?-kc(Math.abs(e-n),1,t)/t:0,zP=(e,t,n=15,r=40)=>{const s=XN(e.x,r,t.width-r)*n,o=XN(e.y,r,t.height-r)*n;return[s,o]},$m=(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)}),kx=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Lm=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),vc=(e,t=[0,0])=>{var s,o;const{x:n,y:r}=hk(e)?e.internals.positionAbsolute:Qd(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0}},Dh=(e,t=[0,0])=>{var s,o;const{x:n,y:r}=hk(e)?e.internals.positionAbsolute:Qd(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((o=e.measured)==null?void 0:o.height)??e.height??e.initialHeight??0)}},BP=(e,t)=>Lm($m(kx(e),kx(t))),_d=(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)},QN=e=>qs(e.width)&&qs(e.height)&&qs(e.x)&&qs(e.y),qs=e=>!isNaN(e)&&isFinite(e),QB=(e,t)=>{},ef=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),tf=({x:e,y:t},[n,r,s],o=!1,a=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return o?ef(l,a):l},Fh=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function jl(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 ZB(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=jl(e,n),s=jl(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=jl(e.top??e.y??0,n),s=jl(e.bottom??e.y??0,n),o=jl(e.left??e.x??0,t),a=jl(e.right??e.x??0,t);return{top:r,right:a,bottom:s,left:o,x:o+a,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function e4(e,t,n,r,s,o){const{x:a,y:l}=Fh(e,[t,n,r]),{x:c,y:u}=Fh({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=s-c,p=o-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(p)}}const gk=(e,t,n,r,s,o)=>{const a=ZB(o,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),d=kc(u,r,s),p=e.x+e.width/2,f=e.y+e.height/2,h=t/2-p*d,g=n/2-f*d,k=e4(e,h,g,d,t,n),b={left:Math.min(k.left-a.left,0),top:Math.min(k.top-a.top,0),right:Math.min(k.right-a.right,0),bottom:Math.min(k.bottom-a.bottom,0)};return{x:h-b.left+b.right,y:g-b.top+b.bottom,zoom:d}},Ed=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Sc(e){return e!=null&&e!=="parent"}function oo(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 HP(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 WP(e,t={width:0,height:0},n,r,s){const o={...e},a=r.get(n);if(a){const l=a.origin||s;o.x+=a.internals.positionAbsolute.x-(t.width??0)*l[0],o.y+=a.internals.positionAbsolute.y-(t.height??0)*l[1]}return o}function ZN(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function t4(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function n4(e){return{...MP,...e||{}}}function Gu(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:o,y:a}=Us(e),l=tf({x:o-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},r),{x:c,y:u}=n?ef(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const yk=e=>({width:e.offsetWidth,height:e.offsetHeight}),VP=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},r4=["INPUT","SELECT","TEXTAREA"];function KP(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:r4.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const qP=e=>"clientX"in e,Us=(e,t)=>{var o,a;const n=qP(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[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)}},ej=(e,t,n,r,s)=>{const o=t.querySelectorAll(`.${e}`);return!o||!o.length?null:Array.from(o).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,...yk(a)}})};function UP({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:o,targetControlX:a,targetControlY:l}){const c=e*.125+s*.375+a*.375+n*.125,u=t*.125+o*.375+l*.375+r*.125,d=Math.abs(c-e),p=Math.abs(u-t);return[c,u,d,p]}function up(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function tj({pos:e,x1:t,y1:n,x2:r,y2:s,c:o}){switch(e){case Ke.Left:return[t-up(t-r,o),n];case Ke.Right:return[t+up(r-t,o),n];case Ke.Top:return[t,n-up(n-s,o)];case Ke.Bottom:return[t,n+up(s-n,o)]}}function YP({sourceX:e,sourceY:t,sourcePosition:n=Ke.Bottom,targetX:r,targetY:s,targetPosition:o=Ke.Top,curvature:a=.25}){const[l,c]=tj({pos:n,x1:e,y1:t,x2:r,y2:s,c:a}),[u,d]=tj({pos:o,x1:r,y1:s,x2:e,y2:t,c:a}),[p,f,h,g]=UP({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${l},${c} ${u},${d} ${r},${s}`,p,f,h,g]}function GP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,o=n<e?n+s:n-s,a=Math.abs(r-t)/2,l=r<t?r+a:r-a;return[o,l,s,a]}function s4({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:s=!1,zIndexMode:o="basic"}){if(o==="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 i4({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const o=$m(Dh(e),Dh(t));o.x===o.x2&&(o.x2+=1),o.y===o.y2&&(o.y2+=1);const a={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:r/s[2]};return _d(a,Lm(o))>0}const o4=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,a4=(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)),Qp=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||o4;let s;return OP(e)?s={...e}:s={...e,id:r(e)},a4(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function JP({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,o,a,l]=GP({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,o,a,l]}const nj={[Ke.Left]:{x:-1,y:0},[Ke.Right]:{x:1,y:0},[Ke.Top]:{x:0,y:-1},[Ke.Bottom]:{x:0,y:1}},l4=({source:e,sourcePosition:t=Ke.Bottom,target:n})=>t===Ke.Left||t===Ke.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},rj=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function c4({source:e,sourcePosition:t=Ke.Bottom,target:n,targetPosition:r=Ke.Top,center:s,offset:o,stepPosition:a}){const l=nj[t],c=nj[r],u={x:e.x+l.x*o,y:e.y+l.y*o},d={x:n.x+c.x*o,y:n.y+c.y*o},p=l4({source:u,sourcePosition:t,target:d}),f=p.x!==0?"x":"y",h=p[f];let g=[],k,b;const y={x:0,y:0},v={x:0,y:0},[,,w,C]=GP({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[f]*c[f]===-1){f==="x"?(k=s.x??u.x+(d.x-u.x)*a,b=s.y??(u.y+d.y)/2):(k=s.x??(u.x+d.x)/2,b=s.y??u.y+(d.y-u.y)*a);const I=[{x:k,y:u.y},{x:k,y:d.y}],D=[{x:u.x,y:b},{x:d.x,y:b}];l[f]===h?g=f==="x"?I:D:g=f==="x"?D:I}else{const I=[{x:u.x,y:d.y}],D=[{x:d.x,y:u.y}];if(f==="x"?g=l.x===h?D:I:g=l.y===h?I:D,t===r){const M=Math.abs(e[f]-n[f]);if(M<=o){const q=Math.min(o-1,o-M);l[f]===h?y[f]=(u[f]>e[f]?-1:1)*q:v[f]=(d[f]>n[f]?-1:1)*q}}if(t!==r){const M=f==="x"?"y":"x",q=l[f]===c[M],H=u[M]>d[M],L=u[M]<d[M];(l[f]===1&&(!q&&H||q&&L)||l[f]!==1&&(!q&&L||q&&H))&&(g=f==="x"?I:D)}const B={x:u.x+y.x,y:u.y+y.y},W={x:d.x+v.x,y:d.y+v.y},F=Math.max(Math.abs(B.x-g[0].x),Math.abs(W.x-g[0].x)),T=Math.max(Math.abs(B.y-g[0].y),Math.abs(W.y-g[0].y));F>=T?(k=(B.x+W.x)/2,b=g[0].y):(k=g[0].x,b=(B.y+W.y)/2)}const N={x:u.x+y.x,y:u.y+y.y},j={x:d.x+v.x,y:d.y+v.y};return[[e,...N.x!==g[0].x||N.y!==g[0].y?[N]:[],...g,...j.x!==g[g.length-1].x||j.y!==g[g.length-1].y?[j]:[],n],k,b,w,C]}function u4(e,t,n,r){const s=Math.min(rj(e,t)/2,rj(t,n)/2,r),{x:o,y:a}=t;if(e.x===o&&o===n.x||e.y===a&&a===n.y)return`L${o} ${a}`;if(e.y===a){const u=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${o+s*u},${a}Q ${o},${a} ${o},${a+s*d}`}const l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${o},${a+s*c}Q ${o},${a} ${o+s*l},${a}`}function vx({sourceX:e,sourceY:t,sourcePosition:n=Ke.Bottom,targetX:r,targetY:s,targetPosition:o=Ke.Top,borderRadius:a=5,centerX:l,centerY:c,offset:u=20,stepPosition:d=.5}){const[p,f,h,g,k]=c4({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:o,center:{x:l,y:c},offset:u,stepPosition:d});let b=`M${p[0].x} ${p[0].y}`;for(let y=1;y<p.length-1;y++)b+=u4(p[y-1],p[y],p[y+1],a);return b+=`L${p[p.length-1].x} ${p[p.length-1].y}`,[b,f,h,g,k]}function sj(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function d4(e){var p;const{sourceNode:t,targetNode:n}=e;if(!sj(t)||!sj(n))return null;const r=t.internals.handleBounds||ij(t.handles),s=n.internals.handleBounds||ij(n.handles),o=oj((r==null?void 0:r.source)??[],e.sourceHandle),a=oj(e.connectionMode===bc.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!o||!a)return(p=e.onError)==null||p.call(e,"008",_i.error008(o?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(o==null?void 0:o.position)||Ke.Bottom,c=(a==null?void 0:a.position)||Ke.Top,u=Ka(t,o,l),d=Ka(n,a,c);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:l,targetPosition:c}}function ij(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 Ka(e,t,n=Ke.Left,r=!1){const s=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,o=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:a,height:l}=t??oo(e);if(r)return{x:s+a/2,y:o+l/2};switch((t==null?void 0:t.position)??n){case Ke.Top:return{x:s+a/2,y:o};case Ke.Right:return{x:s+a,y:o+l/2};case Ke.Bottom:return{x:s+a/2,y:o+l};case Ke.Left:return{x:s,y:o+l/2}}}function oj(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Sx(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function f4(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const o=new Set;return e.reduce((a,l)=>([l.markerStart||r,l.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const u=Sx(c,t);o.has(u)||(a.push({id:u,color:c.color||n,...c}),o.add(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const XP=1e3,p4=10,wk={nodeOrigin:[0,0],nodeExtent:jd,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},h4={...wk,checkEquality:!0};function xk(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function m4(e,t,n){const r=xk(wk,n);for(const s of e.values())if(s.parentId)kk(s,e,t,r);else{const o=Qd(s,r.nodeOrigin),a=Sc(s.extent)?s.extent:r.nodeExtent,l=Va(o,a,oo(s));s.internals.positionAbsolute=l}}function g4(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 o={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(o):s.type==="target"&&r.push(o)}return{source:n,target:r}}function bk(e){return e==="manual"}function Nx(e,t,n,r={}){var d,p;const s=xk(h4,r),o={i:0},a=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!bk(s.zIndexMode)?XP:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const f of e){let h=a.get(f.id);if(s.checkEquality&&f===(h==null?void 0:h.internals.userNode))t.set(f.id,h);else{const g=Qd(f,s.nodeOrigin),k=Sc(f.extent)?f.extent:s.nodeExtent,b=Va(g,k,oo(f));h={...s.defaults,...f,measured:{width:(d=f.measured)==null?void 0:d.width,height:(p=f.measured)==null?void 0:p.height},internals:{positionAbsolute:b,handleBounds:g4(f,h),z:QP(f,l,s.zIndexMode),userNode:f}},t.set(f.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),f.parentId&&kk(h,t,n,r,o),u||(u=f.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function y4(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 kk(e,t,n,r,s){const{elevateNodesOnSelect:o,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=xk(wk,r),u=e.parentId,d=t.get(u);if(!d){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}y4(e,n),s&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++s.i,d.internals.z=d.internals.z+s.i*p4),s&&d.internals.rootParentIndex!==void 0&&(s.i=d.internals.rootParentIndex);const p=o&&!bk(c)?XP:0,{x:f,y:h,z:g}=w4(e,d,a,l,p,c),{positionAbsolute:k}=e.internals,b=f!==k.x||h!==k.y;(b||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:b?{x:f,y:h}:k,z:g}})}function QP(e,t,n){const r=qs(e.zIndex)?e.zIndex:0;return bk(n)?r:r+(e.selected?t:0)}function w4(e,t,n,r,s,o){const{x:a,y:l}=t.internals.positionAbsolute,c=oo(e),u=Qd(e,n),d=Sc(e.extent)?Va(u,e.extent,c):u;let p=Va({x:a+d.x,y:l+d.y},r,c);e.extent==="parent"&&(p=FP(p,c,t));const f=QP(e,s,o),h=t.internals.z??0;return{x:p.x,y:p.y,z:h>=f?h+1:f}}function vk(e,t,n,r=[0,0]){var a;const s=[],o=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const u=((a=o.get(l.parentId))==null?void 0:a.expandedRect)??vc(c),d=BP(u,l.rect);o.set(l.parentId,{expandedRect:d,parent:c})}return o.size>0&&o.forEach(({expandedRect:l,parent:c},u)=>{var w;const d=c.internals.positionAbsolute,p=oo(c),f=c.origin??r,h=l.x<d.x?Math.round(Math.abs(d.x-l.x)):0,g=l.y<d.y?Math.round(Math.abs(d.y-l.y)):0,k=Math.max(p.width,Math.round(l.width)),b=Math.max(p.height,Math.round(l.height)),y=(k-p.width)*f[0],v=(b-p.height)*f[1];(h>0||g>0||y||v)&&(s.push({id:u,type:"position",position:{x:c.position.x-h+y,y:c.position.y-g+v}}),(w=n.get(u))==null||w.forEach(C=>{e.some(N=>N.id===C.id)||s.push({id:C.id,type:"position",position:{x:C.position.x+h,y:C.position.y+g}})})),(p.width<l.width||p.height<l.height||h||g)&&s.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:k+(h?f[0]*h-y:0),height:b+(g?f[1]*g-v:0)}})}),s}function x4(e,t,n,r,s,o,a){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const u=[],d=window.getComputedStyle(l),{m22:p}=new window.DOMMatrixReadOnly(d.transform),f=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const k=yk(h.nodeElement),b=g.measured.width!==k.width||g.measured.height!==k.height;if(!!(k.width&&k.height&&(b||!g.internals.handleBounds||h.force))){const v=h.nodeElement.getBoundingClientRect(),w=Sc(g.extent)?g.extent:o;let{positionAbsolute:C}=g.internals;g.parentId&&g.extent==="parent"?C=FP(C,k,t.get(g.parentId)):w&&(C=Va(C,w,k));const N={...g,measured:k,internals:{...g.internals,positionAbsolute:C,handleBounds:{source:ej("source",h.nodeElement,v,p,g.id),target:ej("target",h.nodeElement,v,p,g.id)}}};t.set(g.id,N),g.parentId&&kk(N,t,n,{nodeOrigin:s,zIndexMode:a}),c=!0,b&&(u.push({id:g.id,type:"dimensions",dimensions:k}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:vc(N,s)}))}}if(f.length>0){const h=vk(f,t,n,s);u.push(...h)}return{changes:u,updatedInternals:c}}async function b4({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:o}){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,o]],r),l=!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2]);return Promise.resolve(l)}function aj(e,t,n,r,s,o){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)),o){a=`${s}-${e}-${o}`;const u=r.get(a)||new Map;r.set(a,u.set(n,t))}}function ZP(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:o,sourceHandle:a=null,targetHandle:l=null}=r,c={edgeId:r.id,source:s,target:o,sourceHandle:a,targetHandle:l},u=`${s}-${a}--${o}-${l}`,d=`${o}-${l}--${s}-${a}`;aj("source",c,d,e,s,a),aj("target",c,u,e,o,l),t.set(r.id,r)}}function eI(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:eI(n,t):!1}function lj(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 k4(e,t,n,r){const s=new Map;for(const[o,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!eI(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const l=e.get(o);l&&s.set(o,{id:o,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 Ny({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,l,c;const s=[];for(const[u,d]of t){const p=(a=n.get(u))==null?void 0:a.internals.userNode;p&&s.push({...p,position:d.position,dragging:r})}if(!e)return[s[0],s];const o=(l=n.get(e))==null?void 0:l.internals.userNode;return[o?{...o,position:((c=t.get(e))==null?void 0:c.position)||o.position,dragging:r}:s[0],s]}function v4({dragItems:e,snapGrid:t,x:n,y:r}){const s=e.values().next().value;if(!s)return null;const o={x:n-s.distance.x,y:r-s.distance.y},a=ef(o,t);return{x:a.x-o.x,y:a.y-o.y}}function S4({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let o={x:null,y:null},a=0,l=new Map,c=!1,u={x:0,y:0},d=null,p=!1,f=null,h=!1,g=!1,k=null;function b({noDragClassName:v,handleSelector:w,domNode:C,isSelectable:N,nodeId:j,nodeClickDistance:A=0}){f=ss(C);function I({x:F,y:T}){const{nodeLookup:M,nodeExtent:q,snapGrid:H,snapToGrid:L,nodeOrigin:R,onNodeDrag:z,onSelectionDrag:E,onError:Q,updateNodePositions:V}=t();o={x:F,y:T};let $=!1;const ne=l.size>1,ce=ne&&q?kx(Zd(l)):null,X=ne&&L?v4({dragItems:l,snapGrid:H,x:F,y:T}):null;for(const[re,Z]of l){if(!M.has(re))continue;let ie={x:F-Z.distance.x,y:T-Z.distance.y};L&&(ie=X?{x:Math.round(ie.x+X.x),y:Math.round(ie.y+X.y)}:ef(ie,H));let te=null;if(ne&&q&&!Z.extent&&ce){const{positionAbsolute:be}=Z.internals,qe=be.x-ce.x+q[0][0],Ue=be.x+Z.measured.width-ce.x2+q[1][0],Me=be.y-ce.y+q[0][1],rt=be.y+Z.measured.height-ce.y2+q[1][1];te=[[qe,Me],[Ue,rt]]}const{position:ue,positionAbsolute:fe}=DP({nodeId:re,nextPosition:ie,nodeLookup:M,nodeExtent:te||q,nodeOrigin:R,onError:Q});$=$||Z.position.x!==ue.x||Z.position.y!==ue.y,Z.position=ue,Z.internals.positionAbsolute=fe}if(g=g||$,!!$&&(V(l,!0),k&&(r||z||!j&&E))){const[re,Z]=Ny({nodeId:j,dragItems:l,nodeLookup:M});r==null||r(k,l,re,Z),z==null||z(k,re,Z),j||E==null||E(k,Z)}}async function D(){if(!d)return;const{transform:F,panBy:T,autoPanSpeed:M,autoPanOnNodeDrag:q}=t();if(!q){c=!1,cancelAnimationFrame(a);return}const[H,L]=zP(u,d,M);(H!==0||L!==0)&&(o.x=(o.x??0)-H/F[2],o.y=(o.y??0)-L/F[2],await T({x:H,y:L})&&I(o)),a=requestAnimationFrame(D)}function B(F){var ne;const{nodeLookup:T,multiSelectionActive:M,nodesDraggable:q,transform:H,snapGrid:L,snapToGrid:R,selectNodesOnDrag:z,onNodeDragStart:E,onSelectionDragStart:Q,unselectNodesAndEdges:V}=t();p=!0,(!z||!N)&&!M&&j&&((ne=T.get(j))!=null&&ne.selected||V()),N&&z&&j&&(e==null||e(j));const $=Gu(F.sourceEvent,{transform:H,snapGrid:L,snapToGrid:R,containerBounds:d});if(o=$,l=k4(T,q,$,j),l.size>0&&(n||E||!j&&Q)){const[ce,X]=Ny({nodeId:j,dragItems:l,nodeLookup:T});n==null||n(F.sourceEvent,l,ce,X),E==null||E(F.sourceEvent,ce,X),j||Q==null||Q(F.sourceEvent,X)}}const W=yP().clickDistance(A).on("start",F=>{const{domNode:T,nodeDragThreshold:M,transform:q,snapGrid:H,snapToGrid:L}=t();d=(T==null?void 0:T.getBoundingClientRect())||null,h=!1,g=!1,k=F.sourceEvent,M===0&&B(F),o=Gu(F.sourceEvent,{transform:q,snapGrid:H,snapToGrid:L,containerBounds:d}),u=Us(F.sourceEvent,d)}).on("drag",F=>{const{autoPanOnNodeDrag:T,transform:M,snapGrid:q,snapToGrid:H,nodeDragThreshold:L,nodeLookup:R}=t(),z=Gu(F.sourceEvent,{transform:M,snapGrid:q,snapToGrid:H,containerBounds:d});if(k=F.sourceEvent,(F.sourceEvent.type==="touchmove"&&F.sourceEvent.touches.length>1||j&&!R.has(j))&&(h=!0),!h){if(!c&&T&&p&&(c=!0,D()),!p){const E=Us(F.sourceEvent,d),Q=E.x-u.x,V=E.y-u.y;Math.sqrt(Q*Q+V*V)>L&&B(F)}(o.x!==z.xSnapped||o.y!==z.ySnapped)&&l&&p&&(u=Us(F.sourceEvent,d),I(z))}}).on("end",F=>{if(!(!p||h)&&(c=!1,p=!1,cancelAnimationFrame(a),l.size>0)){const{nodeLookup:T,updateNodePositions:M,onNodeDragStop:q,onSelectionDragStop:H}=t();if(g&&(M(l,!1),g=!1),s||q||!j&&H){const[L,R]=Ny({nodeId:j,dragItems:l,nodeLookup:T,dragging:!1});s==null||s(F.sourceEvent,l,L,R),q==null||q(F.sourceEvent,L,R),j||H==null||H(F.sourceEvent,R)}}}).filter(F=>{const T=F.target;return!F.button&&(!v||!lj(T,`.${v}`,C))&&(!w||lj(T,w,C))});f.call(W)}function y(){f==null||f.on(".drag",null)}return{update:b,destroy:y}}function N4(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const o of t.values())_d(s,vc(o))>0&&r.push(o);return r}const j4=250;function C4(e,t,n,r){var l,c;let s=[],o=1/0;const a=N4(e,n,t+j4);for(const u of a){const d=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const p of d){if(r.nodeId===p.nodeId&&r.type===p.type&&r.id===p.id)continue;const{x:f,y:h}=Ka(u,p,p.position,!0),g=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));g>t||(g<o?(s=[{...p,x:f,y:h}],o=g):g===o&&s.push({...p,x:f,y:h}))}}if(!s.length)return null;if(s.length>1){const u=r.type==="source"?"target":"source";return s.find(d=>d.type===u)??s[0]}return s[0]}function tI(e,t,n,r,s,o=!1){var u,d,p;const a=r.get(e);if(!a)return null;const l=s==="strict"?(u=a.internals.handleBounds)==null?void 0:u[t]:[...((d=a.internals.handleBounds)==null?void 0:d.source)??[],...((p=a.internals.handleBounds)==null?void 0:p.target)??[]],c=(n?l==null?void 0:l.find(f=>f.id===n):l==null?void 0:l[0])??null;return c&&o?{...c,...Ka(a,c,c.position,!0)}:c}function nI(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function _4(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const rI=()=>!0;function E4(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:o,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:p,panBy:f,cancelConnection:h,onConnectStart:g,onConnect:k,onConnectEnd:b,isValidConnection:y=rI,onReconnectEnd:v,updateConnection:w,getTransform:C,getFromHandle:N,autoPanSpeed:j,dragThreshold:A=1,handleDomNode:I}){const D=VP(e.target);let B=0,W;const{x:F,y:T}=Us(e),M=nI(o,I),q=l==null?void 0:l.getBoundingClientRect();let H=!1;if(!q||!M)return;const L=tI(s,M,r,c,t);if(!L)return;let R=Us(e,q),z=!1,E=null,Q=!1,V=null;function $(){if(!d||!q)return;const[ue,fe]=zP(R,q,j);f({x:ue,y:fe}),B=requestAnimationFrame($)}const ne={...L,nodeId:s,type:M,position:L.position},ce=c.get(s);let re={inProgress:!0,isValid:null,from:Ka(ce,ne,Ke.Left,!0),fromHandle:ne,fromPosition:ne.position,fromNode:ce,to:R,toHandle:null,toPosition:JN[ne.position],toNode:null,pointer:R};function Z(){H=!0,w(re),g==null||g(e,{nodeId:s,handleId:r,handleType:M})}A===0&&Z();function ie(ue){if(!H){const{x:rt,y:gt}=Us(ue),bt=rt-F,oe=gt-T;if(!(bt*bt+oe*oe>A*A))return;Z()}if(!N()||!ne){te(ue);return}const fe=C();R=Us(ue,q),W=C4(tf(R,fe,!1,[1,1]),n,c,ne),z||($(),z=!0);const be=sI(ue,{handle:W,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:a?"target":"source",isValidConnection:y,doc:D,lib:u,flowId:p,nodeLookup:c});V=be.handleDomNode,E=be.connection,Q=_4(!!W,be.isValid);const qe=c.get(s),Ue=qe?Ka(qe,ne,Ke.Left,!0):re.from,Me={...re,from:Ue,isValid:Q,to:be.toHandle&&Q?Fh({x:be.toHandle.x,y:be.toHandle.y},fe):R,toHandle:be.toHandle,toPosition:Q&&be.toHandle?be.toHandle.position:JN[ne.position],toNode:be.toHandle?c.get(be.toHandle.nodeId):null,pointer:R};w(Me),re=Me}function te(ue){if(!("touches"in ue&&ue.touches.length>0)){if(H){(W||V)&&E&&Q&&(k==null||k(E));const{inProgress:fe,...be}=re,qe={...be,toPosition:re.toHandle?re.toPosition:null};b==null||b(ue,qe),o&&(v==null||v(ue,qe))}h(),cancelAnimationFrame(B),z=!1,Q=!1,E=null,V=null,D.removeEventListener("mousemove",ie),D.removeEventListener("mouseup",te),D.removeEventListener("touchmove",ie),D.removeEventListener("touchend",te)}}D.addEventListener("mousemove",ie),D.addEventListener("mouseup",te),D.addEventListener("touchmove",ie),D.addEventListener("touchend",te)}function sI(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:o,doc:a,lib:l,flowId:c,isValidConnection:u=rI,nodeLookup:d}){const p=o==="target",f=t?a.querySelector(`.${l}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:g}=Us(e),k=a.elementFromPoint(h,g),b=k!=null&&k.classList.contains(`${l}-flow__handle`)?k:f,y={handleDomNode:b,isValid:!1,connection:null,toHandle:null};if(b){const v=nI(void 0,b),w=b.getAttribute("data-nodeid"),C=b.getAttribute("data-handleid"),N=b.classList.contains("connectable"),j=b.classList.contains("connectableend");if(!w||!v)return y;const A={source:p?w:r,sourceHandle:p?C:s,target:p?r:w,targetHandle:p?s:C};y.connection=A;const D=N&&j&&(n===bc.Strict?p&&v==="source"||!p&&v==="target":w!==r||C!==s);y.isValid=D&&u(A),y.toHandle=tI(w,v,C,d,n,!0)}return y}const jx={onPointerDown:E4,isValid:sI};function A4({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=ss(e);function o({translateExtent:l,width:c,height:u,zoomStep:d=1,pannable:p=!0,zoomable:f=!0,inversePan:h=!1}){const g=w=>{if(w.sourceEvent.type!=="wheel"||!t)return;const C=n(),N=w.sourceEvent.ctrlKey&&Ed()?10:1,j=-w.sourceEvent.deltaY*(w.sourceEvent.deltaMode===1?.05:w.sourceEvent.deltaMode?1:.002)*d,A=C[2]*Math.pow(2,j*N);t.scaleTo(A)};let k=[0,0];const b=w=>{(w.sourceEvent.type==="mousedown"||w.sourceEvent.type==="touchstart")&&(k=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY])},y=w=>{const C=n();if(w.sourceEvent.type!=="mousemove"&&w.sourceEvent.type!=="touchmove"||!t)return;const N=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY],j=[N[0]-k[0],N[1]-k[1]];k=N;const A=r()*Math.max(C[2],Math.log(C[2]))*(h?-1:1),I={x:C[0]-j[0]*A,y:C[1]-j[1]*A},D=[[0,0],[c,u]];t.setViewportConstrained({x:I.x,y:I.y,zoom:C[2]},D,l)},v=RP().on("start",b).on("zoom",p?y:null).on("zoom.wheel",f?g:null);s.call(v,{})}function a(){s.on("zoom",null)}return{update:o,destroy:a,pointer:Hs}}const Om=e=>({x:e.x,y:e.y,zoom:e.k}),jy=({x:e,y:t,zoom:n})=>Mm.translate(e,t).scale(n),Yl=(e,t)=>e.target.closest(`.${t}`),iI=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),P4=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Cy=(e,t=0,n=P4,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},oI=e=>{const t=e.ctrlKey&&Ed()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function I4({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:o,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(Yl(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const p=n.property("__zoom").k||1;if(d.ctrlKey&&a){const b=Hs(d),y=oI(d),v=p*Math.pow(2,y);r.scaleTo(n,v,b,d);return}const f=d.deltaMode===1?20:1;let h=s===Ta.Vertical?0:d.deltaX*f,g=s===Ta.Horizontal?0:d.deltaY*f;!Ed()&&d.shiftKey&&s!==Ta.Vertical&&(h=d.deltaY*f,g=0),r.translateBy(n,-(h/p)*o,-(g/p)*o,{internal:!0});const k=Om(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,k),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,k),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(d,k))}}function R4({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const o=r.type==="wheel",a=!t&&o&&!r.ctrlKey,l=Yl(r,e);if(r.ctrlKey&&o&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,s)}}function T4({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var o,a,l;if((o=r.sourceEvent)!=null&&o.internal)return;const s=Om(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 M4({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return o=>{var a,l;e.usedRightMouseButton=!!(n&&iI(t,e.mouseButton??0)),(a=o.sourceEvent)!=null&&a.sync||r([o.transform.x,o.transform.y,o.transform.k]),s&&!((l=o.sourceEvent)!=null&&l.internal)&&(s==null||s(o.sourceEvent,Om(o.transform)))}}function $4({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:o}){return a=>{var l;if(!((l=a.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,o&&iI(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&o(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=Om(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,c)},n?150:0)}}}function L4({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:o,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:d}){return p=>{var b;const f=e||t,h=n&&p.ctrlKey,g=p.type==="wheel";if(p.button===1&&p.type==="mousedown"&&(Yl(p,`${u}-flow__node`)||Yl(p,`${u}-flow__edge`)))return!0;if(!r&&!f&&!s&&!o&&!n||a||d&&!g||Yl(p,l)&&g||Yl(p,c)&&(!g||s&&g&&!e)||!n&&p.ctrlKey&&g)return!1;if(!n&&p.type==="touchstart"&&((b=p.touches)==null?void 0:b.length)>1)return p.preventDefault(),!1;if(!f&&!s&&!h&&g||!r&&(p.type==="mousedown"||p.type==="touchstart")||Array.isArray(r)&&!r.includes(p.button)&&p.type==="mousedown")return!1;const k=Array.isArray(r)&&r.includes(p.button)||!p.button||p.button<=1;return(!p.ctrlKey||g)&&k}}function O4({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:o,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),p=RP().scaleExtent([t,n]).translateExtent(r),f=ss(e).call(p);v({x:s.x,y:s.y,zoom:kc(s.zoom,t,n)},[[0,0],[d.width,d.height]],r);const h=f.on("wheel.zoom"),g=f.on("dblclick.zoom");p.wheelDelta(oI);function k(W,F){return f?new Promise(T=>{p==null||p.interpolate((F==null?void 0:F.interpolate)==="linear"?Yu:Yp).transform(Cy(f,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>T(!0)),W)}):Promise.resolve(!1)}function b({noWheelClassName:W,noPanClassName:F,onPaneContextMenu:T,userSelectionActive:M,panOnScroll:q,panOnDrag:H,panOnScrollMode:L,panOnScrollSpeed:R,preventScrolling:z,zoomOnPinch:E,zoomOnScroll:Q,zoomOnDoubleClick:V,zoomActivationKeyPressed:$,lib:ne,onTransformChange:ce,connectionInProgress:X,paneClickDistance:re,selectionOnDrag:Z}){M&&!u.isZoomingOrPanning&&y();const ie=q&&!$&&!M;p.clickDistance(Z?1/0:!qs(re)||re<0?0:re);const te=ie?I4({zoomPanValues:u,noWheelClassName:W,d3Selection:f,d3Zoom:p,panOnScrollMode:L,panOnScrollSpeed:R,zoomOnPinch:E,onPanZoomStart:a,onPanZoom:o,onPanZoomEnd:l}):R4({noWheelClassName:W,preventScrolling:z,d3ZoomHandler:h});if(f.on("wheel.zoom",te,{passive:!1}),!M){const fe=T4({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});p.on("start",fe);const be=M4({zoomPanValues:u,panOnDrag:H,onPaneContextMenu:!!T,onPanZoom:o,onTransformChange:ce});p.on("zoom",be);const qe=$4({zoomPanValues:u,panOnDrag:H,panOnScroll:q,onPaneContextMenu:T,onPanZoomEnd:l,onDraggingChange:c});p.on("end",qe)}const ue=L4({zoomActivationKeyPressed:$,panOnDrag:H,zoomOnScroll:Q,panOnScroll:q,zoomOnDoubleClick:V,zoomOnPinch:E,userSelectionActive:M,noPanClassName:F,noWheelClassName:W,lib:ne,connectionInProgress:X});p.filter(ue),V?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function y(){p.on("zoom",null)}async function v(W,F,T){const M=jy(W),q=p==null?void 0:p.constrain()(M,F,T);return q&&await k(q),new Promise(H=>H(q))}async function w(W,F){const T=jy(W);return await k(T,F),new Promise(M=>M(T))}function C(W){if(f){const F=jy(W),T=f.property("__zoom");(T.k!==W.zoom||T.x!==W.x||T.y!==W.y)&&(p==null||p.transform(f,F,null,{sync:!0}))}}function N(){const W=f?IP(f.node()):{x:0,y:0,k:1};return{x:W.x,y:W.y,zoom:W.k}}function j(W,F){return f?new Promise(T=>{p==null||p.interpolate((F==null?void 0:F.interpolate)==="linear"?Yu:Yp).scaleTo(Cy(f,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>T(!0)),W)}):Promise.resolve(!1)}function A(W,F){return f?new Promise(T=>{p==null||p.interpolate((F==null?void 0:F.interpolate)==="linear"?Yu:Yp).scaleBy(Cy(f,F==null?void 0:F.duration,F==null?void 0:F.ease,()=>T(!0)),W)}):Promise.resolve(!1)}function I(W){p==null||p.scaleExtent(W)}function D(W){p==null||p.translateExtent(W)}function B(W){const F=!qs(W)||W<0?0:W;p==null||p.clickDistance(F)}return{update:b,destroy:y,setViewport:w,setViewportConstrained:v,getViewport:N,scaleTo:j,scaleBy:A,setScaleExtent:I,setTranslateExtent:D,syncViewport:C,setClickDistance:B}}var Nc;(function(e){e.Line="line",e.Handle="handle"})(Nc||(Nc={}));function D4({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:o}){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&&o&&(c[1]=c[1]*-1),c}function cj(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 So(e,t){return Math.max(0,t-e)}function No(e,t){return Math.max(0,e-t)}function dp(e,t,n){return Math.max(0,t-e,e-n)}function uj(e,t){return e?!t:t}function F4(e,t,n,r,s,o,a,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:p}=t,f=d&&p,{xSnapped:h,ySnapped:g}=n,{minWidth:k,maxWidth:b,minHeight:y,maxHeight:v}=r,{x:w,y:C,width:N,height:j,aspectRatio:A}=e;let I=Math.floor(d?h-e.pointerX:0),D=Math.floor(p?g-e.pointerY:0);const B=N+(c?-I:I),W=j+(u?-D:D),F=-o[0]*N,T=-o[1]*j;let M=dp(B,k,b),q=dp(W,y,v);if(a){let R=0,z=0;c&&I<0?R=So(w+I+F,a[0][0]):!c&&I>0&&(R=No(w+B+F,a[1][0])),u&&D<0?z=So(C+D+T,a[0][1]):!u&&D>0&&(z=No(C+W+T,a[1][1])),M=Math.max(M,R),q=Math.max(q,z)}if(l){let R=0,z=0;c&&I>0?R=No(w+I,l[0][0]):!c&&I<0&&(R=So(w+B,l[1][0])),u&&D>0?z=No(C+D,l[0][1]):!u&&D<0&&(z=So(C+W,l[1][1])),M=Math.max(M,R),q=Math.max(q,z)}if(s){if(d){const R=dp(B/A,y,v)*A;if(M=Math.max(M,R),a){let z=0;!c&&!u||c&&!u&&f?z=No(C+T+B/A,a[1][1])*A:z=So(C+T+(c?I:-I)/A,a[0][1])*A,M=Math.max(M,z)}if(l){let z=0;!c&&!u||c&&!u&&f?z=So(C+B/A,l[1][1])*A:z=No(C+(c?I:-I)/A,l[0][1])*A,M=Math.max(M,z)}}if(p){const R=dp(W*A,k,b)/A;if(q=Math.max(q,R),a){let z=0;!c&&!u||u&&!c&&f?z=No(w+W*A+F,a[1][0])/A:z=So(w+(u?D:-D)*A+F,a[0][0])/A,q=Math.max(q,z)}if(l){let z=0;!c&&!u||u&&!c&&f?z=So(w+W*A,l[1][0])/A:z=No(w+(u?D:-D)*A,l[0][0])/A,q=Math.max(q,z)}}}D=D+(D<0?q:-q),I=I+(I<0?M:-M),s&&(f?B>W*A?D=(uj(c,u)?-I:I)/A:I=(uj(c,u)?-D:D)*A:d?(D=I/A,u=c):(I=D*A,c=u));const H=c?w+I:w,L=u?C+D:C;return{width:N+(c?-I:I),height:j+(u?-D:D),x:o[0]*I*(c?-1:1)+H,y:o[1]*D*(u?-1:1)+L}}const aI={width:0,height:0,x:0,y:0},z4={...aI,pointerX:0,pointerY:0,aspectRatio:1};function B4(e){return[[0,0],[e.measured.width,e.measured.height]]}function H4(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,o=e.measured.width??0,a=e.measured.height??0,l=n[0]*o,c=n[1]*a;return[[r-l,s-c],[r+o-l,s+a-c]]}function W4({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const o=ss(e);let a={controlDirection:cj("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:d,keepAspectRatio:p,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:k,shouldResize:b}){let y={...aI},v={...z4};a={boundaries:d,resizeDirection:f,keepAspectRatio:p,controlDirection:cj(u)};let w,C=null,N=[],j,A,I,D=!1;const B=yP().on("start",W=>{const{nodeLookup:F,transform:T,snapGrid:M,snapToGrid:q,nodeOrigin:H,paneDomNode:L}=n();if(w=F.get(t),!w)return;C=(L==null?void 0:L.getBoundingClientRect())??null;const{xSnapped:R,ySnapped:z}=Gu(W.sourceEvent,{transform:T,snapGrid:M,snapToGrid:q,containerBounds:C});y={width:w.measured.width??0,height:w.measured.height??0,x:w.position.x??0,y:w.position.y??0},v={...y,pointerX:R,pointerY:z,aspectRatio:y.width/y.height},j=void 0,w.parentId&&(w.extent==="parent"||w.expandParent)&&(j=F.get(w.parentId),A=j&&w.extent==="parent"?B4(j):void 0),N=[],I=void 0;for(const[E,Q]of F)if(Q.parentId===t&&(N.push({id:E,position:{...Q.position},extent:Q.extent}),Q.extent==="parent"||Q.expandParent)){const V=H4(Q,w,Q.origin??H);I?I=[[Math.min(V[0][0],I[0][0]),Math.min(V[0][1],I[0][1])],[Math.max(V[1][0],I[1][0]),Math.max(V[1][1],I[1][1])]]:I=V}h==null||h(W,{...y})}).on("drag",W=>{const{transform:F,snapGrid:T,snapToGrid:M,nodeOrigin:q}=n(),H=Gu(W.sourceEvent,{transform:F,snapGrid:T,snapToGrid:M,containerBounds:C}),L=[];if(!w)return;const{x:R,y:z,width:E,height:Q}=y,V={},$=w.origin??q,{width:ne,height:ce,x:X,y:re}=F4(v,a.controlDirection,H,a.boundaries,a.keepAspectRatio,$,A,I),Z=ne!==E,ie=ce!==Q,te=X!==R&&Z,ue=re!==z&&ie;if(!te&&!ue&&!Z&&!ie)return;if((te||ue||$[0]===1||$[1]===1)&&(V.x=te?X:y.x,V.y=ue?re:y.y,y.x=V.x,y.y=V.y,N.length>0)){const Ue=X-R,Me=re-z;for(const rt of N)rt.position={x:rt.position.x-Ue+$[0]*(ne-E),y:rt.position.y-Me+$[1]*(ce-Q)},L.push(rt)}if((Z||ie)&&(V.width=Z&&(!a.resizeDirection||a.resizeDirection==="horizontal")?ne:y.width,V.height=ie&&(!a.resizeDirection||a.resizeDirection==="vertical")?ce:y.height,y.width=V.width,y.height=V.height),j&&w.expandParent){const Ue=$[0]*(V.width??0);V.x&&V.x<Ue&&(y.x=Ue,v.x=v.x-(V.x-Ue));const Me=$[1]*(V.height??0);V.y&&V.y<Me&&(y.y=Me,v.y=v.y-(V.y-Me))}const fe=D4({width:y.width,prevWidth:E,height:y.height,prevHeight:Q,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),be={...y,direction:fe};(b==null?void 0:b(W,be))!==!1&&(D=!0,g==null||g(W,be),r(V,L))}).on("end",W=>{D&&(k==null||k(W,{...y}),s==null||s({...y}),D=!1)});o.call(B)}function c(){o.on(".drag",null)}return{update:l,destroy:c}}var lI={exports:{}},cI={},uI={exports:{}},dI={};/**
|
|
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 jc=m;function V4(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var K4=typeof Object.is=="function"?Object.is:V4,q4=jc.useState,U4=jc.useEffect,Y4=jc.useLayoutEffect,G4=jc.useDebugValue;function J4(e,t){var n=t(),r=q4({inst:{value:n,getSnapshot:t}}),s=r[0].inst,o=r[1];return Y4(function(){s.value=n,s.getSnapshot=t,_y(s)&&o({inst:s})},[e,n,t]),U4(function(){return _y(s)&&o({inst:s}),e(function(){_y(s)&&o({inst:s})})},[e]),G4(n),n}function _y(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!K4(e,n)}catch{return!0}}function X4(e,t){return t()}var Q4=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?X4:J4;dI.useSyncExternalStore=jc.useSyncExternalStore!==void 0?jc.useSyncExternalStore:Q4;uI.exports=dI;var fI=uI.exports;/**
|
|
53
|
-
* @license React
|
|
54
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
55
|
-
*
|
|
56
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
57
|
-
*
|
|
58
|
-
* This source code is licensed under the MIT license found in the
|
|
59
|
-
* LICENSE file in the root directory of this source tree.
|
|
60
|
-
*/var Dm=m,Z4=fI;function eH(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var tH=typeof Object.is=="function"?Object.is:eH,nH=Z4.useSyncExternalStore,rH=Dm.useRef,sH=Dm.useEffect,iH=Dm.useMemo,oH=Dm.useDebugValue;cI.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var o=rH(null);if(o.current===null){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=iH(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),s!==void 0&&a.hasValue){var g=a.value;if(s(g,h))return p=g}return p=h}if(g=p,tH(d,h))return g;var k=r(h);return s!==void 0&&s(g,k)?(d=h,g):(d=h,p=k)}var u=!1,d,p,f=n===void 0?null:n;return[function(){return c(t())},f===null?void 0:function(){return c(f())}]},[t,n,r,s]);var l=nH(e,o[0],o[1]);return sH(function(){a.hasValue=!0,a.value=l},[l]),oH(l),l};lI.exports=cI;var aH=lI.exports;const lH=Zo(aH),cH={},dj=e=>{let t;const n=new Set,r=(d,p)=>{const f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){const h=t;t=p??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,h))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(cH?"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},uH=e=>e?dj(e):dj,{useDebugValue:dH}=dt,{useSyncExternalStoreWithSelector:fH}=lH,pH=e=>e;function pI(e,t=pH,n){const r=fH(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return dH(r),r}const fj=(e,t)=>{const n=uH(e),r=(s,o=t)=>pI(n,s,o);return Object.assign(r,n),r},hH=(e,t)=>e?fj(e,t):fj;function kn(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const Fm=m.createContext(null),mH=Fm.Provider,hI=_i.error001();function Dt(e,t){const n=m.useContext(Fm);if(n===null)throw new Error(hI);return pI(n,e,t)}function wn(){const e=m.useContext(Fm);if(e===null)throw new Error(hI);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const pj={display:"none"},gH={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},mI="react-flow__node-desc",gI="react-flow__edge-desc",yH="react-flow__aria-live",wH=e=>e.ariaLiveMessage,xH=e=>e.ariaLabelConfig;function bH({rfId:e}){const t=Dt(wH);return i.jsx("div",{id:`${yH}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:gH,children:t})}function kH({rfId:e,disableKeyboardA11y:t}){const n=Dt(xH);return i.jsxs(i.Fragment,{children:[i.jsx("div",{id:`${mI}-${e}`,style:pj,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),i.jsx("div",{id:`${gI}-${e}`,style:pj,children:n["edge.a11yDescription.default"]}),!t&&i.jsx(bH,{rfId:e})]})}const zm=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},o)=>{const a=`${e}`.split("-");return i.jsx("div",{className:Kn(["react-flow__panel",n,...a]),style:r,ref:o,...s,children:t})});zm.displayName="Panel";function vH({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:i.jsx(zm,{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:i.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const SH=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}},fp=e=>e.id;function NH(e,t){return kn(e.selectedNodes.map(fp),t.selectedNodes.map(fp))&&kn(e.selectedEdges.map(fp),t.selectedEdges.map(fp))}function jH({onSelectionChange:e}){const t=wn(),{selectedNodes:n,selectedEdges:r}=Dt(SH,NH);return m.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(o=>o(s))},[n,r,e]),null}const CH=e=>!!e.onSelectionChangeHandlers;function _H({onSelectionChange:e}){const t=Dt(CH);return e||t?i.jsx(jH,{onSelectionChange:e}):null}const Cx=typeof window<"u"?m.useLayoutEffect:m.useEffect,yI=[0,0],EH={x:0,y:0,zoom:1},AH=["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"],hj=[...AH,"rfId"],PH=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}),mj={translateExtent:jd,nodeOrigin:yI,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function IH(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:o,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=Dt(PH,kn),u=wn();Cx(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=mj,l()}),[]);const d=m.useRef(mj);return Cx(()=>{for(const p of hj){const f=e[p],h=d.current[p];f!==h&&(typeof e[p]>"u"||(p==="nodes"?t(f):p==="edges"?n(f):p==="minZoom"?r(f):p==="maxZoom"?s(f):p==="translateExtent"?o(f):p==="nodeExtent"?a(f):p==="ariaLabelConfig"?u.setState({ariaLabelConfig:n4(f)}):p==="fitView"?u.setState({fitViewQueued:f}):p==="fitViewOptions"?u.setState({fitViewOptions:f}):u.setState({[p]:f})))}d.current=e},hj.map(p=>e[p])),null}function gj(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function RH(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const s=gj(),o=()=>n(s!=null&&s.matches?"dark":"light");return o(),s==null||s.addEventListener("change",o),()=>{s==null||s.removeEventListener("change",o)}},[e]),t!==null?t:(r=gj())!=null&&r.matches?"dark":"light"}const yj=typeof document<"u"?document:null;function Ad(e=null,t={target:yj,actInsideInputWithModifier:!0}){const[n,r]=m.useState(!1),s=m.useRef(!1),o=m.useRef(new Set([])),[a,l]=m.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(p=>typeof p=="string").map(p=>p.replace("+",`
|
|
61
|
-
`).replace(`
|
|
62
|
-
|
|
63
|
-
`,`
|
|
64
|
-
+`).split(`
|
|
65
|
-
`)),d=u.reduce((p,f)=>p.concat(...f),[]);return[u,d]}return[[],[]]},[e]);return m.useEffect(()=>{const c=(t==null?void 0:t.target)??yj,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=h=>{var b,y;if(s.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!s.current||s.current&&!u)&&KP(h))return!1;const k=xj(h.code,l);if(o.current.add(h[k]),wj(a,o.current,!1)){const v=((y=(b=h.composedPath)==null?void 0:b.call(h))==null?void 0:y[0])||h.target,w=(v==null?void 0:v.nodeName)==="BUTTON"||(v==null?void 0:v.nodeName)==="A";t.preventDefault!==!1&&(s.current||!w)&&h.preventDefault(),r(!0)}},p=h=>{const g=xj(h.code,l);wj(a,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(h[g]),h.key==="Meta"&&o.current.clear(),s.current=!1},f=()=>{o.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",p),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",p),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,r]),n}function wj(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function xj(e,t){return t.includes(e)?"code":"key"}const TH=()=>{const e=wn();return m.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,o],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??o},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:o,maxZoom:a,panZoom:l}=e.getState(),c=gk(t,r,s,o,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:o,domNode:a}=e.getState();if(!a)return t;const{x:l,y:c}=a.getBoundingClientRect(),u={x:t.x-l,y:t.y-c},d=n.snapGrid??s,p=n.snapToGrid??o;return tf(u,r,p,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:o}=r.getBoundingClientRect(),a=Fh(t,n);return{x:a.x+s,y:a.y+o}}}),[])};function wI(e,t){const n=[],r=new Map,s=[];for(const o of e)if(o.type==="add"){s.push(o);continue}else if(o.type==="remove"||o.type==="replace")r.set(o.id,[o]);else{const a=r.get(o.id);a?a.push(o):r.set(o.id,[o])}for(const o of t){const a=r.get(o.id);if(!a){n.push(o);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const l={...o};for(const c of a)MH(c,l);n.push(l)}return s.length&&s.forEach(o=>{o.index!==void 0?n.splice(o.index,0,{...o.item}):n.push({...o.item})}),n}function MH(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 zh(e,t){return wI(e,t)}function Bh(e,t){return wI(e,t)}function xa(e,t){return{id:e,type:"select",selected:t}}function Gl(e,t=new Set,n=!1){const r=[];for(const[s,o]of e){const a=t.has(s);!(o.selected===void 0&&!a)&&o.selected!==a&&(n&&(o.selected=a),r.push(xa(o.id,a)))}return r}function bj({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(o=>[o.id,o]));for(const[o,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:o})}for(const[o]of t)r.get(o)===void 0&&n.push({id:o,type:"remove"});return n}function kj(e){return{id:e.id,type:"remove"}}const vj=e=>qB(e),$H=e=>OP(e);function xI(e){return m.forwardRef(e)}function Sj(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>LH(()=>n(s=>s+BigInt(1))));return Cx(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function LH(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const bI=m.createContext(null);function OH({children:e}){const t=wn(),n=m.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:p,nodeLookup:f,fitViewQueued:h,onNodesChangeMiddlewareMap:g}=t.getState();let k=c;for(const y of l)k=typeof y=="function"?y(k):y;let b=bj({items:k,lookup:f});for(const y of g.values())b=y(b);d&&u(k),b.length>0?p==null||p(b):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:v,setNodes:w}=t.getState();y&&w(v)})},[]),r=Sj(n),s=m.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:p,edgeLookup:f}=t.getState();let h=c;for(const g of l)h=typeof g=="function"?g(h):g;d?u(h):p&&p(bj({items:h,lookup:f}))},[]),o=Sj(s),a=m.useMemo(()=>({nodeQueue:r,edgeQueue:o}),[]);return i.jsx(bI.Provider,{value:a,children:e})}function DH(){const e=m.useContext(bI);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const FH=e=>!!e.panZoom;function Rc(){const e=TH(),t=wn(),n=DH(),r=Dt(FH),s=m.useMemo(()=>{const o=p=>t.getState().nodeLookup.get(p),a=p=>{n.nodeQueue.push(p)},l=p=>{n.edgeQueue.push(p)},c=p=>{var y,v;const{nodeLookup:f,nodeOrigin:h}=t.getState(),g=vj(p)?p:f.get(p.id),k=g.parentId?WP(g.position,g.measured,g.parentId,f,h):g.position,b={...g,position:k,width:((y=g.measured)==null?void 0:y.width)??g.width,height:((v=g.measured)==null?void 0:v.height)??g.height};return vc(b)},u=(p,f,h={replace:!1})=>{a(g=>g.map(k=>{if(k.id===p){const b=typeof f=="function"?f(k):f;return h.replace&&vj(b)?b:{...k,...b}}return k}))},d=(p,f,h={replace:!1})=>{l(g=>g.map(k=>{if(k.id===p){const b=typeof f=="function"?f(k):f;return h.replace&&$H(b)?b:{...k,...b}}return k}))};return{getNodes:()=>t.getState().nodes.map(p=>({...p})),getNode:p=>{var f;return(f=o(p))==null?void 0:f.internals.userNode},getInternalNode:o,getEdges:()=>{const{edges:p=[]}=t.getState();return p.map(f=>({...f}))},getEdge:p=>t.getState().edgeLookup.get(p),setNodes:a,setEdges:l,addNodes:p=>{const f=Array.isArray(p)?p:[p];n.nodeQueue.push(h=>[...h,...f])},addEdges:p=>{const f=Array.isArray(p)?p:[p];n.edgeQueue.push(h=>[...h,...f])},toObject:()=>{const{nodes:p=[],edges:f=[],transform:h}=t.getState(),[g,k,b]=h;return{nodes:p.map(y=>({...y})),edges:f.map(y=>({...y})),viewport:{x:g,y:k,zoom:b}}},deleteElements:async({nodes:p=[],edges:f=[]})=>{const{nodes:h,edges:g,onNodesDelete:k,onEdgesDelete:b,triggerNodeChanges:y,triggerEdgeChanges:v,onDelete:w,onBeforeDelete:C}=t.getState(),{nodes:N,edges:j}=await XB({nodesToRemove:p,edgesToRemove:f,nodes:h,edges:g,onBeforeDelete:C}),A=j.length>0,I=N.length>0;if(A){const D=j.map(kj);b==null||b(j),v(D)}if(I){const D=N.map(kj);k==null||k(N),y(D)}return(I||A)&&(w==null||w({nodes:N,edges:j})),{deletedNodes:N,deletedEdges:j}},getIntersectingNodes:(p,f=!0,h)=>{const g=QN(p),k=g?p:c(p),b=h!==void 0;return k?(h||t.getState().nodes).filter(y=>{const v=t.getState().nodeLookup.get(y.id);if(v&&!g&&(y.id===p.id||!v.internals.positionAbsolute))return!1;const w=vc(b?y:v),C=_d(w,k);return f&&C>0||C>=w.width*w.height||C>=k.width*k.height}):[]},isNodeIntersecting:(p,f,h=!0)=>{const k=QN(p)?p:c(p);if(!k)return!1;const b=_d(k,f);return h&&b>0||b>=f.width*f.height||b>=k.width*k.height},updateNode:u,updateNodeData:(p,f,h={replace:!1})=>{u(p,g=>{const k=typeof f=="function"?f(g):f;return h.replace?{...g,data:k}:{...g,data:{...g.data,...k}}},h)},updateEdge:d,updateEdgeData:(p,f,h={replace:!1})=>{d(p,g=>{const k=typeof f=="function"?f(g):f;return h.replace?{...g,data:k}:{...g,data:{...g.data,...k}}},h)},getNodesBounds:p=>{const{nodeLookup:f,nodeOrigin:h}=t.getState();return UB(p,{nodeLookup:f,nodeOrigin:h})},getHandleConnections:({type:p,id:f,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}-${p}${f?`-${f}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:p,handleId:f,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}${p?f?`-${p}-${f}`:`-${p}`:""}`))==null?void 0:g.values())??[])},fitView:async p=>{const f=t.getState().fitViewResolver??t4();return t.setState({fitViewQueued:!0,fitViewOptions:p,fitViewResolver:f}),n.nodeQueue.push(h=>[...h]),f.promise}}},[]);return m.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const Nj=e=>e.selected,zH=typeof window<"u"?window:void 0;function BH({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=wn(),{deleteElements:r}=Rc(),s=Ad(e,{actInsideInputWithModifier:!1}),o=Ad(t,{target:zH});m.useEffect(()=>{if(s){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(Nj),edges:a.filter(Nj)}),n.setState({nodesSelectionActive:!1})}},[s]),m.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])}function HH(e){const t=wn();m.useEffect(()=>{const n=()=>{var s,o,a,l;if(!e.current||!(((o=(s=e.current).checkVisibility)==null?void 0:o.call(s))??!0))return!1;const r=yk(e.current);(r.height===0||r.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",_i.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 Bm={position:"absolute",width:"100%",height:"100%",top:0,left:0},WH=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function VH({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:o=Ta.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:p,zoomActivationKeyCode:f,preventScrolling:h=!0,children:g,noWheelClassName:k,noPanClassName:b,onViewportChange:y,isControlledViewport:v,paneClickDistance:w,selectionOnDrag:C}){const N=wn(),j=m.useRef(null),{userSelectionActive:A,lib:I,connectionInProgress:D}=Dt(WH,kn),B=Ad(f),W=m.useRef();HH(j);const F=m.useCallback(T=>{y==null||y({x:T[0],y:T[1],zoom:T[2]}),v||N.setState({transform:T})},[y,v]);return m.useEffect(()=>{if(j.current){W.current=O4({domNode:j.current,minZoom:d,maxZoom:p,translateExtent:u,viewport:c,onDraggingChange:H=>N.setState(L=>L.paneDragging===H?L:{paneDragging:H}),onPanZoomStart:(H,L)=>{const{onViewportChangeStart:R,onMoveStart:z}=N.getState();z==null||z(H,L),R==null||R(L)},onPanZoom:(H,L)=>{const{onViewportChange:R,onMove:z}=N.getState();z==null||z(H,L),R==null||R(L)},onPanZoomEnd:(H,L)=>{const{onViewportChangeEnd:R,onMoveEnd:z}=N.getState();z==null||z(H,L),R==null||R(L)}});const{x:T,y:M,zoom:q}=W.current.getViewport();return N.setState({panZoom:W.current,transform:[T,M,q],domNode:j.current.closest(".react-flow")}),()=>{var H;(H=W.current)==null||H.destroy()}}},[]),m.useEffect(()=>{var T;(T=W.current)==null||T.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:o,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:B,preventScrolling:h,noPanClassName:b,userSelectionActive:A,noWheelClassName:k,lib:I,onTransformChange:F,connectionInProgress:D,selectionOnDrag:C,paneClickDistance:w})},[e,t,n,r,s,o,a,l,B,h,b,A,k,I,F,D,C,w]),i.jsx("div",{className:"react-flow__renderer",ref:j,style:Bm,children:g})}const KH=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function qH(){const{userSelectionActive:e,userSelectionRect:t}=Dt(KH,kn);return e&&t?i.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 Ey=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},UH=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function YH({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Cd.Full,panOnDrag:r,paneClickDistance:s,selectionOnDrag:o,onSelectionStart:a,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:p,onPaneMouseMove:f,onPaneMouseLeave:h,children:g}){const k=wn(),{userSelectionActive:b,elementsSelectable:y,dragging:v,connectionInProgress:w}=Dt(UH,kn),C=y&&(e||b),N=m.useRef(null),j=m.useRef(),A=m.useRef(new Set),I=m.useRef(new Set),D=m.useRef(!1),B=R=>{if(D.current||w){D.current=!1;return}c==null||c(R),k.getState().resetSelectedElements(),k.setState({nodesSelectionActive:!1})},W=R=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){R.preventDefault();return}u==null||u(R)},F=d?R=>d(R):void 0,T=R=>{D.current&&(R.stopPropagation(),D.current=!1)},M=R=>{var ce,X;const{domNode:z}=k.getState();if(j.current=z==null?void 0:z.getBoundingClientRect(),!j.current)return;const E=R.target===N.current;if(!E&&!!R.target.closest(".nokey")||!e||!(o&&E||t)||R.button!==0||!R.isPrimary)return;(X=(ce=R.target)==null?void 0:ce.setPointerCapture)==null||X.call(ce,R.pointerId),D.current=!1;const{x:$,y:ne}=Us(R.nativeEvent,j.current);k.setState({userSelectionRect:{width:0,height:0,startX:$,startY:ne,x:$,y:ne}}),E||(R.stopPropagation(),R.preventDefault())},q=R=>{const{userSelectionRect:z,transform:E,nodeLookup:Q,edgeLookup:V,connectionLookup:$,triggerNodeChanges:ne,triggerEdgeChanges:ce,defaultEdgeOptions:X,resetSelectedElements:re}=k.getState();if(!j.current||!z)return;const{x:Z,y:ie}=Us(R.nativeEvent,j.current),{startX:te,startY:ue}=z;if(!D.current){const Me=t?0:s;if(Math.hypot(Z-te,ie-ue)<=Me)return;re(),a==null||a(R)}D.current=!0;const fe={startX:te,startY:ue,x:Z<te?Z:te,y:ie<ue?ie:ue,width:Math.abs(Z-te),height:Math.abs(ie-ue)},be=A.current,qe=I.current;A.current=new Set(mk(Q,fe,E,n===Cd.Partial,!0).map(Me=>Me.id)),I.current=new Set;const Ue=(X==null?void 0:X.selectable)??!0;for(const Me of A.current){const rt=$.get(Me);if(rt)for(const{edgeId:gt}of rt.values()){const bt=V.get(gt);bt&&(bt.selectable??Ue)&&I.current.add(gt)}}if(!ZN(be,A.current)){const Me=Gl(Q,A.current,!0);ne(Me)}if(!ZN(qe,I.current)){const Me=Gl(V,I.current);ce(Me)}k.setState({userSelectionRect:fe,userSelectionActive:!0,nodesSelectionActive:!1})},H=R=>{var z,E;R.button===0&&((E=(z=R.target)==null?void 0:z.releasePointerCapture)==null||E.call(z,R.pointerId),!b&&R.target===N.current&&k.getState().userSelectionRect&&(B==null||B(R)),k.setState({userSelectionActive:!1,userSelectionRect:null}),D.current&&(l==null||l(R),k.setState({nodesSelectionActive:A.current.size>0})))},L=r===!0||Array.isArray(r)&&r.includes(0);return i.jsxs("div",{className:Kn(["react-flow__pane",{draggable:L,dragging:v,selection:e}]),onClick:C?void 0:Ey(B,N),onContextMenu:Ey(W,N),onWheel:Ey(F,N),onPointerEnter:C?void 0:p,onPointerMove:C?q:f,onPointerUp:C?H:void 0,onPointerDownCapture:C?M:void 0,onClickCapture:C?T:void 0,onPointerLeave:h,ref:N,style:Bm,children:[g,i.jsx(qH,{})]})}function _x({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:o,multiSelectionActive:a,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",_i.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(o({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):s([e])}function kI({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:o,nodeClickDistance:a}){const l=wn(),[c,u]=m.useState(!1),d=m.useRef();return m.useEffect(()=>{d.current=S4({getStoreItems:()=>l.getState(),onNodeMouseDown:p=>{_x({id:p,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),m.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:o,nodeId:s,nodeClickDistance:a}),()=>{var p;(p=d.current)==null||p.destroy()}},[n,r,t,o,e,s,a]),c}const GH=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function vI(){const e=wn();return m.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:o,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),p=new Map,f=GH(a),h=s?o[0]:5,g=s?o[1]:5,k=n.direction.x*h*n.factor,b=n.direction.y*g*n.factor;for(const[,y]of u){if(!f(y))continue;let v={x:y.internals.positionAbsolute.x+k,y:y.internals.positionAbsolute.y+b};s&&(v=ef(v,o));const{position:w,positionAbsolute:C}=DP({nodeId:y.id,nextPosition:v,nodeLookup:u,nodeExtent:r,nodeOrigin:d,onError:l});y.position=w,y.internals.positionAbsolute=C,p.set(y.id,y)}c(p)},[])}const Sk=m.createContext(null),JH=Sk.Provider;Sk.Consumer;const SI=()=>m.useContext(Sk),XH=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),QH=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:o,connection:a}=r,{fromHandle:l,toHandle:c,isValid:u}=a,d=(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:d,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:o===bc.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:d&&u}};function ZH({type:e="source",position:t=Ke.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:o=!0,id:a,onConnect:l,children:c,className:u,onMouseDown:d,onTouchStart:p,...f},h){var q,H;const g=a||null,k=e==="target",b=wn(),y=SI(),{connectOnClick:v,noPanClassName:w,rfId:C}=Dt(XH,kn),{connectingFrom:N,connectingTo:j,clickConnecting:A,isPossibleEndHandle:I,connectionInProcess:D,clickConnectionInProcess:B,valid:W}=Dt(QH(y,g,e),kn);y||(H=(q=b.getState()).onError)==null||H.call(q,"010",_i.error010());const F=L=>{const{defaultEdgeOptions:R,onConnect:z,hasDefaultEdges:E}=b.getState(),Q={...R,...L};if(E){const{edges:V,setEdges:$}=b.getState();$(Qp(Q,V))}z==null||z(Q),l==null||l(Q)},T=L=>{if(!y)return;const R=qP(L.nativeEvent);if(s&&(R&&L.button===0||!R)){const z=b.getState();jx.onPointerDown(L.nativeEvent,{handleDomNode:L.currentTarget,autoPanOnConnect:z.autoPanOnConnect,connectionMode:z.connectionMode,connectionRadius:z.connectionRadius,domNode:z.domNode,nodeLookup:z.nodeLookup,lib:z.lib,isTarget:k,handleId:g,nodeId:y,flowId:z.rfId,panBy:z.panBy,cancelConnection:z.cancelConnection,onConnectStart:z.onConnectStart,onConnectEnd:(...E)=>{var Q,V;return(V=(Q=b.getState()).onConnectEnd)==null?void 0:V.call(Q,...E)},updateConnection:z.updateConnection,onConnect:F,isValidConnection:n||((...E)=>{var Q,V;return((V=(Q=b.getState()).isValidConnection)==null?void 0:V.call(Q,...E))??!0}),getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,autoPanSpeed:z.autoPanSpeed,dragThreshold:z.connectionDragThreshold})}R?d==null||d(L):p==null||p(L)},M=L=>{const{onClickConnectStart:R,onClickConnectEnd:z,connectionClickStartHandle:E,connectionMode:Q,isValidConnection:V,lib:$,rfId:ne,nodeLookup:ce,connection:X}=b.getState();if(!y||!E&&!s)return;if(!E){R==null||R(L.nativeEvent,{nodeId:y,handleId:g,handleType:e}),b.setState({connectionClickStartHandle:{nodeId:y,type:e,id:g}});return}const re=VP(L.target),Z=n||V,{connection:ie,isValid:te}=jx.isValid(L.nativeEvent,{handle:{nodeId:y,id:g,type:e},connectionMode:Q,fromNodeId:E.nodeId,fromHandleId:E.id||null,fromType:E.type,isValidConnection:Z,flowId:ne,doc:re,lib:$,nodeLookup:ce});te&&ie&&F(ie);const ue=structuredClone(X);delete ue.inProgress,ue.toPosition=ue.toHandle?ue.toHandle.position:null,z==null||z(L,ue),b.setState({connectionClickStartHandle:null})};return i.jsx("div",{"data-handleid":g,"data-nodeid":y,"data-handlepos":t,"data-id":`${C}-${y}-${g}-${e}`,className:Kn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",w,u,{source:!k,target:k,connectable:r,connectablestart:s,connectableend:o,clickconnecting:A,connectingfrom:N,connectingto:j,valid:W,connectionindicator:r&&(!D||I)&&(D||B?o:s)}]),onMouseDown:T,onTouchStart:T,onClick:v?M:void 0,ref:h,...f,children:c})}const Vn=m.memo(xI(ZH));function e5({data:e,isConnectable:t,sourcePosition:n=Ke.Bottom}){return i.jsxs(i.Fragment,{children:[e==null?void 0:e.label,i.jsx(Vn,{type:"source",position:n,isConnectable:t})]})}function t5({data:e,isConnectable:t,targetPosition:n=Ke.Top,sourcePosition:r=Ke.Bottom}){return i.jsxs(i.Fragment,{children:[i.jsx(Vn,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,i.jsx(Vn,{type:"source",position:r,isConnectable:t})]})}function n5(){return null}function r5({data:e,isConnectable:t,targetPosition:n=Ke.Top}){return i.jsxs(i.Fragment,{children:[i.jsx(Vn,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Hh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},jj={input:e5,default:t5,output:r5,group:n5};function s5(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 i5=e=>{const{width:t,height:n,x:r,y:s}=Zd(e.nodeLookup,{filter:o=>!!o.selected});return{width:qs(t)?t:null,height:qs(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 o5({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=wn(),{width:s,height:o,transformString:a,userSelectionActive:l}=Dt(i5,kn),c=vI(),u=m.useRef(null);m.useEffect(()=>{var h;n||(h=u.current)==null||h.focus({preventScroll:!0})},[n]);const d=!l&&s!==null&&o!==null;if(kI({nodeRef:u,disabled:!d}),!d)return null;const p=e?h=>{const g=r.getState().nodes.filter(k=>k.selected);e(h,g)}:void 0,f=h=>{Object.prototype.hasOwnProperty.call(Hh,h.key)&&(h.preventDefault(),c({direction:Hh[h.key],factor:h.shiftKey?4:1}))};return i.jsx("div",{className:Kn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:i.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:p,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:s,height:o}})})}const Cj=typeof window<"u"?window:void 0,a5=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function NI({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:p,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:k,zoomActivationKeyCode:b,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:w,panOnScroll:C,panOnScrollSpeed:N,panOnScrollMode:j,zoomOnDoubleClick:A,panOnDrag:I,defaultViewport:D,translateExtent:B,minZoom:W,maxZoom:F,preventScrolling:T,onSelectionContextMenu:M,noWheelClassName:q,noPanClassName:H,disableKeyboardA11y:L,onViewportChange:R,isControlledViewport:z}){const{nodesSelectionActive:E,userSelectionActive:Q}=Dt(a5,kn),V=Ad(u,{target:Cj}),$=Ad(k,{target:Cj}),ne=$||I,ce=$||C,X=d&&ne!==!0,re=V||Q||X;return BH({deleteKeyCode:c,multiSelectionKeyCode:g}),i.jsx(VH,{onPaneContextMenu:o,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:w,panOnScroll:ce,panOnScrollSpeed:N,panOnScrollMode:j,zoomOnDoubleClick:A,panOnDrag:!V&&ne,defaultViewport:D,translateExtent:B,minZoom:W,maxZoom:F,zoomActivationKeyCode:b,preventScrolling:T,noWheelClassName:q,noPanClassName:H,onViewportChange:R,isControlledViewport:z,paneClickDistance:l,selectionOnDrag:X,children:i.jsxs(YH,{onSelectionStart:f,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:a,panOnDrag:ne,isSelecting:!!re,selectionMode:p,selectionKeyPressed:V,paneClickDistance:l,selectionOnDrag:X,children:[e,E&&i.jsx(o5,{onSelectionContextMenu:M,noPanClassName:H,disableKeyboardA11y:L})]})})}NI.displayName="FlowRenderer";const l5=m.memo(NI),c5=e=>t=>e?mk(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 u5(e){return Dt(m.useCallback(c5(e),[e]),kn)}const d5=e=>e.updateNodeInternals;function f5(){const e=Dt(d5),[t]=m.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const o=s.target.getAttribute("data-id");r.set(o,{id:o,nodeElement:s.target,force:!0})}),e(r)}));return m.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function p5({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=wn(),o=m.useRef(null),a=m.useRef(null),l=m.useRef(e.sourcePosition),c=m.useRef(e.targetPosition),u=m.useRef(t),d=n&&!!e.internals.handleBounds;return m.useEffect(()=>{o.current&&!e.hidden&&(!d||a.current!==o.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(o.current),a.current=o.current)},[d,e.hidden]),m.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),m.useEffect(()=>{if(o.current){const p=u.current!==t,f=l.current!==e.sourcePosition,h=c.current!==e.targetPosition;(p||f||h)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:o.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),o}function h5({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:o,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:p,noDragClassName:f,noPanClassName:h,disableKeyboardA11y:g,rfId:k,nodeTypes:b,nodeClickDistance:y,onError:v}){const{node:w,internals:C,isParent:N}=Dt(Z=>{const ie=Z.nodeLookup.get(e),te=Z.parentLookup.has(e);return{node:ie,internals:ie.internals,isParent:te}},kn);let j=w.type||"default",A=(b==null?void 0:b[j])||jj[j];A===void 0&&(v==null||v("003",_i.error003(j)),j="default",A=(b==null?void 0:b.default)||jj.default);const I=!!(w.draggable||l&&typeof w.draggable>"u"),D=!!(w.selectable||c&&typeof w.selectable>"u"),B=!!(w.connectable||u&&typeof w.connectable>"u"),W=!!(w.focusable||d&&typeof w.focusable>"u"),F=wn(),T=HP(w),M=p5({node:w,nodeType:j,hasDimensions:T,resizeObserver:p}),q=kI({nodeRef:M,disabled:w.hidden||!I,noDragClassName:f,handleSelector:w.dragHandle,nodeId:e,isSelectable:D,nodeClickDistance:y}),H=vI();if(w.hidden)return null;const L=oo(w),R=s5(w),z=D||I||t||n||r||s,E=n?Z=>n(Z,{...C.userNode}):void 0,Q=r?Z=>r(Z,{...C.userNode}):void 0,V=s?Z=>s(Z,{...C.userNode}):void 0,$=o?Z=>o(Z,{...C.userNode}):void 0,ne=a?Z=>a(Z,{...C.userNode}):void 0,ce=Z=>{const{selectNodesOnDrag:ie,nodeDragThreshold:te}=F.getState();D&&(!ie||!I||te>0)&&_x({id:e,store:F,nodeRef:M}),t&&t(Z,{...C.userNode})},X=Z=>{if(!(KP(Z.nativeEvent)||g)){if(TP.includes(Z.key)&&D){const ie=Z.key==="Escape";_x({id:e,store:F,unselect:ie,nodeRef:M})}else if(I&&w.selected&&Object.prototype.hasOwnProperty.call(Hh,Z.key)){Z.preventDefault();const{ariaLabelConfig:ie}=F.getState();F.setState({ariaLiveMessage:ie["node.a11yDescription.ariaLiveMessage"]({direction:Z.key.replace("Arrow","").toLowerCase(),x:~~C.positionAbsolute.x,y:~~C.positionAbsolute.y})}),H({direction:Hh[Z.key],factor:Z.shiftKey?4:1})}}},re=()=>{var qe;if(g||!((qe=M.current)!=null&&qe.matches(":focus-visible")))return;const{transform:Z,width:ie,height:te,autoPanOnNodeFocus:ue,setCenter:fe}=F.getState();if(!ue)return;mk(new Map([[e,w]]),{x:0,y:0,width:ie,height:te},Z,!0).length>0||fe(w.position.x+L.width/2,w.position.y+L.height/2,{zoom:Z[2]})};return i.jsx("div",{className:Kn(["react-flow__node",`react-flow__node-${j}`,{[h]:I},w.className,{selected:w.selected,selectable:D,parent:N,draggable:I,dragging:q}]),ref:M,style:{zIndex:C.z,transform:`translate(${C.positionAbsolute.x}px,${C.positionAbsolute.y}px)`,pointerEvents:z?"all":"none",visibility:T?"visible":"hidden",...w.style,...R},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:E,onMouseMove:Q,onMouseLeave:V,onContextMenu:$,onClick:ce,onDoubleClick:ne,onKeyDown:W?X:void 0,tabIndex:W?0:void 0,onFocus:W?re:void 0,role:w.ariaRole??(W?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${mI}-${k}`,"aria-label":w.ariaLabel,...w.domAttributes,children:i.jsx(JH,{value:e,children:i.jsx(A,{id:e,data:w.data,type:j,positionAbsoluteX:C.positionAbsolute.x,positionAbsoluteY:C.positionAbsolute.y,selected:w.selected??!1,selectable:D,draggable:I,deletable:w.deletable??!0,isConnectable:B,sourcePosition:w.sourcePosition,targetPosition:w.targetPosition,dragging:q,dragHandle:w.dragHandle,zIndex:C.z,parentId:w.parentId,...L})})})}var m5=m.memo(h5);const g5=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function jI(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:o}=Dt(g5,kn),a=u5(e.onlyRenderVisibleElements),l=f5();return i.jsx("div",{className:"react-flow__nodes",style:Bm,children:a.map(c=>i.jsx(m5,{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:o},c))})}jI.displayName="NodeRenderer";const y5=m.memo(jI);function w5(e){return Dt(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 o=n.nodeLookup.get(s.source),a=n.nodeLookup.get(s.target);o&&a&&i4({sourceNode:o,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),kn)}const x5=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return i.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},b5=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return i.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},_j={[gi.Arrow]:x5,[gi.ArrowClosed]:b5};function k5(e){const t=wn();return m.useMemo(()=>{var s,o;return Object.prototype.hasOwnProperty.call(_j,e)?_j[e]:((o=(s=t.getState()).onError)==null||o.call(s,"009",_i.error009(e)),null)},[e])}const v5=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:o="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=k5(t);return c?i.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:l,refX:"0",refY:"0",children:i.jsx(c,{color:n,strokeWidth:a})}):null},CI=({defaultColor:e,rfId:t})=>{const n=Dt(o=>o.edges),r=Dt(o=>o.defaultEdgeOptions),s=m.useMemo(()=>f4(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?i.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:i.jsx("defs",{children:s.map(o=>i.jsx(v5,{id:o.id,type:o.type,color:o.color,width:o.width,height:o.height,markerUnits:o.markerUnits,strokeWidth:o.strokeWidth,orient:o.orient},o.id))})}):null};CI.displayName="MarkerDefinitions";var S5=m.memo(CI);function _I({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:o,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...d}){const[p,f]=m.useState({x:1,y:0,width:0,height:0}),h=Kn(["react-flow__edge-textwrapper",u]),g=m.useRef(null);return m.useEffect(()=>{if(g.current){const k=g.current.getBBox();f({x:k.x,y:k.y,width:k.width,height:k.height})}},[n]),n?i.jsxs("g",{transform:`translate(${e-p.width/2} ${t-p.height/2})`,className:h,visibility:p.width?"visible":"hidden",...d,children:[s&&i.jsx("rect",{width:p.width+2*a[0],x:-a[0],y:-a[1],height:p.height+2*a[1],className:"react-flow__edge-textbg",style:o,rx:l,ry:l}),i.jsx("text",{className:"react-flow__edge-text",y:p.height/2,dy:"0.3em",ref:g,style:r,children:n}),c]}):null}_I.displayName="EdgeText";const N5=m.memo(_I);function Hm({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:o,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return i.jsxs(i.Fragment,{children:[i.jsx("path",{...d,d:e,fill:"none",className:Kn(["react-flow__edge-path",d.className])}),u?i.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&qs(t)&&qs(n)?i.jsx(N5,{x:t,y:n,label:r,labelStyle:s,labelShowBg:o,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function Ej({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Ke.Left||e===Ke.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function EI({sourceX:e,sourceY:t,sourcePosition:n=Ke.Bottom,targetX:r,targetY:s,targetPosition:o=Ke.Top}){const[a,l]=Ej({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,u]=Ej({pos:o,x1:r,y1:s,x2:e,y2:t}),[d,p,f,h]=UP({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}`,d,p,f,h]}function AI(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:o,sourcePosition:a,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:k,markerStart:b,interactionWidth:y})=>{const[v,w,C]=EI({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:o,targetPosition:l}),N=e.isInternal?void 0:t;return i.jsx(Hm,{id:N,path:v,labelX:w,labelY:C,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:k,markerStart:b,interactionWidth:y})})}const j5=AI({isInternal:!1}),PI=AI({isInternal:!0});j5.displayName="SimpleBezierEdge";PI.displayName="SimpleBezierEdgeInternal";function II(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:o,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:p,style:f,sourcePosition:h=Ke.Bottom,targetPosition:g=Ke.Top,markerEnd:k,markerStart:b,pathOptions:y,interactionWidth:v})=>{const[w,C,N]=vx({sourceX:n,sourceY:r,sourcePosition:h,targetX:s,targetY:o,targetPosition:g,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),j=e.isInternal?void 0:t;return i.jsx(Hm,{id:j,path:w,labelX:C,labelY:N,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:p,style:f,markerEnd:k,markerStart:b,interactionWidth:v})})}const RI=II({isInternal:!1}),TI=II({isInternal:!0});RI.displayName="SmoothStepEdge";TI.displayName="SmoothStepEdgeInternal";function MI(e){return m.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return i.jsx(RI,{...n,id:r,pathOptions:m.useMemo(()=>{var o;return{borderRadius:0,offset:(o=n.pathOptions)==null?void 0:o.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const C5=MI({isInternal:!1}),$I=MI({isInternal:!0});C5.displayName="StepEdge";$I.displayName="StepEdgeInternal";function LI(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:o,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:p,style:f,markerEnd:h,markerStart:g,interactionWidth:k})=>{const[b,y,v]=JP({sourceX:n,sourceY:r,targetX:s,targetY:o}),w=e.isInternal?void 0:t;return i.jsx(Hm,{id:w,path:b,labelX:y,labelY:v,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:p,style:f,markerEnd:h,markerStart:g,interactionWidth:k})})}const _5=LI({isInternal:!1}),OI=LI({isInternal:!0});_5.displayName="StraightEdge";OI.displayName="StraightEdgeInternal";function DI(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:o,sourcePosition:a=Ke.Bottom,targetPosition:l=Ke.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:k,markerStart:b,pathOptions:y,interactionWidth:v})=>{const[w,C,N]=YP({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:o,targetPosition:l,curvature:y==null?void 0:y.curvature}),j=e.isInternal?void 0:t;return i.jsx(Hm,{id:j,path:w,labelX:C,labelY:N,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:k,markerStart:b,interactionWidth:v})})}const E5=DI({isInternal:!1}),FI=DI({isInternal:!0});E5.displayName="BezierEdge";FI.displayName="BezierEdgeInternal";const Aj={default:FI,straight:OI,step:$I,smoothstep:TI,simplebezier:PI},Pj={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},A5=(e,t,n)=>n===Ke.Left?e-t:n===Ke.Right?e+t:e,P5=(e,t,n)=>n===Ke.Top?e-t:n===Ke.Bottom?e+t:e,Ij="react-flow__edgeupdater";function Rj({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:o,onMouseOut:a,type:l}){return i.jsx("circle",{onMouseDown:s,onMouseEnter:o,onMouseOut:a,className:Kn([Ij,`${Ij}-${l}`]),cx:A5(t,r,e),cy:P5(n,r,e),r,stroke:"transparent",fill:"transparent"})}function I5({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:o,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:p,setReconnecting:f,setUpdateHover:h}){const g=wn(),k=(C,N)=>{if(C.button!==0)return;const{autoPanOnConnect:j,domNode:A,connectionMode:I,connectionRadius:D,lib:B,onConnectStart:W,cancelConnection:F,nodeLookup:T,rfId:M,panBy:q,updateConnection:H}=g.getState(),L=N.type==="target",R=(Q,V)=>{f(!1),p==null||p(Q,n,N.type,V)},z=Q=>u==null?void 0:u(n,Q),E=(Q,V)=>{f(!0),d==null||d(C,n,N.type),W==null||W(Q,V)};jx.onPointerDown(C.nativeEvent,{autoPanOnConnect:j,connectionMode:I,connectionRadius:D,domNode:A,handleId:N.id,nodeId:N.nodeId,nodeLookup:T,isTarget:L,edgeUpdaterType:N.type,lib:B,flowId:M,cancelConnection:F,panBy:q,isValidConnection:(...Q)=>{var V,$;return(($=(V=g.getState()).isValidConnection)==null?void 0:$.call(V,...Q))??!0},onConnect:z,onConnectStart:E,onConnectEnd:(...Q)=>{var V,$;return($=(V=g.getState()).onConnectEnd)==null?void 0:$.call(V,...Q)},onReconnectEnd:R,updateConnection:H,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:C.currentTarget})},b=C=>k(C,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=C=>k(C,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>h(!0),w=()=>h(!1);return i.jsxs(i.Fragment,{children:[(e===!0||e==="source")&&i.jsx(Rj,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:b,onMouseEnter:v,onMouseOut:w,type:"source"}),(e===!0||e==="target")&&i.jsx(Rj,{position:c,centerX:o,centerY:a,radius:t,onMouseDown:y,onMouseEnter:v,onMouseOut:w,type:"target"})]})}function R5({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:o,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:p,onReconnectStart:f,onReconnectEnd:h,rfId:g,edgeTypes:k,noPanClassName:b,onError:y,disableKeyboardA11y:v}){let w=Dt(fe=>fe.edgeLookup.get(e));const C=Dt(fe=>fe.defaultEdgeOptions);w=C?{...C,...w}:w;let N=w.type||"default",j=(k==null?void 0:k[N])||Aj[N];j===void 0&&(y==null||y("011",_i.error011(N)),N="default",j=(k==null?void 0:k.default)||Aj.default);const A=!!(w.focusable||t&&typeof w.focusable>"u"),I=typeof p<"u"&&(w.reconnectable||n&&typeof w.reconnectable>"u"),D=!!(w.selectable||r&&typeof w.selectable>"u"),B=m.useRef(null),[W,F]=m.useState(!1),[T,M]=m.useState(!1),q=wn(),{zIndex:H,sourceX:L,sourceY:R,targetX:z,targetY:E,sourcePosition:Q,targetPosition:V}=Dt(m.useCallback(fe=>{const be=fe.nodeLookup.get(w.source),qe=fe.nodeLookup.get(w.target);if(!be||!qe)return{zIndex:w.zIndex,...Pj};const Ue=d4({id:e,sourceNode:be,targetNode:qe,sourceHandle:w.sourceHandle||null,targetHandle:w.targetHandle||null,connectionMode:fe.connectionMode,onError:y});return{zIndex:s4({selected:w.selected,zIndex:w.zIndex,sourceNode:be,targetNode:qe,elevateOnSelect:fe.elevateEdgesOnSelect,zIndexMode:fe.zIndexMode}),...Ue||Pj}},[w.source,w.target,w.sourceHandle,w.targetHandle,w.selected,w.zIndex]),kn),$=m.useMemo(()=>w.markerStart?`url('#${Sx(w.markerStart,g)}')`:void 0,[w.markerStart,g]),ne=m.useMemo(()=>w.markerEnd?`url('#${Sx(w.markerEnd,g)}')`:void 0,[w.markerEnd,g]);if(w.hidden||L===null||R===null||z===null||E===null)return null;const ce=fe=>{var Me;const{addSelectedEdges:be,unselectNodesAndEdges:qe,multiSelectionActive:Ue}=q.getState();D&&(q.setState({nodesSelectionActive:!1}),w.selected&&Ue?(qe({nodes:[],edges:[w]}),(Me=B.current)==null||Me.blur()):be([e])),s&&s(fe,w)},X=o?fe=>{o(fe,{...w})}:void 0,re=a?fe=>{a(fe,{...w})}:void 0,Z=l?fe=>{l(fe,{...w})}:void 0,ie=c?fe=>{c(fe,{...w})}:void 0,te=u?fe=>{u(fe,{...w})}:void 0,ue=fe=>{var be;if(!v&&TP.includes(fe.key)&&D){const{unselectNodesAndEdges:qe,addSelectedEdges:Ue}=q.getState();fe.key==="Escape"?((be=B.current)==null||be.blur(),qe({edges:[w]})):Ue([e])}};return i.jsx("svg",{style:{zIndex:H},children:i.jsxs("g",{className:Kn(["react-flow__edge",`react-flow__edge-${N}`,w.className,b,{selected:w.selected,animated:w.animated,inactive:!D&&!s,updating:W,selectable:D}]),onClick:ce,onDoubleClick:X,onContextMenu:re,onMouseEnter:Z,onMouseMove:ie,onMouseLeave:te,onKeyDown:A?ue:void 0,tabIndex:A?0:void 0,role:w.ariaRole??(A?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":w.ariaLabel===null?void 0:w.ariaLabel||`Edge from ${w.source} to ${w.target}`,"aria-describedby":A?`${gI}-${g}`:void 0,ref:B,...w.domAttributes,children:[!T&&i.jsx(j,{id:e,source:w.source,target:w.target,type:w.type,selected:w.selected,animated:w.animated,selectable:D,deletable:w.deletable??!0,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,sourceX:L,sourceY:R,targetX:z,targetY:E,sourcePosition:Q,targetPosition:V,data:w.data,style:w.style,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerStart:$,markerEnd:ne,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth}),I&&i.jsx(I5,{edge:w,isReconnectable:I,reconnectRadius:d,onReconnect:p,onReconnectStart:f,onReconnectEnd:h,sourceX:L,sourceY:R,targetX:z,targetY:E,sourcePosition:Q,targetPosition:V,setUpdateHover:F,setReconnecting:M})]})})}var T5=m.memo(R5);const M5=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function zI({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:o,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:p,onEdgeDoubleClick:f,onReconnectStart:h,onReconnectEnd:g,disableKeyboardA11y:k}){const{edgesFocusable:b,edgesReconnectable:y,elementsSelectable:v,onError:w}=Dt(M5,kn),C=w5(t);return i.jsxs("div",{className:"react-flow__edges",children:[i.jsx(S5,{defaultColor:e,rfId:n}),C.map(N=>i.jsx(T5,{id:N,edgesFocusable:b,edgesReconnectable:y,elementsSelectable:v,noPanClassName:s,onReconnect:o,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:p,onDoubleClick:f,onReconnectStart:h,onReconnectEnd:g,rfId:n,onError:w,edgeTypes:r,disableKeyboardA11y:k},N))]})}zI.displayName="EdgeRenderer";const $5=m.memo(zI),L5=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function O5({children:e}){const t=Dt(L5);return i.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function D5(e){const t=Rc(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const F5=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function z5(e){const t=Dt(F5),n=wn();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function B5(e){return e.connection.inProgress?{...e.connection,to:tf(e.connection.to,e.transform)}:{...e.connection}}function H5(e){return B5}function W5(e){const t=H5();return Dt(t,kn)}const V5=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function K5({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:o,height:a,isValid:l,inProgress:c}=Dt(V5,kn);return!(o&&s&&c)?null:i.jsx("svg",{style:e,width:o,height:a,className:"react-flow__connectionline react-flow__container",children:i.jsx("g",{className:Kn(["react-flow__connection",LP(l)]),children:i.jsx(BI,{style:t,type:n,CustomComponent:r,isValid:l})})})}const BI=({style:e,type:t=Io.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:o,fromNode:a,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:p,toPosition:f,pointer:h}=W5();if(!s)return;if(n)return i.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:o.x,fromY:o.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:f,connectionStatus:LP(r),toNode:d,toHandle:p,pointer:h});let g="";const k={sourceX:o.x,sourceY:o.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:f};switch(t){case Io.Bezier:[g]=YP(k);break;case Io.SimpleBezier:[g]=EI(k);break;case Io.Step:[g]=vx({...k,borderRadius:0});break;case Io.SmoothStep:[g]=vx(k);break;default:[g]=JP(k)}return i.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};BI.displayName="ConnectionLine";const q5={};function Tj(e=q5){m.useRef(e),wn(),m.useEffect(()=>{},[e])}function U5(){wn(),m.useRef(!1),m.useEffect(()=>{},[])}function HI({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:o,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:p,onSelectionStart:f,onSelectionEnd:h,connectionLineType:g,connectionLineStyle:k,connectionLineComponent:b,connectionLineContainerStyle:y,selectionKeyCode:v,selectionOnDrag:w,selectionMode:C,multiSelectionKeyCode:N,panActivationKeyCode:j,zoomActivationKeyCode:A,deleteKeyCode:I,onlyRenderVisibleElements:D,elementsSelectable:B,defaultViewport:W,translateExtent:F,minZoom:T,maxZoom:M,preventScrolling:q,defaultMarkerColor:H,zoomOnScroll:L,zoomOnPinch:R,panOnScroll:z,panOnScrollSpeed:E,panOnScrollMode:Q,zoomOnDoubleClick:V,panOnDrag:$,onPaneClick:ne,onPaneMouseEnter:ce,onPaneMouseMove:X,onPaneMouseLeave:re,onPaneScroll:Z,onPaneContextMenu:ie,paneClickDistance:te,nodeClickDistance:ue,onEdgeContextMenu:fe,onEdgeMouseEnter:be,onEdgeMouseMove:qe,onEdgeMouseLeave:Ue,reconnectRadius:Me,onReconnect:rt,onReconnectStart:gt,onReconnectEnd:bt,noDragClassName:oe,noWheelClassName:je,noPanClassName:Ve,disableKeyboardA11y:tt,nodeExtent:Jt,rfId:st,viewport:de,onViewportChange:ve}){return Tj(e),Tj(t),U5(),D5(n),z5(de),i.jsx(l5,{onPaneClick:ne,onPaneMouseEnter:ce,onPaneMouseMove:X,onPaneMouseLeave:re,onPaneContextMenu:ie,onPaneScroll:Z,paneClickDistance:te,deleteKeyCode:I,selectionKeyCode:v,selectionOnDrag:w,selectionMode:C,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:N,panActivationKeyCode:j,zoomActivationKeyCode:A,elementsSelectable:B,zoomOnScroll:L,zoomOnPinch:R,zoomOnDoubleClick:V,panOnScroll:z,panOnScrollSpeed:E,panOnScrollMode:Q,panOnDrag:$,defaultViewport:W,translateExtent:F,minZoom:T,maxZoom:M,onSelectionContextMenu:p,preventScrolling:q,noDragClassName:oe,noWheelClassName:je,noPanClassName:Ve,disableKeyboardA11y:tt,onViewportChange:ve,isControlledViewport:!!de,children:i.jsxs(O5,{children:[i.jsx($5,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:rt,onReconnectStart:gt,onReconnectEnd:bt,onlyRenderVisibleElements:D,onEdgeContextMenu:fe,onEdgeMouseEnter:be,onEdgeMouseMove:qe,onEdgeMouseLeave:Ue,reconnectRadius:Me,defaultMarkerColor:H,noPanClassName:Ve,disableKeyboardA11y:tt,rfId:st}),i.jsx(K5,{style:k,type:g,component:b,containerStyle:y}),i.jsx("div",{className:"react-flow__edgelabel-renderer"}),i.jsx(y5,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:o,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:ue,onlyRenderVisibleElements:D,noPanClassName:Ve,noDragClassName:oe,disableKeyboardA11y:tt,nodeExtent:Jt,rfId:st}),i.jsx("div",{className:"react-flow__viewport-portal"})]})})}HI.displayName="GraphView";const Y5=m.memo(HI),Mj=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:o,fitView:a,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:d,nodeExtent:p,zIndexMode:f="basic"}={})=>{const h=new Map,g=new Map,k=new Map,b=new Map,y=r??t??[],v=n??e??[],w=d??[0,0],C=p??jd;ZP(k,b,y);const{nodesInitialized:N}=Nx(v,h,g,{nodeOrigin:w,nodeExtent:C,zIndexMode:f});let j=[0,0,1];if(a&&s&&o){const A=Zd(h,{filter:W=>!!((W.width||W.initialWidth)&&(W.height||W.initialHeight))}),{x:I,y:D,zoom:B}=gk(A,s,o,c,u,(l==null?void 0:l.padding)??.1);j=[I,D,B]}return{rfId:"1",width:s??0,height:o??0,transform:j,nodes:v,nodesInitialized:N,nodeLookup:h,parentLookup:g,edges:y,edgeLookup:b,connectionLookup:k,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:jd,nodeExtent:C,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:bc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:w,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:l,fitViewResolver:null,connection:{...$P},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:QB,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:MP,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},G5=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:o,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:p,zIndexMode:f})=>hH((h,g)=>{async function k(){const{nodeLookup:b,panZoom:y,fitViewOptions:v,fitViewResolver:w,width:C,height:N,minZoom:j,maxZoom:A}=g();y&&(await JB({nodes:b,width:C,height:N,panZoom:y,minZoom:j,maxZoom:A},v),w==null||w.resolve(!0),h({fitViewResolver:null}))}return{...Mj({nodes:e,edges:t,width:s,height:o,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:p,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:b=>{const{nodeLookup:y,parentLookup:v,nodeOrigin:w,elevateNodesOnSelect:C,fitViewQueued:N,zIndexMode:j,nodesSelectionActive:A}=g(),{nodesInitialized:I,hasSelectedNodes:D}=Nx(b,y,v,{nodeOrigin:w,nodeExtent:p,elevateNodesOnSelect:C,checkEquality:!0,zIndexMode:j}),B=A&&D;N&&I?(k(),h({nodes:b,nodesInitialized:I,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:B})):h({nodes:b,nodesInitialized:I,nodesSelectionActive:B})},setEdges:b=>{const{connectionLookup:y,edgeLookup:v}=g();ZP(y,v,b),h({edges:b})},setDefaultNodesAndEdges:(b,y)=>{if(b){const{setNodes:v}=g();v(b),h({hasDefaultNodes:!0})}if(y){const{setEdges:v}=g();v(y),h({hasDefaultEdges:!0})}},updateNodeInternals:b=>{const{triggerNodeChanges:y,nodeLookup:v,parentLookup:w,domNode:C,nodeOrigin:N,nodeExtent:j,debug:A,fitViewQueued:I,zIndexMode:D}=g(),{changes:B,updatedInternals:W}=x4(b,v,w,C,N,j,D);W&&(m4(v,w,{nodeOrigin:N,nodeExtent:j,zIndexMode:D}),I?(k(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(B==null?void 0:B.length)>0&&(A&&console.log("React Flow: trigger node changes",B),y==null||y(B)))},updateNodePositions:(b,y=!1)=>{const v=[];let w=[];const{nodeLookup:C,triggerNodeChanges:N,connection:j,updateConnection:A,onNodesChangeMiddlewareMap:I}=g();for(const[D,B]of b){const W=C.get(D),F=!!(W!=null&&W.expandParent&&(W!=null&&W.parentId)&&(B!=null&&B.position)),T={id:D,type:"position",position:F?{x:Math.max(0,B.position.x),y:Math.max(0,B.position.y)}:B.position,dragging:y};if(W&&j.inProgress&&j.fromNode.id===W.id){const M=Ka(W,j.fromHandle,Ke.Left,!0);A({...j,from:M})}F&&W.parentId&&v.push({id:D,parentId:W.parentId,rect:{...B.internals.positionAbsolute,width:B.measured.width??0,height:B.measured.height??0}}),w.push(T)}if(v.length>0){const{parentLookup:D,nodeOrigin:B}=g(),W=vk(v,C,D,B);w.push(...W)}for(const D of I.values())w=D(w);N(w)},triggerNodeChanges:b=>{const{onNodesChange:y,setNodes:v,nodes:w,hasDefaultNodes:C,debug:N}=g();if(b!=null&&b.length){if(C){const j=zh(b,w);v(j)}N&&console.log("React Flow: trigger node changes",b),y==null||y(b)}},triggerEdgeChanges:b=>{const{onEdgesChange:y,setEdges:v,edges:w,hasDefaultEdges:C,debug:N}=g();if(b!=null&&b.length){if(C){const j=Bh(b,w);v(j)}N&&console.log("React Flow: trigger edge changes",b),y==null||y(b)}},addSelectedNodes:b=>{const{multiSelectionActive:y,edgeLookup:v,nodeLookup:w,triggerNodeChanges:C,triggerEdgeChanges:N}=g();if(y){const j=b.map(A=>xa(A,!0));C(j);return}C(Gl(w,new Set([...b]),!0)),N(Gl(v))},addSelectedEdges:b=>{const{multiSelectionActive:y,edgeLookup:v,nodeLookup:w,triggerNodeChanges:C,triggerEdgeChanges:N}=g();if(y){const j=b.map(A=>xa(A,!0));N(j);return}N(Gl(v,new Set([...b]))),C(Gl(w,new Set,!0))},unselectNodesAndEdges:({nodes:b,edges:y}={})=>{const{edges:v,nodes:w,nodeLookup:C,triggerNodeChanges:N,triggerEdgeChanges:j}=g(),A=b||w,I=y||v,D=[];for(const W of A){if(!W.selected)continue;const F=C.get(W.id);F&&(F.selected=!1),D.push(xa(W.id,!1))}const B=[];for(const W of I)W.selected&&B.push(xa(W.id,!1));N(D),j(B)},setMinZoom:b=>{const{panZoom:y,maxZoom:v}=g();y==null||y.setScaleExtent([b,v]),h({minZoom:b})},setMaxZoom:b=>{const{panZoom:y,minZoom:v}=g();y==null||y.setScaleExtent([v,b]),h({maxZoom:b})},setTranslateExtent:b=>{var y;(y=g().panZoom)==null||y.setTranslateExtent(b),h({translateExtent:b})},resetSelectedElements:()=>{const{edges:b,nodes:y,triggerNodeChanges:v,triggerEdgeChanges:w,elementsSelectable:C}=g();if(!C)return;const N=y.reduce((A,I)=>I.selected?[...A,xa(I.id,!1)]:A,[]),j=b.reduce((A,I)=>I.selected?[...A,xa(I.id,!1)]:A,[]);v(N),w(j)},setNodeExtent:b=>{const{nodes:y,nodeLookup:v,parentLookup:w,nodeOrigin:C,elevateNodesOnSelect:N,nodeExtent:j,zIndexMode:A}=g();b[0][0]===j[0][0]&&b[0][1]===j[0][1]&&b[1][0]===j[1][0]&&b[1][1]===j[1][1]||(Nx(y,v,w,{nodeOrigin:C,nodeExtent:b,elevateNodesOnSelect:N,checkEquality:!1,zIndexMode:A}),h({nodeExtent:b}))},panBy:b=>{const{transform:y,width:v,height:w,panZoom:C,translateExtent:N}=g();return b4({delta:b,panZoom:C,transform:y,translateExtent:N,width:v,height:w})},setCenter:async(b,y,v)=>{const{width:w,height:C,maxZoom:N,panZoom:j}=g();if(!j)return Promise.resolve(!1);const A=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:N;return await j.setViewport({x:w/2-b*A,y:C/2-y*A,zoom:A},{duration:v==null?void 0:v.duration,ease:v==null?void 0:v.ease,interpolate:v==null?void 0:v.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...$P}})},updateConnection:b=>{h({connection:b})},reset:()=>h({...Mj()})}},Object.is);function Nk({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:o,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:p,zIndexMode:f,children:h}){const[g]=m.useState(()=>G5({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:o,fitView:u,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:d,nodeExtent:p,zIndexMode:f}));return i.jsx(mH,{value:g,children:i.jsx(OH,{children:h})})}function J5({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:o,height:a,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:p,nodeExtent:f,zIndexMode:h}){return m.useContext(Fm)?i.jsx(i.Fragment,{children:e}):i.jsx(Nk,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:o,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:p,nodeExtent:f,zIndexMode:h,children:e})}const X5={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Q5({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:o,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:p,onMoveEnd:f,onConnect:h,onConnectStart:g,onConnectEnd:k,onClickConnectStart:b,onClickConnectEnd:y,onNodeMouseEnter:v,onNodeMouseMove:w,onNodeMouseLeave:C,onNodeContextMenu:N,onNodeDoubleClick:j,onNodeDragStart:A,onNodeDrag:I,onNodeDragStop:D,onNodesDelete:B,onEdgesDelete:W,onDelete:F,onSelectionChange:T,onSelectionDragStart:M,onSelectionDrag:q,onSelectionDragStop:H,onSelectionContextMenu:L,onSelectionStart:R,onSelectionEnd:z,onBeforeDelete:E,connectionMode:Q,connectionLineType:V=Io.Bezier,connectionLineStyle:$,connectionLineComponent:ne,connectionLineContainerStyle:ce,deleteKeyCode:X="Backspace",selectionKeyCode:re="Shift",selectionOnDrag:Z=!1,selectionMode:ie=Cd.Full,panActivationKeyCode:te="Space",multiSelectionKeyCode:ue=Ed()?"Meta":"Control",zoomActivationKeyCode:fe=Ed()?"Meta":"Control",snapToGrid:be,snapGrid:qe,onlyRenderVisibleElements:Ue=!1,selectNodesOnDrag:Me,nodesDraggable:rt,autoPanOnNodeFocus:gt,nodesConnectable:bt,nodesFocusable:oe,nodeOrigin:je=yI,edgesFocusable:Ve,edgesReconnectable:tt,elementsSelectable:Jt=!0,defaultViewport:st=EH,minZoom:de=.5,maxZoom:ve=2,translateExtent:ze=jd,preventScrolling:Ze=!0,nodeExtent:Se,defaultMarkerColor:Tt="#b1b1b7",zoomOnScroll:vn=!0,zoomOnPinch:dn=!0,panOnScroll:nn=!1,panOnScrollSpeed:Sn=.5,panOnScrollMode:ee=Ta.Free,zoomOnDoubleClick:Ie=!0,panOnDrag:Fe=!0,onPaneClick:Je,onPaneMouseEnter:Pt,onPaneMouseMove:jt,onPaneMouseLeave:lr,onPaneScroll:rn,onPaneContextMenu:gr,paneClickDistance:qn=1,nodeClickDistance:Mn=0,children:Un,onReconnect:Yn,onReconnectStart:cr,onReconnectEnd:yr,onEdgeContextMenu:Xr,onEdgeDoubleClick:Gn,onEdgeMouseEnter:mt,onEdgeMouseMove:Fn,onEdgeMouseLeave:Ft,reconnectRadius:fn=10,onNodesChange:zn,onEdgesChange:ps,noDragClassName:ri="nodrag",noWheelClassName:ur="nowheel",noPanClassName:Wt="nopan",fitView:ae,fitViewOptions:ke,connectOnClick:ot,attributionPosition:xt,proOptions:xn,defaultEdgeOptions:on,elevateNodesOnSelect:Jn=!0,elevateEdgesOnSelect:Qr=!1,disableKeyboardA11y:ct=!1,autoPanOnConnect:qt,autoPanOnNodeDrag:Vt,autoPanSpeed:wr,connectionRadius:et,isValidConnection:_r,onError:Or,style:si,id:co,nodeDragThreshold:As,connectionDragThreshold:se,viewport:Ne,onViewportChange:Pe,width:lt,height:zt,colorMode:Mt="light",debug:Xn,onScroll:pn,ariaLabelConfig:Er,zIndexMode:K="basic",...he},$e){const pe=co||"1",Be=RH(Mt),In=m.useCallback(Et=>{Et.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),pn==null||pn(Et)},[pn]);return i.jsx("div",{"data-testid":"rf__wrapper",...he,onScroll:In,style:{...si,...X5},ref:$e,className:Kn(["react-flow",s,Be]),id:co,role:"application",children:i.jsxs(J5,{nodes:e,edges:t,width:lt,height:zt,fitView:ae,fitViewOptions:ke,minZoom:de,maxZoom:ve,nodeOrigin:je,nodeExtent:Se,zIndexMode:K,children:[i.jsx(IH,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:g,onConnectEnd:k,onClickConnectStart:b,onClickConnectEnd:y,nodesDraggable:rt,autoPanOnNodeFocus:gt,nodesConnectable:bt,nodesFocusable:oe,edgesFocusable:Ve,edgesReconnectable:tt,elementsSelectable:Jt,elevateNodesOnSelect:Jn,elevateEdgesOnSelect:Qr,minZoom:de,maxZoom:ve,nodeExtent:Se,onNodesChange:zn,onEdgesChange:ps,snapToGrid:be,snapGrid:qe,connectionMode:Q,translateExtent:ze,connectOnClick:ot,defaultEdgeOptions:on,fitView:ae,fitViewOptions:ke,onNodesDelete:B,onEdgesDelete:W,onDelete:F,onNodeDragStart:A,onNodeDrag:I,onNodeDragStop:D,onSelectionDrag:q,onSelectionDragStart:M,onSelectionDragStop:H,onMove:d,onMoveStart:p,onMoveEnd:f,noPanClassName:Wt,nodeOrigin:je,rfId:pe,autoPanOnConnect:qt,autoPanOnNodeDrag:Vt,autoPanSpeed:wr,onError:Or,connectionRadius:et,isValidConnection:_r,selectNodesOnDrag:Me,nodeDragThreshold:As,connectionDragThreshold:se,onBeforeDelete:E,debug:Xn,ariaLabelConfig:Er,zIndexMode:K}),i.jsx(Y5,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:w,onNodeMouseLeave:C,onNodeContextMenu:N,onNodeDoubleClick:j,nodeTypes:o,edgeTypes:a,connectionLineType:V,connectionLineStyle:$,connectionLineComponent:ne,connectionLineContainerStyle:ce,selectionKeyCode:re,selectionOnDrag:Z,selectionMode:ie,deleteKeyCode:X,multiSelectionKeyCode:ue,panActivationKeyCode:te,zoomActivationKeyCode:fe,onlyRenderVisibleElements:Ue,defaultViewport:st,translateExtent:ze,minZoom:de,maxZoom:ve,preventScrolling:Ze,zoomOnScroll:vn,zoomOnPinch:dn,zoomOnDoubleClick:Ie,panOnScroll:nn,panOnScrollSpeed:Sn,panOnScrollMode:ee,panOnDrag:Fe,onPaneClick:Je,onPaneMouseEnter:Pt,onPaneMouseMove:jt,onPaneMouseLeave:lr,onPaneScroll:rn,onPaneContextMenu:gr,paneClickDistance:qn,nodeClickDistance:Mn,onSelectionContextMenu:L,onSelectionStart:R,onSelectionEnd:z,onReconnect:Yn,onReconnectStart:cr,onReconnectEnd:yr,onEdgeContextMenu:Xr,onEdgeDoubleClick:Gn,onEdgeMouseEnter:mt,onEdgeMouseMove:Fn,onEdgeMouseLeave:Ft,reconnectRadius:fn,defaultMarkerColor:Tt,noDragClassName:ri,noWheelClassName:ur,noPanClassName:Wt,rfId:pe,disableKeyboardA11y:ct,nodeExtent:Se,viewport:Ne,onViewportChange:Pe}),i.jsx(_H,{onSelectionChange:T}),Un,i.jsx(vH,{proOptions:xn,position:xt}),i.jsx(kH,{rfId:pe,disableKeyboardA11y:ct})]})})}var WI=xI(Q5);function Z5(){const e=wn();return m.useCallback(t=>{const{domNode:n,updateNodeInternals:r}=e.getState(),s=Array.isArray(t)?t:[t],o=new Map;s.forEach(a=>{const l=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${a}"]`);l&&o.set(a,{id:a,nodeElement:l,force:!0})}),requestAnimationFrame(()=>r(o,{triggerFitView:!1}))},[])}function eW(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(o=>zh(s,o)),[]);return[t,n,r]}function tW(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(o=>Bh(s,o)),[]);return[t,n,r]}function nW({dimensions:e,lineWidth:t,variant:n,className:r}){return i.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Kn(["react-flow__background-pattern",n,r])})}function rW({radius:e,className:t}){return i.jsx("circle",{cx:e,cy:e,r:e,className:Kn(["react-flow__background-pattern","dots",t])})}var Vo;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Vo||(Vo={}));const sW={[Vo.Dots]:1,[Vo.Lines]:1,[Vo.Cross]:6},iW=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function VI({id:e,variant:t=Vo.Dots,gap:n=20,size:r,lineWidth:s=1,offset:o=0,color:a,bgColor:l,style:c,className:u,patternClassName:d}){const p=m.useRef(null),{transform:f,patternId:h}=Dt(iW,kn),g=r||sW[t],k=t===Vo.Dots,b=t===Vo.Cross,y=Array.isArray(n)?n:[n,n],v=[y[0]*f[2]||1,y[1]*f[2]||1],w=g*f[2],C=Array.isArray(o)?o:[o,o],N=b?[w,w]:v,j=[C[0]*f[2]||1+N[0]/2,C[1]*f[2]||1+N[1]/2],A=`${h}${e||""}`;return i.jsxs("svg",{className:Kn(["react-flow__background",u]),style:{...c,...Bm,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:p,"data-testid":"rf__background",children:[i.jsx("pattern",{id:A,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${j[0]},-${j[1]})`,children:k?i.jsx(rW,{radius:w/2,className:d}):i.jsx(nW,{dimensions:N,lineWidth:s,variant:t,className:d})}),i.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${A})`})]})}VI.displayName="Background";const KI=m.memo(VI);function oW(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:i.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function aW(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:i.jsx("path",{d:"M0 0h32v4.2H0z"})})}function lW(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:i.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 cW(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:i.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 uW(){return i.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:i.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 pp({children:e,className:t,...n}){return i.jsx("button",{type:"button",className:Kn(["react-flow__controls-button",t]),...n,children:e})}const dW=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function qI({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:o,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:u,children:d,position:p="bottom-left",orientation:f="vertical","aria-label":h}){const g=wn(),{isInteractive:k,minZoomReached:b,maxZoomReached:y,ariaLabelConfig:v}=Dt(dW,kn),{zoomIn:w,zoomOut:C,fitView:N}=Rc(),j=()=>{w(),o==null||o()},A=()=>{C(),a==null||a()},I=()=>{N(s),l==null||l()},D=()=>{g.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),c==null||c(!k)},B=f==="horizontal"?"horizontal":"vertical";return i.jsxs(zm,{className:Kn(["react-flow__controls",B,u]),position:p,style:e,"data-testid":"rf__controls","aria-label":h??v["controls.ariaLabel"],children:[t&&i.jsxs(i.Fragment,{children:[i.jsx(pp,{onClick:j,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:y,children:i.jsx(oW,{})}),i.jsx(pp,{onClick:A,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:b,children:i.jsx(aW,{})})]}),n&&i.jsx(pp,{className:"react-flow__controls-fitview",onClick:I,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:i.jsx(lW,{})}),r&&i.jsx(pp,{className:"react-flow__controls-interactive",onClick:D,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:k?i.jsx(uW,{}):i.jsx(cW,{})}),d]})}qI.displayName="Controls";m.memo(qI);function fW({id:e,x:t,y:n,width:r,height:s,style:o,color:a,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:p,selected:f,onClick:h}){const{background:g,backgroundColor:k}=o||{},b=a||g||k;return i.jsx("rect",{className:Kn(["react-flow__minimap-node",{selected:f},u]),x:t,y:n,rx:d,ry:d,width:r,height:s,style:{fill:b,stroke:l,strokeWidth:c},shapeRendering:p,onClick:h?y=>h(y,e):void 0})}const pW=m.memo(fW),hW=e=>e.nodes.map(t=>t.id),Ay=e=>e instanceof Function?e:()=>e;function mW({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:o=pW,onClick:a}){const l=Dt(hW,kn),c=Ay(t),u=Ay(e),d=Ay(n),p=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return i.jsx(i.Fragment,{children:l.map(f=>i.jsx(yW,{id:f,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:o,onClick:a,shapeRendering:p},f))})}function gW({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:o,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:u,x:d,y:p,width:f,height:h}=Dt(g=>{const k=g.nodeLookup.get(e);if(!k)return{node:void 0,x:0,y:0,width:0,height:0};const b=k.internals.userNode,{x:y,y:v}=k.internals.positionAbsolute,{width:w,height:C}=oo(b);return{node:b,x:y,y:v,width:w,height:C}},kn);return!u||u.hidden||!HP(u)?null:i.jsx(l,{x:d,y:p,width:f,height:h,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:o,shapeRendering:a,onClick:c,id:u.id})}const yW=m.memo(gW);var wW=m.memo(mW);const xW=200,bW=150,kW=e=>!e.hidden,vW=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?BP(Zd(e.nodeLookup,{filter:kW}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},SW="react-flow__minimap-desc";function UI({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:o=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:p,position:f="bottom-right",onClick:h,onNodeClick:g,pannable:k=!1,zoomable:b=!1,ariaLabel:y,inversePan:v,zoomStep:w=1,offsetScale:C=5}){const N=wn(),j=m.useRef(null),{boundingRect:A,viewBB:I,rfId:D,panZoom:B,translateExtent:W,flowWidth:F,flowHeight:T,ariaLabelConfig:M}=Dt(vW,kn),q=(e==null?void 0:e.width)??xW,H=(e==null?void 0:e.height)??bW,L=A.width/q,R=A.height/H,z=Math.max(L,R),E=z*q,Q=z*H,V=C*z,$=A.x-(E-A.width)/2-V,ne=A.y-(Q-A.height)/2-V,ce=E+V*2,X=Q+V*2,re=`${SW}-${D}`,Z=m.useRef(0),ie=m.useRef();Z.current=z,m.useEffect(()=>{if(j.current&&B)return ie.current=A4({domNode:j.current,panZoom:B,getTransform:()=>N.getState().transform,getViewScale:()=>Z.current}),()=>{var be;(be=ie.current)==null||be.destroy()}},[B]),m.useEffect(()=>{var be;(be=ie.current)==null||be.update({translateExtent:W,width:F,height:T,inversePan:v,pannable:k,zoomStep:w,zoomable:b})},[k,b,v,w,W,F,T]);const te=h?be=>{var Me;const[qe,Ue]=((Me=ie.current)==null?void 0:Me.pointer(be))||[0,0];h(be,{x:qe,y:Ue})}:void 0,ue=g?m.useCallback((be,qe)=>{const Ue=N.getState().nodeLookup.get(qe).internals.userNode;g(be,Ue)},[]):void 0,fe=y??M["minimap.ariaLabel"];return i.jsx(zm,{position:f,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 d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof p=="number"?p*z: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:Kn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:i.jsxs("svg",{width:q,height:H,viewBox:`${$} ${ne} ${ce} ${X}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":re,ref:j,onClick:te,children:[fe&&i.jsx("title",{id:re,children:fe}),i.jsx(wW,{onClick:ue,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:o,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:l}),i.jsx("path",{className:"react-flow__minimap-mask",d:`M${$-V},${ne-V}h${ce+V*2}v${X+V*2}h${-ce-V*2}z
|
|
66
|
-
M${I.x},${I.y}h${I.width}v${I.height}h${-I.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}UI.displayName="MiniMap";m.memo(UI);const NW=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,jW={[Nc.Line]:"right",[Nc.Handle]:"bottom-right"};function CW({nodeId:e,position:t,variant:n=Nc.Handle,className:r,style:s=void 0,children:o,color:a,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:p=!1,resizeDirection:f,autoScale:h=!0,shouldResize:g,onResizeStart:k,onResize:b,onResizeEnd:y}){const v=SI(),w=typeof e=="string"?e:v,C=wn(),N=m.useRef(null),j=n===Nc.Handle,A=Dt(m.useCallback(NW(j&&h),[j,h]),kn),I=m.useRef(null),D=t??jW[n];m.useEffect(()=>{if(!(!N.current||!w))return I.current||(I.current=W4({domNode:N.current,nodeId:w,getStoreItems:()=>{const{nodeLookup:W,transform:F,snapGrid:T,snapToGrid:M,nodeOrigin:q,domNode:H}=C.getState();return{nodeLookup:W,transform:F,snapGrid:T,snapToGrid:M,nodeOrigin:q,paneDomNode:H}},onChange:(W,F)=>{const{triggerNodeChanges:T,nodeLookup:M,parentLookup:q,nodeOrigin:H}=C.getState(),L=[],R={x:W.x,y:W.y},z=M.get(w);if(z&&z.expandParent&&z.parentId){const E=z.origin??H,Q=W.width??z.measured.width??0,V=W.height??z.measured.height??0,$={id:z.id,parentId:z.parentId,rect:{width:Q,height:V,...WP({x:W.x??z.position.x,y:W.y??z.position.y},{width:Q,height:V},z.parentId,M,E)}},ne=vk([$],M,q,H);L.push(...ne),R.x=W.x?Math.max(E[0]*Q,W.x):void 0,R.y=W.y?Math.max(E[1]*V,W.y):void 0}if(R.x!==void 0&&R.y!==void 0){const E={id:w,type:"position",position:{...R}};L.push(E)}if(W.width!==void 0&&W.height!==void 0){const Q={id:w,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:W.width,height:W.height}};L.push(Q)}for(const E of F){const Q={...E,type:"position"};L.push(Q)}T(L)},onEnd:({width:W,height:F})=>{const T={id:w,type:"dimensions",resizing:!1,dimensions:{width:W,height:F}};C.getState().triggerNodeChanges([T])}})),I.current.update({controlPosition:D,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:p,resizeDirection:f,onResizeStart:k,onResize:b,onResizeEnd:y,shouldResize:g}),()=>{var W;(W=I.current)==null||W.destroy()}},[D,l,c,u,d,p,k,b,y,g]);const B=D.split("-");return i.jsx("div",{className:Kn(["react-flow__resize-control","nodrag",...B,n,r]),ref:N,style:{...s,scale:A,...a&&{[j?"backgroundColor":"borderColor"]:a}},children:o})}const jk=m.memo(CW),_W="modulepreload",EW=function(e){return"/"+e},$j={},AW=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=EW(c),c in $j)return;$j[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const p=document.createElement("link");if(p.rel=u?"stylesheet":_W,u||(p.as="script"),p.crossOrigin="",p.href=c,l&&p.setAttribute("nonce",l),document.head.appendChild(p),u)return new Promise((f,h)=>{p.addEventListener("load",f),p.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${c}`)))})}))}function o(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"&&o(l.reason);return t().catch(o)})};function PW(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const IW=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,RW=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,TW={};function Lj(e,t){return(TW.jsx?RW:IW).test(e)}const MW=/[ \t\n\f\r]/g;function $W(e){return typeof e=="object"?e.type==="text"?Oj(e.value):!1:Oj(e)}function Oj(e){return e.replace(MW,"")===""}class nf{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}nf.prototype.normal={};nf.prototype.property={};nf.prototype.space=void 0;function YI(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new nf(n,r,t)}function Ex(e){return e.toLowerCase()}class Jr{constructor(t,n){this.attribute=n,this.property=t}}Jr.prototype.attribute="";Jr.prototype.booleanish=!1;Jr.prototype.boolean=!1;Jr.prototype.commaOrSpaceSeparated=!1;Jr.prototype.commaSeparated=!1;Jr.prototype.defined=!1;Jr.prototype.mustUseProperty=!1;Jr.prototype.number=!1;Jr.prototype.overloadedBoolean=!1;Jr.prototype.property="";Jr.prototype.spaceSeparated=!1;Jr.prototype.space=void 0;let LW=0;const vt=rl(),Hn=rl(),Ax=rl(),Ae=rl(),ln=rl(),oc=rl(),ts=rl();function rl(){return 2**++LW}const Px=Object.freeze(Object.defineProperty({__proto__:null,boolean:vt,booleanish:Hn,commaOrSpaceSeparated:ts,commaSeparated:oc,number:Ae,overloadedBoolean:Ax,spaceSeparated:ln},Symbol.toStringTag,{value:"Module"})),Py=Object.keys(Px);class Ck extends Jr{constructor(t,n,r,s){let o=-1;if(super(t,n),Dj(this,"space",s),typeof r=="number")for(;++o<Py.length;){const a=Py[o];Dj(this,Py[o],(r&Px[a])===Px[a])}}}Ck.prototype.defined=!0;function Dj(e,t,n){n&&(e[t]=n)}function Tc(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const o=new Ck(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[Ex(r)]=r,n[Ex(o.attribute)]=r}return new nf(t,n,e.space)}const GI=Tc({properties:{ariaActiveDescendant:null,ariaAtomic:Hn,ariaAutoComplete:null,ariaBusy:Hn,ariaChecked:Hn,ariaColCount:Ae,ariaColIndex:Ae,ariaColSpan:Ae,ariaControls:ln,ariaCurrent:null,ariaDescribedBy:ln,ariaDetails:null,ariaDisabled:Hn,ariaDropEffect:ln,ariaErrorMessage:null,ariaExpanded:Hn,ariaFlowTo:ln,ariaGrabbed:Hn,ariaHasPopup:null,ariaHidden:Hn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ln,ariaLevel:Ae,ariaLive:null,ariaModal:Hn,ariaMultiLine:Hn,ariaMultiSelectable:Hn,ariaOrientation:null,ariaOwns:ln,ariaPlaceholder:null,ariaPosInSet:Ae,ariaPressed:Hn,ariaReadOnly:Hn,ariaRelevant:null,ariaRequired:Hn,ariaRoleDescription:ln,ariaRowCount:Ae,ariaRowIndex:Ae,ariaRowSpan:Ae,ariaSelected:Hn,ariaSetSize:Ae,ariaSort:null,ariaValueMax:Ae,ariaValueMin:Ae,ariaValueNow:Ae,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function JI(e,t){return t in e?e[t]:t}function XI(e,t){return JI(e,t.toLowerCase())}const OW=Tc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:oc,acceptCharset:ln,accessKey:ln,action:null,allow:null,allowFullScreen:vt,allowPaymentRequest:vt,allowUserMedia:vt,alt:null,as:null,async:vt,autoCapitalize:null,autoComplete:ln,autoFocus:vt,autoPlay:vt,blocking:ln,capture:null,charSet:null,checked:vt,cite:null,className:ln,cols:Ae,colSpan:null,content:null,contentEditable:Hn,controls:vt,controlsList:ln,coords:Ae|oc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:vt,defer:vt,dir:null,dirName:null,disabled:vt,download:Ax,draggable:Hn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:vt,formTarget:null,headers:ln,height:Ae,hidden:Ax,high:Ae,href:null,hrefLang:null,htmlFor:ln,httpEquiv:ln,id:null,imageSizes:null,imageSrcSet:null,inert:vt,inputMode:null,integrity:null,is:null,isMap:vt,itemId:null,itemProp:ln,itemRef:ln,itemScope:vt,itemType:ln,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:vt,low:Ae,manifest:null,max:null,maxLength:Ae,media:null,method:null,min:null,minLength:Ae,multiple:vt,muted:vt,name:null,nonce:null,noModule:vt,noValidate:vt,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:vt,optimum:Ae,pattern:null,ping:ln,placeholder:null,playsInline:vt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:vt,referrerPolicy:null,rel:ln,required:vt,reversed:vt,rows:Ae,rowSpan:Ae,sandbox:ln,scope:null,scoped:vt,seamless:vt,selected:vt,shadowRootClonable:vt,shadowRootDelegatesFocus:vt,shadowRootMode:null,shape:null,size:Ae,sizes:null,slot:null,span:Ae,spellCheck:Hn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Ae,step:null,style:null,tabIndex:Ae,target:null,title:null,translate:null,type:null,typeMustMatch:vt,useMap:null,value:Hn,width:Ae,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ln,axis:null,background:null,bgColor:null,border:Ae,borderColor:null,bottomMargin:Ae,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:vt,declare:vt,event:null,face:null,frame:null,frameBorder:null,hSpace:Ae,leftMargin:Ae,link:null,longDesc:null,lowSrc:null,marginHeight:Ae,marginWidth:Ae,noResize:vt,noHref:vt,noShade:vt,noWrap:vt,object:null,profile:null,prompt:null,rev:null,rightMargin:Ae,rules:null,scheme:null,scrolling:Hn,standby:null,summary:null,text:null,topMargin:Ae,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Ae,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:vt,disableRemotePlayback:vt,prefix:null,property:null,results:Ae,security:null,unselectable:null},space:"html",transform:XI}),DW=Tc({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:ts,accentHeight:Ae,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Ae,amplitude:Ae,arabicForm:null,ascent:Ae,attributeName:null,attributeType:null,azimuth:Ae,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Ae,by:null,calcMode:null,capHeight:Ae,className:ln,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Ae,diffuseConstant:Ae,direction:null,display:null,dur:null,divisor:Ae,dominantBaseline:null,download:vt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Ae,enableBackground:null,end:null,event:null,exponent:Ae,externalResourcesRequired:null,fill:null,fillOpacity:Ae,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:oc,g2:oc,glyphName:oc,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Ae,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Ae,horizOriginX:Ae,horizOriginY:Ae,id:null,ideographic:Ae,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Ae,k:Ae,k1:Ae,k2:Ae,k3:Ae,k4:Ae,kernelMatrix:ts,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Ae,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Ae,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Ae,overlineThickness:Ae,paintOrder:null,panose1:null,path:null,pathLength:Ae,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ln,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Ae,pointsAtY:Ae,pointsAtZ:Ae,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ts,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ts,rev:ts,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ts,requiredFeatures:ts,requiredFonts:ts,requiredFormats:ts,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Ae,specularExponent:Ae,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Ae,strikethroughThickness:Ae,string:null,stroke:null,strokeDashArray:ts,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Ae,strokeOpacity:Ae,strokeWidth:null,style:null,surfaceScale:Ae,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ts,tabIndex:Ae,tableValues:null,target:null,targetX:Ae,targetY:Ae,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ts,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Ae,underlineThickness:Ae,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Ae,values:null,vAlphabetic:Ae,vMathematical:Ae,vectorEffect:null,vHanging:Ae,vIdeographic:Ae,version:null,vertAdvY:Ae,vertOriginX:Ae,vertOriginY:Ae,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Ae,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:JI}),QI=Tc({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()}}),ZI=Tc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:XI}),eR=Tc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),FW={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"},zW=/[A-Z]/g,Fj=/-[a-z]/g,BW=/^data[-\w.:]+$/i;function HW(e,t){const n=Ex(t);let r=t,s=Jr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&BW.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Fj,VW);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Fj.test(o)){let a=o.replace(zW,WW);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=Ck}return new s(r,t)}function WW(e){return"-"+e.toLowerCase()}function VW(e){return e.charAt(1).toUpperCase()}const KW=YI([GI,OW,QI,ZI,eR],"html"),_k=YI([GI,DW,QI,ZI,eR],"svg");function qW(e){return e.join(" ").trim()}var Ek={},zj=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,UW=/\n/g,YW=/^\s*/,GW=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,JW=/^:\s*/,XW=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,QW=/^[;\s]*/,ZW=/^\s+|\s+$/g,e6=`
|
|
67
|
-
`,Bj="/",Hj="*",ka="",t6="comment",n6="declaration";function r6(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(g){var k=g.match(UW);k&&(n+=k.length);var b=g.lastIndexOf(e6);r=~b?g.length-b:r+g.length}function o(){var g={line:n,column:r};return function(k){return k.position=new a(g),u(),k}}function a(g){this.start=g,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function l(g){var k=new Error(t.source+":"+n+":"+r+": "+g);if(k.reason=g,k.filename=t.source,k.line=n,k.column=r,k.source=e,!t.silent)throw k}function c(g){var k=g.exec(e);if(k){var b=k[0];return s(b),e=e.slice(b.length),k}}function u(){c(YW)}function d(g){var k;for(g=g||[];k=p();)k!==!1&&g.push(k);return g}function p(){var g=o();if(!(Bj!=e.charAt(0)||Hj!=e.charAt(1))){for(var k=2;ka!=e.charAt(k)&&(Hj!=e.charAt(k)||Bj!=e.charAt(k+1));)++k;if(k+=2,ka===e.charAt(k-1))return l("End of comment missing");var b=e.slice(2,k-2);return r+=2,s(b),e=e.slice(k),r+=2,g({type:t6,comment:b})}}function f(){var g=o(),k=c(GW);if(k){if(p(),!c(JW))return l("property missing ':'");var b=c(XW),y=g({type:n6,property:Wj(k[0].replace(zj,ka)),value:b?Wj(b[0].replace(zj,ka)):ka});return c(QW),y}}function h(){var g=[];d(g);for(var k;k=f();)k!==!1&&(g.push(k),d(g));return g}return u(),h()}function Wj(e){return e?e.replace(ZW,ka):ka}var s6=r6,i6=rd&&rd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ek,"__esModule",{value:!0});Ek.default=a6;const o6=i6(s6);function a6(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,o6.default)(e),s=typeof t=="function";return r.forEach(o=>{if(o.type!=="declaration")return;const{property:a,value:l}=o;s?t(a,l,o):l&&(n=n||{},n[a]=l)}),n}var Wm={};Object.defineProperty(Wm,"__esModule",{value:!0});Wm.camelCase=void 0;var l6=/^--[a-zA-Z0-9_-]+$/,c6=/-([a-z])/g,u6=/^[^-]+$/,d6=/^-(webkit|moz|ms|o|khtml)-/,f6=/^-(ms)-/,p6=function(e){return!e||u6.test(e)||l6.test(e)},h6=function(e,t){return t.toUpperCase()},Vj=function(e,t){return"".concat(t,"-")},m6=function(e,t){return t===void 0&&(t={}),p6(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(f6,Vj):e=e.replace(d6,Vj),e.replace(c6,h6))};Wm.camelCase=m6;var g6=rd&&rd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},y6=g6(Ek),w6=Wm;function Ix(e,t){var n={};return!e||typeof e!="string"||(0,y6.default)(e,function(r,s){r&&s&&(n[(0,w6.camelCase)(r,t)]=s)}),n}Ix.default=Ix;var x6=Ix;const b6=Zo(x6),tR=nR("end"),Ak=nR("start");function nR(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 k6(e){const t=Ak(e),n=tR(e);if(t&&n)return{start:t,end:n}}function Ju(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Kj(e.position):"start"in e||"end"in e?Kj(e):"line"in e||"column"in e?Rx(e):""}function Rx(e){return qj(e&&e.line)+":"+qj(e&&e.column)}function Kj(e){return Rx(e&&e.start)+"-"+Rx(e&&e.end)}function qj(e){return e&&typeof e=="number"?e:1}class Cr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",o={},a=!1;if(n&&("line"in n&&"column"in n?o={place:n}:"start"in n&&"end"in n?o={place:n}:"type"in n?o={ancestors:[n],place:n.position}:o={...n}),typeof t=="string"?s=t:!o.cause&&t&&(a=!0,s=t.message,o.cause=t),!o.ruleId&&!o.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?o.ruleId=r:(o.source=r.slice(0,c),o.ruleId=r.slice(c+1))}if(!o.place&&o.ancestors&&o.ancestors){const c=o.ancestors[o.ancestors.length-1];c&&(o.place=c.position)}const l=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.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=Ju(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Cr.prototype.file="";Cr.prototype.name="";Cr.prototype.reason="";Cr.prototype.message="";Cr.prototype.stack="";Cr.prototype.column=void 0;Cr.prototype.line=void 0;Cr.prototype.ancestors=void 0;Cr.prototype.cause=void 0;Cr.prototype.fatal=void 0;Cr.prototype.place=void 0;Cr.prototype.ruleId=void 0;Cr.prototype.source=void 0;const Pk={}.hasOwnProperty,v6=new Map,S6=/[A-Z]/g,N6=new Set(["table","tbody","thead","tfoot","tr"]),j6=new Set(["td","th"]),rR="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function C6(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=M6(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=T6(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"?_k:KW,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=sR(s,e,void 0);return o&&typeof o!="string"?o:s.create(e,s.Fragment,{children:o||void 0},void 0)}function sR(e,t,n){if(t.type==="element")return _6(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return E6(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return P6(e,t,n);if(t.type==="mdxjsEsm")return A6(e,t);if(t.type==="root")return I6(e,t,n);if(t.type==="text")return R6(e,t)}function _6(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=_k,e.schema=s),e.ancestors.push(t);const o=oR(e,t.tagName,!1),a=$6(e,t);let l=Rk(e,t);return N6.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!$W(c):!0})),iR(e,a,o,t),Ik(a,l),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function E6(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)}Pd(e,t.position)}function A6(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Pd(e,t.position)}function P6(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=_k,e.schema=s),e.ancestors.push(t);const o=t.name===null?e.Fragment:oR(e,t.name,!0),a=L6(e,t),l=Rk(e,t);return iR(e,a,o,t),Ik(a,l),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function I6(e,t,n){const r={};return Ik(r,Rk(e,t)),e.create(t,e.Fragment,r,n)}function R6(e,t){return t.value}function iR(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Ik(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function T6(e,t,n){return r;function r(s,o,a,l){const u=Array.isArray(a.children)?n:t;return l?u(o,a,l):u(o,a)}}function M6(e,t){return n;function n(r,s,o,a){const l=Array.isArray(o.children),c=Ak(r);return t(s,o,a,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function $6(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&Pk.call(t.properties,s)){const o=O6(e,s,t.properties[s]);if(o){const[a,l]=o;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&j6.has(t.tagName)?r=l:n[a]=l}}if(r){const o=n.style||(n.style={});o[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function L6(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const o=r.data.estree.body[0];o.type;const a=o.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else Pd(e,t.position);else{const s=r.name;let o;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,o=e.evaluater.evaluateExpression(l.expression)}else Pd(e,t.position);else o=r.value===null?!0:r.value;n[s]=o}return n}function Rk(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:v6;for(;++r<t.children.length;){const o=t.children[r];let a;if(e.passKeys){const c=o.type==="element"?o.tagName:o.type==="mdxJsxFlowElement"||o.type==="mdxJsxTextElement"?o.name:void 0;if(c){const u=s.get(c)||0;a=c+"-"+u,s.set(c,u+1)}}const l=sR(e,o,a);l!==void 0&&n.push(l)}return n}function O6(e,t,n){const r=HW(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?PW(n):qW(n)),r.property==="style"){let s=typeof n=="object"?n:D6(e,String(n));return e.stylePropertyNameCase==="css"&&(s=F6(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?FW[r.property]||r.property:r.attribute,n]}}function D6(e,t){try{return b6(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Cr("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=rR+"#cannot-parse-style-attribute",s}}function oR(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let o=-1,a;for(;++o<s.length;){const l=Lj(s[o])?{type:"Identifier",name:s[o]}:{type:"Literal",value:s[o]};a=a?{type:"MemberExpression",object:a,property:l,computed:!!(o&&l.type==="Literal"),optional:!1}:l}r=a}else r=Lj(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return Pk.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Pd(e)}function Pd(e,t){const n=new Cr("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=rR+"#cannot-handle-mdx-estrees-without-createevaluater",n}function F6(e){const t={};let n;for(n in e)Pk.call(e,n)&&(t[z6(n)]=e[n]);return t}function z6(e){let t=e.replace(S6,B6);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function B6(e){return"-"+e.toLowerCase()}const Iy={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"]},H6={};function W6(e,t){const n=H6,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return aR(e,r,s)}function aR(e,t,n){if(V6(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 Uj(e.children,t,n)}return Array.isArray(e)?Uj(e,t,n):""}function Uj(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=aR(e[s],t,n);return r.join("")}function V6(e){return!!(e&&typeof e=="object")}const Yj=document.createElement("i");function Tk(e){const t="&"+e+";";Yj.innerHTML=t;const n=Yj.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ei(e,t,n,r){const s=e.length;let o=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);o<r.length;)a=r.slice(o,o+1e4),a.unshift(t,0),e.splice(...a),o+=1e4,t+=1e4}function Ss(e,t){return e.length>0?(Ei(e,e.length,0,t),e):t}const Gj={}.hasOwnProperty;function K6(e){const t={};let n=-1;for(;++n<e.length;)q6(t,e[n]);return t}function q6(e,t){let n;for(n in t){const s=(Gj.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let a;if(o)for(a in o){Gj.call(s,a)||(s[a]=[]);const l=o[a];U6(s[a],Array.isArray(l)?l:l?[l]:[])}}}function U6(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ei(e,0,0,r)}function lR(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 ac(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const yi=ra(/[A-Za-z]/),os=ra(/[\dA-Za-z]/),Y6=ra(/[#-'*+\--9=?A-Z^-~]/);function Tx(e){return e!==null&&(e<32||e===127)}const Mx=ra(/\d/),G6=ra(/[\dA-Fa-f]/),J6=ra(/[!-/:-@[-`{-~]/);function yt(e){return e!==null&&e<-2}function Gr(e){return e!==null&&(e<0||e===32)}function Kt(e){return e===-2||e===-1||e===32}const X6=ra(new RegExp("\\p{P}|\\p{S}","u")),Q6=ra(/\s/);function ra(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Mc(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const o=e.charCodeAt(n);let a="";if(o===37&&os(e.charCodeAt(n+1))&&os(e.charCodeAt(n+2)))s=2;else if(o<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(o))||(a=String.fromCharCode(o));else if(o>55295&&o<57344){const l=e.charCodeAt(n+1);o<56320&&l>56319&&l<57344?(a=String.fromCharCode(o,l),s=1):a="�"}else a=String.fromCharCode(o);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 un(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(c){return Kt(c)?(e.enter(n),l(c)):t(c)}function l(c){return Kt(c)&&o++<s?(e.consume(c),l):(e.exit(n),t(c))}}const Z6={tokenize:e8};function e8(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"),un(e,t,"linePrefix")}function s(l){return e.enter("paragraph"),o(l)}function o(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,a(l)}function a(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return yt(l)?(e.consume(l),e.exit("chunkText"),o):(e.consume(l),a)}}const t8={tokenize:n8},Jj={tokenize:r8};function n8(e){const t=this,n=[];let r=0,s,o,a;return l;function l(w){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,c,u)(w)}return u(w)}function c(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&v();const C=t.events.length;let N=C,j;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){j=t.events[N][1].end;break}y(r);let A=C;for(;A<t.events.length;)t.events[A][1].end={...j},A++;return Ei(t.events,N+1,0,t.events.slice(C)),t.events.length=A,u(w)}return l(w)}function u(w){if(r===n.length){if(!s)return f(w);if(s.currentConstruct&&s.currentConstruct.concrete)return g(w);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Jj,d,p)(w)}function d(w){return s&&v(),y(r),f(w)}function p(w){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,g(w)}function f(w){return t.containerState={},e.attempt(Jj,h,g)(w)}function h(w){return r++,n.push([t.currentConstruct,t.containerState]),f(w)}function g(w){if(w===null){s&&v(),y(0),e.consume(w);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:o}),k(w)}function k(w){if(w===null){b(e.exit("chunkFlow"),!0),y(0),e.consume(w);return}return yt(w)?(e.consume(w),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(w),k)}function b(w,C){const N=t.sliceStream(w);if(C&&N.push(null),w.previous=o,o&&(o.next=w),o=w,s.defineSkip(w.start),s.write(N),t.parser.lazy[w.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 A=t.events.length;let I=A,D,B;for(;I--;)if(t.events[I][0]==="exit"&&t.events[I][1].type==="chunkFlow"){if(D){B=t.events[I][1].end;break}D=!0}for(y(r),j=A;j<t.events.length;)t.events[j][1].end={...B},j++;Ei(t.events,I+1,0,t.events.slice(A)),t.events.length=j}}function y(w){let C=n.length;for(;C-- >w;){const N=n[C];t.containerState=N[1],N[0].exit.call(t,e)}n.length=w}function v(){s.write([null]),o=void 0,s=void 0,t.containerState._closeFlow=void 0}}function r8(e,t,n){return un(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Xj(e){if(e===null||Gr(e)||Q6(e))return 1;if(X6(e))return 2}function Mk(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const o=e[s].resolveAll;o&&!r.includes(o)&&(t=o(t,n),r.push(o))}return t}const $x={name:"attention",resolveAll:s8,tokenize:i8};function s8(e,t){let n=-1,r,s,o,a,l,c,u,d;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 p={...e[r][1].end},f={...e[n][1].start};Qj(p,-c),Qj(f,c),a={type:c>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},o={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=Ss(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Ss(u,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",o,t]]),u=Ss(u,Mk(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Ss(u,[["exit",o,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(d=2,u=Ss(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Ei(e,r-1,n-r+3,u),n=r+u.length-d-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function i8(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=Xj(r);let o;return a;function a(c){return o=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===o)return e.consume(c),l;const u=e.exit("attentionSequence"),d=Xj(c),p=!d||d===2&&s||n.includes(c),f=!s||s===2&&d||n.includes(r);return u._open=!!(o===42?p:p&&(s||!f)),u._close=!!(o===42?f:f&&(d||!p)),t(c)}}function Qj(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const o8={name:"autolink",tokenize:a8};function a8(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"),o}function o(h){return yi(h)?(e.consume(h),a):h===64?n(h):u(h)}function a(h){return h===43||h===45||h===46||os(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||os(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||Tx(h)?n(h):(e.consume(h),c)}function u(h){return h===64?(e.consume(h),d):Y6(h)?(e.consume(h),u):n(h)}function d(h){return os(h)?p(h):n(h)}function p(h){return h===46?(e.consume(h),r=0,d):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):f(h)}function f(h){if((h===45||os(h))&&r++<63){const g=h===45?f:p;return e.consume(h),g}return n(h)}}const Vm={partial:!0,tokenize:l8};function l8(e,t,n){return r;function r(o){return Kt(o)?un(e,s,"linePrefix")(o):s(o)}function s(o){return o===null||yt(o)?t(o):n(o)}}const cR={continuation:{tokenize:u8},exit:d8,name:"blockQuote",tokenize:c8};function c8(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"),o}return n(a)}function o(a){return Kt(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function u8(e,t,n){const r=this;return s;function s(a){return Kt(a)?un(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):o(a)}function o(a){return e.attempt(cR,t,n)(a)}}function d8(e){e.exit("blockQuote")}const uR={name:"characterEscape",tokenize:f8};function f8(e,t,n){return r;function r(o){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(o),e.exit("escapeMarker"),s}function s(o){return J6(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const dR={name:"characterReference",tokenize:p8};function p8(e,t,n){const r=this;let s=0,o,a;return l;function l(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),c}function c(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),o=31,a=os,d(p))}function u(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,a=G6,d):(e.enter("characterReferenceValue"),o=7,a=Mx,d(p))}function d(p){if(p===59&&s){const f=e.exit("characterReferenceValue");return a===os&&!Tk(r.sliceSerialize(f))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(p)&&s++<o?(e.consume(p),d):n(p)}}const Zj={partial:!0,tokenize:m8},e1={concrete:!0,name:"codeFenced",tokenize:h8};function h8(e,t,n){const r=this,s={partial:!0,tokenize:N};let o=0,a=0,l;return c;function c(j){return u(j)}function u(j){const A=r.events[r.events.length-1];return o=A&&A[1].type==="linePrefix"?A[2].sliceSerialize(A[1],!0).length:0,l=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(j)}function d(j){return j===l?(a++,e.consume(j),d):a<3?n(j):(e.exit("codeFencedFenceSequence"),Kt(j)?un(e,p,"whitespace")(j):p(j))}function p(j){return j===null||yt(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(Zj,k,C)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(j))}function f(j){return j===null||yt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(j)):Kt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),un(e,h,"whitespace")(j)):j===96&&j===l?n(j):(e.consume(j),f)}function h(j){return j===null||yt(j)?p(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(j))}function g(j){return j===null||yt(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(j)):j===96&&j===l?n(j):(e.consume(j),g)}function k(j){return e.attempt(s,C,b)(j)}function b(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),y}function y(j){return o>0&&Kt(j)?un(e,v,"linePrefix",o+1)(j):v(j)}function v(j){return j===null||yt(j)?e.check(Zj,k,C)(j):(e.enter("codeFlowValue"),w(j))}function w(j){return j===null||yt(j)?(e.exit("codeFlowValue"),v(j)):(e.consume(j),w)}function C(j){return e.exit("codeFenced"),t(j)}function N(j,A,I){let D=0;return B;function B(q){return j.enter("lineEnding"),j.consume(q),j.exit("lineEnding"),W}function W(q){return j.enter("codeFencedFence"),Kt(q)?un(j,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):F(q)}function F(q){return q===l?(j.enter("codeFencedFenceSequence"),T(q)):I(q)}function T(q){return q===l?(D++,j.consume(q),T):D>=a?(j.exit("codeFencedFenceSequence"),Kt(q)?un(j,M,"whitespace")(q):M(q)):I(q)}function M(q){return q===null||yt(q)?(j.exit("codeFencedFence"),A(q)):I(q)}}}function m8(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"),o)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const Ry={name:"codeIndented",tokenize:y8},g8={partial:!0,tokenize:w8};function y8(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),un(e,o,"linePrefix",5)(u)}function o(u){const d=r.events[r.events.length-1];return d&&d[1].type==="linePrefix"&&d[2].sliceSerialize(d[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?c(u):yt(u)?e.attempt(g8,a,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||yt(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function w8(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):yt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):un(e,o,"linePrefix",5)(a)}function o(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):yt(a)?s(a):n(a)}}const x8={name:"codeText",previous:k8,resolve:b8,tokenize:v8};function b8(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 k8(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function v8(e,t,n){let r=0,s,o;return a;function a(p){return e.enter("codeText"),e.enter("codeTextSequence"),l(p)}function l(p){return p===96?(e.consume(p),r++,l):(e.exit("codeTextSequence"),c(p))}function c(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),c):p===96?(o=e.enter("codeTextSequence"),s=0,d(p)):yt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(p))}function u(p){return p===null||p===32||p===96||yt(p)?(e.exit("codeTextData"),c(p)):(e.consume(p),u)}function d(p){return p===96?(e.consume(p),s++,d):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(o.type="codeTextData",u(p))}}class S8{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 o=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&xu(this.left,r),o.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),xu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),xu(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);xu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);xu(this.left,n.reverse())}}}function xu(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 fR(e){const t={};let n=-1,r,s,o,a,l,c,u;const d=new S8(e);for(;++n<d.length;){for(;n in t;)n=t[n];if(r=d.get(n),n&&r[1].type==="chunkFlow"&&d.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,o=0,o<c.length&&c[o][1].type==="lineEndingBlank"&&(o+=2),o<c.length&&c[o][1].type==="content"))for(;++o<c.length&&c[o][1].type!=="content";)c[o][1].type==="chunkText"&&(c[o][1]._isInFirstContentOfListItem=!0,o++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,N8(d,n)),n=t[n],u=!0);else if(r[1]._container){for(o=n,s=void 0;o--;)if(a=d.get(o),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(d.get(s)[1].type="lineEndingBlank"),a[1].type="lineEnding",s=o);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;s&&(r[1].end={...d.get(s)[1].start},l=d.slice(s,n),l.unshift(r),d.splice(s,n-s+1,l))}}return Ei(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function N8(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const o=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const l=a.events,c=[],u={};let d,p,f=-1,h=n,g=0,k=0;const b=[k];for(;h;){for(;e.get(++s)[1]!==h;);o.push(s),h._tokenizer||(d=r.sliceStream(h),h.next||d.push(null),p&&a.defineSkip(h.start),h._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(d),h._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),p=h,h=h.next}for(h=n;++f<l.length;)l[f][0]==="exit"&&l[f-1][0]==="enter"&&l[f][1].type===l[f-1][1].type&&l[f][1].start.line!==l[f][1].end.line&&(k=f+1,b.push(k),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(a.events=[],h?(h._tokenizer=void 0,h.previous=void 0):b.pop(),f=b.length;f--;){const y=l.slice(b[f],b[f+1]),v=o.pop();c.push([v,v+y.length-1]),e.splice(v,2,y)}for(c.reverse(),f=-1;++f<c.length;)u[g+c[f][0]]=g+c[f][1],g+=c[f][1]-c[f][0]-1;return u}const j8={resolve:_8,tokenize:E8},C8={partial:!0,tokenize:A8};function _8(e){return fR(e),e}function E8(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?o(l):yt(l)?e.check(C8,a,o)(l):(e.consume(l),s)}function o(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 A8(e,t,n){const r=this;return s;function s(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),un(e,o,"linePrefix")}function o(a){if(a===null||yt(a))return n(a);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function pR(e,t,n,r,s,o,a,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return p;function p(y){return y===60?(e.enter(r),e.enter(s),e.enter(o),e.consume(y),e.exit(o),f):y===null||y===32||y===41||Tx(y)?n(y):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),k(y))}function f(y){return y===62?(e.enter(o),e.consume(y),e.exit(o),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===62?(e.exit("chunkString"),e.exit(l),f(y)):y===null||y===60||yt(y)?n(y):(e.consume(y),y===92?g:h)}function g(y){return y===60||y===62||y===92?(e.consume(y),h):h(y)}function k(y){return!d&&(y===null||y===41||Gr(y))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(y)):d<u&&y===40?(e.consume(y),d++,k):y===41?(e.consume(y),d--,k):y===null||y===32||y===40||Tx(y)?n(y):(e.consume(y),y===92?b:k)}function b(y){return y===40||y===41||y===92?(e.consume(y),k):k(y)}}function hR(e,t,n,r,s,o){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(o),d}function d(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(o),e.enter(s),e.consume(h),e.exit(s),e.exit(r),t):yt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),p(h))}function p(h){return h===null||h===91||h===93||yt(h)||l++>999?(e.exit("chunkString"),d(h)):(e.consume(h),c||(c=!Kt(h)),h===92?f:p)}function f(h){return h===91||h===92||h===93?(e.consume(h),l++,p):p(h)}}function mR(e,t,n,r,s,o){let a;return l;function l(f){return f===34||f===39||f===40?(e.enter(r),e.enter(s),e.consume(f),e.exit(s),a=f===40?41:f,c):n(f)}function c(f){return f===a?(e.enter(s),e.consume(f),e.exit(s),e.exit(r),t):(e.enter(o),u(f))}function u(f){return f===a?(e.exit(o),c(a)):f===null?n(f):yt(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),un(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===a||f===null||yt(f)?(e.exit("chunkString"),u(f)):(e.consume(f),f===92?p:d)}function p(f){return f===a||f===92?(e.consume(f),d):d(f)}}function Xu(e,t){let n;return r;function r(s){return yt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Kt(s)?un(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const P8={name:"definition",tokenize:R8},I8={partial:!0,tokenize:T8};function R8(e,t,n){const r=this;let s;return o;function o(h){return e.enter("definition"),a(h)}function a(h){return hR.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function l(h){return s=ac(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 Gr(h)?Xu(e,u)(h):u(h)}function u(h){return pR(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function d(h){return e.attempt(I8,p,p)(h)}function p(h){return Kt(h)?un(e,f,"whitespace")(h):f(h)}function f(h){return h===null||yt(h)?(e.exit("definition"),r.parser.defined.push(s),t(h)):n(h)}}function T8(e,t,n){return r;function r(l){return Gr(l)?Xu(e,s)(l):n(l)}function s(l){return mR(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function o(l){return Kt(l)?un(e,a,"whitespace")(l):a(l)}function a(l){return l===null||yt(l)?t(l):n(l)}}const M8={name:"hardBreakEscape",tokenize:$8};function $8(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),s}function s(o){return yt(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const L8={name:"headingAtx",resolve:O8,tokenize:D8};function O8(e,t){let n=e.length-2,r=3,s,o;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},o={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ei(e,r,n-r+1,[["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t]])),e}function D8(e,t,n){let r=0;return s;function s(d){return e.enter("atxHeading"),o(d)}function o(d){return e.enter("atxHeadingSequence"),a(d)}function a(d){return d===35&&r++<6?(e.consume(d),a):d===null||Gr(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||yt(d)?(e.exit("atxHeading"),t(d)):Kt(d)?un(e,l,"whitespace")(d):(e.enter("atxHeadingText"),u(d))}function c(d){return d===35?(e.consume(d),c):(e.exit("atxHeadingSequence"),l(d))}function u(d){return d===null||d===35||Gr(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const F8=["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"],t1=["pre","script","style","textarea"],z8={concrete:!0,name:"htmlFlow",resolveTo:W8,tokenize:V8},B8={partial:!0,tokenize:q8},H8={partial:!0,tokenize:K8};function W8(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 V8(e,t,n){const r=this;let s,o,a,l,c;return u;function u($){return d($)}function d($){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume($),p}function p($){return $===33?(e.consume($),f):$===47?(e.consume($),o=!0,k):$===63?(e.consume($),s=3,r.interrupt?t:E):yi($)?(e.consume($),a=String.fromCharCode($),b):n($)}function f($){return $===45?(e.consume($),s=2,h):$===91?(e.consume($),s=5,l=0,g):yi($)?(e.consume($),s=4,r.interrupt?t:E):n($)}function h($){return $===45?(e.consume($),r.interrupt?t:E):n($)}function g($){const ne="CDATA[";return $===ne.charCodeAt(l++)?(e.consume($),l===ne.length?r.interrupt?t:F:g):n($)}function k($){return yi($)?(e.consume($),a=String.fromCharCode($),b):n($)}function b($){if($===null||$===47||$===62||Gr($)){const ne=$===47,ce=a.toLowerCase();return!ne&&!o&&t1.includes(ce)?(s=1,r.interrupt?t($):F($)):F8.includes(a.toLowerCase())?(s=6,ne?(e.consume($),y):r.interrupt?t($):F($)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n($):o?v($):w($))}return $===45||os($)?(e.consume($),a+=String.fromCharCode($),b):n($)}function y($){return $===62?(e.consume($),r.interrupt?t:F):n($)}function v($){return Kt($)?(e.consume($),v):B($)}function w($){return $===47?(e.consume($),B):$===58||$===95||yi($)?(e.consume($),C):Kt($)?(e.consume($),w):B($)}function C($){return $===45||$===46||$===58||$===95||os($)?(e.consume($),C):N($)}function N($){return $===61?(e.consume($),j):Kt($)?(e.consume($),N):w($)}function j($){return $===null||$===60||$===61||$===62||$===96?n($):$===34||$===39?(e.consume($),c=$,A):Kt($)?(e.consume($),j):I($)}function A($){return $===c?(e.consume($),c=null,D):$===null||yt($)?n($):(e.consume($),A)}function I($){return $===null||$===34||$===39||$===47||$===60||$===61||$===62||$===96||Gr($)?N($):(e.consume($),I)}function D($){return $===47||$===62||Kt($)?w($):n($)}function B($){return $===62?(e.consume($),W):n($)}function W($){return $===null||yt($)?F($):Kt($)?(e.consume($),W):n($)}function F($){return $===45&&s===2?(e.consume($),H):$===60&&s===1?(e.consume($),L):$===62&&s===4?(e.consume($),Q):$===63&&s===3?(e.consume($),E):$===93&&s===5?(e.consume($),z):yt($)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(B8,V,T)($)):$===null||yt($)?(e.exit("htmlFlowData"),T($)):(e.consume($),F)}function T($){return e.check(H8,M,V)($)}function M($){return e.enter("lineEnding"),e.consume($),e.exit("lineEnding"),q}function q($){return $===null||yt($)?T($):(e.enter("htmlFlowData"),F($))}function H($){return $===45?(e.consume($),E):F($)}function L($){return $===47?(e.consume($),a="",R):F($)}function R($){if($===62){const ne=a.toLowerCase();return t1.includes(ne)?(e.consume($),Q):F($)}return yi($)&&a.length<8?(e.consume($),a+=String.fromCharCode($),R):F($)}function z($){return $===93?(e.consume($),E):F($)}function E($){return $===62?(e.consume($),Q):$===45&&s===2?(e.consume($),E):F($)}function Q($){return $===null||yt($)?(e.exit("htmlFlowData"),V($)):(e.consume($),Q)}function V($){return e.exit("htmlFlow"),t($)}}function K8(e,t,n){const r=this;return s;function s(a){return yt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),o):n(a)}function o(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function q8(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(Vm,t,n)}}const U8={name:"htmlText",tokenize:Y8};function Y8(e,t,n){const r=this;let s,o,a;return l;function l(E){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(E),c}function c(E){return E===33?(e.consume(E),u):E===47?(e.consume(E),N):E===63?(e.consume(E),w):yi(E)?(e.consume(E),I):n(E)}function u(E){return E===45?(e.consume(E),d):E===91?(e.consume(E),o=0,g):yi(E)?(e.consume(E),v):n(E)}function d(E){return E===45?(e.consume(E),h):n(E)}function p(E){return E===null?n(E):E===45?(e.consume(E),f):yt(E)?(a=p,L(E)):(e.consume(E),p)}function f(E){return E===45?(e.consume(E),h):p(E)}function h(E){return E===62?H(E):E===45?f(E):p(E)}function g(E){const Q="CDATA[";return E===Q.charCodeAt(o++)?(e.consume(E),o===Q.length?k:g):n(E)}function k(E){return E===null?n(E):E===93?(e.consume(E),b):yt(E)?(a=k,L(E)):(e.consume(E),k)}function b(E){return E===93?(e.consume(E),y):k(E)}function y(E){return E===62?H(E):E===93?(e.consume(E),y):k(E)}function v(E){return E===null||E===62?H(E):yt(E)?(a=v,L(E)):(e.consume(E),v)}function w(E){return E===null?n(E):E===63?(e.consume(E),C):yt(E)?(a=w,L(E)):(e.consume(E),w)}function C(E){return E===62?H(E):w(E)}function N(E){return yi(E)?(e.consume(E),j):n(E)}function j(E){return E===45||os(E)?(e.consume(E),j):A(E)}function A(E){return yt(E)?(a=A,L(E)):Kt(E)?(e.consume(E),A):H(E)}function I(E){return E===45||os(E)?(e.consume(E),I):E===47||E===62||Gr(E)?D(E):n(E)}function D(E){return E===47?(e.consume(E),H):E===58||E===95||yi(E)?(e.consume(E),B):yt(E)?(a=D,L(E)):Kt(E)?(e.consume(E),D):H(E)}function B(E){return E===45||E===46||E===58||E===95||os(E)?(e.consume(E),B):W(E)}function W(E){return E===61?(e.consume(E),F):yt(E)?(a=W,L(E)):Kt(E)?(e.consume(E),W):D(E)}function F(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),s=E,T):yt(E)?(a=F,L(E)):Kt(E)?(e.consume(E),F):(e.consume(E),M)}function T(E){return E===s?(e.consume(E),s=void 0,q):E===null?n(E):yt(E)?(a=T,L(E)):(e.consume(E),T)}function M(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||Gr(E)?D(E):(e.consume(E),M)}function q(E){return E===47||E===62||Gr(E)?D(E):n(E)}function H(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function L(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),R}function R(E){return Kt(E)?un(e,z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):z(E)}function z(E){return e.enter("htmlTextData"),a(E)}}const $k={name:"labelEnd",resolveAll:Q8,resolveTo:Z8,tokenize:e9},G8={tokenize:t9},J8={tokenize:n9},X8={tokenize:r9};function Q8(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&&Ei(e,0,e.length,n),e}function Z8(e,t){let n=e.length,r=0,s,o,a,l;for(;n--;)if(s=e[n][1],o){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&&(o=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(a=n);const c={type:e[o][1].type==="labelLink"?"link":"image",start:{...e[o][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[o][1].start},end:{...e[a][1].end}},d={type:"labelText",start:{...e[o+r+2][1].end},end:{...e[a-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=Ss(l,e.slice(o+1,o+r+3)),l=Ss(l,[["enter",d,t]]),l=Ss(l,Mk(t.parser.constructs.insideSpan.null,e.slice(o+r+4,a-3),t)),l=Ss(l,[["exit",d,t],e[a-2],e[a-1],["exit",u,t]]),l=Ss(l,e.slice(a+1)),l=Ss(l,[["exit",c,t]]),Ei(e,o,e.length,l),e}function e9(e,t,n){const r=this;let s=r.events.length,o,a;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){o=r.events[s][1];break}return l;function l(f){return o?o._inactive?p(f):(a=r.parser.defined.includes(ac(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),c):n(f)}function c(f){return f===40?e.attempt(G8,d,a?d:p)(f):f===91?e.attempt(J8,d,a?u:p)(f):a?d(f):p(f)}function u(f){return e.attempt(X8,d,p)(f)}function d(f){return t(f)}function p(f){return o._balanced=!0,n(f)}}function t9(e,t,n){return r;function r(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),s}function s(p){return Gr(p)?Xu(e,o)(p):o(p)}function o(p){return p===41?d(p):pR(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function a(p){return Gr(p)?Xu(e,c)(p):d(p)}function l(p){return n(p)}function c(p){return p===34||p===39||p===40?mR(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):d(p)}function u(p){return Gr(p)?Xu(e,d)(p):d(p)}function d(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function n9(e,t,n){const r=this;return s;function s(l){return hR.call(r,e,o,a,"reference","referenceMarker","referenceString")(l)}function o(l){return r.parser.defined.includes(ac(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function r9(e,t,n){return r;function r(o){return e.enter("reference"),e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),s}function s(o){return o===93?(e.enter("referenceMarker"),e.consume(o),e.exit("referenceMarker"),e.exit("reference"),t):n(o)}}const s9={name:"labelStartImage",resolveAll:$k.resolveAll,tokenize:i9};function i9(e,t,n){const r=this;return s;function s(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),o}function o(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 o9={name:"labelStartLink",resolveAll:$k.resolveAll,tokenize:a9};function a9(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"),o}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const Ty={name:"lineEnding",tokenize:l9};function l9(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),un(e,t,"linePrefix")}}const Zp={name:"thematicBreak",tokenize:c9};function c9(e,t,n){let r=0,s;return o;function o(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||yt(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),Kt(u)?un(e,l,"whitespace")(u):l(u))}}const zr={continuation:{tokenize:p9},exit:m9,name:"list",tokenize:f9},u9={partial:!0,tokenize:g9},d9={partial:!0,tokenize:h9};function f9(e,t,n){const r=this,s=r.events[r.events.length-1];let o=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return l;function l(h){const g=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:Mx(h)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(Zp,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 Mx(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(Vm,r.interrupt?n:d,e.attempt(u9,f,p))}function d(h){return r.containerState.initialBlankLine=!0,o++,f(h)}function p(h){return Kt(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),f):n(h)}function f(h){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function p9(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(Vm,s,o);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,un(e,t,"listItemIndent",r.containerState.size+1)(l)}function o(l){return r.containerState.furtherBlankLines||!Kt(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(d9,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,un(e,e.attempt(zr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function h9(e,t,n){const r=this;return un(e,s,"listItemIndent",r.containerState.size+1);function s(o){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(o):n(o)}}function m9(e){e.exit(this.containerState.type)}function g9(e,t,n){const r=this;return un(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(o){const a=r.events[r.events.length-1];return!Kt(o)&&a&&a[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const n1={name:"setextUnderline",resolveTo:y9,tokenize:w9};function y9(e,t){let n=e.length,r,s,o;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),!o&&e[n][1].type==="definition"&&(o=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",o?(e.splice(s,0,["enter",a,t]),e.splice(o+1,0,["exit",e[r][1],t]),e[r][1].end={...e[o][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function w9(e,t,n){const r=this;let s;return o;function o(u){let d=r.events.length,p;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){p=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(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"),Kt(u)?un(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||yt(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const x9={tokenize:b9};function b9(e){const t=this,n=e.attempt(Vm,r,e.attempt(this.parser.constructs.flowInitial,s,un(e,e.attempt(this.parser.constructs.flow,s,e.attempt(j8,s)),"linePrefix")));return n;function r(o){if(o===null){e.consume(o);return}return e.enter("lineEndingBlank"),e.consume(o),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(o){if(o===null){e.consume(o);return}return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const k9={resolveAll:yR()},v9=gR("string"),S9=gR("text");function gR(e){return{resolveAll:yR(e==="text"?N9:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],o=n.attempt(s,a,l);return a;function a(d){return u(d)?o(d):l(d)}function l(d){if(d===null){n.consume(d);return}return n.enter("data"),n.consume(d),c}function c(d){return u(d)?(n.exit("data"),o(d)):(n.consume(d),c)}function u(d){if(d===null)return!0;const p=s[d];let f=-1;if(p)for(;++f<p.length;){const h=p[f];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function yR(e){return t;function t(n,r){let s=-1,o;for(;++s<=n.length;)o===void 0?n[s]&&n[s][1].type==="data"&&(o=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==o+2&&(n[o][1].end=n[s-1][1].end,n.splice(o+2,s-o-2),s=o+2),o=void 0);return e?e(n,r):n}}function N9(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 o=s.length,a=-1,l=0,c;for(;o--;){const u=s[o];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){o++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:o?a:r.start._bufferIndex+a,_index:r.start._index+o,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 j9={42:zr,43:zr,45:zr,48:zr,49:zr,50:zr,51:zr,52:zr,53:zr,54:zr,55:zr,56:zr,57:zr,62:cR},C9={91:P8},_9={[-2]:Ry,[-1]:Ry,32:Ry},E9={35:L8,42:Zp,45:[n1,Zp],60:z8,61:n1,95:Zp,96:e1,126:e1},A9={38:dR,92:uR},P9={[-5]:Ty,[-4]:Ty,[-3]:Ty,33:s9,38:dR,42:$x,60:[o8,U8],91:o9,92:[M8,uR],93:$k,95:$x,96:x8},I9={null:[$x,k9]},R9={null:[42,95]},T9={null:[]},M9=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:R9,contentInitial:C9,disable:T9,document:j9,flow:E9,flowInitial:_9,insideSpan:I9,string:A9,text:P9},Symbol.toStringTag,{value:"Module"}));function $9(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={},o=[];let a=[],l=[];const c={attempt:A(N),check:A(j),consume:v,enter:w,exit:C,interrupt:A(j,{interrupt:!0})},u={code:null,containerState:{},defineSkip:k,events:[],now:g,parser:e,previous:null,sliceSerialize:f,sliceStream:h,write:p};let d=t.tokenize.call(u,c);return t.resolveAll&&o.push(t),u;function p(W){return a=Ss(a,W),b(),a[a.length-1]!==null?[]:(I(t,0),u.events=Mk(o,u.events,u),u.events)}function f(W,F){return O9(h(W),F)}function h(W){return L9(a,W)}function g(){const{_bufferIndex:W,_index:F,line:T,column:M,offset:q}=r;return{_bufferIndex:W,_index:F,line:T,column:M,offset:q}}function k(W){s[W.line]=W.column,B()}function b(){let W;for(;r._index<a.length;){const F=a[r._index];if(typeof F=="string")for(W=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===W&&r._bufferIndex<F.length;)y(F.charCodeAt(r._bufferIndex));else y(F)}}function y(W){d=d(W)}function v(W){yt(W)?(r.line++,r.column=1,r.offset+=W===-3?2:1,B()):W!==-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=W}function w(W,F){const T=F||{};return T.type=W,T.start=g(),u.events.push(["enter",T,u]),l.push(T),T}function C(W){const F=l.pop();return F.end=g(),u.events.push(["exit",F,u]),F}function N(W,F){I(W,F.from)}function j(W,F){F.restore()}function A(W,F){return T;function T(M,q,H){let L,R,z,E;return Array.isArray(M)?V(M):"tokenize"in M?V([M]):Q(M);function Q(X){return re;function re(Z){const ie=Z!==null&&X[Z],te=Z!==null&&X.null,ue=[...Array.isArray(ie)?ie:ie?[ie]:[],...Array.isArray(te)?te:te?[te]:[]];return V(ue)(Z)}}function V(X){return L=X,R=0,X.length===0?H:$(X[R])}function $(X){return re;function re(Z){return E=D(),z=X,X.partial||(u.currentConstruct=X),X.name&&u.parser.constructs.disable.null.includes(X.name)?ce():X.tokenize.call(F?Object.assign(Object.create(u),F):u,c,ne,ce)(Z)}}function ne(X){return W(z,E),q}function ce(X){return E.restore(),++R<L.length?$(L[R]):H}}}function I(W,F){W.resolveAll&&!o.includes(W)&&o.push(W),W.resolve&&Ei(u.events,F,u.events.length-F,W.resolve(u.events.slice(F),u)),W.resolveTo&&(u.events=W.resolveTo(u.events,u))}function D(){const W=g(),F=u.previous,T=u.currentConstruct,M=u.events.length,q=Array.from(l);return{from:M,restore:H};function H(){r=W,u.previous=F,u.currentConstruct=T,u.events.length=M,l=q,B()}}function B(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function L9(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,o=t.end._bufferIndex;let a;if(n===s)a=[e[n].slice(r,o)];else{if(a=e.slice(n,s),r>-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}o>0&&a.push(e[s].slice(0,o))}return a}function O9(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const o=e[n];let a;if(typeof o=="string")a=o;else switch(o){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(o)}s=o===-2,r.push(a)}return r.join("")}function D9(e){const r={constructs:K6([M9,...(e||{}).extensions||[]]),content:s(Z6),defined:[],document:s(t8),flow:s(x9),lazy:{},string:s(v9),text:s(S9)};return r;function s(o){return a;function a(l){return $9(r,o,l)}}}function F9(e){for(;!fR(e););return e}const r1=/[\0\t\n\r]/g;function z9(){let e=1,t="",n=!0,r;return s;function s(o,a,l){const c=[];let u,d,p,f,h;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(a||void 0).decode(o)),p=0,t="",n&&(o.charCodeAt(0)===65279&&p++,n=void 0);p<o.length;){if(r1.lastIndex=p,u=r1.exec(o),f=u&&u.index!==void 0?u.index:o.length,h=o.charCodeAt(f),!u){t=o.slice(p);break}if(h===10&&p===f&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),p<f&&(c.push(o.slice(p,f)),e+=f-p),h){case 0:{c.push(65533),e++;break}case 9:{for(d=Math.ceil(e/4)*4,c.push(-2);e++<d;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}p=f+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const B9=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function H9(e){return e.replace(B9,W9)}function W9(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),o=s===120||s===88;return lR(n.slice(o?2:1),o?16:10)}return Tk(n)||e}const wR={}.hasOwnProperty;function V9(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),K9(n)(F9(D9(n).document().write(z9()(e,t,!0))))}function K9(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(bt),autolinkProtocol:D,autolinkEmail:D,atxHeading:o(Ue),blockQuote:o(te),characterEscape:D,characterReference:D,codeFenced:o(ue),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(ue,a),codeText:o(fe,a),codeTextData:D,data:D,codeFlowValue:D,definition:o(be),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o(qe),hardBreakEscape:o(Me),hardBreakTrailing:o(Me),htmlFlow:o(rt,a),htmlFlowData:D,htmlText:o(rt,a),htmlTextData:D,image:o(gt),label:a,link:o(bt),listItem:o(je),listItemValue:f,listOrdered:o(oe,p),listUnordered:o(oe),paragraph:o(Ve),reference:$,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(Ue),strong:o(tt),thematicBreak:o(st)},exit:{atxHeading:c(),atxHeadingSequence:N,autolink:c(),autolinkEmail:ie,autolinkProtocol:Z,blockQuote:c(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:X,characterReference:re,codeFenced:c(b),codeFencedFence:k,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:B,codeIndented:c(y),codeText:c(q),codeTextData:B,data:B,definition:c(),definitionDestinationString:C,definitionLabelString:v,definitionTitleString:w,emphasis:c(),hardBreakEscape:c(F),hardBreakTrailing:c(F),htmlFlow:c(T),htmlFlowData:B,htmlText:c(M),htmlTextData:B,image:c(L),label:z,labelText:R,lineEnding:W,link:c(H),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ne,resourceDestinationString:E,resourceTitleString:Q,resource:V,setextHeading:c(I),setextHeadingLineSequence:A,setextHeadingText:j,strong:c(),thematicBreak:c()}};xR(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(de){let ve={type:"root",children:[]};const ze={stack:[ve],tokenStack:[],config:t,enter:l,exit:u,buffer:a,resume:d,data:n},Ze=[];let Se=-1;for(;++Se<de.length;)if(de[Se][1].type==="listOrdered"||de[Se][1].type==="listUnordered")if(de[Se][0]==="enter")Ze.push(Se);else{const Tt=Ze.pop();Se=s(de,Tt,Se)}for(Se=-1;++Se<de.length;){const Tt=t[de[Se][0]];wR.call(Tt,de[Se][1].type)&&Tt[de[Se][1].type].call(Object.assign({sliceSerialize:de[Se][2].sliceSerialize},ze),de[Se][1])}if(ze.tokenStack.length>0){const Tt=ze.tokenStack[ze.tokenStack.length-1];(Tt[1]||s1).call(ze,void 0,Tt[0])}for(ve.position={start:jo(de.length>0?de[0][1].start:{line:1,column:1,offset:0}),end:jo(de.length>0?de[de.length-2][1].end:{line:1,column:1,offset:0})},Se=-1;++Se<t.transforms.length;)ve=t.transforms[Se](ve)||ve;return ve}function s(de,ve,ze){let Ze=ve-1,Se=-1,Tt=!1,vn,dn,nn,Sn;for(;++Ze<=ze;){const ee=de[Ze];switch(ee[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{ee[0]==="enter"?Se++:Se--,Sn=void 0;break}case"lineEndingBlank":{ee[0]==="enter"&&(vn&&!Sn&&!Se&&!nn&&(nn=Ze),Sn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Sn=void 0}if(!Se&&ee[0]==="enter"&&ee[1].type==="listItemPrefix"||Se===-1&&ee[0]==="exit"&&(ee[1].type==="listUnordered"||ee[1].type==="listOrdered")){if(vn){let Ie=Ze;for(dn=void 0;Ie--;){const Fe=de[Ie];if(Fe[1].type==="lineEnding"||Fe[1].type==="lineEndingBlank"){if(Fe[0]==="exit")continue;dn&&(de[dn][1].type="lineEndingBlank",Tt=!0),Fe[1].type="lineEnding",dn=Ie}else if(!(Fe[1].type==="linePrefix"||Fe[1].type==="blockQuotePrefix"||Fe[1].type==="blockQuotePrefixWhitespace"||Fe[1].type==="blockQuoteMarker"||Fe[1].type==="listItemIndent"))break}nn&&(!dn||nn<dn)&&(vn._spread=!0),vn.end=Object.assign({},dn?de[dn][1].start:ee[1].end),de.splice(dn||Ze,0,["exit",vn,ee[2]]),Ze++,ze++}if(ee[1].type==="listItemPrefix"){const Ie={type:"listItem",_spread:!1,start:Object.assign({},ee[1].start),end:void 0};vn=Ie,de.splice(Ze,0,["enter",Ie,ee[2]]),Ze++,ze++,nn=void 0,Sn=!0}}}return de[ve][1]._spread=Tt,ze}function o(de,ve){return ze;function ze(Ze){l.call(this,de(Ze),Ze),ve&&ve.call(this,Ze)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(de,ve,ze){this.stack[this.stack.length-1].children.push(de),this.stack.push(de),this.tokenStack.push([ve,ze||void 0]),de.position={start:jo(ve.start),end:void 0}}function c(de){return ve;function ve(ze){de&&de.call(this,ze),u.call(this,ze)}}function u(de,ve){const ze=this.stack.pop(),Ze=this.tokenStack.pop();if(Ze)Ze[0].type!==de.type&&(ve?ve.call(this,de,Ze[0]):(Ze[1]||s1).call(this,de,Ze[0]));else throw new Error("Cannot close `"+de.type+"` ("+Ju({start:de.start,end:de.end})+"): it’s not open");ze.position.end=jo(de.end)}function d(){return W6(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function f(de){if(this.data.expectingFirstListItemValue){const ve=this.stack[this.stack.length-2];ve.start=Number.parseInt(this.sliceSerialize(de),10),this.data.expectingFirstListItemValue=void 0}}function h(){const de=this.resume(),ve=this.stack[this.stack.length-1];ve.lang=de}function g(){const de=this.resume(),ve=this.stack[this.stack.length-1];ve.meta=de}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const de=this.resume(),ve=this.stack[this.stack.length-1];ve.value=de.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const de=this.resume(),ve=this.stack[this.stack.length-1];ve.value=de.replace(/(\r?\n|\r)$/g,"")}function v(de){const ve=this.resume(),ze=this.stack[this.stack.length-1];ze.label=ve,ze.identifier=ac(this.sliceSerialize(de)).toLowerCase()}function w(){const de=this.resume(),ve=this.stack[this.stack.length-1];ve.title=de}function C(){const de=this.resume(),ve=this.stack[this.stack.length-1];ve.url=de}function N(de){const ve=this.stack[this.stack.length-1];if(!ve.depth){const ze=this.sliceSerialize(de).length;ve.depth=ze}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function A(de){const ve=this.stack[this.stack.length-1];ve.depth=this.sliceSerialize(de).codePointAt(0)===61?1:2}function I(){this.data.setextHeadingSlurpLineEnding=void 0}function D(de){const ze=this.stack[this.stack.length-1].children;let Ze=ze[ze.length-1];(!Ze||Ze.type!=="text")&&(Ze=Jt(),Ze.position={start:jo(de.start),end:void 0},ze.push(Ze)),this.stack.push(Ze)}function B(de){const ve=this.stack.pop();ve.value+=this.sliceSerialize(de),ve.position.end=jo(de.end)}function W(de){const ve=this.stack[this.stack.length-1];if(this.data.atHardBreak){const ze=ve.children[ve.children.length-1];ze.position.end=jo(de.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ve.type)&&(D.call(this,de),B.call(this,de))}function F(){this.data.atHardBreak=!0}function T(){const de=this.resume(),ve=this.stack[this.stack.length-1];ve.value=de}function M(){const de=this.resume(),ve=this.stack[this.stack.length-1];ve.value=de}function q(){const de=this.resume(),ve=this.stack[this.stack.length-1];ve.value=de}function H(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=ve,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function L(){const de=this.stack[this.stack.length-1];if(this.data.inReference){const ve=this.data.referenceType||"shortcut";de.type+="Reference",de.referenceType=ve,delete de.url,delete de.title}else delete de.identifier,delete de.label;this.data.referenceType=void 0}function R(de){const ve=this.sliceSerialize(de),ze=this.stack[this.stack.length-2];ze.label=H9(ve),ze.identifier=ac(ve).toLowerCase()}function z(){const de=this.stack[this.stack.length-1],ve=this.resume(),ze=this.stack[this.stack.length-1];if(this.data.inReference=!0,ze.type==="link"){const Ze=de.children;ze.children=Ze}else ze.alt=ve}function E(){const de=this.resume(),ve=this.stack[this.stack.length-1];ve.url=de}function Q(){const de=this.resume(),ve=this.stack[this.stack.length-1];ve.title=de}function V(){this.data.inReference=void 0}function $(){this.data.referenceType="collapsed"}function ne(de){const ve=this.resume(),ze=this.stack[this.stack.length-1];ze.label=ve,ze.identifier=ac(this.sliceSerialize(de)).toLowerCase(),this.data.referenceType="full"}function ce(de){this.data.characterReferenceType=de.type}function X(de){const ve=this.sliceSerialize(de),ze=this.data.characterReferenceType;let Ze;ze?(Ze=lR(ve,ze==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ze=Tk(ve);const Se=this.stack[this.stack.length-1];Se.value+=Ze}function re(de){const ve=this.stack.pop();ve.position.end=jo(de.end)}function Z(de){B.call(this,de);const ve=this.stack[this.stack.length-1];ve.url=this.sliceSerialize(de)}function ie(de){B.call(this,de);const ve=this.stack[this.stack.length-1];ve.url="mailto:"+this.sliceSerialize(de)}function te(){return{type:"blockquote",children:[]}}function ue(){return{type:"code",lang:null,meta:null,value:""}}function fe(){return{type:"inlineCode",value:""}}function be(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function qe(){return{type:"emphasis",children:[]}}function Ue(){return{type:"heading",depth:0,children:[]}}function Me(){return{type:"break"}}function rt(){return{type:"html",value:""}}function gt(){return{type:"image",title:null,url:"",alt:null}}function bt(){return{type:"link",title:null,url:"",children:[]}}function oe(de){return{type:"list",ordered:de.type==="listOrdered",start:null,spread:de._spread,children:[]}}function je(de){return{type:"listItem",spread:de._spread,checked:null,children:[]}}function Ve(){return{type:"paragraph",children:[]}}function tt(){return{type:"strong",children:[]}}function Jt(){return{type:"text",value:""}}function st(){return{type:"thematicBreak"}}}function jo(e){return{line:e.line,column:e.column,offset:e.offset}}function xR(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?xR(e,r):q9(e,r)}}function q9(e,t){let n;for(n in t)if(wR.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 s1(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ju({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ju({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ju({start:t.start,end:t.end})+") is still open")}function U9(e){const t=this;t.parser=n;function n(r){return V9(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function Y9(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 G9(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
70
|
-
`}]}function J9(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 o={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(o.data={meta:t.meta}),e.patch(t,o),o=e.applyData(t,o),o={type:"element",tagName:"pre",properties:{},children:[o]},e.patch(t,o),o}function X9(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Q9(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Z9(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Mc(r.toLowerCase()),o=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=o+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 eV(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 tV(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function bR(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),o=s[0];o&&o.type==="text"?o.value="["+o.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 nV(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return bR(e,t);const s={src:Mc(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const o={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,o),e.applyData(t,o)}function rV(e,t){const n={src:Mc(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 sV(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 iV(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return bR(e,t);const s={href:Mc(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const o={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,o),e.applyData(t,o)}function oV(e,t){const n={href:Mc(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 aV(e,t,n){const r=e.all(t),s=n?lV(n):kR(t),o={},a=[];if(typeof t.checked=="boolean"){const d=r[0];let p;d&&d.type==="element"&&d.tagName==="p"?p=d:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const d=r[l];(s||l!==0||d.type!=="element"||d.tagName!=="p")&&a.push({type:"text",value:`
|
|
72
|
-
`}),d.type==="element"&&d.tagName==="p"&&!s?a.push(...d.children):a.push(d)}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:o,children:a};return e.patch(t,u),e.applyData(t,u)}function lV(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=kR(n[r])}return t}function kR(e){const t=e.spread;return t??e.children.length>1}function cV(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 o={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,o),e.applyData(t,o)}function uV(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function dV(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function fV(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function pV(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=Ak(t.children[1]),c=tR(t.children[t.children.length-1]);l&&c&&(a.position={start:l,end:c}),s.push(a)}const o={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,o),e.applyData(t,o)}function hV(e,t,n){const r=n?n.children:void 0,o=(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 p=t.children[c],f={},h=a?a[c]:void 0;h&&(f.align=h);let g={type:"element",tagName:o,properties:f,children:[]};p&&(g.children=e.all(p),e.patch(p,g),g=e.applyData(p,g)),u.push(g)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function mV(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const i1=9,o1=32;function gV(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const o=[];for(;r;)o.push(a1(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return o.push(a1(t.slice(s),s>0,!1)),o.join("")}function a1(e,t,n){let r=0,s=e.length;if(t){let o=e.codePointAt(r);for(;o===i1||o===o1;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(s-1);for(;o===i1||o===o1;)s--,o=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function yV(e,t){const n={type:"text",value:gV(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function wV(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const xV={blockquote:Y9,break:G9,code:J9,delete:X9,emphasis:Q9,footnoteReference:Z9,heading:eV,html:tV,imageReference:nV,image:rV,inlineCode:sV,linkReference:iV,link:oV,listItem:aV,list:cV,paragraph:uV,root:dV,strong:fV,table:pV,tableCell:mV,tableRow:hV,text:yV,thematicBreak:wV,toml:hp,yaml:hp,definition:hp,footnoteDefinition:hp};function hp(){}const vR=-1,Km=0,Qu=1,Wh=2,Lk=3,Ok=4,Dk=5,Fk=6,SR=7,NR=8,l1=typeof self=="object"?self:globalThis,bV=(e,t)=>{const n=(s,o)=>(e.set(o,s),s),r=s=>{if(e.has(s))return e.get(s);const[o,a]=t[s];switch(o){case Km:case vR:return n(a,s);case Qu:{const l=n([],s);for(const c of a)l.push(r(c));return l}case Wh:{const l=n({},s);for(const[c,u]of a)l[r(c)]=r(u);return l}case Lk:return n(new Date(a),s);case Ok:{const{source:l,flags:c}=a;return n(new RegExp(l,c),s)}case Dk:{const l=n(new Map,s);for(const[c,u]of a)l.set(r(c),r(u));return l}case Fk:{const l=n(new Set,s);for(const c of a)l.add(r(c));return l}case SR:{const{name:l,message:c}=a;return n(new l1[l](c),s)}case NR: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 l1[o](a),s)};return r},c1=e=>bV(new Map,e)(0),Cl="",{toString:kV}={},{keys:vV}=Object,bu=e=>{const t=typeof e;if(t!=="object"||!e)return[Km,t];const n=kV.call(e).slice(8,-1);switch(n){case"Array":return[Qu,Cl];case"Object":return[Wh,Cl];case"Date":return[Lk,Cl];case"RegExp":return[Ok,Cl];case"Map":return[Dk,Cl];case"Set":return[Fk,Cl];case"DataView":return[Qu,n]}return n.includes("Array")?[Qu,n]:n.includes("Error")?[SR,n]:[Wh,n]},mp=([e,t])=>e===Km&&(t==="function"||t==="symbol"),SV=(e,t,n,r)=>{const s=(a,l)=>{const c=r.push(a)-1;return n.set(l,c),c},o=a=>{if(n.has(a))return n.get(a);let[l,c]=bu(a);switch(l){case Km:{let d=a;switch(c){case"bigint":l=NR,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return s([vR],a)}return s([l,d],a)}case Qu:{if(c){let f=a;return c==="DataView"?f=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(f=new Uint8Array(a)),s([c,[...f]],a)}const d=[],p=s([l,d],a);for(const f of a)d.push(o(f));return p}case Wh:{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 o(a.toJSON());const d=[],p=s([l,d],a);for(const f of vV(a))(e||!mp(bu(a[f])))&&d.push([o(f),o(a[f])]);return p}case Lk:return s([l,a.toISOString()],a);case Ok:{const{source:d,flags:p}=a;return s([l,{source:d,flags:p}],a)}case Dk:{const d=[],p=s([l,d],a);for(const[f,h]of a)(e||!(mp(bu(f))||mp(bu(h))))&&d.push([o(f),o(h)]);return p}case Fk:{const d=[],p=s([l,d],a);for(const f of a)(e||!mp(bu(f)))&&d.push(o(f));return p}}const{message:u}=a;return s([l,{name:c,message:u}],a)};return o},u1=(e,{json:t,lossy:n}={})=>{const r=[];return SV(!(t||n),!!t,new Map,r)(e),r},Vh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?c1(u1(e,t)):structuredClone(e):(e,t)=>c1(u1(e,t));function NV(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 jV(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function CV(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||NV,r=e.options.footnoteBackLabel||jV,s=e.options.footnoteLabel||"Footnotes",o=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 d=e.all(u),p=String(u.identifier).toUpperCase(),f=Mc(p.toLowerCase());let h=0;const g=[],k=e.footnoteCounts.get(p);for(;k!==void 0&&++h<=k;){g.length>0&&g.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,h);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,h),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const b=d[d.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const v=b.children[b.children.length-1];v&&v.type==="text"?v.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...g)}else d.push(...g);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(d,!0)};e.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Vh(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 jR=function(e){if(e==null)return PV;if(typeof e=="function")return qm(e);if(typeof e=="object")return Array.isArray(e)?_V(e):EV(e);if(typeof e=="string")return AV(e);throw new Error("Expected function, string, or object as test")};function _V(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=jR(e[n]);return qm(r);function r(...s){let o=-1;for(;++o<t.length;)if(t[o].apply(this,s))return!0;return!1}}function EV(e){const t=e;return qm(n);function n(r){const s=r;let o;for(o in e)if(s[o]!==t[o])return!1;return!0}}function AV(e){return qm(t);function t(n){return n&&n.type===e}}function qm(e){return t;function t(n,r,s){return!!(IV(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function PV(){return!0}function IV(e){return e!==null&&typeof e=="object"&&"type"in e}const CR=[],RV=!0,d1=!1,TV="skip";function MV(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const o=jR(s),a=r?-1:1;l(e,void 0,[])();function l(c,u,d){const p=c&&typeof c=="object"?c:{};if(typeof p.type=="string"){const h=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(c.type+(h?"<"+h+">":""))+")"})}return f;function f(){let h=CR,g,k,b;if((!t||o(c,u,d[d.length-1]||void 0))&&(h=$V(n(c,d)),h[0]===d1))return h;if("children"in c&&c.children){const y=c;if(y.children&&h[0]!==TV)for(k=(r?y.children.length:-1)+a,b=d.concat(y);k>-1&&k<y.children.length;){const v=y.children[k];if(g=l(v,k,b)(),g[0]===d1)return g;k=typeof g[1]=="number"?g[1]:k+a}}return h}}}function $V(e){return Array.isArray(e)?e:typeof e=="number"?[RV,e]:e==null?CR:[e]}function _R(e,t,n,r){let s,o,a;typeof t=="function"&&typeof n!="function"?(o=void 0,a=t,s=n):(o=t,a=n,s=r),MV(e,o,l,s);function l(c,u){const d=u[u.length-1],p=d?d.children.indexOf(c):void 0;return a(c,p,d)}}const Lx={}.hasOwnProperty,LV={};function OV(e,t){const n=t||LV,r=new Map,s=new Map,o=new Map,a={...xV,...n.handlers},l={all:u,applyData:FV,definitionById:r,footnoteById:s,footnoteCounts:o,footnoteOrder:[],handlers:a,one:c,options:n,patch:DV,wrap:BV};return _R(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const p=d.type==="definition"?r:s,f=String(d.identifier).toUpperCase();p.has(f)||p.set(f,d)}}),l;function c(d,p){const f=d.type,h=l.handlers[f];if(Lx.call(l.handlers,f)&&h)return h(l,d,p);if(l.options.passThrough&&l.options.passThrough.includes(f)){if("children"in d){const{children:k,...b}=d,y=Vh(b);return y.children=l.all(d),y}return Vh(d)}return(l.options.unknownHandler||zV)(l,d,p)}function u(d){const p=[];if("children"in d){const f=d.children;let h=-1;for(;++h<f.length;){const g=l.one(f[h],d);if(g){if(h&&f[h-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=f1(g.value)),!Array.isArray(g)&&g.type==="element")){const k=g.children[0];k&&k.type==="text"&&(k.value=f1(k.value))}Array.isArray(g)?p.push(...g):p.push(g)}}}return p}}function DV(e,t){e.position&&(t.position=k6(e))}function FV(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,o=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"&&o&&Object.assign(n.properties,Vh(o)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function zV(e,t){const n=t.data||{},r="value"in t&&!(Lx.call(n,"hProperties")||Lx.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 BV(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 f1(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function p1(e,t){const n=OV(e,t),r=n.one(e,void 0),s=CV(n),o=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&o.children.push({type:"text",value:`
|
|
79
|
-
`},s),o}function HV(e,t){return e&&"run"in e?async function(n,r){const s=p1(n,{file:r,...t});await e.run(s,r)}:function(n,r){return p1(n,{file:r,...e||t})}}function h1(e){if(e)throw e}var eh=Object.prototype.hasOwnProperty,ER=Object.prototype.toString,m1=Object.defineProperty,g1=Object.getOwnPropertyDescriptor,y1=function(t){return typeof Array.isArray=="function"?Array.isArray(t):ER.call(t)==="[object Array]"},w1=function(t){if(!t||ER.call(t)!=="[object Object]")return!1;var n=eh.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&eh.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||eh.call(t,s)},x1=function(t,n){m1&&n.name==="__proto__"?m1(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},b1=function(t,n){if(n==="__proto__")if(eh.call(t,n)){if(g1)return g1(t,n).value}else return;return t[n]},WV=function e(){var t,n,r,s,o,a,l=arguments[0],c=1,u=arguments.length,d=!1;for(typeof l=="boolean"&&(d=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=b1(l,n),s=b1(t,n),l!==s&&(d&&s&&(w1(s)||(o=y1(s)))?(o?(o=!1,a=r&&y1(r)?r:[]):a=r&&w1(r)?r:{},x1(l,{name:n,newValue:e(d,a,s)})):typeof s<"u"&&x1(l,{name:n,newValue:s}));return l};const My=Zo(WV);function Ox(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 VV(){const e=[],t={run:n,use:r};return t;function n(...s){let o=-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 d=e[++o];let p=-1;if(c){a(c);return}for(;++p<s.length;)(u[p]===null||u[p]===void 0)&&(u[p]=s[p]);s=u,d?KV(d,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 KV(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 d=u;if(l&&n)throw d;return s(d)}l||(c&&c.then&&typeof c.then=="function"?c.then(o,s):c instanceof Error?s(c):o(c))}function s(a,...l){n||(n=!0,t(a,...l))}function o(a){s(null,a)}}const di={basename:qV,dirname:UV,extname:YV,join:GV,sep:"/"};function qV(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');rf(e);let n=0,r=-1,s=e.length,o;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(o){n=s+1;break}}else r<0&&(o=!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(o){n=s+1;break}}else a<0&&(o=!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 UV(e){if(rf(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 YV(e){rf(e);let t=e.length,n=-1,r=0,s=-1,o=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:o!==1&&(o=1):s>-1&&(o=-1)}return s<0||n<0||o===0||o===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function GV(...e){let t=-1,n;for(;++t<e.length;)rf(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":JV(n)}function JV(e){rf(e);const t=e.codePointAt(0)===47;let n=XV(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function XV(e,t){let n="",r=0,s=-1,o=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||o===1))if(s!==a-1&&o===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,o=0;continue}}else if(n.length>0){n="",r=0,s=a,o=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,o=0}else l===46&&o>-1?o++:o=-1}return n}function rf(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const QV={cwd:ZV};function ZV(){return"/"}function Dx(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function eK(e){if(typeof e=="string")e=new URL(e);else if(!Dx(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 tK(e)}function tK(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 $y=["history","path","basename","stem","extname","dirname"];class AR{constructor(t){let n;t?Dx(t)?n={path:t}:typeof t=="string"||nK(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":QV.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<$y.length;){const o=$y[r];o in n&&n[o]!==void 0&&n[o]!==null&&(this[o]=o==="history"?[...n[o]]:n[o])}let s;for(s in n)$y.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?di.basename(this.path):void 0}set basename(t){Oy(t,"basename"),Ly(t,"basename"),this.path=di.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?di.dirname(this.path):void 0}set dirname(t){k1(this.basename,"dirname"),this.path=di.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?di.extname(this.path):void 0}set extname(t){if(Ly(t,"extname"),k1(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=di.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Dx(t)&&(t=eK(t)),Oy(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?di.basename(this.path,this.extname):void 0}set stem(t){Oy(t,"stem"),Ly(t,"stem"),this.path=di.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 Cr(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 Ly(e,t){if(e&&e.includes(di.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+di.sep+"`")}function Oy(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function k1(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function nK(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const rK=function(e){const r=this.constructor.prototype,s=r[e],o=function(){return s.apply(o,arguments)};return Object.setPrototypeOf(o,r),o},sK={}.hasOwnProperty;class zk extends rK{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=VV()}copy(){const t=new zk;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(My(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(zy("data",this.frozen),this.namespace[t]=n,this):sK.call(this.namespace,t)&&this.namespace[t]||void 0:t?(zy("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=gp(t),r=this.parser||this.Parser;return Dy("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Dy("process",this.parser||this.Parser),Fy("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(o,a){const l=gp(t),c=r.parse(l);r.run(c,l,function(d,p,f){if(d||!p||!f)return u(d);const h=p,g=r.stringify(h,f);aK(g)?f.value=g:f.result=g,u(d,f)});function u(d,p){d||!p?a(d):o?o(p):n(void 0,p)}}}processSync(t){let n=!1,r;return this.freeze(),Dy("processSync",this.parser||this.Parser),Fy("processSync",this.compiler||this.Compiler),this.process(t,s),S1("processSync","process",n),r;function s(o,a){n=!0,h1(o),r=a}}run(t,n,r){v1(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?o(void 0,r):new Promise(o);function o(a,l){const c=gp(n);s.run(t,c,u);function u(d,p,f){const h=p||t;d?l(d):a?a(h):r(void 0,h,f)}}}runSync(t,n){let r=!1,s;return this.run(t,n,o),S1("runSync","run",r),s;function o(a,l){h1(a),s=l,r=!0}}stringify(t,n){this.freeze();const r=gp(n),s=this.compiler||this.Compiler;return Fy("stringify",s),v1(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(zy("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 o(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[d,...p]=u;c(d,p)}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=My(!0,s.settings,u.settings))}function l(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const p=u[d];o(p)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let p=-1,f=-1;for(;++p<r.length;)if(r[p][0]===u){f=p;break}if(f===-1)r.push([u,...d]);else if(d.length>0){let[h,...g]=d;const k=r[f][1];Ox(k)&&Ox(h)&&(h=My(!0,k,h)),r[f]=[u,h,...g]}}}}const iK=new zk().freeze();function Dy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Fy(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function zy(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 v1(e){if(!Ox(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function S1(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function gp(e){return oK(e)?e:new AR(e)}function oK(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function aK(e){return typeof e=="string"||lK(e)}function lK(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const cK="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",N1=[],j1={allowDangerousHtml:!0},uK=/^(https?|ircs?|mailto|xmpp)$/i,dK=[{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 PR(e){const t=fK(e),n=pK(e);return hK(t.runSync(t.parse(n),n),e)}function fK(e){const t=e.rehypePlugins||N1,n=e.remarkPlugins||N1,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...j1}:j1;return iK().use(U9).use(n).use(HV,r).use(t)}function pK(e){const t=e.children||"",n=new AR;return typeof t=="string"&&(n.value=t),n}function hK(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,o=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||mK;for(const d of dK)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+cK+d.id,void 0);return _R(e,u),C6(e,{Fragment:i.Fragment,components:s,ignoreInvalidStyle:!0,jsx:i.jsx,jsxs:i.jsxs,passKeys:!0,passNode:!0});function u(d,p,f){if(d.type==="raw"&&f&&typeof p=="number")return a?f.children.splice(p,1):f.children[p]={type:"text",value:d.value},p;if(d.type==="element"){let h;for(h in Iy)if(Object.hasOwn(Iy,h)&&Object.hasOwn(d.properties,h)){const g=d.properties[h],k=Iy[h];(k===null||k.includes(d.tagName))&&(d.properties[h]=c(String(g||""),h,d))}}if(d.type==="element"){let h=n?!n.includes(d.tagName):o?o.includes(d.tagName):!1;if(!h&&r&&typeof p=="number"&&(h=!r(d,p,f)),h&&f&&typeof p=="number")return l&&d.children?f.children.splice(p,1,...d.children):f.children.splice(p,1),p}}}function mK(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||uK.test(e.slice(0,t))?e:""}const gK=new Set(["echarts"]),yK=new Set(["line","bar","pie","scatter","radar","heatmap","tree","treemap","sunburst","sankey","graph","gauge","funnel"]),wK=new Set(["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","oncontextmenu","onkeydown","onkeyup","onkeypress","onload","onerror"]),xK=["#7c9cff","#a8e66f","#ffcf5c","#68d8d6","#ff8fb3","#b79cff","#f59e73","#8bd17c"];function Ko(e){return e&&typeof e=="object"&&!Array.isArray(e)}function qa(e,t){if(!Ko(e))return{...t};const n={...e};for(const[r,s]of Object.entries(t))n[r]==null?n[r]=s:Ko(n[r])&&Ko(s)&&(n[r]=qa(n[r],s));return n}function Um(e,t){return e==null?e:Array.isArray(e)?e.map(n=>Ko(n)?qa(n,t):n):Ko(e)?qa(e,t):e}function bK(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 Fx(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)=>Fx(n,`${t}[${r}]`));return}if(typeof e=="object")for(const[n,r]of Object.entries(e)){if(/^on[A-Z]/.test(n)||wK.has(n.toLowerCase()))throw new Error(`${t}.${n} is not allowed`);Fx(r,`${t}.${n}`)}}}function kK(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(!yK.has(r))throw new Error(`series.type "${r||"(empty)"}" is not allowed`)}return t}function vK(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:qa(e,t)}function SK(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(!Ko(r))return r;const o=s===0&&t&&r.text==null?{...r,text:t}:r;return qa(o,n)}):Ko(e)?qa(t&&e.text==null?{...e,text:t}:e,n):t?{...n,text:t}:e}function NK(e,t){const n={top:t?42:14,textStyle:{color:"rgba(255, 255, 255, 0.72)"},itemGap:14};return e==null?e:Um(e,n)}function C1(e,t="rgba(255, 255, 255, 0.62)"){return Um(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 jK(e,t){const n={left:52,right:42,top:t?78:42,bottom:42,containLabel:!0};return e==null?n:Um(e,n)}function CK(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:Um(e,t)}function _K(e,t,n){const r=SK(e.title,n),s=!!(Array.isArray(r)?r:[r]).filter(Boolean).some(a=>Ko(a)&&a.text),o=e.legend!=null&&e.legend!==!1;return{...e,backgroundColor:e.backgroundColor??"transparent",color:e.color??xK,textStyle:qa(e.textStyle,{color:"rgba(255, 255, 255, 0.78)"}),title:r,tooltip:vK(e.tooltip),legend:NK(e.legend,s),grid:e.xAxis!=null||e.yAxis!=null?jK(e.grid,s||o):e.grid,xAxis:C1(e.xAxis),yAxis:C1(e.yAxis),radar:CK(e.radar),series:t}}function EK(e){const t=bK(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(!gK.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");Fx(n);const r=kK(n.option.series),s=n.title==null?"":String(n.title),o=_K(n.option,r,s);return{ok:!0,spec:{...n,title:s,option:o}}}catch(n){return{ok:!1,error:String((n==null?void 0:n.message)||n)}}}function yp(e,t){let n=0;for(let r=t-1;r>=0&&e[r]==="\\";r-=1)n+=1;return n%2===1}function AK(e,t){let n=t;for(;n<e.length&&e[n]==="`";)n+=1;return n-t}function qi(e){let t=String(e||"").trim();if(!t.includes("|"))return[];t.startsWith("|")&&(t=t.slice(1)),t.endsWith("|")&&!yp(t,t.length-1)&&(t=t.slice(0,-1));const n=[];let r="",s=0;for(let o=0;o<t.length;o+=1){const a=t[o];if(a==="`"&&!yp(t,o)){const l=AK(t,o);r+=t.slice(o,o+l),s===0?s=l:s===l&&(s=0),o+=l-1;continue}if(s===0&&a==="|"&&!yp(t,o)){n.push(r.trim()),r="";continue}if(s===0&&a==="\\"&&t[o+1]==="|"&&yp(t,o+1)){r+="|",o+=1;continue}r+=a}return n.push(r.trim()),n}function IR(e,t){if(!t)return e;const n=e.slice(0,t);for(e.length>t&&(n[t-1]=[e[t-1],...e.slice(t)].filter(Boolean).join(" | "));n.length<t;)n.push("");return n}function RR(e){const t=qi(e);return t.length>1&&t.every(n=>/^:?-{3,}:?$/.test(n))}function TR(e){return qi(e).map(t=>t.startsWith(":")&&t.endsWith(":")?"center":t.endsWith(":")?"right":"left")}function PK(e){return/^\s*(sequenceDiagram|flowchart\s+(?:TD|TB|BT|LR|RL)|graph\s+(?:TD|TB|BT|LR|RL))\b/i.test(String(e||""))}function IK(e){const t=String(e||"").split(/\r?\n/).map(l=>l.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[];let s="TD";const o=(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?o(u[1],u[2]||u[3]||u[4]||u[1]):o(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 RK({code:e}){const t=m.useMemo(()=>IK(e),[e]),n=t.direction==="LR"||t.direction==="RL",r=150,s=46,o=n?102:38,a=n?34:72,l=new Map;t.nodes.forEach((d,p)=>{l.set(d.id,{x:28+(n?p*(r+o):p%3*(r+o)),y:28+(n?p%3*(s+a):p*(s+a))})});const c=Math.max(520,...Array.from(l.values()).map(d=>d.x+r+28)),u=Math.max(220,...Array.from(l.values()).map(d=>d.y+s+28));return i.jsxs("svg",{viewBox:`0 0 ${c} ${u}`,role:"img","aria-label":"Mermaid flowchart preview",children:[i.jsx("defs",{children:i.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:i.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),t.edges.map((d,p)=>{const f=l.get(d.from),h=l.get(d.to);if(!f||!h)return null;const g=n?`M ${f.x+r} ${f.y+s/2} C ${(f.x+h.x+r)/2} ${f.y+s/2}, ${(f.x+h.x+r)/2} ${h.y+s/2}, ${h.x} ${h.y+s/2}`:`M ${f.x+r/2} ${f.y+s} C ${f.x+r/2} ${f.y+s+28}, ${h.x+r/2} ${h.y-28}, ${h.x+r/2} ${h.y}`;return i.jsx("path",{className:"af-md-mermaid-edge",d:g,markerEnd:"url(#af-md-mermaid-arrow)"},`${d.from}-${d.to}-${p}`)}),t.nodes.map(d=>{const p=l.get(d.id);return i.jsxs("g",{children:[i.jsx("rect",{className:"af-md-mermaid-box",x:p.x,y:p.y,width:r,height:s,rx:"8"}),i.jsx("text",{className:"af-md-mermaid-text",x:p.x+r/2,y:p.y+s/2+5,textAnchor:"middle",children:d.label.slice(0,24)})]},d.id)})]})}function TK(e){const t=String(e||"").split(/\r?\n/).map(o=>o.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[],s=(o,a="")=>{const l=String(o||"").trim();l&&(n.has(l)||n.set(l,a||l))};for(const o of t){if(/^sequenceDiagram\b/i.test(o))continue;const a=o.match(/^(participant|actor)\s+([A-Za-z0-9_]+)(?:\s+as\s+(.+))?$/i);if(a){s(a[2],a[3]||a[2]);continue}const l=o.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=o.match(/^note\s+(?:over|right of|left of)\s+([^:]+):\s*(.+)$/i);r.push({type:"note",text:c?c[2]:o})}return{participants:Array.from(n,([o,a])=>({id:o,label:a})),rows:r}}function MK({code:e}){const t=m.useMemo(()=>TK(e),[e]),n=t.participants.length?t.participants:[{id:"A",label:"A"},{id:"B",label:"B"}],r=190,s=48,o=26,a=44,l=48,c=Math.max(620,s*2+n.length*r),u=Math.max(220,o+a+Math.max(1,t.rows.length)*l+34),d=p=>{const f=Math.max(0,n.findIndex(h=>h.id===p));return s+f*r+r/2};return i.jsxs("svg",{viewBox:`0 0 ${c} ${u}`,role:"img","aria-label":"Mermaid sequence diagram preview",children:[i.jsx("defs",{children:i.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:i.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),n.map((p,f)=>{const h=s+f*r+r/2;return i.jsxs("g",{children:[i.jsx("rect",{className:"af-md-mermaid-box",x:h-68,y:o,width:"136",height:"34",rx:"8"}),i.jsx("text",{className:"af-md-mermaid-text",x:h,y:o+22,textAnchor:"middle",children:p.label.slice(0,18)}),i.jsx("line",{className:"af-md-sequence-life",x1:h,y1:o+a,x2:h,y2:u-18})]},p.id)}),t.rows.map((p,f)=>{const h=o+a+f*l+24;if(p.type!=="message")return i.jsxs("g",{children:[i.jsx("rect",{className:"af-md-sequence-note",x:s,y:h-17,width:c-s*2,height:"30",rx:"7"}),i.jsx("text",{className:"af-md-mermaid-text",x:s+12,y:h+4,children:p.text.slice(0,120)})]},`note-${f}`);const g=d(p.from),k=d(p.to),b=(g+k)/2;return i.jsxs("g",{children:[i.jsx("line",{className:"af-md-mermaid-edge",x1:g,y1:h,x2:k,y2:h,markerEnd:"url(#af-md-sequence-arrow)"}),i.jsx("text",{className:"af-md-sequence-label",x:b,y:h-8,textAnchor:"middle",children:p.text.slice(0,72)})]},`msg-${f}`)})]})}function MR({code:e}){const t=String(e||"").trim();if(!t)return null;const n=/^sequenceDiagram\b/i.test(t);return i.jsx("div",{className:"af-md-mermaid-preview",children:n?i.jsx(MK,{code:t}):i.jsx(RK,{code:t})})}function $K(e){const t=String(e||"").replace(/\r\n/g,`
|
|
80
|
-
`).split(`
|
|
81
|
-
`),n=[];let r=[],s=!1;const o=()=>{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){o();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&&PK(l)){o();const u=[];for(;a<t.length;){const d=t[a]||"";if(u.length>0&&(!d.trim()||/^-{3,}\s*$/.test(d)||/^#{1,6}\s+/.test(d)))break;u.push(d),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&&qi(l).length>1&&RR(t[a+1])){o();const u=qi(l),d=TR(t[a+1]),p=[];for(a+=2;a<t.length&&t[a].trim()&&qi(t[a]).length>1;)p.push(IR(qi(t[a]),u.length)),a++;n.push({type:"table",headers:u,align:d,rows:p});continue}r.push(l),a++}return o(),n}function _1(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),o=[];for(const a of s)if(a!=="."){if(a===".."){if(o.length===0)return n;o.pop();continue}o.push(a)}return o.join("/")}function $R(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="",o=0,a=!1;for(;o<r.length;){const l=r[o];if(l==="`"){a=!a,s+=l,o+=1;continue}if(!(!a&&/^https?:\/\//i.test(r.slice(o)))){s+=l,o+=1;continue}if((o>0?r[o-1]:"")==="("){s+=l,o+=1;continue}let d=o;for(;d<r.length&&!/\s|<|>/.test(r[d]);)d+=1;let p=r.slice(o,d),f="";for(;/[.,;:!?)}\]]$/.test(p);)f=p.slice(-1)+f,p=p.slice(0,-1);p?s+=`[${p}](${p})${f}`:s+=r.slice(o,d),o=d}return s}).join(`
|
|
87
|
-
`)}function LR(e,t=!1,n=""){const r=o=>{const a=String(o||"").trim();if(!a)return"";if(/^(?:https?:|data:|blob:|file:|javascript:|mailto:|tel:)/i.test(a)||a.startsWith("#"))return a;const l=_1(a,n);return e?e(l,{kind:"link",download:!0}):l},s=(o,a)=>{const l=r(a);!l||l.startsWith("#")||/^(?:javascript):/i.test(l)||(o.stopPropagation(),!(o.defaultPrevented||o.button!==0)&&(o.preventDefault(),window.open(l,"_blank","noopener,noreferrer")))};return{...t?{p:({children:o})=>i.jsx(i.Fragment,{children:o})}:{},code:({inline:o,className:a,children:l})=>{var d;const c=((d=String(a||"").match(/language-(\w+)/i))==null?void 0:d[1])||"",u=String(l||"").replace(/\n$/,"");return!o&&/^(mermaid|mmd)$/i.test(c)?i.jsx(MR,{code:u}):o?i.jsx("code",{className:a,children:l}):i.jsx("code",{className:a,children:l})},img:({src:o,alt:a})=>i.jsx("img",{src:e?e(_1(o,n)):o||"",alt:a||"",loading:"lazy"}),a:({href:o,children:a})=>i.jsx("a",{href:r(o),target:"_blank",rel:"noopener noreferrer",onClick:l=>s(l,o),children:a})}}function E1({children:e,resolveSrc:t,basePath:n=""}){return i.jsx(PR,{components:LR(t,!0,n),children:$R(e)})}function Bk({content:e,resolveSrc:t,basePath:n=""}){const r=m.useMemo(()=>$K(e),[e]),s=m.useMemo(()=>LR(t,!1,n),[n,t]);return i.jsx(i.Fragment,{children:r.map((o,a)=>o.type==="mermaid"?i.jsx(MR,{code:o.text},`mermaid-${a}`):o.type!=="table"?i.jsx(PR,{components:s,children:$R(o.text)},`md-${a}`):i.jsx("div",{className:"af-work-display-table-wrap",children:i.jsxs("table",{className:"af-work-display-table",children:[i.jsx("thead",{children:i.jsx("tr",{children:o.headers.map((l,c)=>i.jsx("th",{style:{textAlign:o.align[c]||"left"},children:i.jsx(E1,{resolveSrc:t,basePath:n,children:l})},c))})}),i.jsx("tbody",{children:o.rows.map((l,c)=>i.jsx("tr",{children:o.headers.map((u,d)=>i.jsx("td",{style:{textAlign:o.align[d]||"left"},children:i.jsx(E1,{resolveSrc:t,basePath:n,children:l[d]||""})},d))},c))})]})},`table-${a}`))})}function LK(e,t=","){const n=[];let r=[],s="",o=!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(o){c==='"'&&u==='"'?(s+='"',l+=1):c==='"'?o=!1:s+=c;continue}c==='"'?o=!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 ci(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 OK(e){if(Array.isArray(e)){if(e.every(s=>s&&typeof s=="object"&&!Array.isArray(s))){const s=Array.from(new Set(e.flatMap(o=>Object.keys(o))));return{columns:s.map(o=>({key:o,label:o,align:"left"})),rows:e.map(o=>s.map(a=>ci(o[a])))}}if(e.every(Array.isArray)&&e.length>0){const s=e[0].map((o,a)=>ci(o)||`Column ${a+1}`);return{columns:s.map((o,a)=>({key:String(a),label:o,align:"left"})),rows:e.slice(1).map(o=>s.map((a,l)=>ci(o[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,o)=>s&&typeof s=="object"?{key:String(s.key||s.name||s.field||o),label:String(s.label||s.title||s.name||s.key||`Column ${o+1}`),align:["left","center","right"].includes(s.align)?s.align:"left"}:{key:String(o),label:ci(s)||`Column ${o+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,o)=>({key:String(o),label:ci(s)||`Column ${o+1}`,align:"left"})),{columns:r,rows:n.slice(1).map(s=>r.map((o,a)=>ci(s[a])))}):{columns:r,rows:n.map(s=>Array.isArray(s)?r.map((o,a)=>ci(s[a])):s&&typeof s=="object"?r.map(o=>ci(s[o.key])):r.map((o,a)=>a===0?ci(s):""))}}function DK(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=OK(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&&qi(s[0]).length>1&&RR(s[1])){const l=qi(s[0]),c=TR(s[1]);return{columns:l.map((u,d)=>({key:String(d),label:u,align:c[d]||"left"})),rows:s.slice(2).map(u=>IR(qi(u),l.length)),error:""}}const o=r.includes(" ")?" ":",",a=LK(r,o);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 Hk({content:e}){const t=m.useMemo(()=>DK(e),[e]);return t.error||t.columns.length===0?i.jsxs("div",{className:"af-work-display-table-empty",children:[i.jsx("strong",{children:"Table data error"}),i.jsx("span",{children:t.error||"No columns found"})]}):i.jsx("div",{className:"af-work-display-table-wrap af-work-display-table-wrap--standalone",children:i.jsxs("table",{className:"af-work-display-table",children:[i.jsx("thead",{children:i.jsx("tr",{children:t.columns.map((n,r)=>i.jsx("th",{style:{textAlign:n.align||"left"},children:n.label},`${n.key}-${r}`))})}),i.jsx("tbody",{children:t.rows.map((n,r)=>i.jsx("tr",{children:t.columns.map((s,o)=>i.jsx("td",{style:{textAlign:s.align||"left"},children:ci(n[o])},`${s.key}-${o}`))},r))})]})})}function Wk({content:e}){const t=m.useRef(null),n=m.useMemo(()=>EK(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 o=!1,a=null,l=null,c=null;return s({loading:!0,error:""}),AW(()=>import("./index-DgQRkS4v.js"),[]).then(u=>{o||!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),o||s({loading:!1,error:""}))}).catch(u=>{o||s({loading:!1,error:String((u==null?void 0:u.message)||u)})}),()=>{var u,d;o=!0,c&&window.removeEventListener("resize",c),(u=l==null?void 0:l.disconnect)==null||u.call(l),(d=a==null?void 0:a.dispose)==null||d.call(a)}},[n]),!n.ok||r.error?i.jsxs("div",{className:"af-work-display-chart-error",children:[i.jsx("strong",{children:"Chart configuration error"}),i.jsx("span",{children:r.error||n.error})]}):i.jsxs("div",{className:"af-work-display-chart",children:[i.jsx("div",{ref:t,className:"af-work-display-chart__canvas"}),r.loading?i.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 OR(e){return typeof e>"u"||e===null}function FK(e){return typeof e=="object"&&e!==null}function zK(e){return Array.isArray(e)?e:OR(e)?[]:[e]}function BK(e,t){var n,r,s,o;if(t)for(o=Object.keys(t),n=0,r=o.length;n<r;n+=1)s=o[n],e[s]=t[s];return e}function HK(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function WK(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var VK=OR,KK=FK,qK=zK,UK=HK,YK=WK,GK=BK,Vk={isNothing:VK,isObject:KK,toArray:qK,repeat:UK,isNegativeZero:YK,extend:GK};function DR(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 Id(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=DR(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Id.prototype=Object.create(Error.prototype);Id.prototype.constructor=Id;Id.prototype.toString=function(t){return this.name+": "+DR(this,t)};var va=Id,JK=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],XK=["scalar","sequence","mapping"];function QK(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function ZK(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(JK.indexOf(n)===-1)throw new va('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=QK(t.styleAliases||null),XK.indexOf(this.kind)===-1)throw new va('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var Sr=ZK;function A1(e,t){var n=[];return e[t].forEach(function(r){var s=n.length;n.forEach(function(o,a){o.tag===r.tag&&o.kind===r.kind&&o.multi===r.multi&&(s=a)}),n[s]=r}),n}function e7(){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 zx(e){return this.extend(e)}zx.prototype.extend=function(t){var n=[],r=[];if(t instanceof Sr)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 va("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(o){if(!(o instanceof Sr))throw new va("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(o.loadKind&&o.loadKind!=="scalar")throw new va("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(o.multi)throw new va("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(o){if(!(o instanceof Sr))throw new va("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var s=Object.create(zx.prototype);return s.implicit=(this.implicit||[]).concat(n),s.explicit=(this.explicit||[]).concat(r),s.compiledImplicit=A1(s,"implicit"),s.compiledExplicit=A1(s,"explicit"),s.compiledTypeMap=e7(s.compiledImplicit,s.compiledExplicit),s};var t7=zx,n7=new Sr("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),r7=new Sr("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),s7=new Sr("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),i7=new t7({explicit:[n7,r7,s7]});function o7(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function a7(){return null}function l7(e){return e===null}var c7=new Sr("tag:yaml.org,2002:null",{kind:"scalar",resolve:o7,construct:a7,predicate:l7,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function u7(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 d7(e){return e==="true"||e==="True"||e==="TRUE"}function f7(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var p7=new Sr("tag:yaml.org,2002:bool",{kind:"scalar",resolve:u7,construct:d7,predicate:f7,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 h7(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function m7(e){return 48<=e&&e<=55}function g7(e){return 48<=e&&e<=57}function y7(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(!h7(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}if(s==="o"){for(n++;n<t;n++)if(s=e[n],s!=="_"){if(!m7(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}}if(s==="_")return!1;for(;n<t;n++)if(s=e[n],s!=="_"){if(!g7(e.charCodeAt(n)))return!1;r=!0}return!(!r||s==="_")}function w7(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 x7(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!Vk.isNegativeZero(e)}var b7=new Sr("tag:yaml.org,2002:int",{kind:"scalar",resolve:y7,construct:w7,predicate:x7,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"]}}),k7=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function v7(e){return!(e===null||!k7.test(e)||e[e.length-1]==="_")}function S7(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 N7=/^[-+]?[0-9]+e/;function j7(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(Vk.isNegativeZero(e))return"-0.0";return n=e.toString(10),N7.test(n)?n.replace("e",".e"):n}function C7(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||Vk.isNegativeZero(e))}var _7=new Sr("tag:yaml.org,2002:float",{kind:"scalar",resolve:v7,construct:S7,predicate:C7,represent:j7,defaultStyle:"lowercase"}),E7=i7.extend({implicit:[c7,p7,b7,_7]}),A7=E7,FR=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),zR=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 P7(e){return e===null?!1:FR.exec(e)!==null||zR.exec(e)!==null}function I7(e){var t,n,r,s,o,a,l,c=0,u=null,d,p,f;if(t=FR.exec(e),t===null&&(t=zR.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(o=+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]&&(d=+t[10],p=+(t[11]||0),u=(d*60+p)*6e4,t[9]==="-"&&(u=-u)),f=new Date(Date.UTC(n,r,s,o,a,l,c)),u&&f.setTime(f.getTime()-u),f}function R7(e){return e.toISOString()}var T7=new Sr("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:P7,construct:I7,instanceOf:Date,represent:R7});function M7(e){return e==="<<"||e===null}var $7=new Sr("tag:yaml.org,2002:merge",{kind:"scalar",resolve:M7}),Kk=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
94
|
-
\r`;function L7(e){if(e===null)return!1;var t,n,r=0,s=e.length,o=Kk;for(n=0;n<s;n++)if(t=o.indexOf(e.charAt(n)),!(t>64)){if(t<0)return!1;r+=6}return r%8===0}function O7(e){var t,n,r=e.replace(/[\r\n=]/g,""),s=r.length,o=Kk,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|o.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 D7(e){var t="",n=0,r,s,o=e.length,a=Kk;for(r=0;r<o;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=o%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 F7(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var z7=new Sr("tag:yaml.org,2002:binary",{kind:"scalar",resolve:L7,construct:O7,predicate:F7,represent:D7}),B7=Object.prototype.hasOwnProperty,H7=Object.prototype.toString;function W7(e){if(e===null)return!0;var t=[],n,r,s,o,a,l=e;for(n=0,r=l.length;n<r;n+=1){if(s=l[n],a=!1,H7.call(s)!=="[object Object]")return!1;for(o in s)if(B7.call(s,o))if(!a)a=!0;else return!1;if(!a)return!1;if(t.indexOf(o)===-1)t.push(o);else return!1}return!0}function V7(e){return e!==null?e:[]}var K7=new Sr("tag:yaml.org,2002:omap",{kind:"sequence",resolve:W7,construct:V7}),q7=Object.prototype.toString;function U7(e){if(e===null)return!0;var t,n,r,s,o,a=e;for(o=new Array(a.length),t=0,n=a.length;t<n;t+=1){if(r=a[t],q7.call(r)!=="[object Object]"||(s=Object.keys(r),s.length!==1))return!1;o[t]=[s[0],r[s[0]]]}return!0}function Y7(e){if(e===null)return[];var t,n,r,s,o,a=e;for(o=new Array(a.length),t=0,n=a.length;t<n;t+=1)r=a[t],s=Object.keys(r),o[t]=[s[0],r[s[0]]];return o}var G7=new Sr("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:U7,construct:Y7}),J7=Object.prototype.hasOwnProperty;function X7(e){if(e===null)return!0;var t,n=e;for(t in n)if(J7.call(n,t)&&n[t]!==null)return!1;return!0}function Q7(e){return e!==null?e:{}}var Z7=new Sr("tag:yaml.org,2002:set",{kind:"mapping",resolve:X7,construct:Q7});A7.extend({implicit:[T7,$7],explicit:[z7,K7,G7,Z7]});function P1(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 eq=new Array(256),tq=new Array(256);for(var _l=0;_l<256;_l++)eq[_l]=P1(_l)?1:0,tq[_l]=P1(_l);const Rd=["requirement","planning","code","test","normal"],I1={普通:"normal",技术规划:"planning",代码执行:"code",测试回归:"test",需求拆解:"requirement"};function qk(e,t){var s,o,a,l,c,u,d,p,f,h,g,k,b,y;const n=v=>{const w={type:(v==null?void 0:v.type)??"node",name:(v==null?void 0:v.name)??"",value:(v==null?void 0:v.value)??(v==null?void 0:v.default)??""};return(v==null?void 0:v.required)===!0&&(w.required=!0),(v==null?void 0:v.description)!=null&&String(v.description).trim()&&(w.description=String(v.description)),(v==null?void 0:v.showOnNode)!=null&&(w.showOnNode=!!v.showOnNode),w},r={};for(const v of e){if((s=v==null?void 0:v.data)!=null&&s.isWorkspaceGroup)continue;const w=t[v.id]&&typeof t[v.id]=="object"?{...t[v.id]}:{},C=((o=v.data)==null?void 0:o.definitionId)||v.id,N=((a=v.data)==null?void 0:a.inputs)??[],j=((l=v.data)==null?void 0:l.outputs)??[],A=((c=v.data)==null?void 0:c.role)!=null?String(v.data.role).trim():"",I=w.role!=null?String(w.role).trim():"",D=I1[A]||A,B=I1[I]||I,W=Rd.includes(D)?D:Rd.includes(B)?B:"normal",F=Array.isArray(N)?N.map(n):Array.isArray(w.input)?w.input.map(ce=>n(ce)):[],T=Array.isArray(j)?j.map(n):Array.isArray(w.output)?w.output.map(ce=>n(ce)):[],M=((u=v.data)==null?void 0:u.label)!=null?String(v.data.label):w.label!=null?String(w.label):v.id,q=(d=v.data)==null?void 0:d.body,H=q!=null?String(q):w.body!=null?String(w.body):"";let L=((p=v.data)==null?void 0:p.model)!=null&&String(v.data.model).trim()!==""?String(v.data.model).trim():w.model!=null&&String(w.model).trim()!==""?String(w.model).trim():void 0;(L===""||L==="default")&&(L=void 0);const R={...w,definitionId:C,label:M,role:W,model:L,input:F,output:T},z=((f=v.data)==null?void 0:f.marketplaceRef)||w.marketplaceRef;z?R.marketplaceRef=String(z):delete R.marketplaceRef;const E=((h=v.data)==null?void 0:h.marketplacePackageId)||w.marketplacePackageId;E?R.marketplacePackageId=String(E):delete R.marketplacePackageId;const Q=((g=v.data)==null?void 0:g.marketplaceVersion)||w.marketplaceVersion;Q?R.marketplaceVersion=String(Q):delete R.marketplaceVersion,C.startsWith("provide_")||H.trim()===""?delete R.body:R.body=H;const V=Array.isArray((k=v.data)==null?void 0:k.images)?v.data.images:Array.isArray(w.images)?w.images:[];V.length>0?R.images=V:delete R.images;const $=(b=v.data)==null?void 0:b.script,ne=$!=null?String($):w.script!=null?String(w.script):"";ne.trim()===""?delete R.script:R.script=ne;for(const ce of["scriptRef","implementationRef","implementationMode"]){const X=(y=v.data)==null?void 0:y[ce],re=X!=null?String(X):w[ce]!=null?String(w[ce]):"";re.trim()===""?delete R[ce]:R[ce]=re.trim()}delete R.temperature,delete R.maxTokens,delete R.description,r[v.id]=R}return r}function Zu(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function nq(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 rq(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)),o=(t||[]).filter(a=>s.has(a.source)&&s.has(a.target));return{version:1,nodes:r.map(a=>Zu(a)),edges:o.map(a=>Zu(a)),instances:qk(r,n||{})}}function sq(e,t,n,r,s={}){var p;if(!e||!Array.isArray(e.nodes)||e.nodes.length===0)return null;const o=s.offset||{x:48,y:48},a=new Set((t||[]).map(f=>f.id)),l=new Map;for(const f of e.nodes)l.set(f.id,nq(f.id,a));const c=e.nodes.map(f=>{var g,k;const h=l.get(f.id);return{...Zu(f),id:h,selected:!0,dragging:!1,position:{x:Number(((g=f.position)==null?void 0:g.x)||0)+o.x,y:Number(((k=f.position)==null?void 0:k.y)||0)+o.y}}}),u=(e.edges||[]).filter(f=>l.has(f.source)&&l.has(f.target)).map((f,h)=>{const g=l.get(f.source),k=l.get(f.target);return{...Zu(f),id:`e-${g}-${k}-${Date.now()}-${h}`,source:g,target:k,selected:!1}}),d={...r||{}};for(const[f,h]of l.entries()){const g=(p=e.instances)==null?void 0:p[f];g&&(d[h]={...Zu(g),label:g.label!=null?String(g.label):h})}return{nodes:[...(t||[]).map(f=>({...f,selected:!1})),...c],edges:[...(n||[]).map(f=>({...f,selected:!1})),...u],instances:d,pastedNodeIds:c.map(f=>f.id)}}function En(e){switch(Kh(e)){case"text":return"#2196f3";case"file":return"#4caf50";case"node":return"#ff9800";case"bool":return"#9c27b0";default:return"#9e9e9e"}}function Kh(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 iq(e,t){const n=Kh(e),r=Kh(t);return!n||!r?!1:n==="any"||r==="any"?!0:n===r}const oq=new Set(["knowledgeContext","workspaceContext","skillsContext","mcpContext"]);function Bx(e){const t=Kh(e==null?void 0:e.type),n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim();return t==="text"&&oq.has(n)?`${t}+${n}`:t}function aq(e){return Bx(e)}function Td(e,t){if(!e||!t||!iq(e.type,t.type))return!1;const n=Bx(e),r=Bx(t),s=n.includes("+"),o=r.includes("+");return s||o?n===r:!0}function lq(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 Hx(e,t,n){var l;const r=n==="source"?"outputs":"inputs",o=lq(t,n==="source"?"output":"input");return o<0?null:(Array.isArray((l=e==null?void 0:e.data)==null?void 0:l[r])?e.data[r]:[])[o]||null}const qh=/\[image\s+(\d+)\]/gi;function ao(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 cq(e){return`image ${ao(e).length+1}`}function uq(e,t){const n=String(e||""),r=`[${t}]`;return n.trim()?`${n.replace(/[ \t]+$/u,"")} ${r}`:r}function dq(e,t){const n=ao(e),r=String(t||""),s=new Set;qh.lastIndex=0;let o;for(;o=qh.exec(r);)s.add(`image ${o[1]}`.toLowerCase());return s.size===0?[]:n.filter(a=>s.has(String(a.label||"").toLowerCase()))}function fq(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 BR(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 ed(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 HR({files:e,body:t,images:n}){const r=Array.from(e||[]);if(r.length===0)return null;let s=String(t||"");const o=ao(n);for(const a of r){const l=await fq(a),c=cq(o);o.push({id:`${Date.now().toString(36)}-${o.length+1}`,label:c,...l}),s=uq(s,c)}return{body:s,images:o}}function ws(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function pq(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 hq(e){return["true","1","yes","on"].includes(String((e==null?void 0:e.value)??(e==null?void 0:e.default)??"").trim().toLowerCase())}function Gt(e){e.stopPropagation()}function mq(e){return String(e||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function gq(e,t){const n=`\\[${mq(t)}\\]`;return String(e||"").replace(new RegExp(`[ \\t]*${n}`,"gi"),"").replace(/[ \t]+\n/g,`
|
|
96
|
-
`).replace(/\n{3,}/g,`
|
|
97
|
-
|
|
98
|
-
`).trimEnd()}function By(e){return String(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function yq(e){const t=String(e||"");let n="",r=0;qh.lastIndex=0;let s;for(;s=qh.exec(t);)n+=By(t.slice(r,s.index)),n+=`<span class="af-flow-node__image-token">${By(s[0])}</span>`,r=s.index+s[0].length;return n+=By(t.slice(r)),n||" "}function wq(e,t){const n=window.getComputedStyle(e),r=Number.parseFloat(n.lineHeight)||18,s=Number.parseFloat(n.paddingTop)||0,o=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+o+a+l)}function xq({data:e,selected:t,id:n,deleteNode:r,onProvideExpand:s,onProvideValueChange:o,onNodeBodyChange:a,onNodeImagesChange:l,modelLists:c,onModelChange:u}){var ur,Wt;const{t:d}=Lr(),p=(e==null?void 0:e.inputs)??[],f=(e==null?void 0:e.outputs)??[],h=((e==null?void 0:e.schemaType)??"agent").toLowerCase(),g=pq(e),k=(e==null?void 0:e.isRunMode)??!1,b=!!(e!=null&&e.readOnly),y=(e==null?void 0:e.isExecuting)??!1,v=(e==null?void 0:e.isDim)??!1,w=(e==null?void 0:e.nodeStatus)??null,C=(e==null?void 0:e.nodeElapsed)??null,N=(e==null?void 0:e.definitionId)||"",j=N.startsWith("provide_"),A=N==="provide_bool",I=N==="provide_str",D=N==="provide_file",B=N==="provide_password",W=N==="agent_subAgent",F=N==="control_agent_toBool",T=(W||F)&&!k,M=A?hq(f[0]):!1,q=j?String(((ur=f[0])==null?void 0:ur.value)??((Wt=f[0])==null?void 0:Wt.default)??(e==null?void 0:e.body)??""):"",H=String((e==null?void 0:e.body)||""),L=(e==null?void 0:e.displayLabel)||(e==null?void 0:e.label)||d("flow:node.fallbackLabel"),R=!j&&!T&&(e!=null&&e.showBodyPreview)?String((e==null?void 0:e.body)||"").trim():"",z=ao(e==null?void 0:e.images),E=A||I||D||B||T||!!R,Q=m.useRef(!1),V=m.useRef(!1),$=m.useRef(null),ne=m.useRef(null),ce=m.useRef(null),X=m.useRef(null),re=m.useRef(null),[Z,ie]=m.useState(q),[te,ue]=m.useState(!1),[fe,be]=m.useState(H),[qe,Ue]=m.useState(!1),[Me,rt]=m.useState({visible:!1,top:0,height:100}),[gt,bt]=m.useState(!1),oe=m.useCallback(()=>{const ae=ne.current;if(!ae)return;const ke=Math.max(1,ae.scrollHeight),ot=Math.max(1,ae.clientHeight),xt=ke>ot+1,xn=xt?Math.max(12,ot/ke*100):100,on=Math.max(0,100-xn),Jn=xt?Math.min(on,ae.scrollTop/Math.max(1,ke-ot)*on):0;rt({visible:xt,top:Jn,height:xn})},[]);m.useEffect(()=>{Q.current||ie(q)},[n,q]),m.useEffect(()=>{V.current||be(H)},[n,H]),m.useEffect(()=>{const ae=ne.current;if(!ae)return;if(T){ae.style.minHeight="",ae.style.height="",ce.current&&(ce.current.style.minHeight="",ce.current.style.height="");return}const ke=wq(ae,fe);ae.style.minHeight=`${ke}px`,ae.style.height="",ce.current&&(ce.current.style.minHeight=`${ke}px`,ce.current.style.height="")},[fe,T]),m.useEffect(()=>{if(!T)return;const ae=window.requestAnimationFrame(oe),ke=ne.current;if(!ke||typeof ResizeObserver>"u")return()=>window.cancelAnimationFrame(ae);const ot=new ResizeObserver(oe);return ot.observe(ke),()=>{window.cancelAnimationFrame(ae),ot.disconnect()}},[fe,T,oe]),m.useEffect(()=>{const ae=$.current,ke=e==null?void 0:e.onNodeContentResize;if(!T||!ae||!ke||typeof ResizeObserver>"u")return;let ot=0;const xt=()=>{window.cancelAnimationFrame(ot),ot=window.requestAnimationFrame(()=>ke(n))},xn=new ResizeObserver(xt);return xn.observe(ae),xt(),()=>{window.cancelAnimationFrame(ot),xn.disconnect()}},[e==null?void 0:e.onNodeContentResize,T,n]),m.useEffect(()=>{if(!gt)return;const ae=window.setTimeout(()=>{const ke=re.current;if(!ke)return;ke.focus();const ot=ke.value.length;ke.setSelectionRange(ot,ot)},0);return()=>window.clearTimeout(ae)},[gt]);const je=Array.isArray(c==null?void 0:c.cursor)?c.cursor:[],Ve=Array.isArray(c==null?void 0:c.opencode)?c.opencode:[],tt=Array.isArray(c==null?void 0:c.claudeCode)?c.claudeCode:[],Jt=Array.isArray(c==null?void 0:c.codex)?c.codex:[],st=((e==null?void 0:e.model)??"").trim(),de=h==="agent"&&!N.startsWith("tool_nodejs"),ve=new Set(je.map(ws)),ze=new Set(Ve.map(ws)),Ze=new Set(tt.map(ws)),Se=new Set(Jt.map(ws)),Tt=st?st.startsWith("cursor:")||st.startsWith("opencode:")||st.startsWith("codex:")||st.startsWith("claude-code:")?st:Ze.has(st)?`claude-code:${st}`:Se.has(st)?`codex:${st}`:ze.has(st)?`opencode:${st}`:ve.has(st)?`cursor:${st}`:st:"",vn=st&&!Tt.startsWith("cursor:")&&!Tt.startsWith("opencode:")&&!Tt.startsWith("codex:")&&!Tt.startsWith("claude-code:")&&!ve.has(st)&&!ze.has(st)&&!Ze.has(st)&&!Se.has(st),dn=st.startsWith("cursor:")?st.slice(7):st.startsWith("opencode:")?st.slice(9):st.startsWith("codex:")?st.slice(6):st.startsWith("claude-code:")?st.slice(12):st,nn=ae=>{if(b)return;const ke=ae.target.value;u&&u(n,ke)},Sn=ae=>{ae.stopPropagation(),!b&&r&&r(n)},ee=ae=>{ae.stopPropagation(),s&&s()},Ie=ae=>{ae.stopPropagation(),!b&&(o==null||o(n,ae.target.value==="true"?"true":"false"))},Fe=ae=>{if(ae.stopPropagation(),b)return;const ke=ae.target.value;ie(ke),Q.current||o==null||o(n,ke)},Je=ae=>{ae.stopPropagation(),Q.current=!0},Pt=ae=>{if(ae.stopPropagation(),b)return;Q.current=!1;const ke=ae.currentTarget.value;ie(ke),o==null||o(n,ke)},jt=()=>{b||o==null||o(n,Z)},lr=ae=>{if(ae.stopPropagation(),b)return;if(typeof(e==null?void 0:e.onOpenProvideFilePicker)=="function"){e.onOpenProvideFilePicker(n,Z);return}const ke=window.prompt("文件路径",Z);ke!=null&&(ie(ke),o==null||o(n,ke))},rn=ae=>{ae.stopPropagation(),ue(ke=>!ke)},gr=ae=>{if(be(ae),a==null||a(n,ae),l){const ke=dq(z,ae);(ke.length!==z.length||ke.some((ot,xt)=>{var xn;return ot.id!==((xn=z[xt])==null?void 0:xn.id)}))&&l(n,ke)}},qn=ae=>{if(ae.stopPropagation(),b)return;const ke=ae.target.value;V.current?be(ke):gr(ke)},Mn=ae=>{ae.stopPropagation(),!b&&(V.current=!0,Ue(!0))},Un=ae=>{if(ae.stopPropagation(),b)return;V.current=!1,Ue(!1);const ke=ae.currentTarget.value;gr(ke)},Yn=()=>{b||(V.current=!1,Ue(!1),gr(fe))},cr=ae=>{ae.stopPropagation(),ae.preventDefault(),!b&&bt(!0)},yr=()=>{bt(!1),Yn()},Xr=ae=>{ae.stopPropagation(),ae.key==="Escape"&&(ae.preventDefault(),yr())},Gn=m.useCallback(ae=>{const ke=ne.current;if(!ke)return;const ot=Math.max(0,ke.scrollHeight-ke.clientHeight);ke.scrollTop=Math.min(1,Math.max(0,ae))*ot,oe()},[oe]),mt=m.useCallback((ae,ke=0)=>{const ot=X.current;if(!ot)return 0;const xt=ot.getBoundingClientRect(),xn=Me.height/100*xt.height,on=Math.max(1,xt.height-xn);return(ae-xt.top-ke)/on},[Me.height]),Fn=m.useCallback(ae=>{var Vt,wr;if(!Me.visible)return;ae.preventDefault(),ae.stopPropagation();const ke=X.current;if(!ke)return;const ot=ke.getBoundingClientRect(),xt=Me.top/100*ot.height,xn=Me.height/100*ot.height,Jn=ae.clientY>=ot.top+xt&&ae.clientY<=ot.top+xt+xn?ae.clientY-ot.top-xt:xn/2;Gn(mt(ae.clientY,Jn));const Qr=ae.pointerId;(wr=(Vt=ae.currentTarget).setPointerCapture)==null||wr.call(Vt,Qr);const ct=et=>{et.preventDefault(),Gn(mt(et.clientY,Jn))},qt=()=>{window.removeEventListener("pointermove",ct),window.removeEventListener("pointerup",qt),window.removeEventListener("pointercancel",qt)};window.addEventListener("pointermove",ct),window.addEventListener("pointerup",qt),window.addEventListener("pointercancel",qt)},[mt,Me.height,Me.top,Me.visible,Gn]),Ft=async ae=>{if(b)return;const ke=await HR({files:ae,body:fe,images:z});ke&&(be(ke.body),a==null||a(n,ke.body),l==null||l(n,ke.images))},fn=(ae,ke)=>{if(ae.stopPropagation(),b)return;const ot=z.filter(xn=>xn.id!==ke.id),xt=gq(fe,ke.label);be(xt),a==null||a(n,xt),l==null||l(n,ot)},zn=ae=>{if(b)return;const ke=BR(ae);ke.length!==0&&(ae.preventDefault(),ae.stopPropagation(),Ft(ke).catch(()=>{}))},ps=ae=>{if(b)return;const ke=ed(ae);ke.length!==0&&(ae.preventDefault(),ae.stopPropagation(),Ft(ke).catch(()=>{}))},ri=()=>{const ae=ne.current,ke=ce.current;!ae||!ke||(ke.scrollTop=ae.scrollTop,ke.scrollLeft=ae.scrollLeft)};return i.jsxs("div",{className:"af-flow-node"+(t?" af-flow-node--selected":"")+(y?" af-flow-node--executing":"")+(w==="success"?" af-flow-node--done":"")+(w==="failed"?" af-flow-node--failed":"")+(w==="running"&&!y?" af-flow-node--running-disk":"")+(v?" af-flow-node--dim":"")+(T?" af-flow-node--inline-body-editor":"")+(I?" af-flow-node--provide-text":"")+(B?" af-flow-node--provide-password":"")+" af-flow-node--"+h.replace(/[^a-z0-9_-]/g,""),"data-schema":h,children:[i.jsxs("div",{className:"af-flow-node__chrome",children:[i.jsx("span",{className:"af-flow-node__title af-flow-node__title--chrome",title:`${L}${n?` (${n})`:""}${g?` · ${g}`:""}`,children:L}),!k&&de&&i.jsxs("div",{className:"af-flow-node__model-wrap nodrag",onPointerDown:Gt,onMouseDown:Gt,onClick:Gt,children:[i.jsxs("select",{className:"af-flow-node__model nodrag",value:Tt,onChange:nn,onPointerDown:Gt,onMouseDown:Gt,onClick:Gt,"aria-label":d("flow:node.model"),title:dn||d("flow:node.defaultModel"),disabled:b,children:[i.jsx("option",{value:"",children:d("flow:node.defaultModel")}),vn&&i.jsx("option",{value:st,children:st}),je.length>0&&i.jsx("optgroup",{label:"Cursor",children:je.map(ae=>i.jsx("option",{value:`cursor:${ws(ae)}`,children:ws(ae)},`c-${ae}`))}),Ve.length>0&&i.jsx("optgroup",{label:"OpenCode",children:Ve.map(ae=>i.jsx("option",{value:`opencode:${ws(ae)}`,children:ws(ae)},`o-${ae}`))}),Jt.length>0&&i.jsx("optgroup",{label:"Codex",children:Jt.map(ae=>i.jsx("option",{value:`codex:${ws(ae)}`,children:ws(ae)},`codex-${ae}`))}),tt.length>0&&i.jsx("optgroup",{label:"Claude Code",children:tt.map(ae=>i.jsx("option",{value:`claude-code:${ws(ae)}`,children:ws(ae)},`cc-${ae}`))})]}),i.jsx("span",{className:"af-flow-node__model-arrow material-symbols-outlined",children:"expand_more"})]}),y&&i.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--executing",children:"EXECUTING"}),w==="running"&&!y&&i.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--running-disk",title:d("flow:node.diskRunning"),children:"RUNNING"}),w==="success"&&i.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--done",children:C!=null&&String(C).trim()!==""?C:"--"}),w==="failed"&&i.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--failed",children:"FAILED"}),!k&&j&&!A&&!I&&!D&&!B&&i.jsx("button",{type:"button",className:"af-flow-node__expand",onClick:ee,"aria-label":d("flow:node.expandProvide"),title:d("flow:node.expandProvide"),children:i.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),!k&&i.jsx("button",{type:"button",className:"af-flow-node__delete",disabled:b,onClick:Sn,"aria-label":d("flow:node.deleteNode"),title:d("flow:node.deleteNode"),children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),i.jsxs("div",{className:"af-flow-node__body",children:[i.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--in",children:p.map((ae,ke)=>{if(ae.showOnNode===!1)return null;const ot=d("flow:node.inputTooltip",{name:ae.name||`#${ke}`,type:ae.type})+(ae.default!=null&&ae.default!==""?d("flow:node.defaultSuffix",{value:ae.default}):""),xt=ae.name||`#${ke+1}`;return i.jsxs("div",{className:"af-flow-node__port-row",title:ot,children:[i.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--in",children:[xt,ae.required?i.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),i.jsx(Vn,{type:"target",position:Ke.Left,id:`input-${ke}`,className:"af-flow-node__handle",style:{background:En(ae.type)},title:ot})]},`in-${ke}`)})}),i.jsxs("div",{className:"af-flow-node__title-wrap",children:[A?i.jsxs("select",{className:"af-flow-node__bool-select nodrag"+(M?" af-flow-node__bool-select--true":""),value:M?"true":"false",onChange:Ie,onPointerDown:Gt,onMouseDown:Gt,onClick:Gt,"aria-label":"Boolean value",title:M?"true":"false",disabled:b,children:[i.jsx("option",{value:"false",children:"false"}),i.jsx("option",{value:"true",children:"true"})]}):I?i.jsx("textarea",{className:"af-flow-node__inline-text nodrag",value:Z,onChange:Fe,onCompositionStart:Je,onCompositionEnd:Pt,onBlur:jt,onPointerDown:Gt,onMouseDown:Gt,onClick:Gt,placeholder:"输入文本",rows:2,readOnly:b}):D?i.jsxs("div",{className:"af-flow-node__file-value nodrag",onPointerDown:Gt,onMouseDown:Gt,onClick:Gt,children:[i.jsx("input",{className:"af-flow-node__file-input nodrag",value:Z,onChange:Fe,onCompositionStart:Je,onCompositionEnd:Pt,onBlur:jt,placeholder:"选择或输入文件路径",title:Z||"选择或输入文件路径",readOnly:b}),i.jsx("button",{type:"button",className:"af-flow-node__file-picker nodrag",disabled:b,onClick:lr,"aria-label":"选择文件",title:"选择文件",children:i.jsx("span",{className:"material-symbols-outlined",children:"folder_open"})})]}):B?i.jsxs("div",{className:"af-flow-node__password-value nodrag",onPointerDown:Gt,onMouseDown:Gt,onClick:Gt,children:[i.jsx("input",{className:"af-flow-node__password-input nodrag",type:te?"text":"password",value:Z,onChange:Fe,onCompositionStart:Je,onCompositionEnd:Pt,onBlur:jt,placeholder:"输入密码或密钥",title:te?Z:"密码已隐藏",autoComplete:"off",readOnly:b}),i.jsx("button",{type:"button",className:"af-flow-node__password-toggle nodrag",disabled:b,onClick:rn,"aria-label":te?"隐藏密码":"预览密码",title:te?"隐藏密码":"预览密码",children:i.jsx("span",{className:"material-symbols-outlined",children:te?"visibility_off":"visibility"})})]}):T?i.jsxs("div",{ref:$,className:"af-flow-node__prompt-stack nodrag"+(qe?" af-flow-node__prompt-stack--composing":""),children:[i.jsx("pre",{ref:ce,className:"af-flow-node__prompt-backdrop","aria-hidden":"true",dangerouslySetInnerHTML:{__html:yq(fe)+`
|
|
99
|
-
`}}),i.jsx("textarea",{ref:ne,className:"af-flow-node__prompt-editor nodrag",value:fe,onChange:qn,onCompositionStart:Mn,onCompositionEnd:Un,onBlur:Yn,onPaste:zn,onDrop:ps,onScroll:ae=>{ri(),oe()},onPointerDown:Gt,onMouseDown:Gt,onClick:Gt,onKeyDown:Gt,onDragOver:ae=>{ed(ae).length>0&&ae.preventDefault()},placeholder:F?"输入判断条件 / prompt":"输入 prompt",rows:2,readOnly:b}),!b&&i.jsx("button",{type:"button",className:"af-flow-node__prompt-expand nodrag",onPointerDown:Gt,onMouseDown:Gt,onClick:cr,"aria-label":"放大编辑",title:"放大编辑",children:i.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),i.jsx("div",{ref:X,className:"af-flow-node__prompt-scrollbar"+(Me.visible?" af-flow-node__prompt-scrollbar--visible":""),onPointerDown:Fn,"aria-hidden":"true",children:i.jsx("span",{style:{height:`${Me.height}%`,top:`${Me.top}%`}})})]}):null,T&&z.length>0?i.jsx("div",{className:"af-flow-node__image-chips",children:z.map((ae,ke)=>i.jsxs("span",{className:"af-flow-node__image-chip",title:ae.name,children:[i.jsx("img",{src:ae.dataUrl,alt:""}),i.jsxs("span",{children:["[",ae.label||`image ${ke+1}`,"]"]}),i.jsx("button",{type:"button",className:"af-flow-node__image-remove nodrag",disabled:b,onClick:ot=>fn(ot,ae),onPointerDown:Gt,onMouseDown:Gt,"aria-label":`删除 ${ae.label||`image ${ke+1}`}`,title:"删除图片",children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},ae.id||ke))}):null,R?i.jsx("span",{className:"af-flow-node__prompt-preview",title:R,children:R}):null,E?null:i.jsx("span",{className:"af-flow-node__body-title",title:L,children:L})]}),i.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--out",children:f.map((ae,ke)=>{if(ae.showOnNode===!1)return null;const ot=d("flow:node.outputTooltip",{name:ae.name||`#${ke}`,type:ae.type})+(ae.default!=null&&ae.default!==""?d("flow:node.defaultSuffix",{value:ae.default}):""),xt=ae.name||`#${ke+1}`;return i.jsxs("div",{className:"af-flow-node__port-row",title:ot,children:[i.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--out",children:[xt,ae.required?i.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),i.jsx(Vn,{type:"source",position:Ke.Right,id:`output-${ke}`,className:"af-flow-node__handle",style:{background:En(ae.type)},title:ot})]},`out-${ke}`)})})]}),gt?sr.createPortal(i.jsx("div",{className:"af-flow-node-full-editor nodrag",onPointerDown:Gt,onMouseDown:Gt,onClick:Gt,onWheel:Gt,children:i.jsxs("div",{className:"af-flow-node-full-editor__panel",children:[i.jsxs("div",{className:"af-flow-node-full-editor__header",children:[i.jsxs("div",{children:[i.jsx("div",{className:"af-flow-node-full-editor__title",children:L}),i.jsx("div",{className:"af-flow-node-full-editor__hint",children:"编辑 prompt,Esc 关闭"})]}),i.jsx("button",{type:"button",className:"af-flow-node-full-editor__close",onClick:yr,"aria-label":"关闭",title:"关闭",children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),i.jsx("textarea",{ref:re,className:"af-flow-node-full-editor__textarea",value:fe,onChange:qn,onCompositionStart:Mn,onCompositionEnd:Un,onPaste:zn,onDrop:ps,onKeyDown:Xr,onDragOver:ae=>{ed(ae).length>0&&ae.preventDefault()},placeholder:F?"输入判断条件 / prompt":"输入 prompt",readOnly:b})]})}),document.body):null]})}const lc="flowNode";function Wx(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 bq={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 kq(e,t,n){const r=String((n==null?void 0:n.displayName)||"").trim(),s=String(t||"").trim();return!r||!s||r===s?s:(bq[e]||[]).includes(s)?r:s}const vq={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"])},Sq={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"])},Nq={agent_subAgent:new Set(["knowledgeContext","skillsContext"])},jq=new Set(["display_markdown","display_mermaid","display_ascii","display_html","display_react_app","display_image","display_chart","display_table"]);function Cq(e,t){if(!jq.has(String(e||"")))return!1;const n=String((t==null?void 0:t.name)||"");return n==="content"||n==="src"}function _q(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function Eq(e,t){const n=String((e==null?void 0:e.baseDefinitionId)||"").trim();return n||t}function WR(e){const t=String(e??"");return/^[A-Za-z0-9_@%+=:,./-]+$/.test(t)?t:"'"+t.replace(/'/g,"'\\''")+"'"}function Aq(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 Pq(e){const t=String(e??"").trim();return t?t.includes("${")?t:WR(t):""}function Iq(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}`,o=Array.isArray(t.args)?t.args.map(Pq).filter(Boolean):[];return[Aq(t,n),WR(s),...o].join(" ")}return String(t.command||"").trim()}function R1(e,t,n){return!Array.isArray(t)||!Array.isArray(n)||n.length===0?t:t.map((r,s)=>{var u,d,p;const o=n[s],l=n.find(f=>(f==null?void 0:f.name)&&f.name===r.name)||o;if(!l)return r;const c=r.showOnNode===!1&&l.showOnNode==null&&((u=vq[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&&Cq(e,r)?{showOnNode:!0}:{},...(d=Nq[e])!=null&&d.has(r.name)?{showOnNode:!0}:{},...(p=Sq[e])!=null&&p.has(r.name)?{showOnNode:!1}:{}}})}function Rq(e){var s,o;const t=Array.isArray((s=e==null?void 0:e.data)==null?void 0:s.inputs)?e.data.inputs:[],n=Array.isArray((o=e==null?void 0:e.data)==null?void 0:o.outputs)?e.data.outputs:[],r=a=>a.map(l=>{const c=Wx(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 Vx(e,t,n,r,s){var R,z,E,Q,V,$,ne,ce,X,re,Z,ie,te,ue,fe,be,qe,Ue,Me,rt,gt,bt;const o=((R=e.data)==null?void 0:R.definitionId)||String(e.id).replace(/-\d+$/,""),a=n.find(oe=>oe.id===o),l=t[e.id];let c=[],u=[],d=((z=e.data)==null?void 0:z.label)??e.id,p,f,h,g,k;const b=!!l;l&&(Array.isArray(l.input)&&(c=l.input.map(Wx)),Array.isArray(l.output)&&(u=l.output.map(Wx)),l.label&&(d=String(l.label)),l.role&&typeof l.role=="string"&&(p=l.role),l.model!=null&&(f=String(l.model).trim()),l.body!=null&&(h=String(l.body)),Array.isArray(l.images)&&(g=l.images),l.script!=null&&(k=String(l.script)));const y=p??(typeof((E=e.data)==null?void 0:E.role)=="string"?e.data.role:"普通"),v=f??((Q=e.data)==null?void 0:Q.model)??void 0,w=(a==null?void 0:a.description)!=null?String(a.description).trim():"",C=w!==""?w:void 0,N=h??((V=e.data)==null?void 0:V.body)??"",j=Array.isArray(g)?g:Array.isArray(($=e.data)==null?void 0:$.images)?e.data.images:[],A=Iq(a),I=k!==void 0?k:((ne=e.data)==null?void 0:ne.script)!=null?String(e.data.script):A,D=String(e.id),B=(ce=r==null?void 0:r[s])==null?void 0:ce[D],W=(X=B==null?void 0:B.label)==null?void 0:X.label,F=B==null?void 0:B.body,T=B==null?void 0:B.description;b||(c.length===0&&((re=a==null?void 0:a.inputs)!=null&&re.length)&&(c=a.inputs.map(oe=>({...oe}))),u.length===0&&((Z=a==null?void 0:a.outputs)!=null&&Z.length)&&(u=a.outputs.map(oe=>({...oe}))));const M=Eq(a,(a==null?void 0:a.id)??o),q=(l==null?void 0:l.marketplaceRef)||((ie=e.data)==null?void 0:ie.marketplaceRef)||_q(a);if(M==="agent_subAgent"&&!u.some(oe=>(oe==null?void 0:oe.name)==="result")){const oe=(te=a==null?void 0:a.outputs)==null?void 0:te.find(je=>(je==null?void 0:je.name)==="result");u=[...u,oe?{...oe}:{type:"text",name:"result",default:""}]}if(M==="agent_subAgent"&&!c.some(oe=>(oe==null?void 0:oe.name)==="knowledgeContext")){const oe=(ue=a==null?void 0:a.inputs)==null?void 0:ue.find(je=>(je==null?void 0:je.name)==="knowledgeContext");c=[...c,oe?{...oe}:{type:"text",name:"knowledgeContext",default:"",showOnNode:!0}]}if((M==="display_markdown"||M==="display_mermaid"||M==="display_ascii"||M==="display_chart"||M==="display_table")&&!u.some(oe=>(oe==null?void 0:oe.name)==="next")){const oe=(fe=a==null?void 0:a.outputs)==null?void 0:fe.find(je=>(je==null?void 0:je.name)==="next");u=[...u,oe?{...oe}:{type:"node",name:"next",default:""}]}if(M==="workspace_run"){if(!c.some(oe=>(oe==null?void 0:oe.name)==="prev")){const oe=(be=a==null?void 0:a.inputs)==null?void 0:be.find(je=>(je==null?void 0:je.name)==="prev");c=[oe?{...oe}:{type:"node",name:"prev",default:""},...c]}if(!u.some(oe=>(oe==null?void 0:oe.name)==="next")){const oe=(qe=a==null?void 0:a.outputs)==null?void 0:qe.find(je=>(je==null?void 0:je.name)==="next");u=[...u,oe?{...oe}:{type:"node",name:"next",default:""}]}}c=R1(M,c,a==null?void 0:a.inputs),u=R1(M,u,a==null?void 0:a.outputs),M.startsWith("provide_")&&u[0]&&String(u[0].default??u[0].value??"").trim()===""&&String(N).trim()!==""&&(u=u.map((oe,je)=>je===0?{...oe,default:N,value:N}:oe));const H=kq(M,d,a),L=M==="tool_nodejs"||String(I).trim()!=="";return{...e,type:"flowNode",data:{...e.data,label:W||d,displayLabel:H,definitionDisplayName:a==null?void 0:a.displayName,definitionId:M,...q?{marketplaceRef:q}:{},...l!=null&&l.marketplacePackageId||(Ue=e.data)!=null&&Ue.marketplacePackageId||a!=null&&a.packageId?{marketplacePackageId:(l==null?void 0:l.marketplacePackageId)||((Me=e.data)==null?void 0:Me.marketplacePackageId)||(a==null?void 0:a.packageId)}:{},...l!=null&&l.marketplaceVersion||(rt=e.data)!=null&&rt.marketplaceVersion||a!=null&&a.version?{marketplaceVersion:(l==null?void 0:l.marketplaceVersion)||((gt=e.data)==null?void 0:gt.marketplaceVersion)||(a==null?void 0:a.version)}:{},schemaType:((bt=e.data)==null?void 0:bt.schemaType)??e.type??"agent",role:y,model:v,body:F||N,images:j,script:I,inputs:c,outputs:u,description:T||C,originalLabel:d,originalBody:N,...L?{script:I}:{}}}}function Tq(e,t){const n=new Map(t.map(r=>[r.id,r]));return e.filter(r=>{var d,p,f,h;const s=n.get(r.source),o=n.get(r.target),a=((p=(d=s==null?void 0:s.data)==null?void 0:d.outputs)==null?void 0:p.length)??0,l=((h=(f=o==null?void 0:o.data)==null?void 0:f.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&&o&&c>=0&&c<a&&u>=0&&u<l})}function T1(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 M1(e,t){return!Array.isArray(e)||!e[t]||e[t].showOnNode===!0?e:e.map((n,r)=>r===t?{...n,showOnNode:!0}:n)}function Hy(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=T1(t==null?void 0:t.sourceHandle,"output"),o=T1(t==null?void 0:t.targetHandle,"input");let a=!1;const l=(e||[]).map(c=>{var u,d,p,f;if(c.id===n){const h=M1((u=c.data)==null?void 0:u.outputs,s);if(h!==((d=c.data)==null?void 0:d.outputs))return a=!0,{...c,data:{...c.data,outputs:h}}}if(c.id===r){const h=M1((p=c.data)==null?void 0:p.inputs,o);if(h!==((f=c.data)==null?void 0:f.inputs))return a=!0,{...c,data:{...c.data,inputs:h}}}return c});return a?l:e}function Mq(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 $1(e){return e.key==="?"||e.key==="/"&&e.shiftKey}function $q(){return typeof navigator>"u"?!1:/Mac|iPhone|iPod|iPad/i.test(navigator.platform||navigator.userAgent||"")}function Lq({children:e}){return i.jsx("kbd",{className:"af-kbd",children:e})}function Fs({keys:e}){return i.jsx("span",{className:"af-shortcuts-keys",children:e.map((t,n)=>i.jsxs("span",{children:[n>0?i.jsx("span",{className:"af-shortcuts-keys__plus",children:"+"}):null,i.jsx(Lq,{children:t})]},n))})}function Oq({open:e,onClose:t}){const{t:n}=Lr(),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 o=$q()?"⌘":"Ctrl";return i.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:a=>{a.target===a.currentTarget&&t()},children:i.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:[i.jsxs("div",{className:"af-shortcuts-panel__head",children:[i.jsx("h2",{id:"af-shortcuts-title",className:"af-shortcuts-panel__title",children:n("flow:shortcuts.title")}),i.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":n("common:common.close"),children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),i.jsxs("div",{className:"af-shortcuts-panel__body",children:[i.jsxs("section",{className:"af-shortcuts-section",children:[i.jsx("h3",{className:"af-shortcuts-cat",children:n("flow:shortcuts.general")}),i.jsxs("ul",{className:"af-shortcuts-list",children:[i.jsxs("li",{className:"af-shortcuts-row",children:[i.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.saveDesc")}),i.jsx(Fs,{keys:[o,"S"]})]}),i.jsxs("li",{className:"af-shortcuts-row",children:[i.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.shortcutsLabel")}),i.jsx(Fs,{keys:["?"]})]}),i.jsxs("li",{className:"af-shortcuts-row",children:[i.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.jumpToNode")}),i.jsx(Fs,{keys:[o,"K"]})]}),i.jsxs("li",{className:"af-shortcuts-row",children:[i.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.openNodePalette")}),i.jsx(Fs,{keys:["A"]})]})]})]}),i.jsxs("section",{className:"af-shortcuts-section",children:[i.jsx("h3",{className:"af-shortcuts-cat",children:n("flow:shortcuts.canvas")}),i.jsxs("ul",{className:"af-shortcuts-list",children:[i.jsxs("li",{className:"af-shortcuts-row",children:[i.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectTool")}),i.jsx(Fs,{keys:["V"]})]}),i.jsxs("li",{className:"af-shortcuts-row",children:[i.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.panTool")}),i.jsx(Fs,{keys:["H"]})]}),i.jsxs("li",{className:"af-shortcuts-row",children:[i.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.holdSpacePan")}),i.jsx(Fs,{keys:["Space"]})]}),i.jsxs("li",{className:"af-shortcuts-row",children:[i.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.saveViewport")}),i.jsx(Fs,{keys:["F"]})]}),i.jsxs("li",{className:"af-shortcuts-row",children:[i.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectAll")}),i.jsx(Fs,{keys:[o,"A"]})]}),i.jsxs("li",{className:"af-shortcuts-row",children:[i.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.undo")}),i.jsx(Fs,{keys:[o,"Z"]})]}),i.jsxs("li",{className:"af-shortcuts-row",children:[i.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.redo")}),i.jsx(Fs,{keys:[o,"Shift","Z"]})]})]})]})]})]})})}function Dq(e,t){if(!t)return 1;const n=t.toLowerCase(),r=(e.id||"").toLowerCase(),s=(e.label||"").toLowerCase(),o=(e.definitionId||"").toLowerCase();return r===n?100:r.startsWith(n)?80:r.includes(n)?60:s.startsWith(n)?40:s.includes(n)?30:o.includes(n)?15:0}function Fq({open:e,onClose:t,onJump:n,nodes:r}){const{t:s}=Lr(),[o,a]=m.useState(""),[l,c]=m.useState(0),u=m.useRef(null),d=m.useRef(null);m.useEffect(()=>{if(!e)return;a(""),c(0);const g=requestAnimationFrame(()=>{var k;return(k=u.current)==null?void 0:k.focus()});return()=>cancelAnimationFrame(g)},[e]);const p=m.useMemo(()=>{const g=(r||[]).map(y=>{var v,w,C;return{id:y.id,label:((v=y.data)==null?void 0:v.label)||"",definitionId:((w=y.data)==null?void 0:w.definitionId)||"",schemaType:((C=y.data)==null?void 0:C.schemaType)||""}}),k=o.trim(),b=g.map(y=>({e:y,s:Dq(y,k)})).filter(y=>y.s>0);return b.sort((y,v)=>v.s-y.s||y.e.id.localeCompare(v.e.id)),b.slice(0,50).map(y=>y.e)},[r,o]);if(m.useEffect(()=>{l>=p.length&&c(0)},[p.length,l]),m.useEffect(()=>{var k;const g=(k=d.current)==null?void 0:k.querySelector(`[data-idx="${l}"]`);g&&g.scrollIntoView({block:"nearest"})},[l]),!e)return null;const f=g=>{const k=p[g];k&&(n(k.id),t())},h=g=>{if(g.key==="Escape"){g.preventDefault(),t();return}if(g.key==="ArrowDown"){g.preventDefault(),c(k=>Math.min(p.length-1,k+1));return}if(g.key==="ArrowUp"){g.preventDefault(),c(k=>Math.max(0,k-1));return}g.key==="Enter"&&(g.preventDefault(),f(l))};return i.jsx("div",{className:"af-jump-overlay",role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&t()},children:i.jsxs("div",{className:"af-jump-panel",role:"dialog","aria-modal":"true","aria-label":s("flow:jumpPalette.title"),onMouseDown:g=>g.stopPropagation(),children:[i.jsxs("div",{className:"af-jump-panel__input-wrap",children:[i.jsx("span",{className:"af-jump-panel__icon material-symbols-outlined","aria-hidden":!0,children:"search"}),i.jsx("input",{ref:u,type:"text",className:"af-jump-panel__input",placeholder:s("flow:jumpPalette.placeholder"),value:o,onChange:g=>{a(g.target.value),c(0)},onKeyDown:h,spellCheck:!1,autoComplete:"off"}),i.jsx("span",{className:"af-jump-panel__count",children:p.length})]}),p.length===0?i.jsx("div",{className:"af-jump-panel__empty",children:s("flow:jumpPalette.empty")}):i.jsx("ul",{ref:d,className:"af-jump-panel__list",role:"listbox",children:p.map((g,k)=>i.jsxs("li",{"data-idx":k,role:"option","aria-selected":k===l,className:"af-jump-panel__item"+(k===l?" af-jump-panel__item--active":""),onMouseEnter:()=>c(k),onMouseDown:b=>{b.preventDefault(),f(k)},children:[i.jsx("span",{className:"af-jump-panel__id",children:g.id}),g.label&&g.label!==g.id&&i.jsx("span",{className:"af-jump-panel__label",children:g.label}),g.definitionId&&i.jsx("span",{className:"af-jump-panel__tag",children:g.definitionId})]},g.id))}),i.jsxs("div",{className:"af-jump-panel__hint",children:[i.jsxs("span",{children:[i.jsx("kbd",{className:"af-kbd",children:"↑"}),i.jsx("kbd",{className:"af-kbd",children:"↓"})," ",s("flow:jumpPalette.hintNavigate")]}),i.jsxs("span",{children:[i.jsx("kbd",{className:"af-kbd",children:"Enter"})," ",s("flow:jumpPalette.hintJump")]}),i.jsxs("span",{children:[i.jsx("kbd",{className:"af-kbd",children:"Esc"})," ",s("flow:jumpPalette.hintClose")]})]})]})})}function L1(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 zq(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 O1(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 Wy(e){return String((e==null?void 0:e.nodeId)||(e==null?void 0:e.runNodeId)||"")}function D1(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 Bq({flowParams:e,scheduleNodeId:t="",runNodeId:n="",lastRunId:r="",label:s="",onClose:o}){const[a,l]=m.useState([]),[c,u]=m.useState(""),[d,p]=m.useState(null),[f,h]=m.useState(!1),[g,k]=m.useState(!1),[b,y]=m.useState(""),[v,w]=m.useState(""),C=m.useCallback(async()=>{if(e!=null&&e.flowId){h(!0),y("");try{const I=new URLSearchParams;I.set("flowId",e.flowId),I.set("flowSource",e.flowSource||"user"),t?I.set("scheduleNodeId",t):n&&I.set("runNodeId",n),I.set("limit","80");const D=await fetch(`/api/workspace/run-logs?${I.toString()}`),B=await D.json().catch(()=>({}));if(!D.ok)throw new Error(B.error||"读取日志失败");const W=Array.isArray(B.runs)?B.runs:[];l(W),u(F=>{const T=W[0]||null;return T&&String(T.status||"")==="running"&&T.runId!==F?T.runId:F&&W.some(M=>M.runId===F)?F:r&&W.some(M=>M.runId===r)?r:(T==null?void 0:T.runId)||""})}catch(I){y(String(I.message||I)),l([])}finally{h(!1)}}},[e==null?void 0:e.flowId,e==null?void 0:e.flowSource,r,n,t]),N=m.useCallback(async I=>{if(!I){p(null);return}k(!0);try{const D=new URLSearchParams({flowId:(e==null?void 0:e.flowId)||"",flowSource:(e==null?void 0:e.flowSource)||"user"});e!=null&&e.archived&&D.set("archived","1");const B=await fetch(`/api/workspace/run-logs/${encodeURIComponent(I)}?${D.toString()}`),W=await B.json().catch(()=>({}));if(!B.ok)throw new Error(W.error||"读取日志详情失败");p(W)}catch(D){p({error:String(D.message||D),events:[]})}finally{k(!1)}},[e==null?void 0:e.archived,e==null?void 0:e.flowId,e==null?void 0:e.flowSource]);m.useEffect(()=>{C()},[C]),m.useEffect(()=>{N(c)},[N,c]),m.useEffect(()=>{const I=a.find(B=>B.runId===c),D=window.setInterval(()=>{C(),(!I||I.status==="running")&&c&&N(c)},2e3);return()=>window.clearInterval(D)},[N,C,a,c]);const j=m.useMemo(()=>{const I=Array.isArray(d==null?void 0:d.events)?d.events:[],D=v.trim().toLowerCase();return D?I.filter(B=>String(B.type||"").toLowerCase().includes(D)||Wy(B).toLowerCase().includes(D)||O1(B).toLowerCase().includes(D)):I},[d==null?void 0:d.events,v]),A=(d==null?void 0:d.run)||a.find(I=>I.runId===c)||null;return i.jsxs("div",{className:"af-work-run-logs",children:[i.jsxs("div",{className:"af-pipeline-drawer-head",children:[i.jsx("h2",{className:"af-pipeline-drawer-title",children:"执行日志"}),i.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:o,"aria-label":"关闭日志侧栏",children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),i.jsxs("div",{className:"af-work-run-logs__meta",children:[i.jsx("span",{children:s||t||n||"Workspace Run"}),i.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>void C(),title:"刷新日志","aria-label":"刷新日志",children:i.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]}),b?i.jsx("div",{className:"af-work-run-logs__error",children:b}):null,i.jsxs("div",{className:"af-work-run-logs__body",children:[i.jsxs("div",{className:"af-work-run-logs__list",children:[i.jsx("div",{className:"af-work-run-logs__section-title",children:"最近执行"}),f?i.jsx("div",{className:"af-work-run-logs__empty",children:"Loading..."}):null,!f&&a.length===0?i.jsx("div",{className:"af-work-run-logs__empty",children:"暂无执行日志"}):null,a.map(I=>i.jsxs("button",{type:"button",className:"af-work-run-logs__run"+(I.runId===c?" af-work-run-logs__run--active":""),onClick:()=>u(I.runId),title:I.runId,children:[i.jsx("span",{className:`af-work-run-logs__status af-work-run-logs__status--${D1(I.status)}`,children:I.status||"unknown"}),i.jsx("span",{className:"af-work-run-logs__run-label",children:I.label||I.runNodeId||I.scheduleNodeId||"Workspace Run"}),i.jsx("span",{children:L1(I.startedAt)}),i.jsx("span",{children:zq(I.durationMs)})]},I.runId))]}),i.jsxs("div",{className:"af-work-run-logs__detail",children:[i.jsxs("div",{className:"af-work-run-logs__detail-head",children:[i.jsxs("div",{children:[i.jsx("div",{className:"af-work-run-logs__section-title",children:"详情"}),A!=null&&A.label?i.jsx("div",{className:"af-work-run-logs__detail-label",children:A.label}):null,i.jsx("div",{className:"af-work-run-logs__run-id",children:(A==null?void 0:A.runId)||"-"})]}),A?i.jsx("span",{className:`af-work-run-logs__status af-work-run-logs__status--${D1(A.status)}`,children:A.status}):null]}),i.jsxs("label",{className:"af-work-run-logs__search",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),i.jsx("input",{value:v,onChange:I=>w(I.target.value),placeholder:"搜索事件、节点、错误"})]}),g?i.jsx("div",{className:"af-work-run-logs__empty",children:"Loading..."}):null,d!=null&&d.error?i.jsx("div",{className:"af-work-run-logs__error",children:d.error}):null,!g&&!j.length?i.jsx("div",{className:"af-work-run-logs__empty",children:"暂无事件"}):null,i.jsx("div",{className:"af-work-run-logs__events",children:j.map((I,D)=>i.jsxs("div",{className:"af-work-run-logs__event",children:[i.jsx("span",{className:"af-work-run-logs__event-time",children:L1(I.ts)}),i.jsx("span",{className:"af-work-run-logs__event-type",children:I.type||"event"}),Wy(I)?i.jsx("span",{className:"af-work-run-logs__event-node",children:Wy(I)}):null,i.jsx("pre",{children:O1(I)})]},`${I.ts||D}-${D}`))})]})]})]})}function Hq(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 VR(e){const t=Hq(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,o])=>[String(s),String(o??"")])),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 Wq(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 Vq(e){return String(e).replace(/<\/script/gi,"<\\/script")}function Ym(e){const t=VR(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 Uk(e,t=""){const n=VR(e),r=n.files||{},s=r[n.entry]!=null?n.entry:Object.keys(r).find(f=>/(?:^|\/)App\.[jt]sx$/i.test(f))||Object.keys(r).find(f=>/\.[jt]sx?$/i.test(f))||n.entry,o=Wq(r[s]||""),a=Object.entries(r).filter(([f])=>/\.css$/i.test(f)).map(([,f])=>String(f||"")).join(`
|
|
101
|
-
|
|
102
|
-
`),l=String(n.title||"React App"),c=JSON.stringify(String(t||"")),u=JSON.stringify(n.inputs||{}),d=Vq(o||"function App() { return <main><h1>React App</h1><p>No entry file content.</p></main>; }"),p=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,f=>({"<":"<",">":">","&":"&"})[f])}</title>
|
|
114
|
-
<style>${p.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
|
-
${d}
|
|
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 KR=new Set(["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"]),Kq=["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"];function qq(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 Uq(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 F1(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 qR(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(KR.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 UR(e){return{inputNames:F1(e==null?void 0:e.inputs),outputNames:F1(e==null?void 0:e.outputs)}}function Yq(e,t,n){const r=UR(t),s=Uq(e),o=[];for(const a of s)if(!qR(a.key,r)){const l=a.key.trim()===""?n("flow:placeholder.empty"):a.key.trim();o.push({start:a.start,end:a.end,message:n("flow:placeholder.invalidPlaceholder",{hint:l})})}return o}function Gq(e,t){const n=UR(t),r=/\$\{([^}]*)\}/g,s=[];let o=0,a;for(;(a=r.exec(e))!==null;){a.index>o&&s.push({kind:"plain",text:e.slice(o,a.index)});const l=a[0],c=qR(a[1],n);s.push({kind:c?"ph-valid":"ph-invalid",text:l}),o=a.index+l.length}return o<e.length&&s.push({kind:"plain",text:e.slice(o)}),s}function Jq(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Xq(e){return e.map(t=>{const n=Jq(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 Qq(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 o=(r==null?void 0:r.type)!=null?String(r.type):"";n.push({section:"input",insert:`input.${s}`,label:s,subtitle:o?t("flow:placeholder.inputSubtitle",{type:o}):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 o=(r==null?void 0:r.type)!=null?String(r.type):"";n.push({section:"output",insert:`output.${s}`,label:s,subtitle:o?t("flow:placeholder.outputSubtitle",{type:o}):t("flow:placeholder.outputSubtitleNoType")})}for(const r of Kq)KR.has(r)&&n.push({section:"runtime",insert:r,label:r,subtitle:t("flow:placeholder.runtimeConst")});return n}function Zq(e,t){const n=t.toLowerCase();return n?e.filter(r=>[r.insert,r.label,r.subtitle??""].map(o=>String(o).toLowerCase()).some(o=>o.includes(n))):e}function eU(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 o=e.clientWidth;if(o<=0)return null;s.style.width=`${o}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 wp({value:e,onChange:t,disabled:n,placeholder:r,rows:s=8,textareaClassName:o,ioSlots:a,variant:l="drawer",images:c,onImagesChange:u}){const{t:d}=Lr(),p=m.useId(),f=m.useRef(null),h=m.useRef(null),[g,k]=m.useState(0),[b,y]=m.useState(0),[v,w]=m.useState(null),C=m.useMemo(()=>ao(c),[c]),N=m.useMemo(()=>Yq(e,a,d),[e,a,d]),j=N.length>0,A=m.useMemo(()=>Gq(e,a),[e,a]),I=m.useMemo(()=>Xq(A),[A]),D=m.useMemo(()=>n?null:qq(e,g),[e,g,n]),B=m.useMemo(()=>{if(!D)return[];const H=Qq(a,d);return Zq(H,D.query)},[D,a,d]);m.useEffect(()=>{y(H=>{const L=Math.max(0,B.length-1);return Math.min(Math.max(0,H),L)})},[B.length]);const W=m.useCallback(()=>{const H=f.current;if(!H||!D||B.length===0){w(null);return}const L=eU(H,g);if(!L){w(null);return}const R=4,z=44,E=13.5*16,Q=Math.min(B.length*z+8,E);let V=L.bottom+R;V+Q>window.innerHeight-8&&(V=Math.max(8,L.top-Q-R));const $=288;let ne=L.left;ne=Math.max(8,Math.min(ne,window.innerWidth-$-8)),w({top:V,left:ne})},[D,B.length,g]);m.useLayoutEffect(()=>{if(!D||B.length===0){w(null);return}const H=requestAnimationFrame(()=>W());return()=>cancelAnimationFrame(H)},[D,B.length,g,e,W]),m.useEffect(()=>{if(!D||B.length===0)return;const H=()=>W();return window.addEventListener("scroll",H,!0),window.addEventListener("resize",H),()=>{window.removeEventListener("scroll",H,!0),window.removeEventListener("resize",H)}},[D,B.length,W]);const F=m.useCallback(H=>{if(!D)return;const{atIndex:L}=D,R=e.slice(0,L)+"${"+H+"}"+e.slice(g);t(R);const z=L+H.length+3;queueMicrotask(()=>{const E=f.current;E&&(E.focus(),E.setSelectionRange(z,z)),k(z)})},[D,e,g,t]),T=m.useCallback(()=>{const H=f.current,L=h.current;!H||!L||(L.scrollTop=H.scrollTop,L.scrollLeft=H.scrollLeft,D&&B.length>0&&queueMicrotask(()=>W()))},[D,B.length,W]),M=m.useCallback(H=>{if(!n&&D&&B.length>0&&(H.key==="ArrowDown"||H.key==="ArrowUp"||H.key==="Enter")){if(H.key==="ArrowDown")H.preventDefault(),y(L=>(L+1)%B.length);else if(H.key==="ArrowUp")H.preventDefault(),y(L=>(L-1+B.length)%B.length);else if(H.key==="Enter"&&!H.shiftKey){H.preventDefault();const L=B[b];L&&F(L.insert)}}},[n,D,B,b,F]),q=m.useCallback(async H=>{if(n||typeof u!="function")return!1;const L=await HR({files:H,body:e,images:C});return L?(t(L.body),u(L.images),queueMicrotask(()=>{const R=f.current;if(!R)return;R.focus();const z=L.body.length;R.setSelectionRange(z,z),k(z)}),!0):!1},[n,C,t,u,e]);return i.jsxs("div",{className:"af-body-prompt-editor"+(l==="expand"?" af-body-prompt-editor--expand":""),children:[C.length>0?i.jsx("div",{className:"af-body-image-list","aria-label":"image attachments",children:C.map((H,L)=>i.jsxs("span",{className:"af-body-image-chip",title:H.name,children:[i.jsx("img",{src:H.dataUrl,alt:""}),i.jsxs("span",{children:["[",H.label||`image ${L+1}`,"]"]})]},H.id||L))}):null,i.jsxs("div",{className:"af-body-prompt-stack",children:[i.jsx("pre",{ref:h,className:"af-body-prompt-backdrop "+o,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:I+`
|
|
182
|
-
`}}),i.jsx("textarea",{ref:f,className:"af-body-prompt-textarea "+o,rows:s,value:e,disabled:n,placeholder:r,spellCheck:!1,"aria-invalid":j,"aria-describedby":j?p:void 0,onChange:H=>{t(H.target.value),k(H.target.selectionStart??H.target.value.length)},onSelect:H=>{const L=H.target;L instanceof HTMLTextAreaElement&&k(L.selectionStart??0)},onClick:H=>{const L=H.target;L instanceof HTMLTextAreaElement&&k(L.selectionStart??0)},onKeyUp:H=>{const L=H.target;L instanceof HTMLTextAreaElement&&k(L.selectionStart??L.value.length)},onKeyDown:M,onPaste:H=>{const L=BR(H);L.length!==0&&(H.preventDefault(),q(L).catch(()=>{}))},onDragOver:H=>{ed(H).length>0&&H.preventDefault()},onDrop:H=>{const L=ed(H);L.length!==0&&(H.preventDefault(),q(L).catch(()=>{}))},onScroll:T})]}),D&&B.length>0&&v?sr.createPortal(i.jsx("ul",{className:"af-body-ph-menu af-body-ph-menu--pop af-composer-mention-menu",role:"listbox","aria-label":d("flow:nodeProps.placeholderSlots"),style:{position:"fixed",top:v.top,left:v.left,right:"auto",bottom:"auto",margin:0,zIndex:2e4},children:B.map((H,L)=>i.jsx("li",{role:"option","aria-selected":L===b,children:i.jsxs("button",{type:"button",className:"af-composer-mention-item"+(L===b?" af-composer-mention-item--active":""),onMouseDown:R=>R.preventDefault(),onMouseEnter:()=>y(L),onClick:()=>F(H.insert),children:[i.jsx("span",{className:"af-composer-mention-id",children:`\${${H.insert}}`}),H.subtitle?i.jsx("span",{className:"af-composer-mention-sub",children:H.subtitle}):null]})},`${H.section}-${H.insert}`))}),document.body):null,j?i.jsx("p",{id:p,className:"af-body-ph-issues",role:"status",children:N.map(H=>H.message).join(" · ")}):null]})}const tU=/^[a-zA-Z_][a-zA-Z0-9_-]*$/;function ku(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function z1({kind:e,label:t,slots:n,onSlotsChange:r,disabled:s,requiredReadonly:o=!0}){const{t:a}=Lr(),l=()=>r([...n,{type:"text",name:"",default:"",required:!1,showOnNode:!1}]),c=p=>r(n.filter((f,h)=>h!==p)),u=(p,f,h)=>{const g=n.map((k,b)=>{if(b!==p)return k;const y={...k,[f]:h};return f==="required"&&h===!0&&(y.showOnNode=!0),y});r(g)},d=e==="input"?"input":"output";return i.jsxs("div",{className:"af-node-props-field af-node-props-field--io",children:[i.jsxs("div",{className:"af-node-props-io-head",children:[i.jsx("span",{className:"af-node-props-label",children:t}),i.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")})]}),i.jsx("p",{className:"af-node-props-io-hint",children:a("flow:nodeProps.handleHint",{prefix:d})}),n.length===0?i.jsx("p",{className:"af-node-props-io-empty",children:a(e==="input"?"flow:nodeProps.noInputPins":"flow:nodeProps.noOutputPins")}):null,n.length>0?i.jsxs("div",{className:"af-node-props-io-table",role:"group","aria-label":t,children:[i.jsxs("div",{className:"af-node-props-io-table-head","aria-hidden":!0,children:[i.jsx("span",{children:a("flow:nodeProps.handle")}),i.jsx("span",{children:a("flow:nodeProps.type")}),i.jsx("span",{children:a("flow:nodeProps.name")}),i.jsx("span",{children:a("flow:nodeProps.defaultValue")}),i.jsx("span",{children:a("flow:nodeProps.description")}),i.jsx("span",{children:a("flow:nodeProps.required")}),i.jsx("span",{children:a("flow:nodeProps.showOnNode")}),i.jsx("span",{})]}),n.map((p,f)=>i.jsxs("div",{className:"af-node-props-io-row",children:[i.jsxs("span",{className:"af-node-props-io-handle",title:`${d}-${f}`,children:[d,"-",f]}),i.jsx("select",{className:"af-node-props-input af-node-props-io-cell",value:p.type,onChange:h=>u(f,"type",h.target.value),disabled:s,"aria-label":a("flow:nodeProps.pinTypeAriaLabel",{label:t,index:f}),children:["node","text","file","bool"].map(h=>i.jsx("option",{value:h,children:h},h))}),i.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:p.name,onChange:h=>u(f,"name",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinNameAriaLabel",{label:t,index:f})}),i.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:p.default,onChange:h=>u(f,"default",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinDefaultAriaLabel",{label:t,index:f})}),i.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:p.description||"",onChange:h=>u(f,"description",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinDescriptionAriaLabel",{label:t,index:f})}),i.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.requiredHint"),children:i.jsx("input",{type:"checkbox",checked:!!p.required,onChange:h=>{o||u(f,"required",h.target.checked)},disabled:s||o,"aria-label":a("flow:nodeProps.pinRequiredAriaLabel",{label:t,index:f})})}),i.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.showOnNodeHint"),children:i.jsx("input",{type:"checkbox",checked:p.showOnNode!==!1,onChange:h=>u(f,"showOnNode",h.target.checked),disabled:s,"aria-label":a("flow:nodeProps.pinShowOnNodeAriaLabel",{label:t,index:f})})}),i.jsx("button",{type:"button",className:"af-icon-btn af-node-props-io-remove",onClick:()=>c(f),disabled:s,"aria-label":a("flow:nodeProps.deletePinAriaLabel",{label:t,index:f}),title:a("flow:nodeProps.deletePin"),children:i.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},`${d}-${f}`))]}):null]})}function nU({draft:e,setDraft:t,definitionId:n,systemPromptReadonly:r,modelLists:s,disabled:o,onIdBlur:a,onClose:l,onPublishToMarketplace:c,allowEditRequiredPins:u=!1,error:d,ioSlots:p}){const{t:f}=Lr(),[h,g]=m.useState(!1),[k,b]=m.useState(!1),[y,v]=m.useState({status:"idle",message:""}),w=m.useCallback(T=>{t(M=>M&&{...M,...T})},[t]),{cursorList:C,opencodeList:N,claudeCodeList:j,codexList:A,currentNotInLists:I}=m.useMemo(()=>{const T=Array.isArray(s==null?void 0:s.cursor)?s.cursor:[],M=Array.isArray(s==null?void 0:s.opencode)?s.opencode:[],q=Array.isArray(s==null?void 0:s.claudeCode)?s.claudeCode:[],H=Array.isArray(s==null?void 0:s.codex)?s.codex:[],L=new Set([...T,...M,...q,...H].map(ku)),R=((e==null?void 0:e.model)??"").trim(),z=R.startsWith("cursor:")?R.slice(7):R.startsWith("opencode:")?R.slice(9):R.startsWith("codex:")?R.slice(6):R.startsWith("claude-code:")?R.slice(12):R,E=R&&!L.has(z)?R:"";return{cursorList:T,opencodeList:M,claudeCodeList:q,codexList:H,currentNotInLists:E}},[s,e==null?void 0:e.model]);if(!e)return null;const D=String(e.script??""),B=n==="tool_nodejs"||D.trim()!=="",W=typeof c=="function"&&!o&&(e==null?void 0:e.newId),F=async()=>{if(W){v({status:"running",message:f("flow:nodeProps.publishRunning")});try{const T=await c(e,n);v({status:"success",message:T!=null&&T.definitionId?f("flow:nodeProps.publishSuccessWithId",{id:T.definitionId}):f("flow:nodeProps.publishSuccess")})}catch(T){v({status:"error",message:String((T==null?void 0:T.message)||T)})}}};return i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"af-pipeline-drawer-head af-node-props-head",children:[i.jsx("h2",{className:"af-pipeline-drawer-title",children:f("flow:nodeProps.title")}),i.jsxs("div",{className:"af-node-props-head-actions",children:[i.jsxs("button",{type:"button",className:"af-btn-ghost af-node-props-market-btn",onClick:F,disabled:!W||y.status==="running",title:f("flow:nodeProps.publishToMarketplaceHint"),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"inventory_2"}),y.status==="running"?f("flow:nodeProps.publishing"):f("flow:nodeProps.publishToMarketplace")]}),i.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-close-secondary",onClick:l,children:f("common:common.close")})]})]}),i.jsxs("div",{className:"af-pipeline-drawer-body af-node-props-body",children:[d?i.jsx("p",{className:"af-err af-node-props-err",children:d}):null,y.message?i.jsx("p",{className:`af-node-props-market-status af-node-props-market-status--${y.status}`,children:y.message}):null,i.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[i.jsx("span",{className:"af-node-props-label",children:f("flow:node.nodeType")}),i.jsx("div",{className:"af-pipeline-drawer-readonly af-node-props-readonly-mono",children:n})]}),i.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[i.jsxs("span",{className:"af-node-props-label",children:[f("flow:nodeProps.instanceId"),i.jsx("span",{className:"af-node-props-hint",children:f("flow:node.displayNameHint")})]}),i.jsx("input",{type:"text",className:"af-node-props-input",value:e.newId,onChange:T=>w({newId:T.target.value}),onBlur:a,disabled:o,spellCheck:!1,autoComplete:"off","aria-label":f("flow:nodeProps.instanceId")})]}),i.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[i.jsxs("span",{className:"af-node-props-label",children:[f("flow:node.displayName"),"(LABEL)"]}),i.jsx("input",{type:"text",className:"af-node-props-input",value:e.label,onChange:T=>w({label:T.target.value}),disabled:o,spellCheck:!1})]}),i.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[i.jsxs("span",{className:"af-node-props-label",children:[f("flow:node.role"),"(ROLE)"]}),i.jsx("select",{className:"af-node-props-select",value:Rd.includes(e.role)?e.role:f("flow:roles.normal"),onChange:T=>w({role:T.target.value}),disabled:o,children:Rd.map(T=>i.jsx("option",{value:T,children:T},T))})]}),i.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[i.jsxs("span",{className:"af-node-props-label",children:[f("flow:node.model"),"(MODEL)"]}),i.jsx("span",{className:"af-node-props-sublabel",children:f("flow:node.modelHint")}),i.jsxs("select",{className:"af-node-props-select",value:(()=>{const T=(e.model||"").trim();return T?I||T:""})(),onChange:T=>w({model:T.target.value}),disabled:o,"aria-label":f("flow:nodeProps.modelAriaLabel"),children:[i.jsx("option",{value:"",children:f("flow:node.defaultModel")}),I?i.jsxs("option",{value:I,children:[I,f("flow:nodeProps.yamlValueNotInList")]}):null,C.length>0?i.jsx("optgroup",{label:"Cursor",children:C.map(T=>i.jsx("option",{value:ku(T),children:T},`c-${T}`))}):null,N.length>0?i.jsx("optgroup",{label:"OpenCode",children:N.map(T=>i.jsx("option",{value:`opencode:${ku(T)}`,children:T},`o-${T}`))}):null,A.length>0?i.jsx("optgroup",{label:"Codex",children:A.map(T=>i.jsx("option",{value:`codex:${ku(T)}`,children:T},`codex-${T}`))}):null,j.length>0?i.jsx("optgroup",{label:"Claude Code",children:j.map(T=>i.jsx("option",{value:`claude-code:${ku(T)}`,children:T},`cc-${T}`))}):null]})]}),i.jsx(z1,{kind:"input",label:f("flow:nodeProps.inputPins"),slots:Array.isArray(e.inputs)?e.inputs:[],onSlotsChange:T=>w({inputs:T}),disabled:o,requiredReadonly:!u}),i.jsx(z1,{kind:"output",label:f("flow:nodeProps.outputPins"),slots:Array.isArray(e.outputs)?e.outputs:[],onSlotsChange:T=>w({outputs:T}),disabled:o,requiredReadonly:!u}),B?i.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[i.jsxs("div",{className:"af-node-props-prompt-head",children:[i.jsxs("span",{className:"af-node-props-label",children:[f("flow:node.directCommand"),"(script)",i.jsx("span",{className:"af-node-props-hint",children:f("flow:node.scriptHint")})]}),i.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>b(!0),"aria-label":f("flow:nodeProps.expandEditScript"),title:f("flow:nodeProps.expand"),disabled:o,children:i.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),i.jsx(wp,{value:D,onChange:T=>w({script:T}),disabled:o,placeholder:f("flow:nodeProps.scriptPlaceholder"),rows:6,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea af-node-props-script-textarea",ioSlots:p,variant:"drawer"})]}):null,i.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[i.jsx("span",{className:"af-node-props-label",children:"Script file(scriptRef)"}),i.jsxs("span",{className:"af-node-props-sublabel",children:["Relative path under this flow, for example nodes/",e.id,"/script.mjs"]}),i.jsx("input",{type:"text",className:"af-node-props-input",value:e.scriptRef||"",onChange:T=>w({scriptRef:T.target.value}),disabled:o,spellCheck:!1,autoComplete:"off"})]}),i.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[i.jsx("span",{className:"af-node-props-label",children:"Implementation file(implementationRef)"}),i.jsxs("span",{className:"af-node-props-sublabel",children:["Relative path under this flow, for example nodes/",e.id,"/implementation.md"]}),i.jsx("input",{type:"text",className:"af-node-props-input",value:e.implementationRef||"",onChange:T=>w({implementationRef:T.target.value}),disabled:o,spellCheck:!1,autoComplete:"off"})]}),i.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[i.jsx("span",{className:"af-node-props-label",children:"Implementation mode"}),i.jsxs("select",{className:"af-node-props-select",value:e.implementationMode||"",onChange:T=>w({implementationMode:T.target.value}),disabled:o,children:[i.jsx("option",{value:"",children:"auto"}),i.jsx("option",{value:"script",children:"script"}),i.jsx("option",{value:"steps",children:"steps"}),i.jsx("option",{value:"hybrid",children:"hybrid"})]})]}),i.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[i.jsxs("div",{className:"af-node-props-prompt-head",children:[i.jsx("span",{className:"af-node-props-label",children:f("flow:node.userPrompt")}),i.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>g(!0),"aria-label":f("flow:nodeProps.expandEdit"),title:f("flow:nodeProps.expand"),disabled:o,children:i.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),i.jsx(wp,{value:e.body,onChange:T=>w({body:T}),images:e.images,onImagesChange:T=>w({images:T}),disabled:o,placeholder:f("flow:nodeProps.bodyPlaceholder"),rows:8,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea",ioSlots:p,variant:"drawer"})]}),i.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[i.jsx("span",{className:"af-node-props-label",children:f("flow:node.systemDescription")}),i.jsx("textarea",{className:"af-pipeline-drawer-textarea af-node-props-system-readonly",rows:4,readOnly:!0,value:r||f("flow:nodeProps.noDescription"),spellCheck:!1})]})]}),k?i.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":f("flow:nodeProps.editScript"),onMouseDown:T=>{T.target===T.currentTarget&&b(!1)},children:i.jsxs("div",{className:"af-node-props-expand-panel",children:[i.jsxs("div",{className:"af-node-props-expand-head",children:[i.jsx("span",{className:"af-node-props-expand-title",children:f("flow:node.directCommand")}),i.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>b(!1),"aria-label":f("flow:nodeProps.collapse"),children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),i.jsx(wp,{value:D,onChange:T=>w({script:T}),disabled:o,placeholder:f("flow:nodeProps.scriptPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:p,variant:"expand"})]})}):null,h?i.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":f("flow:nodeProps.editUserPrompt"),onMouseDown:T=>{T.target===T.currentTarget&&g(!1)},children:i.jsxs("div",{className:"af-node-props-expand-panel",children:[i.jsxs("div",{className:"af-node-props-expand-head",children:[i.jsx("span",{className:"af-node-props-expand-title",children:f("flow:node.body")}),i.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>g(!1),"aria-label":f("flow:nodeProps.collapse"),children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),i.jsx(wp,{value:e.body,onChange:T=>w({body:T}),images:e.images,onImagesChange:T=>w({images:T}),disabled:o,placeholder:f("flow:nodeProps.bodyPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:p,variant:"expand"})]})}):null]})}function rU({open:e,onClose:t,flowId:n,flowSource:r,onArchived:s}){const{t:o}=Lr(),a=m.useId(),l=m.useRef(null),[c,u]=m.useState(""),[d,p]=m.useState(!1),[f,h]=m.useState("");if(m.useEffect(()=>{if(!e)return;u(""),h(""),p(!1);const y=requestAnimationFrame(()=>{var v;return(v=l.current)==null?void 0:v.focus()});return()=>cancelAnimationFrame(y)},[e,n]),!e)return null;const g=c.trim(),k=g===n;async function b(y){if(y.preventDefault(),!(!k||d)){p(!0),h("");try{const v=await fetch("/api/flow/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:g})}),w=await v.json().catch(()=>({}));if(!v.ok){h(typeof w.error=="string"?w.error:o("project:archiveModal.archiveFailed"));return}s()}catch(v){h(String((v==null?void 0:v.message)||v))}finally{p(!1)}}}return i.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&t()},children:i.jsxs("div",{ref:l,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":a,tabIndex:-1,onMouseDown:y=>y.stopPropagation(),children:[i.jsxs("div",{className:"af-shortcuts-panel__head",children:[i.jsx("h2",{id:a,className:"af-shortcuts-panel__title",children:o("project:archiveModal.title")}),i.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":o("project:archiveModal.close"),children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),i.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:b,children:[i.jsx("p",{className:"af-new-pipeline-lead",children:o("project:archiveModal.lead",{flowId:n})}),i.jsxs("label",{className:"af-new-pipeline-field",children:[i.jsx("span",{className:"af-pipeline-drawer-label",children:o("project:archiveModal.confirmLabel")}),i.jsx("input",{type:"text",className:"af-new-pipeline-input",value:c,onChange:y=>u(y.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":g.length>0&&!k})]}),f?i.jsx("p",{className:"af-err af-new-pipeline-err",children:f}):null,i.jsxs("div",{className:"af-new-pipeline-actions",children:[i.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:d,children:o("project:archiveModal.cancel")}),i.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!k||d,children:o(d?"project:archiveModal.archiving":"project:archiveModal.confirmArchive")})]})]})]})})}function sU({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,workspaceId:o="",leaveShared:a=!1,onDeleted:l}){const{t:c}=Lr(),u=m.useId(),d=m.useRef(null),[p,f]=m.useState(""),[h,g]=m.useState(!1),[k,b]=m.useState("");if(m.useEffect(()=>{if(!e)return;f(""),b(""),g(!1);const C=requestAnimationFrame(()=>{var N;return(N=d.current)==null?void 0:N.focus()});return()=>cancelAnimationFrame(C)},[e,n]),!e)return null;const y=p.trim(),v=a||y===n;async function w(C){if(C.preventDefault(),!v||h)return;g(!0),b("");let N=null;try{const j=new AbortController;N=setTimeout(()=>j.abort(),15e3);const A=await fetch("/api/flow/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:a?n:y,flowArchived:s,workspaceId:o}),signal:j.signal}),I=await A.json().catch(()=>({}));if(!A.ok){b(typeof I.error=="string"?I.error:c("project:deleteModal.deleteFailed"));return}try{for(let D=localStorage.length-1;D>=0;D--){const B=localStorage.key(D);B&&(B.startsWith(`af:composer-sessions:${n}:${r}`)||B.startsWith(`af:composer-active-session:${n}:${r}`)||B.startsWith(`af:workspace-composer:${n}:${r}`))&&localStorage.removeItem(B)}}catch{}await l()}catch(j){if((j==null?void 0:j.name)==="AbortError"){b(c("project:deleteModal.deleteTimeout"));return}b(String((j==null?void 0:j.message)||j))}finally{N&&clearTimeout(N),g(!1)}}return i.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:C=>{C.target===C.currentTarget&&t()},children:i.jsxs("div",{ref:d,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":u,tabIndex:-1,onMouseDown:C=>C.stopPropagation(),children:[i.jsxs("div",{className:"af-shortcuts-panel__head",children:[i.jsx("h2",{id:u,className:"af-shortcuts-panel__title",children:a?"退出共享 Workspace":c("project:deleteModal.title")}),i.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":c("project:deleteModal.close"),children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),i.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:w,children:[i.jsx("p",{className:"af-new-pipeline-lead",children:a?`退出后,${n} 将从你的项目列表移除;源项目和其他成员的数据不会被删除。`:c("project:deleteModal.lead",{flowId:n})}),a?null:i.jsxs("label",{className:"af-new-pipeline-field",children:[i.jsx("span",{className:"af-pipeline-drawer-label",children:c("project:deleteModal.confirmLabel")}),i.jsx("input",{type:"text",className:"af-new-pipeline-input",value:p,onChange:C=>f(C.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":y.length>0&&!v})]}),k?i.jsx("p",{className:"af-err af-new-pipeline-err",children:k}):null,i.jsxs("div",{className:"af-new-pipeline-actions",children:[i.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:h,children:c("project:deleteModal.cancel")}),i.jsx("button",{type:"submit",className:"af-btn-primary af-btn-destructive",disabled:!v||h,children:h?a?"退出中...":c("project:deleteModal.deleting"):a?"确认退出":c("project:deleteModal.confirmDelete")})]})]})]})})}const B1=80,iU=220;function oU(e){if(!e||typeof e!="object")return e;const{selected:t,dragging:n,resizing:r,className:s,positionAbsolute:o,measured:a,internals:l,...c}=e;return c}function aU(e){if(!e||typeof e!="object")return e;const{selected:t,className:n,...r}=e;return r}function xp(e,t,n){const r={nodes:Array.isArray(e)?e.map(oU):[],edges:Array.isArray(t)?t.map(aU):[],extra:n&&typeof n=="object"?n:{}},s=JSON.stringify(r);return{value:JSON.parse(s),signature:s}}function Vy(e,t){const n=[...e,t];return n.length>B1?n.slice(n.length-B1):n}function lU({nodes:e,edges:t,extra:n,enabled:r=!0,onRestore:s}){const[o,a]=m.useState(0),l=m.useRef([]),c=m.useRef([]),u=m.useRef(null),d=m.useRef(null),p=m.useRef(null),f=m.useRef(null),h=m.useRef(!1),g=m.useCallback(()=>a(N=>N+1),[]),k=m.useCallback(()=>{f.current&&(window.clearTimeout(f.current),f.current=null)},[]),b=m.useCallback(()=>{k();const N=d.current,j=p.current;return d.current=null,p.current=null,!N||!j||N.signature===j.signature?(j&&(u.current=j),!1):(l.current=Vy(l.current,N),c.current=[],u.current=j,g(),!0)},[g,k]),y=m.useCallback((N=[],j=[],A={})=>{k(),l.current=[],c.current=[],d.current=null,p.current=null,u.current=xp(N,j,A),h.current=!1,g()},[g,k]),v=m.useCallback(N=>{h.current=!0,u.current=N,d.current=null,p.current=null,k(),s==null||s(N.value),g()},[g,k,s]),w=m.useCallback(()=>{b();const N=u.current||xp(e,t,n),j=l.current.pop();return j?(c.current=Vy(c.current,N),v(j),!0):(g(),!1)},[g,t,n,b,e,v]),C=m.useCallback(()=>{b();const N=u.current||xp(e,t,n),j=c.current.pop();return j?(l.current=Vy(l.current,N),v(j),!0):(g(),!1)},[g,t,n,b,e,v]);return m.useEffect(()=>()=>k(),[k]),m.useEffect(()=>{if(!r)return;const N=xp(e,t,n);if(!u.current){u.current=N;return}if(h.current){h.current=!1,u.current=N;return}N.signature!==u.current.signature&&(d.current||(d.current=u.current),p.current=N,k(),f.current=window.setTimeout(()=>{b()},iU))},[k,t,r,n,b,e]),{canUndo:l.current.length>0||!!d.current,canRedo:c.current.length>0,resetHistory:y,undo:w,redo:C,version:o}}function ro(e){return String(e??"").trim()}function H1(e){return e===!0?!0:["true","yes","done","waived","not_required"].includes(ro(e).toLowerCase())}function cU(e){return e===!1?!0:["false","no","not_required","waived"].includes(ro(e).toLowerCase())}function uU(e,t=""){return ro((e==null?void 0:e.key)||(e==null?void 0:e.issueKey)||(e==null?void 0:e.issue_key)||(e==null?void 0:e.id)||t)}function YR(e){return ro((e==null?void 0:e.platform)||"all").toLowerCase()||"all"}function GR(e){return YR(e)==="all"}function dU(e,t=[]){const n=ro((e==null?void 0:e.sourceIssue)||(e==null?void 0:e.source_issue)||(e==null?void 0:e.parentKey)||(e==null?void 0:e.parent_key)||(e==null?void 0:e.parentIssue)||(e==null?void 0:e.parent_issue)||(e==null?void 0:e.parent));if(n)return n;const r=YR(e),s=uU(e);if(!s||!["android","ios"].includes(r))return"";const o=`-${r}`;if(!s.endsWith(o))return"";const a=s.slice(0,-o.length);return new Set(t.map(l=>ro(l))).has(a)?a:""}function Uh(e){const t=ro(e==null?void 0:e.label).toLowerCase(),n=ro((e==null?void 0:e.href)||(e==null?void 0:e.url)).toLowerCase();return/\/merge_requests\/\d+/.test(n)||/\bmr\b|merge request|合并请求|实现 mr|修复 mr|提测 mr|集成 mr/i.test(t)?"mr":/\/issues\/\d+/.test(n)||/gitlab issue/i.test(t)?"issue":"other"}function fU(e=[]){const t={issue:0,mr:1,other:2};return[...e].sort((n,r)=>t[Uh(n)]-t[Uh(r)])}function pU(e){const t=ro((e==null?void 0:e.noMrReason)||(e==null?void 0:e.no_mr_reason)||(e==null?void 0:e.mrWaiverReason)||(e==null?void 0:e.mr_waiver_reason)||(e==null?void 0:e.implementationNotRequiredReason)||(e==null?void 0:e.implementation_not_required_reason));return/user confirmed self-test completion without implementation mr evidence/i.test(t)?"自测确认,无需实现 MR":t}function hU(e,t=[]){if(GR(e))return{kind:"aggregate",label:"双端汇总",detail:"由 Android / iOS 端侧 Issue 承接"};const n=t.map(Uh);if(n.includes("mr"))return{kind:"linked",label:"MR 已关联",detail:""};const r=(e==null?void 0:e.mrRequired)??(e==null?void 0:e.mr_required)??(e==null?void 0:e.requiresMr)??(e==null?void 0:e.requires_mr);return H1(e==null?void 0:e.implementationNotRequired)||H1(e==null?void 0:e.implementation_not_required)||cU(r)?{kind:"not-required",label:pU(e)||"无需实现 MR",detail:""}:n.includes("issue")?{kind:"pending",label:"MR 尚未记录",detail:""}:{kind:"missing-issue",label:"GitLab Issue 未绑定",detail:"端侧执行项应先创建或绑定 GitLab Issue"}}function Kx(e=[]){return e.reduce((t,n)=>t+1+Kx(Array.isArray(n==null?void 0:n.children)?n.children:[]),0)}function Hr(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Yh(e){return Array.isArray(e)?e.map(Yh):Hr(e)?Object.fromEntries(Object.keys(e).sort().map(t=>[t,Yh(e[t])])):e}function Gi(e,t){return JSON.stringify(Yh(e))===JSON.stringify(Yh(t))}function JR(e){return Hr(e==null?void 0:e.instances)?e.instances:{}}function Md(e){return Hr(e==null?void 0:e.ui)?e.ui:{}}function bp(e,t){if(!Hr(e))return{};const n=new Set(t);return Object.fromEntries(Object.entries(e).filter(([r])=>!n.has(r)))}function mU(e,t){if(!Hr(e)||!Hr(t)||!Hr(e.instances)||!Hr(t.instances)||!Array.isArray(e.edges)||!Array.isArray(t.edges)||!Hr(e.ui)||!Hr(t.ui)||Number(e.version||1)!==Number(t.version||1))return!1;const n=bp(e,["version","instances","edges","ui"]),r=bp(t,["version","instances","edges","ui"]);if(!Gi(n,r))return!1;const s=["nodePositions","nodeSizes","groups","displayPage","viewport"];return Gi(bp(e.ui,s),bp(t.ui,s))}function XR(e){const t=Array.isArray(Md(e).groups)?Md(e).groups:[];return new Map(t.filter(n=>n==null?void 0:n.id).map(n=>[String(n.id),n]))}function W1(e){const t=new Set(Object.keys(JR(e)));for(const n of Array.isArray(e==null?void 0:e.edges)?e.edges:[])n!=null&&n.source&&t.add(String(n.source)),n!=null&&n.target&&t.add(String(n.target));for(const n of XR(e).keys())t.add(n);return t}function V1(e,t){const n=JR(e),r=Md(e),s=XR(e);return{instance:Object.prototype.hasOwnProperty.call(n,t)?n[t]:null,position:Hr(r.nodePositions)&&Object.prototype.hasOwnProperty.call(r.nodePositions,t)?r.nodePositions[t]:null,size:Hr(r.nodeSizes)&&Object.prototype.hasOwnProperty.call(r.nodeSizes,t)?r.nodeSizes[t]:null,group:s.get(t)||null}}function K1(e){return(Array.isArray(e==null?void 0:e.edges)?e.edges:[]).map(t=>({...t})).sort((t,n)=>{const r=[t.source,t.target,t.sourceHandle,t.targetHandle,t.id].map(o=>String(o??"")).join("\0"),s=[n.source,n.target,n.sourceHandle,n.targetHandle,n.id].map(o=>String(o??"")).join("\0");return r.localeCompare(s)})}function gU(e,t){if(!mU(e,t))return{safe:!1,changedNodeIds:[],nodesChanged:!0,edgesChanged:!0,displayPageChanged:!0};const n=new Set([...W1(e),...W1(t)]),r=Array.from(n).filter(s=>!Gi(V1(e,s),V1(t,s)));return{safe:!0,changedNodeIds:r,nodesChanged:r.length>0,edgesChanged:!Gi(K1(e),K1(t)),displayPageChanged:!Gi(Md(e).displayPage||null,Md(t).displayPage||null)}}function yU(e,t,n){const r=new Map((Array.isArray(e)?e:[]).map(o=>[o.id,o])),s=new Set(Array.isArray(n)?n:[]);return(Array.isArray(t)?t:[]).map(o=>{const a=r.get(o.id);return a&&!s.has(o.id)?a:a?{...o,selected:a.selected===!0}:o})}function q1(e){return[e==null?void 0:e.source,e==null?void 0:e.target,e==null?void 0:e.sourceHandle,e==null?void 0:e.targetHandle].map(t=>String(t??"")).join("\0")}function U1(e){if(!e||typeof e!="object")return e;const t={...e};return delete t.selected,t}function wU(e,t){const n=new Map((Array.isArray(e)?e:[]).map(r=>[q1(r),r]));return(Array.isArray(t)?t:[]).map(r=>{const s=n.get(q1(r));return s?Gi(U1(s),U1(r))?s:{...r,selected:s.selected===!0}:r})}function xU(e,t,n){const r=Hr(e)?e:{},s=Hr(t)?t:{},o=new Set(Array.isArray(n)?n:[]);return Object.fromEntries(Object.entries(s).map(([a,l])=>[a,!o.has(a)&&Object.prototype.hasOwnProperty.call(r,a)?r[a]:l]))}function bU({background:e=!1,requestId:t=0,currentRequestId:n=0,dirty:r=!1,startedEditVersion:s=0,currentEditVersion:o=0,startedRevision:a="",currentRevision:l=""}={}){return t!==n?"superseded":e&&(r||o!==s||l!==a)?"local-edits":""}function kU({savedGraph:e,sentGraph:t,savedRevision:n="",currentRevision:r=""}={}){return{graph:e||t||null,revision:String(n||r||"")}}function vU(e=[]){let t=!1,n=!1,r=!1;for(const s of Array.isArray(e)?e:[]){if((s==null?void 0:s.type)==="position"&&s.position){r=!0,s.dragging===!0&&(t=!0),s.dragging===!1&&(n=!0);continue}if((s==null?void 0:s.type)==="dimensions"&&s.dimensions){r=!0,s.resizing===!0&&(t=!0),s.resizing===!1&&(n=!0);continue}["add","remove","replace"].includes(s==null?void 0:s.type)&&(r=!0)}return{active:t,finished:n,mutated:r}}function Y1(e,t){return{...t,waiters:[...Array.isArray(e==null?void 0:e.waiters)?e.waiters:[],...Array.isArray(t==null?void 0:t.waiters)?t.waiters:[]]}}function SU({background:e=!1}={}){return{graph:!0,nodes:!e,files:!e}}function NU({eventType:e="",revision:t="",currentRevision:n="",targetRevision:r="",refreshPending:s=!1}={}){return e!=="graph.committed"||!t?!1:t===n?!0:t===r&&s}const jU="af:workspace-graph:v2",G1="agentflow.workspace.sidebarCollapsed",Il=["DISPLAY","CONTROL","TOOL","PROVIDE","AGENT"],CU=new Set(["control_start","control_end","control_load_skills","control_load_mcp","control_cd_workspace","control_user_workspace"]),_U={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:""}]},EU={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:""}]},AU={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}]},PU={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}]},IU={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}]},RU={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}]},TU=new Set(["png","jpg","jpeg","gif","webp","svg"]),QR=320,ZR=180,eT=960,Gh=96,tT=900,qx=520,Ux=320,kp=52,Ua=240,Ya=160,Yx="display-ref:",$d="0 9 * * *",MU="Asia/Shanghai",$U="0.1.105";function LU(){const e=new URLSearchParams(window.location.search);return{flowId:e.get("flowId")||"",flowSource:e.get("flowSource")||"user",workspaceId:e.get("workspaceId")||"",archived:e.get("archived")==="1"||e.get("flowArchived")==="1"}}function Ir(e){const t=new URLSearchParams;return e.flowId&&t.set("flowId",e.flowId),e.flowSource&&t.set("flowSource",e.flowSource),e.workspaceId&&t.set("workspaceId",e.workspaceId),e.archived&&t.set("archived","1"),t}function Yk(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 OU(e){const t=Yk(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 Gk(e,t=80){return(Array.isArray(e)?e:[]).map(OU).filter(Boolean).slice(-t)}function DU(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n={};for(const[r,s]of Object.entries(t).slice(-80)){const o=String(r||"").trim();if(!o||!s||typeof s!="object")continue;const a=Gk(s.messages,40),l=Yk(s.draft||"",2e3);!a.length&&!l||(n[o]={sessionId:String(s.sessionId||`nodechat_${o}`),messages:a,...l?{draft:l}:{},candidateContent:"",running:!1,error:""})}return n}function FU(e){return(Array.isArray(e)?e:[]).map(t=>{const n=String((t==null?void 0:t.id)||"").trim();if(!n)return null;const r=Gk(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:Yk((t==null?void 0:t.label)||n,120),status:s==="failed"?"failed":"done",messages:r}}).filter(Boolean).slice(-20)}function J1(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:Gk(n.messages,100),runSessions:FU(n.runSessions)},nodeChats:DU(t.nodeChats)}}function Jh(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 TU.has(n)}function Ld(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=Ir(t||{});return s.set("path",r),n.download&&s.set("download","1"),`/api/workspace/file/raw?${s.toString()}`}function zU(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 BU(e){const t=String((e==null?void 0:e.username)||(e==null?void 0:e.userId)||"").trim();return t?`${G1}:${t}`:G1}function HU(e){try{const t=window.localStorage.getItem(e);if(t==="false")return!1;if(t==="true")return!0}catch{}return!0}function X1(e){return!e||typeof e.closest!="function"?!1:!!e.closest("input, textarea, select, [contenteditable='true']")}function WU(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 VU(e){return!e||typeof e.closest!="function"?!1:!!e.closest(".af-flow-node__prompt-stack")&&!WU(e)}function KU(e){const t=String(e||"").trim();if(!t||qU(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 o=r==="readToolCall"?"读取文件/上下文":r==="grepToolCall"?"搜索代码":r==="editToolCall"?"编辑文件":r;return s==="completed"?`完成:${o}`:`执行:${o}`}return/^\[stderr\]/.test(t)?t:""}function qU(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 UU(e){const t=String(e||"").trim();return t?/^模型/.test(t)?"model":/^(执行|完成|耗时):/.test(t)?"tool":/^运行/.test(t)?"run":/^\[stderr\]/.test(t)?"error":"other":"other"}function Ky(e,t,n,r="Workspace Run"){var c;const s=String(n||"").trim(),o=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=o==null?void 0:o.data)==null?void 0:c.label)||(a==null?void 0:a.label)||"").trim()||s||r}function qy(e,t,n="Workspace Run"){const r=String(e||"").trim()||n,s=String(t||"").trim();return!s||r===s?r:`${r} (${s})`}function Sa(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 Q1(e){const t=String(e||"").trim().toLowerCase();return{unselected:"未选择需求",unavailable:"未连接",json_unsupported:"待升级",command_failed:"读取失败",uninitialized:"未初始化",preflight_blocked:"环境阻塞",tech_design_missing:"缺技术方案",tech_design_draft_review:"方案待确认",tech_design_confirmed:"方案已确认",baseline_missing:"缺基线",plan_missing:"缺计划",plan_draft_review:"计划待确认",issue_binding_missing:"待绑定 Issue",ready_for_implementation:"待实现",implementation_ready:"待实现",implementing:"实现中",implementation_in_progress:"实现中",implementation_review:"实现待审",self_test_ready:"待自测",bugfix:"修 Bug",fix_ready:"待修复",fix_in_progress:"修复中",testing:"已提测",done:"完成",blocked:"阻塞",conflict:"冲突",requirement_changed:"需求变更"}[t]||t||"未知"}function YU(e){const t=String(e||"").trim().toLowerCase();return!t||["unselected","unavailable","json_unsupported","command_failed","uninitialized","preflight_blocked"].includes(t)?-1:/done|complete|closed|finished/.test(t)?3:/bug|fix|testing|test|self_test|submit_test/.test(t)?2:/implement|development|ready_for_implementation|issue_binding|gitlab|mr/.test(t)?1:0}function GU(e){const t=YU(e);return["方案确定","开发","Bug 修复","完成"].map((n,r)=>{let s="pending";return t>r?s="done":t===r&&(s=r===3?"done":"current"),{label:n,status:s}})}function nT(e){const t=String(e||"").trim();if(!/^https?:\/\//i.test(t))return t;try{const n=new URL(t);if(n.hostname==="0.0.0.0"||n.hostname==="::"||n.hostname==="[::]"){const r=window.location.hostname;n.hostname=r&&r!=="0.0.0.0"&&r!=="::"?r:"127.0.0.1"}return n.href}catch{return t}}function Xh(e){const t=String((e==null?void 0:e.url)||(e==null?void 0:e.href)||"").trim();if(t)return nT(t);const n=String((e==null?void 0:e.path)||"").trim();return n?`file://${n}`:""}function sa(e){const t=String(e||"").trim().toLowerCase();return["done","success","completed","passed"].includes(t)?"done":["current","running","active","next"].includes(t)?"current":["observed","observation"].includes(t)?"observed":["superseded","stale","replaced"].includes(t)?"superseded":["blocked","failed","error","conflict"].includes(t)?"blocked":"pending"}function Ga(e){if(!e||typeof e!="object")return"";const t=String(e.truth||e.stateTruth||e.state_truth||"").trim().toLowerCase();return t||(String(e.idempotencyKey||e.idempotency_key||"").trim().startsWith("snapshot-action:")||String(e.source||"")==="prd-flow-client"&&String(e.type||"")==="workflow-action"?"observation":String(e.type||"")==="review-link"?"runtime_event":"")}function Jk(e){return sa(e==null?void 0:e.status)==="done"&&Ga(e)!=="observation"}function Ji(e,t){return!e||typeof e!="object"?`Action ${t+1}`:String(e.title||e.label||e.name||e.actionLabel||e.action_label||e.id||e.action||`Action ${t+1}`)}function th(e){return!e||typeof e!="object"?"":String(e.detail||e.description||e.summary||e.message||e.reason||"")}function Xk(e){return!e||typeof e!="object"?"":[e.code,e.action,e.actionId,e.action_id,e.stage,e.stageKey,e.stage_key,e.type,e.title].map(t=>String(t||"")).join(" ").toLowerCase()}function JU(e,t="当前任务"){const r=[e==null?void 0:e.issueLabel,e==null?void 0:e.issue_label,e==null?void 0:e.title,e==null?void 0:e.label,e==null?void 0:e.name].map(s=>String(s||"")).join(" ").match(/\b(Issue\d+|Bug\d+)\b/i);return r?r[1].replace(/^issue/i,"Issue").replace(/^bug/i,"Bug"):t}function XU(e,t){const n=Ji(e,t),r=sa(e==null?void 0:e.status),s=Jk(e),a=`${Ja(e)} ${Xk(e)}`,l=JU(e);if(/issue-plan:|plan_draft_local|submit-plan|plan-doc|plan_doc_confirmed/.test(a)){if(s)return`${l} 方案已确认`;if(r==="observed"||r==="superseded"||Ga(e)==="observation")return`${l} 方案状态已观察`;if(r==="current"&&/^确认\s+/.test(n))return n}if(/issue-gitlab:|gitlab_issue_missing|ensure-gitlab-issue/.test(a)){if(s)return`已为 ${l} 创建/绑定 GitLab Issue`;if(r==="observed"||r==="superseded"||Ga(e)==="observation")return`${l} GitLab Issue 状态已观察`}return/implementation_in_progress|impl_in_progress/.test(a)?`正在实现 ${l}`:/implementation_ready/.test(a)?`可以开始实现 ${l}`:n}function QU(e){if(!e||typeof e!="object")return"";const t=sa(e.status),n=Ga(e),r=Jk(e),o=`${Ja(e)} ${Xk(e)}`,a=Gm(e),l=a.some(p=>/方案|plan|markdown|review|预览/i.test(String(p.label||""))),c=a.some(p=>/gitlab issue/i.test(String(p.label||""))),u=a.some(p=>/gitlab epic/i.test(String(p.label||"")));if(/issue-plan:|plan_draft_local|submit-plan|plan-doc|plan_doc_confirmed/.test(o))return r?l?"方案已确认并归档;可从下方打开方案文档预览。":"方案已确认并归档。":n==="observation"||t==="observed"?"客户端上报了当前方案阶段;这不是 ai-doc 确认结果。":t==="superseded"?"该客户端观察已被更新状态替代,仅保留为运行态记录。":t==="current"?"方案草稿已生成,等待确认;确认后会归档为正式方案。":"方案草稿已生成,等待确认。";if(/issue-gitlab:|gitlab_issue_missing|ensure-gitlab-issue/.test(o))return r?c&&u?"GitLab Issue 和 Epic 已绑定;可从下方打开关联链接。":c?"GitLab Issue 已绑定;可从下方打开关联链接。":"GitLab Issue 绑定步骤已完成。":n==="observation"||t==="observed"?"客户端上报了 GitLab Issue 阶段;是否已绑定以 GitLab/ai-doc 事实为准。":t==="superseded"?"该客户端观察已被更新状态替代,仅保留为运行态记录。":"方案文档已归档,等待创建或绑定 GitLab Issue。";if(/implementation_in_progress|impl_in_progress/.test(o))return"需求分支已就绪,当前处于实现中;实现 MR 创建后会记录到本 Issue。";if(/implementation_ready/.test(o))return"方案文档和 GitLab Issue 已就绪,等待开始实现。";const d=th(e);return d?d.length>180&&a.length?"相关结果和产物已更新;可从下方链接查看。":d:""}function Qh(e){return!e||typeof e!="object"?"":String(e.time||e.at||e.observedAt||e.observed_at||e.reportedAt||e.reported_at||e.startedAt||e.started_at||e.completedAt||e.completed_at||e.updatedAt||e.updated_at||e.createdAt||e.created_at||"")}const rT="Asia/Shanghai",ZU=new Intl.DateTimeFormat("zh-CN",{timeZone:rT,year:"numeric",month:"2-digit",day:"2-digit"}),eY=new Intl.DateTimeFormat("zh-CN",{timeZone:rT,hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1});function sT(e){const t=Qh(e);if(!t)return null;const n=Date.parse(t);return Number.isFinite(n)?new Date(n):null}function tY(e){const t=sT(e);return t?ZU.format(t).replace(/\//g,"-"):"无时间"}function nY(e){const t=sT(e);return t?eY.format(t):""}function rY(e=[]){const t=[];return(Array.isArray(e)?e:[]).forEach((n,r)=>{const s=tY(n);let o=t[t.length-1];(!o||o.day!==s)&&(o={day:s,items:[]},t.push(o)),o.items.push({item:n,index:r})}),t}function iT(e){const t=sa(e);return t==="done"?"完成":t==="current"?"当前":t==="observed"?"已观察":t==="superseded"?"已更新":t==="blocked"?"阻塞":"待处理"}function Ma(e){const t=String(e||"").trim(),n=t.toLowerCase();return n==="android"?"Android":n==="ios"?"iOS":["all","both","cross-platform","cross_platform"].includes(n)?"双端":t}function sY(e){const t=sa(e==null?void 0:e.status);return Ga(e)==="observation"&&t==="done"?"已观察":iT(t)}function oT(e){if(!e||typeof e!="object")return[];const t=[],n=(o,a,l)=>{const c=String(l||"").trim();c&&t.push({key:`${o}:${c}`,type:o,label:String(a||c),value:c})},r=sa(e.status),s=Ga(e)==="observation"&&r==="done"?"observed":r;return n("status",iT(s),s),n("issue",e.issueKey||e.issue_key||e.issue,e.issueKey||e.issue_key||e.issue),n("platform",Ma(e.platform),e.platform),t}function iY(e=[]){const t=new Map;return(Array.isArray(e)?e:[]).forEach(n=>{oT(n).forEach(r=>{const s=t.get(r.key);t.set(r.key,{...r,count:((s==null?void 0:s.count)||0)+1})})}),Array.from(t.values()).sort((n,r)=>{const s={status:0,issue:1,platform:2,source:3,actor:4};return(s[n.type]??9)-(s[r.type]??9)||r.count-n.count||n.label.localeCompare(r.label)})}function oY(e,t){const n=String(t||"all");return!n||n==="all"?!0:oT(e).some(r=>r.key===n)}function aY(e){if(!e||typeof e!="object")return[];const t=[],n=(r,s)=>{const o=String(s||"").trim();o&&t.push({label:r,value:o})};return n("Issue",e.issueKey||e.issue_key||e.issue),n("平台",Ma(e.platform)),t}function Gm(e){const t=[],n=(c,u)=>{const d=nT(u);d&&t.push({label:String(c||d).trim()||d,href:d})},r=(c,u="链接",d=0)=>{if(d>3||c==null)return;if(typeof c=="string"){(/^(https?:\/\/|file:\/\/)/i.test(c)||c.startsWith("/"))&&n(u,c);return}if(Array.isArray(c)){c.forEach((f,h)=>r(f,`${u} ${h+1}`,d+1));return}if(typeof c!="object")return;const p=c.label||c.title||c.name||c.kind||c.type||u;n(p,c.url||c.href||c.path||c.file||c.filePath||c.file_path);for(const f of["links","urls","artifacts","outputs","output","results","result","files"])c[f]!=null&&r(c[f],f,d+1)},s=Array.isArray(e==null?void 0:e.links)?e.links:[];for(const c of s)typeof c=="string"?n("链接",c):n((c==null?void 0:c.label)||(c==null?void 0:c.title)||(c==null?void 0:c.kind)||"链接",(c==null?void 0:c.url)||(c==null?void 0:c.href));for(const c of Array.isArray(e==null?void 0:e.artifacts)?e.artifacts:[])n((c==null?void 0:c.label)||(c==null?void 0:c.title)||(c==null?void 0:c.kind)||"Artifact",Xh(c));n("TAPD",(e==null?void 0:e.tapdUrl)||(e==null?void 0:e.tapd_url)),n("ai-doc",(e==null?void 0:e.docUrl)||(e==null?void 0:e.doc_url)||(e==null?void 0:e.aiDocUrl)||(e==null?void 0:e.ai_doc_url)),n("Plan",(e==null?void 0:e.planDocUrl)||(e==null?void 0:e.plan_doc_url)||(e==null?void 0:e.planUrl)||(e==null?void 0:e.plan_url)),n("Issue",(e==null?void 0:e.issueUrl)||(e==null?void 0:e.issue_url)),n("GitLab Issue",(e==null?void 0:e.gitlabIssue)||(e==null?void 0:e.gitlab_issue)),n("GitLab Epic",(e==null?void 0:e.gitlabEpic)||(e==null?void 0:e.gitlab_epic)),n("MR",(e==null?void 0:e.mrUrl)||(e==null?void 0:e.mr_url)||(e==null?void 0:e.mergeRequestUrl)||(e==null?void 0:e.merge_request_url)),n("实现 MR",(e==null?void 0:e.implMr)||(e==null?void 0:e.impl_mr)),n("修复 MR",(e==null?void 0:e.fixMr)||(e==null?void 0:e.fix_mr)),n("提测 MR",(e==null?void 0:e.testMr)||(e==null?void 0:e.test_mr)),n("集成 MR",(e==null?void 0:e.integrationMr)||(e==null?void 0:e.integration_mr)),n("Jenkins",(e==null?void 0:e.jenkinsUrl)||(e==null?void 0:e.jenkins_url)||(e==null?void 0:e.jenkinsBuildUrl)||(e==null?void 0:e.jenkins_build_url)),n("安装包",(e==null?void 0:e.jenkinsPackageUrl)||(e==null?void 0:e.jenkins_package_url)),n("二维码",(e==null?void 0:e.jenkinsQrUrl)||(e==null?void 0:e.jenkins_qr_url)),n("调整",(e==null?void 0:e.editUrl)||(e==null?void 0:e.edit_url)||(e==null?void 0:e.adjustUrl)||(e==null?void 0:e.adjust_url)),n("链接",(e==null?void 0:e.url)||(e==null?void 0:e.href)),r(e==null?void 0:e.urls,"URL"),r(e==null?void 0:e.outputs,"产物"),r(e==null?void 0:e.output,"产物"),r(e==null?void 0:e.results,"结果"),r(e==null?void 0:e.result,"结果"),r(e==null?void 0:e.files,"文件");const o=c=>{const u=String(c||"").trim();try{const d=new URL(u,window.location.origin);return`${d.origin}${d.pathname}`}catch{return u.split(/[?#]/)[0]}},a=c=>{const u=String(c||"");return/方案文档/.test(u)?50:/临时/.test(u)?40:/Markdown Review/i.test(u)?20:/预览|review/i.test(u)?10:0},l=new Map;for(const c of t){const u=/\/api\/prd-workflow\/review\//.test(String(c.href||"")),d=u?`review:${o(c.href)}`:`${c.label}
|
|
184
|
-
${c.href}`,p=l.get(d);if(!p){l.set(d,c);continue}if(u){const f=a(p.label),h=a(c.label);(h>f||h===f&&String(c.label||"").length>String(p.label||"").length)&&l.set(d,c)}}return Array.from(l.values())}function aT(e){const t=String((e==null?void 0:e.href)||(e==null?void 0:e.url)||"").trim(),n=[e==null?void 0:e.label,e==null?void 0:e.title,e==null?void 0:e.kind,e==null?void 0:e.type,e==null?void 0:e.source,t].map(r=>String(r||"")).join(" ");return/gitlab|merge[_ -]?request|jenkins|tapd/i.test(n)?!1:/ai[-_ ]?doc|方案文档|技术方案|设计文档|代码审查|code review|markdown review|文档预览|\/api\/prd-workflow\/review\//i.test(n)}function lY(e,t=[]){const n=[],r=new Map;for(const u of Gx(e)){const d=Si(u),p=String((u==null?void 0:u.title)||(u==null?void 0:u.name)||(u==null?void 0:u.summary)||"").trim();d&&p&&r.set(d,p)}const s=(u,d={})=>{const p=f=>{const h=String(d.issueKey||(u==null?void 0:u.issueKey)||(u==null?void 0:u.issue_key)||(u==null?void 0:u.issue)||"").trim(),g=String(d.documentTitle||f.title||(u==null?void 0:u.documentTitle)||(u==null?void 0:u.document_title)||(u==null?void 0:u.title)||"").trim(),k={label:String(f.label||"ai-doc").trim()||"ai-doc",href:String(f.href||f.url||"").trim(),kind:String(f.kind||f.type||"").trim(),title:g||r.get(h)||""};k.href&&aT(k)&&n.push({...d,...k,kind:d.displayKind||k.kind||"ai-doc"})};for(const f of Array.isArray(u==null?void 0:u.artifacts)?u.artifacts:[])!f||typeof f!="object"||p({...f,label:f.label||f.title||f.kind||"ai-doc",href:Xh(f)});for(const f of Gm(u))p(f)};s(e,{displayKind:"ai-doc"});for(const u of Array.isArray(t)?t:[])s(u,{issueKey:String((u==null?void 0:u.issueKey)||(u==null?void 0:u.issue_key)||(u==null?void 0:u.issue)||"").trim(),platform:Ma(u==null?void 0:u.platform),displayKind:"Workflow 文档",documentTitle:String((u==null?void 0:u.documentTitle)||(u==null?void 0:u.document_title)||(u==null?void 0:u.title)||"").trim()});for(const u of["actions","workflowActions","workflow_actions","timeline","history","events","runtimeEvents","runtime_events"])for(const d of Array.isArray(e==null?void 0:e[u])?e[u]:[])s(d,{issueKey:String((d==null?void 0:d.issueKey)||(d==null?void 0:d.issue_key)||(d==null?void 0:d.issue)||"").trim(),platform:Ma(d==null?void 0:d.platform),displayKind:"Workflow 文档",documentTitle:String((d==null?void 0:d.documentTitle)||(d==null?void 0:d.document_title)||(d==null?void 0:d.title)||"").trim()});for(const u of Gx(e))s(u,{issueKey:Si(u),platform:Ma(u==null?void 0:u.platform),displayKind:"Issue 文档",documentTitle:String((u==null?void 0:u.title)||(u==null?void 0:u.name)||(u==null?void 0:u.summary)||"").trim()});const o=u=>{try{const d=new URL(String(u||""),window.location.origin);return`${d.origin}${d.pathname}`}catch{return String(u||"").split(/[?#]/)[0]}},a=u=>{const d=String(u||"");return/技术方案|方案文档/.test(d)?50:/代码审查|code review/i.test(d)?40:/设计文档/.test(d)?30:/markdown review|文档预览/i.test(d)?20:10},l=u=>{const d=String(u||"").trim();if(!d)return 0;const p=d.replace(/^Issue\s*\d+\s*/i,"").trim();return/^(方案文档预览|方案文档|技术方案|设计文档|代码审查|Markdown Review|文档预览)$/i.test(p)?10:100+Math.min(d.length,100)},c=new Map;for(const u of n){const d=o(u.href),p=c.get(d);if(!p){const{displayKind:g,...k}=u;c.set(d,k);continue}const f=a(u.label)>a(p.label)?u.label:p.label,h=l(u.title)>l(p.title)?u.title:p.title;c.set(d,{...u,...p,label:f,title:h,issueKey:p.issueKey||u.issueKey,platform:p.platform||u.platform,kind:p.kind||u.kind})}return Array.from(c.values())}function cY(e){return!e||typeof e!="object"?{}:{marker:e.marker||e.flag||"",command:e.command||e.nextCommand||e.next_command||"",runtimeOnly:e.runtimeOnly===!0||e.runtime_only===!0,markerOnly:e.markerOnly===!0||e.marker_only===!0,url:e.url||e.href||e.mrUrl||e.mr_url||e.mergeRequestUrl||e.merge_request_url||"",mr:e.mr||e.mrUrl||e.mr_url||e.mergeRequestUrl||e.merge_request_url||"",testEnv:e.testEnv||e.test_environment||"",summary:e.summary||e.detail||e.description||"",links:Array.isArray(e.links)?e.links:[],artifacts:Array.isArray(e.artifacts)?e.artifacts:[],outputs:Array.isArray(e.outputs)?e.outputs:[],results:Array.isArray(e.results)?e.results:[]}}function Si(e,t=0){return String((e==null?void 0:e.key)||(e==null?void 0:e.issueKey)||(e==null?void 0:e.issue_key)||(e==null?void 0:e.id)||(e==null?void 0:e.iid)||(e==null?void 0:e.title)||`issue-${t+1}`).trim()}function uY(e,t=0){return String((e==null?void 0:e.title)||(e==null?void 0:e.name)||(e==null?void 0:e.label)||(e==null?void 0:e.summary)||Si(e,t)||`Issue ${t+1}`).trim()}function dY(e){return String((e==null?void 0:e.epicKey)||(e==null?void 0:e.epic_key)||(e==null?void 0:e.epic)||(e==null?void 0:e.epicTitle)||(e==null?void 0:e.epic_title)||(e==null?void 0:e.parentEpic)||(e==null?void 0:e.parent_epic)||"未归类").trim()}function fY(e){return String((e==null?void 0:e.sourceIssue)||(e==null?void 0:e.source_issue)||(e==null?void 0:e.parentKey)||(e==null?void 0:e.parent_key)||(e==null?void 0:e.parent)||(e==null?void 0:e.parentIssue)||(e==null?void 0:e.parent_issue)||"").trim()}function pY(e){const t=Gm(e),n=(s,o)=>{if(Array.isArray(s)){for(const a of s)if(a)if(typeof a=="string")t.push({label:o,href:a});else{const l=a.url||a.href||a.webUrl||a.web_url||a.mrUrl||a.mr_url||a.issueUrl||a.issue_url;l&&t.push({label:a.label||a.title||a.platform||a.kind||o,href:l})}}};n(e==null?void 0:e.mrs,"MR"),n(e==null?void 0:e.mergeRequests,"MR"),n(e==null?void 0:e.merge_requests,"MR"),n(e==null?void 0:e.implMrs,"MR"),n(e==null?void 0:e.impl_mrs,"MR"),n(e==null?void 0:e.platformMrs,"MR"),n(e==null?void 0:e.platform_mrs,"MR");const r=new Set;return t.filter(s=>{const o=String(s.href||"").trim();if(!o)return!1;const a=`${s.label}
|
|
185
|
-
${o}`;return r.has(a)?!1:(r.add(a),!0)})}function hY(e){const t=Array.isArray(e==null?void 0:e.epics)?e.epics:Array.isArray(e==null?void 0:e.epicGroups)?e.epicGroups:Array.isArray(e==null?void 0:e.epic_groups)?e.epic_groups:[],n=[],r=new Map,s=(a,l="")=>{const c=String(a||"未归类").trim()||"未归类";return r.has(c)?l&&r.get(c).title===c&&(r.get(c).title=String(l)):r.set(c,{key:c,title:String(l||c),issues:[]}),r.get(c)};for(const a of t){const l=String((a==null?void 0:a.key)||(a==null?void 0:a.id)||(a==null?void 0:a.title)||(a==null?void 0:a.name)||"未归类").trim(),c=s(l,(a==null?void 0:a.title)||(a==null?void 0:a.name)||l),u=Array.isArray(a==null?void 0:a.issues)?a.issues:Array.isArray(a==null?void 0:a.children)?a.children:Array.isArray(a==null?void 0:a.items)?a.items:[];for(const d of u)d&&typeof d=="object"&&c.issues.push({...d,epicKey:l})}for(const a of Array.isArray(e==null?void 0:e.issues)?e.issues:[])a&&typeof a=="object"&&n.push(a);for(const a of n)s(dY(a)).issues.push(a);const o=a=>{const l=new Map,c=[],u=a.map((d,p)=>Si(d,p));return a.forEach((d,p)=>{const f=Si(d,p);l.set(f,{issue:d,children:[]})}),a.forEach((d,p)=>{const f=Si(d,p),h=fY(d)||dU(d,u),g=l.get(f);h&&l.has(h)?l.get(h).children.push(g):c.push(g)}),c};return Array.from(r.values()).map(a=>({...a,issues:o(a.issues)}))}function Od(e){return String((e==null?void 0:e.actionId)||(e==null?void 0:e.action_id)||(e==null?void 0:e.action)||(e==null?void 0:e.id)||"").trim()}function Ja(e){if(!e||typeof e!="object")return"";const t=String(e.issueKey||e.issue_key||e.issue||"").trim(),n=String(e.action||e.actionId||e.action_id||Od(e)||"").trim(),r=String(e.stageKey||e.stage_key||e.stage||e.phase||e.code||e.pointer||n).trim(),s=[r,n,e.code,e.type,e.title].map(o=>String(o||"")).join(" ").toLowerCase();if(t){if(/plan_draft_local|submit-plan|plan-doc/.test(s))return`issue-plan:${t}`;if(/gitlab_issue_missing|ensure-gitlab-issue/.test(s))return`issue-gitlab:${t}`}return r}function Zh(e){const t=Qh(e)||String((e==null?void 0:e.startedAt)||(e==null?void 0:e.started_at)||(e==null?void 0:e.createdAt)||(e==null?void 0:e.created_at)||(e==null?void 0:e.updatedAt)||(e==null?void 0:e.updated_at)||""),n=Date.parse(t);return Number.isFinite(n)?n:NaN}function Gx(e){var s,o,a,l,c,u,d,p,f,h,g,k;const t=[],n=b=>{b&&typeof b=="object"&&!Array.isArray(b)&&t.push(b)},r=b=>{if(!b||typeof b!="object"||Array.isArray(b))return;const y=Array.isArray(b.issues)?b.issues:Array.isArray(b.children)?b.children:Array.isArray(b.items)?b.items:[];for(const v of y)!v||typeof v!="object"||Array.isArray(v)||(v.issue&&typeof v.issue=="object"?(n(v.issue),Array.isArray(v.children)&&v.children.forEach(w=>n((w==null?void 0:w.issue)||w))):n(v))};return[e==null?void 0:e.issues,(s=e==null?void 0:e.raw)==null?void 0:s.issues,(a=(o=e==null?void 0:e.raw)==null?void 0:o.prd)==null?void 0:a.issues].forEach(b=>{Array.isArray(b)&&b.forEach(n)}),[e==null?void 0:e.epics,e==null?void 0:e.epicGroups,e==null?void 0:e.epic_groups,(l=e==null?void 0:e.raw)==null?void 0:l.epics,(c=e==null?void 0:e.raw)==null?void 0:c.epicGroups,(u=e==null?void 0:e.raw)==null?void 0:u.epic_groups,(p=(d=e==null?void 0:e.raw)==null?void 0:d.prd)==null?void 0:p.epics,(h=(f=e==null?void 0:e.raw)==null?void 0:f.prd)==null?void 0:h.epicGroups,(k=(g=e==null?void 0:e.raw)==null?void 0:g.prd)==null?void 0:k.epic_groups].forEach(b=>{Array.isArray(b)&&b.forEach(r)}),t}function mY(e,t){const n=String(t||"").trim();return n&&Gx(e).find((r,s)=>Si(r,s)===n)||null}function gY(e){var t,n,r,s,o,a,l,c;return String((e==null?void 0:e.gitlabEpic)||(e==null?void 0:e.gitlab_epic)||((t=e==null?void 0:e.prd)==null?void 0:t.gitlabEpic)||((n=e==null?void 0:e.prd)==null?void 0:n.gitlab_epic)||((r=e==null?void 0:e.raw)==null?void 0:r.gitlabEpic)||((s=e==null?void 0:e.raw)==null?void 0:s.gitlab_epic)||((a=(o=e==null?void 0:e.raw)==null?void 0:o.prd)==null?void 0:a.gitlabEpic)||((c=(l=e==null?void 0:e.raw)==null?void 0:l.prd)==null?void 0:c.gitlab_epic)||"").trim()}function yY(e,t){if(!t||typeof t!="object")return t;const n=String(t.issueKey||t.issue_key||t.issue||"").trim(),r=mY(e,n),s=String(t.platform||(r==null?void 0:r.platform)||"").trim(),o=s&&!t.platform?{...t,platform:s}:t,a=String((r==null?void 0:r.gitlabIssue)||(r==null?void 0:r.gitlab_issue)||o.gitlabIssue||o.gitlab_issue||"").trim(),l=gY(e);if(!a&&!l)return o;const c=Ja(o),u=`${c} ${Xk(o)}`;if(!/issue-gitlab:|gitlab_issue_missing|ensure-gitlab-issue|implementation|impl_|fix_|testing|submit-test|self-test/i.test(u))return o;const p=[];a&&p.push({label:"GitLab Issue",kind:"gitlab-issue",durability:"durable",url:a}),l&&p.push({label:"GitLab Epic",kind:"gitlab-epic",durability:"durable",url:l});const f=sa(o.status),h=a&&f==="done"&&/^issue-gitlab:/.test(c)&&/需要.*GitLab Issue/.test(String(o.title||o.label||""));return{...o,...a?{gitlabIssue:a,gitlab_issue:a}:{},...l?{gitlabEpic:l,gitlab_epic:l}:{},...h?{title:String(o.title||o.label||"GitLab Issue 已绑定").replace(/^需要为/,"已为").replace("创建或绑定","创建/绑定"),label:String(o.label||o.title||"GitLab Issue 已绑定").replace(/^需要为/,"已为").replace("创建或绑定","创建/绑定")}:{},artifacts:wi(o.artifacts,p)}}function wi(e,t){const n=[],r=new Set,s=o=>{if(!o)return;const a=typeof o=="string"?o:JSON.stringify(o);r.has(a)||(r.add(a),n.push(o))};return(Array.isArray(e)?e:[]).forEach(s),(Array.isArray(t)?t:[]).forEach(s),n}function Z1(e,t){const n=Zh(t),r=Zh(e),s=Number.isFinite(n)&&(!Number.isFinite(r)||n>=r)?t:e,o=(s==null?void 0:s.status)||(t==null?void 0:t.status)||(e==null?void 0:e.status);return{...e,...t,title:Ji(s,0)||Ji(t,0)||Ji(e,0),detail:th(s)||th(t)||th(e),status:o,links:wi(e==null?void 0:e.links,t==null?void 0:t.links),artifacts:wi(e==null?void 0:e.artifacts,t==null?void 0:t.artifacts),outputs:wi(e==null?void 0:e.outputs,t==null?void 0:t.outputs),results:wi(e==null?void 0:e.results,t==null?void 0:t.results),events:wi(e==null?void 0:e.events,t==null?void 0:t.events),createdAt:(e==null?void 0:e.createdAt)||(e==null?void 0:e.created_at)||(t==null?void 0:t.createdAt)||(t==null?void 0:t.created_at),startedAt:(e==null?void 0:e.startedAt)||(e==null?void 0:e.started_at)||(t==null?void 0:t.startedAt)||(t==null?void 0:t.started_at),updatedAt:(s==null?void 0:s.updatedAt)||(s==null?void 0:s.updated_at)||(t==null?void 0:t.updatedAt)||(t==null?void 0:t.updated_at)||(e==null?void 0:e.updatedAt)||(e==null?void 0:e.updated_at)}}function wY(e,t){const n=[],r=new Map,s=new Map,o=new Map,a=p=>{var f,h;return!!(!p||typeof p!="object"||p.auxiliary===!0||p.auxiliary_event===!0||String(p.type||"")==="review-link"||String(p.type||"")==="action-preview"||p.preview===!0||String(p.type||"")==="same-platform-stage-conflict"&&/\/api\/prd-workflow\/review\//.test(String(((f=p.conflict)==null?void 0:f.previousArtifact)||((h=p.conflict)==null?void 0:h.incomingArtifact)||"")))},l=(p,f)=>({...p,links:wi(p==null?void 0:p.links,f==null?void 0:f.links),artifacts:wi(p==null?void 0:p.artifacts,f==null?void 0:f.artifacts),outputs:wi(p==null?void 0:p.outputs,f==null?void 0:f.outputs),results:wi(p==null?void 0:p.results,f==null?void 0:f.results)}),c=(p,f)=>{if(!p)return;const h=r.get(p);if(h!=null){n[h]=l(n[h],f);return}o.set(p,l(o.get(p)||{},f))},u=(p,f)=>p&&o.has(p)?l(f,o.get(p)):f,d=p=>{if(Array.isArray(p))for(const f of p){const h=Ja(f);if(a(f)){c(h,f);continue}const g=String(f.id||f.eventId||f.event_id||f.actionId||f.action_id||"").trim(),k=h||g,b=k?r.get(k)??s.get(g):null;k&&b!=null?(n[b]=u(h,Z1(n[b],f)),h&&r.set(h,b),g&&s.set(g,b)):(k&&r.set(k,n.length),g&&s.set(g,n.length),n.push(u(h,f)))}};if(d(e==null?void 0:e.actions),d(e==null?void 0:e.workflowActions),d(e==null?void 0:e.workflow_actions),d(e==null?void 0:e.timeline),d(e==null?void 0:e.history),d(e==null?void 0:e.events),d(e==null?void 0:e.runtimeEvents),d(e==null?void 0:e.runtime_events),t&&typeof t=="object"){const p=Od(t),f=Ja(t),h=f?r.get(f):p?s.get(p):null,g={...t,status:t.status||"next",kind:"next_action"};h!=null&&(n[h]=Z1(n[h],g))}return n.map((p,f)=>({item:p,index:f,ts:Zh(p)})).filter(p=>Number.isFinite(p.ts)).sort((p,f)=>f.ts-p.ts||p.index-f.index).map(p=>yY(e,p.item))}function xY(e){return(Array.isArray(e==null?void 0:e.runtimeEvents)?e.runtimeEvents:Array.isArray(e==null?void 0:e.runtime_events)?e.runtime_events:[]).filter(n=>n&&typeof n=="object").map((n,r)=>({item:n,index:r,ts:Zh(n)})).sort((n,r)=>{const s=Number.isFinite(n.ts),o=Number.isFinite(r.ts);return s&&o?r.ts-n.ts||r.index-n.index:s?-1:o?1:r.index-n.index}).slice(0,8).map(n=>n.item)}function bY(e,t){const n=String(t||"all");if(n==="all")return!0;const r=[e==null?void 0:e.status,e==null?void 0:e.type,e==null?void 0:e.kind,e==null?void 0:e.title,e==null?void 0:e.detail,e==null?void 0:e.error,JSON.stringify((e==null?void 0:e.links)||[]),JSON.stringify((e==null?void 0:e.artifacts)||[])].join(" ").toLowerCase();return n==="errors"?/error|failed|conflict|blocked|stale|revision|冲突|失败/.test(r):n==="review"?/review|temporary-review|临时/.test(r):n==="external"?/mr|merge request|gitlab|jenkins|package|build|tapd/.test(r):!0}function kY(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,o=Number.isFinite(r)&&Number.isFinite(s)?`(+${Sa(r)} / 总 ${Sa(s)})`:"";return`${t+1}. ${n}${o}`}function lT(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 Rl(...e){for(const t of e){const n=Number(t);if(Number.isFinite(n))return n}return NaN}function vY(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 SY(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 NY(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 jY(e){var o,a,l;const t=lT(e);if(!t||typeof t!="object")return null;const n=String(t.type||""),r=String(t.subtype||""),s=Rl(t.timestamp_ms,t.completedAtMs,t.startedAtMs,e==null?void 0:e.ts,Date.now());if(n==="tool_call"&&r==="completed"){const c=SY(t),u=vY(t),d=Rl(t.startedAtMs,c==null?void 0:c.startedAtMs),p=Rl(t.completedAtMs,c==null?void 0:c.completedAtMs),f=((o=c==null?void 0:c.result)==null?void 0:o.success)||((a=c==null?void 0:c.result)==null?void 0:a.failure)||{},h=Number.isFinite(d)&&Number.isFinite(p)?Math.max(0,p-d):Rl(f.executionTime,f.localExecutionTimeMs),g=String(((l=c==null?void 0:c.args)==null?void 0:l.command)||f.command||"").trim(),k=g?g.split(`
|
|
186
|
-
`).find(Boolean)||g:"";return{kind:"tool",label:NY(u,c),durationMs:Number.isFinite(h)?h:null,at:s,detail:k?k.slice(0,90):""}}if(n==="result"){const c=Rl(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 eC(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()),o=Array.isArray(t)?t:[],a=[...o].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=Rl(a==null?void 0:a.durationMs,l==null?void 0:l.totalMs,c),d=s.filter(b=>b.kind==="model").reduce((b,y)=>b+(Number(y.stepMs)||0),0),p=o.filter(b=>(b==null?void 0:b.kind)==="tool"),f=p.reduce((b,y)=>b+(Number(y.durationMs)||0),0),h=o.filter(b=>(b==null?void 0:b.kind)==="network").length,g=[...s.filter(b=>Number(b.stepMs)>=1e3).map(b=>({label:b.text,durationMs:Number(b.stepMs),detail:"Activity 间隔"})),...p.filter(b=>Number(b.durationMs)>=1e3).map(b=>({label:b.label,durationMs:Number(b.durationMs),detail:b.detail||"工具实际执行"}))].sort((b,y)=>y.durationMs-b.durationMs).slice(0,6),k=["耗时概览"];return Number.isFinite(u)&&k.push(`- 当前总耗时:${Sa(u)}`),d>0&&k.push(`- 模型相关间隔:约 ${Sa(d)}(按 Activity 间隔估算)`),p.length>0&&k.push(`- 工具实际执行:${Sa(f)}(${p.length} 次完成事件)`),h>0&&k.push(`- 网络/会话恢复事件:${h} 次`),g.length>0&&(k.push(""),k.push("慢步骤"),g.forEach((b,y)=>{const v=b.detail?` · ${b.detail}`:"";k.push(`${y+1}. ${b.label}:${Sa(b.durationMs)}${v}`)})),s.length>0&&(k.push(""),k.push("最近 Activity"),s.slice(-10).forEach((b,y)=>{k.push(kY(b,y))})),p.length>0&&(k.push(""),k.push("最近工具完成"),p.slice(-8).forEach((b,y)=>{const v=Number.isFinite(Number(b.durationMs))?` ${Sa(b.durationMs)}`:"",w=b.detail?` · ${b.detail}`:"";k.push(`${y+1}. ${b.label}${v}${w}`)})),k.join(`
|
|
187
|
-
`)}function tC(e){if(String((e==null?void 0:e.type)||"")!=="raw"||String((e==null?void 0:e.eventType)||"")!=="thinking")return"";const t=lT(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 cT(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 uT(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function Qk(e){if(!e)return"";const t=String(e.baseDefinitionId||"").trim();return t||String(e.id||"").trim()}function dT(e){const t=String(e??"");return/^[A-Za-z0-9_@%+=:,./-]+$/.test(t)?t:"'"+t.replace(/'/g,"'\\''")+"'"}function CY(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 _Y(e){const t=String(e??"").trim();return t?t.includes("${")?t:dT(t):""}function fT(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(/\/+$/,""),o=s?`${s}/${n}`:`\${flowDir}/${n}`,a=Array.isArray(t.args)?t.args.map(_Y).filter(Boolean):[];return[CY(t,n),dT(o),...a].join(" ")}return String(t.command||"").trim()}function Mu(e){const t=String(Qk(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 nC(e){return e==="DISPLAY"?"preview":e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function em(e){return String((e==null?void 0:e.displayName)||(e==null?void 0:e.label)||(e==null?void 0:e.id)||"Node")}function $u(e){return em(e)}function Jx(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function vp(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 rC(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(),o=String((t==null?void 0:t.default)??(t==null?void 0:t.value)??"").trim();return[e,r,s?`type: ${s}`:"",o?`default: ${o}`:""].filter(Boolean).join(" · ")}function sC(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 Uy(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])),o=Hx(s.get(n),e.sourceHandle||"output-0","source"),a=Hx(s.get(r),e.targetHandle||"input-0","target");return!!(o&&a&&Td(o,a))}function EY(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 o=t.find(l=>l.id===n),a=Hx(o,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:aq(a)}:null}function AY(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 o=0;o<s.length;o+=1){const a=s[o];if(!(t.handleType==="source"?Td(t.slot,a):Td(a,t.slot)))continue;const c=Mu(n);return{def:n,order:r,category:c,categoryRank:Il.indexOf(c),slot:a,slotIndex:o,displayLabel:$u(n),description:Jx(n)}}return null}).filter(Boolean).sort((n,r)=>{var a,l;const s=(a=n.slot)!=null&&a.required?0:1,o=(l=r.slot)!=null&&l.required?0:1;return s-o||n.slotIndex-r.slotIndex||n.categoryRank-r.categoryRank||n.order-r.order}):[]}function PY(e,t,n){var o,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 d=Array.isArray(s?(o=u.data)==null?void 0:o.inputs:(a=u.data)==null?void 0:a.outputs)?s?u.data.inputs:u.data.outputs:[];for(let p=0;p<d.length;p+=1){const f=d[p];if((f==null?void 0:f.showOnNode)===!1||!(s?Td(n.slot,f):Td(f,n.slot)))continue;const g=s?{source:n.nodeId,sourceHandle:n.handleId,target:u.id,targetHandle:`input-${p}`}:{source:u.id,sourceHandle:`output-${p}`,target:n.nodeId,targetHandle:n.handleId},k=(t||[]).some(b=>b.target===g.target&&b.targetHandle===g.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:f,slotIndex:p,handleId:s?g.targetHandle:g.sourceHandle,connection:g,occupied:k})}}return r.sort((u,d)=>{var k,b,y,v,w,C,N,j;const p=Number(((b=(k=u.node)==null?void 0:k.position)==null?void 0:b.y)||0),f=Number(((v=(y=d.node)==null?void 0:y.position)==null?void 0:v.y)||0),h=Number(((C=(w=u.node)==null?void 0:w.position)==null?void 0:C.x)||0),g=Number(((j=(N=d.node)==null?void 0:N.position)==null?void 0:j.x)||0);return p-f||h-g||u.slotIndex-d.slotIndex||String(u.nodeId).localeCompare(String(d.nodeId))})}function Jl(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 IY(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 o=`${n}_${s}`;if(!r.has(o))return o}return`${n}_${Date.now().toString(36)}`}function RY(e){return(e==null?void 0:e.default)!=null?String(e.default):(e==null?void 0:e.value)!=null?String(e.value):""}function TY(e){const t=Number(e);if(!Number.isFinite(t)||t<=0)return $d;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} * * *`:$d}function Mo(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 Zk(e){const t=String(e||"").trim().match(/^(\d{1,2}):(\d{1,2})$/);return t?`${Mo(t[1],9,0,23)}:${Mo(t[2],0,0,59)}`:"09:00"}function Lu(e,t,n,r,s){const o=Zk(t),[a,l]=o.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()||$d:`${l} ${a} * * *`}function MY(e){const n=String(e||$d).trim().split(/\s+/);if(n.length!==5)return{scheduleType:"custom",time:"09:00",weekday:1,monthDay:1};const[r,s,o,a,l]=n,c=Number.parseInt(r,10),u=Number.parseInt(s,10),d=Number.isFinite(c)&&Number.isFinite(u)&&r===String(c)&&s===String(u),p=d?`${Mo(u,9,0,23)}:${Mo(c,0,0,59)}`:"09:00";return d&&o==="*"&&a==="*"&&l==="*"?{scheduleType:"daily",time:p,weekday:1,monthDay:1}:d&&o==="*"&&a==="*"&&/^\d+$/.test(l)?{scheduleType:"weekly",time:p,weekday:Math.max(0,Math.min(6,Number.parseInt(l,10))),monthDay:1}:d&&/^\d+$/.test(o)&&a==="*"&&l==="*"?{scheduleType:"monthly",time:p,weekday:1,monthDay:Math.max(1,Math.min(31,Number.parseInt(o,10)))}:{scheduleType:"custom",time:p,weekday:1,monthDay:1}}function ev(e){let t={};const n=String(e||"").trim();if(n)try{t=JSON.parse(n)}catch{t={}}const r=Number(t.intervalMinutes),s=TY(r),o=typeof t.cron=="string"&&t.cron.trim()?t.cron.trim():s,a=MY(o),l=["daily","weekly","monthly","custom"].includes(t.scheduleType)?t.scheduleType:a.scheduleType,c=Zk(t.time||a.time||"09:00"),u=Math.max(0,Math.min(6,Number.parseInt(String(t.weekday??a.weekday??1),10)||1)),d=Math.max(1,Math.min(31,Number.parseInt(String(t.monthDay??a.monthDay??1),10)||1)),p=Lu(l,c,u,d,o);return{enabled:t.enabled===!0,scheduleType:l,time:c,weekday:u,monthDay:d,cron:p,timezone:MU,targetRunNodeId:typeof t.targetRunNodeId=="string"?t.targetRunNodeId.trim():"",overlapPolicy:"skip"}}function $Y(e){const t=ev(JSON.stringify(e||{}));return JSON.stringify(t)}function LY(e){const t=Number(e||0);return!Number.isFinite(t)||t<=0?"-":new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function OY(e){return e==="weekly"?"每周":e==="monthly"?"每月":e==="custom"?"高级 Cron":"每天"}function iC(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 Sp(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:iC(n.nextRunAt),lastAt:iC(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 td(e){var t;return!!((t=e==null?void 0:e.data)!=null&&t.isWorkspaceGroup)}function tm(e){return e>0?`Group ${e+1}`:"Group"}function DY(e){return(Array.isArray(e)?e:[]).map((n,r)=>{const s=String((n==null?void 0:n.id)||`group_${r+1}`).trim(),o=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(o)||!Number.isFinite(a)||!Number.isFinite(l)||!Number.isFinite(c)?null:{id:s,title:String((n==null?void 0:n.title)||tm(r)).trim()||tm(r),color:String((n==null?void 0:n.color)||"purple").trim()||"purple",x:o,y:a,width:Math.max(Ua,Math.round(l)),height:Math.max(Ya,Math.round(c))}}).filter(Boolean)}function FY(e){var n;return DY((n=e==null?void 0:e.ui)==null?void 0:n.groups).map(r=>({id:r.id,type:lc,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 Xx(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(Ua,Math.round(t)),height:Math.max(Ya,Math.round(n))}}function Ou(e){return(Array.isArray(e)?e:[]).map(t=>({type:(t==null?void 0:t.type)||"node",name:(t==null?void 0:t.name)||"",default:RY(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 pT(e){const t=(e==null?void 0:e.data)||{},n=r=>(Array.isArray(r)?r:[]).map((s,o)=>(s==null?void 0:s.showOnNode)===!1?"":[o,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 zY(e){var o,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=Jm(t);return[pT(e),Cn(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(((o=e==null?void 0:e.measured)==null?void 0:o.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 BY(e,t){return!e||!t?!1:e.selected===t.selected&&e.isExecuting===t.isExecuting&&e.nodeStatus===t.nodeStatus&&e.nodeElapsed===t.nodeElapsed&&e.optimizingRun===t.optimizingRun&&e.scheduledRunState===t.scheduledRunState&&e.nodeChatActive===t.nodeChatActive&&e.nodeChat===t.nodeChat}function vu(e,t){var h,g;const n=e!=null&&e.instances&&typeof e.instances=="object"?e.instances:{},r=gT(n),s=Array.isArray(e==null?void 0:e.edges)?e.edges:[],o=(h=e==null?void 0:e.ui)!=null&&h.nodePositions&&typeof e.ui.nodePositions=="object"?e.ui.nodePositions:{},a=(g=e==null?void 0:e.ui)!=null&&g.nodeSizes&&typeof e.ui.nodeSizes=="object"?e.ui.nodeSizes:{},l=new Set(Object.keys(r));for(const k of s)k!=null&&k.source&&l.add(String(k.source)),k!=null&&k.target&&l.add(String(k.target));const u=Array.from(l).map(k=>{const b=r[k]||{},y=b.definitionId||k,v=t.find(F=>F.id===y),w=Qk(v)||y,C=t.find(F=>F.id===w)||v,N=b.marketplaceRef||uT(v),j=fT(v),A=o[k]&&typeof o[k].x=="number"&&typeof o[k].y=="number"?o[k]:{x:320+l.size*20,y:180+l.size*12},I=!!Cn({definitionId:w,inputs:b.input,outputs:b.output}),D=a[k]&&typeof a[k].width=="number"&&typeof a[k].height=="number"?{width:a[k].width,height:a[k].height}:null,B=$a(D,{display:I}),W=B&&!Js(w);return{id:k,type:lc,position:A,...W?{width:B.width,height:B.height}:{},data:{label:b.label||em(v)||em(C)||k,definitionId:w,...N?{marketplaceRef:N}:{},...v!=null&&v.packageId?{marketplacePackageId:v.packageId}:{},...v!=null&&v.version?{marketplaceVersion:v.version}:{},schemaType:cT(w,C||v),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||"",...W?{nodeSize:B}:{},...I&&W?{displaySize:B}:{}}}}).map(k=>Vx(k,r,t)),d=FY(e),p=s.filter(k=>(k==null?void 0:k.source)&&(k==null?void 0:k.target)).filter(k=>!d.some(b=>b.id===String(k.source)||b.id===String(k.target))).map((k,b)=>({id:k.id||`we-${k.source}-${k.target}-${b}`,source:String(k.source),target:String(k.target),sourceHandle:k.sourceHandle??void 0,targetHandle:k.targetHandle??void 0,markerEnd:{type:gi.ArrowClosed}})),f=[...d,...u];return{nodes:f,edges:Tq(p,f),instances:r}}function oC(e){return`${Yx}${e}`}function Yy(e){const t=String(e||"");return t.startsWith(Yx)?t.slice(Yx.length):t}function Qx(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 nh(e,t=[]){const n=new Map((Array.isArray(t)?t:[]).filter(p=>{var f;return Xa((f=p==null?void 0:p.data)==null?void 0:f.definitionId)}).map(p=>[p.id,p])),r=Array.isArray(e==null?void 0:e.nodeIds)?e.nodeIds:[],s=[],o=new Set;for(const p of r){const f=String(p||"").trim();!f||o.has(f)||!n.has(f)||(o.add(f),s.push(f))}const a={},l=e!=null&&e.nodePositions&&typeof e.nodePositions=="object"?e.nodePositions:{};s.forEach((p,f)=>{const h=l[p];a[p]=h&&typeof h.x=="number"&&typeof h.y=="number"?{x:h.x,y:h.y}:{x:180+f*36,y:120+f*28}});const c={},u=e!=null&&e.nodeSizes&&typeof e.nodeSizes=="object"?e.nodeSizes:{};s.forEach(p=>{const f=$a(u[p],{display:!0});f&&(c[p]=f)});const d=Qx(e==null?void 0:e.viewport);return{nodeIds:s,nodePositions:a,nodeSizes:c,...d?{viewport:d}:{}}}function aC(e,t=[]){return nh(e,t)}const Gy=[{value:"1",label:"1 天"},{value:"7",label:"7 天"},{value:"30",label:"30 天"},{value:"90",label:"90 天"},{value:"365",label:"1 年"},{value:"permanent",label:"永久"}];function Jy(e={}){return{title:"",layout:"gallery",nodeIds:[],expiresInDays:30,permanent:!1,...e}}function lC(e={}){return e.permanent?"permanent":String(e.expiresInDays||30)}function cC(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 HY(e={}){if(!e.expiresAt)return"永久有效";const t=Date.parse(String(e.expiresAt||""));return Number.isFinite(t)?`有效期至 ${new Date(t).toLocaleString()}`:"永久有效"}function uC(e={}){return new URL(e.url||`/display/${e.id||""}`,window.location.origin).href}const hT="af:workspace:canvas-clipboard",mT="agentflow.workspace.canvas-clipboard";function WY(e){return JSON.stringify({type:mT,version:1,clipboard:e})}function VY(e){try{const t=JSON.parse(String(e||""));if((t==null?void 0:t.type)!==mT)return null;const n=t.clipboard;return!n||!Array.isArray(n.nodes)||n.nodes.length===0?null:n}catch{return null}}function KY(e){try{localStorage.setItem(hT,WY(e))}catch{}}function qY(){try{return VY(localStorage.getItem(hT))}catch{return null}}function UY(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}async function dC(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 fC(e,t,n){const r=Number(e);return!Number.isFinite(r)||r<=0?0:Math.min(n,Math.max(t,Math.round(r)))}function $a(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:fC(n,ZR,eT)||QR,height:fC(r,Gh,tT)||Gh}}function nm(e){const t=$a(e,{display:!0});return t?{width:Math.max(320,Math.round(t.width)),height:Math.max(180,Math.round(t.height))}:null}function YY(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:qx,height:Ux}}function GY(e,t=""){const n=nm(e==null?void 0:e.displaySize);if(n)return n;const r=nm(e==null?void 0:e.nodeSize);if(r)return r;const s=Xa(t)||sf(Jo((e==null?void 0:e.inputs)||(e==null?void 0:e.input)||[],"displayType","markdown"));return YY(s)}function Tl(e){var s,o,a,l,c,u,d,p,f,h,g;if(Js((s=e==null?void 0:e.data)==null?void 0:s.definitionId))return null;const t=!!Cn(e==null?void 0:e.data),n=Number(((a=(o=e==null?void 0:e.data)==null?void 0:o.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(((p=(d=e==null?void 0:e.data)==null?void 0:d.displaySize)==null?void 0:p.height)||((h=(f=e==null?void 0:e.data)==null?void 0:f.nodeSize)==null?void 0:h.height)||(e==null?void 0:e.height)||(t?(g=e==null?void 0:e.measured)==null?void 0:g.height:0)||0);return $a({width:n,height:r},{display:t})}function El(e,t,n){var d,p,f,h,g,k,b,y,v,w,C,N,j;const r=(e||[]).filter(A=>!td(A)),s=(e||[]).filter(td),o=gT(qk(r,n||{})),a=t.map(A=>({source:A.source,target:A.target,sourceHandle:A.sourceHandle??null,targetHandle:A.targetHandle??null})).filter(A=>!s.some(I=>I.id===A.source||I.id===A.target)),l={},c={},u=[];for(const A of r){l[A.id]={x:((d=A.position)==null?void 0:d.x)||0,y:((p=A.position)==null?void 0:p.y)||0};const I=Tl(A);I&&(c[A.id]=I)}for(const A of s){const I=Number(((h=(f=A.data)==null?void 0:f.nodeSize)==null?void 0:h.width)||A.width||((g=A.measured)==null?void 0:g.width)||0),D=Number(((b=(k=A.data)==null?void 0:k.nodeSize)==null?void 0:b.height)||A.height||((y=A.measured)==null?void 0:y.height)||0);u.push({id:A.id,title:String(((v=A.data)==null?void 0:v.title)||((w=A.data)==null?void 0:w.label)||"Group"),color:String(((C=A.data)==null?void 0:C.color)||"purple"),x:Number(((N=A.position)==null?void 0:N.x)||0),y:Number(((j=A.position)==null?void 0:j.y)||0),width:Math.max(Ua,Math.round(I||Ua)),height:Math.max(Ya,Math.round(D||Ya))})}return{version:1,instances:o,edges:a,ui:{nodePositions:l,nodeSizes:c,groups:u}}}function gT(e){const t={};for(const[n,r]of Object.entries(e||{})){const s=String((r==null?void 0:r.definitionId)||n);if(!!Xa(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 Xa(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 Cn(e){const t=Xa(e==null?void 0:e.definitionId);return t||(Js(e==null?void 0:e.definitionId)&&Jm(e)?sf(Jo((e==null?void 0:e.inputs)||(e==null?void 0:e.input)||[],"displayType","markdown")):"")}function Xi(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],n=Cn(e),r=Js(e==null?void 0:e.definitionId),s=n==="image"?"src":"content",o=u=>String((u==null?void 0:u.value)??(u==null?void 0:u.default)??""),a=u=>o(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?o(l):"";return String(r?c:(e==null?void 0:e.body)||c)}function Go(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 JY(e){let t=String(e||"").replace(/\r\n/g,`
|
|
188
|
-
`).trim();return t.includes(`
|
|
189
|
-
`)||(t=t.replace(/\s+(resultFile|result|outParams|outParams\.[A-Za-z_][A-Za-z0-9_-]*)\s*:/g,`
|
|
190
|
-
$1:`).replace(/(^|\n)outParams:\s+([A-Za-z_][A-Za-z0-9_-]*\s*:)/g,`$1outParams:
|
|
191
|
-
$2`)),t}function Ni(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=JY(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 d=String(c[1]||"").trim();return d==="|"||d===">"?a.slice((c.index||0)+c[0].length).split(`
|
|
192
|
-
`).filter(f=>/^\s+/.test(f)||!f.trim()).map(f=>f.replace(/^\s{2}/,"")).join(`
|
|
193
|
-
`).replace(/\s+$/g,""):d.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("{"),o=t.lastIndexOf("}");s>=0&&o>s&&r.unshift(t.slice(s,o+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 Qa(e,t){const n=Ir(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 Zx(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 XY(e,t=[],n=[]){const r=String(e||"");if(!r)return"";const s=new Map(t.map(o=>[o.id,o]));return(Array.isArray(n)?n:[]).filter(o=>String((o==null?void 0:o.target)||"")===r).slice(0,4).map(o=>{const a=s.get(String((o==null?void 0:o.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(`
|
|
194
|
-
`)}).filter(Boolean).join(`
|
|
195
|
-
|
|
196
|
-
`)}function $c(e){let t=Ni(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 o=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*)$/);o&&o[1]&&(t=o[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((o,a)=>{const l=a.exec(t);return l?o<0?l.index:Math.min(o,l.index):o},-1);return s>0&&(t=t.slice(s).trim()),t}function QY(e){const t=$c(e);return t.trim()?/<[^>]*$/g.test(t)?"HTML 内容末尾存在未闭合标签,可能是生成或保存时被截断。":/^(?:<!doctype\b|<html\b)/i.test(t)&&!/<\/html\s*>/i.test(t)?"完整 HTML 文档缺少 </html> 结束标签,可能是生成或保存时被截断。":"":""}function Ea(e,t){return e==="html"?QY(t):""}function yT(e,t=""){const n=$c(e);if(!n.trim())return"";const s=`<base target="_blank"><script data-agentflow-display-link-guard="1">
|
|
197
|
-
(() => {
|
|
198
|
-
const frameId = ${JSON.stringify(String(t||""))};
|
|
199
|
-
const postSize = () => {
|
|
200
|
-
const doc = document.documentElement;
|
|
201
|
-
const body = document.body;
|
|
202
|
-
const height = Math.ceil(Math.max(
|
|
203
|
-
doc ? doc.scrollHeight : 0,
|
|
204
|
-
doc ? doc.offsetHeight : 0,
|
|
205
|
-
doc ? doc.clientHeight : 0,
|
|
206
|
-
body ? body.scrollHeight : 0,
|
|
207
|
-
body ? body.offsetHeight : 0,
|
|
208
|
-
body ? body.clientHeight : 0,
|
|
209
|
-
window.innerHeight || 0
|
|
210
|
-
));
|
|
211
|
-
window.parent.postMessage({ source: "agentflow-html-display-size", frameId, height }, "*");
|
|
212
|
-
};
|
|
213
|
-
document.addEventListener("click", (event) => {
|
|
214
|
-
const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
|
|
215
|
-
if (!link) return;
|
|
216
|
-
const rawHref = String(link.getAttribute("href") || "").trim();
|
|
217
|
-
if (!rawHref || rawHref.startsWith("#")) return;
|
|
218
|
-
if (/^javascript:/i.test(rawHref)) {
|
|
219
|
-
event.preventDefault();
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
event.preventDefault();
|
|
223
|
-
window.open(link.href, "_blank", "noopener,noreferrer");
|
|
224
|
-
}, true);
|
|
225
|
-
window.addEventListener("load", postSize);
|
|
226
|
-
window.addEventListener("resize", postSize);
|
|
227
|
-
requestAnimationFrame(postSize);
|
|
228
|
-
setTimeout(postSize, 60);
|
|
229
|
-
setTimeout(postSize, 300);
|
|
230
|
-
if (typeof ResizeObserver !== "undefined") {
|
|
231
|
-
const resizeObserver = new ResizeObserver(postSize);
|
|
232
|
-
resizeObserver.observe(document.documentElement);
|
|
233
|
-
if (document.body) resizeObserver.observe(document.body);
|
|
234
|
-
}
|
|
235
|
-
if (typeof MutationObserver !== "undefined") {
|
|
236
|
-
const mutationObserver = new MutationObserver(postSize);
|
|
237
|
-
mutationObserver.observe(document.documentElement, { childList: true, subtree: true, attributes: true, characterData: true });
|
|
238
|
-
}
|
|
239
|
-
})();
|
|
240
|
-
<\/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 ZY(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 eG(e,t){const n=document.createElement("a");n.href=e,n.download=t,document.body.appendChild(n),n.click(),n.remove()}function tG(e,t){const n=URL.createObjectURL(e);try{eG(n,t)}finally{window.setTimeout(()=>URL.revokeObjectURL(n),1e3)}}function wT(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 nG(e){const t=wT(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>"}
|
|
241
|
-
${t.documentElement.outerHTML}`:""}function Xy(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 rG(e,t,n,r={}){var b;const s=(b=e==null?void 0:e.getBoundingClientRect)==null?void 0:b.call(e),o=wT(e),a=o==null?void 0:o.documentElement,l=o==null?void 0:o.body,c=(r==null?void 0:r.card)||null,u=(r==null?void 0:r.displayBody)||null,d=(r==null?void 0:r.scroller)||null,p=(r==null?void 0:r.displaySize)||null,f={fallbackWidth:Number(t)||null,fallbackHeight:Number(n)||null,displaySizeWidth:Number((p==null?void 0:p.width)||0)||null,displaySizeHeight:Number((p==null?void 0:p.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:Xy(c),displayBody:Xy(u),scroller:Xy(d)},h=[Number(t)||0,Number((p==null?void 0:p.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((d==null?void 0:d.clientWidth)||0),Number((d==null?void 0:d.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(y=>Math.ceil(y)).filter(y=>y>0),g=Math.max(1,...h.length?h:[960]),k=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:g,height:k,debug:f}}async function sG({flowParams:e,content:t,sourceFilePath:n,iframe:r,width:s,height:o,filename:a,snapshotElements:l,displaySize:c}){const u=rG(r,s,o,{...l||{},displaySize:c}),d=nG(r),p=await fetch("/api/workspace/html-screenshot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,content:d||t,sourceFilePath:n||"",width:u.width,height:u.height,filename:a})});if(!p.ok){const h=await p.json().catch(()=>({}));throw new Error(h.error||"截图失败")}const f=await p.blob();tG(f,a)}function iG(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 xT(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 oG(e){const t=String(e||"").split(/\r?\n/).map(l=>l.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[];let s="TD";const o=(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?o(u[1],u[2]||u[3]||u[4]||u[1]):o(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 bT({code:e}){const t=m.useMemo(()=>oG(e),[e]);if(!String(e||"").trim())return null;const n=t.direction==="LR"||t.direction==="RL",r=142,s=44,o=n?96:32,a=n?30:68,l=new Map;t.nodes.forEach((d,p)=>{l.set(d.id,{x:24+(n?p*(r+o):p%3*(r+o)),y:24+(n?p%3*(s+a):p*(s+a))})});const c=Math.max(360,...Array.from(l.values()).map(d=>d.x+r+24)),u=Math.max(180,...Array.from(l.values()).map(d=>d.y+s+24));return i.jsx("div",{className:"af-work-node__mermaid-preview",children:i.jsxs("svg",{viewBox:`0 0 ${c} ${u}`,role:"img","aria-label":"Mermaid preview",children:[i.jsx("defs",{children:i.jsx("marker",{id:"af-work-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:i.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),t.edges.map((d,p)=>{const f=l.get(d.from),h=l.get(d.to);if(!f||!h)return null;const g=n?`M ${f.x+r} ${f.y+s/2} C ${(f.x+h.x+r)/2} ${f.y+s/2}, ${(f.x+h.x+r)/2} ${h.y+s/2}, ${h.x} ${h.y+s/2}`:`M ${f.x+r/2} ${f.y+s} C ${f.x+r/2} ${f.y+s+28}, ${h.x+r/2} ${h.y-28}, ${h.x+r/2} ${h.y}`;return i.jsx("path",{className:"af-work-node__mermaid-edge",d:g,markerEnd:"url(#af-work-arrow)"},`${d.from}-${d.to}-${p}`)}),t.nodes.map(d=>{const p=l.get(d.id);return i.jsxs("g",{children:[i.jsx("rect",{className:"af-work-node__mermaid-box",x:p.x,y:p.y,width:r,height:s,rx:"8"}),i.jsx("text",{className:"af-work-node__mermaid-text",x:p.x+r/2,y:p.y+s/2+5,textAnchor:"middle",children:d.label.slice(0,22)})]},d.id)})]})})}function li({className:e="",children:t}){const n=m.useRef(null),r=m.useRef(null),[s,o]=m.useState({visible:!1,top:0,height:100}),a=m.useCallback(()=>{const d=n.current;if(!d)return;const p=Math.max(1,d.scrollHeight),f=Math.max(1,d.clientHeight),h=p>f+1,g=h?Math.max(12,f/p*100):100,k=Math.max(0,100-g),b=h?Math.min(k,d.scrollTop/Math.max(1,p-f)*k):0;o({visible:h,top:b,height:g})},[]);m.useEffect(()=>{const d=requestAnimationFrame(a),p=n.current;if(!p||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(d);const f=new ResizeObserver(a);f.observe(p);for(const h of Array.from(p.children))f.observe(h);return()=>{cancelAnimationFrame(d),f.disconnect()}},[t,a]);const l=m.useCallback(d=>{const p=n.current;if(!p)return;const f=Math.max(0,p.scrollHeight-p.clientHeight);p.scrollTop=Math.min(1,Math.max(0,d))*f,a()},[a]),c=m.useCallback((d,p=0)=>{const f=r.current;if(!f)return 0;const h=f.getBoundingClientRect(),g=s.height/100*h.height,k=Math.max(1,h.height-g);return(d-h.top-p)/k},[s.height]),u=m.useCallback(d=>{var C,N;if(!s.visible)return;d.preventDefault(),d.stopPropagation();const p=r.current;if(!p)return;const f=p.getBoundingClientRect(),h=s.top/100*f.height,g=s.height/100*f.height,b=d.clientY>=f.top+h&&d.clientY<=f.top+h+g?d.clientY-f.top-h:g/2;l(c(d.clientY,b));const y=d.pointerId;(N=(C=d.currentTarget).setPointerCapture)==null||N.call(C,y);const v=j=>{j.preventDefault(),l(c(j.clientY,b))},w=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w)};window.addEventListener("pointermove",v),window.addEventListener("pointerup",w),window.addEventListener("pointercancel",w)},[c,l,s.height,s.top,s.visible]);return i.jsxs("div",{className:`af-visible-scroll-frame ${e}`,children:[i.jsx("div",{ref:n,className:`af-visible-scroll-frame__scroller ${e}`,onScroll:a,children:t}),i.jsx("div",{ref:r,className:"af-visible-scrollbar"+(s.visible?" af-visible-scrollbar--visible":""),onPointerDown:u,"aria-hidden":"true",children:i.jsx("span",{style:{height:`${s.height}%`,top:`${s.top}%`}})})]})}function kT({data:e,flowParams:t,htmlFrameRef:n,htmlFrameVersion:r=0}){const s=Cn(e),o=Xi(e),a=s==="image"?o:Ni(o),l=s==="image"?"":Go(a,s),[c,u]=m.useState(""),[d,p]=m.useState(""),[f,h]=m.useState(!1);m.useEffect(()=>{let v=!1;return l?(h(!0),p(""),u(""),Qa(t,l).then(w=>{v||u(w)}).catch(w=>{v||p(String(w.message||w))}).finally(()=>{v||h(!1)}),()=>{v=!0}):(u(""),p(""),h(!1),()=>{v=!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 g=l?c:a,k=s==="html"?$c(g):s==="react"?Ym(g):Ni(g),b=m.useRef("");if(b.current||(b.current=`html-display-${Math.random().toString(36).slice(2,10)}`),!s)return null;const y=Ea(s,k);if(f)return i.jsxs(li,{className:"af-work-display-empty",children:["Loading ",l,"..."]});if(d)return i.jsx(li,{className:"af-work-display-empty",children:d});if(y)return i.jsx(li,{className:"af-work-display-empty",children:y});if(!k.trim())return i.jsx(li,{className:"af-work-display-empty",children:"No display content"});if(s==="html"||s==="react")return i.jsx("div",{className:"af-work-display-body af-work-display-body--html",children:i.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"?Uk(k,b.current):yT(k,b.current)},r)});if(s==="image"){const v=Ld(k,t);return i.jsx(li,{className:"af-work-display-body af-work-display-body--image",children:i.jsx("img",{className:"af-work-display-image",src:v,alt:iG(e),loading:"lazy"})})}return s==="markdown"?i.jsx(li,{className:"af-work-display-body af-work-display-body--markdown",children:i.jsx(Bk,{content:k,basePath:l,resolveSrc:(v,w)=>Ld(v,t,w)})}):s==="chart"?i.jsx(li,{className:"af-work-display-body af-work-display-body--chart",children:i.jsx(Wk,{content:k})}):s==="table"?i.jsx(li,{className:"af-work-display-body af-work-display-body--table",children:i.jsx(Hk,{content:k})}):s==="mermaid"?i.jsxs(li,{className:"af-work-display-body",children:[i.jsx(bT,{code:k}),i.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--mermaid",children:k})]}):i.jsx(li,{className:"af-work-display-body af-work-display-body--ascii",children:i.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--ascii",children:k})})}function aG({node:e,onClose:t}){var v,w,C,N,j,A,I,D,B,W,F;const n=m.useRef(null),r=Cn(e==null?void 0:e.data),s=((v=e==null?void 0:e.data)==null?void 0:v.label)||(r==="html"?"HTML 展示":r==="markdown"?"Markdown 展示":"Display 预览"),o=!!((w=e==null?void 0:e.data)!=null&&w.readOnly),[a,l]=m.useState(!1),[c,u]=m.useState(""),[d,p]=m.useState(""),[f,h]=m.useState(!1),g=Xi(e==null?void 0:e.data),k=r==="markdown"?Ni(g):"",b=r==="markdown"?Go(k,"markdown"):"",y=r==="markdown"?b?d:k:"";return m.useEffect(()=>{const T=M=>{if(M.key==="Escape"){if(a){u(String(y||"")),l(!1);return}t==null||t()}};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)},[y,a,t]),m.useEffect(()=>{var M;let T=!1;return r!=="markdown"||!b?(p(""),h(!1),()=>{T=!0}):(h(!0),Qa(((M=e==null?void 0:e.data)==null?void 0:M.flowParams)||{},b).then(q=>{T||p(q)}).catch(q=>{var H,L;T||(p(""),(L=(H=e==null?void 0:e.data)==null?void 0:H.onStatus)==null||L.call(H,String(q.message||q)))}).finally(()=>{T||h(!1)}),()=>{T=!0})},[r,b,(N=(C=e==null?void 0:e.data)==null?void 0:C.flowParams)==null?void 0:N.flowId,(A=(j=e==null?void 0:e.data)==null?void 0:j.flowParams)==null?void 0:A.flowSource,(D=(I=e==null?void 0:e.data)==null?void 0:I.flowParams)==null?void 0:D.archived,(B=e==null?void 0:e.data)==null?void 0:B.displayReloadKey]),m.useEffect(()=>{a||u(String(y||""))},[y,a]),e?sr.createPortal(i.jsx("div",{className:"af-display-preview-overlay",role:"dialog","aria-modal":"true","aria-label":"全屏预览",children:i.jsxs("div",{className:"af-display-preview-shell",children:[i.jsxs("div",{className:"af-display-preview-head",children:[i.jsxs("div",{className:"af-display-preview-title",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:xT(r)}),i.jsx("strong",{children:s}),i.jsx("span",{children:e.id})]}),i.jsxs("div",{className:"af-display-preview-actions",children:[r==="markdown"?a?i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"af-display-preview-action",disabled:o||f,onClick:async()=>{var T,M;try{await ST({nodeId:e.id,data:e.data,filePath:b,content:c,setFileContent:p}),l(!1)}catch(q){(M=(T=e==null?void 0:e.data)==null?void 0:T.onStatus)==null||M.call(T,String(q.message||q))}},"aria-label":"保存并预览",title:"保存并预览",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"done"})}),i.jsx("button",{type:"button",className:"af-display-preview-action",onClick:()=>{u(String(y||"")),l(!1)},"aria-label":"取消编辑",title:"取消编辑",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):i.jsx("button",{type:"button",className:"af-display-preview-action",disabled:o||f,onClick:()=>{u(String(y||"")),l(!0)},"aria-label":"编辑 Markdown",title:"编辑 Markdown",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"edit"})}):null,i.jsx("button",{type:"button",className:"af-display-preview-action",onClick:t,"aria-label":"关闭全屏预览",title:"关闭",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close_fullscreen"})})]})]}),i.jsx("div",{className:"af-display-preview-content",children:r==="markdown"&&a?i.jsx(vT,{value:c,onChange:u,onUploadImage:(W=e.data)==null?void 0:W.onUploadWorkspaceImage,readOnly:o}):i.jsx(kT,{data:e.data,flowParams:(F=e.data)==null?void 0:F.flowParams,htmlFrameRef:n})})]})}),document.body):null}function lG({node:e}){var f,h,g,k,b,y,v,w,C,N;const t=Cn(e==null?void 0:e.data),n=Xi(e==null?void 0:e.data),r=t==="image"?n:Ni(n),s=t==="image"?"":Go(r,t),[o,a]=m.useState(""),[l,c]=m.useState(!1);m.useEffect(()=>{var A;let j=!1;return s?(c(!0),a(""),Qa(((A=e==null?void 0:e.data)==null?void 0:A.flowParams)||{},s).then(I=>{j||a(I)}).catch(()=>{j||a("")}).finally(()=>{j||c(!1)}),()=>{j=!0}):(a(""),c(!1),()=>{j=!0})},[s,(h=(f=e==null?void 0:e.data)==null?void 0:f.flowParams)==null?void 0:h.flowId,(k=(g=e==null?void 0:e.data)==null?void 0:g.flowParams)==null?void 0:k.flowSource,(y=(b=e==null?void 0:e.data)==null?void 0:b.flowParams)==null?void 0:y.archived,(v=e==null?void 0:e.data)==null?void 0:v.displayReloadKey]);const u=s?o:r,d=t==="html"?$c(u):t==="react"?Ym(u):Ni(u),p=Ea(t,d);return l?i.jsx("div",{className:"af-display-picker-preview__empty",children:"Loading"}):p?i.jsx("div",{className:"af-display-picker-preview__empty",children:p}):d.trim()?t==="html"||t==="react"?i.jsx("iframe",{title:((w=e==null?void 0:e.data)==null?void 0:w.label)||(e==null?void 0:e.id),sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox",srcDoc:t==="react"?Uk(d):yT(d)}):t==="image"?i.jsx("img",{src:Ld(d,(C=e==null?void 0:e.data)==null?void 0:C.flowParams),alt:((N=e==null?void 0:e.data)==null?void 0:N.label)||(e==null?void 0:e.id),loading:"lazy"}):t==="markdown"?i.jsx("div",{className:"af-display-picker-preview__markdown",children:i.jsx(Bk,{content:d,basePath:s,resolveSrc:(j,A)=>{var I;return Ld(j,(I=e==null?void 0:e.data)==null?void 0:I.flowParams,A)}})}):t==="chart"?i.jsx(Wk,{content:d}):t==="table"?i.jsx(Hk,{content:d}):t==="mermaid"?i.jsxs("div",{className:"af-display-picker-preview__diagram",children:[i.jsx(bT,{code:d}),i.jsx("pre",{children:d})]}):i.jsx("pre",{className:"af-display-picker-preview__pre",children:d}):i.jsx("div",{className:"af-display-picker-preview__empty",children:"No content"})}function vT({value:e,onChange:t,onUploadImage:n,readOnly:r=!1}){const s=m.useRef(null),o=m.useRef(null),a=m.useRef(null),[l,c]=m.useState(!1),[u,d]=m.useState({visible:!1,top:0,height:100}),p=m.useCallback(()=>{const y=s.current;if(!y)return;const v=Math.max(1,y.scrollHeight),w=Math.max(1,y.clientHeight),C=v>w+1,N=C?Math.max(12,w/v*100):100,j=Math.max(0,100-N),A=C?Math.min(j,y.scrollTop/Math.max(1,v-w)*j):0;d({visible:C,top:A,height:N})},[]);m.useEffect(()=>{const y=requestAnimationFrame(p),v=s.current;if(!v||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(y);const w=new ResizeObserver(p);return w.observe(v),()=>{cancelAnimationFrame(y),w.disconnect()}},[p,e]);const f=m.useCallback(y=>{const v=s.current;if(!v)return;const w=Math.max(0,v.scrollHeight-v.clientHeight);v.scrollTop=Math.min(1,Math.max(0,y))*w,p()},[p]),h=m.useCallback((y,v=0)=>{const w=a.current;if(!w)return 0;const C=w.getBoundingClientRect(),N=u.height/100*C.height,j=Math.max(1,C.height-N);return(y-C.top-v)/j},[u.height]),g=m.useCallback(y=>{if(!u.visible)return;y.preventDefault(),y.stopPropagation();const v=a.current;if(!v)return;const w=v.getBoundingClientRect(),C=u.top/100*w.height,N=u.height/100*w.height,A=y.clientY>=w.top+C&&y.clientY<=w.top+C+N?y.clientY-w.top-C:N/2;f(h(y.clientY,A));const I=B=>{B.preventDefault(),f(h(B.clientY,A))},D=()=>{window.removeEventListener("pointermove",I),window.removeEventListener("pointerup",D),window.removeEventListener("pointercancel",D)};window.addEventListener("pointermove",I),window.addEventListener("pointerup",D),window.addEventListener("pointercancel",D)},[h,f,u.height,u.top,u.visible]),k=m.useCallback(y=>{const v=String(e||""),w=s.current,C=Number((w==null?void 0:w.selectionStart)??v.length),N=Number((w==null?void 0:w.selectionEnd)??C),j=v.slice(0,C),A=v.slice(N),I=j&&!j.endsWith(`
|
|
242
|
-
`)?`
|
|
243
|
-
`:"",D=A&&!A.startsWith(`
|
|
244
|
-
`)?`
|
|
245
|
-
`:"",B=`${j}${I}${y}${D}${A}`;t==null||t(B),window.requestAnimationFrame(()=>{var F,T;const W=j.length+I.length+y.length;(F=s.current)==null||F.focus(),(T=s.current)==null||T.setSelectionRange(W,W)})},[t,e]),b=m.useCallback(async y=>{if(!r&&!(!y||l)){c(!0);try{const v=await(n==null?void 0:n(y)),w=String(v||"").trim();if(w){const C=String(y.name||"image").replace(/\.[^.]+$/g,"").trim()||"image";k(``)}}finally{c(!1)}}},[k,n,r,l]);return i.jsxs("div",{className:"af-work-display-editor nodrag nopan",onClick:y=>y.stopPropagation(),onDragOver:y=>{var w;Array.from(((w=y.dataTransfer)==null?void 0:w.items)||[]).some(C=>String((C==null?void 0:C.type)||"").startsWith("image/"))&&(y.preventDefault(),y.dataTransfer.dropEffect="copy")},onDrop:y=>{var w;const v=Array.from(((w=y.dataTransfer)==null?void 0:w.files)||[]).find(Jh);v&&(y.preventDefault(),b(v))},children:[i.jsxs("div",{className:"af-work-display-editor__toolbar",children:[i.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:l||r,onClick:()=>{var y;return(y=o.current)==null?void 0:y.click()},"aria-label":"上传图片",title:"上传图片",children:i.jsx("span",{className:"material-symbols-outlined",children:l?"hourglass_top":"add_photo_alternate"})}),i.jsx("input",{ref:o,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:y=>{var w;const v=(w=y.target.files)==null?void 0:w[0];y.target.value="",v&&b(v)}})]}),i.jsx("textarea",{ref:s,className:"af-work-display-editor__textarea",value:e,onChange:y=>t==null?void 0:t(y.target.value),onScroll:p,onKeyDown:y=>{y.key==="Escape"&&y.stopPropagation()},placeholder:"输入 Markdown 内容",spellCheck:!1,readOnly:r}),i.jsx("div",{ref:a,className:"af-work-display-editor__scrollbar"+(u.visible?" af-work-display-editor__scrollbar--visible":""),onPointerDown:g,"aria-hidden":"true",children:i.jsx("span",{style:{height:`${u.height}%`,top:`${u.top}%`}})})]})}function cG({nodeId:e,data:t}){const n=t==null?void 0:t.nodeChatActive,r=!!(t!=null&&t.selected),s=(t==null?void 0:t.nodeChat)||{},o=Array.isArray(s.messages)?s.messages:[],a=String(s.draft||""),[l,c]=m.useState(a),u=m.useRef(!1),d=String(s.candidateContent||""),p=!!s.running,f=!!(t!=null&&t.readOnly),h=String(s.error||""),g=o.slice(-2);return m.useEffect(()=>{u.current||c(a)},[a]),!n&&!r?null:n?i.jsxs("div",{className:"af-work-node-chat nodrag nopan",onClick:k=>k.stopPropagation(),children:[i.jsxs("div",{className:"af-work-node-chat__head",children:[i.jsxs("div",{children:[i.jsx("strong",{children:"继续微调"}),i.jsx("span",{children:(t==null?void 0:t.label)||e})]}),i.jsx("button",{type:"button",onClick:()=>{var k;return(k=t==null?void 0:t.onCloseNodeChat)==null?void 0:k.call(t)},"aria-label":"关闭节点微调",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.length>0||p||h?i.jsxs("div",{className:"af-work-node-chat__messages",children:[g.map((k,b)=>i.jsxs("div",{className:`af-work-node-chat__msg af-work-node-chat__msg--${k.role==="assistant"?"assistant":"user"}`,children:[i.jsx("span",{children:k.role==="assistant"?"AI":"你"}),i.jsx("p",{children:k.text})]},`${k.at||b}-${b}`)),p?i.jsx("div",{className:"af-work-node-chat__pending",children:"生成中..."}):null,h?i.jsx("div",{className:"af-work-node-chat__error",children:h}):null]}):null,i.jsxs("div",{className:"af-work-node-chat__composer",children:[i.jsx("button",{type:"button",className:"af-work-node-chat__add",disabled:p||f,"aria-label":"添加上下文",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),i.jsx("textarea",{className:"af-work-node-chat__input",rows:2,value:l,disabled:p||f,placeholder:"描述你想怎么调整这个展示",onCompositionStart:()=>{u.current=!0},onCompositionEnd:k=>{var y;u.current=!1;const b=k.currentTarget.value;c(b),(y=t==null?void 0:t.onUpdateNodeChatDraft)==null||y.call(t,e,b)},onChange:k=>{var y;const b=k.target.value;c(b),u.current||(y=t==null?void 0:t.onUpdateNodeChatDraft)==null||y.call(t,e,b)},onKeyDown:k=>{var b,y;k.isComposing||(b=k.nativeEvent)!=null&&b.isComposing||k.keyCode===229||(k.metaKey||k.ctrlKey)&&k.key==="Enter"&&(k.preventDefault(),(y=t==null?void 0:t.onSendNodeChat)==null||y.call(t,e,l))}}),i.jsx("button",{type:"button",className:"af-work-node-chat__send",disabled:p||f||!l.trim(),onClick:()=>{var k;return(k=t==null?void 0:t.onSendNodeChat)==null?void 0:k.call(t,e,l)},"aria-label":"发送",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_upward"})})]}),d.trim()?i.jsx("div",{className:"af-work-node-chat__messages",children:i.jsxs("div",{className:"af-work-node-chat__msg af-work-node-chat__msg--assistant",children:[i.jsx("span",{children:"AI"}),i.jsx("p",{children:d})]})}):null]}):i.jsxs("button",{type:"button",className:"af-work-node-chat-anchor nodrag nopan",onClick:k=>{var b;k.stopPropagation(),(b=t==null?void 0:t.onToggleNodeChat)==null||b.call(t,e)},title:"微调这个节点","aria-label":"微调这个节点",children:[i.jsx("span",{className:"material-symbols-outlined af-work-node-chat-anchor__plus","aria-hidden":!0,children:"add"}),i.jsx("span",{className:"af-work-node-chat-anchor__label",children:"继续微调这个展示"}),i.jsx("span",{className:"material-symbols-outlined af-work-node-chat-anchor__expand","aria-hidden":!0,children:"open_in_full"})]})}function uG(e){return e==="mermaid"?"mmd":e==="ascii"?"txt":e==="html"?"html":e==="react"?"json":e==="image"?"txt":e==="chart"||e==="table"?"json":"md"}function dG(e){return String(e).trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)||"display"}function fG(e){return String(e||"node").trim().replace(/[^a-zA-Z0-9._-]+/g,"_").replace(/^_+|_+$/g,"").slice(0,120)||"node"}function pC(e,t=""){const n=Go(e,t).replace(/^\/+/,"");return n.startsWith("outputs/")?n:""}function pG(e,t){const n=fG(e),r=new Set,s=Cn(t)||"";Js(t==null?void 0:t.definitionId)&&r.add(`outputs/${n}`);const o=pC(Xi(t),s);return o&&r.add(o),(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(/^\/+/,""),d=pC(u,s);return d&&r.add(d),u===`outputs/${n}`||u.startsWith(`outputs/${n}/`)})&&r.add(`outputs/${n}`),Array.from(r)}function hC(e,t){const n=Cn(t)||"markdown";return`outputs/${dG((t==null?void 0:t.label)||e||n)}.${uG(n)}`}async function ST({nodeId:e,data:t,filePath:n,content:r,setFileContent:s}){var o,a;if(n){const l=await Zx((t==null?void 0:t.flowParams)||{},n,r);s==null||s(r),(o=t==null?void 0:t.onSetDisplayNodeContent)==null||o.call(t,e,l,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已更新 ${l}`});return}(a=t==null?void 0:t.onSetDisplayNodeContent)==null||a.call(t,e,r,"replace",{logChat:!1,statusMessage:"已更新 Markdown 内容"})}function NT({id:e,data:t,selected:n,deleteNode:r}){var re,Z,ie;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],a=(Array.isArray(t==null?void 0:t.outputs)?t.outputs:[]).map((te,ue)=>({slot:te,idx:ue})).sort((te,ue)=>{var Me,rt,gt,bt;const fe=String(((Me=te.slot)==null?void 0:Me.name)||"").trim(),be=String(((rt=ue.slot)==null?void 0:rt.name)||"").trim();if(fe==="next"&&be!=="next")return-1;if(be==="next"&&fe!=="next")return 1;const qe=String(((gt=te.slot)==null?void 0:gt.type)||"").trim(),Ue=String(((bt=ue.slot)==null?void 0:bt.type)||"").trim();return qe==="node"&&Ue!=="node"?-1:Ue==="node"&&qe!=="node"?1:te.idx-ue.idx}),l=Cn(t),c=m.useRef(null),u=m.useRef(null),[d,p]=m.useState(0),[f,h]=m.useState(!1),[g,k]=m.useState(!1),[b,y]=m.useState(!1),[v,w]=m.useState(""),[C,N]=m.useState(""),[j,A]=m.useState(!1),[I,D]=m.useState(!1),B=m.useRef(null),W=Xi(t),F=l==="markdown"?Ni(W):"",T=l==="markdown"?Go(F,"markdown"):"",M=l==="markdown"?T?C:F:"",q=!!(t!=null&&t.readOnly),H=!!(t!=null&&t.displayPageMode);m.useEffect(()=>{let te=!1;return l!=="markdown"||!T?(N(""),A(!1),()=>{te=!0}):(A(!0),Qa((t==null?void 0:t.flowParams)||{},T).then(ue=>{te||N(ue)}).catch(ue=>{var fe;te||(N(""),(fe=t==null?void 0:t.onStatus)==null||fe.call(t,String(ue.message||ue)))}).finally(()=>{te||A(!1)}),()=>{te=!0})},[l,T,(re=t==null?void 0:t.flowParams)==null?void 0:re.flowId,(Z=t==null?void 0:t.flowParams)==null?void 0:Z.flowSource,(ie=t==null?void 0:t.flowParams)==null?void 0:ie.archived,t==null?void 0:t.displayReloadKey]),m.useEffect(()=>{if(!g)return;const te=()=>k(!1);return window.addEventListener("pointerup",te,!0),window.addEventListener("pointercancel",te,!0),window.addEventListener("mouseup",te,!0),window.addEventListener("blur",te),()=>{window.removeEventListener("pointerup",te,!0),window.removeEventListener("pointercancel",te,!0),window.removeEventListener("mouseup",te,!0),window.removeEventListener("blur",te)}},[g]),m.useEffect(()=>{b||w(String(M||""))},[M,b]);const L=(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"),R=String((t==null?void 0:t.sourceNodeId)||e),z=(t==null?void 0:t.sharingDisplayNodeId)===R,E=t!=null&&t.displaySize&&Number(t.displaySize.width)>0&&Number(t.displaySize.height)>0?{width:Number(t.displaySize.width),height:Number(t.displaySize.height)}:null,Q=m.useCallback(async()=>{var oe,je,Ve,tt,Jt,st,de,ve,ze,Ze;if(l!=="html"||f)return;const te=Xi(t),ue=Go(te,l);let fe=te;if(ue)try{fe=await Qa((t==null?void 0:t.flowParams)||{},ue)}catch(Se){h(!1),console.warn("Failed to read HTML display file before saving image.",Se);return}const be=$c(fe);if(!be.trim())return;const qe=Ea(l,be);if(qe){console.warn(qe);return}const Ue=(je=(oe=u.current)==null?void 0:oe.getBoundingClientRect)==null?void 0:je.call(oe),Me=(tt=(Ve=c.current)==null?void 0:Ve.querySelector)==null?void 0:tt.call(Ve,".af-work-display-body"),rt=(st=(Jt=c.current)==null?void 0:Jt.querySelector)==null?void 0:st.call(Jt,".af-visible-scroll-frame__scroller"),gt=Math.round(Math.max(Number((Ue==null?void 0:Ue.width)||0),Number((E==null?void 0:E.width)||0),Number(((de=c.current)==null?void 0:de.clientWidth)||0),Number((Me==null?void 0:Me.clientWidth)||0),Number((rt==null?void 0:rt.clientWidth)||0),Math.max(320,Number((E==null?void 0:E.width)||960)-2))),bt=Math.round(Math.max(Number((Ue==null?void 0:Ue.height)||0),Number((E==null?void 0:E.height)||0),Number(((ve=c.current)==null?void 0:ve.clientHeight)||0),Number((Me==null?void 0:Me.clientHeight)||0),Number((rt==null?void 0:rt.clientHeight)||0),Math.max(180,Number((E==null?void 0:E.height)||640)-46)));h(!0);try{await sG({flowParams:(t==null?void 0:t.flowParams)||{},content:be,sourceFilePath:ue,iframe:u.current,width:gt,height:bt,filename:ZY((t==null?void 0:t.label)||e||"html-render","png"),snapshotElements:{card:c.current,displayBody:Me,scroller:rt},displaySize:E}),(ze=t==null?void 0:t.onStatus)==null||ze.call(t,"已导出 HTML 展示截图")}catch(Se){const Tt=String((Se==null?void 0:Se.message)||Se||"截图失败");(Ze=t==null?void 0:t.onStatus)==null||Ze.call(t,`HTML 截图失败:${Tt}`),console.warn("Failed to save HTML display as PNG.",Se)}finally{h(!1)}},[t,E==null?void 0:E.height,E==null?void 0:E.width,e,l,f]),V=m.useCallback(te=>{var ue;q||!te||l!=="image"||(ue=t==null?void 0:t.onUploadImageToDisplayNode)==null||ue.call(t,e,te)},[t,e,l,q]),$=m.useCallback(te=>{var ue,fe;(ue=te==null?void 0:te.stopPropagation)==null||ue.call(te),!q&&((fe=t==null?void 0:t.onSetDisplayNodeContent)==null||fe.call(t,e,"","replace",{logChat:!1,reloadDisplay:!0,statusMessage:"已清空 Display 内容"}),l==="markdown"&&(w(""),y(!1)))},[t,e,l,q]),ne=m.useCallback(te=>{var be,qe;q||l!=="image"||!(Array.from(((be=te.dataTransfer)==null?void 0:be.files)||[]).some(Jh)||Array.from(((qe=te.dataTransfer)==null?void 0:qe.items)||[]).some(Ue=>String((Ue==null?void 0:Ue.type)||"").startsWith("image/")))||(te.preventDefault(),te.stopPropagation(),te.dataTransfer.dropEffect="copy",D(!0))},[l,q]),ce=m.useCallback(te=>{l==="image"&&(te.currentTarget.contains(te.relatedTarget)||D(!1))},[l]),X=m.useCallback(te=>{var fe;if(l!=="image")return;const ue=Array.from(((fe=te.dataTransfer)==null?void 0:fe.files)||[]).find(Jh);ue&&(te.preventDefault(),te.stopPropagation(),D(!1),V(ue))},[l,V]);return i.jsxs("div",{className:"af-work-display-card"+(E?" af-work-display-card--sized":"")+(n?" af-work-display-card--selected":"")+(g?" af-work-display-card--resizing":"")+(I?" af-work-display-card--image-drop":"")+(H?" af-work-display-card--presentation":"")+(t!=null&&t.isExecuting?" af-work-display-card--executing":"")+((t==null?void 0:t.nodeStatus)==="success"?" af-work-display-card--done":"")+((t==null?void 0:t.nodeStatus)==="failed"?" af-work-display-card--failed":""),style:E?{width:E.width,height:E.height}:void 0,ref:c,onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,onDragOver:ne,onDragLeave:ce,onDrop:X,children:[i.jsx(jk,{className:"af-work-display-resize nodrag",position:"bottom-right",minWidth:320,minHeight:180,onResizeStart:()=>k(!0),onResizeEnd:()=>k(!1),children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),s.map((te,ue)=>{if(te.showOnNode===!1)return null;const fe=`${4.15+ue*1.75}rem`,be=te.name||`#${ue+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:fe},children:be}),i.jsx(Vn,{type:"target",position:Ke.Left,id:`input-${ue}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:fe,background:En(te.type)},title:`${be} · ${te.type}`})]},`in-${ue}`)}),a.map(({slot:te,idx:ue},fe)=>{if(te.showOnNode===!1)return null;const be=`${4.15+fe*1.75}rem`,qe=te.name||`#${ue+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:be},children:qe}),i.jsx(Vn,{type:"source",position:Ke.Right,id:`output-${ue}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:be,background:En(te.type)},title:`${qe} · ${te.type}`})]},`out-${ue}`)}),i.jsxs("div",{className:"af-work-display-card__head",children:[i.jsxs("div",{className:"af-work-display-card__title",children:[i.jsx("span",{className:"material-symbols-outlined",children:xT(l)}),i.jsx("strong",{children:L}),i.jsx("span",{children:(t==null?void 0:t.definitionId)||"display"})]}),l==="html"?i.jsxs("div",{className:"af-work-display-card__html-controls nodrag",onClick:te=>te.stopPropagation(),children:[i.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var te,ue,fe,be;try{(be=(fe=(ue=(te=u.current)==null?void 0:te.contentWindow)==null?void 0:ue.history)==null?void 0:fe.back)==null||be.call(fe)}catch{}},"aria-label":"后退",title:"后退",children:i.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),i.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var te,ue,fe,be;try{(be=(fe=(ue=(te=u.current)==null?void 0:te.contentWindow)==null?void 0:ue.history)==null?void 0:fe.forward)==null||be.call(fe)}catch{}},"aria-label":"前进",title:"前进",children:i.jsx("span",{className:"material-symbols-outlined",children:"arrow_forward"})}),i.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>p(te=>te+1),"aria-label":"刷新",title:"刷新",children:i.jsx("span",{className:"material-symbols-outlined",children:"refresh"})}),i.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:f,onClick:Q,"aria-label":"截图另存为图片",title:"截图另存为图片",children:i.jsx("span",{className:"material-symbols-outlined",children:f?"hourglass_empty":"photo_camera"})})]}):null,l==="markdown"?b?i.jsxs("div",{className:"af-work-display-card__html-controls nodrag",onClick:te=>te.stopPropagation(),children:[i.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:q||j,onClick:async()=>{var te;try{await ST({nodeId:e,data:t,filePath:T,content:v,setFileContent:N}),y(!1)}catch(ue){(te=t==null?void 0:t.onStatus)==null||te.call(t,String(ue.message||ue))}},"aria-label":"保存并预览",title:"保存并预览",children:i.jsx("span",{className:"material-symbols-outlined",children:"done"})}),i.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{w(String(M||"")),y(!1)},"aria-label":"取消编辑",title:"取消编辑",children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}):i.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:q||j,onClick:te=>{te.stopPropagation(),w(String(M||"")),y(!0)},"aria-label":"编辑 Markdown",title:"编辑 Markdown",children:i.jsx("span",{className:"material-symbols-outlined",children:"edit"})}):null,l==="image"?i.jsxs(i.Fragment,{children:[i.jsx("input",{ref:B,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:te=>{var fe;const ue=(fe=te.target.files)==null?void 0:fe[0];te.target.value="",ue&&V(ue)}}),i.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:q,onClick:te=>{var ue;te.stopPropagation(),(ue=B.current)==null||ue.click()},"aria-label":"上传图片",title:"上传图片",children:i.jsx("span",{className:"material-symbols-outlined",children:"upload"})})]}):null,i.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",onClick:te=>{var ue;te.stopPropagation(),(ue=t==null?void 0:t.onOpenDisplayPreview)==null||ue.call(t,R)},"aria-label":"全屏预览",title:"全屏预览",children:i.jsx("span",{className:"material-symbols-outlined",children:"fullscreen"})}),i.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:z,onClick:te=>{var ue;te.stopPropagation(),(ue=t==null?void 0:t.onShareDisplayNode)==null||ue.call(t,R)},"aria-label":"分享展示",title:"分享展示",children:i.jsx("span",{className:"material-symbols-outlined",children:z?"hourglass_empty":"ios_share"})}),i.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:q,onClick:$,"aria-label":"清空内容",title:"清空内容",children:i.jsx("span",{className:"material-symbols-outlined",children:"delete_sweep"})}),i.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:q,onClick:()=>{var te;return(te=t==null?void 0:t.onSaveDisplayNodeToFile)==null?void 0:te.call(t,e,t)},"aria-label":"另存为文件",title:"另存为文件",children:i.jsx("span",{className:"material-symbols-outlined",children:"save"})}),i.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",disabled:q,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l==="markdown"&&b?i.jsx(vT,{value:v,onChange:w,onUploadImage:t==null?void 0:t.onUploadWorkspaceImage,readOnly:q}):i.jsx(kT,{data:t,flowParams:t==null?void 0:t.flowParams,htmlFrameRef:u,htmlFrameVersion:d}),i.jsx(cG,{nodeId:e,data:t})]})}function hG({id:e,data:t,selected:n,deleteNode:r}){var d,p,f;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],o=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],a=((p=(d=t==null?void 0:t.runningRunNodeIds)==null?void 0:d.has)==null?void 0:p.call(d,e))||((f=t==null?void 0:t.runningRunNodeIds)==null?void 0:f[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 i.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,g)=>{if(h.showOnNode===!1)return null;const k=`${2.25+g*1.75}rem`,b=h.name||`#${g+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:k},children:b}),i.jsx(Vn,{type:"target",position:Ke.Left,id:`input-${g}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:k,background:En(h.type)},title:`${b} · ${h.type}`})]},`in-${g}`)}),o.map((h,g)=>{if(h.showOnNode===!1)return null;const k=`${2.25+g*1.75}rem`,b=h.name||`#${g+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:k},children:b}),i.jsx(Vn,{type:"source",position:Ke.Right,id:`output-${g}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:k,background:En(h.type)},title:`${b} · ${h.type}`})]},`out-${g}`)}),i.jsxs("div",{className:"af-work-run-card__head",children:[i.jsx("span",{className:"material-symbols-outlined",children:"play_circle"}),i.jsx("strong",{children:(t==null?void 0:t.label)||"Run"}),i.jsx("span",{children:(t==null?void 0:t.definitionId)||"workspace_run"}),i.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",disabled:u,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),i.jsxs("div",{className:"af-work-run-card__actions",children:[i.jsxs("button",{type:"button",className:"af-work-run-card__button nodrag"+(a?" af-work-run-card__button--stop":""),disabled:u||l,onClick:h=>{var g,k;h.stopPropagation(),a?(g=t==null?void 0:t.onStopWorkspaceNode)==null||g.call(t,e):(k=t==null?void 0:t.onRunWorkspaceNode)==null||k.call(t,e)},children:[i.jsx("span",{className:"material-symbols-outlined",children:a?"stop_circle":"play_arrow"}),i.jsx("span",{children:a?"Stop":"Run line"})]}),i.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 g;h.stopPropagation(),(g=t==null?void 0:t.onOptimizeWorkspaceRun)==null||g.call(t,e)},children:i.jsx("span",{className:"material-symbols-outlined",children:l?"sync":"auto_fix_high"})}),i.jsx("button",{type:"button",className:"af-work-run-card__button af-work-run-card__logs nodrag",title:"查看执行日志","aria-label":"查看执行日志",onClick:h=>{var g;h.stopPropagation(),(g=t==null?void 0:t.onOpenWorkspaceRunLogs)==null||g.call(t,{nodeId:e,runNodeId:e,scheduleNodeId:"",label:(t==null?void 0:t.label)||"Run"})},children:i.jsx("span",{className:"material-symbols-outlined",children:"article"})})]})]})}function mG({id:e,data:t,selected:n,deleteNode:r,skills:s,skillCollections:o,workspaces:a}){var Ze,Se,Tt,vn,dn,nn,Sn;const l=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],c=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],u=IG(t),[d,p]=m.useState(u.task),f=m.useRef(!1),h=m.useRef(u.task),g=((Se=(Ze=t==null?void 0:t.runningRunNodeIds)==null?void 0:Ze.has)==null?void 0:Se.call(Ze,e))||((Tt=t==null?void 0:t.runningRunNodeIds)==null?void 0:Tt[e])===!0||(t==null?void 0:t.isExecuting)||(t==null?void 0:t.nodeStatus)==="running",k=(t==null?void 0:t.nodeStatus)==="stopped",b=!!(t!=null&&t.readOnly),y=Array.isArray(s)?s:[],v=Array.isArray(o)?o:[],w=m.useMemo(()=>(Array.isArray(a)?a:[]).map(ee=>({id:String((ee==null?void 0:ee.id)||""),label:String((ee==null?void 0:ee.label)||(ee==null?void 0:ee.name)||"知识库"),kind:(ee==null?void 0:ee.kind)==="git"?"git":"local",path:String((ee==null?void 0:ee.path)||""),repoUrl:String((ee==null?void 0:ee.repoUrl)||""),branch:String((ee==null?void 0:ee.branch)||""),mountPath:String((ee==null?void 0:ee.mountPath)||""),builtin:(ee==null?void 0:ee.builtin)===!0,exists:(ee==null?void 0:ee.exists)!==!1,type:String((ee==null?void 0:ee.type)||"")})).filter(ee=>ee.path),[a]),[C,N]=m.useState(!1),[j,A]=m.useState(""),[I,D]=m.useState(()=>new Set),[B,W]=m.useState(!1),[F,T]=m.useState(""),[M,q]=m.useState("config"),H=Jm(t),L=!!H,R=IT(u.displayType),z=m.useMemo(()=>GY(t,R),[t==null?void 0:t.displaySize,t==null?void 0:t.nodeSize,t==null?void 0:t.inputs,t==null?void 0:t.input,R]),E=m.useMemo(()=>({...t,sourceNodeId:e,label:t!=null&&t.label&&t.label!=="Context Run"?t.label:"一键任务",definitionId:R,displaySize:z,nodeSize:z,body:H,inputs:[{type:"text",name:R==="display_image"?"src":"content",value:H,default:H}],outputs:c.length?c:[{type:"node",name:"next",default:""}]}),[t,R,e,H,c,z]),Q=Array.isArray((vn=t==null?void 0:t.modelLists)==null?void 0:vn.cursor)?t.modelLists.cursor:[],V=Array.isArray((dn=t==null?void 0:t.modelLists)==null?void 0:dn.opencode)?t.modelLists.opencode:[],$=Array.isArray((nn=t==null?void 0:t.modelLists)==null?void 0:nn.claudeCode)?t.modelLists.claudeCode:[],ne=Array.isArray((Sn=t==null?void 0:t.modelLists)==null?void 0:Sn.codex)?t.modelLists.codex:[],ce=m.useMemo(()=>new Set(Q.map(xs)),[Q]),X=m.useMemo(()=>new Set(V.map(xs)),[V]),re=m.useMemo(()=>new Set($.map(xs)),[$]),Z=m.useMemo(()=>new Set(ne.map(xs)),[ne]),ie=u.model,te=m.useMemo(()=>ie?ie.startsWith("cursor:")||ie.startsWith("opencode:")||ie.startsWith("codex:")||ie.startsWith("claude-code:")?ie:re.has(ie)?`claude-code:${ie}`:Z.has(ie)?`codex:${ie}`:X.has(ie)?`opencode:${ie}`:ce.has(ie)?`cursor:${ie}`:ie:"",[re,Z,ce,X,ie]),ue=ie.startsWith("cursor:")?ie.slice(7):ie.startsWith("opencode:")?ie.slice(9):ie.startsWith("codex:")?ie.slice(6):ie.startsWith("claude-code:")?ie.slice(12):ie,fe=ue,be=!!ie&&!ce.has(fe)&&!X.has(fe)&&!re.has(fe)&&!Z.has(fe),qe=m.useMemo(()=>new Set(u.skillKeys),[u.skillKeys]),Ue=m.useMemo(()=>new Map(y.map(ee=>[ee.key,ee])),[y]),Me=m.useMemo(()=>{const ee=new Set,Ie=v.map(Je=>{const Pt=Yo(Je,y).map(jt=>Ue.get(jt)).filter(Boolean);for(const jt of Pt)ee.add(jt.key);return{...Je,skills:Pt}}).filter(Je=>Je.skills.length>0),Fe=y.filter(Je=>!ee.has(Je.key));return{collectionGroups:Ie,ungrouped:Fe}},[v,Ue,y]);m.useEffect(()=>{D(ee=>{let Ie=!1;const Fe=new Set(ee);for(const Je of Me.collectionGroups)Fe.has(Je.id)||(Fe.add(Je.id),Ie=!0);return Ie?Fe:ee})},[Me.collectionGroups]);const rt=m.useMemo(()=>{const ee=j.trim().toLowerCase();if(!ee)return Me;const Ie=Je=>[Je==null?void 0:Je.key,Je==null?void 0:Je.name,Je==null?void 0:Je.description].map(Pt=>String(Pt||"").toLowerCase()).join(" ").includes(ee);return{collectionGroups:Me.collectionGroups.map(Je=>{const Pt=[Je==null?void 0:Je.id,Je==null?void 0:Je.name,Je==null?void 0:Je.description].map(jt=>String(jt||"").toLowerCase()).join(" ").includes(ee);return{...Je,skills:Pt?Je.skills:Je.skills.filter(Ie)}}).filter(Je=>Je.skills.length>0),ungrouped:Me.ungrouped.filter(Ie)}},[Me,j]),gt=eb(C,[rt.collectionGroups.length,rt.ungrouped.length,I.size,u.skillKeys.length,j]),bt=m.useMemo(()=>{const ee=F.trim().toLowerCase();return ee?w.filter(Ie=>[Ie.id,Ie.label,Ie.path,Ie.repoUrl,Ie.branch,Ie.mountPath,Ie.type].join(" ").toLowerCase().includes(ee)):w},[w,F]),oe=m.useMemo(()=>$T(u.knowledgeContext),[u.knowledgeContext]),je=m.useMemo(()=>new Set(oe.map(ee=>ee.id||ee.path||ee.repoPath).filter(Boolean)),[oe]),Ve=eb(B,[bt.length,oe.length,F]);m.useEffect(()=>{u.task!==h.current&&(h.current=u.task,f.current||p(u.task))},[u.task]),m.useEffect(()=>{if(!L){q("config");return}g||q("result")},[L,H,g]),m.useEffect(()=>{var Ie,Fe;if(!(M==="result"&&L))return;(Ie=t==null?void 0:t.onEnsureWorkspaceNodeDisplaySize)==null||Ie.call(t,e,z),(Fe=t==null?void 0:t.onRefreshNodeInternals)==null||Fe.call(t,e);const ee=window.setTimeout(()=>{var Je;return(Je=t==null?void 0:t.onRefreshNodeInternals)==null?void 0:Je.call(t,e)},120);return()=>window.clearTimeout(ee)},[t==null?void 0:t.onEnsureWorkspaceNodeDisplaySize,t==null?void 0:t.onRefreshNodeInternals,R,L,e,H,z,M]);const tt=ee=>{var Ie;(Ie=t==null?void 0:t.onChangeContextRunConfig)==null||Ie.call(t,e,{...u,task:d,...ee})},Jt=(ee=d)=>{var Fe;const Ie=String(ee??"");Ie!==u.task&&(h.current=Ie,(Fe=t==null?void 0:t.onChangeContextRunConfig)==null||Fe.call(t,e,{...u,task:Ie}))},st=(ee,Ie)=>{const Fe=new Set(u.skillKeys);for(const Je of ee){const Pt=String(Je||"").trim();Pt&&(Ie?Fe.add(Pt):Fe.delete(Pt))}tt({skillKeys:Array.from(Fe)})},de=ee=>{D(Ie=>{const Fe=new Set(Ie);return Fe.has(ee)?Fe.delete(ee):Fe.add(ee),Fe})},ve=(ee,Ie)=>{const Fe=(ee==null?void 0:ee.id)||(ee==null?void 0:ee.path)||"";if(!Fe)return;const Je=w.filter(Pt=>{const jt=Pt.id||Pt.path||"";return jt===Fe?Ie:je.has(jt)});tt({knowledgeContext:Xm(Je)})},ze=()=>{tt({knowledgeContext:null})};return M==="result"&&L?i.jsx(NT,{id:e,data:{...E,selected:t==null?void 0:t.selected,onSelectNodePointerDown:t==null?void 0:t.onSelectNodePointerDown},selected:n,deleteNode:r}):i.jsxs("div",{className:"af-work-context-run-card"+(n?" af-work-context-run-card--selected":"")+(M==="result"&&L?" af-work-context-run-card--result":"")+(g?" 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":"")+(k?" af-work-context-run-card--stopped":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[l.map((ee,Ie)=>{if(ee.showOnNode===!1)return null;const Fe=`${2.25+Ie*1.75}rem`,Je=ee.name||`#${Ie+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:Fe},children:Je}),i.jsx(Vn,{type:"target",position:Ke.Left,id:`input-${Ie}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:Fe,background:En(ee.type)},title:`${Je} · ${ee.type}`})]},`in-${Ie}`)}),c.map((ee,Ie)=>{if(ee.showOnNode===!1)return null;const Fe=`${2.25+Ie*1.75}rem`,Je=ee.name||`#${Ie+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:Fe},children:Je}),i.jsx(Vn,{type:"source",position:Ke.Right,id:`output-${Ie}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:Fe,background:En(ee.type)},title:`${Je} · ${ee.type}`})]},`out-${Ie}`)}),i.jsxs("div",{className:"af-work-context-run-card__head",children:[i.jsx("span",{className:"material-symbols-outlined",children:"automation"}),i.jsx("strong",{children:t!=null&&t.label&&t.label!=="Context Run"?t.label:"一键任务"}),i.jsxs("div",{className:"af-work-context-run-card__model-wrap nodrag",onPointerDown:ee=>ee.stopPropagation(),onMouseDown:ee=>ee.stopPropagation(),onClick:ee=>ee.stopPropagation(),children:[i.jsxs("select",{className:"af-work-context-run-card__model",value:te,disabled:b,"aria-label":"模型",title:ue||"默认模型",onChange:ee=>tt({model:ee.target.value}),children:[i.jsx("option",{value:"",children:"默认"}),be?i.jsx("option",{value:ie,children:ie}):null,Q.length?i.jsx("optgroup",{label:"Cursor",children:Q.map(ee=>i.jsx("option",{value:`cursor:${xs(ee)}`,children:xs(ee)},`context-cursor-${ee}`))}):null,V.length?i.jsx("optgroup",{label:"OpenCode",children:V.map(ee=>i.jsx("option",{value:`opencode:${xs(ee)}`,children:xs(ee)},`context-opencode-${ee}`))}):null,ne.length?i.jsx("optgroup",{label:"Codex",children:ne.map(ee=>i.jsx("option",{value:`codex:${xs(ee)}`,children:xs(ee)},`context-codex-${ee}`))}):null,$.length?i.jsx("optgroup",{label:"Claude Code",children:$.map(ee=>i.jsx("option",{value:`claude-code:${xs(ee)}`,children:xs(ee)},`context-claude-${ee}`))}):null]}),i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"expand_more"})]}),i.jsx("span",{className:"af-work-context-run-card__kind",children:Js(t==null?void 0:t.definitionId)?"workspace_one_click_task":(t==null?void 0:t.definitionId)||"workspace_one_click_task"}),L?i.jsxs("div",{className:"af-work-context-run-card__view-switch nodrag",onClick:ee=>ee.stopPropagation(),children:[i.jsx("button",{type:"button",className:M==="config"?"is-active":"",onClick:()=>q("config"),"aria-label":"切换到任务配置",children:i.jsx("span",{className:"material-symbols-outlined",children:"tune"})}),i.jsx("button",{type:"button",className:M==="result"?"is-active":"",onClick:()=>q("result"),"aria-label":"切换到展示结果",children:i.jsx("span",{className:"material-symbols-outlined",children:"preview"})})]}):null,i.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",disabled:b,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),i.jsxs("div",{className:"af-work-context-run-card__body nodrag",children:[i.jsxs(i.Fragment,{children:[i.jsx("textarea",{value:d,disabled:b,placeholder:"输入任务,例如:基于选中的知识库总结需求并生成展示页",onCompositionStart:()=>{f.current=!0},onCompositionEnd:ee=>{f.current=!1,p(ee.currentTarget.value),Jt(ee.currentTarget.value)},onChange:ee=>{p(ee.target.value)},onBlur:ee=>Jt(ee.currentTarget.value)}),i.jsxs("div",{className:"af-work-context-run-card__grid",children:[i.jsxs("div",{className:"af-work-context-run-card__skills",children:[i.jsxs("button",{type:"button",disabled:b,className:"af-work-context-run-card__select",onClick:ee=>{var Ie;ee.stopPropagation(),C||(Ie=t==null?void 0:t.onRefreshSkills)==null||Ie.call(t),N(Fe=>!Fe)},children:[i.jsx("span",{className:"material-symbols-outlined",children:"extension"}),i.jsx("span",{children:u.skillKeys.length?`${u.skillKeys.length} skills`:"Skills"}),i.jsx("span",{className:"material-symbols-outlined",children:"expand_more"})]}),C?i.jsxs("div",{className:"af-work-context-run-card__skills-menu",onClick:ee=>ee.stopPropagation(),children:[i.jsxs("div",{className:"af-work-load-skills-search",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),i.jsx("input",{type:"search",value:j,onChange:ee=>A(ee.target.value),placeholder:"搜索 Skills...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Skills"}),j?i.jsx("button",{type:"button",onClick:()=>A(""),"aria-label":"清空搜索",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),i.jsxs("div",{ref:gt.menuRef,className:"af-work-load-skills-menu af-work-context-run-card__menu-scroll",onScroll:gt.updateMenuScrollbar,children:[rt.collectionGroups.map(ee=>{const Ie=ee.skills.map(jt=>jt.key),Fe=Ie.filter(jt=>qe.has(jt)).length,Je=Ie.length>0&&Fe===Ie.length,Pt=I.has(ee.id);return i.jsxs("section",{className:"af-work-load-skills-menu__group"+(Pt?" af-work-load-skills-menu__group--collapsed":""),children:[i.jsxs("div",{className:"af-work-load-skills-menu__group-head",children:[i.jsx("input",{type:"checkbox",checked:Je,disabled:b,onChange:jt=>st(Ie,jt.target.checked),"aria-label":`选择 ${ee.name}`}),i.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-toggle",onClick:()=>de(ee.id),"aria-expanded":!Pt,children:i.jsxs("span",{className:"af-work-load-skills-menu__group-main",children:[i.jsx("span",{children:ee.name}),ee.description?i.jsx("em",{children:ee.description}):null]})}),i.jsxs("small",{children:[Fe,"/",Ie.length]}),i.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-arrow",onClick:()=>de(ee.id),"aria-label":Pt?`展开 ${ee.name}`:`收起 ${ee.name}`,children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Pt?"chevron_right":"expand_more"})})]}),Pt?null:i.jsx("div",{className:"af-work-load-skills-menu__options",children:ee.skills.map(jt=>i.jsxs("label",{className:"af-work-load-skills-menu__option",children:[i.jsx("input",{type:"checkbox",checked:qe.has(jt.key),disabled:b,onChange:lr=>st([jt.key],lr.target.checked)}),i.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[i.jsx("span",{className:"af-work-load-skills-menu__option-title",children:jt.name}),jt.description?i.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:jt.description}):null]})]},`${ee.id}:${jt.key}`))})]},ee.id)}),rt.ungrouped.length>0?i.jsxs("section",{className:"af-work-load-skills-menu__group",children:[i.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[i.jsx("span",{children:"Ungrouped"}),i.jsx("small",{children:rt.ungrouped.length})]}),i.jsx("div",{className:"af-work-load-skills-menu__options",children:rt.ungrouped.map(ee=>i.jsxs("label",{className:"af-work-load-skills-menu__option",children:[i.jsx("input",{type:"checkbox",checked:qe.has(ee.key),disabled:b,onChange:Ie=>st([ee.key],Ie.target.checked)}),i.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[i.jsx("span",{className:"af-work-load-skills-menu__option-title",children:ee.name}),ee.description?i.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:ee.description}):null]})]},`ungrouped:${ee.key}`))})]}):null,rt.collectionGroups.length===0&&rt.ungrouped.length===0?i.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 Skills"}):null,i.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>tt({skillKeys:[]}),children:"清空"})]}),i.jsx("div",{ref:gt.scrollbarTrackRef,className:"af-work-load-skills-scrollbar"+(gt.scrollbar.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:gt.handleScrollbarPointerDown,"aria-hidden":"true",children:i.jsx("span",{style:{height:`${gt.scrollbar.height}%`,top:`${gt.scrollbar.top}%`}})})]}):null]}),i.jsxs("div",{className:"af-work-context-run-card__workspace",children:[i.jsxs("button",{type:"button",disabled:b,className:"af-work-context-run-card__select",onClick:ee=>{var Ie;ee.stopPropagation(),B||(Ie=t==null?void 0:t.onRefreshWorkspaces)==null||Ie.call(t),W(Fe=>!Fe)},children:[i.jsx("span",{className:"material-symbols-outlined",children:oe.length?"folder_open":"folder_off"}),i.jsx("span",{children:oe.length?`${oe.length} 知识库`:"知识库"}),i.jsx("span",{className:"material-symbols-outlined",children:"expand_more"})]}),B?i.jsxs("div",{className:"af-work-context-run-card__workspace-menu",onClick:ee=>ee.stopPropagation(),children:[i.jsxs("div",{className:"af-work-load-skills-search",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),i.jsx("input",{type:"search",value:F,onChange:ee=>T(ee.target.value),placeholder:"搜索知识库...",spellCheck:!1,autoComplete:"off","aria-label":"搜索知识库"}),F?i.jsx("button",{type:"button",onClick:()=>T(""),"aria-label":"清空搜索",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),i.jsxs("div",{ref:Ve.menuRef,className:"af-work-load-skills-menu af-work-context-run-card__menu-scroll",onScroll:Ve.updateMenuScrollbar,children:[i.jsxs("section",{className:"af-work-load-skills-menu__group",children:[i.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[i.jsx("span",{children:"知识库"}),i.jsx("small",{children:bt.length})]}),i.jsx("div",{className:"af-work-load-skills-menu__options",children:bt.map(ee=>i.jsxs("label",{className:"af-work-load-skills-menu__option",children:[i.jsx("input",{type:"checkbox",checked:je.has(ee.id||ee.path),disabled:b,onChange:Ie=>ve(ee,Ie.target.checked)}),i.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[i.jsx("span",{className:"af-work-load-skills-menu__option-title",children:ee.label}),i.jsxs("span",{className:"af-work-load-skills-menu__option-desc",children:[ee.kind==="git"&&ee.repoUrl?`${ee.repoUrl}${ee.branch?` · ${ee.branch}`:""}${ee.mountPath?` · ${ee.mountPath}`:""}`:ee.path,ee.exists?"":" · 路径未就绪"]})]})]},`${ee.id}:${ee.path}`))})]}),bt.length===0?i.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的知识库"}):null,i.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:ze,children:"清空知识库"})]}),i.jsx("div",{ref:Ve.scrollbarTrackRef,className:"af-work-load-skills-scrollbar"+(Ve.scrollbar.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:Ve.handleScrollbarPointerDown,"aria-hidden":"true",children:i.jsx("span",{style:{height:`${Ve.scrollbar.height}%`,top:`${Ve.scrollbar.top}%`}})})]}):null]}),i.jsxs("select",{value:u.displayType,disabled:b,onChange:ee=>tt({displayType:ee.target.value}),children:[i.jsx("option",{value:"markdown",children:"Markdown"}),i.jsx("option",{value:"html",children:"HTML"}),i.jsx("option",{value:"react",children:"React"}),i.jsx("option",{value:"table",children:"Table"}),i.jsx("option",{value:"chart",children:"Chart"}),i.jsx("option",{value:"ascii",children:"ASCII"}),i.jsx("option",{value:"mermaid",children:"Mermaid"})]})]}),H?i.jsx("pre",{className:"af-work-context-run-card__preview",children:H.slice(0,520)}):null]}),i.jsxs("div",{className:"af-work-context-run-card__actions",children:[i.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-context-run-card__run nodrag"+(g?" af-work-run-card__button--stop":""),disabled:b,onClick:ee=>{var Ie,Fe;ee.stopPropagation(),Jt(),g?(Ie=t==null?void 0:t.onStopWorkspaceNode)==null||Ie.call(t,e):(Fe=t==null?void 0:t.onRunWorkspaceNode)==null||Fe.call(t,e)},children:[i.jsx("span",{className:"material-symbols-outlined",children:g?"stop_circle":"play_arrow"}),i.jsx("span",{children:g?"Stop":"Run"})]}),i.jsx("button",{type:"button",className:"af-work-run-card__button af-work-context-run-card__logs nodrag",onClick:ee=>{var Ie;ee.stopPropagation(),(Ie=t==null?void 0:t.onOpenWorkspaceRunLogs)==null||Ie.call(t,{nodeId:e,runNodeId:e,scheduleNodeId:"",label:t!=null&&t.label&&t.label!=="Context Run"?t.label:"一键任务"})},children:i.jsx("span",{className:"material-symbols-outlined",children:"article"})})]})]})]})}function gG({id:e,data:t,selected:n,deleteNode:r}){var C,N,j;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],o=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],a=ev((t==null?void 0:t.body)||""),l=(t==null?void 0:t.scheduledRunState)||{},c=((N=(C=t==null?void 0:t.runningRunNodeIds)==null?void 0:C.has)==null?void 0:N.call(C,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,d=(t==null?void 0:t.nodeStatus)==="stopped",p=!!(t!=null&&t.readOnly),f=A=>{var I;(I=t==null?void 0:t.onChangeScheduledRunConfig)==null||I.call(t,e,{...a,...A})},h=A=>{f({scheduleType:A,cron:Lu(A,a.time,a.weekday,a.monthDay,a.cron)})},g=A=>{f({time:A,cron:Lu(a.scheduleType,A,a.weekday,a.monthDay,a.cron)})},[k,b]=Zk(a.time).split(":"),y=(A,I)=>{g(`${Mo(A,9,0,23)}:${Mo(I,0,0,59)}`)},v=A=>{f({weekday:A,cron:Lu(a.scheduleType,a.time,A,a.monthDay,a.cron)})},w=A=>{f({monthDay:A,cron:Lu(a.scheduleType,a.time,a.weekday,A,a.cron)})};return i.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":"")+(d?" af-work-run-card--stopped":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[s.map((A,I)=>{if(A.showOnNode===!1)return null;const D=`${2.25+I*1.75}rem`,B=A.name||`#${I+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:D},children:B}),i.jsx(Vn,{type:"target",position:Ke.Left,id:`input-${I}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:D,background:En(A.type)},title:`${B} · ${A.type}`})]},`in-${I}`)}),o.map((A,I)=>{if(A.showOnNode===!1)return null;const D=`${2.25+I*1.75}rem`,B=A.name||`#${I+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:D},children:B}),i.jsx(Vn,{type:"source",position:Ke.Right,id:`output-${I}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:D,background:En(A.type)},title:`${B} · ${A.type}`})]},`out-${I}`)}),i.jsxs("div",{className:"af-work-run-card__head",children:[i.jsx("span",{className:"material-symbols-outlined",children:"event_repeat"}),i.jsx("strong",{children:(t==null?void 0:t.label)||"Scheduled Run"}),i.jsx("span",{children:(t==null?void 0:t.definitionId)||"workspace_scheduled_run"}),i.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",disabled:p,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),i.jsxs("div",{className:"af-work-schedule-card__body nodrag",children:[i.jsxs("label",{className:"af-work-schedule-card__toggle",children:[i.jsx("input",{type:"checkbox",checked:a.enabled,disabled:p,onChange:A=>f({enabled:A.target.checked})}),i.jsx("span",{children:a.enabled?"定时开启":"定时关闭"})]}),i.jsxs("label",{className:"af-work-schedule-card__field",children:[i.jsx("span",{children:"频率"}),i.jsxs("select",{value:a.scheduleType,disabled:p,onChange:A=>h(A.target.value),children:[i.jsx("option",{value:"daily",children:"每天"}),i.jsx("option",{value:"weekly",children:"每周"}),i.jsx("option",{value:"monthly",children:"每月"}),i.jsx("option",{value:"custom",children:"高级 Cron"})]})]}),a.scheduleType!=="custom"?i.jsxs("label",{className:"af-work-schedule-card__field",children:[i.jsx("span",{children:"时间"}),i.jsxs("div",{className:"af-work-schedule-time-selects",children:[i.jsx("select",{value:k,disabled:p,"aria-label":"小时",onChange:A=>y(A.target.value,b),children:Array.from({length:24},(A,I)=>Mo(I,0,0,23)).map(A=>i.jsxs("option",{value:A,children:[A," 时"]},A))}),i.jsx("select",{value:b,disabled:p,"aria-label":"分钟",onChange:A=>y(k,A.target.value),children:Array.from({length:12},(A,I)=>Mo(I*5,0,0,59)).map(A=>i.jsxs("option",{value:A,children:[A," 分"]},A))})]})]}):null,a.scheduleType==="weekly"?i.jsxs("label",{className:"af-work-schedule-card__field",children:[i.jsx("span",{children:"星期"}),i.jsxs("select",{value:a.weekday,disabled:p,onChange:A=>v(A.target.value),children:[i.jsx("option",{value:1,children:"周一"}),i.jsx("option",{value:2,children:"周二"}),i.jsx("option",{value:3,children:"周三"}),i.jsx("option",{value:4,children:"周四"}),i.jsx("option",{value:5,children:"周五"}),i.jsx("option",{value:6,children:"周六"}),i.jsx("option",{value:0,children:"周日"})]})]}):null,a.scheduleType==="monthly"?i.jsxs("label",{className:"af-work-schedule-card__field",children:[i.jsx("span",{children:"日期"}),i.jsx("select",{value:a.monthDay,disabled:p,onChange:A=>w(A.target.value),children:Array.from({length:31},(A,I)=>I+1).map(A=>i.jsxs("option",{value:A,children:[A," 日"]},A))})]}):null,a.scheduleType==="custom"?i.jsxs("label",{className:"af-work-schedule-card__field",children:[i.jsx("span",{children:"Cron"}),i.jsx("input",{type:"text",value:a.cron,disabled:p,spellCheck:!1,placeholder:$d,onChange:A=>f({cron:A.target.value})})]}):null,i.jsxs("div",{className:"af-work-schedule-card__meta",children:[i.jsxs("span",{children:[OY(a.scheduleType)," ",a.scheduleType==="custom"?"":a.time]}),i.jsxs("span",{children:["Next ",LY(l.nextAt)]}),i.jsx("span",{children:c?"running":l.lastStatus||"idle"})]}),l.lastError?i.jsx("div",{className:"af-work-schedule-card__error",children:l.lastError}):null,i.jsxs("div",{className:"af-work-schedule-card__actions",children:[i.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:p||u,onClick:A=>{var I,D;A.stopPropagation(),c?(I=t==null?void 0:t.onStopWorkspaceNode)==null||I.call(t,e):(D=t==null?void 0:t.onRunWorkspaceNode)==null||D.call(t,e)},children:[i.jsx("span",{className:"material-symbols-outlined",children:c?"stop_circle":"play_arrow"}),i.jsx("span",{children:c?"停止":"立即运行"})]}),i.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-schedule-card__optimize nodrag"+(u?" af-work-schedule-card__optimize--running":""),disabled:p||c||u,title:"为下游节点提前生成 implementation",onClick:A=>{var I;A.stopPropagation(),(I=t==null?void 0:t.onOptimizeWorkspaceSchedule)==null||I.call(t,e)},children:[i.jsx("span",{className:"material-symbols-outlined",children:u?"sync":"auto_fix_high"}),i.jsx("span",{children:u?"优化中":"优化"})]}),i.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-schedule-card__logs nodrag",onClick:A=>{var I;A.stopPropagation(),(I=t==null?void 0:t.onOpenWorkspaceRunLogs)==null||I.call(t,{nodeId:e,scheduleNodeId:e,runNodeId:l.targetRunNodeId||e,lastRunId:l.lastRunId||"",label:(t==null?void 0:t.label)||"Scheduled Run"})},children:[i.jsx("span",{className:"material-symbols-outlined",children:"article"}),i.jsx("span",{children:"日志"})]})]})]})]})}function yG({id:e,data:t,selected:n,deleteNode:r}){const{setNodes:s}=Rc(),o=!!(t!=null&&t.readOnly),a=Xx(t==null?void 0:t.nodeSize)||{width:Ua,height:Ya},l=m.useCallback(c=>{var u,d;c.button!==0||c.metaKey||c.ctrlKey||c.shiftKey||(d=(u=c.target)==null?void 0:u.closest)!=null&&d.call(u,".af-work-group-node__resize, .af-work-group-node__delete")||s(p=>_T(p,e))},[e,s]);return i.jsxs("div",{className:"af-work-group-node"+(n?" af-work-group-node--selected":""),style:{width:a.width,height:a.height},onPointerDownCapture:l,children:[o?null:i.jsx(jk,{className:"af-work-group-node__resize nodrag",minWidth:Ua,minHeight:Ya,position:"bottom-right",children:i.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),i.jsxs("div",{className:"af-work-group-node__title nodrag",children:[i.jsx("span",{children:(t==null?void 0:t.title)||(t==null?void 0:t.label)||"Group"}),i.jsx("button",{type:"button",className:"af-work-group-node__delete",disabled:o,onClick:c=>{c.stopPropagation(),r==null||r(e)},"aria-label":"删除分组",title:"删除分组",children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})]})}function wG(e){var g,k,b,y,v,w,C,N,j,A,I,D,B,W,F,T,M,q,H,L,R,z,E,Q,V,$,ne,ce;const{setEdges:t,setNodes:n}=Rc(),r=(g=e.data)==null?void 0:g.onSyncNodePropDraft,s=!!((k=e.data)!=null&&k.readOnly),[o,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(X=>{var ie,te,ue;if(s)return;(te=(ie=e.data)==null?void 0:ie.onCleanupWorkspaceNodeOutputs)==null||te.call(ie,X,e.data);const re=Js((ue=e.data)==null?void 0:ue.definitionId)?RT(X):"",Z=new Set([X,re].filter(Boolean));n(fe=>fe.filter(be=>!Z.has(be.id))),t(fe=>fe.filter(be=>!Z.has(be.source)&&!Z.has(be.target)))},[e.data,s,t,n]),u=m.useCallback(X=>{var re,Z;X.button!==0||X.metaKey||X.ctrlKey||X.shiftKey||(Z=(re=X.target)==null?void 0:re.closest)!=null&&Z.call(re,".react-flow__handle, .af-work-display-resize")||(n(ie=>_T(ie,e.id)),t(ie=>vG(ie)))},[e.id,t,n]),d=m.useCallback((X,re)=>{s||(n(Z=>Z.map(ie=>ie.id===X?{...ie,data:{...ie.data,model:re}}:ie)),r==null||r(X,{model:re}))},[s,n,r]),p=m.useCallback((X,re)=>{s||(n(Z=>Z.map(ie=>{var ue;if(ie.id!==X)return ie;const te=Array.isArray((ue=ie.data)==null?void 0:ue.outputs)&&ie.data.outputs.length?ie.data.outputs.map((fe,be)=>be===0?{...fe,default:re,value:re}:fe):[{type:"bool",name:"value",default:re,value:re}];return{...ie,data:{...ie.data,body:"",outputs:te}}})),r==null||r(X,Z=>({body:"",outputs:Array.isArray(Z==null?void 0:Z.outputs)&&Z.outputs.length?Z.outputs.map((te,ue)=>ue===0?{...te,default:re,value:re}:te):[{type:"bool",name:"value",default:re,value:re}]})))},[s,n,r]),f=m.useCallback((X,re)=>{s||(n(Z=>Z.map(ie=>ie.id===X?{...ie,data:{...ie.data,body:re}}:ie)),r==null||r(X,{body:re}))},[s,n,r]),h=m.useCallback((X,re)=>{if(s)return;const Z=ao(re);n(ie=>ie.map(te=>te.id===X?{...te,data:{...te.data,images:Z}}:te)),r==null||r(X,{images:Z})},[s,n,r]);return(y=e.data)!=null&&y.isWorkspaceGroup?i.jsx(yG,{...e,deleteNode:c}):Xa((v=e.data)==null?void 0:v.definitionId)?i.jsx(NT,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):((w=e.data)==null?void 0:w.definitionId)==="workspace_run"?i.jsx(hG,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):((C=e.data)==null?void 0:C.definitionId)==="workspace_scheduled_run"?i.jsx(gG,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):Js((N=e.data)==null?void 0:N.definitionId)?i.jsx(mG,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,skills:(j=e.data)==null?void 0:j.skills,skillCollections:(A=e.data)==null?void 0:A.skillCollections,workspaces:(I=e.data)==null?void 0:I.workspaceTargets}):((D=e.data)==null?void 0:D.definitionId)==="control_load_skills"?i.jsx(DG,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,skills:(B=e.data)==null?void 0:B.skills,skillCollections:(W=e.data)==null?void 0:W.skillCollections,onChangeSkillKeys:(F=e.data)==null?void 0:F.onChangeLoadSkillKeys}):((T=e.data)==null?void 0:T.definitionId)==="control_load_mcp"?i.jsx(FG,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,servers:(M=e.data)==null?void 0:M.mcpServers,onChangeMcpNames:(q=e.data)==null?void 0:q.onChangeLoadMcpNames}):((H=e.data)==null?void 0:H.definitionId)==="control_cd_workspace"?i.jsx(zG,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,workspaces:(L=e.data)==null?void 0:L.workspaceTargets,onChangeWorkspace:(R=e.data)==null?void 0:R.onChangeLoadWorkspace,onRefreshWorkspaces:(z=e.data)==null?void 0:z.onRefreshWorkspaces}):i.jsxs("div",{className:"af-work-flow-node"+(e.selected?" af-work-flow-node--selected":"")+(o?" af-work-flow-node--resizing":"")+((E=e.data)!=null&&E.isExecuting||((Q=e.data)==null?void 0:Q.nodeStatus)==="running"?" af-work-flow-node--executing":"")+(((V=e.data)==null?void 0:V.nodeStatus)==="success"?" af-work-flow-node--done":"")+((($=e.data)==null?void 0:$.nodeStatus)==="failed"?" af-work-flow-node--failed":"")+(((ne=e.data)==null?void 0:ne.nodeStatus)==="stopped"?" af-work-flow-node--stopped":""),style:l?{width:l.width,height:l.height}:void 0,onPointerDownCapture:u,children:[s?null:i.jsx(jk,{className:"af-work-display-resize af-work-flow-resize nodrag",position:"bottom-right",minWidth:ZR,minHeight:Gh,maxWidth:eT,maxHeight:tT,onResizeStart:()=>a(!0),onResizeEnd:()=>a(!1),children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),i.jsx(xq,{...e,deleteNode:c,modelLists:(ce=e.data)==null?void 0:ce.modelLists,onModelChange:d,onProvideValueChange:p,onNodeBodyChange:f,onNodeImagesChange:h})]})}const xG={[lc]:wG};function tv(e,t=[]){for(const n of e||[])n.type==="file"&&t.push(n),Array.isArray(n.children)&&tv(n.children,t);return t}function jT(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)?jT(r.children,n):null;if(s)return s}return null}function bG(e){const t=String(e||"").replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");return!t||!t.includes("/")?"":t.split("/").slice(0,-1).join("/")}function CT(e,t=[]){for(const n of e||[])n.type==="directory"&&(t.push(n.path),Array.isArray(n.children)&&CT(n.children,t));return t}function Np(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 kG(e,t){const n=String(t||"");let r=!1;const s=(e||[]).map(o=>{const a=o.id===n;return o.selected===a?o:(r=!0,{...o,selected:a})});return r?s:e}function _T(e,t){const n=String(t||""),r=(e||[]).find(o=>o.id===n),s=(e||[]).reduce((o,a)=>o+(a.selected?1:0),0);return r!=null&&r.selected&&s>1?e:kG(e,n)}function vG(e){let t=!1;const n=(e||[]).map(r=>r.selected?(t=!0,{...r,selected:!1}):r);return t?n:e}function SG(e){return[...e||[]].sort((t,n)=>t.type!==n.type?t.type==="directory"?-1:1:String(t.name||"").localeCompare(String(n.name||"")))}function NG(e,t,n=0){const r=String(t||"").replace(/\\/g,"/").split("/").filter(Boolean);if(r.length===0)return e;const s=(o,a,l)=>{const c=r[a],u=l?`${l}/${c}`:c,d=a===r.length-1;let p=!1;const f=(Array.isArray(o)?o:[]).map(h=>h.name!==c?h:(p=!0,d?{...h,type:"file",name:c,path:u,icon:Jl(c),size:n}:{...h,type:"directory",name:c,path:u,icon:Jl(c,!0),children:s(h.children||[],a+1,u)}));return p||f.push(d?{type:"file",name:c,path:u,icon:Jl(c),size:n}:{type:"directory",name:c,path:u,icon:Jl(c,!0),children:s([],a+1,u)}),SG(f)};return s(e||[],0,"")}function jG(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 ET({items:e,onOpen:t,selectedPath:n,collapsedDirs:r,onToggleDir:s,onSelect:o,onFileDragStart:a,onDelete:l,onDownload:c}){return i.jsx("ul",{className:"af-work-files",children:(e||[]).map(u=>{var h;const d=u.type==="directory",p=d&&(r==null?void 0:r.has(u.path)),f=n===u.path;return i.jsxs("li",{children:[i.jsxs("div",{className:"af-work-file-row",children:[i.jsxs("button",{type:"button",className:"af-work-file af-work-file--"+u.type+(f?" af-work-file--selected":""),draggable:!d,onDragStart:g=>{d||a==null||a(g,u)},onClick:()=>{o==null||o(u),d&&(s==null||s(u.path))},onDoubleClick:()=>{d||t(u)},title:u.path,children:[d?i.jsx("span",{className:"material-symbols-outlined af-work-file__chevron",children:p?"chevron_right":"expand_more"}):null,i.jsx("span",{className:"material-symbols-outlined",children:u.icon||Jl(u.name,d)}),i.jsx("span",{children:u.name})]}),f?i.jsxs("div",{className:"af-work-file-actions",children:[d?null:i.jsx("button",{type:"button",className:"af-work-file-action",onClick:g=>{g.stopPropagation(),c==null||c(u)},"aria-label":`下载 ${u.name}`,title:`下载 ${u.path}`,children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"download"})}),i.jsx("button",{type:"button",className:"af-work-file-action af-work-file-action--danger",onClick:g=>{g.stopPropagation(),l==null||l(u)},"aria-label":`删除 ${u.name}`,title:`删除 ${u.path}`,children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"})})]}):null]}),d&&!p&&((h=u.children)!=null&&h.length)?i.jsx(ET,{items:u.children,onOpen:t,selectedPath:n,collapsedDirs:r,onToggleDir:s,onSelect:o,onFileDragStart:a,onDelete:l,onDownload:c}):null]},u.path)})})}function CG({files:e,query:t,onQueryChange:n,onSelect:r,onUpload:s,onClose:o}){const a=m.useMemo(()=>tv(e),[e]),l=String(t||"").trim().toLowerCase(),c=a.filter(u=>l?`${u.path} ${u.name}`.toLowerCase().includes(l):!0);return i.jsx("div",{className:"af-flow-snippet-modal-overlay",onMouseDown:o,children:i.jsxs("div",{className:"af-flow-snippet-modal af-work-file-picker-modal",role:"dialog","aria-modal":"true","aria-label":"选择文件",onMouseDown:u=>u.stopPropagation(),children:[i.jsxs("div",{className:"af-flow-snippet-modal__head",children:[i.jsxs("span",{className:"af-flow-snippet-modal__title",children:[i.jsx("span",{className:"material-symbols-outlined",children:"folder_open"}),"选择文件"]}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:o,"aria-label":"关闭",children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),i.jsxs("div",{className:"af-flow-snippet-modal__body",children:[i.jsxs("div",{className:"af-work-file-picker-modal__tools",children:[i.jsx("input",{value:t,onChange:u=>n(u.target.value),placeholder:"搜索文件路径...",autoFocus:!0}),i.jsxs("button",{type:"button",onClick:()=>s==null?void 0:s(""),children:[i.jsx("span",{className:"material-symbols-outlined",children:"upload_file"}),"上传"]})]}),i.jsxs("div",{className:"af-work-file-picker-modal__list",children:[c.map(u=>i.jsxs("button",{type:"button",className:"af-work-file-picker-modal__item",onClick:()=>r(u),children:[i.jsx("span",{className:"material-symbols-outlined",children:u.icon||Jl(u.name)}),i.jsxs("span",{className:"af-work-file-picker-modal__main",children:[i.jsx("strong",{children:u.name}),i.jsx("small",{children:u.path})]}),u.size?i.jsx("em",{children:jG(u.size)}):null]},u.path)),c.length===0?i.jsx("div",{className:"af-work-file-picker-modal__empty",children:"没有匹配文件,可先上传或调整搜索词。"}):null]})]})]})})}function mC({messages:e,running:t,showRunningIndicator:n=!0}){const r=e.length>0;return i.jsxs("div",{className:"af-composer-ai-stack af-composer-ai-stack--in-panel af-composer-thread-stack",children:[e.map((s,o)=>{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 i.jsxs("section",{className:`af-composer-ai-block af-composer-ai-block--${a}${s.kind?` af-composer-ai-block--kind-${s.kind}`:""}`,children:[i.jsx("div",{className:"af-composer-ai-block-label",children:l}),i.jsx("div",{className:"af-composer-ai-block-body",children:s.text})]},`${o}-${s.role}-${String(s.text||"").slice(0,24)}`)}),n&&t&&!r?i.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--reply af-composer-ai-block--pending",children:[i.jsx("div",{className:"af-composer-ai-block-label",children:"Reply"}),i.jsx("div",{className:"af-composer-ai-block-body",children:"Waiting..."})]}):null,n&&t&&r?i.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--thinking",children:[i.jsx("div",{className:"af-composer-ai-block-label",children:"Thinking"}),i.jsx("div",{className:"af-composer-ai-block-body",children:"Workspace agent is running..."})]}):null]})}function AT(e){const t=String((e==null?void 0:e.kind)||"");return["run-log","run-summary","activity","prompt","raw","thinking"].includes(t)}function _G(e,t=!1){const n=Array.isArray(e)?e:[],r=n.filter(o=>!AT(o));if(r.length>0)return r;const s=[...n].reverse().find(o=>(o==null?void 0:o.kind)==="result"||(o==null?void 0:o.kind)==="assistant"||(o==null?void 0:o.error));return s?[s]:n.length>0||t?[{role:"assistant",kind:"assistant",text:t?"正在执行,可以在完成后继续追问或要求调整。":"运行已完成。可以在下方继续追问、要求总结或调整结果。",at:0}]:[]}function EG(e){return(Array.isArray(e)?e:[]).filter(AT)}function Dd(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 AG(e){const t=Dd((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 Dd((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function PG(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 Dd((n==null?void 0:n.default)||(n==null?void 0:n.value)||"")}function PT(e,t,n=1){const r=(Array.isArray(e)?e:[]).map(o=>String(o||"").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 gC(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function Jo(e,t,n=""){const r=(Array.isArray(e)?e:[]).find(o=>(o==null?void 0:o.name)===t);return String((r==null?void 0:r.value)??(r==null?void 0:r.default)??"").trim()||n}function rm(e,t){const n=Jo(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 sf(e){const t=String(e||"").trim().toLowerCase();return["markdown","html","react","table","chart","ascii","mermaid"].includes(t)?t:"markdown"}function xs(e){const t=String(e||""),n=t.indexOf(" - ");return n>=0?t.slice(0,n).trim():t.trim()}function IT(e){const t=sf(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 RT(e){return`${String(e||"context_run").trim()||"context_run"}__display`}function TT(e){return e==="display_image"?"src":"content"}function yC(e,t,n){const r=TT(t),s=Ou(e);let o=!1;const a=s.map(l=>(l==null?void 0:l.name)===r?(o=!0,{...l,default:n,value:n,showOnNode:l.showOnNode!==!1}):(l==null?void 0:l.name)==="filePath"?{...l,default:"",value:""}:l);return o||a.push({type:"text",name:r,default:n,value:n,required:!0,showOnNode:!0}),a}function wC(e,t,n=[],r=[]){const s=Array.isArray(e)?e:[],o=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)&&o.has(String((u==null?void 0:u.name)||"").trim()));return c<0&&(c=s.findIndex(u=>o.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 xC(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 Jm(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 IG(e){const t=Array.isArray(e==null?void 0:e.inputs)?e.inputs:[],n=Jo(t,"includeWorkspaceContext","true").toLowerCase(),r=rm(t,"knowledgeContext"),s=rm(t,"workspaceContext");return{task:String((e==null?void 0:e.body)||""),skillKeys:PG(e),includeWorkspaceContext:n!=="false"&&n!=="0"&&n!=="off",knowledgeContext:r||(s?Xm([s]):null),workspaceContext:s,displayType:sf(Jo(t,"displayType","markdown")),model:String((e==null?void 0:e.model)||"").trim()}}function Js(e){const t=String(e||"");return t==="workspace_one_click_task"||t==="workspace_context_run"}function RG(e){const t=Dd((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 Dd((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function TG(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function MT(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 o=String(s||r||"知识库").trim();return{id:r,label:o,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||o).trim(),repoUrl:String((e==null?void 0:e.repoUrl)||"").trim(),branch:String((e==null?void 0:e.branch)||"").trim(),readonly:!0,role:t}}function Xm(e=[]){const t=(Array.isArray(e)?e:[e]).map((n,r)=>MT(n,r===0?"primary":"context")).filter(Boolean);return t.length?{version:1,sources:t}:null}function $T(e){return(e&&typeof e=="object"&&Array.isArray(e.sources)?e.sources:[]).map(n=>MT(n,(n==null?void 0:n.role)||"context")).filter(Boolean)}function MG(e){const t=Array.isArray(e==null?void 0:e.inputs)?e.inputs:[],n=rm(t,"knowledgeContext"),r=rm(t,"workspaceContext");return{sources:$T(n||(r?Xm([r]):null)),path:Jo(t,"path",""),label:Jo(t,"label","")}}function bC(e){var r,s,o,a,l,c,u,d,p;if(!e)return null;const{inputs:t,outputs:n}=Rq(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(((o=e.data)==null?void 0:o.model)??""),body:String(((a=e.data)==null?void 0:a.body)??""),images:ao((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(((d=e.data)==null?void 0:d.implementationRef)??""),implementationMode:String(((p=e.data)==null?void 0:p.implementationMode)??""),inputs:t,outputs:n}}function kC(e,t,n,r=""){var c,u;const s=String(n||"").trim(),o=(Array.isArray(e)?e:[]).find(d=>String((d==null?void 0:d.id)||"")===s),a=String(((c=o==null?void 0:o.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 vC(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 $G(e,t,n){var d,p;const r=String(((d=e==null?void 0:e.data)==null?void 0:d.definitionId)??n),s=r.startsWith("provide_"),o=String((t==null?void 0:t.role)||"").trim(),a=Rd.includes(o)?o:"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?[]:ao(t==null?void 0:t.images),inputs:vC(t==null?void 0:t.inputs),outputs:s&&Array.isArray((p=e.data)==null?void 0:p.outputs)?e.data.outputs:vC(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 f of["scriptRef","implementationRef","implementationMode"]){const h=String((t==null?void 0:t[f])??"").trim();h?c[f]=h:delete c[f]}return c}function SC({nodes:e,edges:t,instances:n,selectedNode:r,draft:s,allowRename:o=!1}){if(!s||!r)return{ok:!1,error:""};const a=r.id,l=String(s.newId||"").trim(),c=o?l:a;if(o){if(!tU.test(c))return{ok:!1,error:"Invalid instance id"};if(e.some(k=>k.id===c&&k.id!==a))return{ok:!1,error:"Duplicate instance id"}}const u=$G(r,s,c),d=r.data||{};if(!(c!==a||d.label!==u.label||d.role!==u.role||d.model!==u.model||d.body!==u.body||JSON.stringify(ao(d.images))!==JSON.stringify(u.images)||(d.script??void 0)!==(u.script??void 0)||(d.scriptRef??void 0)!==(u.scriptRef??void 0)||(d.implementationRef??void 0)!==(u.implementationRef??void 0)||(d.implementationMode??void 0)!==(u.implementationMode??void 0)||JSON.stringify(d.inputs||[])!==JSON.stringify(u.inputs||[])||JSON.stringify(d.outputs||[])!==JSON.stringify(u.outputs||[])))return{ok:!0,changed:!1,nextId:c,nodes:e,edges:t,instances:n};const f=e.map(k=>k.id===a?{...k,id:c,selected:!0,data:u}:k);let h=t,g=n;if(c!==a){g={...n||{}};const k={...g[a]||{}};delete g[a],g[c]=k,h=t.map((b,y)=>({...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}-${y}`}))}return{ok:!0,changed:!0,nextId:c,nodes:f,edges:h,instances:g}}function LG(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function OG(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"])LG(e[s],t[s])&&(r[s]=n[s]);return r}function eb(e,t=[]){const n=m.useRef(null),r=m.useRef(null),[s,o]=m.useState({visible:!1,top:0,height:100}),a=m.useCallback(()=>{const d=n.current;if(!d)return;const p=Math.max(1,d.scrollHeight),f=Math.max(1,d.clientHeight),h=p>f+1,g=h?Math.max(12,f/p*100):100,k=Math.max(0,100-g),b=h?Math.min(k,d.scrollTop/Math.max(1,p-f)*k):0;o({visible:h,top:b,height:g})},[]);m.useEffect(()=>{if(!e)return;const d=requestAnimationFrame(a);return()=>cancelAnimationFrame(d)},[e,a,...t]);const l=m.useCallback(d=>{const p=n.current;if(!p)return;const f=Math.max(0,p.scrollHeight-p.clientHeight);p.scrollTop=Math.min(1,Math.max(0,d))*f,a()},[a]),c=m.useCallback((d,p=0)=>{const f=r.current;if(!f)return 0;const h=f.getBoundingClientRect(),g=s.height/100*h.height,k=Math.max(1,h.height-g);return(d-h.top-p)/k},[s.height]),u=m.useCallback(d=>{var C,N;if(!s.visible)return;d.preventDefault(),d.stopPropagation();const p=r.current;if(!p)return;const f=p.getBoundingClientRect(),h=s.top/100*f.height,g=s.height/100*f.height,b=d.clientY>=f.top+h&&d.clientY<=f.top+h+g?d.clientY-f.top-h:g/2;l(c(d.clientY,b));const y=d.pointerId;(N=(C=d.currentTarget).setPointerCapture)==null||N.call(C,y);const v=j=>{j.preventDefault(),l(c(j.clientY,b))},w=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",w),window.removeEventListener("pointercancel",w)};window.addEventListener("pointermove",v),window.addEventListener("pointerup",w),window.addEventListener("pointercancel",w)},[c,l,s.height,s.top,s.visible]);return{menuRef:n,scrollbarTrackRef:r,scrollbar:s,updateMenuScrollbar:a,handleScrollbarPointerDown:u}}function DG({id:e,data:t,selected:n,deleteNode:r,skills:s,skillCollections:o,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:[],d=Array.isArray(o)?o:[],[p,f]=m.useState(!1),[h,g]=m.useState(""),[k,b]=m.useState(()=>new Set),y=m.useRef(null),v=m.useRef(null),[w,C]=m.useState({visible:!1,top:0,height:100}),N=m.useMemo(()=>new Set(AG(t)),[t]),j=m.useMemo(()=>new Map(u.map(L=>[L.key,L])),[u]),A=m.useMemo(()=>Array.from(N).map(L=>{var R;return((R=j.get(L))==null?void 0:R.name)||L}),[j,N]),I=m.useMemo(()=>PT(A,"选择 Skills"),[A]),D=m.useMemo(()=>{const L=new Set,R=d.map(E=>{const Q=Yo(E,u).map(V=>j.get(V)).filter(Boolean);for(const V of Q)L.add(V.key);return{...E,skills:Q}}).filter(E=>E.skills.length>0),z=u.filter(E=>!L.has(E.key));return{collectionGroups:R,ungrouped:z}},[j,d,u]);m.useEffect(()=>{b(L=>{let R=!1;const z=new Set(L);for(const E of D.collectionGroups)z.has(E.id)||(z.add(E.id),R=!0);return R?z:L})},[D.collectionGroups]);const B=m.useMemo(()=>{const L=h.trim().toLowerCase();if(!L)return D;const R=E=>[E==null?void 0:E.key,E==null?void 0:E.name,E==null?void 0:E.description].map(V=>String(V||"").toLowerCase()).join(" ").includes(L);return{collectionGroups:D.collectionGroups.map(E=>{const V=[E==null?void 0:E.id,E==null?void 0:E.name,E==null?void 0:E.description].map($=>String($||"").toLowerCase()).join(" ").includes(L)?E.skills:E.skills.filter(R);return{...E,skills:V}}).filter(E=>E.skills.length>0),ungrouped:D.ungrouped.filter(R)}},[D,h]),W=m.useCallback((L,R)=>{const z=new Set(N);for(const E of L)R?z.add(E):z.delete(E);a==null||a(e,Array.from(z))},[e,N,a]),F=m.useCallback(L=>{b(R=>{const z=new Set(R);return z.has(L)?z.delete(L):z.add(L),z})},[]),T=m.useCallback(()=>{const L=y.current;if(!L)return;const R=Math.max(1,L.scrollHeight),z=Math.max(1,L.clientHeight),E=R>z+1,Q=E?Math.max(12,z/R*100):100,V=Math.max(0,100-Q),$=E?Math.min(V,L.scrollTop/Math.max(1,R-z)*V):0;C({visible:E,top:$,height:Q})},[]);m.useEffect(()=>{if(!p)return;const L=requestAnimationFrame(T);return()=>cancelAnimationFrame(L)},[k,B,N.size,p,T]);const M=m.useCallback(L=>{const R=y.current;if(!R)return;const z=Math.max(0,R.scrollHeight-R.clientHeight);R.scrollTop=Math.min(1,Math.max(0,L))*z,T()},[T]),q=m.useCallback((L,R=0)=>{const z=v.current;if(!z)return 0;const E=z.getBoundingClientRect(),Q=w.height/100*E.height,V=Math.max(1,E.height-Q);return(L-E.top-R)/V},[w.height]),H=m.useCallback(L=>{var re,Z;if(!w.visible)return;L.preventDefault(),L.stopPropagation();const R=v.current;if(!R)return;const z=R.getBoundingClientRect(),E=w.top/100*z.height,Q=w.height/100*z.height,$=L.clientY>=z.top+E&&L.clientY<=z.top+E+Q?L.clientY-z.top-E:Q/2;M(q(L.clientY,$));const ne=L.pointerId;(Z=(re=L.currentTarget).setPointerCapture)==null||Z.call(re,ne);const ce=ie=>{ie.preventDefault(),M(q(ie.clientY,$))},X=()=>{window.removeEventListener("pointermove",ce),window.removeEventListener("pointerup",X),window.removeEventListener("pointercancel",X)};window.addEventListener("pointermove",ce),window.addEventListener("pointerup",X),window.addEventListener("pointercancel",X)},[q,M,w.height,w.top,w.visible]);return i.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":"")+(p?" af-work-load-skills-card--menu-open":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[l.map((L,R)=>{if(L.showOnNode===!1)return null;const z=`${2.6+R*1.7}rem`,E=L.name||`#${R+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:z},children:E}),i.jsx(Vn,{type:"target",position:Ke.Left,id:`input-${R}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:z,background:En(L.type)},title:`${E} · ${L.type}`})]},`in-${R}`)}),c.map((L,R)=>{if(L.showOnNode===!1)return null;const z=`${2.6+R*1.7}rem`,E=L.name||`#${R+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:z},children:E}),i.jsx(Vn,{type:"source",position:Ke.Right,id:`output-${R}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:z,background:En(L.type)},title:`${E} · ${L.type}`})]},`out-${R}`)}),i.jsxs("div",{className:"af-work-load-skills-card__head",children:[i.jsx("span",{className:"material-symbols-outlined",children:"extension"}),i.jsx("strong",{children:(t==null?void 0:t.label)||"Load Skills"}),i.jsx("span",{children:(t==null?void 0:t.definitionId)||"control_load_skills"}),i.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),i.jsxs("div",{className:"af-work-load-skills-card__body nodrag",children:[i.jsxs("button",{type:"button",className:"af-work-load-skills-card__select",onClick:L=>{var R;L.stopPropagation(),p||(R=t==null?void 0:t.onRefreshSkills)==null||R.call(t),f(z=>!z)},children:[i.jsxs("span",{className:"af-work-load-skills-card__summary",title:I.title,children:[i.jsx("span",{className:"af-work-load-skills-card__summary-main",children:I.head}),I.extra?i.jsx("span",{className:"af-work-load-skills-card__summary-extra",children:I.extra}):null]}),i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:p?"expand_less":"expand_more"})]}),p?i.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick:L=>L.stopPropagation(),children:[i.jsxs("div",{className:"af-work-load-skills-search",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),i.jsx("input",{type:"search",value:h,onChange:L=>g(L.target.value),placeholder:"搜索 Skills...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Skills"}),h?i.jsx("button",{type:"button",onClick:()=>g(""),"aria-label":"清空搜索",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),i.jsxs("div",{ref:y,className:"af-work-load-skills-menu",onScroll:T,children:[B.collectionGroups.map(L=>{const R=L.skills.map(V=>V.key),z=R.filter(V=>N.has(V)).length,E=R.length>0&&z===R.length,Q=k.has(L.id);return i.jsxs("section",{className:"af-work-load-skills-menu__group"+(Q?" af-work-load-skills-menu__group--collapsed":""),children:[i.jsxs("div",{className:"af-work-load-skills-menu__group-head",children:[i.jsx("input",{type:"checkbox",checked:E,onChange:V=>W(R,V.target.checked),"aria-label":`选择 ${L.name}`}),i.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-toggle",onClick:()=>F(L.id),"aria-expanded":!Q,children:i.jsxs("span",{className:"af-work-load-skills-menu__group-main",children:[i.jsx("span",{children:L.name}),L.description?i.jsx("em",{children:L.description}):null]})}),i.jsxs("small",{children:[z,"/",R.length]}),i.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-arrow",onClick:()=>F(L.id),"aria-label":Q?`展开 ${L.name}`:`收起 ${L.name}`,children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Q?"chevron_right":"expand_more"})})]}),Q?null:i.jsx("div",{className:"af-work-load-skills-menu__options",children:L.skills.map(V=>i.jsxs("label",{className:"af-work-load-skills-menu__option",children:[i.jsx("input",{type:"checkbox",checked:N.has(V.key),onChange:$=>W([V.key],$.target.checked)}),i.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[i.jsx("span",{className:"af-work-load-skills-menu__option-title",children:V.name}),V.description?i.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:V.description}):null]})]},`${L.id}:${V.key}`))})]},L.id)}),B.ungrouped.length>0?i.jsxs("section",{className:"af-work-load-skills-menu__group",children:[i.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[i.jsx("span",{children:"Ungrouped"}),i.jsx("small",{children:B.ungrouped.length})]}),i.jsx("div",{className:"af-work-load-skills-menu__options",children:B.ungrouped.map(L=>i.jsxs("label",{className:"af-work-load-skills-menu__option",children:[i.jsx("input",{type:"checkbox",checked:N.has(L.key),onChange:R=>W([L.key],R.target.checked)}),i.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[i.jsx("span",{className:"af-work-load-skills-menu__option-title",children:L.name}),L.description?i.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:L.description}):null]})]},`ungrouped:${L.key}`))})]}):null,B.collectionGroups.length===0&&B.ungrouped.length===0?i.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 Skills"}):null,i.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>a==null?void 0:a(e,[]),children:"清空"})]}),i.jsx("div",{ref:v,className:"af-work-load-skills-scrollbar"+(w.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:H,"aria-hidden":"true",children:i.jsx("span",{style:{height:`${w.height}%`,top:`${w.top}%`}})})]}):null]})]})}function FG({id:e,data:t,selected:n,deleteNode:r,servers:s=[],onChangeMcpNames:o}){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),[d,p]=m.useState(""),f=m.useMemo(()=>new Set(RG(t)),[t]),h=m.useMemo(()=>(Array.isArray(s)?s:[]).map(b=>({name:String((b==null?void 0:b.name)||""),description:String((b==null?void 0:b.description)||""),detail:String((b==null?void 0:b.url)||[b==null?void 0:b.command,...Array.isArray(b==null?void 0:b.args)?b.args:[]].filter(Boolean).join(" ")||""),type:String((b==null?void 0:b.type)||"")})).filter(b=>b.name),[s]),g=m.useMemo(()=>{const b=d.trim().toLowerCase();return b?h.filter(y=>[y.name,y.description,y.detail,y.type].join(" ").toLowerCase().includes(b)):h},[d,h]),k=m.useCallback((b,y)=>{const v=new Set(f);for(const w of b)y?v.add(w):v.delete(w);o==null||o(e,Array.from(v))},[e,f,o]);return i.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":"")+(c?" af-work-load-skills-card--menu-open":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[a.map((b,y)=>{if(b.showOnNode===!1)return null;const v=`${2.6+y*1.7}rem`,w=b.name||`#${y+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:v},children:w}),i.jsx(Vn,{type:"target",position:Ke.Left,id:`input-${y}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:v,background:En(b.type)},title:`${w} · ${b.type}`})]},`in-${y}`)}),l.map((b,y)=>{if(b.showOnNode===!1)return null;const v=`${2.6+y*1.7}rem`,w=b.name||`#${y+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:v},children:w}),i.jsx(Vn,{type:"source",position:Ke.Right,id:`output-${y}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:v,background:En(b.type)},title:`${w} · ${b.type}`})]},`out-${y}`)}),i.jsxs("div",{className:"af-work-load-skills-card__head",children:[i.jsx("span",{className:"material-symbols-outlined",children:"hub"}),i.jsx("strong",{children:(t==null?void 0:t.label)||"Load MCP"}),i.jsx("span",{children:(t==null?void 0:t.definitionId)||"control_load_mcp"}),i.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),i.jsxs("div",{className:"af-work-load-skills-card__body nodrag",children:[i.jsxs("button",{type:"button",className:"af-work-load-skills-card__select",onClick:b=>{var y;b.stopPropagation(),c||(y=t==null?void 0:t.onRefreshMcps)==null||y.call(t),u(v=>!v)},children:[i.jsx("span",{children:f.size>0?`${f.size} MCP selected`:"选择 MCP"}),i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:c?"expand_less":"expand_more"})]}),c?i.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick:b=>b.stopPropagation(),children:[i.jsxs("div",{className:"af-work-load-skills-search",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),i.jsx("input",{type:"search",value:d,onChange:b=>p(b.target.value),placeholder:"搜索 MCP...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 MCP"}),d?i.jsx("button",{type:"button",onClick:()=>p(""),"aria-label":"清空搜索",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),i.jsxs("div",{className:"af-work-load-skills-menu",children:[i.jsxs("section",{className:"af-work-load-skills-menu__group",children:[i.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[i.jsx("span",{children:"MCP Servers"}),i.jsx("small",{children:g.length})]}),i.jsx("div",{className:"af-work-load-skills-menu__options",children:g.map(b=>i.jsxs("label",{className:"af-work-load-skills-menu__option",children:[i.jsx("input",{type:"checkbox",checked:f.has(b.name),onChange:y=>k([b.name],y.target.checked)}),i.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[i.jsx("span",{className:"af-work-load-skills-menu__option-title",children:b.name}),b.description||b.detail?i.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:b.description||b.detail}):null]})]},b.name))})]}),g.length===0?i.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 MCP"}):null,i.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>o==null?void 0:o(e,[]),children:"清空"})]})]}):null]})]})}function zG({id:e,data:t,selected:n,deleteNode:r,workspaces:s=[],onChangeWorkspace:o,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,d]=m.useState(!1),[p,f]=m.useState(""),h=MG(t),g=m.useMemo(()=>(Array.isArray(s)?s:[]).map(N=>({id:String((N==null?void 0:N.id)||""),label:String((N==null?void 0:N.label)||(N==null?void 0:N.name)||"知识库"),kind:(N==null?void 0:N.kind)==="git"?"git":"local",path:String((N==null?void 0:N.path)||""),repoUrl:String((N==null?void 0:N.repoUrl)||""),branch:String((N==null?void 0:N.branch)||""),mountPath:String((N==null?void 0:N.mountPath)||""),builtin:(N==null?void 0:N.builtin)===!0,exists:(N==null?void 0:N.exists)!==!1})).filter(N=>N.path),[s]),k=m.useMemo(()=>{const N=p.trim().toLowerCase();return N?g.filter(j=>[j.id,j.label,j.path,j.repoUrl,j.branch,j.mountPath].join(" ").toLowerCase().includes(N)):g},[p,g]),b=m.useMemo(()=>new Set((h.sources||[]).map(N=>N.id||N.path||N.repoPath).filter(Boolean)),[h.sources]),y=m.useMemo(()=>(h.sources||[]).map(N=>N.label||N.id||N.mountPath||N.path),[h.sources]),v=m.useMemo(()=>PT(y,"选择知识库"),[y]),w=eb(u,[k.length,y.length,p]),C=(N,j)=>{const A=(N==null?void 0:N.id)||(N==null?void 0:N.path)||"",I=g.filter(D=>{const B=D.id||D.path||"";return B===A?j:b.has(B)});o==null||o(e,I)};return i.jsxs("div",{className:"af-work-load-skills-card af-work-load-workspace-card"+(n?" af-work-load-skills-card--selected":"")+(u?" af-work-load-skills-card--menu-open":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[l.map((N,j)=>{if(N.showOnNode===!1)return null;const A=`${2.6+j*1.7}rem`,I=N.name||`#${j+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:A},children:I}),i.jsx(Vn,{type:"target",position:Ke.Left,id:`input-${j}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:A,background:En(N.type)},title:`${I} · ${N.type}`})]},`in-${j}`)}),c.map((N,j)=>{if(N.showOnNode===!1)return null;const A=`${2.6+j*1.7}rem`,I=N.name||`#${j+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:A},children:I}),i.jsx(Vn,{type:"source",position:Ke.Right,id:`output-${j}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:A,background:En(N.type)},title:`${I} · ${N.type}`})]},`out-${j}`)}),i.jsxs("div",{className:"af-work-load-skills-card__head",children:[i.jsx("span",{className:"material-symbols-outlined",children:"folder_managed"}),i.jsx("strong",{children:(t==null?void 0:t.label)||"加载知识库"}),i.jsx("span",{children:(t==null?void 0:t.definitionId)||"control_cd_workspace"}),i.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),i.jsxs("div",{className:"af-work-load-skills-card__body nodrag",children:[i.jsxs("button",{type:"button",className:"af-work-load-skills-card__select",onClick:N=>{N.stopPropagation(),u||a==null||a(),d(j=>!j)},children:[i.jsxs("span",{className:"af-work-load-skills-card__summary",title:v.title,children:[i.jsx("span",{className:"af-work-load-skills-card__summary-main",children:v.head}),v.extra?i.jsx("span",{className:"af-work-load-skills-card__summary-extra",children:v.extra}):null]}),i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:u?"expand_less":"expand_more"})]}),u?i.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick:N=>N.stopPropagation(),children:[i.jsxs("div",{className:"af-work-load-skills-search",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),i.jsx("input",{type:"search",value:p,onChange:N=>f(N.target.value),placeholder:"搜索知识库...",spellCheck:!1,autoComplete:"off","aria-label":"搜索知识库"}),p?i.jsx("button",{type:"button",onClick:()=>f(""),"aria-label":"清空搜索",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),i.jsxs("div",{ref:w.menuRef,className:"af-work-load-skills-menu",onScroll:w.updateMenuScrollbar,children:[i.jsxs("section",{className:"af-work-load-skills-menu__group",children:[i.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[i.jsx("span",{children:"知识库"}),i.jsx("small",{children:k.length})]}),i.jsx("div",{className:"af-work-load-skills-menu__options",children:k.map(N=>i.jsxs("label",{className:"af-work-load-skills-menu__option",children:[i.jsx("input",{type:"checkbox",checked:b.has(N.id||N.path),onChange:j=>C(N,j.target.checked)}),i.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[i.jsx("span",{className:"af-work-load-skills-menu__option-title",children:N.label}),i.jsxs("span",{className:"af-work-load-skills-menu__option-desc",children:[N.kind==="git"&&N.repoUrl?`${N.repoUrl}${N.branch?` · ${N.branch}`:""}${N.mountPath?` · ${N.mountPath}`:""}`:N.path,N.exists?"":" · 路径未就绪"]})]})]},`${N.id}:${N.path}`))})]}),k.length===0?i.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的知识库"}):null,i.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>o==null?void 0:o(e,[]),children:"清空知识库"})]}),i.jsx("div",{ref:w.scrollbarTrackRef,className:"af-work-load-skills-scrollbar"+(w.scrollbar.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:w.handleScrollbarPointerDown,"aria-hidden":"true",children:i.jsx("span",{style:{height:`${w.scrollbar.height}%`,top:`${w.scrollbar.top}%`}})})]}):null]})]})}function LT({row:e,index:t=0,child:n=!1}){const r=(e==null?void 0:e.issue)||{},s=GR(r),o=fU(pY(r)),a=s?o.filter(f=>!["issue","mr"].includes(Uh(f))):o,l=hU(r,o),c=Si(r,t),u=s?"":Ma(r.platform),d=Array.isArray(e==null?void 0:e.children)?e.children.length:0,p=[c,s&&d?`${d} 个端侧 Issue`:u,r.status].filter(Boolean);return i.jsxs("div",{className:`af-prd-workflow-issue${n?" af-prd-workflow-issue--child":""}${s?" af-prd-workflow-issue--aggregate":""}`,children:[i.jsx("strong",{children:uY(r,t)}),i.jsx("small",{children:p.join(" · ")}),i.jsxs("div",{className:"af-prd-workflow-issue__state-row",children:[i.jsx("span",{className:`af-prd-workflow-issue__state af-prd-workflow-issue__state--${l.kind}`,children:l.label}),l.detail?i.jsx("small",{children:l.detail}):null]}),a.length?i.jsx("div",{className:"af-prd-workflow-issue__links",children:a.map(f=>i.jsx("a",{href:f.href,target:"_blank",rel:"noreferrer",children:f.label},`${f.label}-${f.href}`))}):null,d?i.jsx("div",{className:"af-prd-workflow-issue__children",children:e.children.map((f,h)=>i.jsx(LT,{row:f,index:h,child:!0},Si((f==null?void 0:f.issue)||{},h)))}):null]})}function Za(e){return e==null?"":typeof e=="string"||typeof e=="number"?String(e).trim():typeof e!="object"||Array.isArray(e)?"":String(e.label||e.name||e.value||e.key||e.code||e.username||e.userId||"").trim()}function Ml(e){return(Array.isArray(e)?e:e==null||e===""?[]:[e]).map(n=>Za(n)).filter(Boolean)}function BG(e){if(!e||typeof e!="object"||Array.isArray(e))return Za(e);const t=Za(e),n=Ml(e.groups||e.variants||e.buckets);return[t,n.length?n.join(" / "):""].filter(Boolean).join(" · ")}function HG(e){if(!e||typeof e!="object"||Array.isArray(e))return Za(e);const t=Za(e),n=e.defaultValue??e.default_value??e.default;return[t,n!=null&&n!==""?`默认 ${String(n)}`:""].filter(Boolean).join(" · ")}function WG({platform:e,value:t}){var p,f,h;const n=Za(t==null?void 0:t.owner),r=Ml(t==null?void 0:t.tags),s=(Array.isArray(t==null?void 0:t.experiments)?t.experiments:[]).map(BG).filter(Boolean),o=(Array.isArray(t==null?void 0:t.settings)?t.settings:[]).map(HG).filter(Boolean),a=Ml((p=t==null?void 0:t.filters)==null?void 0:p.countries),l=Ml((f=t==null?void 0:t.filters)==null?void 0:f.users),c=Ml((h=t==null?void 0:t.filters)==null?void 0:h.versions),u=Ml(t==null?void 0:t.rules),d=[["Tag",r],["AB 实验",s],["Settings",o],["国家过滤",a],["用户过滤",l],["版本过滤",c]].filter(([,g])=>g.length);return!n&&!d.length&&!u.length?null:i.jsxs("section",{className:"af-prd-overall-platform",children:[i.jsxs("div",{className:"af-prd-overall-platform__head",children:[i.jsx("strong",{children:Ma(e)||e}),n?i.jsxs("span",{children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"person"}),n]}):null]}),d.map(([g,k])=>i.jsxs("div",{className:"af-prd-overall-platform__row",children:[i.jsx("small",{children:g}),i.jsx("div",{children:k.map(b=>i.jsx("span",{children:b},`${g}-${b}`))})]},g)),u.length?i.jsxs("div",{className:"af-prd-overall-platform__rules",children:[i.jsx("small",{children:"实现规则"}),i.jsx("ul",{children:u.map(g=>i.jsx("li",{children:g},g))})]}):null]})}function VG({overall:e}){const t=e!=null&&e.requirement&&typeof e.requirement=="object"?e.requirement:{},n=e!=null&&e.platforms&&typeof e.platforms=="object"?e.platforms:{},r=String(t.title||t.name||"").trim(),s=String(t.tapdUrl||t.tapd_url||t.url||"").trim(),o=Za(t.status||t.tapdStatus||t.tapd_status),a=Object.entries(n).filter(([l,c])=>l&&c&&typeof c=="object"&&!Array.isArray(c));return!r&&!s&&!o&&!a.length?null:i.jsxs("article",{className:"af-prd-workflow-card af-prd-overall",children:[i.jsxs("div",{className:"af-prd-workflow-card__head",children:[i.jsx("h2",{children:"需求概览"}),o?i.jsx("span",{className:"af-prd-overall__status",children:o}):null]}),r||s?i.jsx("div",{className:"af-prd-overall__requirement",children:s?i.jsxs("a",{href:s,target:"_blank",rel:"noreferrer",children:[i.jsx("strong",{children:r||`TAPD ${t.tapdId||""}`}),i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"})]}):i.jsx("strong",{children:r})}):null,i.jsx("div",{className:"af-prd-overall__platforms",children:a.map(([l,c])=>i.jsx(WG,{platform:l,value:c},l))})]})}function KG({tapdId:e,setTapdId:t,snapshot:n,loading:r,error:s,actionRunning:o,actionOutput:a,pendingConfirm:l,conflict:c,reviewPublishing:u,onRefresh:d,onRunDryRun:p,onConfirmAction:f,onRetryConflict:h,onPublishReview:g}){var bt;const[k,b]=m.useState("all"),[y,v]=m.useState("all"),[w,C]=m.useState(!1),[N,j]=m.useState(!1),[A,I]=m.useState(!1),[D,B]=m.useState(""),[W,F]=m.useState(""),[T,M]=m.useState(null),q=String((n==null?void 0:n.phase)||(e?"unavailable":"unselected")),H=Array.isArray(n==null?void 0:n.issues)?n.issues:[],L=hY(n),R=L.reduce((oe,je)=>oe+Kx(je.issues),0),z=Array.isArray(n==null?void 0:n.artifacts)?n.artifacts:[];Array.isArray(n==null?void 0:n.optionalGaps)&&n.optionalGaps;const E=n!=null&&n.nextAction&&typeof n.nextAction=="object"?n.nextAction:null,Q=wY(n,E),V=lY(n,Q),$=z.filter(oe=>!aT({...oe,href:Xh(oe)})),ne=m.useMemo(()=>iY(Q),[Q]);m.useEffect(()=>{y!=="all"&&(ne.some(oe=>oe.key===y)||v("all"))},[y,ne]);const ce=Q.filter(oe=>oY(oe,y)),X=rY(ce),re=xY(n),Z=re.filter(oe=>bY(oe,k)),ie=ce.filter(oe=>Jk(oe)).length,te=n!=null&&n.collaboration&&typeof n.collaboration=="object"?n.collaboration:{},ue=te.activeAction&&typeof te.activeAction=="object"?te.activeAction:null;Array.isArray(n==null?void 0:n.clientObservations)&&n.clientObservations;const fe=String((n==null?void 0:n.rawOutput)||""),be=n!=null&&n.overall&&typeof n.overall=="object"?n.overall:null,qe=GU(q),Ue=m.useCallback(async()=>{const oe=String(e||"").trim();if(!oe){M(null);return}j(!0),B("");try{const je=new URLSearchParams({tapdId:oe}),Ve=await fetch(`/api/prd-workflow/collaboration?${je.toString()}`),tt=await Ve.json().catch(()=>({}));if(!Ve.ok)throw new Error(tt.error||"读取 Workflow 分享状态失败");M(tt.collaboration||null)}catch(je){B(String(je.message||je))}finally{j(!1)}},[e]);m.useEffect(()=>{var oe;M(((oe=n==null?void 0:n.collaboration)==null?void 0:oe.workflow)||null)},[(bt=n==null?void 0:n.collaboration)==null?void 0:bt.workflow]);const Me=()=>{C(!0),F(""),Ue()},rt=async()=>{const oe=W.trim();if(!(!oe||!e||A)){I(!0),B("");try{const je=await fetch("/api/prd-workflow/collaboration/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tapdId:e,username:oe,role:"editor"})}),Ve=await je.json().catch(()=>({}));if(!je.ok)throw new Error(Ve.error||"添加 Workflow 协作成员失败");M(Ve.collaboration||null),F("")}catch(je){B(String(je.message||je))}finally{I(!1)}}},gt=async(oe="")=>{if(!(!e||A)){I(!0),B("");try{const je=await fetch("/api/prd-workflow/collaboration/share",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({tapdId:e,...oe?{memberUserId:oe}:{}})}),Ve=await je.json().catch(()=>({}));if(!je.ok)throw new Error(Ve.error||"取消 Workflow 分享失败");M(Ve.collaboration||null),Ve.left&&C(!1)}catch(je){B(String(je.message||je))}finally{I(!1)}}};return i.jsxs("main",{className:"af-prd-workflow af-prd-workflow--timeline","aria-label":"PRD Workflow",children:[i.jsxs("section",{className:"af-prd-workflow__statusbar",children:[i.jsxs("div",{className:"af-prd-workflow__status-main",children:[i.jsx("span",{className:`af-prd-workflow-phase af-prd-workflow-phase--${q.toLowerCase().replace(/[^a-z0-9_-]+/gi,"_")}`,children:Q1(q)}),i.jsx("h1",{children:(n==null?void 0:n.pointer)||(e?"等待 prd-flow 返回状态":"选择 TAPD 需求后读取状态")}),i.jsx("p",{className:"af-prd-workflow__status-subtitle",children:e?i.jsxs(i.Fragment,{children:["TAPD ",i.jsx("strong",{children:e})," · 独立需求 Workflow"]}):i.jsx(i.Fragment,{children:"尚未选择 TAPD 需求"})}),s?i.jsx("p",{className:"af-prd-workflow-error",children:s}):null,ue||te.subscribers?i.jsxs("div",{className:"af-prd-workflow-collab",children:[ue?i.jsxs("span",{children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"lock"}),ue.title||ue.action||"Workflow action"," 执行中",ue.userId?i.jsx("small",{children:ue.userId}):null]}):null,te.subscribers?i.jsxs("span",{children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"group"}),te.subscribers," 个连接"]}):null]}):null]}),i.jsxs("form",{className:"af-prd-workflow__lookup",onSubmit:oe=>{oe.preventDefault(),d==null||d()},children:[i.jsx("div",{className:"af-prd-workflow-flow","aria-label":"需求流程阶段",children:qe.map(oe=>i.jsxs("div",{className:`af-prd-workflow-flow__step af-prd-workflow-flow__step--${oe.status}`,children:[i.jsx("span",{"aria-hidden":"true"}),i.jsx("small",{children:oe.label})]},oe.label))}),i.jsxs("div",{className:"af-prd-workflow__lookup-row",children:[i.jsxs("label",{children:[i.jsx("span",{children:"TAPD Workflow"}),i.jsx("input",{value:e,onChange:oe=>t(oe.target.value),placeholder:"输入需求 ID",autoComplete:"off",spellCheck:!1})]}),i.jsxs("button",{type:"submit",disabled:r,children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:r?"hourglass_empty":"sync"}),r?"读取中":e?"刷新":"读取"]}),i.jsxs("button",{type:"button",disabled:!e,onClick:Me,children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"group_add"}),"分享",(T==null?void 0:T.memberCount)>1?` ${T.memberCount-1}`:""]})]})]})]}),c?i.jsxs("section",{className:"af-prd-workflow-conflict","aria-label":"Workflow conflict",children:[i.jsxs("div",{children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"sync_problem"}),i.jsxs("div",{children:[i.jsx("strong",{children:"状态已变化,需要重新确认"}),i.jsx("p",{children:c.message||"当前 workflow 状态和执行前不一致。"})]})]}),i.jsxs("dl",{children:[i.jsxs("div",{children:[i.jsx("dt",{children:"执行时 revision"}),i.jsx("dd",{children:c.expectedRevision||"空"})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"当前 revision"}),i.jsx("dd",{children:c.currentRevision||"未知"})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"当前状态"}),i.jsx("dd",{children:[Q1(c.currentPhase),c.currentPointer].filter(Boolean).join(" · ")||"未知"})]})]}),i.jsx("div",{className:"af-prd-workflow-conflict__actions",children:i.jsx("button",{type:"button",onClick:()=>d==null?void 0:d(),disabled:r||o,children:"刷新状态"})})]}):null,i.jsxs("section",{className:"af-prd-workflow__main",children:[i.jsxs("article",{className:"af-prd-workflow-actions","aria-label":"Workflow actions",children:[i.jsxs("div",{className:"af-prd-workflow-actions__head",children:[i.jsxs("div",{children:[i.jsx("h2",{children:"Action 时间线"}),i.jsx("p",{children:Q.length?`${ie}/${ce.length} 已完成${y!=="all"?` · 共 ${Q.length}`:""}`:"等待 prd-flow 返回 action 列表"})]}),E&&Od(E)?i.jsxs("div",{className:"af-prd-workflow-local-command",children:[i.jsx("span",{children:"本地 agent 执行"}),i.jsx("code",{children:E.command||Ji(E,0)})]}):null]}),ne.length?i.jsxs("div",{className:"af-prd-workflow-action-filters","aria-label":"Action tag filters",children:[i.jsxs("button",{type:"button",className:y==="all"?"is-active":"","aria-pressed":y==="all",onClick:()=>v("all"),children:["全部 ",i.jsx("span",{children:Q.length})]}),ne.map(oe=>i.jsxs("button",{type:"button",className:y===oe.key?"is-active":"","aria-pressed":y===oe.key,onClick:()=>v(oe.key),children:[oe.label," ",i.jsx("span",{children:oe.count})]},oe.key))]}):null,i.jsx("div",{className:"af-prd-workflow-action-list",children:ce.length?X.map(oe=>i.jsxs("section",{className:"af-prd-workflow-action-day",children:[i.jsxs("div",{className:"af-prd-workflow-action-day__label",children:[i.jsx("span",{children:oe.day}),i.jsx("small",{children:"北京时间"})]}),i.jsx("div",{className:"af-prd-workflow-action-day__items",children:oe.items.map(({item:je,index:Ve})=>{const tt=sa(je.status),Jt=Ga(je)==="observation"&&tt==="done"?"observed":tt,st=Gm(je),de=nY(je),ve=aY(je),ze=XU(je,Ve),Ze=QU(je);return i.jsxs("div",{className:`af-prd-workflow-action af-prd-workflow-action--${Jt}`,children:[i.jsx("div",{className:"af-prd-workflow-action__rail",children:i.jsx("span",{className:"af-prd-workflow-action__dot"})}),i.jsxs("div",{className:"af-prd-workflow-action__body",children:[i.jsxs("div",{className:"af-prd-workflow-action__top",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"af-prd-workflow-action__title",children:[de?i.jsx("time",{dateTime:Qh(je),children:de}):null,i.jsx("strong",{children:ze})]}),Ze?i.jsx("p",{children:Ze}):null,ve.length?i.jsx("div",{className:"af-prd-workflow-action__meta",children:ve.map(Se=>i.jsxs("span",{children:[i.jsx("b",{children:Se.label}),Se.value]},`${Se.label}-${Se.value}`))}):null]}),i.jsx("span",{className:"af-prd-workflow-action__status",children:sY(je)})]}),st.length?i.jsx("div",{className:"af-prd-workflow-action__links",children:st.map(Se=>i.jsxs("a",{href:Se.href,target:"_blank",rel:"noreferrer",children:[i.jsx("span",{children:Se.label}),i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"})]},`${Se.label}-${Se.href}`))}):null]})]},je.id||je.actionId||`${Ji(je,Ve)}-${Ve}`)})})]},oe.day)):i.jsxs("div",{className:"af-prd-workflow-action-empty",children:[i.jsx("strong",{children:e?Q.length?"当前 tag 下暂无 action":"暂无 prd-flow 上报 action":"先选择 TAPD 需求"}),i.jsx("p",{children:e?Q.length?"切换到其它 tag 或查看全部。":"Workflow tab 不会生成默认步骤;需要 prd-flow snapshot 返回 actions/timeline/events/history 或 nextAction。":"选择后从 prd-flow 读取真实 action、产物和 URL。"})]})})]}),i.jsxs("aside",{className:"af-prd-workflow-side","aria-label":"Workflow related links",children:[i.jsx(VG,{overall:be}),$.length?i.jsxs("article",{className:"af-prd-workflow-card",children:[i.jsxs("div",{className:"af-prd-workflow-card__head",children:[i.jsx("h2",{children:"关联产物"}),i.jsx("span",{children:$.length})]}),i.jsx("div",{className:"af-prd-workflow-list",children:$.map((oe,je)=>{const Ve=Xh(oe),tt=String(oe.label||oe.title||oe.kind||Ve||`Artifact ${je+1}`);return Ve?i.jsxs("a",{href:Ve,target:"_blank",rel:"noreferrer",children:[i.jsx("span",{children:tt}),i.jsx("small",{children:oe.kind||Ve})]},`${Ve}-${je}`):i.jsxs("div",{children:[i.jsx("span",{children:tt}),i.jsx("small",{children:oe.kind||""})]},`${tt}-${je}`)})})]}):null,i.jsxs("article",{className:"af-prd-workflow-card",children:[i.jsxs("div",{className:"af-prd-workflow-card__head",children:[i.jsx("h2",{children:"AI Docs"}),i.jsx("span",{children:V.length})]}),i.jsx("div",{className:"af-prd-workflow-list",children:V.length?V.map(oe=>{const je=String(oe.title||oe.label||"ai-doc").trim(),Ve=[oe.label&&oe.label!==je?oe.label:"",oe.platform,oe.issueKey].filter(Boolean);return i.jsxs("a",{className:"af-prd-ai-doc",href:oe.href,target:"_blank",rel:"noreferrer",title:je,children:[i.jsx("span",{className:"af-prd-ai-doc__title",children:je}),i.jsx("small",{className:"af-prd-ai-doc__meta",children:Ve.join(" · ")||oe.kind||"ai-doc"})]},oe.href)}):i.jsx("p",{className:"af-prd-workflow-muted",children:"暂无 ai-doc 文档。"})})]}),i.jsxs("article",{className:"af-prd-workflow-card",children:[i.jsxs("div",{className:"af-prd-workflow-card__head",children:[i.jsx("h2",{children:"Issues"}),i.jsx("span",{children:R||H.length})]}),i.jsx("div",{className:"af-prd-workflow-issues",children:L.length?L.map(oe=>i.jsxs("div",{className:"af-prd-workflow-epic",children:[i.jsxs("div",{className:"af-prd-workflow-epic__head",children:[i.jsx("strong",{children:oe.title||oe.key}),i.jsx("small",{children:Kx(oe.issues)})]}),oe.issues.map((je,Ve)=>i.jsx(LT,{row:je,index:Ve},Si((je==null?void 0:je.issue)||{},Ve)))]},oe.key)):i.jsx("p",{className:"af-prd-workflow-muted",children:"暂无 Issue 信息。"})})]}),i.jsxs("article",{className:"af-prd-workflow-card",children:[i.jsxs("div",{className:"af-prd-workflow-card__head",children:[i.jsx("h2",{children:"运行审计"}),i.jsxs("span",{children:[Z.length,"/",re.length]})]}),i.jsx("div",{className:"af-prd-workflow-audit-filter",role:"tablist","aria-label":"运行审计筛选",children:[["all","全部"],["errors","异常"],["review","Review"],["external","外部"]].map(([oe,je])=>i.jsx("button",{type:"button",className:k===oe?"is-active":"",onClick:()=>b(oe),children:je},oe))}),i.jsx("div",{className:"af-prd-workflow-audit",children:Z.length?Z.map((oe,je)=>i.jsxs("div",{children:[i.jsx("strong",{children:Ji(oe,je)}),i.jsx("small",{children:[oe.status,oe.type,Qh(oe)].filter(Boolean).join(" · ")})]},oe.id||`${oe.type}-${je}`)):i.jsx("p",{className:"af-prd-workflow-muted",children:"暂无运行事件。"})})]}),fe||a?i.jsxs("article",{className:"af-prd-workflow-card af-prd-workflow-card--raw",children:[i.jsx("div",{className:"af-prd-workflow-card__head",children:i.jsx("h2",{children:"Raw"})}),i.jsx("pre",{children:a||fe})]}):null]})]}),w?sr.createPortal(i.jsx("div",{className:"af-flow-snippet-modal-overlay",children:i.jsxs("div",{className:"af-flow-snippet-modal af-display-share-modal",role:"dialog","aria-modal":"true","aria-label":"分享需求 Workflow",children:[i.jsxs("div",{className:"af-flow-snippet-modal__head",children:[i.jsxs("span",{className:"af-flow-snippet-modal__title",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"group_add"}),"分享需求 Workflow"]}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>C(!1),"aria-label":"关闭",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),i.jsxs("div",{className:"af-flow-snippet-modal__body",children:[i.jsxs("p",{className:"af-display-link-modal__empty",children:["按 TAPD ",e," 分享需求流程;不会分享当前 Project、画布或项目文件。"]}),T!=null&&T.role&&T.role!=="owner"?i.jsx("div",{className:"af-prd-workflow-share-note",children:"你是该 Workflow 的协作成员,可以查看和推进需求状态。"}):i.jsxs("div",{className:"af-workspace-member-add",children:[i.jsx("input",{type:"text",value:W,onChange:oe=>F(oe.target.value),onKeyDown:oe=>{oe.key==="Enter"&&W.trim()&&!A&&(oe.preventDefault(),rt())},placeholder:"输入已注册用户名",autoFocus:!0}),i.jsx("button",{type:"button",disabled:A||!W.trim(),onClick:()=>void rt(),children:A?"添加中...":"添加成员"})]}),D?i.jsx("div",{className:"af-flow-snippet-error",children:D}):null,N?i.jsx("div",{className:"af-display-link-modal__empty",children:"正在读取分享成员..."}):null,i.jsx("div",{className:"af-workspace-member-list",children:((T==null?void 0:T.members)||[]).map(oe=>{const je=oe.userId===(T==null?void 0:T.ownerId)||oe.role==="owner";return i.jsxs("div",{className:"af-workspace-member-row",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:je?"shield_person":"person"}),i.jsxs("div",{children:[i.jsx("strong",{children:oe.username||oe.userId}),i.jsx("small",{children:je?"所有者":oe.role==="viewer"?"只读成员":"编辑成员"})]}),(T==null?void 0:T.role)==="owner"&&!je?i.jsx("button",{type:"button",disabled:A,onClick:()=>void gt(oe.userId),children:"取消分享"}):null]},oe.userId)})})]}),i.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[T!=null&&T.role&&T.role!=="owner"?i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",disabled:A,onClick:()=>void gt(),children:"退出分享"}):null,i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",onClick:()=>C(!1),children:"完成"})]})]})}),document.body):null]})}function NC(e,t){if(!(e!=null&&e[`has${t[0].toUpperCase()}${t.slice(1)}`]))return"(删除该字段)";const n=e==null?void 0:e[t];if(typeof n=="string")return n;try{return JSON.stringify(n,null,2)}catch{return String(n)}}function Su(e){if(!(e!=null&&e.hasIncoming))return"null";try{return JSON.stringify(e.incoming,null,2)}catch{return JSON.stringify(String(e.incoming))}}function qG(e,t,n,r=!0){const s=JSON.parse(JSON.stringify(e||{})),o=Array.isArray(t)?t:[];if(!o.length)return r?n:{};let a=s;for(let c=0;c<o.length-1;c+=1){const u=o[c],d=o[c+1];(!a[u]||typeof a[u]!="object")&&(a[u]=Number.isInteger(d)?[]:{}),a=a[u]}const l=o[o.length-1];return r?a[l]=n:Array.isArray(a)&&Number.isInteger(l)?a.splice(l,1):delete a[l],s}function UG(){var XS,QS,ZS;const{t:e,i18n:t}=Lr(),{navigate:n}=ei(),r=Rc(),s=Z5(),o=m.useMemo(LU,[]),a=m.useRef(new URLSearchParams(window.location.search).get("focusNodeId")||""),l=m.useMemo(()=>o.workspaceId?`agentflow.workspace.viewport:shared:${o.workspaceId}`:`agentflow.workspace.viewport:${o.flowSource||"user"}:${o.flowId||""}`,[o]),[c,u]=m.useState(()=>(()=>{const x=new URLSearchParams(window.location.search).get("view");return x==="display"||x==="workflow"?x:"workspace"})()),[d,p]=m.useState(!1),[f,h]=m.useState(!1),[g,k]=eW([]),[b,y]=tW([]),v=m.useRef([]),w=m.useRef([]),C=m.useRef(null),[N,j]=m.useState(()=>nh(null,[])),A=m.useRef(N),[I,D]=m.useState(null),B=m.useRef(null),W=m.useRef(!1),[F,T]=m.useState([]),M=m.useRef(new Map),q=m.useRef(new Map),H=m.useRef(null),L=m.useRef(null),R=m.useRef(null),[z,E]=m.useState(null),[Q,V]=m.useState({}),$=m.useRef({}),ne=m.useRef(!1),ce=m.useRef(null),X=m.useRef(""),re=m.useRef(null),Z=m.useRef(Promise.resolve()),ie=m.useRef({running:!1,pending:null}),te=m.useRef(0),ue=m.useRef(!1),fe=m.useRef(0),be=m.useRef(null),qe=m.useRef(!1),Ue=m.useRef(!1),Me=m.useRef(""),rt=m.useRef(!1),gt=m.useRef(!1),bt=m.useRef(!1),oe=m.useRef(typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`client-${Date.now()}-${Math.random().toString(36).slice(2)}`),je=m.useRef(!1),Ve=m.useRef(null),[tt,Jt]=m.useState([]),st=m.useRef([]),[de,ve]=m.useState(""),[ze,Ze]=m.useState("nodes"),[Se,Tt]=m.useState([]),[vn,dn]=m.useState(!1),[nn,Sn]=m.useState(""),[ee,Ie]=m.useState(!1),[Fe,Je]=m.useState({name:"",id:"",description:""}),[Pt,jt]=m.useState(!1),[lr,rn]=m.useState(""),[gr,qn]=m.useState(""),Mn=m.useRef(null),[Un,Yn]=m.useState(!1),[cr,yr]=m.useState(!1),[Xr,Gn]=m.useState(""),[mt,Fn]=m.useState(null),[Ft,fn]=m.useState(()=>Jy()),[zn,ps]=m.useState(""),[ri,ur]=m.useState(!1),[Wt,ae]=m.useState(""),[ke,ot]=m.useState(!1),[xt,xn]=m.useState([]),[on,Jn]=m.useState(!1),[Qr,ct]=m.useState(""),[qt,Vt]=m.useState(""),[wr,et]=m.useState(""),[_r,Or]=m.useState(!1),[si,co]=m.useState(""),[As,se]=m.useState(""),[Ne,Pe]=m.useState(!1),[lt,zt]=m.useState("nodes"),[Mt,Xn]=m.useState(""),[pn,Er]=m.useState(0),[K,he]=m.useState(""),$e=m.useRef(""),[pe,Be]=m.useState(null),In=m.useRef(null),[Et,Ut]=m.useState(""),[xr,uo]=m.useState([]),[fo,AM]=m.useState(""),[Ce,PM]=m.useState(!0),[Zt,sg]=m.useState(null),[IM,ig]=m.useState(!1),[og,gv]=m.useState(!1),[yv,Bc]=m.useState(""),[Hc,wv]=m.useState(""),[xv,bv]=m.useState(""),[Nn,sl]=m.useState(null),[RM,ia]=m.useState(!1),[ag,il]=m.useState({}),[df,kv]=m.useState(!1),[vv,Wc]=m.useState(""),[lg,TM]=m.useState(""),[MM,ol]=m.useState(()=>new Set),[cg,ug]=m.useState(""),[Vc,dg]=m.useState({nodeId:"",query:""}),[Sv,Nv]=m.useState(!1),jv=m.useRef(null),Cv=m.useRef(null),_v=m.useRef(""),[fg,$M]=m.useState(()=>{try{const x=Number(window.localStorage.getItem("agentflow.workspace.filesPaneHeight")||0);if(Number.isFinite(x)&&x>=160)return x}catch{}return 360}),[LM,Ev]=m.useState(!1),[oa,OM]=m.useState({cursor:[],opencode:[],claudeCode:[],codex:[]}),[Ii,DM]=m.useState(""),[Ps,FM]=m.useState([]),[Av,Pv]=m.useState(!1),[Is,Kc]=m.useState([]),[al,zM]=m.useState([]),[Iv,BM]=m.useState(!1),[Rv,Tv]=m.useState([]),[Mv,$v]=m.useState([]),[dr,HM]=m.useState(()=>{try{const x=String(new URLSearchParams(window.location.search).get("tapdId")||"").trim();return x||String(window.localStorage.getItem(`agentflow.workflow.tapdId:${o.flowSource||"user"}:${o.flowId||""}`)||"").trim()}catch{return""}}),[en,ff]=m.useState(null),[WM,Lv]=m.useState(!1),[VM,ll]=m.useState(""),[pg,Ov]=m.useState(!1),[hg,pf]=m.useState(""),[hs,hf]=m.useState(null),[mg,Dv]=m.useState(!1),[qc,Uc]=m.useState(null),Fv=m.useCallback(x=>{Mn.current&&window.clearTimeout(Mn.current),qn(x),Mn.current=window.setTimeout(()=>{qn(""),Mn.current=null},3800)},[]),po=m.useCallback(x=>{const S=String(x||"").trim();if(!S)return;const _=()=>s(S);window.requestAnimationFrame(_),window.setTimeout(_,80)},[s]),zv=m.useCallback((x,S)=>{const _=String(x||"").trim(),P=nm(S);!_||!P||(k(O=>O.map(U=>{var le;if(U.id!==_)return U;const J=nm((le=U.data)==null?void 0:le.displaySize),Y=J&&J.width===P.width&&J.height===P.height,G=Math.round(Number(U.width||0))===P.width&&Math.round(Number(U.height||0))===P.height;return Y&&G?U:{...U,width:P.width,height:P.height,data:{...U.data,nodeSize:P,displaySize:P}}})),po(_))},[po,k]);m.useEffect(()=>{try{window.localStorage.setItem("agentflow.workspace.filesPaneHeight",String(Math.round(fg)))}catch{}},[fg]);const gg=m.useCallback(x=>{const S=jv.current;if(!S)return;const _=S.getBoundingClientRect(),P=16,O=150,U=230,J=_.top+P,Y=_.bottom-P,G=Math.max(O,Y-J-U),le=Math.min(Math.max(x-J,O),G);$M(le)},[]),KM=m.useCallback(x=>{x.preventDefault(),x.stopPropagation(),Ev(!0),gg(x.clientY);const S=P=>{P.preventDefault(),gg(P.clientY)},_=()=>{Ev(!1),window.removeEventListener("pointermove",S,!0),window.removeEventListener("pointerup",_,!0),window.removeEventListener("pointercancel",_,!0)};window.addEventListener("pointermove",S,!0),window.addEventListener("pointerup",_,!0),window.addEventListener("pointercancel",_,!0)},[gg]);m.useEffect(()=>()=>{Mn.current&&window.clearTimeout(Mn.current),Ve.current&&window.clearTimeout(Ve.current)},[]);const[qM,Bv]=m.useState(()=>new Set),[mf,yg]=m.useState(!1),wg=m.useRef(null),Hv=m.useRef(null),Wv=m.useRef(null),[UM,YM]=m.useState({}),[aa,xg]=m.useState(""),[Zr,Vv]=m.useState(!1),[la,cl]=m.useState([]),[Rs,Bn]=m.useState([]),[Dr,ms]=m.useState("workspace"),[Yc,ul]=m.useState(!1),Kv=m.useRef(null),bg=m.useRef(null),[Gc,dl]=m.useState(null),[GM,kg]=m.useState(!0),[qv,Uv]=m.useState(""),[ca,ho]=m.useState({}),[Ar,Yv]=m.useState(null),[Gv,Jv]=m.useState(!1),fl=m.useMemo(()=>Gv?BU(Ar):"",[Gv,Ar]),[Jc,gf]=m.useState(!0);m.useEffect(()=>{fl&&gf(HU(fl))},[fl]),m.useEffect(()=>{if(fl)try{window.localStorage.setItem(fl,Jc?"true":"false")}catch{}},[Jc,fl]);const[vg,yf]=m.useState(!1),[Sg,Xv]=m.useState(!1),[Ng,Qv]=m.useState("pan"),[Zv,JM]=m.useState({}),Xc=m.useRef({}),[eS,ua]=m.useState({}),Qc=m.useRef(new Map),Zc=m.useRef(new Set),[tS,pl]=m.useState(()=>new Set),[jg,hl]=m.useState({}),[nS,rS]=m.useState(""),[kle,ge]=m.useState(""),[sS,Ts]=m.useState("loading"),[iS,Ms]=m.useState("正在载入 Project"),Ri=m.useMemo(()=>zU(o),[o]),[oS,aS]=m.useState(""),eu=o.flowSource||"user",lS=m.useMemo(()=>new Set(Object.values(Zv||{}).map(x=>String((x==null?void 0:x.runNodeId)||"").trim()).filter(Boolean)),[Zv]),Ti=m.useCallback(x=>{const S=Xc.current||{},_=typeof x=="function"?x(S):x,P=_&&typeof _=="object"&&!Array.isArray(_)?_:{};return Xc.current=P,JM(P),P},[]),cS=!!(o.flowId&&!o.archived&&(Zt!=null&&Zt.role?Zt.role==="owner":eu==="user"||eu==="workspace")),tu=!!(eu==="workspace"&&(Zt!=null&&Zt.role)&&Zt.role!=="owner"),uS={loading:"载入中",dirty:"有未同步修改",saving:"同步中",synced:"已同步",conflict:"同步冲突",error:"同步失败",readonly:"只读"}[sS]||"同步状态",gs=m.useCallback(()=>{!ne.current||!Ce||(rt.current=!1,te.current+=1,ue.current=!0,Ts("dirty"),Ms("本地修改等待同步"))},[Ce]);m.useEffect(()=>{o.flowId&&OD(o.flowId,o.flowSource||"user","workspace",!!o.archived)},[o]),m.useEffect(()=>{const x=()=>{u(new URLSearchParams(window.location.search).get("view")==="display"?"display":"workspace")};return window.addEventListener("popstate",x),()=>window.removeEventListener("popstate",x)},[]),m.useEffect(()=>{cl([]),Bn([]),ms("workspace"),kg(!0)},[o]);const jn=m.useCallback(async()=>{const x=Ir(o),S=await fetch(`/api/workspace/files?${x.toString()}`),_=await S.json();if(!S.ok)throw new Error(_.error||"读取 workspace 失败");const P=_.files||[];uo(P),ol(new Set(CT(P))),AM(_.root||"")},[o]),wf=m.useCallback(async()=>{dn(!0),Sn("");try{const x=await fetch("/api/marketplace/flow-snippets"),S=await x.json().catch(()=>({}));if(!x.ok)throw new Error(S.error||"读取流程片段失败");Tt(Array.isArray(S.snippets)?S.snippets:[])}catch(x){Sn(String(x.message||x)),Tt([])}finally{dn(!1)}},[]),dS=m.useCallback(async(x,S,_)=>{var G,le,xe;if(!ne.current)return;if(!Ce)throw ge("Readonly workspace"),Ts("readonly"),Ms("只读 Project"),new Error("Readonly workspace");Ts("saving"),Ms("正在同步修改");const P=El(x,S,$.current);P.ui={...P.ui||{},displayPage:aC(A.current,x)};const O=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,graph:P,baseRevision:X.current,baseGraph:re.current,clientId:oe.current})}),U=await O.json().catch(()=>({}));if(!O.ok){if(O.status===409||O.status===428){const _e=Array.isArray(U.conflictItems)?U.conflictItems:[];sl({currentRevision:String(U.currentRevision||""),message:U.error||"Workspace 已被其他成员更新",conflictPaths:Array.isArray(U.conflictPaths)?U.conflictPaths:[],conflictItems:_e,mergeGraph:U.mergeGraph||null,currentGraph:U.currentGraph||null}),il(Object.fromEntries(_e.map((We,Re)=>[String(Re),{mode:"local",manual:Su(We)}]))),Wc(""),ia(_e.length>0),Ts("conflict"),Ms(U.error||"存在需要处理的字段冲突");const Oe=Array.isArray(U.conflictPaths)?U.conflictPaths:[],De=Oe.length?`${U.error||"Workspace 已被其他成员更新"}:${Oe.join("、")}`:U.error||"Workspace 已被其他成员更新",He=new Error(De);throw He.code="WORKSPACE_REVISION_CONFLICT",He.currentRevision=U.currentRevision||"",He}const me=new Error(U.error||"保存 workspace graph 失败");throw Ts("error"),Ms(me.message),me}const J=te.current!==_,Y=kU({savedGraph:U.graph,sentGraph:P,savedRevision:U.revision,currentRevision:X.current});if(X.current=Y.revision,re.current=Y.graph,!J){if($.current=((G=U.graph)==null?void 0:G.instances)||P.instances,V($.current),U.merged&&U.graph){const me=vu(U.graph,tt),_e=nh((xe=(le=U.graph)==null?void 0:le.ui)==null?void 0:xe.displayPage,me.nodes);$.current=me.instances,V(me.instances),k(me.nodes),y(me.edges),A.current=_e,j(_e)}ue.current=!1}return ua(Sp(U.workspaceSchedules||[])),sl(null),ia(!1),Ts(J?"dirty":"synced"),Ms(J?"本地仍有修改等待同步":"所有修改已同步"),ge(J?"已保存上一版,本地新修改正在排队":U.merged?"Workspace graph merged and saved":"Workspace graph saved"),U},[o,tt,y,k,Ce]),Yt=m.useCallback((x=g,S=b)=>{const _=ie.current,P={nextNodes:x,nextEdges:S,saveEditVersion:te.current,waiters:[]},O=new Promise((Y,G)=>{P.waiters.push({resolve:Y,reject:G})});if(_.running)return _.pending=Y1(_.pending,P),O;_.running=!0;const U=async()=>{let Y=P;for(;Y;){_.pending&&(Y=Y1(Y,_.pending),_.pending=null);try{const G=await dS(Y.nextNodes,Y.nextEdges,Y.saveEditVersion);Y.waiters.forEach(({resolve:le})=>le(G))}catch(G){(G==null?void 0:G.code)!=="WORKSPACE_REVISION_CONFLICT"&&(Ts("error"),Ms(String(G.message||G))),Y.waiters.forEach(({reject:le})=>le(G)),(G==null?void 0:G.code)==="WORKSPACE_REVISION_CONFLICT"&&_.pending&&(_.pending.waiters.forEach(({reject:le})=>le(G)),_.pending=null)}Y=_.pending,_.pending=null}_.running=!1},J=Z.current.catch(()=>{}).then(U);return Z.current=J,O},[b,g,dS]),XM=m.useCallback(x=>{var _;const S=(_=x==null?void 0:x.extra)!=null&&_.instances&&typeof x.extra.instances=="object"?x.extra.instances:{};$.current=S,V(S),k(Array.isArray(x==null?void 0:x.nodes)?x.nodes:[]),y(Array.isArray(x==null?void 0:x.edges)?x.edges:[]),he(""),E(null)},[y,k]),QM=m.useMemo(()=>({instances:Q}),[Q]),ZM=lU({nodes:g,edges:b,extra:QM,enabled:ne.current,onRestore:XM}),{resetHistory:nu,undo:fS,redo:pS}=ZM,ys=m.useCallback(async(x={})=>{var Te,It;const S=(x==null?void 0:x.background)===!0,_=fe.current+1;fe.current=_;const P=te.current,O=X.current;S||(ne.current=!1);const U=SU({background:S}),J=Ir(o);let Y=null,G;if(!U.nodes&&!U.files)G=await fetch(`/api/workspace/graph?${J.toString()}`);else{const Le=Ir(o);Le.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const[ut,Ct]=await Promise.all([fetch(`/api/nodes?${Le.toString()}`),fetch(`/api/workspace/graph?${J.toString()}`),jn()]);if(Y=await ut.json(),!ut.ok)throw new Error(Y.error||"读取节点定义失败");G=Ct}const le=await G.json();if(!G.ok)throw new Error(le.error||"读取 workspace graph 失败");const xe=bU({background:S,requestId:_,currentRequestId:fe.current,dirty:ue.current,startedEditVersion:P,currentEditVersion:te.current,startedRevision:O,currentRevision:X.current});if(xe==="superseded")return{skipped:!0,reason:xe};if(xe==="local-edits")return ge("检测到远端更新;本地修改将在保存时自动合并"),{skipped:!0,reason:xe};const me=S?st.current:[...(Array.isArray(Y)?Y:Y.nodes||[]).filter(Le=>!CU.has(Le.id)),RU,IU,AU,PU,_U,EU];S||(st.current=me,Jt(me));const _e=le.graph||JSON.parse(localStorage.getItem(jU)||"null")||{},Oe=vu(_e,me),De=nh((Te=_e==null?void 0:_e.ui)==null?void 0:Te.displayPage,Oe.nodes),He=!W.current;let We=B.current;if(He){let Le=null;try{Le=JSON.parse(window.localStorage.getItem(l)||"null")}catch{Le=null}We=Qx(Le)||Qx((It=_e==null?void 0:_e.ui)==null?void 0:It.viewport)}const Re=S?gU(re.current,_e):null;if(S&&(Re!=null&&Re.safe)){const Le=Re.nodesChanged?yU(v.current,Oe.nodes,Re.changedNodeIds):v.current,ut=Re.edgesChanged?wU(w.current,Oe.edges):w.current,Ct=Re.displayPageChanged||!Gi(A.current,De),kl=Re.nodesChanged||Re.edgesChanged||Ct;if(kl&&(rt.current=!0),Re.nodesChanged){const ii=xU($.current,Oe.instances,Re.changedNodeIds);$.current=ii,v.current=Le,V(ii),k(Le)}if(Re.edgesChanged&&(w.current=ut,y(ut)),Ct&&(A.current=De,j(De)),kl&&nu(Le,ut,{instances:Re.nodesChanged?$.current:Oe.instances}),Re.nodesChanged||Ct){const ii=new Set(De.nodeIds);T(pa=>{const ha=pa.filter(Mf=>ii.has(Mf));return ha.length===pa.length?pa:ha})}}else $.current=Oe.instances,v.current=Oe.nodes,w.current=Oe.edges,A.current=De,rt.current=!0,V(Oe.instances),k(Oe.nodes),y(Oe.edges),j(De),T([]),nu(Oe.nodes,Oe.edges,{instances:Oe.instances});const Lt=Sp(le.workspaceSchedules||[]);ua(Le=>Gi(Le,Lt)?Le:Lt),X.current=String(le.revision||""),re.current=_e,ue.current=!1;const it=le.collaboration||null;sg(Le=>Gi(Le,it)?Le:it),sl(null),He&&(D(We),B.current=We,W.current=!0);const Ye=le.writable!==!1;return PM(Ye),ge(Ye?"Workspace ready":"Readonly workspace"),Ts(Ye?"synced":"readonly"),Ms(Ye?"所有修改已同步":"只读 Project"),ne.current=!0,{skipped:!1}},[o,t.language,jn,nu,y,k,l]),Cg=m.useCallback((x={})=>{if(!ne.current)return;const S=String(x.revision||""),_=x.type==="graph.committed",P=!!(be.current||qe.current||Ue.current);if(NU({eventType:x.type,revision:S,currentRevision:X.current,targetRevision:Me.current,refreshPending:P}))return;if(_&&S&&(Me.current=S),ue.current){Ue.current=!1,ge("检测到其他成员的更新;保存时将自动合并");return}if(Ue.current=!0,be.current||qe.current)return;const O=async()=>{if(be.current=null,ue.current){Ue.current=!1,ge("检测到其他成员的更新;保存时将自动合并");return}Ue.current=!1,qe.current=!0;try{await ys({background:!0}),Me.current=X.current}catch(U){Me.current="",ge(String(U.message||U))}finally{qe.current=!1,Ue.current&&!ue.current&&(be.current=window.setTimeout(O,40))}};be.current=window.setTimeout(O,40)},[ys]),xf=m.useCallback(async(x=dr)=>{const S=String(x||"").trim();Lv(!0),ll("");try{const _=Ir(o);_.set("tapdId",S),_.set("runtimeOnly","1");const P=await fetch(`/api/prd-workflow/snapshot?${_.toString()}`),O=await P.json().catch(()=>({}));if(!P.ok)throw new Error(O.error||"读取 PRD Workflow 失败");ff(O.snapshot||null),pf(""),hf(null),Uc(null);try{const U=`agentflow.workflow.tapdId:${o.flowSource||"user"}:${o.flowId||""}`;S?window.localStorage.setItem(U,S):window.localStorage.removeItem(U)}catch{}}catch(_){ll(String(_.message||_))}finally{Lv(!1)}},[o,dr]),ml=m.useCallback(async(x=null,S={})=>{const _=x&&typeof x=="object"?x:en==null?void 0:en.nextAction,P=Od(_);if(!P||pg)return;const O=(S==null?void 0:S.confirm)===!0,U=String((S==null?void 0:S.expectedRevision)||(en==null?void 0:en.revision)||"");Ov(!0),ll(""),O||(pf(""),hf(null),Uc(null));try{const J=await fetch("/api/prd-workflow/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,tapdId:dr,action:P,stage:Ja(_),title:Ji(_,0),...cY(_),dryRun:!O,confirm:O,issueKey:_.issueKey||_.issue_key||"",expectedRevision:U,idempotencyKey:`workflow-${Date.now()}-${Math.random().toString(36).slice(2)}`})}),Y=await J.json().catch(()=>({}));if(!J.ok||Y.ok===!1)throw Y.snapshot&&ff(Y.snapshot),Y.conflict&&Uc({...Y.conflict,action:_}),new Error(Y.error||"执行 PRD Workflow action 失败");pf(Y.rawOutput||(Y.output?JSON.stringify(Y.output,null,2):"")),ff(Y.snapshot||en),Uc(null),hf(O?null:{action:_,output:Y.output||null,expectedRevision:U,at:new Date().toISOString()})}catch(J){ll(String(J.message||J))}finally{Ov(!1)}},[o,pg,en,dr]),e$=m.useCallback((x=null)=>ml(x,{confirm:!1}),[ml]),t$=m.useCallback(()=>{const x=(hs==null?void 0:hs.action)||(en==null?void 0:en.nextAction);return ml(x,{confirm:!0,expectedRevision:(hs==null?void 0:hs.expectedRevision)||""})},[ml,hs,en]),n$=m.useCallback(()=>{const x=(qc==null?void 0:qc.action)||(en==null?void 0:en.nextAction);return Uc(null),ml(x,{confirm:!1})},[ml,qc,en]),r$=m.useCallback(async()=>{var U;const x=String(hg||(en==null?void 0:en.rawOutput)||"").trim();if(!x||mg)return;const S=(hs==null?void 0:hs.action)||(en==null?void 0:en.nextAction)||{},_=`Review: ${Ji(S,0)||(en==null?void 0:en.pointer)||dr||"PRD Workflow"}`,P=/^[\[{]/.test(x),O=x.startsWith("#")?x:`# ${_}
|
|
246
|
-
|
|
247
|
-
${P?`\`\`\`json
|
|
248
|
-
${x}
|
|
249
|
-
\`\`\``:x}`;Dv(!0),ll("");try{const J=await fetch("/api/prd-workflow/review-link",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,tapdId:dr,title:_,markdown:O,action:Od(S),stage:Ja(S),issueKey:S.issueKey||S.issue_key||"",artifactLabel:"临时 Review"})}),Y=await J.json().catch(()=>({}));if(!J.ok||Y.ok===!1)throw new Error(Y.error||"生成 Review 链接失败");ff(Y.snapshot||en);const G=((U=Y.review)==null?void 0:U.url)||"";G&&pf(le=>`${le||x}
|
|
250
|
-
|
|
251
|
-
Review link: ${G}`)}catch(J){ll(String(J.message||J))}finally{Dv(!1)}},[o,hg,hs,mg,en,dr]),s$=m.useCallback(async(x,S)=>{const _={packageId:(x==null?void 0:x.newId)||(x==null?void 0:x.id)||(x==null?void 0:x.label),label:(x==null?void 0:x.label)||(x==null?void 0:x.newId)||(x==null?void 0:x.id),version:"1.0.0",definitionId:S,body:(x==null?void 0:x.body)||"",script:(x==null?void 0:x.script)||"",scriptRef:(x==null?void 0:x.scriptRef)||"",implementationRef:(x==null?void 0:x.implementationRef)||"",implementationMode:(x==null?void 0:x.implementationMode)||"",inputs:Array.isArray(x==null?void 0:x.inputs)?x.inputs:[],outputs:Array.isArray(x==null?void 0:x.outputs)?x.outputs:[],flowId:o.flowId,flowSource:o.flowSource||"user",archived:!!o.archived},P=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_)}),O=await P.json().catch(()=>({}));if(!P.ok||(O==null?void 0:O.ok)===!1)throw new Error((O==null?void 0:O.error)||"Publish failed");return await ys(),ge(`Published node ${O.definitionId||O.id||_.packageId}`),O},[o,ys]),da=m.useCallback((x=Rs)=>{const S=Array.isArray(x)?x:[],P=[...S].reverse().find(O=>(O==null?void 0:O.status)==="running"||(O==null?void 0:O.status)==="stopping")||[...S].reverse().find(O=>O==null?void 0:O.id);return String((P==null?void 0:P.id)||"workspace")},[Rs]),i$=m.useCallback(x=>{const S=String(x||"").trim();!S||S==="workspace"||Bn(_=>{const P=(Array.isArray(_)?_:[]).filter(O=>O.id!==S);return ms(O=>O===S?da(P):O),P})},[da]);m.useCallback((x="")=>{ul(!0),dl(null),Be(null),ms(x||da())},[da]);const hS=m.useCallback((x={})=>{dl({scheduleNodeId:String(x.scheduleNodeId||""),runNodeId:String(x.runNodeId||x.nodeId||""),lastRunId:String(x.lastRunId||""),label:String(x.label||"")}),ul(!1),Be(null),he("")},[]),_g=m.useCallback(async(x="")=>{const S=String(x||"").trim();if(!(!S||!Ce)){rS(S),ge(`Optimizing run: ${S}`);try{await Yt(v.current,w.current);const _=El(v.current,w.current,$.current),P=kC(v.current,$.current,S,Ii),O=await fetch("/api/workspace/run/optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,runNodeId:S,graph:_,model:P})}),U=await O.json().catch(()=>({}));if(!O.ok||U.ok===!1)throw new Error(U.error||"优化失败");const J=U.graph||_,Y=vu(J,tt);$.current=Y.instances,V(Y.instances),k(Y.nodes),y(Y.edges),ua(Sp(U.workspaceSchedules||[])),nu(Y.nodes,Y.edges,{instances:Y.instances});const G=Array.isArray(U.optimized)?U.optimized.length:0;ge(G>0?`已生成 ${G} 个 implementation`:"没有需要优化的节点")}catch(_){ge(String(_.message||_))}finally{rS("")}}},[Ii,w,o,v,tt,nu,Yt,y,k,Ce]),mS=m.useCallback(async(x="")=>{const S=String(x||"").trim(),_=Xc.current||{},P=Object.entries(_).find(([G,le])=>G===S||String((le==null?void 0:le.runNodeId)||"")===S)||Object.entries(_)[0]||null,O=(P==null?void 0:P[0])||"",U=(P==null?void 0:P[1])||null,J=String((U==null?void 0:U.runNodeId)||S||"").trim();if((U==null?void 0:U.status)==="stopping")return;const Y=new Set([J,...Array.isArray(U==null?void 0:U.plannedNodeIds)?U.plannedNodeIds:[]].map(G=>String(G||"").trim()).filter(Boolean));O&&Ti(G=>{const le={...G};return le[O]&&(le[O]={...le[O],status:"stopping"}),le}),ge(J?`Stopping Workspace run: ${J}...`:"Stopping Workspace run..."),Bn(G=>G.map(le=>(O?le.id===O:!J||le.runNodeId===J)&&le.status==="running"?{...le,status:"stopping"}:le));try{const G=await fetch("/api/workspace/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,runId:O,runNodeId:J})}),le=await G.json().catch(()=>({}));if(!G.ok||(le==null?void 0:le.stopped)!==!0)throw new Error(le.error||"Workspace run stop failed");const xe=O?Qc.current.get(O):null;xe&&(xe.abort(),Qc.current.delete(O)),O&&Ti(me=>{const _e={...me};return delete _e[O],_e}),pl(me=>{const _e=new Set(me);for(const Oe of Y)_e.delete(Oe);return _e}),hl(me=>{var Oe;const _e={...me};for(const De of Y)De&&(!_e[De]||((Oe=_e[De])==null?void 0:Oe.status)==="running")&&(_e[De]={status:"stopped"});return _e}),ge(J?`Workspace run stopped: ${J}`:"Workspace run stopped"),Bn(me=>me.map(_e=>(O?_e.id===O:!J||_e.runNodeId===J)?{..._e,status:"stopped",endedAt:Date.now(),messages:[...Array.isArray(_e.messages)?_e.messages:[],{role:"assistant",kind:"status",text:"Workspace run stopped.",at:Date.now()}].slice(-160)}:_e))}catch(G){O&&Ti(xe=>{const me={...xe};return me[O]&&(me[O]={...me[O],status:"running"}),me});const le=String((G==null?void 0:G.message)||G||"Workspace run stop failed");ge(`停止失败:${le}`),Bn(xe=>xe.map(me=>(O?me.id===O:!J||me.runNodeId===J)?{...me,status:"running",messages:[...Array.isArray(me.messages)?me.messages:[],{role:"assistant",kind:"error",error:!0,text:`停止失败:${le}`,at:Date.now()}].slice(-160)}:me))}},[o,Ti]),bf=m.useCallback(async()=>{if(o.flowId)try{const x=Ir(o),S=await fetch(`/api/workspace/run/status?${x.toString()}`),_=await S.json().catch(()=>({}));if(!S.ok||!_.running)return;const P=Array.isArray(_.runs)&&_.runs.length?_.runs:[{runId:`run-restored-${_.startedAt||Date.now()}`,runNodeId:_.runNodeId||"",startedAt:_.startedAt||Date.now(),plannedNodeIds:[]}],O={},U=[];for(const J of P){const Y=String((J==null?void 0:J.runNodeId)||"").trim(),G=String((J==null?void 0:J.runId)||`run-restored-${(J==null?void 0:J.startedAt)||Date.now()}-${Y}`).trim();if(!G)continue;const le=String((J==null?void 0:J.label)||"").trim()||Ky(v.current,$.current,Y,"Workspace Run");O[G]={id:G,runNodeId:Y,label:le,status:(J==null?void 0:J.state)==="stopping"?"stopping":"running",plannedNodeIds:Array.isArray(J==null?void 0:J.plannedNodeIds)?J.plannedNodeIds:[],startedAt:(J==null?void 0:J.startedAt)||Date.now()},Y&&U.push(Y)}if(!Object.keys(O).length)return;Ti(J=>({...J,...O})),pl(J=>{const Y=new Set(J);for(const G of U)Y.add(G);return Y}),hl(J=>{const Y={...J};for(const G of U)Y[G]={status:"running"};return Y}),ge(U.length?`Workspace run still running: ${U.join(", ")}`:"Workspace run still running"),Bn(J=>{const Y=[...J];for(const[G,le]of Object.entries(O)){if(Y.some(_e=>_e.id===G||["running","stopping"].includes(_e.status)&&_e.runNodeId===le.runNodeId))continue;const xe=String(le.runNodeId||""),me=String(le.label||"").trim()||Ky(v.current,$.current,xe,"Workspace Run");Y.push({id:G,label:qy(me,xe,"Workspace Run"),alias:me,runNodeId:xe,status:le.status,startedAt:le.startedAt||Date.now(),steps:xe?[{id:xe,label:qy(me,xe,"Workspace Run"),status:"running"}]:[],messages:[{role:"assistant",kind:"run-summary",text:le.status==="stopping"?"Workspace run is stopping in the background.":"Workspace run is still running in the background.",at:Date.now()}]})}return[...Y.slice(-8)]})}catch{}},[o,v,Ti]),gS=m.useCallback(async x=>{if(!Ce){ge("Readonly workspace");return}if(!x)return;if(Object.values(Xc.current||{}).find(it=>String((it==null?void 0:it.runNodeId)||"")===String(x||""))){ge(`Workspace run already running: ${x}`);return}let _=v.current,P=w.current,O=$.current;const U=In.current;if(U!=null&&U.id){const it=_.find(Te=>Te.id===U.id),Ye=SC({nodes:_,edges:P,instances:O,selectedNode:it,draft:U,allowRename:!1});if(Ye!=null&&Ye.error){Ut(Ye.error),ge(Ye.error);return}Ye!=null&&Ye.ok&&Ye.changed&&(_=Ye.nodes,P=Ye.edges,O=Ye.instances,$.current=O,v.current=_,w.current=P,V(O),k(_),y(P),po(Ye.nextId||U.id))}const J=El(_,P,O),Y=`run-${Date.now()}-${String(x).replace(/[^a-z0-9_-]+/gi,"_")}`,G=Ky(_,O,x,"Workspace Run"),le=qy(G,x,"Workspace Run");let xe=[x];try{const it=await fetch("/api/workspace/run/plan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,graph:J,runNodeId:x})}),Ye=await it.json().catch(()=>({}));if(!it.ok||(Ye==null?void 0:Ye.ok)===!1)throw new Error(Ye.error||"Workspace run plan failed");xe=Array.isArray(Ye.plannedNodeIds)&&Ye.plannedNodeIds.length?Ye.plannedNodeIds.map(It=>String(It||"").trim()).filter(Boolean):[x],xe=Array.from(new Set([x,...xe].filter(Boolean)));const Te=Ye.conflict||null;if(Te!=null&&Te.runNodeId||Te!=null&&Te.runId){const It=Array.isArray(Te.conflictNodeIds)&&Te.conflictNodeIds.length?`: ${Te.conflictNodeIds.join(", ")}`:"";ge(`Run ${x} conflicts with running ${Te.runNodeId||Te.runId}${It}`);return}}catch(it){ge(String(it.message||it));return}const me=new Set(xe),_e=Object.values(Xc.current||{}).find(it=>(Array.isArray(it==null?void 0:it.plannedNodeIds)?it.plannedNodeIds:[]).some(Ye=>me.has(String(Ye||"").trim())));if(_e){const it=(Array.isArray(_e.plannedNodeIds)?_e.plannedNodeIds:[]).map(Ye=>String(Ye||"").trim()).filter(Ye=>Ye&&me.has(Ye));ge(`Run ${x} conflicts with running ${_e.runNodeId||"workspace run"}${it.length?`: ${it.join(", ")}`:""}`);return}const Oe=new AbortController;Qc.current.set(Y,Oe),Zc.current.delete(Y),Ti(it=>({...it,[Y]:{id:Y,runNodeId:x,label:G,plannedNodeIds:xe,startedAt:Date.now()}})),pl(it=>new Set([...it,x])),hl(it=>({...it,[x]:{status:"running"}})),ge(`Running ${le}...`),ms(Y),Bn(it=>[...it.slice(-7),{id:Y,label:le,alias:G,runNodeId:x,status:"running",startedAt:Date.now(),steps:[],messages:[{role:"assistant",kind:"run-summary",text:"准备运行...",at:Date.now()}]}]);let De=x;const He=new Map,We=()=>Zc.current.has(Y),Re=it=>{const Ye=new Set((it||[]).map(Te=>String(Te||"").trim()).filter(Boolean));Ye.size||Ye.add(String(x||"")),pl(Te=>{const It=new Set(Te);for(const Le of Ye)It.delete(Le);return It})},Lt=(it,Ye)=>{const Te=new Set((it||[]).map(It=>String(It||"").trim()).filter(Boolean));Te.size||Te.add(String(x||"")),hl(It=>{var ut;const Le={...It};for(const Ct of Te)Ct&&(!Le[Ct]||((ut=Le[Ct])==null?void 0:ut.status)==="running")&&(Le[Ct]={status:Ye});return Le})};try{await Yt(_,P);const it=kC(_,O,x,Ii),Ye=await fetch("/api/workspace/run",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},signal:Oe.signal,body:JSON.stringify({...o,graph:J,runNodeId:x,runAlias:G,runSessionId:Y,expectedRevision:X.current,clientId:oe.current,model:it,selectedSkills:Is,stream:!0})});if(!Ye.ok){const ye=await Ye.json().catch(()=>({}));throw new Error(ye.error||"Workspace run failed")}if(!Ye.body)throw new Error("Workspace run stream unavailable");const Te=Ye.body.getReader(),It=new TextDecoder;let Le="",ut=[],Ct=[];const kl=(ye,nt)=>{var at,Nt;const Ge=g.find($t=>$t.id===ye),ft=String(((at=Ge==null?void 0:Ge.data)==null?void 0:at.label)||ye||"").trim(),we=String(nt||((Nt=Ge==null?void 0:Ge.data)==null?void 0:Nt.definitionId)||"").trim();return we&&we!==ft?`${ft} (${we})`:ft},ii=(ye,nt,Ge)=>{const ft=String(ye||"").trim();ft&&Bn(we=>we.map(at=>{if(at.id!==Y)return at;const $t=[...Array.isArray(at.steps)?at.steps:[]],pt=$t.findIndex(an=>an.id===ft),kt={id:ft,label:kl(ft,nt),status:Ge};pt>=0?$t[pt]={...$t[pt],...kt}:$t.push(kt);const sn=$t.map((an,yo)=>{const Li=an.status==="done"?"[done]":an.status==="failed"?"[failed]":"[running]";return`${yo+1}. ${Li} ${an.label}`}).join(`
|
|
252
|
-
`),Ht=Array.isArray(at.messages)?at.messages:[],Xt=Ht.findIndex(an=>an.kind==="run-summary"),hn={role:"assistant",kind:"run-summary",text:sn||"准备运行...",at:Date.now()},Ot=[...Ht];return Xt>=0?Ot[Xt]=hn:Ot.unshift(hn),{...at,steps:$t,messages:Ot.slice(-160)}}))},pa=(ye,nt)=>{var s0,i0,o0,a0,l0,c0,u0,d0,f0,p0;const Ge=String(ye||"").trim(),ft=String(nt||"").trim();if(!Ge||!ft)return;const we=(s0=$.current)==null?void 0:s0[Ge];if(!Js(we==null?void 0:we.definitionId))return;const at=Jo(we==null?void 0:we.input,"displayType","markdown"),Nt=IT(at),$t=RT(Ge),pt=tt.find(Pr=>Pr.id===Nt),kt=yC(pt==null?void 0:pt.inputs,Nt,ft),sn=yC(pt==null?void 0:pt.outputs,Nt,ft),Ht=String((we==null?void 0:we.label)||Ge||"一键任务").trim(),Xt={...$.current||{},[Ge]:{...we||{},output:xC(we==null?void 0:we.output)},[$t]:{...((i0=$.current)==null?void 0:i0[$t])||{},definitionId:Nt,label:Ht,role:"normal",body:ft,input:kt,output:sn,sourceContextRunNodeId:Ge,displayReloadKey:String(Date.now())}};$.current=Xt,V(Xt);const hn=v.current||[],Ot=hn.find(Pr=>Pr.id===Ge),an=hn.find(Pr=>Pr.id===$t),yo=Number(((o0=Ot==null?void 0:Ot.measured)==null?void 0:o0.width)||(Ot==null?void 0:Ot.width)||((l0=(a0=Ot==null?void 0:Ot.data)==null?void 0:a0.nodeSize)==null?void 0:l0.width)||520),Li=(an==null?void 0:an.position)||{x:Number(((c0=Ot==null?void 0:Ot.position)==null?void 0:c0.x)||0)+yo+120,y:Number(((u0=Ot==null?void 0:Ot.position)==null?void 0:u0.y)||0)},nr=((d0=an==null?void 0:an.data)==null?void 0:d0.displaySize)||((f0=an==null?void 0:an.data)==null?void 0:f0.nodeSize)||{width:qx,height:Ux},oi=Vx({id:$t,type:lc,position:Li,width:Number(nr.width)||qx,height:Number(nr.height)||Ux,data:{label:Ht,definitionId:Nt,role:"normal",body:ft,inputs:kt,outputs:sn,sourceContextRunNodeId:Ge,displayReloadKey:Xt[$t].displayReloadKey,nodeSize:nr,displaySize:nr}},Xt,tt),wo=hn.map(Pr=>{if(Pr.id===Ge){const{width:vle,height:Sle,measured:Nle,...s2}=Pr,{nodeSize:jle,displaySize:Cle,...Ff}=Pr.data||{};return{...s2,data:{...Ff,outputs:xC(Ff==null?void 0:Ff.outputs),contextRunResultNonce:Date.now()}}}return Pr.id===$t?{...oi,selected:Pr.selected}:Pr});an||wo.push(oi),v.current=wo,k(wo);const xo=w.current||[],Df=TT(Nt),Bg=wC((we==null?void 0:we.output)||((p0=Ot==null?void 0:Ot.data)==null?void 0:p0.outputs),"output",["content","result"],["text"]),n2=wC(kt,"input",[Df,"content"],["text"]),r2={id:`we-${Ge}-${$t}`,source:Ge,target:$t,sourceHandle:Bg,targetHandle:n2,markerEnd:{type:gi.ArrowClosed}},r0=[...xo.filter(Pr=>!(Pr.source===Ge&&Pr.target===$t)),r2];w.current=r0,y(r0),window.requestAnimationFrame(()=>{s(Ge),s($t)})},ha=(ye,nt=null)=>{const Ge=ye!=null&&ye.instances&&typeof ye.instances=="object"?ye.instances:{},ft=nt instanceof Set?nt:null;for(const[we,at]of Object.entries(Ge)){if(ft&&!ft.has(we)||!Js(at==null?void 0:at.definitionId))continue;const Nt=Jm({outputs:at.output});Nt&&pa(we,Nt)}},Mf=ye=>{const nt=String(ye||"").trim();if(!nt)return;const Ge=De;De=nt,pl(ft=>{const we=new Set(ft);return Ge&&Ge!==nt&&Ge!==x&&we.delete(Ge),x&&we.add(x),we.add(nt),we}),hl(ft=>{var we;return{...ft,...Ge&&Ge!==nt&&Ge!==x&&((we=ft[Ge])==null?void 0:we.status)==="running"?{[Ge]:{status:"success"}}:{},...x?{[x]:{status:"running"}}:{},[nt]:{status:"running"}}})},e0=ye=>{const nt=String(ye||"").trim();nt&&(pl(Ge=>{const ft=new Set(Ge);return ft.delete(nt),ft}),hl(Ge=>({...Ge,[nt]:{status:"success"}})))},t0=(ye,nt)=>{const Ge=String(nt||"");if(!Ge.trim())return;const ft=["assistant","thinking","result","error","prompt"].includes(ye)?ye:"assistant";Bn(we=>we.map(at=>{if(at.id!==Y)return at;let Nt=Array.isArray(at.messages)?at.messages:[];if(ft==="result"){const kt=[...Nt].reverse().find(sn=>sn.kind==="assistant");if(String((kt==null?void 0:kt.text)||"").trim()===Ge.trim())return at}if(ft==="assistant"){const kt=Nt.findIndex(sn=>sn.kind==="result"&&String(sn.text||"").trim()===Ge.trim());kt>=0&&(Nt=Nt.filter((sn,Ht)=>Ht!==kt))}const $t=[...Nt],pt=$t[$t.length-1];return pt&&pt.kind===ft&&!pt.error?$t[$t.length-1]={...pt,text:`${pt.text||""}${pt.text?`
|
|
253
|
-
`:""}${Ge}`}:$t.push({role:"assistant",kind:ft,text:Ge,...ft==="error"?{error:!0}:{},at:Date.now()}),{...at,messages:$t.slice(-160)}}))},$f=ye=>{const nt=String(ye||"");nt.trim()&&Bn(Ge=>Ge.map(ft=>{var $t;if(ft.id!==Y)return ft;const we=Array.isArray(ft.messages)?ft.messages:[],at=we.findIndex(pt=>pt.kind==="thinking"),Nt=[...we];if(at>=0){const pt=String((($t=Nt[at])==null?void 0:$t.text)||"");Nt[at]={...Nt[at],text:`${pt}${pt&&!pt.endsWith(`
|
|
254
|
-
`),""}${nt}`,at:Date.now()}}else{const pt=Nt.findIndex(kt=>kt.kind==="activity");Nt.splice(pt>=0?pt+1:Nt.length,0,{role:"assistant",kind:"thinking",text:nt,at:Date.now()})}return{...ft,messages:Nt.slice(-160)}}))},go=(ye,nt=null)=>{const Ge=KU(ye);Ge&&Bn(ft=>ft.map(we=>{if(we.id!==Y)return we;const at=Number(nt==null?void 0:nt.ts)||Date.now(),Nt=Number(we.startedAt)||at,$t=Number(we.lastActivityAt)||Nt,pt=Math.max(0,at-$t),kt=Number.isFinite(Number(nt==null?void 0:nt.runElapsedMs))?Math.max(0,Number(nt.runElapsedMs)):Math.max(0,at-Nt),sn=Array.isArray(we.activities)?we.activities:[],Ht=sn[sn.length-1],hn=(typeof Ht=="string"?Ht:String((Ht==null?void 0:Ht.text)||""))===Ge?sn:[...sn,{text:Ge,kind:UU(Ge),stepMs:pt,totalMs:kt,at}].slice(-30),Ot=Array.isArray(we.timingEntries)?we.timingEntries:[],an=Array.isArray(we.messages)?we.messages:[],yo=an.findIndex(oi=>oi.kind==="activity"),Li={role:"assistant",kind:"activity",text:eC(hn,Ot,Nt,at),at:Date.now()},nr=[...an];if(yo>=0)nr[yo]=Li;else{const oi=nr.findIndex(wo=>wo.kind==="run-summary");nr.splice(oi>=0?oi+1:0,0,Li)}return{...we,activities:hn,lastActivityAt:at,messages:nr.slice(-160)}}))},n0=ye=>{const nt=String((ye==null?void 0:ye.source)||"runner"),Ge=String((ye==null?void 0:ye.stream)||""),ft=String((ye==null?void 0:ye.eventType)||"event"),we=String((ye==null?void 0:ye.text)||"").trim();if(!we)return;const at=`[${nt}${Ge?`:${Ge}`:""}] ${ft}
|
|
255
|
-
${we}`,Nt=jY(ye);Bn($t=>$t.map(pt=>{if(pt.id!==Y)return pt;const sn=[...Array.isArray(pt.rawTrace)?pt.rawTrace:[],at].slice(-80),Ht=Array.isArray(pt.timingEntries)?pt.timingEntries:[],Xt=Nt?[...Ht,Nt].slice(-80):Ht,hn=Array.isArray(pt.activities)?pt.activities:[],Ot=Number(pt.startedAt)||Number(ye==null?void 0:ye.ts)||Date.now(),an=Number(Nt==null?void 0:Nt.at)||Number(ye==null?void 0:ye.ts)||Date.now(),yo=Array.isArray(pt.messages)?pt.messages:[],Li={role:"assistant",kind:"raw",text:sn.join(`
|
|
256
|
-
|
|
257
|
-
---
|
|
258
|
-
|
|
259
|
-
`),at:Date.now()},nr=[...yo],oi=nr.findIndex(xo=>xo.kind==="activity");if(Nt){const xo={role:"assistant",kind:"activity",text:eC(hn,Xt,Ot,an),at:Date.now()};if(oi>=0)nr[oi]=xo;else{const Df=nr.findIndex(Bg=>Bg.kind==="run-summary");nr.splice(Df>=0?Df+1:0,0,xo)}}const wo=nr.findIndex(xo=>xo.kind==="raw");return wo>=0?nr[wo]=Li:nr.push(Li),{...pt,rawTrace:sn,timingEntries:Xt,messages:nr.slice(-160)}}))},t2=ye=>{Bn(nt=>nt.map(Ge=>Ge.id===Y?{...Ge,status:ye,endedAt:Date.now()}:Ge))},Lf=ye=>{const nt=new Set,Ge=String((ye==null?void 0:ye.nodeId)||"").trim();Ge&&nt.add(Ge);for(const ft of Array.isArray(ye==null?void 0:ye.displayNodeIds)?ye.displayNodeIds:[]){const we=String(ft||"").trim();we&&nt.add(we)}for(const ft of Array.isArray(ye==null?void 0:ye.touchedNodeIds)?ye.touchedNodeIds:[]){const we=String(ft||"").trim();we&&nt.add(we)}if(nt.size===0)for(const ft of Array.isArray(ye==null?void 0:ye.order)?ye.order:[]){const we=String(ft||"").trim();we&&nt.add(we)}return nt},Of=(ye,nt=null)=>{const Ge=vu(ye||J,tt),ft=new Map(Ge.nodes.map(pt=>[pt.id,pt])),we=Ge.instances||{},at=nt instanceof Set?nt:null,Nt=(pt,kt)=>{const sn={...pt||kt};Array.isArray(kt==null?void 0:kt.output)&&(sn.output=kt.output);for(const Ht of["scriptRef","implementationRef","implementationMode"])(kt==null?void 0:kt[Ht])!=null&&String(kt[Ht]).trim()!==""&&(sn[Ht]=kt[Ht]);return sn},$t=(pt,kt)=>{const sn={...pt||{}};Array.isArray(kt==null?void 0:kt.outputs)&&(sn.outputs=kt.outputs);for(const Ht of["scriptRef","implementationRef","implementationMode"])(kt==null?void 0:kt[Ht])!=null&&String(kt[Ht]).trim()!==""&&(sn[Ht]=kt[Ht]);return sn};k(pt=>{const kt=new Set(pt.map(Xt=>Xt.id)),Ht={...El(pt,w.current,$.current).instances||{}};for(const[Xt,hn]of Object.entries(we)){if(at&&!at.has(Xt)||!kt.has(Xt))continue;const Ot=Ht[Xt];Xa((hn==null?void 0:hn.definitionId)||(Ot==null?void 0:Ot.definitionId))?Ht[Xt]=hn:Array.isArray(hn==null?void 0:hn.output)&&(Ht[Xt]=Nt(Ot,hn))}return $.current=Ht,V(Ht),pt.map(Xt=>{var Ot,an;if(at&&!at.has(Xt.id))return Xt;const hn=ft.get(Xt.id);return hn?Xa(((Ot=hn.data)==null?void 0:Ot.definitionId)||((an=Xt.data)==null?void 0:an.definitionId))?{...Xt,data:{...Xt.data,...hn.data}}:{...Xt,data:$t(Xt.data,hn.data)}:Xt})})};for(;;){const{value:ye,done:nt}=await Te.read();if(nt)break;Le+=It.decode(ye,{stream:!0});const Ge=Le.split(`
|
|
260
|
-
`);Le=Ge.pop()||"";for(const ft of Ge){if(!ft.trim())continue;const we=JSON.parse(ft);if(we.type==="error")throw new Error(we.error||"Workspace run failed");if(we.type==="stopped"){Zc.current.add(Y),ut=Array.isArray(we.order)?we.order:ut,go("运行停止",we);continue}if(we.type==="node-start"&&(ge(`Running ${we.nodeId}...`),Mf(we.nodeId),ii(we.nodeId,we.definitionId,"running")),we.type==="node-done"){const at=He.get(String(we.nodeId||"").trim());at&&pa(we.nodeId,at),e0(we.nodeId),ii(we.nodeId,we.definitionId,"done")}if(we.type==="status"&&go(we.line||we.message||"",we),we.type==="paused"&&(Ct=Array.isArray(we.nodeIds)?we.nodeIds:[],go("运行暂停",we)),we.type==="natural"&&((we.kind==="result"||/---agentflow\b|resultFile\s*:|\"resultFile\"\s*:|\"result\"\s*:/i.test(String(we.text||"")))&&we.nodeId&&He.set(String(we.nodeId||"").trim(),String(we.text||"")),we.kind==="thinking"?$f(we.text||""):t0(we.kind,we.text||"")),we.type==="raw"){const at=tC(we);at&&$f(at),n0(we)}if(we.type==="graph"&&we.graph){const at=Lf(we);Of(we.graph,at),ha(we.graph,at)}if(we.type==="done"){if(we.revision&&(X.current=String(we.revision)),we.graph){re.current=we.graph;const at=Lf(we);Of(we.graph,at),ha(we.graph,at)}ut=Array.isArray(we.order)?we.order:[],Ct=Array.isArray(we.pauseNodeIds)?we.pauseNodeIds:Ct,go(Ct.length?"运行暂停":"运行完成",we)}}}if(Le.trim()){const ye=JSON.parse(Le);if(ye.type==="error")throw new Error(ye.error||"Workspace run failed");if(ye.type==="stopped"&&(Zc.current.add(Y),go("运行停止",ye)),ye.type==="node-start"&&(ge(`Running ${ye.nodeId}...`),Mf(ye.nodeId),ii(ye.nodeId,ye.definitionId,"running")),ye.type==="node-done"){const nt=He.get(String(ye.nodeId||"").trim());nt&&pa(ye.nodeId,nt),e0(ye.nodeId),ii(ye.nodeId,ye.definitionId,"done")}if(ye.type==="status"&&go(ye.line||ye.message||"",ye),ye.type==="paused"&&(Ct=Array.isArray(ye.nodeIds)?ye.nodeIds:[],go("运行暂停",ye)),ye.type==="natural"&&((ye.kind==="result"||/---agentflow\b|resultFile\s*:|\"resultFile\"\s*:|\"result\"\s*:/i.test(String(ye.text||"")))&&ye.nodeId&&He.set(String(ye.nodeId||"").trim(),String(ye.text||"")),ye.kind==="thinking"?$f(ye.text||""):t0(ye.kind,ye.text||"")),ye.type==="raw"){const nt=tC(ye);nt&&$f(nt),n0(ye)}if(ye.type==="graph"&&ye.graph){const nt=Lf(ye);Of(ye.graph,nt),ha(ye.graph,nt)}if(ye.type==="done"){if(ye.revision&&(X.current=String(ye.revision)),ye.graph){re.current=ye.graph;const nt=Lf(ye);Of(ye.graph,nt),ha(ye.graph,nt)}ut=Array.isArray(ye.order)?ye.order:[],Ct=Array.isArray(ye.pauseNodeIds)?ye.pauseNodeIds:Ct,go(Ct.length?"运行暂停":"运行完成",ye)}}We()&&(Re(xe),Lt(xe,"stopped"));const zg=We()?`Workspace run stopped: ${x}`:Ct.length?`Workspace run paused at ${Ct.join(", ")}`:`Workspace run done: ${ut.length?ut.join(" -> "):x}`;if(ge(zg),We()||Lt(xe,Ct.length?"paused":"success"),t2(We()?"stopped":Ct.length?"paused":"done"),!We()){try{await Yt(v.current,w.current),ge(zg)}catch(ye){ge(`${zg},但保存结果失败:${String(ye.message||ye)}`)}await jn()}}catch(it){if(We()||(it==null?void 0:it.name)==="AbortError"){Re(xe),Lt(xe,"stopped"),ge(`Workspace run stopped: ${x}`),Bn(Ye=>Ye.map(Te=>Te.id===Y?{...Te,status:"stopped",endedAt:Date.now()}:Te));return}Re(xe),Lt([x,De].filter(Boolean),"failed"),ge(String(it.message||it)),Bn(Ye=>Ye.map(Te=>Te.id===Y?{...Te,status:"failed",endedAt:Date.now(),messages:[...Array.isArray(Te.messages)?Te.messages:[],{role:"assistant",error:!0,text:String(it.message||it),at:Date.now()}].slice(-160)}:Te))}finally{Qc.current.get(Y)===Oe&&Qc.current.delete(Y),Ti(it=>{const Ye={...it};return delete Ye[Y],Ye}),Zc.current.delete(Y),Re(xe)}},[Ii,b,o,jn,g,tt,po,Yt,Is,y,k,Ti,s,Ce]),kf=m.useCallback(async()=>{try{const S=await(await fetch("/api/skills")).json().catch(()=>({})),_=Array.isArray(S.skills)?S.skills.map(P=>({key:String(P.key),name:String(P.name||P.id||P.key),description:P.description?String(P.description):"",sourceLabel:P.sourceLabel?String(P.sourceLabel):""})):[];FM(_),Pv(!0)}catch{Pv(!0)}},[]),vf=m.useCallback(async()=>{try{const S=await(await fetch("/api/mcps")).json().catch(()=>({})),_=Array.isArray(S.servers)?S.servers.map(P=>({name:String((P==null?void 0:P.name)||""),type:String((P==null?void 0:P.type)||""),url:String((P==null?void 0:P.url)||""),command:String((P==null?void 0:P.command)||""),args:Array.isArray(P==null?void 0:P.args)?P.args.map(String):[],description:String((P==null?void 0:P.description)||"")})).filter(P=>P.name):[];Tv(_)}catch{Tv([])}},[]),Sf=m.useCallback(async()=>{try{const x=Ir(o),_=await(await fetch(`/api/workspaces?${x.toString()}`)).json().catch(()=>({})),P=Array.isArray(_.workspaces)?_.workspaces.map(O=>({id:String((O==null?void 0:O.id)||""),label:String((O==null?void 0:O.label)||(O==null?void 0:O.name)||"知识库"),path:String((O==null?void 0:O.path)||""),kind:(O==null?void 0:O.kind)==="git"?"git":"local",repoUrl:String((O==null?void 0:O.repoUrl)||""),branch:String((O==null?void 0:O.branch)||""),mountPath:String((O==null?void 0:O.mountPath)||""),type:String((O==null?void 0:O.type)||""),builtin:(O==null?void 0:O.builtin)===!0,exists:(O==null?void 0:O.exists)!==!1})).filter(O=>O.path):[];$v(P)}catch{$v([])}},[o]),yS=m.useCallback(async()=>{je.current=!1;try{const x=Ir(o),S=await fetch(`/api/workspace/conversations?${x.toString()}`),_=await S.json().catch(()=>({}));if(!S.ok)throw new Error(_.error||`HTTP ${S.status}`);const P=J1(_.conversations||{});cl(P.composer.messages),Bn(P.composer.runSessions),ms(P.composer.activeSessionId||"workspace"),ho(P.nodeChats)}catch{cl([]),Bn([]),ms("workspace"),ho({})}finally{je.current=!0}},[o]),wS=m.useCallback(async()=>{if(!Ce||o.archived)return;const x=J1({composer:{activeSessionId:Dr,messages:la,runSessions:Rs},nodeChats:ca});await fetch("/api/workspace/conversations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,conversations:x})}).then(async S=>{if(!S.ok){const _=await S.json().catch(()=>({}));throw new Error(_.error||`HTTP ${S.status}`)}})},[Dr,la,Rs,o,ca,Ce]);m.useEffect(()=>{let x=!1;return(async()=>{const _=new URL(window.location.href),P=String(_.searchParams.get("invite")||"").trim();if(P){ge("正在加入共享 Workspace...");const O=await fetch("/api/workspace/collaboration/accept",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:P})}),U=await O.json().catch(()=>({}));if(!O.ok)throw new Error(U.error||"加入共享 Workspace 失败");_.searchParams.delete("invite"),window.history.replaceState({},"",`${_.pathname}${_.search}${_.hash}`)}x||(await ys(),x||await yS())})().catch(_=>{const P=String(_.message||_);ge(P),Ts("error"),Ms(P)}),wf(),fetch("/api/model-lists").then(_=>_.json()).then(_=>OM({cursor:Array.isArray(_.cursor)?_.cursor.map(String):[],opencode:Array.isArray(_.opencode)?_.opencode.map(String):[],claudeCode:Array.isArray(_.claudeCode)?_.claudeCode.map(String):[],codex:Array.isArray(_.codex)?_.codex.map(String):[]})).catch(()=>{}),kf(),vf(),Sf(),bf(),fetch("/api/skill-collections").then(_=>_.json()).then(_=>{zM(Ia(_)),BM(!0)}).catch(()=>{}),fetch("/api/auth/me").then(_=>_.json()).then(_=>{Yv(_.user||null),Jv(!0)}).catch(()=>{Yv(null),Jv(!0)}),()=>{x=!0}},[ys,yS,wf,vf,kf,bf,Sf,Ri]),m.useEffect(()=>{if(aS(""),!(!Av||!Iv)){if(!Ri){Kc([]);return}Kc(GD(Ri,"workspace",Ps,al)),aS(Ri)}},[al,Iv,Ps,Av,Ri]),m.useEffect(()=>{if(!(oS!==Ri||!Ri))try{localStorage.setItem(Ri,JSON.stringify(Is))}catch{}},[Is,Ri,oS]),m.useEffect(()=>{$.current=Q},[Q]),m.useEffect(()=>{v.current=g},[g]),m.useEffect(()=>{const x=M.current,S=new Map,_=[];for(const J of g){const Y=pT(J);S.set(J.id,Y),x.get(J.id)!==Y&&_.push(J.id)}if(M.current=S,_.length===0)return;const P=()=>_.forEach(J=>s(J)),O=window.requestAnimationFrame(P),U=window.setTimeout(P,80);return()=>{window.cancelAnimationFrame(O),window.clearTimeout(U)}},[g,s]),m.useEffect(()=>{w.current=b},[b]),m.useEffect(()=>{A.current=N},[N]),m.useEffect(()=>{B.current=I},[I]),m.useEffect(()=>{In.current=pe},[pe]),m.useEffect(()=>{$e.current=K},[K]),m.useEffect(()=>{R.current=z},[z]),m.useEffect(()=>{if(!z)return;const x=_=>{_.key==="Escape"&&E(null)},S=_=>{var P,O;(O=(P=_.target)==null?void 0:P.closest)!=null&&O.call(P,".af-connect-node-menu")||E(null)};return document.addEventListener("keydown",x),document.addEventListener("pointerdown",S),()=>{document.removeEventListener("keydown",x),document.removeEventListener("pointerdown",S)}},[z]),m.useEffect(()=>{if(!ne.current||!Ce)return;if(gt.current){ce.current&&window.clearTimeout(ce.current);return}if(rt.current){rt.current=!1;return}gs(),ce.current&&window.clearTimeout(ce.current);const x=bt.current?0:650;return bt.current=!1,ce.current=window.setTimeout(()=>{Yt().catch(S=>ge(String(S.message||S)))},x),()=>{ce.current&&window.clearTimeout(ce.current)}},[g,b,N,gs,Yt,Ce]),m.useEffect(()=>{if(je.current&&!(!Ce||o.archived))return Ve.current&&window.clearTimeout(Ve.current),Ve.current=window.setTimeout(()=>{wS().catch(x=>ge(String(x.message||x)))},900),()=>{Ve.current&&window.clearTimeout(Ve.current)}},[Dr,la,Rs,o.archived,ca,wS,Ce]);const ru=m.useMemo(()=>g.filter(x=>{var S;return((S=x==null?void 0:x.data)==null?void 0:S.definitionId)==="workspace_scheduled_run"}).map(x=>{var S;return{id:x.id,config:ev(((S=x.data)==null?void 0:S.body)||"")}}),[g]),o$=m.useMemo(()=>ru.map(x=>`${x.id}:${x.config.enabled?"1":"0"}:${x.config.cron}:${x.config.timezone}`).join("|"),[ru]);m.useEffect(()=>{if(!ne.current||c!=="workspace"||!o.flowId){ua({});return}if(!ru.length){ua({});return}let x=!1;const S=async()=>{try{const P=Ir(o),O=await fetch(`/api/workspace/schedules?${P.toString()}`),U=await O.json().catch(()=>({}));if(!O.ok)throw new Error(U.error||"读取 Workspace 定时状态失败");x||ua(Sp(U.schedules||[]))}catch{x||ua(P=>{var U;const O={};for(const J of ru)O[J.id]={...P[J.id]||{},lastStatus:((U=P[J.id])==null?void 0:U.lastStatus)||"unknown"};return O})}};S();const _=window.setInterval(S,5e3);return()=>{x=!0,window.clearInterval(_)}},[o,ru,o$,c]);const xS=m.useCallback((x,S)=>{if(!Ce){ge("Readonly workspace");return}const _=gC(S),P=G=>Array.isArray(G)?G.map(le=>(le==null?void 0:le.name)!=="skillKeys"&&(le==null?void 0:le.name)!=="skillsContext"&&(le==null?void 0:le.type)!=="text"?le:{...le,default:_,value:_}):[],O=g.map(G=>{var le;return G.id!==x?G:{...G,data:{...G.data,body:_,inputs:P((le=G.data)==null?void 0:le.inputs)}}}),U=$.current||{},J=U[x]&&typeof U[x]=="object"?U[x]:{},Y={...U,[x]:{...J,body:_,input:P(J.input)}};$.current=Y,k(O),V(Y),Be(G=>!G||G.id!==x?G:{...G,body:_,inputs:P(G.inputs)}),Yt(O,b).catch(G=>ge(String(G.message||G)))},[b,g,Yt,k,Ce]),bS=m.useCallback((x,S)=>{if(!Ce){ge("Readonly workspace");return}const _=TG(S),P=G=>Array.isArray(G)?G.map(le=>(le==null?void 0:le.name)!=="serverNames"&&(le==null?void 0:le.name)!=="mcpContext"&&(le==null?void 0:le.type)!=="text"?le:{...le,default:_,value:_}):[],O=g.map(G=>{var le;return G.id!==x?G:{...G,data:{...G.data,body:_,inputs:P((le=G.data)==null?void 0:le.inputs)}}}),U=$.current||{},J=U[x]&&typeof U[x]=="object"?U[x]:{},Y={...U,[x]:{...J,body:_,input:P(J.input)}};$.current=Y,k(O),V(Y),Be(G=>!G||G.id!==x?G:{...G,body:_,inputs:P(G.inputs)}),Yt(O,b).catch(G=>ge(String(G.message||G)))},[b,g,Yt,k,Ce]),kS=m.useCallback((x,S)=>{if(!Ce){ge("Readonly workspace");return}const _=(Array.isArray(S)?S:S?[S]:[]).filter(De=>String((De==null?void 0:De.path)||"").trim()),P=_[0]||null,O=String((P==null?void 0:P.path)||"").trim(),U=_.length===1?String((P==null?void 0:P.label)||(P==null?void 0:P.id)||"知识库").trim():_.length?`${_.length} 个知识库`:"",J=_.length?JSON.stringify(Xm(_)):"",Y=P?JSON.stringify({version:1,id:(P==null?void 0:P.id)||"",label:String((P==null?void 0:P.label)||(P==null?void 0:P.id)||"知识库").trim(),kind:(P==null?void 0:P.kind)||"local",cwd:O,workspaceRoot:O,repoUrl:(P==null?void 0:P.repoUrl)||"",branch:(P==null?void 0:P.branch)||"",mountPath:(P==null?void 0:P.mountPath)||"",type:(P==null?void 0:P.type)||""}):"",G=De=>Array.isArray(De)?De.map(He=>(He==null?void 0:He.name)==="path"?{...He,default:O,value:O}:(He==null?void 0:He.name)==="label"?{...He,default:U,value:U}:(He==null?void 0:He.name)==="knowledgeContext"?{...He,default:J,value:J}:(He==null?void 0:He.name)==="workspaceContext"?{...He,default:Y,value:Y}:(He==null?void 0:He.name)==="mode"?{...He,default:"set",value:"set"}:He):[],le=De=>Array.isArray(De)?De.map(He=>(He==null?void 0:He.name)==="knowledgeContext"?{...He,default:J,value:J}:(He==null?void 0:He.name)==="workspaceContext"?{...He,default:Y,value:Y,showOnNode:!1}:(He==null?void 0:He.name)==="cwd"?{...He,default:O,value:O,showOnNode:!1}:He):[],xe=g.map(De=>{var He,We,Re;return De.id===x?{...De,data:{...De.data,label:((He=De.data)==null?void 0:He.label)||"加载知识库",inputs:G((We=De.data)==null?void 0:We.inputs),outputs:le((Re=De.data)==null?void 0:Re.outputs)}}:De}),me=$.current||{},_e=me[x]&&typeof me[x]=="object"?me[x]:{},Oe={...me,[x]:{..._e,label:_e.label||"加载知识库",input:G(_e.input),output:le(_e.output)}};$.current=Oe,k(xe),V(Oe),Be(De=>(De==null?void 0:De.id)===x?{...De,inputs:G(De.inputs),outputs:le(De.outputs)}:De),Yt(xe,b).catch(De=>ge(String(De.message||De)))},[b,g,Yt,k,Ce]),vS=m.useCallback((x,S)=>{if(!Ce){ge("Readonly workspace");return}const _=String(x||"");if(!_)return;const P=gC((S==null?void 0:S.skillKeys)||[]),O=sf((S==null?void 0:S.displayType)||"markdown"),U=String((S==null?void 0:S.model)||"").trim(),J=(S==null?void 0:S.includeWorkspaceContext)===!1?"false":"true",Y=S!=null&&S.workspaceContext&&typeof S.workspaceContext=="object"?JSON.stringify(S.workspaceContext):"",G=S!=null&&S.knowledgeContext&&typeof S.knowledgeContext=="object"?JSON.stringify(S.knowledgeContext):"",le=We=>Array.isArray(We)?We.map(Re=>(Re==null?void 0:Re.name)==="skillKeys"?{...Re,default:P,value:P}:(Re==null?void 0:Re.name)==="displayType"?{...Re,default:O,value:O}:(Re==null?void 0:Re.name)==="includeWorkspaceContext"?{...Re,default:J,value:J}:(Re==null?void 0:Re.name)==="knowledgeContext"?{...Re,default:G,value:G}:(Re==null?void 0:Re.name)==="workspaceContext"?{...Re,default:Y,value:Y}:Re):[],xe=We=>Array.isArray(We)?We.map(Re=>(Re==null?void 0:Re.name)==="displayType"?{...Re,default:O,value:O}:Re):[],me=String((S==null?void 0:S.task)??""),_e=g.map(We=>{var Re,Lt;return We.id===_?{...We,data:{...We.data,body:me,model:U,inputs:le((Re=We.data)==null?void 0:Re.inputs),outputs:xe((Lt=We.data)==null?void 0:Lt.outputs)}}:We}),Oe=$.current||{},De=Oe[_]&&typeof Oe[_]=="object"?Oe[_]:{},He={...Oe,[_]:{...De,body:me,model:U,input:le(De.input),output:xe(De.output)}};$.current=He,k(_e),V(He),Be(We=>(We==null?void 0:We.id)===_?{...We,body:me,model:U,inputs:le(We.inputs),outputs:xe(We.outputs)}:We),Yt(_e,b).catch(We=>ge(String(We.message||We)))},[b,g,Yt,k,Ce]),SS=m.useCallback((x,S)=>{if(!Ce){ge("Readonly workspace");return}const _=$Y(S),P=g.map(Y=>Y.id===x?{...Y,data:{...Y.data,body:_}}:Y),O=$.current||{},U=O[x]&&typeof O[x]=="object"?O[x]:{},J={...O,[x]:{...U,body:_}};$.current=J,k(P),V(J),Be(Y=>(Y==null?void 0:Y.id)===x?{...Y,body:_}:Y),Yt(P,b).catch(Y=>ge(String(Y.message||Y)))},[b,g,Yt,k,Ce]),NS=m.useCallback(x=>{const S=String(x||"").trim();S&&(Uv(_=>_===S?"":S),ho(_=>({..._,[S]:_[S]||{sessionId:`nodechat_${Date.now()}_${S.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[],draft:"",candidateContent:"",running:!1,error:""}})))},[]),jS=m.useCallback(()=>Uv(""),[]),CS=m.useCallback((x,S)=>{const _=String(x||"").trim();_&&ho(P=>({...P,[_]:{...P[_]||{sessionId:`nodechat_${Date.now()}_${_.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[]},draft:String(S||""),error:""}}))},[]),$s=m.useCallback((x,S,_="replace",P={})=>{var it,Ye;if(!Ce){ge("Readonly workspace");return}const O=String(x||"").trim();if(!O)return;const U=v.current.find(Te=>Te.id===O),J=Cn(U==null?void 0:U.data),Y=Js((it=U==null?void 0:U.data)==null?void 0:it.definitionId),G=Ni(S),le=J==="html"?$c(G):J==="react"?Ym(G):String(G||""),xe=U?Xi(U.data):"",me=_==="append"&&String(xe||"").trim()?`${String(xe).replace(/\s+$/g,"")}
|
|
261
|
-
|
|
262
|
-
${le.trim()}`:le,_e=J==="image"?"src":"content",Oe=P!=null&&P.reloadDisplay?Date.now():(Ye=U==null?void 0:U.data)==null?void 0:Ye.displayReloadKey,De=Te=>{let It=!1;return(Array.isArray(Te)?Te:[]).map(ut=>{const Ct=String((ut==null?void 0:ut.name)||""),kl=String((ut==null?void 0:ut.type)||"");return(Y?Ct===_e||Ct==="result"||Ct==="filePath":Ct===_e||Ct==="filePath"||kl==="text")?It?{...ut,default:"",value:""}:(It=!0,{...ut,default:me,value:me}):ut})},He=v.current.map(Te=>{var It,Le;return Te.id!==O?Te:{...Te,data:{...Te.data,body:Y?Te.data.body:me,...Oe?{displayReloadKey:Oe}:{},inputs:De((It=Te.data)==null?void 0:It.inputs),outputs:De((Le=Te.data)==null?void 0:Le.outputs)}}}),We=$.current||{},Re=We[O]&&typeof We[O]=="object"?We[O]:{},Lt={...We,[O]:{...Re,body:Y?Re.body:me,input:De(Re.input),output:De(Re.output)}};$.current=Lt,k(He),V(Lt),Be(Te=>(Te==null?void 0:Te.id)===O?{...Te,...Y?{}:{body:me}}:Te),(P==null?void 0:P.logChat)!==!1&&ho(Te=>{var It;return{...Te,[O]:{...Te[O]||{},candidateContent:"",messages:[...(It=Te[O])!=null&&It.messages&&Array.isArray(Te[O].messages)?Te[O].messages:[],{role:"assistant",text:_==="append"?"已追加到当前节点内容。":"已替换当前节点内容。",at:Date.now()}]}}}),Yt(He,w.current).catch(Te=>ge(String(Te.message||Te))),ge(String((P==null?void 0:P.statusMessage)||"")||(_==="append"?"已追加节点内容":"已替换节点内容"))},[Yt,k,Ce]),Nf=m.useCallback(async(x,S="")=>{if(!Ce)return ge("Readonly workspace"),"";if(!x)return"";try{const _=new FormData;_.set("file",x),_.set("dir",String(S||"")),o.flowId&&_.set("flowId",o.flowId),o.flowSource&&_.set("flowSource",o.flowSource),o.archived&&_.set("archived","1");const P=await fetch("/api/workspace/upload",{method:"POST",body:_}),O=await P.json().catch(()=>({}));if(!P.ok)throw new Error(O.error||"上传文件失败");const U=String(O.path||"").trim();if(!U)throw new Error("上传文件失败:未返回路径");return await jn(),ol(J=>{const Y=new Set(J);for(const G of Np(U))Y.delete(G);return Y}),ge(`已上传 ${U}`),U}catch(_){return ge(String(_.message||_)),""}},[o,jn,Ce]),jf=m.useCallback(async x=>Jh(x)?Nf(x,"img"):(ge("请选择图片文件"),""),[Nf]),_S=m.useCallback((x="")=>{var S;if(!Ce){ge("Readonly workspace");return}_v.current=String(x||""),(S=Cv.current)==null||S.click()},[Ce]),a$=m.useCallback(async x=>{const S=Array.from(x.target.files||[]);if(x.target.value="",!S.length)return;const _=_v.current||"";Nv(!0);try{let P="";for(const O of S){const U=await Nf(O,_);U&&(P=U)}S.length>1&&ge(`已上传 ${S.length} 个文件${P?`,最后一个:${P}`:""}`)}catch(P){ge(String(P.message||P))}finally{Nv(!1)}},[Nf]),ES=m.useCallback(async(x,S)=>{const _=String(x||"").trim();if(!_)return;const P=await jf(S);P&&$s(_,P,"replace",{logChat:!1,statusMessage:`已上传图片 ${P}`})},[$s,jf]),AS=m.useCallback(async(x,S=void 0)=>{var De,He;if(!Ce){ge("Readonly workspace");return}const _=String(x||"").trim();if(!_)return;const P=ca[_]||{},O=String(S!==void 0?S:P.draft||"").trim();if(!O||P.running)return;const U=v.current.find(We=>We.id===_);if(!U)return;const J=Cn(U.data)||"markdown",Y=Xi(U.data);let G=Go(Y,J),le=Ni(Y);if(G)try{le=await Qa(o,G)}catch(We){ge(String(We.message||We))}else if(J!=="image"&&String(le||"").trim()){const We=Ea(J,le);if(We){ge(`${We} 未进入微调。`);return}try{const Re=await Zx(o,hC(_,U.data),le);await jn(),$s(_,Re,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已将展示保存为 ${Re}`}),G=Re,le=""}catch(Re){ge(String(Re.message||Re));return}}const xe=XY(_,v.current,w.current),me={role:"user",text:O,at:Date.now()},_e=Array.isArray(P.messages)?P.messages:[],Oe=P.sessionId||`nodechat_${Date.now()}_${_.replace(/[^a-z0-9_-]+/gi,"_")}`;ho(We=>({...We,[_]:{...P,sessionId:Oe,messages:[..._e,me],draft:"",running:!0,error:""}}));try{const We=await fetch("/api/workspace/node-chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,sessionId:Oe,node:{id:_,label:((De=U.data)==null?void 0:De.label)||_,definitionId:((He=U.data)==null?void 0:He.definitionId)||""},nodeKind:J,currentContent:G?"":le,sourceContext:xe,targetFilePath:G,messages:_e,message:O,model:Ii})}),Re=await We.json().catch(()=>({}));if(!We.ok)throw new Error(Re.error||"节点微调失败");const Lt=String(Re.candidateContent||Re.reply||"").trim(),it=!!Re.directFileEdit,Ye=String(Re.artifactPath||G||"").trim();if(it&&Ye){const Te=Ea(J,Lt);if(Te)throw new Error(`${Te} 文件已由 agent 修改,请检查 ${Ye}。`);await jn(),$s(_,Ye,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已按微调描述更新 ${Ye}`})}else if(Lt){const Te=Ea(J,Lt);if(Te)throw new Error(`${Te} 已取消写入,避免覆盖当前展示文件。`);if(G){const It=await Zx(o,G,Lt);await jn(),$s(_,It,"replace",{logChat:!1,statusMessage:`已按微调描述更新 ${It}`})}else $s(_,Lt,"replace",{logChat:!1,statusMessage:"已按微调描述更新展示内容"})}ho(Te=>{var It;return{...Te,[_]:{...Te[_]||{},sessionId:String(Re.sessionId||Oe),running:!1,candidateContent:"",messages:[...(It=Te[_])!=null&&It.messages&&Array.isArray(Te[_].messages)?Te[_].messages:[..._e,me],{role:"assistant",text:Lt||it?Ye?`已更新文件 ${Ye}。`:"已按你的描述更新当前展示。":"没有生成可更新的内容。",at:Date.now()}]}}})}catch(We){const Re=String(We.message||We);ho(Lt=>({...Lt,[_]:{...Lt[_]||{},running:!1,error:Re}})),ge(Re)}},[Ii,o,jn,ca,$s,Ce]),PS=m.useCallback(async(x,S)=>{if(!Ce){ge("Readonly workspace");return}const _=Cn(S)||"markdown",P=Xi(S),O=Go(P,_);let U=Ni(P);if(O)try{U=await Qa(o,O)}catch(le){ge(String(le.message||le));return}if(!String(U||"").trim()){ge("展示节点没有可保存内容");return}const J=Ea(_,U);if(J){ge(`${J} 未保存文件。`);return}const Y=hC(x,S),G=window.prompt("保存到 workspace 相对路径",Y);if(G)try{const le=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,path:G,content:U})}),xe=await le.json().catch(()=>({}));if(!le.ok)throw new Error(xe.error||"保存文件失败");const me=xe.path||G,_e=Ir(o);_e.set("path",me);const Oe=await fetch(`/api/workspace/file?${_e.toString()}`);if(!Oe.ok){const De=await Oe.json().catch(()=>({}));throw new Error(De.error||`保存后读取失败:${me}`)}await jn(),uo(De=>NG(De,me,String(U||"").length)),ol(De=>{const He=new Set(De);for(const We of Np(me))He.delete(We);return He}),$s(x,me,"replace",{logChat:!1,statusMessage:`已保存并引用 ${me}`}),ge(`已保存 ${me}`)}catch(le){ge(String(le.message||le))}},[o,jn,$s,Ce]),IS=m.useCallback(x=>{var O,U;const S=String(x||"").trim();if(!S||zn)return;const _=v.current.find(J=>J.id===S);if(!_||!Cn(_==null?void 0:_.data)){ge("展示节点不可用");return}const P=String(((O=_.data)==null?void 0:O.label)||((U=_.data)==null?void 0:U.displayName)||S).trim()||"AgentFlow Display";fn(Jy({title:P,layout:"single",nodeIds:[S],mode:"single-node",sourceNodeId:S})),Gn(""),Fn(null),Yn(!0)},[zn]),Cf=m.useCallback((x,S)=>{const _=String(x||"");_&&Be(P=>{if(!P||P.id!==_)return P;const O=typeof S=="function"?S(P):S;return!O||typeof O!="object"?P:{...P,...O}})},[]),RS=m.useCallback((x,S)=>{const _=String(x||"");!_||!Ce||(k(P=>P.map(O=>{var J;if(O.id!==_)return O;const U=Array.isArray((J=O.data)==null?void 0:J.outputs)&&O.data.outputs.length?O.data.outputs.map((Y,G)=>G===0?{...Y,default:S,value:S}:Y):[{type:"file",name:"value",default:S,value:S}];return{...O,data:{...O.data,body:"",outputs:U}}})),Cf(_,P=>({body:"",outputs:Array.isArray(P==null?void 0:P.outputs)&&P.outputs.length?P.outputs.map((U,J)=>J===0?{...U,default:S,value:S}:U):[{type:"file",name:"value",default:S,value:S}]})),ge(`已选择文件 ${S}`))},[k,Cf,Ce]),TS=m.useCallback(x=>{dg({nodeId:String(x||""),query:""})},[]),Eg=m.useCallback(()=>{dg({nodeId:"",query:""})},[]),l$=m.useCallback(x=>{const S=String((x==null?void 0:x.path)||"").trim();!S||!Vc.nodeId||(RS(Vc.nodeId,S),Eg())},[Eg,Vc.nodeId,RS]),MS=m.useCallback(async(x,S)=>{if(!Ce)return;const _=pG(x,S);if(_.length===0)return;const P=[];try{for(const O of _){const U=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,path:O})});if(U.status===404)continue;const J=await U.json().catch(()=>({}));if(!U.ok)throw new Error(J.error||"清理节点输出失败");P.push(J.path||O)}if(P.length===0)return;ge(`已清理 ${P.join(", ")}`),await jn(),ug(O=>_.some(U=>O===U||O.startsWith(`${U}/`))?"":O)}catch(O){ge(String(O.message||O))}},[o,jn,Ce]),_f=m.useMemo(()=>({modelLists:oa,showBodyPreview:!0,flowParams:o,readOnly:!Ce,onRunWorkspaceNode:gS,onStopWorkspaceNode:mS,onOpenWorkspaceRunLogs:hS,onOptimizeWorkspaceRun:_g,onOptimizeWorkspaceSchedule:_g,runningRunNodeIds:lS,onChangeScheduledRunConfig:SS,onChangeContextRunConfig:vS,skills:Ps,skillCollections:al,onChangeLoadSkillKeys:xS,onRefreshSkills:kf,mcpServers:Rv,onChangeLoadMcpNames:bS,onRefreshMcps:vf,workspaceTargets:Mv,onChangeLoadWorkspace:kS,onRefreshWorkspaces:Sf,onSaveDisplayNodeToFile:PS,onShareDisplayNode:IS,onOpenDisplayPreview:se,onRefreshNodeInternals:po,onEnsureWorkspaceNodeDisplaySize:zv,sharingDisplayNodeId:zn,onUploadWorkspaceImage:jf,onUploadImageToDisplayNode:ES,onOpenProvideFilePicker:TS,onStatus:ge,onSetDisplayNodeContent:$s,onToggleNodeChat:NS,onCloseNodeChat:jS,onUpdateNodeChatDraft:CS,onSendNodeChat:AS,onSyncNodePropDraft:Cf,onCleanupWorkspaceNodeOutputs:MS}),[vS,bS,xS,kS,SS,MS,jS,zv,o,Rv,oa,TS,hS,_g,vf,po,kf,Sf,gS,lS,PS,AS,$s,IS,zn,al,Ps,mS,Cf,NS,CS,ES,jf,Mv,Ce]),c$=m.useRef(new Map),es=m.useMemo(()=>{const x=c$.current,S=new Set,_=g.map(P=>{var Y,G;const O={selected:P.selected===!0,isExecuting:tS.has(P.id),nodeStatus:((Y=jg[P.id])==null?void 0:Y.status)??null,nodeElapsed:((G=jg[P.id])==null?void 0:G.elapsed)??null,optimizingRun:nS===P.id,scheduledRunState:eS[P.id]||null,nodeChatActive:qv===P.id,nodeChat:ca[P.id]||null},U=x.get(P.id);if(U&&U.source===P&&U.commonData===_f&&BY(U.runtime,O))return S.add(P.id),U.node;const J={...P,data:{...P.data,..._f,...O}};return x.set(P.id,{source:P,commonData:_f,runtime:O,node:J}),S.add(P.id),J});for(const P of x.keys())S.has(P)||x.delete(P);return _},[qv,_f,ca,g,nS,eS,tS,jg]),Ag=m.useMemo(()=>new Map(es.map(x=>[x.id,x])),[es]),$S=As?Ag.get(As):null,su=m.useMemo(()=>{const x=new Set(F);return N.nodeIds.map((S,_)=>{const P=Ag.get(S);if(!P||!Cn(P.data))return null;const O=Tl(P)||{width:520,height:320},U=$a(N.nodeSizes[S]||O,{display:!0})||O,J=N.nodePositions[S]||{x:180+_*36,y:120+_*28};return{...P,id:oC(S),position:J,selected:x.has(S),width:U.width,height:U.height,data:{...P.data,sourceNodeId:S,displayPageMode:!0,readOnly:!0,selected:x.has(S),displaySize:U,nodeSize:U}}}).filter(Boolean)},[N,Ag,F]),gl=m.useMemo(()=>es.filter(x=>Cn(x==null?void 0:x.data)),[es]),ht=c==="display",$n=c==="workflow";m.useEffect(()=>{if(!ht||!N.viewport)return;const x=N.viewport,S=()=>{try{r.setViewport(x,{duration:0})}catch{}},_=window.requestAnimationFrame(()=>window.requestAnimationFrame(S));return()=>window.cancelAnimationFrame(_)},[N.viewport,ht,r]),m.useEffect(()=>{if(ht||$n||!I)return;const x=I,S=()=>{try{r.setViewport(x,{duration:0})}catch{}},_=window.requestAnimationFrame(()=>window.requestAnimationFrame(S));return()=>window.cancelAnimationFrame(_)},[ht,$n,r,I]),m.useEffect(()=>{$n&&xf(dr)},[$n]),m.useEffect(()=>{if(!$n||!dr)return;const x=Ir(o);x.set("tapdId",dr);const S=new EventSource(`/api/prd-workflow/events?${x.toString()}`);return S.onmessage=()=>{xf(dr)},S.onerror=()=>{S.close()},()=>S.close()},[o,$n,xf,dr]),m.useEffect(()=>{if(!o.flowId)return;const x=Ir(o);x.set("clientId",oe.current);const S=new EventSource(`/api/workspace/events?${x.toString()}`);return S.onmessage=_=>{let P=null;try{P=JSON.parse(_.data||"{}")}catch{P=null}if(!(!P||P.clientId===oe.current)){if(P.type==="graph.committed"){Cg(P);return}if(P.type==="runtime.committed"){Cg(P);return}if(String(P.type||"").startsWith("file.")){jn();return}String(P.type||"").startsWith("run.")&&bf()}},()=>{S.close(),be.current&&(window.clearTimeout(be.current),be.current=null),Ue.current=!1}},[o,jn,bf,Cg]),m.useEffect(()=>{const x=q.current,S=new Map,_=[];for(const J of[...es,...su]){const Y=zY(J);S.set(J.id,Y),x.get(J.id)!==Y&&_.push(J.id)}if(q.current=S,_.length===0)return;const P=()=>_.forEach(J=>s(J)),O=window.requestAnimationFrame(P),U=window.setTimeout(P,80);return()=>{window.cancelAnimationFrame(O),window.clearTimeout(U)}},[su,es,s]);const tn=m.useMemo(()=>g.find(x=>x.id===K)||null,[g,K]),Pg=m.useRef({id:"",draft:null}),u$=m.useMemo(()=>{const x=bC(tn);return x?JSON.stringify(x):""},[tn]);m.useEffect(()=>{if(!tn){Pg.current={id:"",draft:null},Be(null),Ut("");return}const x=bC(tn),S=Pg.current;Pg.current={id:tn.id,draft:x},Be(_=>!_||_.id!==tn.id||S.id!==tn.id||!S.draft?x:OG(_,S.draft,x)),Ut("")},[tn==null?void 0:tn.id,u$]);const Ig=m.useCallback((x=!1)=>{if(!pe||!tn)return!1;if(!Ce)return Ut("Readonly workspace"),ge("Readonly workspace"),!1;Ut("");const S=SC({nodes:g,edges:b,instances:$.current,selectedNode:tn,draft:pe,allowRename:x});return S!=null&&S.error?(Ut(S.error),!1):(!(S!=null&&S.ok)||!S.changed||($.current=S.instances,V(S.instances),k(S.nodes),y(S.edges),S.nextId!==tn.id&&he(S.nextId),po(S.nextId)),!0)},[b,pe,g,tn,y,k,po,Ce]);m.useEffect(()=>{if(!Ce||!pe||!tn)return;const x=window.setTimeout(()=>{Ig(!1)},350);return()=>window.clearTimeout(x)},[pe==null?void 0:pe.label,pe==null?void 0:pe.role,pe==null?void 0:pe.model,pe==null?void 0:pe.body,JSON.stringify((pe==null?void 0:pe.images)||[]),pe==null?void 0:pe.script,pe==null?void 0:pe.scriptRef,pe==null?void 0:pe.implementationRef,pe==null?void 0:pe.implementationMode,JSON.stringify((pe==null?void 0:pe.inputs)||[]),JSON.stringify((pe==null?void 0:pe.outputs)||[]),Ig,tn==null?void 0:tn.id,Ce]);const d$=m.useMemo(()=>{const x=new Map(es.map(S=>[S.id,S]));return b.map(S=>{var le,xe,me,_e;const _=x.get(S.source),P=x.get(S.target),O=/^output-(\d+)$/.exec(S.sourceHandle||""),U=/^input-(\d+)$/.exec(S.targetHandle||""),J=_&&O?(xe=(le=_.data)==null?void 0:le.outputs)==null?void 0:xe[parseInt(O[1],10)]:null,Y=P&&U?(_e=(me=P.data)==null?void 0:me.inputs)==null?void 0:_e[parseInt(U[1],10)]:null,G=J!=null&&J.type?En(J.type):Y!=null&&Y.type?En(Y.type):"";return G?{...S,style:{...S.style||{},stroke:G,strokeWidth:2},markerEnd:{type:gi.ArrowClosed,color:G}}:S})},[b,es]),f$=ht?su:es,p$=ht?[]:d$,h$=m.useMemo(()=>ht?su.map(x=>({...x,id:Yy(x.id)})):es,[su,es,ht]),Rg=m.useCallback(x=>{const S=String(x||"").trim();if(!S)return;const _=ht?oC(S):S;ht?T([S]):(k(O=>O.map(U=>({...U,selected:U.id===_}))),y(O=>O.map(U=>({...U,selected:!1}))),he(_));const P=()=>{var le,xe,me;const O=r.getNode(_);if(!O)return;const U=(le=r.getInternalNode)==null?void 0:le.call(r,_),J=((xe=U==null?void 0:U.measured)==null?void 0:xe.width)??(U==null?void 0:U.width)??O.width??260,Y=((me=U==null?void 0:U.measured)==null?void 0:me.height)??(U==null?void 0:U.height)??O.height??120,{zoom:G}=r.getViewport();r.setCenter(O.position.x+J/2,O.position.y+Y/2,{zoom:UY(G),duration:240})};window.requestAnimationFrame(()=>window.requestAnimationFrame(P))},[ht,r,y,k]);m.useEffect(()=>{const x=String(a.current||"").trim();!x||!ne.current||c!=="workspace"||es.some(S=>S.id===x)&&(a.current="",rt.current=!0,Rg(x))},[es,Rg,c]);const LS=m.useCallback(()=>{const x=r.getViewport(),S={x:Number(x.x)||0,y:Number(x.y)||0,zoom:Math.min(Math.max(Number(x.zoom)||1,.1),4)};if(ht){const _={...A.current,viewport:S};A.current=_,j(_),ge("已固定 Display 进入视角")}else{B.current=S,D(S);try{window.localStorage.setItem(l,JSON.stringify(S))}catch{}ge("已固定 Workspace 进入视角");return}Yt(v.current,w.current).catch(_=>ge(String(_.message||_)))},[ht,r,Yt,l]),Tg=m.useMemo(()=>{const x=de.trim().toLowerCase(),S={DISPLAY:[],CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const _ of tt)x&&![_.id,_.label,_.displayName,_.description].some(P=>String(P||"").toLowerCase().includes(x))||S[Mu(_)].push(_);for(const _ of Il)S[_].sort((P,O)=>P.id.localeCompare(O.id));return S},[tt,de]),iu=m.useMemo(()=>{const x=Mt.trim().toLowerCase();return tt.filter(S=>!x||[S.id,S.label,S.displayName,S.description].some(_=>String(_||"").toLowerCase().includes(x))).sort((S,_)=>{const P=Il.indexOf(Mu(S)),O=Il.indexOf(Mu(_));return P!==O?P-O:$u(S).localeCompare($u(_))}).slice(0,30)},[tt,Mt]),ou=m.useMemo(()=>{const x=Mt.trim().toLowerCase();return Se.filter(S=>!x||[S.id,S.version,S.displayName,S.name,S.description,...Array.isArray(S.tags)?S.tags:[]].some(_=>String(_||"").toLowerCase().includes(x))).sort((S,_)=>String(S.displayName||S.name||S.id).localeCompare(String(_.displayName||_.name||_.id))).slice(0,30)},[Se,Mt]);m.useEffect(()=>{Er(0)},[Mt,Ne,lt]),m.useEffect(()=>{if(!Ne)return;const x=window.setTimeout(()=>{var S;return(S=Wv.current)==null?void 0:S.focus()},0);return()=>window.clearTimeout(x)},[Ne]);const m$=m.useMemo(()=>{const x=lg.trim().toLowerCase();return x?tv(xr).filter(S=>S.path.toLowerCase().includes(x)):xr},[lg,xr]),fa=m.useMemo(()=>jT(xr,cg),[xr,cg]),Mi=(fa==null?void 0:fa.type)==="directory"?fa.path:bG((fa==null?void 0:fa.path)||""),g$=m.useCallback(x=>{var S,_;(_=(S=x.target)==null?void 0:S.closest)!=null&&_.call(S,".af-work-file")||ug("")},[]),y$=[...(oa.cursor||[]).map(x=>({label:`Cursor · ${x.split(" - ")[0]}`,value:`cursor:${x.split(" - ")[0]}`})),...(oa.opencode||[]).map(x=>({label:`OpenCode · ${x.split(" - ")[0]}`,value:`opencode:${x.split(" - ")[0]}`})),...(oa.claudeCode||[]).map(x=>({label:`Claude · ${x.split(" - ")[0]}`,value:`claude-code:${x.split(" - ")[0]}`})),...(oa.codex||[]).map(x=>({label:`Codex · ${x.split(" - ")[0]}`,value:`codex:${x.split(" - ")[0]}`}))],Mg=m.useMemo(()=>new Set(Is),[Is]),yl=m.useMemo(()=>{const x=new Map(Ps.map(U=>[U.key,U])),S=new Set,_=new Set,P=al.map(U=>{const J=Yo(U,Ps).map(Y=>x.get(Y)).filter(Boolean);for(const Y of J)S.add(Y.key),_.add(String(Y.name||Y.id||Y.key||"").trim());return{...U,skills:J}}).filter(U=>U.skills.length>0),O=Ps.filter(U=>{const J=String(U.name||U.id||U.key||"").trim();return!S.has(U.key)&&!_.has(J)});return{groups:P,ungrouped:O}},[al,Ps]);m.useEffect(()=>{Bv(x=>{let S=!1;const _=new Set(x);for(const P of yl.groups)_.has(P.id)||(_.add(P.id),S=!0);return S?_:x})},[yl.groups]);const Qn=m.useMemo(()=>{const x=g.filter(S=>S.selected);return x.length>0?x:K?g.filter(S=>S.id===K):[]},[g,K]),Ef=m.useMemo(()=>Qn.map(x=>x.id),[Qn]),OS=m.useCallback(()=>{if(ht)return;if(!Ce){ge("Readonly workspace");return}const x=(v.current||[]).filter(Y=>(Y==null?void 0:Y.selected)&&!td(Y));if(x.length<2){ge("选择至少两个节点后按 G 创建 Group");return}const S=x.reduce((Y,G)=>{var Oe,De,He,We,Re,Lt,it,Ye,Te,It,Le,ut;const le=Number(((Oe=G.position)==null?void 0:Oe.x)||0),xe=Number(((De=G.position)==null?void 0:De.y)||0),me=Number(((He=G.measured)==null?void 0:He.width)||G.width||((Re=(We=G.data)==null?void 0:We.nodeSize)==null?void 0:Re.width)||((it=(Lt=G.data)==null?void 0:Lt.displaySize)==null?void 0:it.width)||QR),_e=Number(((Ye=G.measured)==null?void 0:Ye.height)||G.height||((It=(Te=G.data)==null?void 0:Te.nodeSize)==null?void 0:It.height)||((ut=(Le=G.data)==null?void 0:Le.displaySize)==null?void 0:ut.height)||Gh);return{minX:Math.min(Y.minX,le),minY:Math.min(Y.minY,xe),maxX:Math.max(Y.maxX,le+me),maxY:Math.max(Y.maxY,xe+_e)}},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});if(!Number.isFinite(S.minX)||!Number.isFinite(S.minY))return;const _=new Set((v.current||[]).map(Y=>Y.id));let P=1,O=`group_${P}`;for(;_.has(O);)P+=1,O=`group_${P}`;const U=Xx({width:S.maxX-S.minX+kp*2,height:S.maxY-S.minY+kp*2})||{width:Ua,height:Ya},J={id:O,type:lc,position:{x:S.minX-kp,y:S.minY-kp},width:U.width,height:U.height,selected:!0,draggable:!0,selectable:!0,zIndex:0,data:{isWorkspaceGroup:!0,label:tm(P-1),title:tm(P-1),color:"purple",nodeSize:U}};k(Y=>[J,...Y.map(G=>({...G,selected:!1}))]),y(Y=>Y.map(G=>({...G,selected:!1}))),he(""),ge(`Created group for ${x.length} nodes`)},[ht,y,k,Ce]),au=m.useMemo(()=>g.filter(x=>Cn(x==null?void 0:x.data)),[g]),$g=m.useMemo(()=>Qn.filter(x=>Cn(x==null?void 0:x.data)).map(x=>x.id),[Qn]),w$=m.useMemo(()=>{const x=String((Ar==null?void 0:Ar.username)||(Ar==null?void 0:Ar.userId)||"").trim();return x?x.slice(0,1).toUpperCase():"?"},[Ar]),Lg=m.useMemo(()=>new Set(Ef),[Ef]),Af=m.useMemo(()=>b.filter(x=>Lg.has(x.source)&&Lg.has(x.target)),[b,Lg]),Og=m.useCallback(x=>{const S=x==="display"?"display":x==="workflow"?"workflow":"workspace";u(S),he(""),T([]),E(null),Pe(!1),Or(!1);const _=Ir(o);S==="display"&&_.set("view","display"),S==="workflow"&&(_.set("view","workflow"),dr.trim()&&_.set("tapdId",dr.trim()));const P=`/workspace${_.toString()?`?${_.toString()}`:""}`;window.history.pushState({},"",P)},[o,dr]),DS=m.useCallback(x=>{const S=String(x||"").trim();if(!S)return;const _=v.current.find(P=>P.id===S);if(!_||!Cn(_.data)){ge("展示节点不可用");return}j(P=>{if(P.nodeIds.includes(S))return P;const O=P.nodeIds.length,U=Tl(_);return{nodeIds:[...P.nodeIds,S],nodePositions:{...P.nodePositions,[S]:{x:180+O*36,y:120+O*28}},nodeSizes:{...P.nodeSizes,...U?{[S]:U}:{}}}}),T([S])},[]),FS=m.useCallback(x=>{const S=String(x||"").trim();S&&(j(_=>{const P=_.nodeIds.filter(J=>J!==S),O={..._.nodePositions},U={..._.nodeSizes};return delete O[S],delete U[S],{nodeIds:P,nodePositions:O,nodeSizes:U}}),T(_=>_.filter(P=>P!==S)))},[]),zS=m.useCallback(x=>{const S=String(x||"").trim();S&&(A.current.nodeIds.includes(S)?FS(S):DS(S))},[DS,FS]),Pf=m.useMemo(()=>{const x=si.trim().toLowerCase();return x?gl.filter(S=>{var _,P;return[S.id,(_=S.data)==null?void 0:_.label,(P=S.data)==null?void 0:P.definitionId].filter(Boolean).some(O=>String(O).toLowerCase().includes(x))}):gl},[gl,si]),BS=m.useMemo(()=>{const x=Pf.length,S=x<=1?1:x<=4?2:3,_=Array.from({length:S},()=>({height:0,nodes:[]}));for(const P of Pf){const O=Tl(P)||{width:420,height:260},U=Math.max(1,Number(O.width)||420),J=Math.max(1,Number(O.height)||260),Y=Math.min(26,Math.max(5.5,J/U*16))+3.2;let G=_[0];for(const le of _)le.height<G.height&&(G=le);G.nodes.push(P),G.height+=Y}return _.map(P=>P.nodes)},[Pf]),x$=m.useCallback(x=>{var U;const S=N.nodeIds.includes(x.id),_=Tl(x)||{width:420,height:260},P=Math.max(1,Math.round(Number(_.width)||420)),O=Math.max(1,Math.round(Number(_.height)||260));return i.jsxs("button",{type:"button",className:"af-display-picker-card"+(S?" af-display-picker-card--selected":""),style:{"--af-display-picker-card-ratio":`${P} / ${O}`},onClick:()=>zS(x.id),children:[i.jsx("span",{className:"af-display-picker-card__check","aria-hidden":!0,children:i.jsx("input",{type:"checkbox",checked:S,readOnly:!0,tabIndex:-1})}),i.jsx("span",{className:"af-display-picker-card__preview",children:i.jsx(lG,{node:x})}),i.jsxs("span",{className:"af-display-picker-card__meta",children:[i.jsx("strong",{children:((U=x.data)==null?void 0:U.label)||x.id}),i.jsxs("small",{children:[Cn(x.data)," · ",x.id]})]})]},x.id)},[N.nodeIds,zS]),HS=m.useMemo(()=>{const x=de.trim().toLowerCase();return x?Se.filter(S=>[S.id,S.version,S.displayName,S.name,S.description,...Array.isArray(S.tags)?S.tags:[]].filter(Boolean).some(_=>String(_).toLowerCase().includes(x))):Se},[Se,de]),WS=m.useCallback((x,S)=>{const _=String(x||"snippet_node").trim().replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"snippet_node";let P=`${_}_${Date.now().toString(36)}`,O=2;for(;S.has(P);)P=`${_}_${Date.now().toString(36)}_${O}`,O+=1;return S.add(P),P},[]),lu=m.useCallback((x,S)=>{var Te,It;if(!Ce){ge("Readonly workspace");return}const _=x!=null&&x.snippet&&typeof x.snippet=="object"?x.snippet:{},P=_.instances&&typeof _.instances=="object"?_.instances:{},O=Object.keys(P);if(O.length===0)return;const U=new Set(v.current.map(Le=>Le.id)),J={};for(const Le of O)J[Le]=WS(Le,U);const Y=(Te=_.ui)!=null&&Te.nodePositions&&typeof _.ui.nodePositions=="object"?_.ui.nodePositions:{},G=(It=_.ui)!=null&&It.nodeSizes&&typeof _.ui.nodeSizes=="object"?_.ui.nodeSizes:{},le=O.map(Le=>{const ut=Y[Le];return{id:Le,x:typeof(ut==null?void 0:ut.x)=="number"?ut.x:0,y:typeof(ut==null?void 0:ut.y)=="number"?ut.y:0}}),xe=Math.min(...le.map(Le=>Le.x)),me=Math.min(...le.map(Le=>Le.y));let _e=S||{x:360+v.current.length*24,y:180+v.current.length*18};if(!S){const Le=document.querySelector(".af-workspace-canvas .react-flow");if(Le){const ut=Le.getBoundingClientRect();_e=r.screenToFlowPosition({x:ut.left+ut.width*.48,y:ut.top+ut.height*.32})}}const Oe={},De={},He={};for(const Le of le){const ut=J[Le.id];Oe[ut]={...P[Le.id]||{}},De[ut]={x:_e.x+(Le.x-xe),y:_e.y+(Le.y-me)};const Ct=G[Le.id];typeof(Ct==null?void 0:Ct.width)=="number"&&typeof(Ct==null?void 0:Ct.height)=="number"&&(He[ut]={width:Ct.width,height:Ct.height})}const We=new Set(O),Re=(Array.isArray(_.edges)?_.edges:[]).filter(Le=>We.has(Le==null?void 0:Le.source)&&We.has(Le==null?void 0:Le.target)).map(Le=>({source:J[Le.source],target:J[Le.target],sourceHandle:Le.sourceHandle??null,targetHandle:Le.targetHandle??null})),Lt=vu({instances:Oe,edges:Re,ui:{nodePositions:De,nodeSizes:He}},tt),it=Lt.nodes.map(Le=>Le.id),Ye=Lt.nodes.map(Le=>({...Le,selected:!0}));$.current={...$.current,...Lt.instances},V($.current),k(Le=>[...Le.map(ut=>({...ut,selected:!1})),...Ye]),y(Le=>[...Le.map(ut=>({...ut,selected:!1})),...Lt.edges.map(ut=>({...ut,selected:!1}))]),he(""),T([]),ge(`已添加流程片段:${x.displayName||x.id}(已选中 ${it.length} 个节点)`)},[WS,tt,r,y,k,Ce]),b$=m.useCallback(()=>{var _,P;if(Qn.length<2){Sn("请先在 workspace 画布上选择至少两个节点。"),Ze("flows");return}const x=Qn[0],S=Qn.length===2?`${((_=x.data)==null?void 0:_.label)||x.id} 片段`:`${((P=x.data)==null?void 0:P.label)||x.id} 等 ${Qn.length} 个节点`;Je({name:S,id:S.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),rn(""),Ie(!0),Ze("flows")},[Qn]),k$=m.useCallback(async()=>{var O,U;if(Qn.length<2)return;const x=Fe.name.trim();if(!x){rn("请填写片段名称。");return}const S={},_={};for(const J of Qn){S[J.id]={x:((O=J.position)==null?void 0:O.x)||0,y:((U=J.position)==null?void 0:U.y)||0};const Y=Tl(J);Y&&(_[J.id]=Y)}const P=Af.map(J=>({source:J.source,target:J.target,sourceHandle:J.sourceHandle??null,targetHandle:J.targetHandle??null}));jt(!0),rn("");try{const J=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:Fe.id,name:x,displayName:x,version:"1.0.0",description:Fe.description,snippet:{instances:qk(Qn,$.current),edges:P,ui:{nodePositions:S,nodeSizes:_}}})}),Y=await J.json().catch(()=>({}));if(!J.ok||Y.ok===!1)throw new Error(Y.error||"发布流程片段失败");Ie(!1),ge(`流程片段已发布:${Y.id||x}`),Fv(`流程片段已发布:${Y.id||x}`),await wf(),Ze("flows")}catch(J){rn(String(J.message||J))}finally{jt(!1)}},[wf,Fe,Af,Qn,Fv]),VS=m.useCallback(async()=>{var S;const x=Hc.trim();if(x){gv(!0),Bc("");try{const _=await fetch("/api/workspace/collaboration/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,username:x,role:"editor"})}),P=await _.json().catch(()=>({}));if(!_.ok)throw new Error(P.error||"添加协作成员失败");sg(P.workspace||null),wv(""),ge(`已将 Workspace 分享给 ${((S=P.member)==null?void 0:S.username)||x}`)}catch(_){Bc(String(_.message||_))}finally{gv(!1)}}},[o,Hc]),v$=m.useCallback(()=>{Bc(""),ig(!0)},[]),S$=m.useCallback(async x=>{const S=String((x==null?void 0:x.userId)||"").trim();if(!(!S||S===(Zt==null?void 0:Zt.ownerId))){bv(S),Bc("");try{const _=await fetch("/api/workspace/collaboration/share",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,memberUserId:S})}),P=await _.json().catch(()=>({}));if(!_.ok)throw new Error(P.error||"取消成员分享失败");sg(P.workspace||null),ge(`已取消对 ${(x==null?void 0:x.username)||S} 的分享`)}catch(_){Bc(String(_.message||_))}finally{bv("")}}},[o,Zt==null?void 0:Zt.ownerId]),KS=m.useCallback(async()=>{const x=El(v.current,w.current,$.current);x.ui={...x.ui||{},...B.current?{viewport:B.current}:{},displayPage:aC(A.current,v.current)};const S=new Blob([`${JSON.stringify(x,null,2)}
|
|
263
|
-
`],{type:"application/json"}),_=URL.createObjectURL(S),P=document.createElement("a");P.href=_,P.download=`${o.flowId||"workspace"}-conflict-draft-${Date.now()}.json`,document.body.appendChild(P),P.click(),P.remove(),URL.revokeObjectURL(_),await ys(),sl(null),ia(!1),ge("已备份本地草稿并载入远端最新版本")},[w,o.flowId,ys,v]),N$=m.useCallback(async()=>{const x=Array.isArray(Nn==null?void 0:Nn.conflictItems)?Nn.conflictItems:[];if(!x.length||!(Nn!=null&&Nn.mergeGraph)||!(Nn!=null&&Nn.currentGraph)){Wc("当前冲突缺少字段合并数据,请改用“备份并载入远端”。");return}let S=Nn.mergeGraph;try{x.forEach((P,O)=>{const U=ag[String(O)]||{mode:"local"};let J,Y=!0;U.mode==="remote"?(J=P.current,Y=P.hasCurrent!==!1):U.mode==="manual"?J=JSON.parse(String(U.manual||"")):(J=P.incoming,Y=P.hasIncoming!==!1),S=qG(S,P.pathParts,J,Y)})}catch(P){Wc(`手动值不是有效 JSON:${String(P.message||P)}`);return}kv(!0),Wc(""),Ts("saving"),Ms("正在提交冲突解决结果");const _=Z.current.catch(()=>{}).then(async()=>{const P=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,graph:S,baseRevision:Nn.currentRevision,baseGraph:Nn.currentGraph,clientId:oe.current})}),O=await P.json().catch(()=>({}));if(!P.ok){if(P.status===409&&Array.isArray(O.conflictItems)){const U=O.conflictItems;sl({currentRevision:String(O.currentRevision||""),message:O.error||"Workspace 再次出现冲突",conflictPaths:Array.isArray(O.conflictPaths)?O.conflictPaths:[],conflictItems:U,mergeGraph:O.mergeGraph||null,currentGraph:O.currentGraph||null}),il(Object.fromEntries(U.map((J,Y)=>[String(Y),{mode:"local",manual:Su(J)}])))}throw new Error(O.error||"提交冲突解决结果失败")}await ys(),sl(null),ia(!1),ge("冲突已解决并保存")});Z.current=_;try{await _}catch(P){Wc(String(P.message||P)),Ts("error"),Ms(String(P.message||P))}finally{kv(!1)}},[o,ys,Nn,ag]);m.useCallback(()=>{if(au.length===0){ge("当前 workspace 没有 display 节点");return}const x=$g.length>0?$g:au.map(_=>_.id),S=o.flowId?`${o.flowId} 展示页`:"AgentFlow Display";fn(Jy({title:S,layout:"gallery",nodeIds:x,mode:"multi-node"})),Gn(""),Fn(null),Yn(!0)},[o.flowId,$g,au]);const j$=m.useCallback(x=>{fn(S=>{const _=Array.isArray(S.nodeIds)?S.nodeIds:[];return _.includes(x)?{...S,nodeIds:_.filter(P=>P!==x)}:{...S,nodeIds:[..._,x]}})},[]),Ls=m.useCallback(async()=>{Jn(!0),ct("");try{const x=await fetch("/api/display/shares"),S=await x.json().catch(()=>({}));if(!x.ok)throw new Error(S.error||"读取分享列表失败");xn(Array.isArray(S.shares)?S.shares:[])}catch(x){ct(String(x.message||x)),xn([])}finally{Jn(!1)}},[]),C$=m.useCallback(()=>{ot(!0),et(""),Ls()},[Ls]),_$=m.useCallback(async()=>{var _,P;const x=Ft.title.trim(),S=Array.isArray(Ft.nodeIds)?Ft.nodeIds:[];if(S.length===0){Gn("请选择至少一个 display 节点。");return}yr(!0),Gn(""),Fn(null);try{await Yt(g,b);const O=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,title:x,layout:Ft.layout,nodeIds:S,...cC(Ft)})}),U=await O.json().catch(()=>({}));if(!O.ok||U.ok===!1)throw new Error(U.error||"发布展示页失败");const J=new URL(U.url||`/display/${((_=U.share)==null?void 0:_.id)||""}`,window.location.origin).href;Fn({...U,absoluteUrl:J}),ge((P=U.share)!=null&&P.expiresAt?"展示页已生成":"展示页已生成:永久有效"),ke&&Ls()}catch(O){Gn(String(O.message||O))}finally{yr(!1)}},[Ft,ke,b,o,Ls,g,Yt]),E$=m.useCallback(async()=>{var S,_;const x=Array.isArray(N.nodeIds)?N.nodeIds:[];if(x.length===0){Gn("请先添加至少一个展示节点。"),ge("请先添加至少一个展示节点"),Or(!0);return}yr(!0),Gn("");try{await Yt(g,b);const P=o.flowId?`${o.flowId} 展示页`:"AgentFlow Display",O=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,title:P,layout:"canvas",nodeIds:x,...cC(Ft)})}),U=await O.json().catch(()=>({}));if(!O.ok||U.ok===!1)throw new Error(U.error||"生成展示链接失败");const J=new URL(U.url||`/display/${((S=U.share)==null?void 0:S.id)||""}`,window.location.origin).href;Fn({...U,absoluteUrl:J}),ur(!0),ge((_=U.share)!=null&&_.expiresAt?"展示链接已生成":"展示链接已生成:永久有效"),ke&&Ls()}catch(P){const O=String(P.message||P);Gn(O),ge(O)}finally{yr(!1)}},[N.nodeIds,Ft,ke,b,o,Ls,g,Yt]),qS=m.useCallback(async()=>{const x=mt==null?void 0:mt.absoluteUrl;if(!x)return;const S=await dC(x);ae(S?"copied":"failed"),window.setTimeout(()=>ae(""),1600)},[mt==null?void 0:mt.absoluteUrl]),A$=m.useCallback(async x=>{const S=uC(x),_=await dC(S);et(_?String((x==null?void 0:x.id)||""):"failed"),window.setTimeout(()=>et(""),1600)},[]),P$=m.useCallback(async(x,S)=>{const _=String((x==null?void 0:x.id)||"");if(_){Vt(_),ct("");try{const P=S==="permanent"?{id:_,expiresMode:"permanent",permanent:!0}:{id:_,expiresMode:"days",expiresInDays:Number(S||30)},O=await fetch("/api/display/share",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)}),U=await O.json().catch(()=>({}));if(!O.ok||U.ok===!1)throw new Error(U.error||"更新分享有效期失败");await Ls(),ge("分享有效期已更新")}catch(P){ct(String(P.message||P))}finally{Vt("")}}},[Ls]),I$=m.useCallback(async x=>{const S=String((x==null?void 0:x.id)||"");if(S){Vt(S),ct("");try{const _=await fetch(`/api/display/share?id=${encodeURIComponent(S)}`,{method:"DELETE"}),P=await _.json().catch(()=>({}));if(!_.ok||P.ok===!1)throw new Error(P.error||"撤销分享失败");await Ls(),ge("分享已撤销")}catch(_){ct(String(_.message||_))}finally{Vt("")}}},[Ls]),R$=m.useCallback(x=>{k(S=>S.map(_=>_.id===x?{..._,selected:!1}:_)),he(S=>S===x?"":S)},[k]),wl=m.useCallback(()=>{const x=wg.current;if(!x)return;const S=x.getBoundingClientRect(),_=Math.min(420,Math.max(320,S.width+160)),P=12,O=Math.max(180,S.top-P*2),U=Math.min(560,O);YM({position:"fixed",left:Math.max(12,Math.min(window.innerWidth-_-12,S.left)),top:Math.max(P,S.top-U-P),width:_,maxHeight:U,zIndex:1e4})},[]);m.useEffect(()=>{if(!mf)return;wl();const x=_=>{var O,U;const P=_.target;(O=wg.current)!=null&&O.contains(P)||(U=Hv.current)!=null&&U.contains(P)||yg(!1)},S=_=>{_.key==="Escape"&&yg(!1)};return window.addEventListener("pointerdown",x),window.addEventListener("keydown",S),window.addEventListener("resize",wl),window.addEventListener("scroll",wl,!0),()=>{window.removeEventListener("pointerdown",x),window.removeEventListener("keydown",S),window.removeEventListener("resize",wl),window.removeEventListener("scroll",wl,!0)}},[mf,wl]);const T$=m.useCallback(x=>{var O,U;const S=vU(x);if(S.active?(gt.current||gs(),gt.current=!0):S.finished&>.current&&(gt.current=!1,bt.current=!0),c==="display"){const J=[];let Y=!1;S.mutated&&!S.active&&!S.finished&&gs(),j(G=>{var me,_e;const le={...G.nodePositions},xe={...G.nodeSizes};for(const Oe of x||[]){const De=Yy(Oe==null?void 0:Oe.id);if(!(!De||!G.nodeIds.includes(De))){if(Oe.type==="select"){Oe.selected&&J.push(De);continue}if(Oe.type==="position"&&Oe.position){le[De]={x:Oe.position.x,y:Oe.position.y},Y=!0;continue}if(Oe.type==="dimensions"&&((me=Oe.dimensions)!=null&&me.width)&&((_e=Oe.dimensions)!=null&&_e.height)){const He=$a({width:Math.round(Number(Oe.dimensions.width)),height:Math.round(Number(Oe.dimensions.height))},{display:!0});He&&(xe[De]=He,Y=!0)}}}return Y?{...G,nodePositions:le,nodeSizes:xe}:G}),(x||[]).some(G=>(G==null?void 0:G.type)==="select")&&T(J);return}if(!Ce){const J=(x||[]).filter(Y=>(Y==null?void 0:Y.type)==="select");J.length>0&&k(Y=>zh(J,Y));return}S.mutated&&!S.active&&!S.finished&&gs();const _=new Map;for(const J of x||[])if((J==null?void 0:J.type)==="dimensions"&&((O=J.dimensions)!=null&&O.width)&&((U=J.dimensions)!=null&&U.height)){const Y=g.find(_e=>_e.id===J.id),G=td(Y),le=!!Cn(Y==null?void 0:Y.data),xe={width:Math.round(Number(J.dimensions.width)),height:Math.round(Number(J.dimensions.height))},me=G?Xx(xe):$a(xe,{display:le});me&&_.set(J.id,me)}const P=Array.from(_.keys());if(k(J=>zh(x,J).map(Y=>{const G=_.get(Y.id);return G?td(Y)?{...Y,width:G.width,height:G.height,data:{...Y.data,nodeSize:G}}:Cn(Y.data)?{...Y,width:G.width,height:G.height,data:{...Y.data,nodeSize:G,displaySize:G}}:{...Y,width:G.width,height:G.height,data:{...Y.data,nodeSize:G}}:Y})),P.length>0){const J=()=>P.forEach(Y=>s(Y));window.requestAnimationFrame(J),window.setTimeout(J,80)}},[gs,g,k,s,c,Ce]),M$=m.useCallback(x=>{if(c!=="display"){if(!Ce){const S=(x||[]).filter(_=>(_==null?void 0:_.type)==="select");S.length>0&&y(_=>{const P=Bh(S,_);return w.current=P,P});return}(x||[]).some(S=>(S==null?void 0:S.type)!=="select")&&gs(),y(S=>{const _=Bh(x,S);return w.current=_,_})}},[gs,y,c,Ce]),xl=m.useCallback(()=>{const x=document.querySelector(".af-workspace-canvas .react-flow");if(x){const S=x.getBoundingClientRect();return r.screenToFlowPosition({x:S.left+S.width*.48,y:S.top+S.height*.32})}return{x:360+g.length*36,y:180+g.length*28}},[g.length,r]),If=m.useCallback(()=>{var x,S,_;if(tn){const P=Number(((x=tn.measured)==null?void 0:x.width)||tn.width||260);return{x:Number(((S=tn.position)==null?void 0:S.x)||0)+P+140,y:Number(((_=tn.position)==null?void 0:_.y)||0)}}return xl()},[xl,tn]),$i=m.useCallback((x,S={})=>{if(!Ce)return ge("Readonly workspace"),null;if(!x)return null;const _=Qk(x)||x.id,P=uT(x),O=fT(x),U=S.id||IY(_,g),J=Ou(x.inputs),Y=Ou(x.outputs),G={definitionId:_,...P?{marketplaceRef:P}:{},...x.packageId?{marketplacePackageId:x.packageId}:{},...x.version?{marketplaceVersion:x.version}:{},label:S.label||em(x),role:"normal",body:S.body||"",...S.script||O?{script:S.script||O}:{},...S.scriptRef?{scriptRef:S.scriptRef}:{},...S.implementationRef?{implementationRef:S.implementationRef}:{},...S.implementationMode?{implementationMode:S.implementationMode}:{},input:S.inputs||J,output:S.outputs||Y},le={id:U,type:lc,position:S.position||xl(),data:{label:G.label,definitionId:_,...P?{marketplaceRef:P}:{},...x.packageId?{marketplacePackageId:x.packageId}:{},...x.version?{marketplaceVersion:x.version}:{},schemaType:cT(_,x),role:"normal",body:G.body,...G.script?{script:G.script}:{},...G.scriptRef?{scriptRef:G.scriptRef}:{},...G.implementationRef?{implementationRef:G.implementationRef}:{},...G.implementationMode?{implementationMode:G.implementationMode}:{},inputs:G.input,outputs:G.output}},xe={...Vx(le,{...$.current,[U]:G},tt),selected:!0};return gs(),k(me=>[...me.map(_e=>({..._e,selected:!1})),xe]),S.openProperties&&he(U),U},[xl,gs,g,tt,k,Ce]),$$=m.useCallback(x=>Uy(x,v.current),[]),L$=m.useCallback(x=>{if(!Ce){ge("Readonly workspace");return}if(!Uy(x,v.current)){ge("端口类型不匹配,已取消连线");return}E(null),gs(),k(S=>Hy(S,x)),y(S=>{const _=S.filter(O=>!(O.target===x.target&&O.targetHandle===x.targetHandle)),P=Qp({...x,markerEnd:{type:gi.ArrowClosed}},_);return w.current=P,P})},[gs,y,k,Ce]),O$=m.useCallback((x,S)=>{if(!Ce)return;const _=EY(S,v.current);L.current=_?{..._,preferExisting:!!(x!=null&&x.shiftKey)}:null,E(null)},[Ce]),D$=m.useCallback((x,S)=>{var We,Re,Lt,it;if(!Ce)return;const _=L.current;if(L.current=null,!_||S!=null&&S.toNode)return;const P=AY(tt,_),O=PY(v.current,w.current,_);if(P.length===0&&O.length===0){ge(`没有匹配 ${_.slotType} 端口的节点`);return}const J=!!(x!=null&&x.shiftKey||_.preferExisting)?O.length>0?"existing":"create":P.length>0?"create":"existing",Y=((Re=(We=x==null?void 0:x.changedTouches)==null?void 0:We[0])==null?void 0:Re.clientX)??(x==null?void 0:x.clientX),G=((it=(Lt=x==null?void 0:x.changedTouches)==null?void 0:Lt[0])==null?void 0:it.clientY)??(x==null?void 0:x.clientY);if(!Number.isFinite(Y)||!Number.isFinite(G))return;const le=document.querySelector(".af-workspace-canvas .react-flow");if(!le)return;const xe=le.getBoundingClientRect(),me=320,_e=Math.max(P.length,O.length),Oe=Math.min(480,150+_e*58),De=Math.max(12,Math.min(Y-xe.left,xe.width-me-12)),He=Math.max(12,Math.min(G-xe.top,xe.height-Oe-12));E({left:De,top:He,flowPosition:r.screenToFlowPosition({x:Y,y:G}),draft:_,candidates:P,existingCandidates:O,mode:J,query:""})},[tt,r,Ce]),F$=m.useCallback(x=>{if(!Ce){ge("Readonly workspace"),E(null);return}const S=R.current;if(!S||!(x!=null&&x.def))return;const _=$i(x.def,{position:S.flowPosition});if(!_)return;const P=S.draft.handleType==="source"?{source:S.draft.nodeId,sourceHandle:S.draft.handleId,target:_,targetHandle:`input-${x.slotIndex}`}:{source:_,sourceHandle:`output-${x.slotIndex}`,target:S.draft.nodeId,targetHandle:S.draft.handleId};k(O=>Hy(O,P)),y(O=>{const U=O.filter(Y=>!(Y.target===P.target&&Y.targetHandle===P.targetHandle)),J=Qp({...P,markerEnd:{type:gi.ArrowClosed}},U);return w.current=J,J}),E(null)},[$i,y,Ce]),z$=m.useCallback(x=>{if(!Ce){ge("Readonly workspace"),E(null);return}const S=x==null?void 0:x.connection;if(!S||!Uy(S,v.current)){ge("端口类型不匹配,已取消连线"),E(null);return}k(_=>Hy(_,S)),y(_=>{const P=_.filter(U=>!(U.target===S.target&&U.targetHandle===S.targetHandle)),O=Qp({...S,markerEnd:{type:gi.ArrowClosed}},P);return w.current=O,O}),E(null)},[y,k,Ce]),US=m.useCallback(x=>{x&&($i(x,{position:If()}),Pe(!1),Xn(""))},[$i,If]),YS=m.useCallback(x=>{x&&(lu(x,If()),Pe(!1),Xn(""))},[lu,If]),B$=m.useCallback(x=>{var _,P,O;if(ht||$n)return;const S=x==null?void 0:x.target;X1(S)||(_=S==null?void 0:S.closest)!=null&&_.call(S,"button, a, [role='button'], .react-flow__handle")||(O=(P=C.current)==null?void 0:P.focus)==null||O.call(P,{preventScroll:!0})},[ht,$n]);m.useEffect(()=>{const x=S=>{var le;if(S.defaultPrevented)return;const _=Mq(S.target)||X1(S.target);if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="s"){S.preventDefault(),Yt().catch(xe=>ge(String(xe.message||xe)));return}if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="k"){S.preventDefault(),S.stopPropagation(),Xv(xe=>!xe);return}if(Sg)return;if(vg){(S.key==="Escape"||$1(S))&&(S.preventDefault(),yf(!1));return}const P=S.key.toLowerCase(),O=(S.metaKey||S.ctrlKey)&&P==="c",U=(S.metaKey||S.ctrlKey)&&P==="v",J=_&&O&&VU(S.target);if(_&&!J)return;const Y=(S.metaKey||S.ctrlKey)&&!S.shiftKey&&P==="z",G=(S.metaKey||S.ctrlKey)&&(S.shiftKey&&P==="z"||P==="y");if(Y||G){if(ht){S.preventDefault(),S.stopPropagation(),ge("展示页布局会自动保存");return}if(!Ce){S.preventDefault(),ge("Readonly workspace");return}S.preventDefault(),S.stopPropagation();const xe=Y?fS():pS();ge(xe?Y?"Undo canvas change":"Redo canvas change":Y?"Nothing to undo":"Nothing to redo");return}if(O){if(ht)return;const xe=$e.current,me=(v.current||[]).some(Oe=>Oe==null?void 0:Oe.selected)?v.current:(v.current||[]).map(Oe=>xe&&Oe.id===xe?{...Oe,selected:!0}:Oe),_e=rq(me,w.current,$.current);_e&&(S.preventDefault(),S.stopPropagation(),H.current=_e,KY(_e),J&&typeof((le=S.target)==null?void 0:le.blur)=="function"&&S.target.blur(),ge(`Copied ${_e.nodes.length} node${_e.nodes.length>1?"s":""}`));return}if(U){if(ht){S.preventDefault(),S.stopPropagation();return}if(!Ce){S.preventDefault(),ge("Readonly workspace");return}const xe=H.current||qY();xe&&!H.current&&(H.current=xe);const me=sq(xe,v.current,w.current,$.current);me&&(S.preventDefault(),S.stopPropagation(),$.current=me.instances,V(me.instances),k(me.nodes),y(me.edges),ge(`Pasted ${me.pastedNodeIds.length} node${me.pastedNodeIds.length>1?"s":""}`));return}if($1(S)&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),yf(!0);return}if(P==="g"&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),OS();return}if(S.key==="a"||S.key==="A"){if(S.metaKey||S.ctrlKey){S.preventDefault(),ht?T(A.current.nodeIds):(k(xe=>xe.map(me=>({...me,selected:!0}))),y(xe=>xe.map(me=>({...me,selected:!1}))));return}if(S.altKey)return;if(ht){S.preventDefault(),Or(!0);return}if(!Ce){S.preventDefault(),ge("Readonly workspace");return}S.preventDefault(),Pe(!0);return}if((S.key==="v"||S.key==="V")&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),Qv("select");return}if((S.key==="h"||S.key==="H")&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),Qv("pan");return}(S.key==="f"||S.key==="F")&&!S.metaKey&&!S.ctrlKey&&!S.altKey&&(S.preventDefault(),LS())};return window.addEventListener("keydown",x,!0),()=>window.removeEventListener("keydown",x,!0)},[OS,ht,Sg,LS,pS,Yt,vg,y,k,fS,Ce]);const H$=m.useCallback(x=>{ol(S=>{const _=new Set(S);return _.has(x)?_.delete(x):_.add(x),_})},[]),W$=m.useCallback((x,S)=>{x.dataTransfer.effectAllowed="copy",x.dataTransfer.setData("application/x-agentflow-workspace-file",JSON.stringify({path:S.path,name:S.name,type:S.type})),x.dataTransfer.setData("text/plain",S.path)},[]),V$=m.useCallback((x,S)=>{x.dataTransfer.effectAllowed="move",x.dataTransfer.setData("application/agentflow-node",S.id),x.dataTransfer.setData("text/plain",S.id)},[]),Rf=m.useCallback(async(x,S)=>{const _=String((x==null?void 0:x.name)||(x==null?void 0:x.path)||"").toLowerCase(),P=_.split(".").pop(),O=["jsx","tsx","js"].includes(P)?"display_react_app":P==="html"?"display_html":P==="csv"||P==="tsv"||P==="json"&&/\b(table|data|rows|report)\b/i.test(_)?"display_table":["png","jpg","jpeg","gif","webp","svg"].includes(P)?"display_image":"display_markdown",U=tt.find(me=>me.id===O);if(!U){ge("展示节点不可用");return}const J=O==="display_image";let Y=String(x.path||"");if(!J){const me=Ir(o);me.set("path",x.path);const _e=await fetch(`/api/workspace/file?${me.toString()}`),Oe=await _e.json();if(!_e.ok)throw new Error(Oe.error||"读取文件失败");Y=String(Oe.content||"")}const G=O==="display_image"?"src":"content",le=Ou(U.inputs).map(me=>me.name===G?{...me,default:Y,value:Y}:me),xe=Ou(U.outputs).map(me=>me.name===G?{...me,default:Y,value:Y}:me);$i(U,{label:x.name||"Display",body:Y,inputs:le,outputs:xe,position:S}),ge(`已创建展示:${x.path}`)},[$i,o,tt]),K$=m.useCallback(x=>{if(!Ce){ge("Readonly workspace");return}Rf(x,xl()).catch(S=>ge(String(S.message||S)))},[Rf,xl,Ce]),q$=m.useCallback(x=>{if(!Ce){x.preventDefault(),ge("Readonly workspace");return}const S=x.dataTransfer.getData("application/x-agentflow-workspace-file");if(S){x.preventDefault();let J;try{J=JSON.parse(S)}catch{return}if(!(J!=null&&J.path))return;const Y=r.screenToFlowPosition({x:x.clientX,y:x.clientY});Rf(J,Y).catch(G=>ge(String(G.message||G)));return}const _=x.dataTransfer.getData("application/agentflow-snippet");if(_){const J=Se.find(G=>`${G.id}@${G.version}`===_);if(!J)return;x.preventDefault();const Y=r.screenToFlowPosition({x:x.clientX,y:x.clientY});lu(J,Y);return}const P=x.dataTransfer.getData("application/agentflow-node");if(!P)return;const O=tt.find(J=>J.id===P);if(!O)return;x.preventDefault();const U=r.screenToFlowPosition({x:x.clientX,y:x.clientY});$i(O,{position:U})},[Rf,$i,Se,lu,tt,r,Ce]),U$=m.useCallback(x=>{if(!Ce)return;const S=Array.from(x.dataTransfer.types||[]);!S.includes("application/x-agentflow-workspace-file")&&!S.includes("application/agentflow-node")&&!S.includes("application/agentflow-snippet")||(x.preventDefault(),x.dataTransfer.dropEffect=S.includes("application/agentflow-node")||S.includes("application/agentflow-snippet")?"move":"copy")},[Ce]),Y$=m.useCallback(async(x="")=>{if(!Ce){ge("Readonly workspace");return}const S=window.prompt("新文件名",x?`${x}/notes.md`:"notes.md");if(!S)return;const _=x&&!S.includes("/")?`${x}/${S}`:S;try{const P=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,path:_,content:""})}),O=await P.json();if(!P.ok)throw new Error(O.error||"创建文件失败");await jn(),ol(U=>{const J=new Set(U);for(const Y of Np(O.path||_))J.delete(Y);return J}),ge(`已创建 ${O.path}`)}catch(P){ge(String(P.message||P))}},[o,jn,Ce]),G$=m.useCallback(async(x="")=>{if(!Ce){ge("Readonly workspace");return}const S=window.prompt("新文件夹名",x?`${x}/docs`:"docs");if(!S)return;const _=x&&!S.includes("/")?`${x}/${S}`:S;try{const P=await fetch("/api/workspace/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,path:_})}),O=await P.json();if(!P.ok)throw new Error(O.error||"创建文件夹失败");await jn(),ol(U=>{const J=new Set(U);for(const Y of Np(O.path||_))J.delete(Y);return O.path&&J.delete(O.path),J}),ge(`已创建 ${O.path}`)}catch(P){ge(String(P.message||P))}},[o,jn,Ce]),J$=m.useCallback(async x=>{if(!Ce){ge("Readonly workspace");return}if(!(!(x!=null&&x.path)||!window.confirm(`删除 ${x.path}?`)))try{const S=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,path:x.path})}),_=await S.json();if(!S.ok)throw new Error(_.error||"删除失败");ge(`已删除 ${_.path}`),await jn()}catch(S){ge(String(S.message||S))}},[o,jn,Ce]),X$=m.useCallback(x=>{if(!(x!=null&&x.path)||x.type==="directory")return;const S=Ld(x.path,o,{download:!0});if(!S)return;const _=document.createElement("a");_.href=S,_.download=x.name||x.path.split("/").pop()||"download",_.rel="noopener",document.body.appendChild(_),_.click(),_.remove()},[o]),Tf=m.useCallback(async()=>{if(!Ce){ge("Readonly workspace");return}const x=aa.trim(),S=Dr,_=Rs.find(J=>J.id===S)||null;if(!x||Zr||(_==null?void 0:_.status)==="running"||(_==null?void 0:_.status)==="stopping")return;const P=_?Array.isArray(_.messages)?_.messages:[]:la,O=El(g,b,$.current);xg(""),Vv(!0),ul(!0),dl(null);const U={role:"user",text:x,at:Date.now()};_?Bn(J=>J.map(Y=>Y.id===S?{...Y,status:"running",messages:[...Array.isArray(Y.messages)?Y.messages:[],U].slice(-180)}:Y)):(ms("workspace"),cl(J=>[...J,U]));try{await Yt(g,b);const J=await fetch("/api/workspace/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...o,prompt:x,outputKind:"markdown",workspaceGraph:O,allowFlowYaml:!1,model:Ii,selectedSkills:Is,selectedNodeIds:Ef,messages:P})}),Y=await J.json();if(!J.ok)throw new Error(Y.error||"生成失败");const le={role:"assistant",kind:"assistant",text:String(Y.content||"").trim(),at:Date.now()};_?Bn(xe=>xe.map(me=>me.id===S?{...me,status:"done",messages:[...Array.isArray(me.messages)?me.messages:[],le].slice(-180)}:me)):cl(xe=>[...xe,le]),await ys(),ge("AI 生成完成")}catch(J){const Y=String(J.message||J),G={role:"assistant",text:Y,error:!0,at:Date.now()};_?Bn(le=>le.map(xe=>xe.id===S?{...xe,status:"failed",messages:[...Array.isArray(xe.messages)?xe.messages:[],G].slice(-180)}:xe)):cl(le=>[...le,G]),ge(Y)}finally{Vv(!1)}},[Dr,la,Ii,Rs,Zr,aa,b,o,ys,g,Yt,Ef,Is,Ce]),tr=Rs.find(x=>x.id===Dr)||null,Dg=tr?Array.isArray(tr.messages)?tr.messages:[]:la,bl=tr&&(tr.status==="running"||tr.status==="stopping")||Zr,Q$=_G(Dg,bl),Fg=EG(Dg),GS=tr?tr.status==="stopping"?`${tr.label} stopping`:tr.status==="running"?`${tr.label} running`:tr.status==="paused"?`${tr.label} paused`:tr.status==="failed"?`${tr.label} failed`:`${tr.label} done`:Zr?"Workspace agent running":la.length>0?"Workspace conversation":"Ready";m.useEffect(()=>{Dr!=="workspace"&&(Rs.some(x=>x.id===Dr)||ms(da()))},[Dr,Rs,da]),m.useEffect(()=>{if(!Yc)return;const x=window.requestAnimationFrame(()=>{var _,P;const S=Kv.current;S&&(S.scrollTop=S.scrollHeight),(P=(_=bg.current)==null?void 0:_.scrollIntoView)==null||P.call(_,{block:"nearest",inline:"nearest"})});return()=>window.cancelAnimationFrame(x)},[Dg.length,Dr,GS,Fg.length,Yc]);const Z$=String(o.flowId||"").trim()||"Workspace",mo=(Ft==null?void 0:Ft.mode)==="single-node",JS=mo&&au.find(x=>{var S;return x.id===Ft.sourceNodeId||((S=Ft.nodeIds)==null?void 0:S.includes(x.id))})||null,e2=mo&&JS?[JS]:au;return i.jsxs("div",{className:"af-workspace-page",children:[i.jsxs("header",{className:"af-pipeline-top af-workspace-top",children:[i.jsxs("div",{className:"af-pipeline-top-left",children:[i.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-back",onClick:()=>n("/projects"),"aria-label":"返回",children:i.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),i.jsxs("div",{className:"af-pipeline-brand",title:o.flowId?`${o.flowId} · ${fo}`:fo||"PROJECT",children:[i.jsx("span",{className:"af-pipeline-brand-name",children:Z$}),i.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",$U,"-STABLE"]})]}),i.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[i.jsx("button",{type:"button",className:c==="workspace"?"af-view-switch__active":"",onClick:()=>Og("workspace"),children:"Workspace"}),i.jsx("button",{type:"button",className:c==="display"?"af-view-switch__active":"",onClick:()=>Og("display"),children:"Display"}),i.jsx("button",{type:"button",className:c==="workflow"?"af-view-switch__active":"",onClick:()=>Og("workflow"),children:"Workflow"})]})]}),i.jsxs("div",{className:"af-pipeline-top-right af-workspace-actions",children:[i.jsx("span",{className:`af-workspace-sync-light is-${sS}`,title:`${uS} · ${iS}`,role:"status","aria-label":`${uS}:${iS}`,children:i.jsx("span",{className:"af-workspace-sync-light__dot","aria-hidden":!0})}),Nn?i.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",onClick:()=>{var x;(x=Nn.conflictItems)!=null&&x.length?ia(!0):KS()},title:["先下载当前本地草稿,再载入远端最新版本",...Nn.conflictPaths||[]].join(`
|
|
264
|
-
`),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"difference"}),"处理冲突"]}):null,ht?i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:cr||!(mt!=null&&mt.absoluteUrl)&&N.nodeIds.length===0,onClick:()=>{ae(""),ur(!0)},title:mt!=null&&mt.absoluteUrl?"查看展示链接":N.nodeIds.length===0?"先添加展示节点":"生成展示链接",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:cr?"hourglass_empty":"ios_share"}),cr?"生成中":mt!=null&&mt.absoluteUrl?"展示链接":"生成链接"]}),i.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:gl.length===0,onClick:()=>Or(!0),title:gl.length===0?"当前 workspace 没有 display 节点":"选择展示节点 (A)",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add_to_photos"}),"添加展示"]})]}):null,i.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:!!(Zt!=null&&Zt.role&&Zt.role!=="owner"),onClick:v$,title:Zt!=null&&Zt.role&&Zt.role!=="owner"?"仅 Workspace 所有者可以创建邀请":"邀请其他成员协作编辑",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"group_add"}),"协作分享"]}),i.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",onClick:C$,title:"查看我的展示分享",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder_shared"}),"我的分享"]}),i.jsx("button",{type:"button",className:"af-icon-btn",disabled:!cS,onClick:()=>p(!0),"aria-label":e("project:archiveModal.title"),title:e("project:archiveModal.title"),children:i.jsx("span",{className:"material-symbols-outlined",children:"archive"})}),i.jsx("button",{type:"button",className:"af-icon-btn af-icon-btn--danger",disabled:!cS&&!tu,onClick:()=>h(!0),"aria-label":tu?"退出共享 Workspace":e("flow:topbar.deletePipeline"),title:tu?"退出共享 Workspace":e("flow:topbar.deletePipeline"),children:i.jsx("span",{className:"material-symbols-outlined",children:tu?"logout":"delete_forever"})}),i.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>yf(!0),"aria-label":"快捷键",title:"快捷键 (?)",children:i.jsx("span",{className:"material-symbols-outlined",children:"help"})}),i.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(Yc?" af-composer-topbar-btn--active":"")+(Zr?" af-composer-topbar-btn--running":""),disabled:ht||$n,onClick:()=>{dl(null),ul(x=>(x||ms(da()),!x))},children:"AI"}),i.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!Ce,onClick:()=>Yt().catch(x=>ge(String(x.message||x))),children:"Save"})]})]}),gr?i.jsxs("div",{className:"af-flow-snippet-toast",role:"status","aria-live":"polite",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"check_circle"}),i.jsx("span",{children:gr}),i.jsx("button",{type:"button",onClick:()=>qn(""),"aria-label":"关闭发布提示",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,i.jsxs("div",{className:"af-workspace-body"+(!ht&&!$n&&(Yc||pe)?" af-workspace-body--drawer":"")+(!ht&&!$n&&Jc?" af-workspace-body--sidebar-collapsed":"")+(ht?" af-workspace-body--display-mode":"")+($n?" af-workspace-body--workflow-mode":""),children:[!ht&&!$n&&Jc?i.jsx("nav",{className:"af-workspace-rail","aria-label":"Workspace sidebar",children:i.jsxs("div",{className:"af-workspace-rail__stack",children:[i.jsxs("button",{type:"button",className:"af-workspace-rail__primary",onClick:()=>Pe(!0),"aria-label":"添加节点",title:"添加节点",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"}),i.jsx("span",{className:"af-workspace-rail__dot","aria-hidden":!0})]}),i.jsx("button",{type:"button",className:"af-workspace-rail__btn",onClick:()=>gf(!1),"aria-label":"展开文件",title:"展开文件",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder"})}),i.jsx("span",{className:"af-workspace-rail__divider","aria-hidden":!0}),i.jsx("button",{type:"button",className:"af-workspace-rail__avatar",onClick:()=>gf(!1),"aria-label":"展开侧边栏",title:(Ar==null?void 0:Ar.username)||(Ar==null?void 0:Ar.userId)||"展开侧边栏",children:w$})]})}):null,!ht&&!$n?i.jsxs("aside",{ref:jv,className:"af-workspace-sidebar"+(LM?" af-workspace-sidebar--resizing":""),"aria-hidden":Jc,style:{"--af-work-files-pane-height":`${Math.round(fg)}px`},children:[i.jsxs("section",{className:"af-workspace-files-section",children:[i.jsxs("div",{className:"af-workspace-sidebar-head",children:[i.jsx("h2",{children:"Files"}),i.jsxs("div",{className:"af-workspace-sidebar-actions",children:[i.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>gf(!0),"aria-label":"最小化侧边栏",title:"最小化侧边栏",children:i.jsx("span",{className:"material-symbols-outlined",children:"keyboard_double_arrow_left"})}),i.jsx("button",{type:"button",className:"af-icon-btn",disabled:!Ce,onClick:()=>Y$(Mi),"aria-label":"新增文件",title:Mi?`在 ${Mi} 新增文件`:"新增文件",children:i.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),i.jsx("button",{type:"button",className:"af-icon-btn",disabled:!Ce,onClick:()=>G$(Mi),"aria-label":"新增文件夹",title:Mi?`在 ${Mi} 新增文件夹`:"新增文件夹",children:i.jsx("span",{className:"material-symbols-outlined",children:"create_new_folder"})}),i.jsx("button",{type:"button",className:"af-icon-btn",disabled:!Ce||Sv,onClick:()=>_S(Mi),"aria-label":"上传文件",title:Mi?`上传到 ${Mi}`:"上传文件",children:i.jsx("span",{className:"material-symbols-outlined",children:Sv?"hourglass_top":"upload_file"})}),i.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>void jn(),"aria-label":"刷新文件",title:"刷新文件",children:i.jsx("span",{className:"material-symbols-outlined",children:"refresh"})}),i.jsx("input",{ref:Cv,type:"file",multiple:!0,className:"af-visually-hidden",onChange:a$})]})]}),i.jsx("input",{className:"af-workspace-search",value:lg,onChange:x=>TM(x.target.value),placeholder:"搜索文件..."}),i.jsx("div",{className:"af-workspace-files-scroll",onClick:g$,children:i.jsx(ET,{items:m$,onOpen:K$,selectedPath:cg,collapsedDirs:MM,onToggleDir:H$,onSelect:x=>ug(x.path||""),onFileDragStart:W$,onDelete:J$,onDownload:X$})})]}),i.jsx("button",{type:"button",className:"af-workspace-sidebar-resizer",onPointerDown:KM,role:"separator","aria-orientation":"horizontal","aria-label":"调整 Files 和 Palette 区域大小",title:"拖动调整 Files / Palette 高度"}),i.jsxs("section",{className:"af-workspace-nodes-section",children:[i.jsxs("div",{className:"af-node-palette-head af-workspace-node-palette-head",children:[i.jsxs("h2",{className:"af-node-palette-title",children:[i.jsx("span",{children:"Palette"}),i.jsx("span",{className:"af-node-palette-title-kbd","aria-label":"快捷键 A",children:"A"})]}),i.jsxs("label",{className:"af-palette-search-wrap",children:[i.jsx("span",{className:"af-visually-hidden",children:ze==="flows"?"搜索流程片段":"搜索节点"}),i.jsx("span",{className:"af-palette-search-icon material-symbols-outlined","aria-hidden":!0,children:"search"}),i.jsx("input",{type:"search",className:"af-palette-search-input",value:de,onChange:x=>ve(x.target.value),placeholder:ze==="flows"?"搜索流程片段...":"搜索节点...","aria-label":ze==="flows"?"搜索流程片段":"搜索节点"})]}),i.jsxs("div",{className:"af-palette-tabs",role:"tablist","aria-label":"Palette 类型",children:[i.jsxs("button",{type:"button",role:"tab","aria-selected":ze==="nodes",className:"af-palette-tab"+(ze==="nodes"?" af-palette-tab--active":""),onClick:()=>Ze("nodes"),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),i.jsxs("button",{type:"button",role:"tab","aria-selected":ze==="flows",className:"af-palette-tab"+(ze==="flows"?" af-palette-tab--active":""),onClick:()=>Ze("flows"),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),"流程"]})]})]}),i.jsx("div",{className:"af-node-palette-scroll af-workspace-node-palette-scroll",children:ze==="flows"?i.jsxs(i.Fragment,{children:[i.jsx("section",{className:"af-palette-section af-flow-palette-section--snippets",children:i.jsxs("div",{className:"af-flow-snippet-actions",children:[i.jsxs("button",{type:"button",className:"af-flow-snippet-publish-btn",onClick:b$,disabled:Qn.length<2,title:Qn.length<2?"选择至少两个节点后发布流程片段":"发布选中的流程片段",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"ios_share"}),"发布选中片段"]}),i.jsxs("span",{className:"af-flow-snippet-selection",children:["已选 ",Qn.length," 节点 / ",Af.length," 连线"]})]})}),nn?i.jsx("p",{className:"af-err af-palette-list-err",children:nn}):null,vn?i.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段..."}):HS.length>0?i.jsxs("section",{className:"af-palette-section af-flow-palette-section--snippets",children:[i.jsx("h3",{className:"af-palette-cat",children:"FLOW SNIPPETS"}),i.jsx("div",{className:"af-palette-cards",children:HS.map(x=>{const S=`${x.id}@${x.version}`,_=x.displayName||x.name||x.id,P=x.description||`${x.nodeCount||0} 个节点,${x.edgeCount||0} 条连线`;return i.jsxs("button",{type:"button",className:"af-palette-card af-flow-snippet-card",draggable:!0,onDragStart:O=>{O.dataTransfer.effectAllowed="move",O.dataTransfer.setData("application/agentflow-snippet",S),O.dataTransfer.setData("text/plain",S)},onClick:()=>lu(x),title:P,children:[i.jsxs("span",{className:"af-palette-card-head",children:[i.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:i.jsx("span",{className:"material-symbols-outlined",children:"account_tree"})}),i.jsxs("span",{className:"af-palette-card-main",children:[i.jsx("span",{className:"af-palette-card-label",children:_}),i.jsxs("span",{className:"af-palette-card-id",children:[x.id,"@",x.version]})]})]}),P?i.jsx("span",{className:"af-palette-card-desc",children:P}):null,i.jsxs("span",{className:"af-flow-snippet-meta","aria-hidden":!0,children:[i.jsxs("span",{children:[x.nodeCount||0," nodes"]}),i.jsxs("span",{children:[x.edgeCount||0," edges"]})]})]},S)})})]}):i.jsx("p",{className:"af-palette-empty",children:de.trim()?"没有匹配的流程片段":"暂无流程片段。选择多个节点后发布。"})]}):i.jsxs(i.Fragment,{children:[Il.map(x=>{var S;return(S=Tg[x])!=null&&S.length?i.jsxs("section",{className:`af-palette-section af-flow-palette-section--${x}`,children:[i.jsx("h3",{className:"af-palette-cat",children:x}),i.jsx("div",{className:"af-palette-cards",children:Tg[x].map(_=>{const P=sC(_.inputs,"input"),O=sC(_.outputs,"output"),U=Jx(_),J=$u(_);return i.jsxs("button",{type:"button",className:"af-palette-card",draggable:!0,onDragStart:Y=>V$(Y,_),onClick:()=>$i(_),title:U||_.id,children:[i.jsxs("span",{className:"af-palette-card-head",children:[i.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:i.jsx("span",{className:"material-symbols-outlined",children:nC(x)})}),i.jsxs("span",{className:"af-palette-card-main",children:[i.jsx("span",{className:"af-palette-card-label",children:J}),J!==_.id?i.jsx("span",{className:"af-palette-card-id",children:_.id}):null]})]}),U?i.jsx("span",{className:"af-palette-card-desc",children:U}):null,i.jsxs("span",{className:"af-palette-card-ports","aria-hidden":!0,children:[i.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--in",children:[i.jsxs("span",{className:"af-palette-card-port-count",children:[P.list.length," IN"]}),i.jsxs("span",{className:"af-palette-card-port-list",children:[P.shown.map((Y,G)=>i.jsxs("span",{className:"af-palette-card-port",title:rC("input",Y,G),children:[i.jsx("span",{className:"af-palette-card-port-dot",style:{background:En(Y==null?void 0:Y.type)}}),i.jsx("span",{className:"af-palette-card-port-name",children:vp(Y,G)})]},`in-${G}`)),P.hidden>0?i.jsxs("span",{className:"af-palette-card-port-more",children:["+",P.hidden]}):null]})]}),i.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--out",children:[i.jsxs("span",{className:"af-palette-card-port-count",children:[O.list.length," OUT"]}),i.jsxs("span",{className:"af-palette-card-port-list",children:[O.shown.map((Y,G)=>i.jsxs("span",{className:"af-palette-card-port",title:rC("output",Y,G),children:[i.jsx("span",{className:"af-palette-card-port-name",children:vp(Y,G)}),i.jsx("span",{className:"af-palette-card-port-dot",style:{background:En(Y==null?void 0:Y.type)}})]},`out-${G}`)),O.hidden>0?i.jsxs("span",{className:"af-palette-card-port-more",children:["+",O.hidden]}):null]})]})]})]},_.id)})})]},x):null}),tt.length>0&&de.trim()&&Il.every(x=>{var S;return!((S=Tg[x])!=null&&S.length)})?i.jsx("p",{className:"af-palette-empty",children:"没有匹配的节点"}):null]})})]})]}):null,$n?i.jsx(KG,{tapdId:dr,setTapdId:HM,snapshot:en,loading:WM,error:VM,actionRunning:pg,actionOutput:hg,pendingConfirm:hs,conflict:qc,reviewPublishing:mg,onRefresh:()=>xf(dr),onRunDryRun:e$,onConfirmAction:t$,onRetryConflict:n$,onPublishReview:r$}):i.jsxs("main",{ref:C,className:"af-workspace-canvas",tabIndex:-1,onPointerDownCapture:B$,children:[i.jsx(WI,{className:"af-flow-canvas af-workspace-flow"+(Ng==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select")+(ht?" af-workspace-flow--display-mode":""),nodes:f$,edges:p$,nodeTypes:xG,onNodesChange:T$,onEdgesChange:M$,onConnect:ht?void 0:L$,onConnectStart:ht?void 0:O$,onConnectEnd:ht?void 0:D$,isValidConnection:ht?void 0:$$,onNodeClick:(x,S)=>{var _;if(ht){T([Yy(S.id)]);return}if((_=S==null?void 0:S.data)!=null&&_.isWorkspaceGroup){he("");return}if(x.detail>=3){ul(!1),k(P=>P.map(O=>({...O,selected:O.id===S.id}))),y(P=>P.map(O=>({...O,selected:!1}))),he(S.id);return}K&&he(S.id)},onNodeDoubleClick:x=>{x.preventDefault()},onPaneClick:()=>{ht?T([]):he("")},onDrop:ht?void 0:q$,onDragOver:ht?void 0:U$,nodesDraggable:ht?!0:Ce,nodesConnectable:ht?!1:Ce,edgesReconnectable:ht?!1:Ce,deleteKeyCode:ht?null:Ce?["Backspace","Delete"]:null,selectionOnDrag:Ng==="select",panOnDrag:Ng==="pan"?!0:[1,2],panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,children:i.jsx(KI,{color:"rgba(255,255,255,0.12)",gap:22,size:1})}),!ht&&z?(()=>{var Y;const x=String(z.query||"").trim().toLowerCase(),S=z.mode==="create"?"create":"existing",_=Array.isArray(z.candidates)?z.candidates:[],P=Array.isArray(z.existingCandidates)?z.existingCandidates:[],O=x?_.filter(G=>{var le,xe,me;return[(le=G.def)==null?void 0:le.id,G.displayLabel,G.description,(xe=G.slot)==null?void 0:xe.name,(me=G.slot)==null?void 0:me.type].filter(Boolean).some(_e=>String(_e).toLowerCase().includes(x))}):_,U=x?P.filter(G=>{var le,xe;return[G.nodeId,G.nodeLabel,G.definitionId,(le=G.slot)==null?void 0:le.name,(xe=G.slot)==null?void 0:xe.type].filter(Boolean).some(me=>String(me).toLowerCase().includes(x))}):P,J=z.draft.handleType==="source"?"IN":"OUT";return i.jsxs("div",{className:"af-connect-node-menu",style:{left:z.left,top:z.top},role:"dialog","aria-label":"选择匹配节点",children:[i.jsxs("div",{className:"af-connect-node-menu__head",children:[i.jsxs("div",{className:"af-connect-node-menu__title",children:[i.jsx("span",{className:"af-connect-node-menu__dot",style:{background:En((Y=z.draft.slot)==null?void 0:Y.type)},"aria-hidden":!0}),i.jsxs("span",{children:["匹配 ",z.draft.slotType," 节点"]})]}),i.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>E(null),children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),i.jsxs("div",{className:"af-connect-node-menu__tabs",role:"tablist","aria-label":"连接方式",children:[i.jsxs("button",{type:"button",className:S==="existing"?"af-connect-node-menu__tab af-connect-node-menu__tab--active":"af-connect-node-menu__tab",disabled:P.length===0,onClick:()=>E(G=>G&&{...G,mode:"existing",query:""}),children:["连接已有 ",i.jsx("span",{children:P.length})]}),i.jsxs("button",{type:"button",className:S==="create"?"af-connect-node-menu__tab af-connect-node-menu__tab--active":"af-connect-node-menu__tab",disabled:_.length===0,onClick:()=>E(G=>G&&{...G,mode:"create",query:""}),children:["新建节点 ",i.jsx("span",{children:_.length})]})]}),i.jsxs("label",{className:"af-connect-node-menu__search",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),i.jsx("input",{type:"search",value:z.query,onChange:G=>E(le=>le&&{...le,query:G.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),i.jsxs("div",{className:"af-connect-node-menu__list",children:[S==="create"?O.map(G=>{var me,_e;const le=G.displayLabel||((me=G.def)==null?void 0:me.id),xe=vp(G.slot,G.slotIndex);return i.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>F$(G),title:G.description||G.def.id,children:[i.jsxs("span",{className:"af-connect-node-menu__item-main",children:[i.jsx("span",{className:"af-connect-node-menu__item-label",children:le}),le!==G.def.id?i.jsx("span",{className:"af-connect-node-menu__item-id",children:G.def.id}):null]}),i.jsxs("span",{className:"af-connect-node-menu__port",children:[i.jsx("span",{children:J}),i.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:En((_e=G.slot)==null?void 0:_e.type)},"aria-hidden":!0}),i.jsx("span",{className:"af-connect-node-menu__port-name",children:xe})]})]},`${G.def.id}-${G.slotIndex}`)}):U.map(G=>{var me;const le=G.nodeLabel||G.nodeId,xe=vp(G.slot,G.slotIndex);return i.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>z$(G),title:`${G.definitionId||G.nodeId} · ${xe}`,children:[i.jsxs("span",{className:"af-connect-node-menu__item-main",children:[i.jsx("span",{className:"af-connect-node-menu__item-label",children:le}),i.jsxs("span",{className:"af-connect-node-menu__item-id",children:[G.definitionId?`${G.definitionId} · `:"",G.nodeId]})]}),i.jsxs("span",{className:"af-connect-node-menu__port",children:[i.jsx("span",{children:J}),i.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:En((me=G.slot)==null?void 0:me.type)},"aria-hidden":!0}),i.jsx("span",{className:"af-connect-node-menu__port-name",children:xe}),G.occupied?i.jsx("span",{className:"af-connect-node-menu__port-badge",children:"替换"}):null]})]},`${G.nodeId}-${G.handleId}`)}),(S==="create"?O.length:U.length)===0?i.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null,!ht&&!$n&&!GM?i.jsx("div",{className:"af-workspace-composer af-bottom-composer-stack af-flow-bottom-composer",children:i.jsxs("div",{className:"af-pipeline-composer-inner",children:[i.jsx("button",{type:"button",className:"af-workspace-composer-minimize",onClick:()=>kg(!0),"aria-label":"最小化 AI 输入框",title:"最小化",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"remove"})}),i.jsx("div",{className:"af-composer-selected","aria-label":"Selected workspace nodes",children:Qn.length===0?i.jsx("span",{className:"af-composer-selected-empty",children:"选择画布节点后,可作为本次 Workspace AI 的上下文。"}):Qn.map(x=>{var O,U;const S=String(((O=x.data)==null?void 0:O.label)??x.id),_=(U=x.data)!=null&&U.definitionId?String(x.data.definitionId):"",P=_&&_!==S?`${S} · ${x.id} · ${_}`:`${S} · ${x.id}`;return i.jsxs("div",{className:"af-composer-node-chip",title:P,children:[i.jsx("span",{className:"af-composer-node-chip-kind",children:_||"node"}),i.jsx("span",{className:"af-composer-node-chip-label",children:S}),i.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>R$(x.id),"aria-label":`取消选择 ${x.id}`,children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},x.id)})}),i.jsxs("div",{className:"af-composer-card af-composer-card--input-only",children:[i.jsx("div",{className:"af-composer-input-wrap",children:i.jsx("textarea",{className:"af-composer-textarea",value:aa,rows:2,onChange:x=>xg(x.target.value),onKeyDown:x=>{(x.metaKey||x.ctrlKey)&&x.key==="Enter"&&(x.preventDefault(),Tf())},placeholder:"描述你想在 workspace 中生成、分析或展示的内容",autoComplete:"off",spellCheck:!1,disabled:!Ce})}),i.jsxs("div",{className:"af-composer-toolbar",children:[i.jsxs("div",{className:"af-composer-skills-field",children:[i.jsxs("button",{ref:wg,type:"button",className:"af-composer-skills-button"+(Is.length>0?" af-composer-skills-button--active":""),disabled:Zr||!Ce,"aria-haspopup":"listbox","aria-expanded":mf,onClick:()=>yg(x=>!x),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),i.jsx("span",{children:Is.length>0?`Skills ${Is.length}`:"Skills"})]}),mf&&!Zr?sr.createPortal(i.jsx("div",{ref:Hv,className:"af-composer-skills-menu",role:"listbox","aria-label":"Skills",style:UM,children:Ps.length===0?i.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):i.jsxs(i.Fragment,{children:[yl.groups.map(x=>{const S=Yo(x,Ps),_=UD(x,Mg,Ps),P=qM.has(x.id);return i.jsxs("div",{className:"af-composer-skill-group af-composer-skill-group--framed"+(P?" af-composer-skill-group--collapsed":""),children:[i.jsxs("div",{className:"af-composer-skill-group-title af-composer-skill-group-title--selectable",children:[i.jsxs("label",{className:"af-composer-skill-group-check",children:[i.jsx("input",{type:"checkbox",checked:_==="all",disabled:S.length===0,onChange:O=>{const U=O.target.checked;Kc(J=>U?KD(J,S):qD(J,S))}}),i.jsxs("span",{className:"af-composer-skill-group-title-main",children:[i.jsx("span",{children:x.name}),x.builtin?i.jsx("em",{children:"built-in"}):null,_==="partial"?i.jsx("em",{children:"partial"}):null]})]}),i.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":P?`展开 ${x.name}`:`收起 ${x.name}`,onClick:()=>{Bv(O=>{const U=new Set(O);return U.has(x.id)?U.delete(x.id):U.add(x.id),U})},children:[i.jsx("span",{children:x.skills.length}),i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:P?"expand_more":"expand_less"})]})]}),P?null:i.jsx("div",{className:"af-composer-skill-group-items",children:x.skills.map(O=>i.jsxs("label",{className:"af-composer-skill-option",children:[i.jsx("input",{type:"checkbox",checked:Mg.has(O.key),onChange:U=>{const J=U.target.checked;Kc(Y=>J?Y.includes(O.key)?Y:[...Y,O.key]:Y.filter(G=>G!==O.key))}}),i.jsxs("span",{className:"af-composer-skill-option-main",children:[i.jsx("span",{className:"af-composer-skill-option-title",children:O.name}),O.description?i.jsx("span",{className:"af-composer-skill-option-desc",children:O.description}):null]})]},`${x.id}:${O.key}`))})]},x.id)}),yl.ungrouped.length>0?i.jsxs("div",{className:"af-composer-skill-group",children:[i.jsxs("div",{className:"af-composer-skill-group-title",children:[i.jsx("span",{children:"Ungrouped"}),i.jsx("span",{children:yl.ungrouped.length})]}),yl.ungrouped.map(x=>i.jsxs("label",{className:"af-composer-skill-option",children:[i.jsx("input",{type:"checkbox",checked:Mg.has(x.key),onChange:S=>{const _=S.target.checked;Kc(P=>_?P.includes(x.key)?P:[...P,x.key]:P.filter(O=>O!==x.key))}}),i.jsxs("span",{className:"af-composer-skill-option-main",children:[i.jsx("span",{className:"af-composer-skill-option-title",children:x.name}),x.description?i.jsx("span",{className:"af-composer-skill-option-desc",children:x.description}):null]})]},`ungrouped:${x.key}`))]}):null]})}),document.body):null]}),i.jsx("label",{className:"af-composer-model-field",children:i.jsxs("select",{className:"af-composer-model-select",value:Ii,onChange:x=>DM(x.target.value),"aria-label":"模型",children:[i.jsx("option",{value:"",children:"默认模型"}),y$.map(x=>i.jsx("option",{value:x.value,children:x.label},x.value))]})}),i.jsx("button",{type:"button",className:"af-composer-send"+(aa.trim()&&!Zr?" af-composer-send--active":"")+(Zr?" af-composer-send--stop":""),disabled:Zr||!aa.trim()||!Ce,"aria-label":Zr?"Running":"Send",onClick:()=>void Tf(),children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Zr?"sync":"arrow_upward"})})]})]})]})}):!ht&&!$n?i.jsx("button",{type:"button",className:"af-workspace-composer-fab",onClick:()=>kg(!1),"aria-label":"展开 AI 输入框",title:"展开 AI 输入框",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"auto_awesome"})}):null]}),!ht&&!$n&&Yc?i.jsx("aside",{className:"af-pipeline-drawer af-pipeline-drawer--wide af-workspace-composer-drawer","aria-label":"Workspace AI Composer",children:i.jsxs("div",{className:"af-composer-sidebar",children:[i.jsxs("div",{className:"af-pipeline-drawer-head",children:[i.jsx("h2",{className:"af-pipeline-drawer-title",children:"AI Composer"}),i.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:()=>ul(!1),"aria-label":"关闭 AI 对话侧栏",children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),i.jsxs("div",{className:"af-composer-session-tabs",children:[i.jsx("button",{type:"button",className:"af-composer-session-tab"+(Dr==="workspace"?" af-composer-session-tab--active":""),ref:Dr==="workspace"?bg:null,onClick:()=>ms("workspace"),children:i.jsx("span",{className:"af-composer-session-label",children:"Workspace"})}),Rs.map(x=>i.jsxs("div",{role:"tab",tabIndex:0,ref:Dr===x.id?bg:null,className:"af-composer-session-tab"+(Dr===x.id?" af-composer-session-tab--active":"")+(x.status==="running"||x.status==="stopping"?" af-composer-session-tab--running":""),onClick:()=>ms(x.id),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),ms(x.id))},title:x.runNodeId||x.label,children:[i.jsx("span",{className:"af-composer-session-label",children:x.label}),i.jsx("button",{type:"button",className:"af-composer-session-close",onClick:S=>{S.preventDefault(),S.stopPropagation(),i$(x.id)},"aria-label":`关闭 ${x.label}`,title:"关闭 tab",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]},x.id))]}),i.jsx("div",{className:"af-composer-sidebar-status"+(bl?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:GS}),i.jsxs("div",{className:"af-composer-sidebar-thread",ref:Kv,children:[i.jsx(mC,{messages:Q$,running:bl,showRunningIndicator:!tr}),Fg.length>0?i.jsxs("details",{className:"af-composer-sidebar-log-details",...bl?{open:!0}:{},children:[i.jsx("summary",{children:"执行日志"}),i.jsx(mC,{messages:Fg,running:!1,showRunningIndicator:!1})]}):null]}),i.jsxs("div",{className:"af-composer-sidebar-input",children:[i.jsx("textarea",{className:"af-composer-sidebar-textarea",value:aa,rows:3,onChange:x=>xg(x.target.value),onKeyDown:x=>{(x.metaKey||x.ctrlKey)&&x.key==="Enter"&&(x.preventDefault(),Tf())},placeholder:tr?"继续追问、总结或要求调整这次结果":"继续描述你想让 AI 在 workspace 中做什么",disabled:!Ce||bl}),i.jsx("button",{type:"button",className:"af-composer-sidebar-send",disabled:!Ce||bl||!aa.trim(),onClick:()=>void Tf(),"aria-label":"发送 AI 对话",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_upward"})})]})]})}):!ht&&!$n&&pe&&tn?i.jsx("aside",{className:"af-pipeline-drawer af-workspace-node-drawer","aria-label":"Workspace Node Properties",children:i.jsx(nU,{draft:pe,setDraft:Be,definitionId:String(((XS=tn.data)==null?void 0:XS.definitionId)||tn.id),systemPromptReadonly:String(((QS=tn.data)==null?void 0:QS.description)||""),modelLists:oa,disabled:!Ce,onIdBlur:()=>Ig(!0),onClose:()=>he(""),onPublishToMarketplace:s$,error:Et,ioSlots:{inputs:Array.isArray(pe==null?void 0:pe.inputs)?pe.inputs:[],outputs:Array.isArray(pe==null?void 0:pe.outputs)?pe.outputs:[]}})}):null,!ht&&!$n&&Gc?sr.createPortal(i.jsx("div",{className:"af-workspace-run-logs-overlay",role:"presentation",onMouseDown:()=>dl(null),children:i.jsx("aside",{className:"af-workspace-run-logs-drawer","aria-label":"Workspace Run Logs",onMouseDown:x=>x.stopPropagation(),children:i.jsx(Bq,{flowParams:o,scheduleNodeId:Gc.scheduleNodeId,runNodeId:Gc.runNodeId,lastRunId:Gc.lastRunId,label:Gc.label,onClose:()=>dl(null)})})}),document.body):null,i.jsx(Oq,{open:vg,onClose:()=>yf(!1)}),i.jsx(Fq,{open:Sg,onClose:()=>Xv(!1),onJump:Rg,nodes:h$}),i.jsx(rU,{open:d,onClose:()=>p(!1),flowId:o.flowId||"",flowSource:eu,onArchived:()=>{p(!1),n("/projects?tab=archived")}}),i.jsx(sU,{open:f&&!!o.flowId,onClose:()=>h(!1),flowId:o.flowId||"",flowSource:eu,flowArchived:!!o.archived,workspaceId:o.workspaceId||"",leaveShared:tu,onDeleted:async()=>{h(!1),n("/projects")}}),RM&&Nn?sr.createPortal(i.jsx("div",{className:"af-flow-snippet-modal-overlay",children:i.jsxs("div",{className:"af-flow-snippet-modal af-workspace-conflict-modal",role:"dialog","aria-modal":"true","aria-label":"解决 Workspace 冲突",children:[i.jsxs("div",{className:"af-flow-snippet-modal__head",children:[i.jsxs("span",{className:"af-flow-snippet-modal__title",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"difference"}),"解决 ",((ZS=Nn.conflictItems)==null?void 0:ZS.length)||0," 处字段冲突"]}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>ia(!1),"aria-label":"关闭",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),i.jsxs("div",{className:"af-flow-snippet-modal__body",children:[i.jsxs("div",{className:"af-workspace-conflict-summary",children:["未冲突的改动已经自动合并。这里只需要决定双方同时修改的字段。",i.jsxs("div",{className:"af-workspace-conflict-bulk",children:[i.jsx("button",{type:"button",onClick:()=>il(Object.fromEntries((Nn.conflictItems||[]).map((x,S)=>[String(S),{mode:"local",manual:Su(x)}]))),children:"全部保留我的"}),i.jsx("button",{type:"button",onClick:()=>il(Object.fromEntries((Nn.conflictItems||[]).map((x,S)=>[String(S),{mode:"remote",manual:Su(x)}]))),children:"全部使用远端"})]})]}),(Nn.conflictItems||[]).map((x,S)=>{const _=ag[String(S)]||{mode:"local",manual:Su(x)};return i.jsxs("section",{className:"af-workspace-conflict-item",children:[i.jsx("code",{className:"af-workspace-conflict-path",children:x.path}),i.jsx("div",{className:"af-workspace-conflict-options",children:[["local","保留我的"],["remote","使用远端"],["manual","手动编辑"]].map(([P,O])=>i.jsx("button",{type:"button",className:_.mode===P?"is-active":"",onClick:()=>il(U=>({...U,[String(S)]:{..._,mode:P}})),children:O},P))}),i.jsxs("div",{className:"af-workspace-conflict-values",children:[i.jsxs("div",{className:_.mode==="local"?"is-selected":"",children:[i.jsx("span",{children:"我的修改"}),i.jsx("pre",{children:NC(x,"incoming")})]}),i.jsxs("div",{className:_.mode==="remote"?"is-selected":"",children:[i.jsx("span",{children:"远端修改"}),i.jsx("pre",{children:NC(x,"current")})]})]}),_.mode==="manual"?i.jsxs("label",{className:"af-workspace-conflict-manual",children:[i.jsx("span",{children:"最终值(JSON)"}),i.jsx("textarea",{value:_.manual,onChange:P=>il(O=>({...O,[String(S)]:{..._,manual:P.target.value}})),rows:5})]}):null]},`${x.path||"conflict"}-${S}`)}),vv?i.jsx("div",{className:"af-flow-snippet-error",children:vv}):null]}),i.jsxs("div",{className:"af-flow-snippet-modal__foot af-workspace-conflict-foot",children:[i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",disabled:df,onClick:()=>void KS(),children:"备份并载入远端"}),i.jsx("span",{className:"af-workspace-conflict-foot__spacer"}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",disabled:df,onClick:()=>ia(!1),children:"稍后处理"}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:df||!(Nn.conflictItems||[]).length,onClick:()=>void N$(),children:df?"保存中...":"应用选择并保存"})]})]})}),document.body):null,ee?sr.createPortal(i.jsx("div",{className:"af-flow-snippet-modal-overlay",children:i.jsxs("div",{className:"af-flow-snippet-modal",role:"dialog","aria-modal":"true","aria-label":"发布流程片段",children:[i.jsxs("div",{className:"af-flow-snippet-modal__head",children:[i.jsxs("span",{className:"af-flow-snippet-modal__title",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"ios_share"}),"发布流程片段"]}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>Ie(!1),"aria-label":"关闭",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),i.jsxs("div",{className:"af-flow-snippet-modal__body",children:[i.jsxs("label",{className:"af-flow-snippet-field",children:[i.jsx("span",{children:"名称"}),i.jsx("input",{type:"text",value:Fe.name,onChange:x=>{const S=x.target.value;Je(_=>({..._,name:S,id:_.id?_.id:S.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")}))},placeholder:"例如:内容整理片段",autoFocus:!0})]}),i.jsxs("label",{className:"af-flow-snippet-field",children:[i.jsx("span",{children:"ID"}),i.jsx("input",{type:"text",value:Fe.id,onChange:x=>Je(S=>({...S,id:x.target.value})),placeholder:"content-cleanup-snippet"})]}),i.jsxs("label",{className:"af-flow-snippet-field",children:[i.jsx("span",{children:"说明"}),i.jsx("textarea",{value:Fe.description,onChange:x=>Je(S=>({...S,description:x.target.value})),placeholder:"这段流程适合什么 workspace 场景、需要接哪些上下游。",rows:4})]}),i.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",Qn.length," 个节点和 ",Af.length," 条内部连线。"]}),lr?i.jsx("div",{className:"af-flow-snippet-error",children:lr}):null]}),i.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>Ie(!1),children:"取消"}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:Pt||!Fe.name.trim(),onClick:()=>void k$(),children:Pt?"发布中...":"发布"})]})]})}),document.body):null,$S?i.jsx(aG,{node:$S,onClose:()=>se("")}):null,Un?sr.createPortal(i.jsx("div",{className:"af-flow-snippet-modal-overlay",children:i.jsxs("div",{className:"af-flow-snippet-modal af-display-share-modal",role:"dialog","aria-modal":"true","aria-label":mo?"新建分享":"发布展示页",children:[i.jsxs("div",{className:"af-flow-snippet-modal__head",children:[i.jsxs("span",{className:"af-flow-snippet-modal__title",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"present_to_all"}),mo?"新建分享":"发布展示页"]}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>Yn(!1),"aria-label":"关闭",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),i.jsxs("div",{className:"af-flow-snippet-modal__body",children:[i.jsxs("label",{className:"af-flow-snippet-field",children:[i.jsx("span",{children:"标题"}),i.jsx("input",{type:"text",value:Ft.title,onChange:x=>fn(S=>({...S,title:x.target.value})),placeholder:"展示页标题",autoFocus:!0})]}),mo?null:i.jsxs("label",{className:"af-flow-snippet-field",children:[i.jsx("span",{children:"布局"}),i.jsxs("select",{className:"af-display-share-select",value:Ft.layout,onChange:x=>fn(S=>({...S,layout:x.target.value})),children:[i.jsx("option",{value:"gallery",children:"Gallery"}),i.jsx("option",{value:"document",children:"Document"}),i.jsx("option",{value:"slides",children:"Slides"})]})]}),i.jsxs("label",{className:"af-flow-snippet-field",children:[i.jsx("span",{children:"有效期"}),i.jsx("select",{className:"af-display-share-select",value:lC(Ft),onChange:x=>{const S=x.target.value;fn(_=>({..._,permanent:S==="permanent",expiresInDays:S==="permanent"?_.expiresInDays||30:Number(S)}))},children:Gy.map(x=>i.jsx("option",{value:x.value,children:x.label},x.value))})]}),i.jsxs("div",{className:"af-display-share-node-list",role:"group","aria-label":mo?"分享内容":"选择展示节点",children:[mo?i.jsx("span",{className:"af-display-share-node-list__label",children:"分享内容"}):null,e2.map(x=>{var _;const S=Array.isArray(Ft.nodeIds)&&Ft.nodeIds.includes(x.id);return i.jsxs("label",{className:"af-display-share-node-row",children:[i.jsx("input",{type:"checkbox",checked:S,disabled:mo,onChange:()=>j$(x.id)}),i.jsxs("span",{className:"af-display-share-node-row__main",children:[i.jsx("strong",{children:((_=x.data)==null?void 0:_.label)||x.id}),i.jsxs("small",{children:[Cn(x.data)," · ",x.id]})]})]},x.id)})]}),mt!=null&&mt.absoluteUrl?i.jsxs("div",{className:"af-display-share-result",children:[i.jsx("input",{type:"text",readOnly:!0,value:mt.absoluteUrl,onFocus:x=>x.target.select()}),i.jsx("button",{type:"button",onClick:()=>window.open(mt.absoluteUrl,"_blank","noopener,noreferrer"),children:"打开"}),i.jsx("button",{type:"button",onClick:()=>void qS(),children:Wt==="copied"?"已复制":Wt==="failed"?"复制失败":"复制"})]}):null,Xr?i.jsx("div",{className:"af-flow-snippet-error",children:Xr}):null]}),i.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>Yn(!1),children:"取消"}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:cr||!Array.isArray(Ft.nodeIds)||Ft.nodeIds.length===0,onClick:()=>void _$(),children:cr?"生成中...":"生成链接"})]})]})}),document.body):null,ri?sr.createPortal(i.jsx("div",{className:"af-flow-snippet-modal-overlay",children:i.jsxs("div",{className:"af-flow-snippet-modal af-display-link-modal",role:"dialog","aria-modal":"true","aria-label":"展示链接",children:[i.jsxs("div",{className:"af-flow-snippet-modal__head",children:[i.jsxs("span",{className:"af-flow-snippet-modal__title",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"link"}),"展示链接"]}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>{ae(""),ur(!1)},"aria-label":"关闭",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),i.jsxs("div",{className:"af-flow-snippet-modal__body",children:[mt!=null&&mt.absoluteUrl?i.jsxs("div",{className:"af-display-link-modal__url",children:[i.jsx("input",{type:"text",readOnly:!0,value:mt.absoluteUrl,onFocus:x=>x.target.select(),autoFocus:!0}),i.jsxs("button",{type:"button",onClick:()=>window.open(mt.absoluteUrl,"_blank","noopener,noreferrer"),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"}),"打开"]}),i.jsxs("button",{type:"button",onClick:()=>void qS(),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Wt==="copied"?"check":"content_copy"}),Wt==="copied"?"已复制":Wt==="failed"?"复制失败":"复制"]})]}):i.jsx("div",{className:"af-display-link-modal__empty",children:"还没有生成展示链接"}),i.jsxs("label",{className:"af-flow-snippet-field",children:[i.jsx("span",{children:"新链接有效期"}),i.jsx("select",{className:"af-display-share-select",value:lC(Ft),onChange:x=>{const S=x.target.value;fn(_=>({..._,permanent:S==="permanent",expiresInDays:S==="permanent"?_.expiresInDays||30:Number(S)}))},children:Gy.map(x=>i.jsx("option",{value:x.value,children:x.label},x.value))})]}),Xr?i.jsx("div",{className:"af-flow-snippet-error",children:Xr}):null]}),i.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>{ae(""),ur(!1)},children:"关闭"}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:cr||N.nodeIds.length===0,onClick:()=>void E$(),children:cr?"生成中...":mt!=null&&mt.absoluteUrl?"更新链接":"生成链接"})]})]})}),document.body):null,IM?sr.createPortal(i.jsx("div",{className:"af-flow-snippet-modal-overlay",children:i.jsxs("div",{className:"af-flow-snippet-modal af-display-share-modal",role:"dialog","aria-modal":"true","aria-label":"协作分享",children:[i.jsxs("div",{className:"af-flow-snippet-modal__head",children:[i.jsxs("span",{className:"af-flow-snippet-modal__title",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"group_add"}),"协作分享"]}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>ig(!1),"aria-label":"关闭",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),i.jsxs("div",{className:"af-flow-snippet-modal__body",children:[i.jsx("p",{className:"af-display-link-modal__empty",children:"输入已注册用户名。添加后,这个 Workspace 会直接出现在对方的项目列表中。"}),i.jsxs("div",{className:"af-workspace-member-add",children:[i.jsx("input",{type:"text",value:Hc,onChange:x=>wv(x.target.value),onKeyDown:x=>{x.key==="Enter"&&Hc.trim()&&!og&&(x.preventDefault(),VS())},placeholder:"输入用户名",autoFocus:!0}),i.jsx("button",{type:"button",disabled:og||!Hc.trim(),onClick:()=>void VS(),children:og?"添加中...":"添加成员"})]}),yv?i.jsx("div",{className:"af-flow-snippet-error",children:yv}):null,i.jsx("div",{className:"af-workspace-member-list",children:((Zt==null?void 0:Zt.members)||[]).map(x=>{const S=x.userId===(Zt==null?void 0:Zt.ownerId)||x.role==="owner";return i.jsxs("div",{className:"af-workspace-member-row",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:S?"shield_person":"person"}),i.jsxs("div",{children:[i.jsx("strong",{children:x.username||x.userId}),i.jsx("small",{children:S?"所有者":x.role==="viewer"?"只读成员":"编辑成员"})]}),S?null:i.jsx("button",{type:"button",disabled:xv===x.userId,onClick:()=>void S$(x),children:xv===x.userId?"移除中...":"取消分享"})]},x.userId)})})]}),i.jsx("div",{className:"af-flow-snippet-modal__foot",children:i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>ig(!1),children:"完成"})})]})}),document.body):null,ke?sr.createPortal(i.jsx("div",{className:"af-flow-snippet-modal-overlay",children:i.jsxs("div",{className:"af-flow-snippet-modal af-display-shares-modal",role:"dialog","aria-modal":"true","aria-label":"我的分享",children:[i.jsxs("div",{className:"af-flow-snippet-modal__head",children:[i.jsxs("span",{className:"af-flow-snippet-modal__title",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder_shared"}),"我的分享"]}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>ot(!1),"aria-label":"关闭",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),i.jsxs("div",{className:"af-flow-snippet-modal__body",children:[i.jsxs("div",{className:"af-display-shares-toolbar",children:[i.jsx("span",{children:xt.length?`${xt.length} 个分享`:"暂无分享"}),i.jsxs("button",{type:"button",onClick:()=>void Ls(),disabled:on,children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),"刷新"]})]}),Qr?i.jsx("div",{className:"af-flow-snippet-error",children:Qr}):null,on?i.jsx("div",{className:"af-display-link-modal__empty",children:"Loading..."}):null,!on&&xt.length===0?i.jsx("div",{className:"af-display-link-modal__empty",children:"还没有创建过展示分享"}):null,i.jsx("div",{className:"af-display-shares-list",children:xt.map(x=>{const S=uC(x),_=qt===x.id,P=x.expiresAt?String(x.expiresInDays||30):"permanent";return i.jsxs("article",{className:"af-display-share-item",children:[i.jsxs("div",{className:"af-display-share-item__main",children:[i.jsx("strong",{children:x.title||"AgentFlow Display"}),i.jsxs("span",{children:[x.flowId||"-"," · ",x.layout||"gallery"," · ",Array.isArray(x.nodeIds)?x.nodeIds.length:0," nodes"]}),i.jsx("small",{children:HY(x)})]}),i.jsx("input",{className:"af-display-share-item__url",type:"text",readOnly:!0,value:S,onFocus:O=>O.target.select()}),i.jsx("select",{className:"af-display-share-select",value:P,disabled:_,onChange:O=>void P$(x,O.target.value),"aria-label":"修改分享有效期",children:Gy.map(O=>i.jsx("option",{value:O.value,children:O.label},O.value))}),i.jsxs("div",{className:"af-display-share-item__actions",children:[i.jsxs("button",{type:"button",onClick:()=>window.open(S,"_blank","noopener,noreferrer"),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"}),"打开"]}),i.jsxs("button",{type:"button",onClick:()=>void A$(x),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:wr===x.id?"check":"content_copy"}),wr===x.id?"已复制":"复制"]}),i.jsxs("button",{type:"button",className:"af-display-share-item__danger",disabled:_,onClick:()=>void I$(x),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:_?"hourglass_empty":"link_off"}),"撤销"]})]})]},x.id)})})]})]})}),document.body):null,_r?sr.createPortal(i.jsx("div",{className:"af-flow-snippet-modal-overlay",children:i.jsxs("div",{className:"af-flow-snippet-modal af-display-picker-modal",role:"dialog","aria-modal":"true","aria-label":"选择展示节点",children:[i.jsxs("div",{className:"af-flow-snippet-modal__head",children:[i.jsxs("span",{className:"af-flow-snippet-modal__title",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add_to_photos"}),"选择展示节点"]}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>Or(!1),"aria-label":"关闭",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),i.jsxs("div",{className:"af-flow-snippet-modal__body",children:[i.jsxs("label",{className:"af-display-picker-search",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),i.jsx("input",{type:"search",value:si,onChange:x=>co(x.target.value),placeholder:"搜索展示节点...",autoFocus:!0})]}),i.jsx("div",{className:"af-display-picker-grid",role:"group","aria-label":"选择展示节点",style:{"--af-display-picker-columns":BS.length||1},children:Pf.length>0?BS.map((x,S)=>i.jsx("div",{className:"af-display-picker-column",children:x.map(x$)},`display-picker-column-${S}`)):i.jsx("div",{className:"af-display-picker-empty",children:gl.length===0?"当前 Workspace 没有 display 节点":"没有匹配的展示节点"})})]}),i.jsx("div",{className:"af-flow-snippet-modal__foot",children:i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",onClick:()=>Or(!1),children:"完成"})})]})}),document.body):null,Vc.nodeId?sr.createPortal(i.jsx(CG,{files:xr,query:Vc.query,onQueryChange:x=>dg(S=>({...S,query:x})),onSelect:l$,onUpload:_S,onClose:Eg}),document.body):null,!ht&&!$n&&Ne?sr.createPortal(i.jsx("div",{className:"af-workspace-quick-add-backdrop",onMouseDown:()=>Pe(!1),children:i.jsxs("div",{className:"af-workspace-quick-add",role:"dialog","aria-modal":"true","aria-label":"Add workspace node",onMouseDown:x=>x.stopPropagation(),children:[i.jsxs("div",{className:"af-workspace-quick-add__tabs",role:"tablist","aria-label":"选择添加类型",children:[i.jsx("button",{type:"button",role:"tab","aria-selected":lt==="nodes",className:"af-workspace-quick-add__tab"+(lt==="nodes"?" af-workspace-quick-add__tab--active":""),onClick:()=>zt("nodes"),children:"节点"}),i.jsx("button",{type:"button",role:"tab","aria-selected":lt==="flows",className:"af-workspace-quick-add__tab"+(lt==="flows"?" af-workspace-quick-add__tab--active":""),onClick:()=>zt("flows"),children:"流程"})]}),i.jsxs("div",{className:"af-workspace-quick-add__search",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),i.jsx("input",{ref:Wv,value:Mt,onChange:x=>Xn(x.target.value),onKeyDown:x=>{if(x.key==="Escape")x.preventDefault(),Pe(!1);else if(x.key==="ArrowDown"){x.preventDefault();const S=lt==="flows"?ou.length:iu.length;Er(_=>Math.min(Math.max(0,S-1),_+1))}else x.key==="ArrowUp"?(x.preventDefault(),Er(S=>Math.max(0,S-1))):x.key==="Tab"?(x.preventDefault(),zt(S=>S==="nodes"?"flows":"nodes")):x.key==="Enter"&&(x.preventDefault(),lt==="flows"?YS(ou[pn]||ou[0]):US(iu[pn]||iu[0]))},placeholder:lt==="flows"?"搜索流程片段...":"搜索节点...","aria-label":lt==="flows"?"搜索流程片段":"搜索节点"})]}),i.jsx("div",{className:"af-workspace-quick-add__list",children:lt==="flows"?ou.length===0?i.jsx("div",{className:"af-workspace-quick-add__empty",children:vn?"正在加载流程片段...":nn||"没有匹配的流程片段"}):ou.map((x,S)=>{const _=x.displayName||x.name||x.id,P=x.snippet&&typeof x.snippet=="object"?x.snippet.instances:null,O=x.snippet&&typeof x.snippet=="object"?x.snippet.edges:null,U=Number.isFinite(Number(x.nodeCount))?Number(x.nodeCount):Object.keys(P||{}).length,J=Number.isFinite(Number(x.edgeCount))?Number(x.edgeCount):Array.isArray(O)?O.length:0;return i.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(S===pn?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>Er(S),onClick:()=>YS(x),children:[i.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:"schema"}),i.jsxs("span",{className:"af-workspace-quick-add__main",children:[i.jsx("span",{className:"af-workspace-quick-add__label",children:_}),i.jsxs("span",{className:"af-workspace-quick-add__meta",children:[x.id,x.version?` · v${x.version}`:""]}),i.jsx("span",{className:"af-workspace-quick-add__desc",children:x.description||`${U} 节点 / ${J} 连线`})]}),i.jsx("span",{className:"af-workspace-quick-add__cat",children:"FLOW"})]},`${x.id}@${x.version}`)}):iu.length===0?i.jsx("div",{className:"af-workspace-quick-add__empty",children:"没有匹配的节点"}):iu.map((x,S)=>{const _=Mu(x),P=$u(x),O=Jx(x);return i.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(S===pn?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>Er(S),onClick:()=>US(x),children:[i.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:nC(_)}),i.jsxs("span",{className:"af-workspace-quick-add__main",children:[i.jsx("span",{className:"af-workspace-quick-add__label",children:P}),i.jsx("span",{className:"af-workspace-quick-add__meta",children:x.id}),O?i.jsx("span",{className:"af-workspace-quick-add__desc",children:O}):null]}),i.jsx("span",{className:"af-workspace-quick-add__cat",children:_})]},x.id)})})]})}),document.body):null]})]})}function YG(){return i.jsx(Nk,{children:i.jsx(UG,{})})}function GG(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(),o=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)||(o?r(o):""))}function JG(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 XG(e){let t=String(e||"").replace(/\r\n/g,`
|
|
265
|
-
`).trim();return t.includes(`
|
|
266
|
-
`)||(t=t.replace(/\s+(resultFile|result|outParams|outParams\.[A-Za-z_][A-Za-z0-9_-]*)\s*:/g,`
|
|
267
|
-
$1:`).replace(/(^|\n)outParams:\s+([A-Za-z_][A-Za-z0-9_-]*\s*:)/g,`$1outParams:
|
|
268
|
-
$2`)),t}function OT(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=XG(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 d=String(c[1]||"").trim();return d==="|"||d===">"?a.slice((c.index||0)+c[0].length).split(`
|
|
269
|
-
`).filter(f=>/^\s+/.test(f)||!f.trim()).map(f=>f.replace(/^\s{2}/,"")).join(`
|
|
270
|
-
`).replace(/\s+$/g,""):d.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("{"),o=t.lastIndexOf("}");s>=0&&o>s&&r.unshift(t.slice(s,o+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 nv(e){let t=OT(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 o=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*)$/);o&&o[1]&&(t=o[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((o,a)=>{const l=a.exec(t);return l?o<0?l.index:Math.min(o,l.index):o},-1);return s>0&&(t=t.slice(s).trim()),t}function QG(e){const t=nv(e);return t.trim()?/<[^>]*$/g.test(t)?"HTML 内容末尾存在未闭合标签,可能是生成或保存时被截断。":/^(?:<!doctype\b|<html\b)/i.test(t)&&!/<\/html\s*>/i.test(t)?"完整 HTML 文档缺少 </html> 结束标签,可能是生成或保存时被截断。":"":""}function ZG(e){const t=nv(e);if(!t.trim())return"";const n=`<base target="_blank"><script data-agentflow-display-link-guard="1">
|
|
271
|
-
(() => {
|
|
272
|
-
document.addEventListener("click", (event) => {
|
|
273
|
-
const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
|
|
274
|
-
if (!link) return;
|
|
275
|
-
const rawHref = String(link.getAttribute("href") || "").trim();
|
|
276
|
-
if (!rawHref || rawHref.startsWith("#")) return;
|
|
277
|
-
if (/^javascript:/i.test(rawHref)) {
|
|
278
|
-
event.preventDefault();
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
event.preventDefault();
|
|
282
|
-
window.open(link.href, "_blank", "noopener,noreferrer");
|
|
283
|
-
}, true);
|
|
284
|
-
})();
|
|
285
|
-
<\/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 DT(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 eJ(e,t,n={}){const r=String(e||"").trim();return r?DT(r,t,n):""}function tJ({className:e="",children:t}){const n=m.useRef(null),r=m.useRef(null),[s,o]=m.useState({visible:!1,top:0,height:100}),a=m.useCallback(()=>{const d=n.current;if(!d)return;const p=Math.max(1,d.scrollHeight),f=Math.max(1,d.clientHeight),h=p>f+1,g=h?Math.max(12,f/p*100):100,k=Math.max(0,100-g),b=h?Math.min(k,d.scrollTop/Math.max(1,p-f)*k):0;o({visible:h,top:b,height:g})},[]);m.useEffect(()=>{const d=requestAnimationFrame(a),p=n.current;if(!p||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(d);const f=new ResizeObserver(a);f.observe(p);for(const h of Array.from(p.children))f.observe(h);return()=>{cancelAnimationFrame(d),f.disconnect()}},[t,a]);const l=m.useCallback(d=>{const p=n.current;if(!p)return;const f=Math.max(0,p.scrollHeight-p.clientHeight);p.scrollTop=Math.min(1,Math.max(0,d))*f,a()},[a]),c=m.useCallback((d,p=0)=>{const f=r.current;if(!f)return 0;const h=f.getBoundingClientRect(),g=s.height/100*h.height,k=Math.max(1,h.height-g);return(d-h.top-p)/k},[s.height]),u=m.useCallback(d=>{if(!s.visible)return;d.preventDefault(),d.stopPropagation();const p=r.current;if(!p)return;const f=p.getBoundingClientRect(),h=s.top/100*f.height,g=s.height/100*f.height,b=d.clientY>=f.top+h&&d.clientY<=f.top+h+g?d.clientY-f.top-h:g/2;l(c(d.clientY,b));const y=w=>{w.preventDefault(),l(c(w.clientY,b))},v=()=>{window.removeEventListener("pointermove",y),window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v)};window.addEventListener("pointermove",y),window.addEventListener("pointerup",v),window.addEventListener("pointercancel",v)},[c,l,s.height,s.top,s.visible]);return i.jsxs("div",{className:`af-public-display-node__body ${e} nowheel nopan nodrag`,children:[i.jsx("div",{ref:n,className:`af-public-display-node__scroller ${e} nowheel nopan nodrag`,onScroll:a,children:t}),i.jsx("div",{ref:r,className:"af-public-display-scrollbar"+(s.visible?" af-public-display-scrollbar--visible":""),onPointerDown:u,"aria-hidden":"true",children:i.jsx("span",{style:{height:`${s.height}%`,top:`${s.top}%`}})})]})}function tb({node:e,shareId:t,style:n,bare:r=!1}){const s=GG(e),o=e.kind==="html"?nv(s):e.kind==="react"?Ym(s):OT(s),a=e.kind==="html"?QG(o):"",l=`af-public-display-node__body--${e.kind||"unknown"}`;return i.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:i.jsx("div",{className:"af-public-display-node__head",children:i.jsxs("div",{className:"af-public-display-node__title",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:JG(e.kind)}),i.jsx("strong",{children:e.label||e.id}),i.jsx("em",{children:e.definitionId||e.kind||"display"})]})}),i.jsx(tJ,{className:l,children:a?i.jsx("div",{className:"af-public-display-empty",children:a}):o.trim()?i.jsxs(i.Fragment,{children:[e.kind==="html"?i.jsx("iframe",{title:e.label||e.id,sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox",srcDoc:ZG(o)}):null,e.kind==="react"?i.jsx("iframe",{title:e.label||e.id,sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox",srcDoc:Uk(o)}):null,e.kind==="image"?i.jsx("img",{src:DT(o,t),alt:e.label||e.id,loading:"lazy"}):null,e.kind==="markdown"?i.jsx("div",{className:"af-public-display-markdown",children:i.jsx(Bk,{content:o,resolveSrc:(c,u)=>eJ(c,t,u)})}):null,e.kind==="chart"?i.jsx(Wk,{content:o}):null,e.kind==="table"?i.jsx(Hk,{content:o}):null,e.kind==="mermaid"||e.kind==="ascii"?i.jsx("pre",{children:o}):null]}):i.jsx("div",{className:"af-public-display-empty",children:"No display content"})})]})}function nJ({data:e}){return i.jsx(tb,{node:e==null?void 0:e.node,shareId:e==null?void 0:e.shareId})}const rJ={publicDisplay:nJ};function sJ(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 FT(){var l,c,u,d;const{path:e}=ei(),t=m.useMemo(()=>sJ(e),[e]),[n,r]=m.useState({loading:!0,error:"",share:null,nodes:[]});m.useEffect(()=>{let p=!1;async function f(){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)}`),g=await h.json().catch(()=>({}));if(!h.ok)throw new Error(g.error||"展示页不存在");p||r({loading:!1,error:"",share:g.share||null,nodes:Array.isArray(g.nodes)?g.nodes:[]})}catch(h){p||r({loading:!1,error:String((h==null?void 0:h.message)||h),share:null,nodes:[]})}}return f(),()=>{p=!0}},[t]);const s=m.useMemo(()=>(Array.isArray(n.nodes)?n.nodes:[]).map((f,h)=>{const g=f.position&&typeof f.position.x=="number"&&typeof f.position.y=="number"?f.position:{x:120+h*40,y:100+h*32},k=f.size&&typeof f.size.width=="number"&&typeof f.size.height=="number"?f.size:{width:520,height:320};return{id:f.id,type:"publicDisplay",position:g,data:{node:f,shareId:t},selectable:!1,draggable:!1,style:{width:Math.max(1,Number(k.width)||520),height:Math.max(1,Number(k.height)||320)}}}),[t,n.nodes]),o=m.useMemo(()=>{var k;const p=(k=n.share)==null?void 0:k.viewport;if(!p||typeof p!="object")return null;const f=Number(p.x),h=Number(p.y),g=Number(p.zoom);return!Number.isFinite(f)||!Number.isFinite(h)||!Number.isFinite(g)?null:{x:f,y:h,zoom:Math.min(Math.max(g,.1),4)}},[(l=n.share)==null?void 0:l.viewport]);if(n.loading)return i.jsx("main",{className:"af-public-display-page",children:i.jsx("div",{className:"af-public-display-status",children:"Loading..."})});if(n.error)return i.jsx("main",{className:"af-public-display-page",children:i.jsxs("div",{className:"af-public-display-status af-public-display-status--error",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"error"}),i.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 i.jsx("main",{className:"af-public-display-page af-public-display-page--single",children:i.jsx("div",{className:"af-public-display-grid",children:(n.nodes||[]).map(f=>i.jsx(tb,{node:f,shareId:t,bare:!0},f.id))})});const p=a==="slides"?"af-public-display-page--slides":a==="document"?"af-public-display-page--document":"af-public-display-page--gallery";return i.jsxs("main",{className:`af-public-display-page ${p}`,children:[i.jsxs("header",{className:"af-public-display-hero",children:[i.jsxs("div",{children:[i.jsx("p",{children:"AgentFlow Display"}),i.jsx("h1",{children:((u=n.share)==null?void 0:u.title)||"AgentFlow Display"})]}),i.jsx("span",{children:(d=n.share)!=null&&d.expiresAt?`有效期至 ${new Date(n.share.expiresAt).toLocaleString()}`:"永久有效"})]}),i.jsx("div",{className:"af-public-display-grid",children:(n.nodes||[]).map(f=>i.jsx(tb,{node:f,shareId:t},f.id))})]})}return i.jsx("main",{className:"af-public-display-page af-public-display-page--canvas",children:i.jsx(Nk,{children:i.jsx(WI,{className:"af-public-display-flow",nodes:s,edges:[],nodeTypes:rJ,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnDrag:!0,noPanClassName:"nopan",noDragClassName:"nodrag",noWheelClassName:"nowheel",panOnScroll:!0,zoomOnScroll:!0,zoomOnPinch:!0,defaultViewport:o||void 0,fitView:!o,fitViewOptions:{padding:.18,duration:180},minZoom:.1,maxZoom:4,proOptions:{hideAttribution:!0},children:i.jsx(KI,{color:"rgba(255,255,255,0.12)",gap:22,size:1})})})})}const wt=e=>typeof e=="string",Nu=()=>{let e,t;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n},jC=e=>e==null?"":""+e,iJ=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},oJ=/###/g,CC=e=>e&&e.indexOf("###")>-1?e.replace(oJ,"."):e,_C=e=>!e||wt(e),nd=(e,t,n)=>{const r=wt(t)?t.split("."):t;let s=0;for(;s<r.length-1;){if(_C(e))return{};const o=CC(r[s]);!e[o]&&n&&(e[o]=new n),Object.prototype.hasOwnProperty.call(e,o)?e=e[o]:e={},++s}return _C(e)?{}:{obj:e,k:CC(r[s])}},EC=(e,t,n)=>{const{obj:r,k:s}=nd(e,t,Object);if(r!==void 0||t.length===1){r[s]=n;return}let o=t[t.length-1],a=t.slice(0,t.length-1),l=nd(e,a,Object);for(;l.obj===void 0&&a.length;)o=`${a[a.length-1]}.${o}`,a=a.slice(0,a.length-1),l=nd(e,a,Object),l&&l.obj&&typeof l.obj[`${l.k}.${o}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${o}`]=n},aJ=(e,t,n,r)=>{const{obj:s,k:o}=nd(e,t,Object);s[o]=s[o]||[],s[o].push(n)},sm=(e,t)=>{const{obj:n,k:r}=nd(e,t);if(n)return n[r]},lJ=(e,t,n)=>{const r=sm(e,n);return r!==void 0?r:sm(t,n)},zT=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?wt(e[r])||e[r]instanceof String||wt(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):zT(e[r],t[r],n):e[r]=t[r]);return e},Al=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var cJ={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const uJ=e=>wt(e)?e.replace(/[&<>"'\/]/g,t=>cJ[t]):e;class dJ{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 fJ=[" ",",","?","!",";"],pJ=new dJ(20),hJ=(e,t,n)=>{t=t||"",n=n||"";const r=fJ.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const s=pJ.getRegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let o=!s.test(e);if(!o){const a=e.indexOf(n);a>0&&!s.test(e.substring(0,a))&&(o=!0)}return o},nb=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 o=0;o<r.length;){if(!s||typeof s!="object")return;let a,l="";for(let c=o;c<r.length;++c)if(c!==o&&(l+=n),l+=r[c],a=s[l],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&c<r.length-1)continue;o+=c-o+1;break}s=a}return s},im=e=>e&&e.replace("_","-"),mJ={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class om{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||mJ,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:(wt(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new om(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new om(this.logger,t)}}var xi=new om;class Qm{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 AC extends Qm{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 o=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):wt(r)&&o?l.push(...r.split(o)):l.push(r)));const c=sm(this.data,l);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=l[0],n=l[1],r=l.slice(2).join(".")),c||!a||!wt(r)?c:nb(this.data&&this.data[t]&&this.data[t][n],r,o)}addResource(t,n,r,s){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=o.keySeparator!==void 0?o.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),EC(this.data,l,s),o.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 o in r)(wt(r[o])||Array.isArray(r[o]))&&this.addResource(t,n,o,r[o],{silent:!0});s.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,s,o){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},l=[t,n];t.indexOf(".")>-1&&(l=t.split("."),s=r,r=n,n=l[1]),this.addNamespaces(n);let c=sm(this.data,l)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?zT(c,r,o):c={...c,...r},EC(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 BT={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,s){return e.forEach(o=>{this.processors[o]&&(t=this.processors[o].process(t,n,r,s))}),t}};const PC={};class am extends Qm{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),iJ(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=xi.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 o=n.ns||this.options.defaultNS||[];const a=r&&t.indexOf(r)>-1,l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!hJ(t,r,s);if(a&&!l){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:wt(o)?[o]:o};const u=t.split(r);(r!==s||r===s&&this.options.ns.indexOf(u[0])>-1)&&(o=u.shift()),t=u.join(s)}return{key:t,namespaces:wt(o)?[o]:o}}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,o=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,d=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(d){const C=n.nsSeparator||this.options.nsSeparator;return s?{res:`${c}${C}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${C}${a}`}return s?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:a}const p=this.resolve(t,n);let f=p&&p.res;const h=p&&p.usedKey||a,g=p&&p.exactUsedKey||a,k=Object.prototype.toString.apply(f),b=["[object Number]","[object Function]","[object RegExp]"],y=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,w=!wt(f)&&typeof f!="boolean"&&typeof f!="number";if(v&&f&&w&&b.indexOf(k)<0&&!(wt(y)&&Array.isArray(f))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const C=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,f,{...n,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return s?(p.res=C,p.usedParams=this.getUsedParamsDetails(n),p):C}if(o){const C=Array.isArray(f),N=C?[]:{},j=C?g:h;for(const A in f)if(Object.prototype.hasOwnProperty.call(f,A)){const I=`${j}${o}${A}`;N[A]=this.translate(I,{...n,joinArrays:!1,ns:l}),N[A]===I&&(N[A]=f[A])}f=N}}else if(v&&wt(y)&&Array.isArray(f))f=f.join(y),f&&(f=this.extendTranslation(f,t,n,r));else{let C=!1,N=!1;const j=n.count!==void 0&&!wt(n.count),A=am.hasDefaultValue(n),I=j?this.pluralResolver.getSuffix(u,n.count,n):"",D=n.ordinal&&j?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",B=j&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),W=B&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${I}`]||n[`defaultValue${D}`]||n.defaultValue;!this.isValidLookup(f)&&A&&(C=!0,f=W),this.isValidLookup(f)||(N=!0,f=a);const T=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&N?void 0:f,M=A&&W!==f&&this.options.updateMissing;if(N||C||M){if(this.logger.log(M?"updateKey":"missingKey",u,c,a,M?W:f),o){const R=this.resolve(a,{...n,keySeparator:!1});R&&R.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 q=[];const H=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&H&&H[0])for(let R=0;R<H.length;R++)q.push(H[R]);else this.options.saveMissingTo==="all"?q=this.languageUtils.toResolveHierarchy(n.lng||this.language):q.push(n.lng||this.language);const L=(R,z,E)=>{const Q=A&&E!==f?E:T;this.options.missingKeyHandler?this.options.missingKeyHandler(R,c,z,Q,M,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(R,c,z,Q,M,n),this.emit("missingKey",R,c,z,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&j?q.forEach(R=>{const z=this.pluralResolver.getSuffixes(R,n);B&&n[`defaultValue${this.options.pluralSeparator}zero`]&&z.indexOf(`${this.options.pluralSeparator}zero`)<0&&z.push(`${this.options.pluralSeparator}zero`),z.forEach(E=>{L([R],a+E,n[`defaultValue${E}`]||W)})}):L(q,a,W))}f=this.extendTranslation(f,t,n,p,r),N&&f===a&&this.options.appendNamespaceToMissingKey&&(f=`${c}:${a}`),(N||C)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}:${a}`:a,C?f:void 0):f=this.options.parseMissingKeyHandler(f))}return s?(p.res=f,p.usedParams=this.getUsedParamsDetails(n),p):f}extendTranslation(t,n,r,s,o){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=wt(t)&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let d;if(u){const f=t.match(this.interpolator.nestingRegexp);d=f&&f.length}let p=r.replace&&!wt(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(p={...this.options.interpolation.defaultVariables,...p}),t=this.interpolator.interpolate(t,p,r.lng||this.language||s.usedLng,r),u){const f=t.match(this.interpolator.nestingRegexp),h=f&&f.length;d<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 f=arguments.length,h=new Array(f),g=0;g<f;g++)h[g]=arguments[g];return o&&o[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=wt(l)?[l]:l;return t!=null&&c&&c.length&&r.applyPostProcessor!==!1&&(t=BT.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,o,a,l;return wt(t)&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(c,n),d=u.key;s=d;let p=u.namespaces;this.options.fallbackNS&&(p=p.concat(this.options.fallbackNS));const f=n.count!==void 0&&!wt(n.count),h=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),g=n.context!==void 0&&(wt(n.context)||typeof n.context=="number")&&n.context!=="",k=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);p.forEach(b=>{this.isValidLookup(r)||(l=b,!PC[`${k[0]}-${b}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&(PC[`${k[0]}-${b}`]=!0,this.logger.warn(`key "${s}" for languages "${k.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),k.forEach(y=>{if(this.isValidLookup(r))return;a=y;const v=[d];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,d,y,b,n);else{let C;f&&(C=this.pluralResolver.getSuffix(y,n.count,n));const N=`${this.options.pluralSeparator}zero`,j=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(v.push(d+C),n.ordinal&&C.indexOf(j)===0&&v.push(d+C.replace(j,this.options.pluralSeparator)),h&&v.push(d+N)),g){const A=`${d}${this.options.contextSeparator}${n.context}`;v.push(A),f&&(v.push(A+C),n.ordinal&&C.indexOf(j)===0&&v.push(A+C.replace(j,this.options.pluralSeparator)),h&&v.push(A+N))}}let w;for(;w=v.pop();)this.isValidLookup(r)||(o=w,r=this.getResource(y,b,w,n))}))})}),{res:r,usedKey:s,exactUsedKey:o,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&&!wt(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 o of n)delete s[o]}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 Qy=e=>e.charAt(0).toUpperCase()+e.slice(1);class IC{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=xi.create("languageUtils")}getScriptPartFromCode(t){if(t=im(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=im(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(wt(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]=Qy(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]=Qy(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=Qy(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(o=>{if(o===s)return o;if(!(o.indexOf("-")<0&&s.indexOf("-")<0)&&(o.indexOf("-")>0&&s.indexOf("-")<0&&o.substring(0,o.indexOf("-"))===s||o.indexOf(s)===0&&s.length>1))return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),wt(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=[],o=a=>{a&&(this.isSupportedCode(a)?s.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return wt(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):wt(t)&&o(this.formatLanguageCode(t)),r.forEach(a=>{s.indexOf(a)<0&&o(this.formatLanguageCode(a))}),s}}let gJ=[{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}],yJ={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 wJ=["v1","v2","v3"],xJ=["v4"],RC={zero:0,one:1,two:2,few:3,many:4,other:5},bJ=()=>{const e={};return gJ.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:yJ[t.fc]}})}),e};class kJ{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=xi.create("pluralResolver"),(!this.options.compatibilityJSON||xJ.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=bJ(),this.pluralRulesCache={}}addRule(t,n){this.rules[t]=n}clearCache(){this.pluralRulesCache={}}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi()){const r=im(t==="dev"?"en":t),s=n.ordinal?"ordinal":"cardinal",o=JSON.stringify({cleanedCode:r,type:s});if(o in this.pluralRulesCache)return this.pluralRulesCache[o];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[o]=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,o)=>RC[s]-RC[o]).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 o=()=>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()}`:o():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!wJ.includes(this.options.compatibilityJSON)}}const TC=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,o=lJ(e,t,n);return!o&&s&&wt(n)&&(o=nb(e,n,r),o===void 0&&(o=nb(t,n,r))),o},Zy=e=>e.replace(/\$/g,"$$$$");class vJ{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=xi.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:o,prefixEscaped:a,suffix:l,suffixEscaped:c,formatSeparator:u,unescapeSuffix:d,unescapePrefix:p,nestingPrefix:f,nestingPrefixEscaped:h,nestingSuffix:g,nestingSuffixEscaped:k,nestingOptionsSeparator:b,maxReplaces:y,alwaysFormat:v}=t.interpolation;this.escape=n!==void 0?n:uJ,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=o?Al(o):a||"{{",this.suffix=l?Al(l):c||"}}",this.formatSeparator=u||",",this.unescapePrefix=d?"":p||"-",this.unescapeSuffix=this.unescapePrefix?"":d||"",this.nestingPrefix=f?Al(f):h||Al("$t("),this.nestingSuffix=g?Al(g):k||Al(")"),this.nestingOptionsSeparator=b||",",this.maxReplaces=y||1e3,this.alwaysFormat=v!==void 0?v:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,s){let o,a,l;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=h=>{if(h.indexOf(this.formatSeparator)<0){const y=TC(n,c,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...s,...n,interpolationkey:h}):y}const g=h.split(this.formatSeparator),k=g.shift().trim(),b=g.join(this.formatSeparator).trim();return this.format(TC(n,c,k,this.options.keySeparator,this.options.ignoreJSONStructure),b,r,{...s,...n,interpolationkey:k})};this.resetRegExp();const d=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,p=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>Zy(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?Zy(this.escape(h)):Zy(h)}].forEach(h=>{for(l=0;o=h.regex.exec(t);){const g=o[1].trim();if(a=u(g),a===void 0)if(typeof d=="function"){const b=d(t,o,s);a=wt(b)?b:""}else if(s&&Object.prototype.hasOwnProperty.call(s,g))a="";else if(p){a=o[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${t}`),a="";else!wt(a)&&!this.useRawValueToEscape&&(a=jC(a));const k=h.safeValue(a);if(t=t.replace(o[0],k),p?(h.regex.lastIndex+=a.length,h.regex.lastIndex-=o[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,o,a;const l=(c,u)=>{const d=this.nestingOptionsSeparator;if(c.indexOf(d)<0)return c;const p=c.split(new RegExp(`${d}[ ]*{`));let f=`{${p[1]}`;c=p[0],f=this.interpolate(f,a);const h=f.match(/'/g),g=f.match(/"/g);(h&&h.length%2===0&&!g||g.length%2!==0)&&(f=f.replace(/'/g,'"'));try{a=JSON.parse(f),u&&(a={...u,...a})}catch(k){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,k),`${c}${d}${f}`}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&&!wt(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 d=s[1].split(this.formatSeparator).map(p=>p.trim());s[1]=d.shift(),c=d,u=!0}if(o=n(l.call(this,s[1].trim(),a),a),o&&s[0]===t&&!wt(o))return o;wt(o)||(o=jC(o)),o||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),o=""),u&&(o=c.reduce((d,p)=>this.format(d,p,r.lng,{...r,interpolationkey:s[1].trim()}),o.trim())),t=t.replace(s[0],o),this.regexp.lastIndex=0}return t}}const SJ=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,""),d=l.trim();n[d]||(n[d]=u),u==="false"&&(n[d]=!1),u==="true"&&(n[d]=!0),isNaN(u)||(n[d]=parseInt(u,10))}})}return{formatName:t,formatOptions:n}},Pl=e=>{const t={};return(n,r,s)=>{let o=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(o={...o,[s.interpolationkey]:void 0});const a=r+JSON.stringify(o);let l=t[a];return l||(l=e(im(r),s),t[a]=l),l(n)}};class NJ{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=xi.create("formatter"),this.options=t,this.formats={number:Pl((n,r)=>{const s=new Intl.NumberFormat(n,{...r});return o=>s.format(o)}),currency:Pl((n,r)=>{const s=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>s.format(o)}),datetime:Pl((n,r)=>{const s=new Intl.DateTimeFormat(n,{...r});return o=>s.format(o)}),relativetime:Pl((n,r)=>{const s=new Intl.RelativeTimeFormat(n,{...r});return o=>s.format(o,r.range||"day")}),list:Pl((n,r)=>{const s=new Intl.ListFormat(n,{...r});return o=>s.format(o)})},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()]=Pl(n)}format(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=n.split(this.formatSeparator);if(o.length>1&&o[0].indexOf("(")>1&&o[0].indexOf(")")<0&&o.find(l=>l.indexOf(")")>-1)){const l=o.findIndex(c=>c.indexOf(")")>-1);o[0]=[o[0],...o.splice(1,l)].join(this.formatSeparator)}return o.reduce((l,c)=>{const{formatName:u,formatOptions:d}=SJ(c);if(this.formats[u]){let p=l;try{const f=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},h=f.locale||f.lng||s.locale||s.lng||r;p=this.formats[u](l,h,{...d,...s,...f})}catch(f){this.logger.warn(f)}return p}else this.logger.warn(`there was no format function for ${u}`);return l},t)}}const jJ=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class CJ extends Qm{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=xi.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 o={},a={},l={},c={};return t.forEach(u=>{let d=!0;n.forEach(p=>{const f=`${u}|${p}`;!r.reload&&this.store.hasResourceBundle(u,p)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?a[f]===void 0&&(a[f]=!0):(this.state[f]=1,d=!1,a[f]===void 0&&(a[f]=!0),o[f]===void 0&&(o[f]=!0),c[p]===void 0&&(c[p]=!0)))}),d||(l[u]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(c)}}loaded(t,n,r){const s=t.split("|"),o=s[0],a=s[1];n&&this.emit("failedLoading",o,a,n),!n&&r&&this.store.addResourceBundle(o,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=>{aJ(c.loaded,[o],a),jJ(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(u=>{l[u]||(l[u]={});const d=c.loaded[u];d.length&&d.forEach(p=>{l[u][p]===void 0&&(l[u][p]=!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,o=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:o,callback:a});return}this.readingCalls++;const l=(u,d)=>{if(this.readingCalls--,this.waitingReads.length>0){const p=this.waitingReads.shift();this.read(p.lng,p.ns,p.fcName,p.tried,p.wait,p.callback)}if(u&&d&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,s+1,o*2,a)},o);return}a(u,d)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const u=c(t,n);u&&typeof u.then=="function"?u.then(d=>l(null,d)).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();wt(t)&&(t=this.languageUtils.toResolveHierarchy(t)),wt(n)&&(n=[n]);const o=this.queueLoad(t,n,r,s);if(!o.toLoad.length)return o.pending.length||s(),null;o.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],o=r[1];this.read(s,o,"read",void 0,void 0,(a,l)=>{a&&this.logger.warn(`${n}loading namespace ${o} for language ${s} failed`,a),!a&&l&&this.logger.log(`${n}loaded namespace ${o} for language ${s}`,l),this.loaded(t,a,l)})}saveMissing(t,n,r,s,o){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:o},u=this.backend.create.bind(this.backend);if(u.length<6)try{let d;u.length===5?d=u(t,n,r,s,c):d=u(t,n,r,s),d&&typeof d.then=="function"?d.then(p=>l(null,p)).catch(l):l(null,d)}catch(d){l(d)}else u(t,n,r,s,l,c)}!t||!t[0]||this.store.addResource(t[0],n,r,s)}}}const MC=()=>({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]),wt(e[1])&&(t.defaultValue=e[1]),wt(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}}),$C=e=>(wt(e.ns)&&(e.ns=[e.ns]),wt(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),wt(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),jp=()=>{},_J=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class Fd extends Qm{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=$C(t),this.services={},this.logger=xi,this.modules={external:[]},_J(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&&(wt(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const s=MC();this.options={...s,...this.options,...$C(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 o=d=>d?typeof d=="function"?new d:d:null;if(!this.options.isClone){this.modules.logger?xi.init(o(this.modules.logger),this.options):xi.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:typeof Intl<"u"&&(d=NJ);const p=new IC(this.options);this.store=new AC(this.options.resources,this.options);const f=this.services;f.logger=xi,f.resourceStore=this.store,f.languageUtils=p,f.pluralResolver=new kJ(p,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),d&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(f.formatter=o(d),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new vJ(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new CJ(o(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(h){for(var g=arguments.length,k=new Array(g>1?g-1:0),b=1;b<g;b++)k[b-1]=arguments[b];t.emit(h,...k)}),this.modules.languageDetector&&(f.languageDetector=o(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=o(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new am(this.services,this.options),this.translator.on("*",function(h){for(var g=arguments.length,k=new Array(g>1?g-1:0),b=1;b<g;b++)k[b-1]=arguments[b];t.emit(h,...k)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=jp),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const d=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);d.length>0&&d[0]!=="dev"&&(this.options.lng=d[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(d=>{this[d]=function(){return t.store[d](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(d=>{this[d]=function(){return t.store[d](...arguments),t}});const c=Nu(),u=()=>{const d=(p,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(f),r(p,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return d(null,this.t.bind(this));this.changeLanguage(this.options.lng,d)};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]:jp;const s=wt(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 o=[],a=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(u=>{u!=="cimode"&&o.indexOf(u)<0&&o.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(o,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(l)})}else r(null)}reloadResources(t,n,r){const s=Nu();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=jp),this.services.backendConnector.reload(t,n,o=>{s.resolve(),r(o)}),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"&&BT.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=Nu();this.emit("languageChanging",t);const o=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},a=(c,u)=>{u?(o(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=wt(c)?c:this.services.languageUtils.getBestMatchFromCodes(c);u&&(this.language||o(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,d=>{a(d,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 o=function(a,l){let c;if(typeof l!="object"){for(var u=arguments.length,d=new Array(u>2?u-2:0),p=2;p<u;p++)d[p-2]=arguments[p];c=s.options.overloadTranslationOptionHandler([a,l].concat(d))}else c={...l};c.lng=c.lng||o.lng,c.lngs=c.lngs||o.lngs,c.ns=c.ns||o.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||r||o.keyPrefix);const f=s.options.keySeparator||".";let h;return c.keyPrefix&&Array.isArray(a)?h=a.map(g=>`${c.keyPrefix}${f}${g}`):h=c.keyPrefix?`${c.keyPrefix}${f}${a}`:a,s.t(h,c)};return wt(t)?o.lng=t:o.lngs=t,o.ns=n,o.keyPrefix=r,o}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,o=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(o,t)))}loadNamespaces(t,n){const r=Nu();return this.options.ns?(wt(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=Nu();wt(t)&&(t=[t]);const s=this.options.preload||[],o=t.filter(a=>s.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return o.length?(this.options.preload=s.concat(o),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 IC(MC());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 Fd(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:jp;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},o=new Fd(s);return(t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(l=>{o[l]=this[l]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r&&(o.store=new AC(this.store.data,s),o.services.resourceStore=o.store),o.translator=new am(o.services,s),o.translator.on("*",function(l){for(var c=arguments.length,u=new Array(c>1?c-1:0),d=1;d<c;d++)u[d-1]=arguments[d];o.emit(l,...u)}),o.init(s,n),o.translator.options=s,o.translator.backendConnector.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},o}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const mr=Fd.createInstance();mr.createInstance=Fd.createInstance;mr.createInstance;mr.dir;mr.init;mr.loadResources;mr.reloadResources;mr.use;mr.changeLanguage;mr.getFixedT;mr.t;mr.exists;mr.setDefaultNamespace;mr.hasLoadedNamespace;mr.loadNamespaces;mr.loadLanguages;function EJ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function zd(e){"@babel/helpers - typeof";return zd=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},zd(e)}function AJ(e,t){if(zd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(zd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function PJ(e){var t=AJ(e,"string");return zd(t)=="symbol"?t:t+""}function IJ(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,PJ(r.key),r)}}function RJ(e,t,n){return t&&IJ(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var HT=[],TJ=HT.forEach,MJ=HT.slice;function $J(e){return TJ.call(MJ.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var LC=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,LJ=function(t,n,r){var s=r||{};s.path=s.path||"/";var o=encodeURIComponent(n),a="".concat(t,"=").concat(o);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(!LC.test(s.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(s.domain)}if(s.path){if(!LC.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},OC={create:function(t,n,r,s){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(o.expires=new Date,o.expires.setTime(o.expires.getTime()+r*60*1e3)),s&&(o.domain=s),document.cookie=LJ(t,encodeURIComponent(n),o)},read:function(t){for(var n="".concat(t,"="),r=document.cookie.split(";"),s=0;s<r.length;s++){for(var o=r[s];o.charAt(0)===" ";)o=o.substring(1,o.length);if(o.indexOf(n)===0)return o.substring(n.length,o.length)}return null},remove:function(t){this.create(t,"",-1)}},OJ={name:"cookie",lookup:function(t){var n;if(t.lookupCookie&&typeof document<"u"){var r=OC.read(t.lookupCookie);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupCookie&&typeof document<"u"&&OC.create(n.lookupCookie,t,n.cookieMinutes,n.cookieDomain,n.cookieOptions)}},DJ={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),o=s.split("&"),a=0;a<o.length;a++){var l=o[a].indexOf("=");if(l>0){var c=o[a].substring(0,l);c===t.lookupQuerystring&&(n=o[a].substring(l+1))}}}return n}},ju=null,DC=function(){if(ju!==null)return ju;try{ju=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{ju=!1}return ju},FJ={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&DC()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&DC()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},Cu=null,FC=function(){if(Cu!==null)return Cu;try{Cu=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Cu=!1}return Cu},zJ={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&FC()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&FC()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},BJ={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}},HJ={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}},WJ={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}},VJ={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]}},WT=!1;try{document.cookie,WT=!0}catch{}var VT=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];WT||VT.splice(1,1);function KJ(){return{order:VT,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var KT=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};EJ(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return RJ(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=$J(r,this.options||{},KJ()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(o){return o.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=s,this.addDetector(OJ),this.addDetector(DJ),this.addDetector(FJ),this.addDetector(zJ),this.addDetector(BJ),this.addDetector(HJ),this.addDetector(WJ),this.addDetector(VJ)}},{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(o){if(r.detectors[o]){var a=r.detectors[o].lookup(r.options);a&&typeof a=="string"&&(a=[a]),a&&(s=s.concat(a))}}),s=s.map(function(o){return r.options.convertDetectedLanguage(o)}),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(o){s.detectors[o]&&s.detectors[o].cacheUserLanguage(n,s.options)}))}}])}();KT.type="languageDetector";const qJ={name:"AgentFlow",tagline:"AI Workflow Orchestration"},UJ={projects:"Projects",nodes:"Nodes",myNodes:"My Nodes",myFlows:"My Flows",skills:"Skills",mcps:"MCP",feedback:"Feedback",flowEditor:"Flow Editor",settings:"Settings",back:"Back"},YJ={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"},GJ={success:"Success",failed:"Failed",pending:"Pending",running:"Running",skipped:"Skipped"},JJ={agent:"Agent",control:"Control",tool:"Tool",start:"Start",end:"End"},XJ={online:"Engine Online",offline:"Engine Offline",connecting:"Connecting…"},QJ={hub:"AgentFlow Hub",docs:"Documentation",github:"GitHub Repository"},ZJ={app:qJ,nav:UJ,common:YJ,status:GJ,nodeTypes:JJ,engine:XJ,links:QJ},eX="Flow Editor",tX="Nodes",nX="Edges",rX="Properties",sX={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"},iX={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}}"},oX={run:"Run Flow",stop:"Stop",resume:"Resume",validate:"Validate",export:"Export",import:"Import"},aX={nodeList:"Node List",runHistory:"Run History",validation:"Validation Results"},lX={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"},cX={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)"},uX={saving:"Saving...",saved:"Saved",saveFailed:"Save failed",runInTerminal:"Please use terminal to run"},dX={requirement:"Requirement Analysis",planning:"Technical Planning",code:"Code Execution",test:"Test Regression",normal:"Normal"},fX={phase:"Phase",allPhasesComplete:"All phases completed",currentPhaseComplete:"Current phase completed, waiting for confirmation..."},pX={node:"Node",text:"Text",file:"File",bool:"Boolean"},hX={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"},mX={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"},gX={title:"Jump to node",placeholder:"Type node ID or label…",empty:"No matching nodes",hintNavigate:"navigate",hintJump:"jump",hintClose:"close"},yX={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."},wX={mainNav:"Main Navigation"},xX={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'},bX={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):
|
|
286
|
-
{{summary}}`,step:"Step {{current}}/{{total}}: {{description}}",phaseGeneration:`Phased generation ({{count}} phases): {{labels}}
|
|
287
|
-
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}}"},kX={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"},vX={nodePalette:"Node Palette",noPipelineSelected:"No pipeline selected",moreRuns:"+{{count}} more",moreFlows:"+{{count}} more flows",runId:"Run ID: {{id}}"},SX={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}}"},NX={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"},jX={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"},CX={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"},_X={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"},EX={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"},AX={invalidPlaceholder:"Invalid placeholder: {{hint}}",empty:"(empty)",inputSubtitle:"Input · {{type}}",inputSubtitleNoType:"Input",outputSubtitle:"Output · {{type}}",outputSubtitleNoType:"Output",runtimeConst:"Runtime constant"},PX={justNow:"Just now",minutesAgo:"{{n}} min ago",hoursAgo:"{{n}} hr ago",yesterday:"Yesterday",daysAgo:"{{n}} days ago",milliseconds:"{{n}} ms",seconds:"{{n}} s"},IX={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"},RX={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."},TX={title:"Print Output: {{instanceId}}",expand:"Expand",restore:"Restore"},MX={save:"Save",cancel:"Cancel"},$X={title:"Run with Params",noParams:"No input params in this flow",run:"Run",cancel:"Cancel"},LX={title:"Run with Preset",noPresets:"No presets available",default:"Default run",run:"Run",cancel:"Cancel"},OX={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"},DX={title:eX,nodes:tX,edges:nX,properties:rX,node:sX,nodeProps:iX,actions:oX,panel:aX,palette:lX,pipeline:cX,status:uX,roles:dX,phases:fX,types:pX,runContext:hX,shortcuts:mX,jumpPalette:gX,emptyCanvas:yX,sidebar:wX,validation:xX,composer:bX,topbar:kX,palette2:vX,run:SX,fileEdit:NX,settings:jX,schedule:CX,history:_X,nodePropsError:EX,placeholder:AX,time:PX,userCheck:IX,userAsk:RX,toolPrint:TX,provideEdit:MX,runParams:$X,runPreset:LX,runConfig:OX},FX="Settings",zX={engine:"Engine Settings",preferences:"Global Preferences"},BX={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)."},HX={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..."}},WX={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."},VX={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."},KX={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."},qX={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)"},UX={title:"User Allowlist",description:"Only controls which usernames may register or sign in. Users set their own password on first sign-in.",enabled:"Allowlist enabled",open:"Open registration",refreshing:"Refreshing...",saving:"Saving...",file:"File",fileList:"File allowlist",envList:"Environment allowlist",readonly:"Read-only",userCount:"{{count}} users",remove:"Remove {{username}}",emptyFile:"No file allowlist configured. If env allowlist is also empty, every username can register.",emptyEnv:"AGENTFLOW_USER_WHITELIST / AGENTFLOW_ALLOWED_USERS is not configured",unionHint:"The file allowlist and env allowlist are combined. This only stores usernames, never passwords.",add:"Add"},YX={title:"System Status",normal:"Service normal",abnormal:"Some interfaces abnormal",cursorModels:"Cursor Models",opencodeModels:"OpenCode Models",claudeCodeModels:"Claude Code Models",codexModels:"Codex Models"},GX={title:"Shortcuts",projects:"Projects & Pipelines",flowEditor:"Node Canvas"},JX={title:"Language",description:"Select your preferred language for the interface",options:{zh:"中文",en:"English",ja:"日本語"}},XX={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."},QX={title:FX,crumb:zX,workspace:BX,cursor:HX,opencode:WX,claudeCode:VX,codex:KX,env:qX,allowlist:UX,system:YX,shortcuts:GX,language:JX,onboarding:XX},ZX={thinking:"Thinking",result:"Result",reply:"Reply",error:"Error"},eQ={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)"},tQ={send:"Send",stop:"Stop",expand:"Expand",collapse:"Collapse",clear:"Clear"},nQ={conversation:"Chat",conversationWithNumber:"Chat {{num}}",default:"Default"},rQ={endSession:"End chat (will stop generation)",closeSession:"Close chat",newSession:"New chat",expandComposer:"Expand chat and output"},sQ={hint:"Use the bottom input box for AI chat, with @node mentions, model selection, and more"},iQ={aiLabels:ZX,placeholders:eQ,actions:tQ,labels:nQ,tooltips:rQ,rightPanel:sQ},oQ="Projects",aQ="All",lQ="Archived",cQ="Nodes",uQ="My Nodes",dQ="My Flows",fQ="Skills",pQ="Active Projects",hQ="Archived Pipelines",mQ="Global Nodes",gQ="All Nodes",yQ="My Nodes",wQ="Manage node versions published to the current workspace marketplace, {{count}} total.",xQ="Manage flow snippets published to the current workspace marketplace, {{count}} total.",bQ="Global Skills",kQ="Create New Project",vQ="New Pipeline",SQ="SEARCH PIPELINES...",NQ="SEARCH NODES...",jQ="SEARCH FLOW SNIPPETS...",CQ="SEARCH SKILLS...",_Q="Refresh Resources",EQ="Loading pipelines...",AQ="Loading global resources...",PQ="Filter result: {{count}} items (matching title, description, path and tags)",IQ="Archived pipelines can still be opened and edited; files are located in the _archived subdirectory of each pipelines directory.",RQ="Manage your distributed node architectures and monitoring pipelines. Drag flow.yaml or .zip into this page to import shared flows.",TQ="Review all globally available node definitions, {{count}} total, including built-in, workspace, and marketplace nodes.",MQ="Review Composer-selectable skills, {{count}} total, including AgentFlow built-ins and workspace skills.",$Q="Executable building blocks for pipeline runtime",LQ="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.",OQ="Published local node packages",DQ="Only node versions published to this workspace marketplace appear here. Inspect details and delete versions that no flow uses.",FQ="Published flow snippets",zQ="Flow snippets published from Pipeline or Workspace canvases appear here. Search and inspect them, then load them from the canvas flow palette.",BQ="Operating guides for Composer and agents",HQ="Skills tell AI which rules to follow for a task, how to change flows, and how to reuse project conventions.",WQ="No archived projects.",VQ="No active pipelines; archived items are in the Archived tab.",KQ="No global nodes available.",qQ="No marketplace nodes have been published.",UQ="No flow snippets have been published. Select multiple canvas nodes and publish them first.",YQ="No skills available.",GQ="No description.",JQ='No node matches "{{query}}".',XQ='No flow snippet matches "{{query}}".',QQ='No skill matches "{{query}}".',ZQ="{{inputs}} in / {{outputs}} out",eZ="Flow Snippet",tZ="{{nodes}} nodes / {{edges}} edges",nZ="Skill",rZ="Node detail",sZ="Flow snippet detail",iZ="Skill detail",oZ="Type",aZ="Source",lZ="Package",cZ="Version",uZ="Path",dZ="Editable",fZ="Read only",pZ="Editable",hZ="Schema",mZ="Inputs",gZ="Outputs",yZ="Runtime",wZ="Node Body",xZ="Files",bZ="Usage",kZ="No runtime manifest.",vZ="No node body or README.",SZ="No previewable files.",NZ="Select a file to preview.",jZ="Binary file preview is not supported.",CZ="Large file; showing the first 256KB only.",_Z="No pipelines using this node were found.",EZ="Node Management",AZ="Delete Node Version",PZ="Deleting...",IZ="AgentFlow checks all flow references before deleting; installed or used versions are kept.",RZ="Delete {{id}}@{{version}}? This cannot be undone.",TZ="Deleted {{id}}@{{version}}.",MZ="{{count}} flow(s) still use it.",$Z="Flow Snippet Management",LZ="Delete Flow Snippet",OZ="Deleting...",DZ="Deleting it only removes this reusable marketplace snippet. Nodes already loaded onto canvases are not changed.",FZ="Delete {{id}}@{{version}}? This cannot be undone.",zZ="Deleted {{id}}@{{version}}.",BZ="No slots",HZ="Purpose",WZ="This node is an execution unit in a pipeline. Its schema affects canvas wiring, parameter input, and runtime scheduling.",VZ="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.",KZ="Scale",qZ="Flow Preview",UZ="Edges",YZ="Snippet JSON",GZ="{{count}} more edge(s)",JZ="No previewable nodes.",XZ="This skill is injected into Composer as context for AI, constraining its decisions, edit strategy, and output format.",QZ="SKILL.md Preview",ZZ="No preview content available.",eee="Select a resource to inspect details.",tee="Failed to load pipeline list.",nee="No pipelines in current workspace.",ree="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.",see='No pipelines found matching "{{query}}". Try different keywords or clear the search.',iee="Recent Activity",oee="No recent activity",aee="No recent activity matching the keyword",lee="Recent Run",cee="Recent Open",uee={builtin:"Built-in",workspace:"Workspace",user:"User"},dee={flow:"Flow",global:"Global",marketplace:"Marketplace"},fee={all:"All",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},pee={overview:"Overview",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},hee="Open to edit this pipeline in the node canvas.",mee={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>"},gee={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"},yee={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"},wee={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"},xee={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"},bee={title:oQ,all:aQ,archived:lQ,nodes:cQ,myNodes:uQ,myFlows:dQ,skills:fQ,activeProjects:pQ,archivedPipelines:hQ,globalNodes:mQ,nodeScopeAll:gQ,nodeScopeMine:yQ,myNodesHint:wQ,myFlowsHint:xQ,globalSkills:bQ,createNew:kQ,newPipeline:vQ,searchPipelines:SQ,searchNodes:NQ,searchFlows:jQ,searchSkills:CQ,refreshResources:_Q,loadingPipelines:EQ,loadingResources:AQ,filterResult:PQ,archivedHint:IQ,activeHint:RQ,nodesHint:TQ,skillsHint:MQ,nodesPurposeTitle:$Q,nodesPurposeDesc:LQ,myNodesPurposeTitle:OQ,myNodesPurposeDesc:DQ,myFlowsPurposeTitle:FQ,myFlowsPurposeDesc:zQ,skillsPurposeTitle:BQ,skillsPurposeDesc:HQ,noArchived:WQ,noActive:VQ,noNodes:KQ,noMyNodes:qQ,noMyFlows:UQ,noSkills:YQ,noDescription:GQ,noNodeMatch:JQ,noFlowSnippetMatch:XQ,noSkillMatch:QQ,nodeSlots:ZQ,flowSnippet:eZ,flowSnippetNodes:tZ,skill:nZ,nodeDetail:rZ,flowDetail:sZ,skillDetail:iZ,detailType:oZ,detailSource:aZ,detailPackage:lZ,detailVersion:cZ,detailPath:uZ,detailEditable:dZ,readOnly:fZ,editable:pZ,nodeSchema:hZ,nodeInputs:mZ,nodeOutputs:gZ,nodeRuntime:yZ,nodeBody:wZ,nodeFiles:xZ,nodeUsage:bZ,noRuntimeManifest:kZ,noNodeBody:vZ,noNodeFiles:SZ,selectNodeFile:NZ,binaryFile:jZ,fileTruncated:CZ,noNodeUsage:_Z,myNodeManagement:EZ,deleteMyNode:AZ,deletingMyNode:PZ,deleteMyNodeHint:IZ,deleteMyNodeConfirm:RZ,deleteMyNodeSuccess:TZ,deleteMyNodeUsedBy:MZ,myFlowManagement:$Z,deleteMyFlow:LZ,deletingMyFlow:OZ,deleteMyFlowHint:DZ,deleteMyFlowConfirm:FZ,deleteMyFlowSuccess:zZ,noSlots:BZ,resourceMeaning:HZ,nodesMeaning:WZ,myFlowsMeaning:VZ,flowSnippetScale:KZ,flowSnippetPreview:qZ,flowSnippetEdges:UZ,flowSnippetJson:YZ,flowSnippetMoreEdges:GZ,noFlowSnippetPreview:JZ,skillsMeaning:XZ,skillPreview:QZ,skillPreviewEmpty:ZZ,selectResource:eee,loadFailed:tee,noPipelines:nee,emptyHint:ree,noMatch:see,recentActivity:iee,noRecentActivity:oee,noMatchRecent:aee,recentRun:lee,recentOpen:cee,sourceBadge:uee,resourceSource:dee,resourceFilter:fee,nodeDetailTabs:pee,defaultCardDesc:hee,hubCard:mee,newPipelineModal:gee,importModal:yee,deleteModal:wee,archiveModal:xee},kee="Back",vee="Next",See="Skip",Nee="Done",jee="Start Creating",Cee={intro:`Welcome to AgentFlow! This is a visual workflow orchestration tool.
|
|
288
|
-
|
|
289
|
-
Click the button below to create your first pipeline.`,hubIntro:`Don't want to start from scratch?
|
|
290
|
-
|
|
291
|
-
Browse ready-made pipelines on AgentFlow Hub — community-shared flows you can install and run in one click.`},_ee={intro:`Now you're in the flow editor.
|
|
292
|
-
|
|
293
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
294
|
-
|
|
295
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`,introEmpty:`The canvas is empty. Start creating your flow!
|
|
296
|
-
|
|
297
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
298
|
-
|
|
299
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`},Eee={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"},Aee={back:kee,next:vee,skip:See,done:Nee,startCreate:jee,projects:Cee,flow:_ee,newPipeline:Eee},Pee={name:"AgentFlow",tagline:"AI 工作流编排"},Iee={projects:"项目",nodes:"Nodes",myNodes:"我的 Nodes",myFlows:"我的流程",skills:"Skills",mcps:"MCP",feedback:"意见反馈",flowEditor:"流程编辑器",settings:"设置",back:"返回"},Ree={loading:"加载中…",saving:"保存中…",save:"保存",cancel:"取消",delete:"删除",edit:"编辑",create:"创建",close:"关闭",confirm:"确认",copy:"复制",copied:"已复制!",refresh:"刷新",search:"搜索",filter:"筛选",success:"成功",error:"错误",warning:"警告",info:"信息",done:"完成",pending:"待处理",running:"运行中",notFound:"未找到",required:"必填",optional:"可选"},Tee={success:"成功",failed:"失败",pending:"等待",running:"运行中",skipped:"跳过"},Mee={agent:"Agent 节点",control:"控制节点",tool:"工具节点",start:"开始",end:"结束"},$ee={online:"引擎在线",offline:"引擎离线",connecting:"连接中…"},Lee={hub:"AgentFlow Hub",docs:"文档",github:"GitHub 仓库"},Oee={app:Pee,nav:Iee,common:Ree,status:Tee,nodeTypes:Mee,engine:$ee,links:Lee},Dee="流程编辑器",Fee="节点",zee="连线",Bee="属性",Hee={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:"编辑内容"},Wee={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}}"},Vee={run:"运行流程",stop:"停止",resume:"继续",validate:"校验",export:"导出",import:"导入"},Kee={nodeList:"节点列表",runHistory:"运行历史",validation:"校验结果"},qee={workspace:"工作区",loading:"加载中…",archived:"已归档",noPipelines:"暂无流水线",more:"更多",moreFlows:"更多流程",noRuns:"暂无运行记录",searchNodes:"搜索节点",noComponents:"暂无可用组件(检查节点库目录)",noMatch:"无匹配节点,请调整搜索词",selectPipeline:"从上方选择一条流水线以加载组件与画布",validationWarnings:"校验警告(与 agentflow validate 槽位检查一致)",output:"输出",model:"模型",userDir:"用户目录",toggleRecentActivity:"展开或收起最近打开或最近运行"},Uee={selectPipeline:"请从顶部下拉选择一条流水线",loadingProps:"加载节点属性…",pipelineId:"流水线 ID",diskPath:"磁盘路径",storageLocation:"存储位置",introduction:"介绍",introductionPlaceholder:"简要描述这条流水线的用途(写入 flow.yaml 的 ui.description)",metadata:"元数据",nodeCount:"节点数",nodesUnit:"个节点",loading:"加载中…",noRuns:"暂无运行记录(终端执行后会在工作区生成运行目录)"},Yee={saving:"保存中…",saved:"已保存",saveFailed:"保存失败",runInTerminal:"运行请使用终端"},Gee={requirement:"需求拆解",planning:"技术规划",code:"代码执行",test:"测试回归",normal:"普通"},Jee={phase:"阶段",allPhasesComplete:"所有阶段完成",currentPhaseComplete:"当前阶段完成,等待确认继续…"},Xee={node:"节点",text:"文本",file:"文件",bool:"布尔"},Qee={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:"等待"},Zee={title:"快捷键",general:"常规",saveDesc:"保存;节点属性侧栏打开时先提交节点再保存 flow",shortcutsLabel:"快捷键",jumpToNode:"按 ID 跳转到节点",openNodePalette:"打开节点面板",canvas:"画布",selectTool:"选择工具",panTool:"平移工具",holdSpacePan:"按住空格临时平移",saveViewport:"保存当前进入视角",selectAll:"全选所有节点",undo:"撤销画布修改",redo:"重做画布修改"},ete={title:"跳转到节点",placeholder:"输入节点 ID 或名称…",empty:"未匹配到节点",hintNavigate:"切换",hintJump:"跳转",hintClose:"关闭"},tte={title:"开始构建你的流程",text:"在下方 AI 输入框中描述你的流程,或从左侧面板拖拽节点到画布",composerHint:"使用 AI Composer 构建 AgentFlow",composerSub:"从左侧拖入节点,或在<strong>下方输入框</strong>中用自然语言描述工作流。<br/>按 <kbd>?</kbd> 查看快捷键。"},nte={mainNav:"主导航"},rte={flowWarningAriaLabel:"流程校验警告",reloadFromServer:"从服务器重新加载流程并刷新校验",reloadFromServerShort:"从服务器重新加载",closeBanner:"关闭校验警告横幅",nodePrefix:"节点",focusNodeAriaLabel:"在画布中选中并定位节点 {{nodeId}}",slotWarningCount:"槽位校验 {{count}} 条(已隐藏)",show:"显示",shortcutHint:"按 ? 查看快捷键",shortcutHintLabel:"快捷键",inputSlotNoEdge:' 的 input 槽位 "{{slotName}}"({{handle}})无对应 edge 连接',outputSlotNoEdge:' 的 output 槽位 "{{slotName}}"({{handle}})无对应 edge 连接'},ste={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}} 步):
|
|
300
|
-
{{summary}}`,step:"步骤 {{current}}/{{total}}: {{description}}",phaseGeneration:`分阶段生成({{count}} 阶段):{{labels}}
|
|
301
|
-
当前:{{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}}"},ite={currentPipeline:"当前流水线",backToEdit:"返回编辑",backToProjects:"返回项目",executionLog:"执行日志",history:"历史",pipelineSettings:"流水线设置",shortcutsLabel:"快捷键",shortcutsTitle:"快捷键 (?)",deletePipeline:"删除流水线",resumeTitle:"在同一 run 目录继续执行(uuid={{uuid}})",resumeTitleNoUuid:"尚未收到 apply-start,将发起新的 run",rerunTitle:"从头开始新的运行",runOptions:"运行选项",runWithParams:"带参数运行",runWithPreset:"指定预设运行",editRun:"编辑运行参数",startRun:"开始执行",stopRun:"停止后台运行"},ote={nodePalette:"节点调色板",noPipelineSelected:"未选择流水线",moreRuns:"+{{count}} 更多",moreFlows:"+{{count}} 更多流程",runId:"运行 ID: {{id}}"},ate={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}} 的分支"},lte={close:"关闭",loading:"加载中…",placeholder:"文件内容",largeFileWarning:"文件较大,编辑器性能可能受影响",reset:"重置",aiEdit:"AI 修改",aiRunning:"AI 处理中…",save:"保存",saving:"保存中…",saved:"已保存"},cte={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:"已复制"},ute={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:"定时配置已保存"},dte={title:"执行历史",summary:"执行结果汇总",successCount:"{{count}} 成功",failedCount:"{{count}} 失败",stoppedCount:"{{count}} 已停止",interruptedCount:"{{count}} 已中断",runningCount:"{{count}} 进行中",success:"成功",failed:"失败",stopped:"已停止",interrupted:"已中断",running:"进行中",unknown:"未知",runLabel:"运行 #{{id}}",enterRunView:"进入该次运行的画布与日志态"},fte={invalidInstanceId:"实例 ID 格式无效:仅允许英文字母、数字、下划线、短横线,且不能以数字开头。",duplicateInstanceId:"该实例 ID 已存在,请换一个。",loadFlowFailed:"读取 flow 失败",loadNodesFailed:"读取节点库失败"},pte={invalidPlaceholder:"无效占位符: {{hint}}",empty:"(空)",inputSubtitle:"输入 · {{type}}",inputSubtitleNoType:"输入",outputSubtitle:"输出 · {{type}}",outputSubtitleNoType:"输出",runtimeConst:"运行时常量"},hte={justNow:"刚刚",minutesAgo:"{{n}} 分钟前",hoursAgo:"{{n}} 小时前",yesterday:"昨天",daysAgo:"{{n}} 天前",milliseconds:"{{n}} 毫秒",seconds:"{{n}} 秒"},mte={title:"用户确认 ({{instanceId}})",edit:"编辑",save:"保存",cancel:"取消",aiEditPlaceholder:"输入 AI 修改指令,如:删除第二项、合并前两项…",aiEditBtn:"AI 修改",aiEditStarted:"AI 正在修改内容…",aiEditDone:"AI 修改完成",aiEditFailed:"AI 修改失败",contentSaved:"内容已保存",saveFailed:"保存失败",close:"关闭",continue:"继续执行",hint:"编辑或使用 AI 修改后点击保存,然后点击「继续执行」恢复流程"},gte={title:"用户选择 ({{instanceId}})",hint:"请从下方选项中选择一项以继续流程",submitting:"提交中…",submitFailed:"提交失败",close:"关闭",noOptions:"该节点未配置选项,请先在编辑器中为 output 槽位添加条目。"},yte={title:"Print 输出: {{instanceId}}",expand:"放大",restore:"还原"},wte={save:"保存",cancel:"取消"},xte={title:"带参数运行",noParams:"此流程无输入参数",run:"运行",cancel:"取消"},bte={title:"指定预设运行",noPresets:"无可用预设",default:"默认运行",run:"运行",cancel:"取消"},kte={preset:"预设",default:"默认",newPreset:"新建预设",deletePreset:"删除预设",presetNamePlaceholder:"预设名称",inputParams:"输入参数",noProvideNodes:"此流程无 provide 节点",filePathPlaceholder:"文件路径…",stringValuePlaceholder:"值…",presetSaved:"预设已保存",presetDeleted:"预设已删除",savePreset:"保存当前预设",expandInput:"编辑内容"},vte={title:Dee,nodes:Fee,edges:zee,properties:Bee,node:Hee,nodeProps:Wee,actions:Vee,panel:Kee,palette:qee,pipeline:Uee,status:Yee,roles:Gee,phases:Jee,types:Xee,runContext:Qee,shortcuts:Zee,jumpPalette:ete,emptyCanvas:tte,sidebar:nte,validation:rte,composer:ste,topbar:ite,palette2:ote,run:ate,fileEdit:lte,settings:cte,schedule:ute,history:dte,nodePropsError:fte,placeholder:pte,time:hte,userCheck:mte,userAsk:gte,toolPrint:yte,provideEdit:wte,runParams:xte,runPreset:bte,runConfig:kte},Ste="设置",Nte={engine:"引擎设置",preferences:"全局首选项"},jte={title:"工作区",currentPath:"当前工作区根目录",placeholder:"加载中…",copyPath:"复制路径",description:"流水线与节点清单将相对于此目录解析(由启动 UI 时传入)。"},Cte={title:"Cursor CLI",status:{cached:"已缓存",notCached:"未缓存"},modelPreviewLabel:"Cursor 模型名称列表",modelList:{cached:"模型清单已缓存",empty:"暂无模型列表",count:"{{count}} 条",fetchedAt:"更新 {{time}}",never:"尚未拉取",refresh:"刷新清单",fetching:"拉取中…"}},_te={modelPreviewLabel:"OpenCode 模型名称列表",title:"OpenCode CLI",status:{ready:"就绪",notFound:"未找到"},provider:"方案 / Provider 标识",providerPlaceholder:"例如 bailian-coding-plan",saving:"正在保存并更新清单…",description:"对应 CLI opencode models <provider> 的参数;停止输入后会写入用户目录 config 并刷新 model-lists.json。"},Ete={title:"Claude Code CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Claude Code 模型名称列表",description:"内置模型列表(Claude Code CLI 无 models 子命令);刷新将探测 claude 二进制是否在 PATH 中。首次使用请先执行 claude /login。"},Ate={title:"Codex CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Codex 模型名称列表",description:"模型列表来自 codex debug models --bundled;首次使用请先执行 codex login。"},Pte={title:"环境变量",note:"当前登录用户私有,运行时优先于服务全局环境变量",noteAdmin:"可配置个人或全局环境变量;个人同名变量优先于全局",saving:"正在保存...",key:"键",value:"值",scope:"范围",personal:"个人",global:"全局",add:"添加",delete:"删除 {{key}}",invalidKey:"环境变量名必须以字母或下划线开头,且只能包含字母、数字和下划线。",newKey:"新环境变量键",newValue:"值(密钥请谨慎)"},Ite={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:"添加"},Rte={title:"系统状态",normal:"服务正常",abnormal:"部分接口异常",cursorModels:"Cursor 模型",opencodeModels:"OpenCode 模型",claudeCodeModels:"Claude Code 模型",codexModels:"Codex 模型"},Tte={title:"快捷入口",projects:"项目与流水线",flowEditor:"节点画布"},Mte={title:"语言",description:"选择界面显示语言",options:{zh:"中文",en:"English",ja:"日本語"}},$te={title:"新手引导",description:"重新启动产品引导流程,了解 AgentFlow 的核心功能。",reset:"重置引导",resetSuccess:"已重置,下次访问将自动启动引导"},Lte={title:Ste,crumb:Nte,workspace:jte,cursor:Cte,opencode:_te,claudeCode:Ete,codex:Ate,env:Pte,allowlist:Ite,system:Rte,shortcuts:Tte,language:Mte,onboarding:$te},Ote={thinking:"思考",result:"结果",reply:"回复",error:"错误"},Dte={input:"让 AI 协助编辑此节点…",waiting:"等待响应…",selectedEmpty:"在画布上选择节点,或在输入框用 @ 选择实例(Instances)或节点类型(Node)",textarea:"描述你的流程或让 AI 协助编辑(⌘/Ctrl+Enter 发送)"},Fte={send:"发送",stop:"停止",expand:"展开",collapse:"收起",clear:"清空"},zte={conversation:"对话",conversationWithNumber:"对话 {{num}}",default:"默认"},Bte={endSession:"结束对话(将停止生成)",closeSession:"关闭对话",newSession:"新建对话",expandComposer:"展开对话与输出"},Hte={hint:"使用底部输入框进行 AI 对话,支持 @节点、选择模型等功能"},Wte={aiLabels:Ote,placeholders:Dte,actions:Fte,labels:zte,tooltips:Bte,rightPanel:Hte},Vte="项目",Kte="全部",qte="已归档",Ute="Nodes",Yte="我的 Nodes",Gte="我的流程",Jte="Skills",Xte="活跃项目",Qte="已归档流水线",Zte="全局 Nodes",ene="全部 Nodes",tne="我的 Nodes",nne="管理当前工作区已发布到本地 Marketplace 的节点,共 {{count}} 个。",rne="管理当前工作区已发布到本地 Marketplace 的流程片段,共 {{count}} 个。",sne="全局 Skills",ine="创建新项目",one="新建流水线",ane="搜索流水线…",lne="搜索 nodes…",cne="搜索流程片段…",une="搜索 skills…",dne="刷新资源",fne="加载流水线列表…",pne="加载全局资源…",hne="筛选结果:{{count}} 条(匹配标题、描述、路径与标签)",mne="已归档的流水线仍可打开与编辑;文件位于各 pipelines 目录下的 _archived。",gne="管理分布式节点架构与监控流水线。可将 flow.yaml 或 .zip 拖入本页导入分享流程。",yne="查看当前可用的全局节点定义,共 {{count}} 个;包含内置、工作区与 marketplace 节点。",wne="查看当前 Composer 可选择的 skills,共 {{count}} 个;包含 AgentFlow 内置与工作区 skills。",xne="流程运行时的可执行积木",bne="Nodes 决定画布上能拖什么、节点有哪些输入输出,以及运行时走 agent、control、provide 或 marketplace 哪类逻辑。",kne="已发布的本地节点包",vne="这里仅显示你发布到当前 Workspace Marketplace 的节点版本;可查看详情并删除未被 Flow 使用的版本。",Sne="已发布的流程片段",Nne="这里显示从 Pipeline 或 Workspace 画布发布的流程片段,可搜索、检查内容,并从画布的流程面板中加载复用。",jne="Composer/Agent 的操作指南",Cne="Skills 告诉 AI 在特定任务里应遵守什么规则、如何修改 flow、如何复用项目约定。",_ne="暂无归档项目。",Ene="暂无未归档流水线;已归档项在 Archived 标签中查看。",Ane="暂无可用全局 nodes。",Pne="暂无已发布的 marketplace nodes。",Ine="暂无已发布的流程片段。可在画布中选中多个节点后发布。",Rne="暂无可用 skills。",Tne="暂无描述。",Mne="未找到与「{{query}}」匹配的 node。",$ne="未找到与「{{query}}」匹配的流程片段。",Lne="未找到与「{{query}}」匹配的 skill。",One="{{inputs}} in / {{outputs}} out",Dne="流程片段",Fne="{{nodes}} 节点 / {{edges}} 连线",zne="Skill",Bne="Node 详情",Hne="流程片段详情",Wne="Skill 详情",Vne="类型",Kne="来源",qne="包",Une="版本",Yne="路径",Gne="可编辑",Jne="只读",Xne="可编辑",Qne="Schema",Zne="输入",ere="输出",tre="Runtime",nre="节点内容",rre="Files",sre="Usage",ire="暂无 runtime manifest。",ore="暂无节点正文或 README。",are="暂无可预览文件。",lre="请选择文件查看内容。",cre="二进制文件暂不支持预览。",ure="文件较大,仅显示前 256KB。",dre="暂未发现使用此 node 的流水线。",fre="节点管理",pre="删除节点版本",hre="删除中…",mre="删除前会检查所有 Flow 引用;仍被安装或使用的版本不会被删除。",gre="确定删除 {{id}}@{{version}}?此操作不可撤销。",yre="已删除 {{id}}@{{version}}。",wre="仍有 {{count}} 个 Flow 使用它。",xre="流程片段管理",bre="删除流程片段",kre="删除中…",vre="删除后不会影响已经加载到画布里的节点,只会移除 Marketplace 中这个可复用片段。",Sre="确定删除 {{id}}@{{version}}?此操作不可撤销。",Nre="已删除 {{id}}@{{version}}。",jre="无槽位",Cre="作用",_re="这个 node 是 pipeline 的执行单元。它的 schema 会影响画布连线、参数输入和运行时调度。",Ere="流程片段是固定化流程的一部分。加载时会复制这组节点、连线和布局到当前画布,不覆盖已有内容。",Are="规模",Pre="流程预览",Ire="连线",Rre="片段 JSON",Tre="还有 {{count}} 条连线",Mre="暂无可预览节点。",$re="这个 skill 会作为 Composer 的上下文注入给 AI,用于约束 AI 的判断、修改方式和输出口径。",Lre="SKILL.md 预览",Ore="暂无可预览内容。",Dre="请选择一个资源查看详情。",Fre="未能加载流水线列表。",zre="当前工作区暂无流水线。",Bre="在仓库根目录执行 {{code1}} 并确认工作区包含 {{code2}} 或用户目录下的流水线;亦可点击 New Pipeline 新建。",Hre="未找到与「{{query}}」匹配的流水线。可尝试其他关键词,或点击清除搜索。",Wre="最近打开或最近运行",Vre="暂无打开或运行记录",Kre="暂无与关键词匹配的最近记录",qre="最近运行",Ure="最近打开",Yre={builtin:"内置",workspace:"工作区",user:"用户"},Gre={flow:"Flow",global:"Global",marketplace:"Marketplace"},Jre={all:"全部",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},Xre={overview:"概览",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},Qre="打开以在节点画布中编辑此流水线。",Zre={eyebrow:"AgentFlow Hub",title:"浏览社区流程",desc:"发现并一键安装社区分享的现成流水线。",cta:"前往 Hub",cliHint:"或通过 CLI 安装:agentflow download <slug>"},ese={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:"关闭"},tse={title:"导入流水线",lead:"已选择文件「{{filename}}」。请确认流水线名称与保存位置;ZIP 将保留目录内脚本等文件。",nameLabel:"名称(必填)",namePlaceholder:"例如 my_shared_flow",nameHint:"须以英文字母开头,仅可使用字母、数字、下划线 _ 与连字符 -",locationLabel:"保存位置",userDir:"用户目录(~/agentflow/pipelines)",workspaceDir:"当前工作区(.workspace/agentflow/pipelines)",changeFile:"更换文件…",importFailed:"导入失败",importing:"导入中…",importAndOpen:"导入并打开",cancel:"取消",close:"关闭"},nse={title:"删除流水线",lead:"将永久删除磁盘上的流水线目录(含 flow.yaml、脚本等),无法撤销。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",deleteFailed:"删除失败",deleteTimeout:"删除请求超时,请重试(可先检查终端中的 UI 服务日志)",delete:"删除",deleting:"删除中…",confirmDelete:"确认删除",cancel:"取消",close:"关闭"},rse={title:"归档流水线",lead:"归档后流水线将移入「Archived」列表,仍可从该列表打开与编辑。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",archiveFailed:"归档失败",archive:"归档",archiving:"归档中…",confirmArchive:"确认归档",cancel:"取消",close:"关闭"},sse={title:Vte,all:Kte,archived:qte,nodes:Ute,myNodes:Yte,myFlows:Gte,skills:Jte,activeProjects:Xte,archivedPipelines:Qte,globalNodes:Zte,nodeScopeAll:ene,nodeScopeMine:tne,myNodesHint:nne,myFlowsHint:rne,globalSkills:sne,createNew:ine,newPipeline:one,searchPipelines:ane,searchNodes:lne,searchFlows:cne,searchSkills:une,refreshResources:dne,loadingPipelines:fne,loadingResources:pne,filterResult:hne,archivedHint:mne,activeHint:gne,nodesHint:yne,skillsHint:wne,nodesPurposeTitle:xne,nodesPurposeDesc:bne,myNodesPurposeTitle:kne,myNodesPurposeDesc:vne,myFlowsPurposeTitle:Sne,myFlowsPurposeDesc:Nne,skillsPurposeTitle:jne,skillsPurposeDesc:Cne,noArchived:_ne,noActive:Ene,noNodes:Ane,noMyNodes:Pne,noMyFlows:Ine,noSkills:Rne,noDescription:Tne,noNodeMatch:Mne,noFlowSnippetMatch:$ne,noSkillMatch:Lne,nodeSlots:One,flowSnippet:Dne,flowSnippetNodes:Fne,skill:zne,nodeDetail:Bne,flowDetail:Hne,skillDetail:Wne,detailType:Vne,detailSource:Kne,detailPackage:qne,detailVersion:Une,detailPath:Yne,detailEditable:Gne,readOnly:Jne,editable:Xne,nodeSchema:Qne,nodeInputs:Zne,nodeOutputs:ere,nodeRuntime:tre,nodeBody:nre,nodeFiles:rre,nodeUsage:sre,noRuntimeManifest:ire,noNodeBody:ore,noNodeFiles:are,selectNodeFile:lre,binaryFile:cre,fileTruncated:ure,noNodeUsage:dre,myNodeManagement:fre,deleteMyNode:pre,deletingMyNode:hre,deleteMyNodeHint:mre,deleteMyNodeConfirm:gre,deleteMyNodeSuccess:yre,deleteMyNodeUsedBy:wre,myFlowManagement:xre,deleteMyFlow:bre,deletingMyFlow:kre,deleteMyFlowHint:vre,deleteMyFlowConfirm:Sre,deleteMyFlowSuccess:Nre,noSlots:jre,resourceMeaning:Cre,nodesMeaning:_re,myFlowsMeaning:Ere,flowSnippetScale:Are,flowSnippetPreview:Pre,flowSnippetEdges:Ire,flowSnippetJson:Rre,flowSnippetMoreEdges:Tre,noFlowSnippetPreview:Mre,skillsMeaning:$re,skillPreview:Lre,skillPreviewEmpty:Ore,selectResource:Dre,loadFailed:Fre,noPipelines:zre,emptyHint:Bre,noMatch:Hre,recentActivity:Wre,noRecentActivity:Vre,noMatchRecent:Kre,recentRun:qre,recentOpen:Ure,sourceBadge:Yre,resourceSource:Gre,resourceFilter:Jre,nodeDetailTabs:Xre,defaultCardDesc:Qre,hubCard:Zre,newPipelineModal:ese,importModal:tse,deleteModal:nse,archiveModal:rse},ise="返回",ose="下一步",ase="跳过",lse="完成",cse="开始创建",use={intro:`欢迎使用 AgentFlow!这是一个可视化流程编排工具。
|
|
302
|
-
|
|
303
|
-
点击下方按钮开始创建你的第一个流水线。`,hubIntro:`不想从零开始?
|
|
304
|
-
|
|
305
|
-
在 AgentFlow Hub 浏览社区分享的现成流水线,一键安装即可运行。`},dse={intro:`现在进入流程编辑器。
|
|
306
|
-
|
|
307
|
-
在下方输入框用自然语言描述你的需求,AI 会自动生成流程图。
|
|
308
|
-
|
|
309
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`,introEmpty:`画布为空,开始创建你的流程吧!
|
|
310
|
-
|
|
311
|
-
在下方输入框用自然语言描述需求,AI 会自动生成流程图。
|
|
312
|
-
|
|
313
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`},fse={guideTitle:"首次创建提示",guideDesc:"输入名称和描述后,AI 会自动生成流程图。你可以在编辑器中自由调整节点和连接。",nameHintGuide:"例如:MyFirstFlow(字母开头,支持数字和下划线)",descPlaceholderGuide:"例如:实现用户登录功能,包含注册、验证、授权",descHintGuide:"描述越详细,AI 生成的流程越准确",createGuide:"创建并开始编辑",typeNode:"节点引用类型",typeStr:"字符串类型",typeFile:"文件路径类型",typeBool:"布尔值类型"},pse={back:ise,next:ose,skip:ase,done:lse,startCreate:cse,projects:use,flow:dse,newPipeline:fse},hse={en:{common:ZJ,flow:DX,settings:QX,composer:iQ,project:bee,onboarding:Aee},zh:{common:Oee,flow:vte,settings:Lte,composer:Wte,project:sse,onboarding:pse}};mr.use(KT).use(KO).init({resources:hse,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 mse=[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"en",name:"English",flag:"🇬🇧"}];function gse(e){return mr.changeLanguage(e)}const rb="agentflow-settings-opencode-plan-v1",Cp="CURSOR_API_KEYS",_p="AGENTFLOW_CURSOR_API_KEY_COOLDOWN_MINUTES",qT=["cursor","opencode","claudeCode","codex"];function UT(){return{cursor:[],opencode:[],claudeCode:[],codex:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null,codexFetchedAt:null}}function sb(e){const t=String(e||"").trim(),n=t.indexOf(" - ");return n>=0?t.slice(0,n).trim():t}function ma(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n={};for(const r of qT)n[r]=Array.isArray(t[r])?[...new Set(t[r].map(sb).filter(Boolean))]:[];return n}function Di(e){if(!e||typeof e!="object")return UT();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 cc(){return`e_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function yse(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function ba(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(),o=String(r.value??""),a=String(r.id??"").trim()||cc(),c=String(r.scope??t).trim()==="global"?"global":"user";!s&&!o||n.push({id:a,key:s,value:o,scope:c})}return n}function zC(e){return ba(e).map(({key:t,value:n})=>({key:t,value:n}))}function BC(){try{return localStorage.getItem(rb)??""}catch{return""}}function YT(e){return e?e.length<=6?"•".repeat(e.length):`${"•".repeat(Math.min(20,e.length-4))}${e.slice(-4)}`:""}function wse(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 o=String(r.key??"").trim();return o?{id:String(r.id??"").trim()||cc(),name:String(r.name??"").trim()||`Key ${s+1}`,key:o,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 HC(e){const t=Array.isArray(e)?e.map((n,r)=>({id:String((n==null?void 0:n.id)||"").trim()||cc(),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 xse(e){const t=String(e||"").trim();return t?t.length<=10?YT(t):`${t.slice(0,4)}${"•".repeat(Math.min(18,t.length-8))}${t.slice(-4)}`:""}function bse(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 kse({authUser:e}){const{t,i18n:n}=Lr(["common","settings"]),r=n.language||"zh",[s,o]=m.useState(""),[a,l]=m.useState(""),[c,u]=m.useState({cursor:[],opencode:[],claudeCode:[],codex:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null,codexFetchedAt:null}),[d,p]=m.useState(UT()),[f,h]=m.useState(()=>ma({})),[g,k]=m.useState(!1),[b,y]=m.useState(""),[v,w]=m.useState(""),[C,N]=m.useState(!1),[j,A]=m.useState(!1),[I,D]=m.useState(""),[B,W]=m.useState([]),[F,T]=m.useState(""),[M,q]=m.useState(!1),[H,L]=m.useState(""),[R,z]=m.useState(""),[E,Q]=m.useState(!1),[V,$]=m.useState(()=>new Set),[ne,ce]=m.useState(""),[X,re]=m.useState(""),[Z,ie]=m.useState(!!(e!=null&&e.isAdmin)),[te,ue]=m.useState(""),[fe,be]=m.useState([]),[qe,Ue]=m.useState([]),[Me,rt]=m.useState(""),[gt,bt]=m.useState(""),[oe,je]=m.useState(!1),[Ve,tt]=m.useState(!1),[Jt,st]=m.useState(""),[de,ve]=m.useState(""),[ze,Ze]=m.useState(""),[Se,Tt]=m.useState(null),[vn,dn]=m.useState(!1),[nn,Sn]=m.useState(!1),[ee,Ie]=m.useState(""),Fe=m.useRef(null),Je=m.useRef(!1),Pt=m.useRef(!1),jt=m.useRef(""),lr=m.useCallback(async()=>{l("");try{const se=await fetch("/api/ui-context");if(!se.ok)throw new Error("HTTP "+se.status);const Ne=await se.json();o(typeof Ne.workspaceRoot=="string"?Ne.workspaceRoot:"")}catch(se){l(String(se.message||se)),o("")}},[]),rn=m.useCallback(async()=>{w(""),N(!0),y("");try{const se=await fetch(e!=null&&e.isAdmin?"/api/model-visibility":"/api/model-lists");if(!se.ok)throw new Error("HTTP "+se.status);const Ne=await se.json();if(e!=null&&e.isAdmin)u(Di(Ne.modelLists)),p(Di(Ne.allModelLists)),h(ma(Ne.hiddenModels));else{const Pe=Di(Ne);u(Pe),p(Pe),h(ma({}))}}catch(se){w(String(se.message||se))}finally{N(!1)}},[e==null?void 0:e.isAdmin]),gr=m.useCallback(async()=>{T("");try{const se=await fetch("/api/user-env"),Ne=await se.json().catch(()=>({}));if(!se.ok)throw new Error(typeof Ne.error=="string"?Ne.error:"HTTP "+se.status);const Pe=ba(Array.isArray(Ne.env)?Ne.env:[],"user").map(Mt=>({...Mt,scope:"user"})),zt=[...e!=null&&e.isAdmin?ba(Array.isArray(Ne.globalEnv)?Ne.globalEnv:[],"global").map(Mt=>({...Mt,scope:"global"})):[],...Pe];jt.current=JSON.stringify(zt),W(zt)}catch(se){W([]),T(String(se.message||se))}finally{Pt.current=!0}},[e==null?void 0:e.isAdmin]),qn=m.useCallback(async()=>{if(e!=null&&e.isAdmin){je(!0),st("");try{const se=await fetch("/api/admin/user-allowlist"),Ne=await se.json().catch(()=>({}));if(!se.ok)throw new Error(typeof Ne.error=="string"?Ne.error:"HTTP "+se.status);const Pe=Ne.allowlist&&typeof Ne.allowlist=="object"?Ne.allowlist:{};be(Array.isArray(Pe.fileUsers)?Pe.fileUsers.map(String):[]),Ue(Array.isArray(Pe.envUsers)?Pe.envUsers.map(String):[]),rt(typeof Pe.path=="string"?Pe.path:"")}catch(se){st(String(se.message||se))}finally{je(!1)}}},[e==null?void 0:e.isAdmin]),Mn=m.useCallback(async se=>{if(e!=null&&e.isAdmin){tt(!0),st("");try{const Ne=await fetch("/api/admin/user-allowlist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({users:se})}),Pe=await Ne.json().catch(()=>({}));if(!Ne.ok)throw new Error(typeof Pe.error=="string"?Pe.error:"HTTP "+Ne.status);const lt=Pe.allowlist&&typeof Pe.allowlist=="object"?Pe.allowlist:{};be(Array.isArray(lt.fileUsers)?lt.fileUsers.map(String):[]),Ue(Array.isArray(lt.envUsers)?lt.envUsers.map(String):[]),rt(typeof lt.path=="string"?lt.path:"")}catch(Ne){st(String(Ne.message||Ne))}finally{tt(!1)}}},[e==null?void 0:e.isAdmin]),Un=m.useCallback(async()=>{if(e!=null&&e.isAdmin){dn(!0),Ie("");try{const se=await fetch("/api/admin/storage-config"),Ne=await se.json().catch(()=>({}));if(!se.ok)throw new Error(typeof Ne.error=="string"?Ne.error:"HTTP "+se.status);const Pe=Ne.config&&typeof Ne.config=="object"?Ne.config:{};Tt(Pe),ve(typeof Pe.dataRoot=="string"?Pe.dataRoot:""),Ze(typeof Pe.skillsRoot=="string"?Pe.skillsRoot:"")}catch(se){Ie(String(se.message||se))}finally{dn(!1)}}},[e==null?void 0:e.isAdmin]),Yn=m.useCallback(async()=>{if(e!=null&&e.isAdmin){Sn(!0),Ie("");try{const se=await fetch("/api/admin/storage-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataRoot:de.trim(),skillsRoot:ze.trim(),migrateLegacySkills:!0})}),Ne=await se.json().catch(()=>({}));if(!se.ok)throw new Error(typeof Ne.error=="string"?Ne.error:"HTTP "+se.status);const Pe=Ne.config&&typeof Ne.config=="object"?Ne.config:{};Tt(Pe),ve(typeof Pe.dataRoot=="string"?Pe.dataRoot:""),Ze(typeof Pe.skillsRoot=="string"?Pe.skillsRoot:"")}catch(se){Ie(String(se.message||se))}finally{Sn(!1)}}},[e==null?void 0:e.isAdmin,de,ze]),cr=m.useCallback(async se=>{const Ne=ba(se),Pe=Ne.filter(zt=>zt.scope!=="global"),lt=Ne.filter(zt=>zt.scope==="global");q(!0),T("");try{const zt=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:zC(Pe),...e!=null&&e.isAdmin?{globalEnv:zC(lt)}:{}})}),Mt=await zt.json().catch(()=>({}));if(!zt.ok)throw new Error(typeof Mt.error=="string"?Mt.error:"HTTP "+zt.status);const Xn=ba(Array.isArray(Mt.env)?Mt.env:[],"user").map(K=>({...K,scope:"user"})),Er=[...e!=null&&e.isAdmin?ba(Array.isArray(Mt.globalEnv)?Mt.globalEnv:[],"global").map(K=>({...K,scope:"global"})):[],...Xn];jt.current=JSON.stringify(Er),W(Er)}catch(zt){T(String(zt.message||zt))}finally{q(!1)}},[e==null?void 0:e.isAdmin]),yr=m.useCallback(async()=>{w(""),N(!0);try{const se=await fetch("/api/update-model-lists",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:te.trim()})}),Ne=await se.json().catch(()=>({}));if(!se.ok)throw new Error(typeof Ne.error=="string"?Ne.error:"HTTP "+se.status);u(Di(Ne.modelLists)),e!=null&&e.isAdmin?await rn():p(Di(Ne.modelLists))}catch(se){w(String(se.message||se))}finally{N(!1)}},[e==null?void 0:e.isAdmin,rn,te]),Xr=m.useCallback(async se=>{if(!(e!=null&&e.isAdmin))return;const Ne=ma(se);h(Ne),k(!0),y("");try{const Pe=await fetch("/api/model-visibility",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hiddenModels:Ne})}),lt=await Pe.json().catch(()=>({}));if(!Pe.ok)throw new Error(typeof lt.error=="string"?lt.error:"HTTP "+Pe.status);u(Di(lt.modelLists)),p(Di(lt.allModelLists)),h(ma(lt.hiddenModels))}catch(Pe){y(String(Pe.message||Pe)),rn()}finally{k(!1)}},[e==null?void 0:e.isAdmin,rn]),Gn=m.useCallback((se,Ne,Pe)=>{const lt=qT.includes(se)?se:"cursor",zt=sb(Ne);if(!zt)return;const Mt=ma(f),Xn=new Set(Mt[lt]);Pe?Xn.delete(zt):Xn.add(zt),Xr({...Mt,[lt]:Array.from(Xn)})},[f,Xr]);m.useEffect(()=>{lr(),rn(),gr(),e!=null&&e.isAdmin&&(qn(),Un()),(async()=>{try{const se=await fetch("/api/agentflow-config");if(se.ok){const Ne=await se.json(),Pe=typeof Ne.opencodeProvider=="string"?Ne.opencodeProvider:"";ue(Pe),Fe.current=Pe;try{localStorage.setItem(rb,Pe)}catch{}}else{const Ne=BC();ue(Ne),Fe.current=Ne}}catch{const se=BC();ue(se),Fe.current=se}finally{Je.current=!0}})()},[e==null?void 0:e.isAdmin,lr,rn,Un,qn,gr]),m.useEffect(()=>{if(!Pt.current||JSON.stringify(ba(B))===jt.current)return;const Ne=setTimeout(()=>{cr(B)},350);return()=>clearTimeout(Ne)},[B,cr]),m.useEffect(()=>{if(!Je.current)return;const se=te.trim();if(se===Fe.current)return;const Ne=setTimeout(()=>{(async()=>{A(!0),D("");try{const Pe=await fetch("/api/agentflow-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:se})}),lt=await Pe.json().catch(()=>({}));if(!Pe.ok)throw new Error(typeof lt.error=="string"?lt.error:"HTTP "+Pe.status);Fe.current=se;try{localStorage.setItem(rb,se)}catch{}lt.modelLists&&(u(Di(lt.modelLists)),e!=null&&e.isAdmin?rn():p(Di(lt.modelLists)))}catch(Pe){D(String(Pe.message||Pe))}finally{A(!1)}})()},450);return()=>clearTimeout(Ne)},[e==null?void 0:e.isAdmin,rn,te]);const mt=e!=null&&e.isAdmin?d:c,Fn=mt.cursor.length>0,Ft=mt.opencode.length>0,fn=mt.claudeCode.length>0,zn=mt.codex.length>0,ps=ma(f),ri={cursor:c.cursor.length,opencode:c.opencode.length,claudeCode:c.claudeCode.length,codex:c.codex.length},ur=m.useCallback((se,Ne,Pe)=>{const lt=Array.isArray(Ne)?Ne:[];if(!(e!=null&&e.isAdmin))return i.jsx("pre",{className:"af-set-model-preview","aria-label":Pe,children:lt.join(`
|
|
314
|
-
`)});const zt=new Set(ps[se]||[]);return i.jsxs("div",{className:"af-set-model-visibility","aria-label":Pe,children:[i.jsxs("div",{className:"af-set-model-visibility-head",children:[i.jsxs("span",{children:["展示 ",ri[se]||0," / ",lt.length]}),i.jsx("span",{children:g?"保存中":"取消勾选后从模型下拉隐藏"})]}),i.jsx("div",{className:"af-set-model-visibility-list",children:lt.map(Mt=>{const Xn=sb(Mt),pn=!zt.has(Xn);return i.jsxs("label",{className:"af-set-model-visibility-row",children:[i.jsx("input",{type:"checkbox",checked:pn,disabled:g,onChange:Er=>Gn(se,Mt,Er.target.checked)}),i.jsx("span",{children:Mt})]},`${se}-${Mt}`)})})]})},[e==null?void 0:e.isAdmin,ps,g,ri,Gn]),Wt=fe.length>0||qe.length>0,ae=e!=null&&e.isAdmin&&Z?"global":"user",ke=m.useMemo(()=>B.find(se=>se.key===Cp&&(se.scope||"user")===ae)||null,[ae,B]),ot=m.useMemo(()=>wse((ke==null?void 0:ke.value)||""),[ke==null?void 0:ke.value]),xt=m.useMemo(()=>B.find(se=>se.key===_p&&(se.scope||"user")===ae)||null,[ae,B]),xn=xt!=null&&xt.value?String(xt.value):"30",on=m.useCallback((se,Ne,Pe)=>{const lt=String(se||"").trim();if(!lt)return;const zt=String(Ne??"");W(Mt=>{const Xn=Mt.find(pn=>pn.key===lt&&(pn.scope||"user")===Pe);return zt?Xn?Mt.map(pn=>pn.id===Xn.id?{...pn,value:zt,scope:Pe}:pn):[{id:cc(),key:lt,value:zt,scope:Pe},...Mt]:Mt.filter(pn=>!(pn.key===lt&&(pn.scope||"user")===Pe))})},[]),Jn=m.useCallback(()=>{const se=X.trim();if(!se)return;const Ne=[...ot,{id:cc(),name:ne.trim()||`Key ${ot.length+1}`,key:se,createdAt:new Date().toISOString()}];on(Cp,HC(Ne),ae),ce(""),re("")},[ne,ot,ae,X,on]),Qr=m.useCallback(se=>{const Ne=ot.filter(Pe=>Pe.id!==se);on(Cp,Ne.length?HC(Ne):"",ae)},[ot,ae,on]),ct=m.useCallback(se=>{const Ne=String(se||"").replace(/[^\d]/g,"");if(!Ne){on(_p,"",ae);return}const Pe=Math.min(1440,Math.max(1,Number(Ne)||30));on(_p,String(Pe),ae)},[ae,on]),qt=m.useCallback(()=>{var se;s&&((se=navigator.clipboard)==null||se.writeText(s))},[s]),Vt=m.useCallback(()=>{const se=H.trim(),Ne=R;if(se){if(!yse(se)){T(t("settings:env.invalidKey"));return}W(Pe=>[{id:cc(),key:se,value:Ne,scope:e!=null&&e.isAdmin&&E?"global":"user"},...Pe]),L(""),z("")}},[e==null?void 0:e.isAdmin,E,H,R,t]),wr=m.useCallback(se=>{W(Ne=>Ne.filter(Pe=>Pe.id!==se))},[]),et=m.useCallback((se,Ne)=>{W(Pe=>Pe.map(lt=>lt.id===se?{...lt,...Ne}:lt))},[]),_r=m.useCallback(se=>{$(Ne=>{const Pe=new Set(Ne);return Pe.has(se)?Pe.delete(se):Pe.add(se),Pe})},[]),Or=m.useCallback(()=>{const se=gt.trim();if(!se)return;if(!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(se)){st("用户名须以字母开头,仅可使用字母、数字、下划线与连字符,最多 64 字符");return}if(new Set(fe.map(Pe=>String(Pe||"").trim().toLowerCase())).has(se.toLowerCase())){bt("");return}bt(""),Mn([...fe,se])},[gt,fe,Mn]),si=m.useCallback(se=>{const Ne=String(se||"").trim().toLowerCase();Ne&&Mn(fe.filter(Pe=>String(Pe||"").trim().toLowerCase()!==Ne))},[fe,Mn]),co=m.useCallback(se=>{const Ne=se.target.value;gse(Ne)},[]),As=se=>{const Ne=bse(se,r);return Ne?t("settings:cursor.modelList.fetchedAt",{time:Ne}):t("settings:cursor.modelList.never")};return i.jsxs("div",{className:"af-settings-page",children:[i.jsx("header",{className:"af-settings-top",children:i.jsxs("div",{className:"af-settings-crumb","aria-label":t("settings:title"),children:[i.jsx("span",{className:"af-settings-crumb-muted",children:t("settings:crumb.engine")}),i.jsx("span",{className:"af-settings-crumb-sep","aria-hidden":!0,children:"/"}),i.jsx("span",{className:"af-settings-crumb-active",children:t("settings:crumb.preferences")})]})}),i.jsx("div",{className:"af-settings-body",children:i.jsxs("div",{className:"af-settings-inner",children:[i.jsxs("header",{className:"af-settings-hero",children:[i.jsxs("h1",{className:"af-settings-h1",children:[t("common:app.name")," ",t("settings:title")]}),i.jsx("p",{className:"af-settings-lead",children:t("settings:workspace.description")}),a?i.jsx("p",{className:"af-err af-settings-api-hint",children:a}):null,v?i.jsx("p",{className:"af-err af-settings-api-hint",children:v}):null,F?i.jsx("p",{className:"af-err af-settings-api-hint",children:F}):null,ee?i.jsx("p",{className:"af-err af-settings-api-hint",children:ee}):null]}),i.jsx("div",{className:"af-settings-layout",children:i.jsxs("div",{className:"af-settings-bento",children:[i.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--low af-set-workspace",children:[i.jsxs("div",{className:"af-set-card-inner",children:[i.jsxs("div",{className:"af-set-card-head",children:[i.jsx("span",{className:"material-symbols-outlined af-set-icon af-set-icon--secondary",children:"folder_managed"}),i.jsx("h2",{className:"af-set-h2",children:t("settings:workspace.title")})]}),i.jsx("label",{className:"af-set-label",htmlFor:"af-workspace-path",children:t("settings:workspace.currentPath")}),i.jsxs("div",{className:"af-set-input-wrap",children:[i.jsx("input",{id:"af-workspace-path",className:"af-set-input af-set-input--mono",type:"text",readOnly:!0,value:s,placeholder:t("common:loading")}),i.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:qt,"aria-label":t("settings:workspace.copyPath"),disabled:!s,children:i.jsx("span",{className:"material-symbols-outlined",children:"content_copy"})})]}),i.jsx("p",{className:"af-set-hint",children:"当前页面只展示运行时根目录。可被节点加载的代码库和文档目录请在左侧“知识库”里维护。"})]}),i.jsx("div",{className:"af-set-watermark","aria-hidden":!0,children:i.jsx("span",{className:"material-symbols-outlined",children:"account_tree"})})]}),i.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[i.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[i.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:"Cursor CLI"}),i.jsx("span",{className:"af-set-badge"+(Fn?" af-set-badge--ok":" af-set-badge--muted"),children:t(Fn?"settings:cursor.status.cached":"settings:cursor.status.notCached")})]}),i.jsxs("div",{className:"af-set-cli-block",children:[i.jsx("div",{className:"af-set-cli-icon",children:i.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:Fn?"check_circle":"hourglass_empty"})}),i.jsxs("div",{children:[i.jsx("p",{className:"af-set-cli-title",children:t(Fn?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),i.jsx("p",{className:"af-set-cli-mono",children:Fn?t("settings:cursor.modelList.count",{count:c.cursor.length})+(e!=null&&e.isAdmin?` / ${mt.cursor.length}`:"")+" · "+As(c.cursorFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),Fn?ur("cursor",mt.cursor,t("settings:cursor.modelPreviewLabel")):null,b?i.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",role:"alert",children:b}):null,i.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>yr(),disabled:C,children:t(C?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),i.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low af-set-cursor-pool",children:[i.jsxs("div",{className:"af-set-env-head",children:[i.jsxs("div",{className:"af-set-card-head",children:[i.jsx("div",{className:"af-set-env-icon-wrap",children:i.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"key"})}),i.jsxs("div",{children:[i.jsx("h2",{className:"af-set-h2",children:"Cursor API Key 池"}),i.jsx("p",{className:"af-set-card-subtitle",children:"按请求轮换,遇到 usage limit 或 resource_exhausted 会自动尝试下一个 Key。"})]})]}),i.jsxs("span",{className:"af-set-badge"+(ot.length?" af-set-badge--ok":" af-set-badge--muted"),children:[ot.length," keys"]})]}),i.jsxs("div",{className:"af-set-cursor-pool-controls",children:[e!=null&&e.isAdmin?i.jsxs("div",{className:"af-set-env-scope-switch af-set-cursor-scope",role:"group","aria-label":"Cursor API Key scope",children:[i.jsx("button",{type:"button",className:Z?"":"is-active",onClick:()=>ie(!1),children:"个人"}),i.jsx("button",{type:"button",className:Z?"is-active":"",onClick:()=>ie(!0),children:"全局"})]}):null,i.jsxs("label",{className:"af-set-cursor-cooldown",children:[i.jsx("span",{children:"限额冷却"}),i.jsx("input",{className:"af-set-input af-set-input--sm af-set-input--mono",inputMode:"numeric",value:xn,onChange:se=>ct(se.target.value)}),i.jsx("span",{children:"分钟"})]}),i.jsx("span",{className:"af-set-env-note",children:M?"保存中":ae==="global"?"全局配置":"个人配置"})]}),i.jsx("div",{className:"af-set-cursor-key-list",children:ot.length?ot.map(se=>i.jsxs("div",{className:"af-set-cursor-key-row",children:[i.jsxs("div",{className:"af-set-cursor-key-main",children:[i.jsx("strong",{children:se.name}),i.jsx("code",{children:xse(se.key)})]}),i.jsx("span",{className:"af-set-cursor-key-meta",children:se.createdAt?new Date(se.createdAt).toLocaleString():"历史 Key"}),i.jsx("button",{type:"button",className:"af-set-env-del af-set-cursor-key-delete","aria-label":`删除 ${se.name}`,onClick:()=>Qr(se.id),children:i.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})]},se.id)):i.jsx("div",{className:"af-set-cursor-key-empty",children:"还没有配置 Key。配置后 Cursor CLI runner 会自动轮换使用。"})}),i.jsxs("div",{className:"af-set-cursor-key-add",children:[i.jsx("input",{className:"af-set-input",value:ne,onChange:se=>ce(se.target.value),placeholder:"名称,例如 Team Key 1"}),i.jsx("input",{className:"af-set-input af-set-input--mono",type:"password",value:X,onChange:se=>re(se.target.value),placeholder:"Cursor API Key"}),i.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:Jn,disabled:!X.trim(),children:[i.jsx("span",{className:"material-symbols-outlined",children:"add"}),"添加 Key"]})]}),i.jsxs("p",{className:"af-set-hint",children:["保存到 ",Cp,";冷却时间保存到 ",_p,"。个人配置会覆盖全局配置。"]})]}),i.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[i.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[i.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:"OpenCode"}),i.jsx("span",{className:"af-set-badge"+(Ft?" af-set-badge--ok":" af-set-badge--err"),children:t(Ft?"settings:opencode.status.ready":"settings:opencode.status.notFound")})]}),i.jsx("p",{className:"af-set-p",children:t("settings:opencode.description")}),i.jsxs("div",{children:[i.jsx("label",{className:"af-set-label-sm",htmlFor:"af-opencode-plan",children:t("settings:opencode.provider")}),i.jsx("input",{id:"af-opencode-plan",className:"af-set-input af-set-input--sm af-set-input--mono",type:"text",value:te,onChange:se=>ue(se.target.value),placeholder:t("settings:opencode.providerPlaceholder"),autoComplete:"off"}),j?i.jsx("p",{className:"af-set-hint af-set-hint--inline","aria-live":"polite",children:t("settings:opencode.saving")}):null,I?i.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",role:"alert",children:I}):null]}),Ft?i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"af-set-cli-mono af-set-cli-mono--block",children:t("settings:cursor.modelList.count",{count:c.opencode.length})+(e!=null&&e.isAdmin?` / ${mt.opencode.length}`:"")+" · "+As(c.opencodeFetchedAt)}),ur("opencode",mt.opencode,t("settings:opencode.modelPreviewLabel"))]}):null,i.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>yr(),disabled:C,children:t(C?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),i.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[i.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[i.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:t("settings:claudeCode.title")}),i.jsx("span",{className:"af-set-badge"+(fn?" af-set-badge--ok":" af-set-badge--err"),children:t(fn?"settings:claudeCode.status.ready":"settings:claudeCode.status.notFound")})]}),i.jsxs("div",{className:"af-set-cli-block",children:[i.jsx("div",{className:"af-set-cli-icon",children:i.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:fn?"check_circle":"hourglass_empty"})}),i.jsxs("div",{children:[i.jsx("p",{className:"af-set-cli-title",children:t(fn?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),i.jsx("p",{className:"af-set-cli-mono",children:fn?t("settings:cursor.modelList.count",{count:c.claudeCode.length})+(e!=null&&e.isAdmin?` / ${mt.claudeCode.length}`:"")+" · "+As(c.claudeCodeFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),i.jsx("p",{className:"af-set-p",children:t("settings:claudeCode.description")}),fn?ur("claudeCode",mt.claudeCode,t("settings:claudeCode.modelPreviewLabel")):null,i.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>yr(),disabled:C,children:t(C?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),i.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[i.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[i.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:t("settings:codex.title")}),i.jsx("span",{className:"af-set-badge"+(zn?" af-set-badge--ok":" af-set-badge--err"),children:t(zn?"settings:codex.status.ready":"settings:codex.status.notFound")})]}),i.jsxs("div",{className:"af-set-cli-block",children:[i.jsx("div",{className:"af-set-cli-icon",children:i.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:zn?"check_circle":"hourglass_empty"})}),i.jsxs("div",{children:[i.jsx("p",{className:"af-set-cli-title",children:t(zn?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),i.jsx("p",{className:"af-set-cli-mono",children:zn?t("settings:cursor.modelList.count",{count:c.codex.length})+(e!=null&&e.isAdmin?` / ${mt.codex.length}`:"")+" · "+As(c.codexFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),i.jsx("p",{className:"af-set-p",children:t("settings:codex.description")}),zn?ur("codex",mt.codex,t("settings:codex.modelPreviewLabel")):null,i.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>yr(),disabled:C,children:t(C?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),i.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low af-set-env",children:[i.jsxs("div",{className:"af-set-env-head",children:[i.jsxs("div",{className:"af-set-card-head",children:[i.jsx("div",{className:"af-set-env-icon-wrap",children:i.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"variables"})}),i.jsx("h2",{className:"af-set-h2",children:t("settings:env.title")})]}),i.jsx("span",{className:"af-set-env-note",children:M?t("settings:env.saving"):e!=null&&e.isAdmin?t("settings:env.noteAdmin"):t("settings:env.note")})]}),i.jsxs("div",{className:"af-set-env-rows"+(e!=null&&e.isAdmin?" af-set-env-rows--admin":""),children:[i.jsxs("div",{className:"af-set-env-row af-set-env-row--header","aria-hidden":!0,children:[i.jsx("span",{children:t("settings:env.key")}),e!=null&&e.isAdmin?i.jsx("span",{children:t("settings:env.scope")}):null,i.jsx("span",{children:t("settings:env.value")}),i.jsx("span",{})]}),i.jsxs("div",{className:"af-set-env-row af-set-env-row--draft"+(e!=null&&e.isAdmin?" af-set-env-row--scoped":""),children:[i.jsx("div",{className:"af-set-env-cell",children:i.jsx("input",{className:"af-set-env-inline af-set-env-inline--key",placeholder:"KEY_NAME",value:H,onChange:se=>L(se.target.value),"aria-label":t("settings:env.newKey")})}),e!=null&&e.isAdmin?i.jsx("div",{className:"af-set-env-cell af-set-env-cell--scope",children:i.jsxs("div",{className:"af-set-env-scope-switch",role:"group","aria-label":t("settings:env.scope"),children:[i.jsx("button",{type:"button",className:E?"":"is-active",onClick:()=>Q(!1),children:t("settings:env.personal")}),i.jsx("button",{type:"button",className:E?"is-active":"",onClick:()=>Q(!0),children:t("settings:env.global")})]})}):null,i.jsx("div",{className:"af-set-env-cell af-set-env-cell--grow af-set-env-cell--value",children:i.jsx("input",{className:"af-set-env-inline af-set-env-inline--value",type:"password",placeholder:t("settings:env.newValue"),value:R,onChange:se=>z(se.target.value),"aria-label":t("settings:env.newValue")})}),i.jsx("div",{className:"af-set-env-actions",children:i.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:Vt,disabled:!H.trim(),children:[i.jsx("span",{className:"material-symbols-outlined",children:"add"}),t("settings:env.add")]})})]}),B.map(se=>i.jsxs("div",{className:"af-set-env-row"+(e!=null&&e.isAdmin?" af-set-env-row--scoped":""),children:[i.jsx("div",{className:"af-set-env-cell",children:i.jsx("input",{className:"af-set-env-inline af-set-env-inline--key",value:se.key,onChange:Ne=>et(se.id,{key:Ne.target.value}),"aria-label":t("settings:env.key"),spellCheck:!1})}),e!=null&&e.isAdmin?i.jsx("div",{className:"af-set-env-cell af-set-env-cell--scope",children:i.jsxs("div",{className:"af-set-env-scope-switch",role:"group","aria-label":t("settings:env.scope"),children:[i.jsx("button",{type:"button",className:se.scope!=="global"?"is-active":"",onClick:()=>et(se.id,{scope:"user"}),children:t("settings:env.personal")}),i.jsx("button",{type:"button",className:se.scope==="global"?"is-active":"",onClick:()=>et(se.id,{scope:"global"}),children:t("settings:env.global")})]})}):null,i.jsxs("div",{className:"af-set-env-cell af-set-env-cell--grow af-set-env-cell--value",children:[i.jsx("input",{className:"af-set-env-inline af-set-env-inline--value",type:V.has(se.id)?"text":"password",value:se.value,onChange:Ne=>et(se.id,{value:Ne.target.value}),placeholder:YT(se.value)||t("settings:env.newValue"),"aria-label":t("settings:env.value")}),i.jsx("button",{type:"button",className:"af-set-env-value-toggle",onClick:()=>_r(se.id),"aria-label":V.has(se.id)?"Hide value":"Show value",children:i.jsx("span",{className:"material-symbols-outlined",children:V.has(se.id)?"visibility_off":"visibility"})})]}),i.jsx("div",{className:"af-set-env-actions",children:i.jsx("button",{type:"button",className:"af-set-env-del","aria-label":t("settings:env.delete",{key:se.key}),onClick:()=>wr(se.id),children:i.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})})]},se.id))]})]}),e!=null&&e.isAdmin?i.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low",children:[i.jsxs("div",{className:"af-set-env-head",children:[i.jsxs("div",{className:"af-set-card-head",children:[i.jsx("div",{className:"af-set-env-icon-wrap",children:i.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"hard_drive_2"})}),i.jsxs("div",{children:[i.jsx("h2",{className:"af-set-h2",children:"AgentFlow Data Root"}),i.jsx("p",{className:"af-set-card-subtitle",children:"配置整个 AgentFlow 数据目录的位置,保存时会迁移当前数据。"})]})]}),i.jsx("span",{className:"af-set-badge"+(Se!=null&&Se.envLocked?" af-set-badge--err":" af-set-badge--ok"),children:Se!=null&&Se.envLocked?"Env locked":"Configurable"}),i.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void Un(),disabled:vn||nn,children:vn?"刷新中...":"刷新"})]}),ee?i.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:ee}):null,i.jsx("label",{className:"af-set-label-sm",htmlFor:"af-agentflow-data-root",children:"Data Root"}),i.jsxs("div",{className:"af-set-input-wrap",children:[i.jsx("input",{id:"af-agentflow-data-root",className:"af-set-input af-set-input--mono",type:"text",value:de,onChange:se=>ve(se.target.value),placeholder:"/data1/services/mengmai/agentflow",autoComplete:"off",disabled:!!(Se!=null&&Se.envLocked)||nn}),i.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:()=>void Yn(),"aria-label":"保存 AgentFlow Data Root",disabled:nn||!!(Se!=null&&Se.envLocked),children:i.jsx("span",{className:"material-symbols-outlined",children:nn?"hourglass_empty":"save"})})]}),i.jsxs("p",{className:"af-set-hint",children:["当前目录:",i.jsx("code",{children:(Se==null?void 0:Se.dataRoot)||de||"-"}),Se!=null&&Se.configPath?i.jsxs(i.Fragment,{children:[";配置文件:",i.jsx("code",{children:Se.configPath})]}):null]}),i.jsxs("p",{className:"af-set-hint",children:["这个目录包含 ",i.jsx("code",{children:"users/"}),"、",i.jsx("code",{children:"pipelines/"}),"、",i.jsx("code",{children:"runBuild/"}),"、",i.jsx("code",{children:"auth/"})," 和 admin 配置。 保存到新绝对路径时会复制旧目录内容;旧目录不会自动删除。",Se!=null&&Se.envLocked?" 当前设置了 AGENTFLOW_HOME,需要改环境变量才能生效。":""]}),i.jsx("label",{className:"af-set-label-sm",htmlFor:"af-agentflow-skills-root",children:"Skills Root"}),i.jsxs("div",{className:"af-set-input-wrap",children:[i.jsx("input",{id:"af-agentflow-skills-root",className:"af-set-input af-set-input--mono",type:"text",value:ze,onChange:se=>Ze(se.target.value),placeholder:"/data1/services/mengmai/agentflow/skills",autoComplete:"off",disabled:!!(Se!=null&&Se.skillsEnvLocked)||nn}),i.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:()=>void Yn(),"aria-label":"保存 AgentFlow Skills Root",disabled:nn||!!(Se!=null&&Se.skillsEnvLocked),children:i.jsx("span",{className:"material-symbols-outlined",children:nn?"hourglass_empty":"save"})})]}),i.jsxs("p",{className:"af-set-hint",children:["当前 Skills:",i.jsx("code",{children:(Se==null?void 0:Se.skillsRoot)||ze||"-"}),Se!=null&&Se.legacySkillsRootExists?i.jsxs(i.Fragment,{children:[";保存时会补迁移旧目录 ",i.jsx("code",{children:Se.legacySkillsRoot})," 中缺失的 skills。"]}):null]}),i.jsxs("p",{className:"af-set-hint",children:["SkillHub 新安装、更新和卸载都作用于 Skills Root;普通用户只通过 Workspace 的 Load Skills 使用。",Se!=null&&Se.skillsEnvLocked?" 当前设置了 AGENTFLOW_SKILLS_ROOT,需要改环境变量才能生效。":""]})]}):null,e!=null&&e.isAdmin?i.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--allowlist",children:[i.jsxs("div",{className:"af-set-env-head",children:[i.jsxs("div",{className:"af-set-card-head",children:[i.jsx("div",{className:"af-set-env-icon-wrap",children:i.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"manage_accounts"})}),i.jsxs("div",{children:[i.jsx("h2",{className:"af-set-h2",children:t("settings:allowlist.title")}),i.jsx("p",{className:"af-set-card-subtitle",children:t("settings:allowlist.description")})]})]}),i.jsx("span",{className:"af-set-badge"+(Wt?" af-set-badge--ok":" af-set-badge--muted"),children:t(Wt?"settings:allowlist.enabled":"settings:allowlist.open")}),i.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void qn(),disabled:oe,children:t(oe?"settings:allowlist.refreshing":"common:common.refresh")})]}),Jt?i.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:Jt}):null,Me?i.jsxs("p",{className:"af-set-hint af-set-hint--inline",children:[t("settings:allowlist.file"),":",i.jsx("code",{children:Me})]}):null,i.jsxs("div",{className:"af-allowlist-grid",children:[i.jsxs("div",{className:"af-allowlist-main",children:[i.jsxs("div",{className:"af-allowlist-head",children:[i.jsx("span",{children:t("settings:allowlist.fileList")}),i.jsx("span",{children:Ve?t("settings:allowlist.saving"):t("settings:allowlist.userCount",{count:fe.length})})]}),i.jsx("div",{className:"af-allowlist-list",children:fe.length>0?fe.map(se=>i.jsxs("div",{className:"af-allowlist-row",children:[i.jsx("span",{className:"af-allowlist-name",children:se}),i.jsx("button",{type:"button",className:"af-set-env-del",onClick:()=>si(se),"aria-label":t("settings:allowlist.remove",{username:se}),disabled:Ve,children:i.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})]},se)):i.jsx("div",{className:"af-allowlist-empty",children:t("settings:allowlist.emptyFile")})}),i.jsxs("div",{className:"af-allowlist-add",children:[i.jsx("input",{className:"af-set-input af-set-input--sm af-set-input--mono",value:gt,onChange:se=>bt(se.target.value),onKeyDown:se=>{se.key==="Enter"&&Or()},placeholder:"username",autoComplete:"off"}),i.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:Or,disabled:Ve||!gt.trim(),children:[i.jsx("span",{className:"material-symbols-outlined",children:"add"}),t("settings:allowlist.add")]})]})]}),i.jsxs("div",{className:"af-allowlist-side",children:[i.jsxs("div",{className:"af-allowlist-head",children:[i.jsx("span",{children:t("settings:allowlist.envList")}),i.jsx("span",{children:t("settings:allowlist.readonly")})]}),i.jsx("div",{className:"af-allowlist-env-list",children:qe.length>0?qe.map(se=>i.jsx("code",{children:se},se)):i.jsx("span",{children:t("settings:allowlist.emptyEnv")})}),i.jsx("p",{className:"af-set-hint af-set-hint--inline",children:t("settings:allowlist.unionHint")})]})]})]}):null,i.jsxs("section",{className:"af-settings-rail","aria-label":t("settings:title"),children:[i.jsxs("div",{className:"af-set-rail-card af-set-rail-card--accent",children:[i.jsxs("div",{className:"af-set-rail-inner",children:[i.jsx("h3",{className:"af-set-rail-h3",children:t("settings:system.title")}),i.jsxs("div",{className:"af-set-health-line",children:[i.jsx("span",{className:"af-set-pulse-dot","aria-hidden":!0}),i.jsx("span",{className:"af-set-health-label",children:t(!a&&!v?"settings:system.normal":"settings:system.abnormal")})]}),i.jsxs("div",{className:"af-set-meter",children:[i.jsxs("div",{className:"af-set-meter-row",children:[i.jsx("span",{children:t("settings:system.cursorModels")}),i.jsx("span",{children:c.cursor.length})]}),i.jsx("div",{className:"af-set-meter-bar",children:i.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.cursor.length>0?12+c.cursor.length*3:4)}%`}})})]}),i.jsxs("div",{className:"af-set-meter",children:[i.jsxs("div",{className:"af-set-meter-row",children:[i.jsx("span",{children:t("settings:system.opencodeModels")}),i.jsx("span",{children:c.opencode.length})]}),i.jsx("div",{className:"af-set-meter-bar",children:i.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.opencode.length>0?12+c.opencode.length*3:4)}%`}})})]}),i.jsxs("div",{className:"af-set-meter",children:[i.jsxs("div",{className:"af-set-meter-row",children:[i.jsx("span",{children:t("settings:system.claudeCodeModels")}),i.jsx("span",{children:c.claudeCode.length})]}),i.jsx("div",{className:"af-set-meter-bar",children:i.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.claudeCode.length>0?12+c.claudeCode.length*3:4)}%`}})})]}),i.jsxs("div",{className:"af-set-meter",children:[i.jsxs("div",{className:"af-set-meter-row",children:[i.jsx("span",{children:t("settings:system.codexModels")}),i.jsx("span",{children:c.codex.length})]}),i.jsx("div",{className:"af-set-meter-bar",children:i.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.codex.length>0?12+c.codex.length*3:4)}%`}})})]})]}),i.jsx("div",{className:"af-set-rail-watermark","aria-hidden":!0,children:i.jsx("span",{className:"material-symbols-outlined",children:"vital_signs"})})]}),i.jsxs("div",{className:"af-set-rail-card",children:[i.jsx("h3",{className:"af-set-rail-h3 af-set-rail-h3--sm",children:t("settings:language.title")}),i.jsxs("div",{className:"af-set-language-selector",children:[i.jsx("select",{className:"af-set-input af-set-input--sm",value:r,onChange:co,"aria-label":t("settings:language.description"),children:mse.map(se=>i.jsxs("option",{value:se.code,children:[se.flag," ",se.name]},se.code))}),i.jsx("p",{className:"af-set-hint",children:t("settings:language.description")})]})]})]})]})})]})})]})}function Fr(e){return new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(Math.max(0,Number(e||0)))}function Ep(e){return`${Math.round(Math.max(0,Math.min(1,Number(e||0)))*100)}%`}function ew(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 vse(e){const t=String(e||"");return t.includes("-")?t.slice(5):t}function tw(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 Sse(e){const t=String(e||"").trim();return t?t.length>18?t.slice(0,8)+"..."+t.slice(-6):t:"-"}function Nse(e){const t=String(e||"unknown");return t==="success"?"成功":t==="failed"?"失败":t==="running"?"运行中":t==="stopped"?"已停止":t==="interrupted"?"中断":"未知"}function jse({authUser:e}){const[t,n]=m.useState(null),[r,s]=m.useState(!1),[o,a]=m.useState(""),l=m.useCallback(async()=>{if(e!=null&&e.isAdmin){s(!0),a("");try{const h=await fetch("/api/admin/usage-dashboard"),g=await h.json().catch(()=>({}));if(!h.ok)throw new Error(typeof g.error=="string"?g.error:"HTTP "+h.status);n(g)}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 k={top:20,right:24,bottom:42,left:42},b=980-k.left-k.right,y=250-k.top-k.bottom,v=c.length>0?c:[],w=Math.max(1,...v.map(D=>Number(D.runs||0))),C=Math.max(1,...v.flatMap(D=>[Number(D.users||0),Number(D.pipelines||0)])),N=D=>k.left+(v.length<=1?b/2:D*b/(v.length-1)),j=D=>k.top+y-Math.max(0,Number(D||0))/w*y,A=D=>k.top+y-Math.max(0,Number(D||0))/C*y,I=D=>v.map((B,W)=>`${W===0?"M":"L"} ${N(W)} ${A(B[D])}`).join(" ");return{width:980,height:250,margin:k,innerHeight:y,rows:v,x:N,yRuns:j,yLine:A,lineUsers:I("users"),linePipelines:I("pipelines"),barWidth:Math.min(34,Math.max(12,b/Math.max(1,v.length)*.44))}},[c]),d=(t==null?void 0:t.usage)||{},p=(t==null?void 0:t.totals)||{},f=Array.isArray(t==null?void 0:t.recentRuns)?t.recentRuns:[];return e!=null&&e.isAdmin?i.jsxs("main",{className:"af-admin-usage-page",children:[i.jsxs("section",{className:"af-admin-usage-hero",children:[i.jsxs("div",{children:[i.jsx("p",{className:"af-admin-usage-eyebrow",children:"Admin / Usage"}),i.jsx("h1",{children:"管理看板"}),i.jsx("p",{children:"重点观察使用率、每日趋势、成功率与各用户流水线活跃度。"})]}),i.jsxs("button",{type:"button",onClick:()=>void l(),disabled:r,children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),r?"刷新中":"刷新"]})]}),o?i.jsx("div",{className:"af-project-admin-usage__error",children:o}):null,i.jsxs("section",{className:"af-admin-usage-rate-grid","aria-label":"使用率",children:[i.jsxs("div",{children:[i.jsx("span",{children:"7日活跃用户率"}),i.jsx("strong",{children:Ep(d.activeUserRate)}),i.jsxs("em",{children:[Fr(d.activeUsers)," / ",Fr(p.users)," users"]})]}),i.jsxs("div",{children:[i.jsx("span",{children:"7日流水线使用率"}),i.jsx("strong",{children:Ep(d.activePipelineRate)}),i.jsxs("em",{children:[Fr(d.activePipelines)," / ",Fr(p.activePipelines)," active"]})]}),i.jsxs("div",{children:[i.jsx("span",{children:"7日 Run"}),i.jsx("strong",{children:Fr(d.runs)}),i.jsxs("em",{children:[Fr(d.avgRunsPerDay)," / day"]})]}),i.jsxs("div",{children:[i.jsx("span",{children:"7日成功率"}),i.jsx("strong",{children:Ep(d.successRate)}),i.jsxs("em",{children:["失败率 ",Ep(d.failureRate)," · avg ",ew(d.avgDurationMs)]})]})]}),i.jsxs("section",{className:"af-project-admin-usage af-admin-usage-trend",children:[i.jsx("div",{className:"af-project-admin-usage__head",children:i.jsxs("div",{children:[i.jsx("strong",{children:"每日趋势"}),i.jsx("span",{children:"上方看趋势,下方看最近 50 次具体运行。"})]})}),i.jsxs("div",{className:"af-admin-usage-chart",role:"img","aria-label":"最近 14 天运行趋势",children:[i.jsxs("div",{className:"af-admin-usage-chart__legend",children:[i.jsxs("span",{children:[i.jsx("i",{className:"af-admin-usage-chart__swatch af-admin-usage-chart__swatch--runs"}),"Runs"]}),i.jsxs("span",{children:[i.jsx("i",{className:"af-admin-usage-chart__swatch af-admin-usage-chart__swatch--users"}),"活跃用户"]}),i.jsxs("span",{children:[i.jsx("i",{className:"af-admin-usage-chart__swatch af-admin-usage-chart__swatch--pipelines"}),"活跃流水线"]})]}),i.jsx("div",{className:"af-admin-usage-chart__canvas",children:i.jsxs("svg",{viewBox:`0 0 ${u.width} ${u.height}`,preserveAspectRatio:"xMidYMid meet",children:[i.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=>i.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,g)=>{const k=u.x(g),b=u.yRuns(h.runs),y=u.margin.top+u.innerHeight,v=Math.max(2,y-b);return i.jsxs("g",{children:[i.jsx("rect",{className:"af-admin-usage-chart__run-bar",x:k-u.barWidth/2,y:y-v,width:u.barWidth,height:v,rx:"5",children:i.jsx("title",{children:`${h.date}: ${h.runs} runs`})}),i.jsx("text",{className:"af-admin-usage-chart__value",x:k,y:y+22,children:Fr(h.runs)}),i.jsx("text",{className:"af-admin-usage-chart__date",x:k,y:y+42,children:vse(h.date)})]},h.date)}),u.rows.length>0?i.jsxs(i.Fragment,{children:[i.jsx("path",{className:"af-admin-usage-chart__line af-admin-usage-chart__line--users",d:u.lineUsers}),i.jsx("path",{className:"af-admin-usage-chart__line af-admin-usage-chart__line--pipelines",d:u.linePipelines}),u.rows.map((h,g)=>{const k=u.x(g);return i.jsxs("g",{children:[i.jsx("circle",{className:"af-admin-usage-chart__point af-admin-usage-chart__point--users",cx:k,cy:u.yLine(h.users),r:"3.5"}),i.jsx("circle",{className:"af-admin-usage-chart__point af-admin-usage-chart__point--pipelines",cx:k,cy:u.yLine(h.pipelines),r:"3.5"})]},`${h.date}-points`)})]}):null]})})]}),i.jsx("div",{className:"af-project-admin-usage__table-wrap",children:i.jsxs("table",{className:"af-project-admin-usage__table af-admin-usage-table--recent",children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"用户"}),i.jsx("th",{children:"流水线"}),i.jsx("th",{children:"运行时间"}),i.jsx("th",{children:"状态"}),i.jsx("th",{children:"耗时"}),i.jsx("th",{children:"Run ID"})]})}),i.jsx("tbody",{children:f.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:6,children:"暂无运行明细"})}):f.map(h=>i.jsxs("tr",{children:[i.jsxs("td",{children:[i.jsx("strong",{children:h.username||h.userId||"-"}),i.jsx("span",{children:h.userId||"-"})]}),i.jsxs("td",{children:[i.jsx("strong",{children:h.flowId||"-"}),i.jsxs("span",{children:[h.runType==="workspace"?"Workspace Run":"Pipeline"," · ",h.flowSource||"user"]})]}),i.jsxs("td",{children:[i.jsx("strong",{children:tw(h.at)}),h.endedAt?i.jsxs("span",{children:["结束 ",tw(h.endedAt)]}):i.jsx("span",{children:"未结束"})]}),i.jsx("td",{children:i.jsx("span",{className:"af-project-admin-usage__chips",children:i.jsx("em",{children:Nse(h.status)})})}),i.jsx("td",{children:ew(h.durationMs)}),i.jsx("td",{children:i.jsx("code",{className:"af-admin-usage-run-id",children:Sse(h.runId)})})]},`${h.userId}:${h.flowSource}:${h.flowId}:${h.runId}:${h.at}`))})]})})]}),i.jsxs("section",{className:"af-project-admin-usage",children:[i.jsx("div",{className:"af-project-admin-usage__head",children:i.jsxs("div",{children:[i.jsx("strong",{children:"用户使用明细"}),i.jsx("span",{children:"按用户汇总 Pipeline 数、Run 次数和最近运行。"})]})}),i.jsx("div",{className:"af-project-admin-usage__table-wrap",children:i.jsxs("table",{className:"af-project-admin-usage__table",children:[i.jsx("thead",{children:i.jsxs("tr",{children:[i.jsx("th",{children:"User"}),i.jsx("th",{children:"Pipeline"}),i.jsx("th",{children:"Runs"}),i.jsx("th",{children:"状态"}),i.jsx("th",{children:"最近运行"})]})}),i.jsx("tbody",{children:r&&!t?i.jsx("tr",{children:i.jsx("td",{colSpan:5,children:"正在加载..."})}):((t==null?void 0:t.users)||[]).length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:5,children:"暂无用户数据"})}):((t==null?void 0:t.users)||[]).map(h=>{var g,k,b,y,v,w,C,N,j,A,I;return i.jsxs("tr",{children:[i.jsxs("td",{children:[i.jsx("strong",{children:h.username||h.userId}),i.jsxs("span",{children:[h.userId,h.isAdmin?" · admin":""]})]}),i.jsxs("td",{children:[i.jsx("strong",{children:Fr((g=h.pipelines)==null?void 0:g.total)}),i.jsxs("span",{children:[Fr((k=h.pipelines)==null?void 0:k.active)," active / ",Fr((b=h.pipelines)==null?void 0:b.archived)," archived"]})]}),i.jsxs("td",{children:[i.jsx("strong",{children:Fr((y=h.runs)==null?void 0:y.total)}),i.jsxs("span",{children:["avg ",ew((v=h.runs)==null?void 0:v.avgDurationMs)]})]}),i.jsx("td",{children:i.jsxs("span",{className:"af-project-admin-usage__chips",children:[i.jsxs("em",{children:["成功 ",Fr((w=h.runs)==null?void 0:w.success)]}),i.jsxs("em",{children:["失败 ",Fr((C=h.runs)==null?void 0:C.failed)]}),i.jsxs("em",{children:["运行中 ",Fr((N=h.runs)==null?void 0:N.running)]})]})}),i.jsx("td",{children:(j=h.runs)!=null&&j.lastRunAt?i.jsxs(i.Fragment,{children:[i.jsx("strong",{children:((A=h.runs)==null?void 0:A.lastRunFlowId)||"-"}),i.jsxs("span",{children:[((I=h.runs)==null?void 0:I.lastRunStatus)||"unknown"," · ",tw(h.runs.lastRunAt)]})]}):i.jsx("span",{children:"无运行记录"})})]},h.userId)})})]})})]})]}):i.jsx("main",{className:"af-admin-usage-page",children:i.jsx("section",{className:"af-project-admin-usage",children:i.jsx("div",{className:"af-project-admin-usage__head",children:i.jsxs("div",{children:[i.jsx("strong",{children:"管理看板"}),i.jsx("span",{children:"需要管理员权限。"})]})})})})}function Cse(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 _se({authUser:e}){const{navigate:t}=ei(),[n,r]=m.useState(""),[s,o]=m.useState(""),[a,l]=m.useState(!1),[c,u]=m.useState(""),[d,p]=m.useState(!1),[f,h]=m.useState([]),[g,k]=m.useState(!1),[b,y]=m.useState(""),v=!!(e!=null&&e.isAdmin),w=m.useCallback(async()=>{if(v){k(!0),y("");try{const N=await fetch("/api/feedback"),j=await N.json().catch(()=>({}));if(!N.ok)throw new Error(j.error||"加载失败");h(Array.isArray(j.feedback)?j.feedback:[])}catch(N){y(String(N.message||N)),h([])}finally{k(!1)}}},[v]);m.useEffect(()=>{w()},[w]);const C=async N=>{if(N.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})}),A=await j.json().catch(()=>({}));if(!j.ok)throw new Error(A.error||"提交失败");p(!0),r(""),o("")}catch(j){u(String(j.message||j))}finally{l(!1)}}};return v?i.jsx("main",{className:"af-feedback-page",children:i.jsxs("section",{className:"af-feedback-panel af-feedback-panel--admin",children:[i.jsxs("div",{className:"af-feedback-head",children:[i.jsxs("div",{children:[i.jsx("span",{className:"af-feedback-eyebrow",children:"Feedback"}),i.jsx("h1",{children:"意见反馈"}),i.jsx("p",{children:"查看用户提交的问题、建议和功能需求。"})]}),i.jsxs("div",{className:"af-feedback-admin-actions",children:[i.jsxs("button",{type:"button",className:"af-feedback-back",onClick:()=>void w(),disabled:g,children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:g?"hourglass_empty":"refresh"}),g?"刷新中...":"刷新"]}),i.jsxs("button",{type:"button",className:"af-feedback-back",onClick:()=>t("/projects"),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),"返回"]})]})]}),b?i.jsx("p",{className:"af-err af-feedback-error",children:b}):null,i.jsx("div",{className:"af-feedback-list af-feedback-list--page",children:f.length>0?f.map(N=>i.jsxs("article",{className:"af-feedback-item",children:[i.jsxs("header",{className:"af-feedback-item__head",children:[i.jsxs("div",{children:[i.jsx("h3",{children:N.title||"未命名反馈"}),i.jsxs("p",{children:[i.jsx("span",{children:N.username||N.userId||"unknown"}),i.jsx("span",{children:Cse(N.createdAt)})]})]}),N.contact?i.jsx("span",{className:"af-feedback-item__contact",children:N.contact}):null]}),i.jsx("p",{className:"af-feedback-item__content",children:N.content}),N.pageUrl?i.jsx("code",{className:"af-feedback-item__url",children:N.pageUrl}):null]},N.id)):i.jsx("div",{className:"af-feedback-empty",children:g?"正在加载反馈...":"暂无反馈"})})]})}):i.jsx("main",{className:"af-feedback-page",children:i.jsxs("section",{className:"af-feedback-panel",children:[i.jsxs("div",{className:"af-feedback-head",children:[i.jsxs("div",{children:[i.jsx("span",{className:"af-feedback-eyebrow",children:"Feedback"}),i.jsx("h1",{children:"意见反馈"}),i.jsx("p",{children:"提交使用中遇到的问题、改进建议或功能需求,管理员会在这里统一查看。"})]}),i.jsxs("button",{type:"button",className:"af-feedback-back",onClick:()=>t("/projects"),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),"返回"]})]}),d?i.jsxs("div",{className:"af-feedback-success",role:"status",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"check_circle"}),i.jsxs("div",{children:[i.jsx("strong",{children:"已提交"}),i.jsx("span",{children:"感谢反馈,管理员可以在意见反馈页查看这条记录。"})]})]}):null,i.jsxs("form",{className:"af-feedback-form",onSubmit:C,children:[i.jsxs("label",{className:"af-feedback-field",children:[i.jsx("span",{children:"标题"}),i.jsx("input",{value:n,onChange:N=>r(N.target.value),placeholder:"一句话说明问题或建议",maxLength:120,required:!0})]}),i.jsxs("label",{className:"af-feedback-field",children:[i.jsx("span",{children:"反馈内容"}),i.jsx("textarea",{value:s,onChange:N=>o(N.target.value),placeholder:"描述具体场景、期望表现、实际表现或复现步骤",maxLength:5e3,rows:9,required:!0})]}),c?i.jsx("p",{className:"af-err af-feedback-error",children:c}):null,i.jsx("div",{className:"af-feedback-actions",children:i.jsxs("button",{type:"submit",className:"af-feedback-submit",disabled:a||!n.trim()||!s.trim(),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:a?"hourglass_empty":"send"}),a?"提交中...":"提交反馈"]})})]})]})})}function GT(){return`m_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function WC(e,t=[]){const n=new Set((Array.isArray(t)?t:[]).map(String));return Object.entries(e&&typeof e=="object"?e:{}).map(([r,s])=>({id:GT(),key:r,value:String(s??""),private:n.has(r)}))}function VC(e){const t={};for(const n of Array.isArray(e)?e:[]){const r=String((n==null?void 0:n.key)||"").trim();r&&(t[r]=String((n==null?void 0:n.value)??""))}return t}function rh(e=null){const t=e!=null&&e.raw&&typeof e.raw=="object"?e.raw:{},n=Array.isArray(t.args)?t.args:Array.isArray(e==null?void 0:e.args)?e.args:[];return{originalName:String((e==null?void 0:e.name)||""),name:String((e==null?void 0:e.name)||""),type:e!=null&&e.url||t.url?"url":"command",url:String((e==null?void 0:e.url)||t.url||""),command:String((e==null?void 0:e.command)||t.command||""),argsText:n.map(String).join(`
|
|
315
|
-
`),description:String((e==null?void 0:e.description)||t.description||""),envRows:WC(t.env||(e==null?void 0:e.env),e==null?void 0:e.privateEnvKeys),headerRows:WC(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 nw(){return rh({name:"",raw:{command:""}})}function Ese(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 o=e.argsText.split(/\r?\n/g).map(a=>a.trim()).filter(Boolean);o.length&&(n.args=o)}const r=VC(e.envRows),s=VC(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(o=>o.private).map(o=>String(o.key||"").trim()).filter(Boolean),privateHeaderKeys:e.headerRows.filter(o=>o.private).map(o=>String(o.key||"").trim()).filter(Boolean)}}function KC(e){return e?e.ok?`${e.toolCount||0} tools enabled`:`Error - ${e.error||"Show Output"}`:"未检测"}function qC(e){return e?e.ok?"ok":"error":"unknown"}function ib(e){return e==="ok"?"ok":e==="partial"?"partial":e==="unsupported"?"error":"unknown"}function Ase(e,t){return e&&e.label||t}async function rw(e){var n;const t=String(e||"");if(!t)return!1;try{if((n=navigator.clipboard)!=null&&n.writeText&&window.isSecureContext)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.top="-9999px",r.style.left="-9999px",r.style.opacity="0",document.body.appendChild(r),r.focus(),r.select();const s=document.execCommand("copy");return r.remove(),s}catch{return!1}}function rv(e){return String(e||"").trim()||"<AGENTFLOW_TOKEN>"}function JT({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:rv(t)}}}},null,2)}function XT({baseUrl:e="",token:t=""}){const n=JSON.stringify(String(e||"http://127.0.0.1:8875")),r=JSON.stringify(rv(t));return["[mcp_servers.agentflow]",'command = "agentflow"','args = ["mcp"]',"","[mcp_servers.agentflow.env]",`AGENTFLOW_BASE_URL = ${n}`,`AGENTFLOW_TOKEN = ${r}`].join(`
|
|
316
|
-
`)}function Pse({baseUrl:e="",token:t=""}){const n=String(e||"http://127.0.0.1:8875"),r=JT({baseUrl:n,token:t}),s=XT({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: ${rv(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 的 MCP 页面点击“使用当前登录 Token”后重新复制。","7. 如果外部 Agent 启动 MCP 时找不到 `agentflow` 命令,请把 command 改成本机 agentflow 可执行文件的绝对路径,或先把 agentflow 安装/软链到 PATH。","","配置后验证:","- 如果配置使用 `command: agentflow`,确认外部 Agent 所在环境可以执行这个命令;如果使用绝对路径,则确认路径存在且可执行。","- 通过 MCP 客户端刷新或重启后,确认 `agentflow` server 出现在 MCP server 列表。","- 如果可以做工具探测,只验证 `tools/list` 能看到 `agentflow_list_flows`、`agentflow_run_flow`、`agentflow_get_display_outputs`。","","最终回复只需要说明:配置了哪些文件、是否验证成功、如果失败下一步该检查什么。"].join(`
|
|
317
|
-
`)}function Ise({server:e}){const t=(e==null?void 0:e.backends)||{},n=[["Cursor",t.cursor],["Codex",t.codex]];return i.jsx("div",{className:"af-mcp-backends",children:n.map(([r,s])=>i.jsxs("div",{className:`af-mcp-backend af-mcp-backend--${ib(s==null?void 0:s.status)}`,children:[i.jsxs("div",{className:"af-mcp-backend-head",children:[i.jsx("strong",{children:r}),i.jsx("span",{children:Ase(s,"Unknown")})]}),Array.isArray(s==null?void 0:s.reasons)&&s.reasons.length?i.jsx("ul",{children:s.reasons.map(o=>i.jsx("li",{children:o},o))}):i.jsx("p",{children:"当前配置可直接使用。"})]},r))})}function UC({title:e,rows:t,onChange:n,placeholderKey:r="KEY",placeholderValue:s="value"}){const o=(a,l,c)=>n(t.map(u=>u.id===a?{...u,[l]:c}:u));return i.jsxs("div",{className:"af-mcp-field",children:[i.jsxs("div",{className:"af-mcp-field-head",children:[i.jsx("span",{children:e}),i.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>n([...t,{id:GT(),key:"",value:"",private:!0}]),children:"添加"})]}),i.jsxs("div",{className:"af-mcp-kv-list",children:[t.length===0?i.jsx("p",{className:"af-set-hint",children:"暂无"}):null,t.map(a=>i.jsxs("div",{className:"af-mcp-kv-row",children:[i.jsx("input",{className:"af-set-input af-set-input--mono",value:a.key,placeholder:r,onChange:l=>o(a.id,"key",l.target.value)}),i.jsx("input",{className:"af-set-input af-set-input--mono",value:a.value,placeholder:s,onChange:l=>o(a.id,"value",l.target.value)}),i.jsxs("label",{className:"af-mcp-private-toggle",title:"只保存到当前 AgentFlow 用户的个人配置",children:[i.jsx("input",{type:"checkbox",checked:!!a.private,onChange:l=>o(a.id,"private",l.target.checked)}),i.jsx("span",{children:"个人"})]}),i.jsx("button",{type:"button",className:"af-set-env-del",onClick:()=>n(t.filter(l=>l.id!==a.id)),"aria-label":"删除",children:i.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},a.id))]})]})}function Rse(){var ce;const[e,t]=m.useState(""),[n,r]=m.useState([]),[s,o]=m.useState(nw),[a,l]=m.useState(""),[c,u]=m.useState(!1),[d,p]=m.useState(!1),[f,h]=m.useState(!1),[g,k]=m.useState({}),[b,y]=m.useState(""),[v,w]=m.useState(""),[C,N]=m.useState(()=>{var X;return typeof window<"u"&&((X=window.location)!=null&&X.origin)?window.location.origin:"http://127.0.0.1:8875"}),[j,A]=m.useState(""),[I,D]=m.useState(""),B=m.useMemo(()=>n.find(X=>X.name===a)||null,[a,n]),W=B&&g[B.name]||null,F=m.useMemo(()=>JT({baseUrl:C,token:j}),[C,j]),T=m.useMemo(()=>XT({baseUrl:C,token:j}),[C,j]),M=m.useMemo(()=>Pse({baseUrl:C,token:j}),[C,j]),q=m.useCallback(async()=>{u(!0),y("");try{const X=await fetch("/api/mcps"),re=await X.json().catch(()=>({}));if(!X.ok)throw new Error(re.error||"MCP HTTP "+X.status);const Z=Array.isArray(re.servers)?re.servers:[];t(String(re.path||"")),r(Z),a&&Z.some(ie=>ie.name===a)&&o(rh(Z.find(ie=>ie.name===a)))}catch(X){y(String(X.message||X))}finally{u(!1)}},[a]);m.useEffect(()=>{q()},[q]);const H=()=>{l(""),o(nw()),w(""),y("")},L=X=>{l(X.name),o(rh(X)),w(""),y("")},R=m.useCallback(async()=>{if(!M)return;const X=await rw(M);D(X?"prompt":"copy-failed"),window.setTimeout(()=>D(""),1200)},[M]),z=m.useCallback(async()=>{const X=await rw(F);D(X?"cursor":"copy-failed"),window.setTimeout(()=>D(""),1200)},[F]),E=m.useCallback(async()=>{const X=await rw(T);D(X?"codex":"copy-failed"),window.setTimeout(()=>D(""),1200)},[T]),Q=m.useCallback(async()=>{try{const X=await fetch("/api/auth/session-token"),re=await X.json().catch(()=>({}));if(!X.ok)throw new Error(typeof re.error=="string"?re.error:"HTTP "+X.status);A(String(re.token||"")),D("token"),window.setTimeout(()=>D(""),1200)}catch(X){D(""),y(String(X.message||X))}},[]),V=async(X="")=>{h(!0),y(""),w("");try{const re=await fetch("/api/mcps/check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(X?{name:X}:{})}),Z=await re.json().catch(()=>({}));if(!re.ok)throw new Error(Z.error||"检测 MCP 失败");const ie=Array.isArray(Z.results)?Z.results:[];k(te=>{const ue={...te};for(const fe of ie)fe!=null&&fe.name&&(ue[fe.name]=fe);return ue}),w(X?`已检测 ${X}。`:"已检测所有 MCP。")}catch(re){y(String(re.message||re))}finally{h(!1)}},$=async()=>{p(!0),y(""),w("");try{const X=Ese(s);if(!X.nextName)throw new Error("请填写 MCP 名称");const re=await fetch("/api/mcps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(X)}),Z=await re.json().catch(()=>({}));if(!re.ok)throw new Error(Z.error||"保存 MCP 失败");const ie=Array.isArray(Z.servers)?Z.servers:[];r(ie),t(String(Z.path||e)),l(X.nextName),o(rh(ie.find(te=>te.name===X.nextName)||null)),k(te=>{const ue={...te};return s.originalName&&s.originalName!==X.nextName&&delete ue[s.originalName],delete ue[X.nextName],ue}),w("已保存。Cursor CLI 下次启动时会读取新配置。")}catch(X){y(String(X.message||X))}finally{p(!1)}},ne=async X=>{if(X!=null&&X.name&&window.confirm(`删除 MCP "${X.name}"?`)){p(!0),y(""),w("");try{const re=await fetch("/api/mcps/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:X.name})}),Z=await re.json().catch(()=>({}));if(!re.ok)throw new Error(Z.error||"删除 MCP 失败");r(Array.isArray(Z.servers)?Z.servers:[]),l(""),o(nw()),k(ie=>{const te={...ie};return delete te[X.name],te}),w("已删除。")}catch(re){y(String(re.message||re))}finally{p(!1)}}};return i.jsxs("main",{className:"af-settings-page",children:[i.jsxs("header",{className:"af-settings-top",children:[i.jsxs("div",{className:"af-settings-crumb",children:[i.jsx("span",{className:"af-settings-crumb-muted",children:"AgentFlow"}),i.jsx("span",{className:"af-settings-crumb-sep",children:"/"}),i.jsx("span",{className:"af-settings-crumb-active",children:"MCP"})]}),i.jsxs("div",{className:"af-settings-top-right",children:[i.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:q,disabled:c||d,children:"刷新"}),i.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>V(),disabled:f||c||d||n.length===0,children:f?"检测中...":"检测状态"}),i.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:H,disabled:d,children:"新增 MCP"})]})]}),i.jsx("div",{className:"af-settings-body",children:i.jsxs("div",{className:"af-settings-inner",children:[i.jsxs("section",{className:"af-settings-hero",children:[i.jsx("h1",{className:"af-settings-h1",children:"MCP 管理"}),i.jsx("p",{className:"af-settings-lead",children:"管理 AgentFlow 暴露给外部 Agent 的 MCP 接入方式,以及 AgentFlow 自身可调用的外部 MCP server。"})]}),i.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low af-set-mcp-personal",children:[i.jsxs("div",{className:"af-set-env-head",children:[i.jsxs("div",{className:"af-set-card-head",children:[i.jsx("div",{className:"af-set-env-icon-wrap",children:i.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"lan"})}),i.jsxs("div",{children:[i.jsx("h2",{className:"af-set-h2",children:"我的 MCP"}),i.jsx("p",{className:"af-set-card-subtitle",children:"给 Cursor、Codex 等外部 Agent 配置 AgentFlow MCP,用来运行流程并读取 display 结果。"})]})]}),i.jsx("span",{className:"af-set-badge af-set-badge--ok",children:"AgentFlow as MCP"})]}),i.jsx("p",{className:"af-set-hint",children:"这里生成的是让其他 Agent 连接本平台的配置;下方“外部 MCP Servers”管理的是 AgentFlow 运行时可调用的外部工具。"}),i.jsxs("div",{className:"af-set-mcp-connect-grid",children:[i.jsxs("label",{className:"af-set-mcp-field",children:[i.jsx("span",{children:"Base URL"}),i.jsx("input",{className:"af-set-input af-set-input--mono",value:C,onChange:X=>N(X.target.value),placeholder:"http://127.0.0.1:8875"})]}),i.jsxs("label",{className:"af-set-mcp-field",children:[i.jsx("span",{children:"Token"}),i.jsxs("div",{className:"af-set-mcp-token-row",children:[i.jsx("input",{className:"af-set-input af-set-input--mono",type:"password",value:j,onChange:X=>A(X.target.value),placeholder:"<AGENTFLOW_TOKEN>"}),i.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:Q,children:I==="token"?"已填入":"使用当前登录 Token"})]})]})]}),i.jsxs("div",{className:"af-set-mcp-snippet-grid",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"af-set-mcp-snippet-head",children:[i.jsx("span",{children:"Cursor mcp.json"}),i.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:z,children:I==="cursor"?"已复制":I==="copy-failed"?"复制失败":"复制"})]}),i.jsx("pre",{className:"af-set-mcp-code",children:F})]}),i.jsxs("div",{children:[i.jsxs("div",{className:"af-set-mcp-snippet-head",children:[i.jsx("span",{children:"Codex config.toml"}),i.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:E,children:I==="codex"?"已复制":I==="copy-failed"?"复制失败":"复制"})]}),i.jsx("pre",{className:"af-set-mcp-code",children:T})]})]}),i.jsx("div",{className:"af-set-mcp-copy-row",children:i.jsxs("button",{type:"button",className:"af-set-footer-primary",onClick:R,children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"content_copy"}),I==="prompt"?"已复制 Prompt":I==="copy-failed"?"复制失败":"复制 AI 配置 Prompt"]})}),I==="copy-failed"?i.jsx("p",{className:"af-mcp-error",children:"浏览器禁止访问剪贴板,请手动选中下面的 Prompt 复制。"}):null,i.jsx("label",{className:"af-set-label-sm",htmlFor:"af-mcp-ai-prompt",children:"AI 配置 Prompt"}),i.jsx("textarea",{id:"af-mcp-ai-prompt",className:"af-set-input af-set-input--mono af-set-mcp-prompt",rows:12,readOnly:!0,value:M})]}),i.jsxs("section",{className:"af-settings-hero af-settings-hero--compact",children:[i.jsx("h2",{className:"af-settings-h2",children:"外部 MCP Servers"}),i.jsxs("p",{className:"af-settings-lead",children:["新增、编辑和删除 AgentFlow 可调用的外部 MCP server。当前配置文件:",i.jsx("span",{className:"af-settings-code",children:e||"~/.cursor/mcp.json"})]})]}),i.jsxs("div",{className:"af-mcp-layout",children:[i.jsxs("section",{className:"af-set-card af-mcp-list-card",children:[i.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[i.jsx("h2",{className:"af-set-h2",children:"Servers"}),i.jsxs("div",{className:"af-mcp-list-head-actions",children:[i.jsx("span",{className:"af-set-badge af-set-badge--muted",children:n.length}),i.jsxs("button",{type:"button",className:"af-set-btn-mini",onClick:H,disabled:d,children:[i.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新增"]})]})]}),c?i.jsx("p",{className:"af-set-p",children:"加载中..."}):null,n.length===0&&!c?i.jsxs("div",{className:"af-mcp-empty",children:[i.jsx("p",{className:"af-set-p",children:"暂无 MCP server。"}),i.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:H,disabled:d,children:"新增 MCP Server"})]}):null,i.jsx("div",{className:"af-mcp-server-list",children:n.map(X=>{var re,Z,ie,te;return i.jsxs("button",{type:"button",className:"af-mcp-server-item"+(a===X.name?" af-mcp-server-item--active":""),onClick:()=>L(X),children:[i.jsx("span",{className:"material-symbols-outlined",children:X.type==="url"?"cloud":"terminal"}),i.jsxs("span",{children:[i.jsxs("span",{className:"af-mcp-server-title",children:[i.jsx("strong",{children:X.name}),i.jsx("small",{className:`af-mcp-server-health af-mcp-server-health--${qC(g[X.name])}`,children:KC(g[X.name])})]}),i.jsxs("span",{className:"af-mcp-server-backends",children:[i.jsx("small",{className:`af-mcp-backend-pill af-mcp-backend-pill--${ib((Z=(re=X.backends)==null?void 0:re.cursor)==null?void 0:Z.status)}`,children:"Cursor"}),i.jsx("small",{className:`af-mcp-backend-pill af-mcp-backend-pill--${ib((te=(ie=X.backends)==null?void 0:ie.codex)==null?void 0:te.status)}`,children:"Codex"})]}),i.jsx("em",{children:X.url||[X.command,...X.args||[]].filter(Boolean).join(" ")})]})]},X.name)})})]}),i.jsxs("section",{className:"af-set-card af-mcp-editor-card",children:[i.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[i.jsxs("div",{children:[i.jsx("h2",{className:"af-set-h2",children:B?"编辑 MCP":"新增 MCP"}),i.jsx("p",{className:"af-set-p af-set-p--tight",children:"保存后会写入 Cursor MCP 配置。已运行的 agent 进程不会热更新,下一次启动会读取新配置。"})]}),B?i.jsxs("div",{className:"af-mcp-editor-actions",children:[i.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>V(B.name),disabled:f||d,children:f?"检测中...":"检测"}),i.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>ne(B),disabled:d,children:"删除"})]}):null]}),b?i.jsx("p",{className:"af-mcp-error",children:b}):null,v?i.jsx("p",{className:"af-mcp-status",children:v}):null,B?i.jsx(Ise,{server:B}):null,W?i.jsxs("div",{className:`af-mcp-check af-mcp-check--${qC(W)}`,children:[i.jsxs("div",{className:"af-mcp-check-head",children:[i.jsx("strong",{children:KC(W)}),i.jsxs("span",{children:[W.elapsedMs||0,"ms"]})]}),W.error?i.jsx("p",{children:W.error}):null,(ce=W.tools)!=null&&ce.length?i.jsx("div",{className:"af-mcp-tools-list",children:W.tools.map(X=>i.jsxs("div",{className:"af-mcp-tool-row",children:[i.jsx("strong",{children:X.name}),X.description?i.jsx("span",{children:X.description}):null]},X.name))}):null]}):null,i.jsxs("div",{className:"af-mcp-form",children:[i.jsxs("label",{className:"af-set-label",children:["MCP 名称",i.jsx("input",{className:"af-set-input af-set-input--mono",value:s.name,onChange:X=>o(re=>({...re,name:X.target.value})),placeholder:"github"})]}),i.jsxs("label",{className:"af-set-label",children:["类型",i.jsxs("select",{className:"af-set-input",value:s.type,onChange:X=>o(re=>({...re,type:X.target.value})),children:[i.jsx("option",{value:"url",children:"URL / HTTP"}),i.jsx("option",{value:"command",children:"Command / stdio"})]})]}),s.type==="url"?i.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["URL",i.jsx("input",{className:"af-set-input af-set-input--mono",value:s.url,onChange:X=>o(re=>({...re,url:X.target.value})),placeholder:"http://127.0.0.1:3845/mcp"})]}):i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"af-set-label",children:["Command",i.jsx("input",{className:"af-set-input af-set-input--mono",value:s.command,onChange:X=>o(re=>({...re,command:X.target.value})),placeholder:"uvx"})]}),i.jsxs("label",{className:"af-set-label",children:["Args,每行一个",i.jsx("textarea",{className:"af-set-input af-mcp-textarea af-set-input--mono",rows:4,value:s.argsText,onChange:X=>o(re=>({...re,argsText:X.target.value})),placeholder:`mcp-server-example
|
|
318
|
-
--flag`})]})]}),i.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["描述",i.jsx("input",{className:"af-set-input",value:s.description,onChange:X=>o(re=>({...re,description:X.target.value})),placeholder:"这个 MCP 提供什么能力"})]}),i.jsx(UC,{title:"Headers",rows:s.headerRows,onChange:X=>o(re=>({...re,headerRows:X})),placeholderKey:"Authorization",placeholderValue:"Bearer ..."}),i.jsx(UC,{title:"Env",rows:s.envRows,onChange:X=>o(re=>({...re,envRows:X})),placeholderKey:"TOKEN",placeholderValue:"..."}),i.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["额外 JSON 字段",i.jsx("textarea",{className:"af-set-input af-mcp-textarea af-set-input--mono",rows:5,value:s.extraJson,onChange:X=>o(re=>({...re,extraJson:X.target.value}))})]})]}),i.jsxs("div",{className:"af-mcp-actions",children:[i.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:H,disabled:d,children:"清空"}),i.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:$,disabled:d,children:d?"保存中...":"保存 MCP"})]})]})]})]})})]})}function Tse(e={}){const t=String((e==null?void 0:e.flowId)||"").trim();if(!t)return"";const n=new URLSearchParams({flowId:t,flowSource:String((e==null?void 0:e.flowSource)||"user").trim()||"user"}),r=String((e==null?void 0:e.workspaceId)||"").trim();if(r&&n.set("workspaceId",r),(e==null?void 0:e.kind)==="workspace"){const s=String((e==null?void 0:e.scheduleNodeId)||"").trim();s&&n.set("focusNodeId",s)}return`/workspace?${n.toString()}`}function YC(e={}){return(e==null?void 0:e.kind)==="workspace"&&String((e==null?void 0:e.scheduleNodeId)||"").trim()?"打开节点":"打开项目"}function GC(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 Mse(e){return(e==null?void 0:e.kind)==="workspace"?"Workspace":"Pipeline"}function $se(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 Lse(){const{navigate:e}=ei(),[t,n]=m.useState([]),[r,s]=m.useState(!1),[o,a]=m.useState(""),[l,c]=m.useState(""),u=m.useCallback(async()=>{s(!0),a("");try{const f=await fetch("/api/schedules"),h=await f.json().catch(()=>({}));if(!f.ok)throw new Error(h.error||"读取定时任务失败");n(Array.isArray(h.schedules)?h.schedules:[])}catch(f){a(String(f.message||f)),n([])}finally{s(!1)}},[]);m.useEffect(()=>{u()},[u]);const d=m.useCallback(async f=>{const h=`${f.kind}:${f.flowSource||"user"}:${f.flowId||""}:${f.scheduleNodeId||""}`;c(h),a("");try{const g=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})}),k=await g.json().catch(()=>({}));if(!g.ok||k.success===!1)throw new Error(k.error||"更新定时任务失败");await u()}catch(g){a(String(g.message||g))}finally{c("")}},[u]),p=m.useMemo(()=>{const f=t.filter(g=>g.enabled).length,h=t.filter(g=>g.kind==="workspace").length;return{total:t.length,enabled:f,workspace:h,pipeline:t.length-h}},[t]);return i.jsxs("div",{className:"af-settings-page af-schedules-page",children:[i.jsxs("div",{className:"af-settings-top",children:[i.jsxs("div",{className:"af-settings-crumb",children:[i.jsx("span",{className:"af-settings-crumb-muted",children:"AgentFlow"}),i.jsx("span",{className:"af-settings-crumb-sep",children:"/"}),i.jsx("span",{className:"af-settings-crumb-active",children:"定时任务"})]}),i.jsxs("button",{type:"button",className:"af-schedules-refresh",onClick:()=>void u(),disabled:r,children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:r?"hourglass_empty":"refresh"}),"刷新"]})]}),i.jsx("div",{className:"af-settings-body",children:i.jsxs("div",{className:"af-settings-inner",children:[i.jsxs("section",{className:"af-settings-hero",children:[i.jsx("h1",{className:"af-settings-h1",children:"定时任务"}),i.jsx("p",{className:"af-settings-lead",children:"统一查看服务器上的 Pipeline 定时任务和 Workspace Scheduled Run,并在这里快捷启停。"})]}),i.jsxs("div",{className:"af-schedules-summary","aria-label":"定时任务汇总",children:[i.jsxs("div",{children:[i.jsx("span",{children:"全部"}),i.jsx("strong",{children:p.total})]}),i.jsxs("div",{children:[i.jsx("span",{children:"启用中"}),i.jsx("strong",{children:p.enabled})]}),i.jsxs("div",{children:[i.jsx("span",{children:"Workspace"}),i.jsx("strong",{children:p.workspace})]}),i.jsxs("div",{children:[i.jsx("span",{children:"Pipeline"}),i.jsx("strong",{children:p.pipeline})]})]}),o?i.jsx("div",{className:"af-schedules-error",children:o}):null,r?i.jsx("div",{className:"af-schedules-empty",children:"Loading..."}):null,!r&&t.length===0?i.jsx("div",{className:"af-schedules-empty",children:"暂无定时任务"}):null,i.jsx("div",{className:"af-schedules-list",children:t.map(f=>{const h=`${f.kind}:${f.flowSource||"user"}:${f.flowId||""}:${f.scheduleNodeId||""}`,g=l===h,k=Tse(f);return i.jsxs("article",{className:"af-schedule-card",children:[i.jsxs("div",{className:"af-schedule-card__main",children:[i.jsxs("div",{className:"af-schedule-card__title-row",children:[i.jsx("strong",{children:f.label||f.flowId||"-"}),i.jsx("span",{className:`af-schedule-badge af-schedule-badge--${f.kind||"pipeline"}`,children:Mse(f)}),i.jsx("span",{className:`af-schedule-state ${f.enabled?"af-schedule-state--on":"af-schedule-state--off"}`,children:$se(f)})]}),i.jsxs("div",{className:"af-schedule-card__meta",children:[i.jsx("span",{children:f.flowId||"-"}),i.jsx("span",{children:f.flowSource||"user"}),f.scheduleNodeId?i.jsx("span",{children:f.scheduleNodeId}):null]}),i.jsxs("div",{className:"af-schedule-card__grid",children:[i.jsxs("div",{children:[i.jsx("span",{children:"Cron"}),i.jsx("strong",{children:f.cron||"-"})]}),i.jsxs("div",{children:[i.jsx("span",{children:"时区"}),i.jsx("strong",{children:f.timezone||"Asia/Shanghai"})]}),i.jsxs("div",{children:[i.jsx("span",{children:"下次执行"}),i.jsx("strong",{children:GC(f.nextRunAt)})]}),i.jsxs("div",{children:[i.jsx("span",{children:"最近执行"}),i.jsx("strong",{children:GC(f.lastTriggeredAt)})]})]}),f.lastError?i.jsx("p",{className:"af-schedule-card__error",children:f.lastError}):null]}),i.jsxs("div",{className:"af-schedule-card__actions",children:[k?i.jsxs("button",{type:"button",className:"af-schedule-open",title:YC(f),onClick:()=>e(k),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"}),YC(f)]}):null,i.jsxs("button",{type:"button",className:f.enabled?"af-schedule-toggle af-schedule-toggle--on":"af-schedule-toggle af-schedule-toggle--off",disabled:g,"aria-pressed":f.enabled,title:f.enabled?"点击停用":"点击启用",onClick:()=>void d(f),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:g?"hourglass_empty":f.enabled?"toggle_on":"toggle_off"}),f.enabled?"已启用":"已停用"]})]})]},h)})})]})})]})}const JC={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 XC(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 Ose(e){var c,u,d,p,f,h,g,k,b,y,v,w;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:[],o=Array.isArray((c=t.configSchema)==null?void 0:c.fields)?t.configSchema.fields:[],a=Array.isArray((d=(u=t.ui)==null?void 0:u.card)==null?void 0:d.actions)?t.ui.card.actions:[],l=(p=e==null?void 0:e.test)!=null&&p.inputs&&typeof e.test.inputs=="object"?e.test.inputs:{};return[{id:"contract",label:"Contract",icon:"account_tree",rows:[...r.map(C=>[`input.${C.name||"-"}`,`${C.type||"text"}${C.required?" · required":""}${C.default?` · default: ${C.default}`:""}`]),...s.map(C=>[`output.${C.name||"-"}`,C.type||"text"]),...o.map(C=>[`config.${C.key||"-"}`,C.type||"text"])]},{id:"runtime",label:"Runtime",icon:"terminal",rows:[["runtime.type",((f=t.runtime)==null?void 0:f.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",((k=(g=t.ui)==null?void 0:g.card)==null?void 0:k.variant)||"default"],["card.icon",((y=(b=t.ui)==null?void 0:b.card)==null?void 0:y.icon)||"extension"],...a.map(C=>[`action.${C.id||C.label||"-"}`,C.variant||C.label||"secondary"])]},{id:"tests",label:"Tests",icon:"science",rows:[...Object.entries(l).map(([C,N])=>[`sample.${C}`,String(N)]),["last run",`${((v=e==null?void 0:e.test)==null?void 0:v.status)||"not run"}${(w=e==null?void 0:e.test)!=null&&w.durationMs?` · ${e.test.durationMs}ms`:""}`]]}]}function Dse(){var T,M,q,H,L,R,z;const[e,t]=m.useState(null),[n,r]=m.useState("runtime"),[s,o]=m.useState(!1),[a,l]=m.useState(!0),[c,u]=m.useState(""),[d,p]=m.useState(!1),[f,h]=m.useState(""),g=e||JC,k=m.useMemo(()=>Ose(g),[g]),b=m.useMemo(()=>k.find(E=>E.id===n)||k[1],[n,k]),y=(g==null?void 0:g.manifest)||{},v=(g==null?void 0:g.config)||{},w=((T=g==null?void 0:g.test)==null?void 0:T.inputs)||{},C=Array.isArray((M=g==null?void 0:g.test)==null?void 0:M.log)?g.test.log:[],N=((H=(q=y.ui)==null?void 0:q.card)==null?void 0:H.icon)||"event_repeat",j=((R=(L=y.ui)==null?void 0:L.card)==null?void 0:R.variant)||"default",A=v.enabled===!0,I=m.useCallback(async()=>{var E;l(!0),u("");try{const Q=await fetch("/api/node-studio/drafts"),V=await Q.json().catch(()=>({}));if(!Q.ok)throw new Error(V.error||"读取节点草稿失败");const $=Array.isArray(V.drafts)?V.drafts[0]:null;if(!($!=null&&$.id)){t(null),h("");return}const ne=await fetch(`/api/node-studio/draft?id=${encodeURIComponent($.id)}`),ce=await ne.json().catch(()=>({}));if(!ne.ok)throw new Error(ce.error||"读取节点草稿失败");t(ce.draft||null),h(String(((E=ce.draft)==null?void 0:E.promptDraft)||""))}catch(Q){u(String(Q.message||Q))}finally{l(!1)}},[]);m.useEffect(()=>{I()},[I]);const D=m.useCallback(async(E={})=>{var Q;p(!0),u("");try{const V=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",...E})}),$=await V.json().catch(()=>({}));if(!V.ok||$.ok===!1)throw new Error($.error||"保存节点草稿失败");t($.draft||e),h(String(((Q=$.draft||e)==null?void 0:Q.promptDraft)||""))}catch(V){u(String(V.message||V))}finally{p(!1)}},[e]),B=()=>{o(!0),window.setTimeout(()=>o(!1),900)},W=E=>{const Q={...v,enabled:E};t(V=>({...V||JC,config:Q})),D({config:{enabled:E}})},F=()=>{D({promptDraft:f,appendUserMessage:!0})};return i.jsxs("div",{className:"af-node-studio-page",children:[i.jsxs("header",{className:"af-node-studio-top",children:[i.jsxs("div",{children:[i.jsxs("div",{className:"af-settings-crumb",children:[i.jsx("span",{className:"af-settings-crumb-muted",children:"AgentFlow"}),i.jsx("span",{className:"af-settings-crumb-sep",children:"/"}),i.jsx("span",{className:"af-settings-crumb-active",children:"Node Studio"})]}),i.jsx("h1",{children:"节点编辑器"})]}),i.jsxs("div",{className:"af-node-studio-actions",children:[i.jsxs("button",{type:"button",onClick:()=>void I(),disabled:a,children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"visibility"}),a?"Loading":"Preview"]}),i.jsxs("button",{type:"button",onClick:B,children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:s?"sync":"science"}),"Test"]}),i.jsxs("button",{type:"button",className:"af-node-studio-actions__primary",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"publish"}),"Publish"]})]})]}),i.jsxs("main",{className:"af-node-studio-shell",children:[i.jsxs("aside",{className:"af-node-studio-agent","aria-label":"AI Agent",children:[i.jsxs("div",{className:"af-node-studio-panel-head",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"auto_awesome"}),i.jsx("strong",{children:"AI Agent"})]}),c?i.jsx("div",{className:"af-node-studio-error",children:c}):null,i.jsxs("div",{className:"af-node-studio-thread",children:[e?null:i.jsx("div",{className:"af-node-studio-empty",children:"还没有节点草稿。描述你要创建的节点,发送后会创建一个新的 draft。"}),(Array.isArray(g==null?void 0:g.agentMessages)?g.agentMessages:[]).map((E,Q)=>i.jsx("div",{className:E.role==="user"?"af-node-studio-message af-node-studio-message--user":"af-node-studio-message",children:E.text||""},`${E.role||"message"}-${Q}`)),i.jsxs("div",{className:"af-node-studio-agent-tools",children:[i.jsxs("button",{type:"button",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"edit"}),"修改 UI"]}),i.jsxs("button",{type:"button",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"code"}),"改脚本"]}),i.jsxs("button",{type:"button",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"bug_report"}),"修复报错"]})]})]}),i.jsxs("label",{className:"af-node-studio-prompt",children:[i.jsx("span",{children:"需求"}),i.jsx("textarea",{value:f,onChange:E=>h(E.target.value)})]}),i.jsxs("button",{type:"button",className:"af-node-studio-send",onClick:F,disabled:d,children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:d?"sync":"send"}),d?"Saving":"Send"]})]}),i.jsxs("section",{className:"af-node-studio-preview","aria-label":"Preview and Test",children:[i.jsxs("div",{className:"af-node-studio-panel-head",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"view_in_ar"}),i.jsx("strong",{children:"Preview / Test"})]}),i.jsxs("div",{className:"af-node-studio-preview-grid",children:[i.jsx("div",{className:"af-node-studio-preview-stage",children:e?j==="schedule"?i.jsxs("div",{className:"af-node-preview-card",children:[i.jsxs("div",{className:"af-node-preview-card__head",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:N}),i.jsx("strong",{children:g.title||y.name||"Untitled Node"}),i.jsx("code",{children:XC(g)})]}),i.jsxs("label",{className:"af-node-preview-toggle",children:[i.jsx("input",{type:"checkbox",checked:A,onChange:E=>W(E.target.checked)}),i.jsx("span",{children:A?"定时开启":"定时关闭"})]}),i.jsxs("div",{className:"af-node-preview-fields",children:[i.jsxs("label",{children:[i.jsx("span",{children:"频率"}),i.jsxs("select",{value:v.scheduleType||"daily",onChange:E=>D({config:{scheduleType:E.target.value}}),children:[i.jsx("option",{value:"daily",children:"每天"}),i.jsx("option",{value:"weekly",children:"每周"})]})]}),i.jsxs("label",{children:[i.jsx("span",{children:"时间"}),i.jsxs("div",{children:[i.jsxs("select",{value:v.hour||"09",onChange:E=>D({config:{hour:E.target.value}}),children:[i.jsx("option",{children:"09"}),i.jsx("option",{children:"10"})]}),i.jsxs("select",{value:v.minute||"00",onChange:E=>D({config:{minute:E.target.value}}),children:[i.jsx("option",{children:"00"}),i.jsx("option",{children:"30"})]})]})]})]}),i.jsxs("div",{className:"af-node-preview-meta",children:[i.jsxs("span",{children:[v.scheduleType==="weekly"?"每周":"每天"," ",v.hour||"09",":",v.minute||"00"]}),i.jsx("span",{children:"Next -"}),i.jsx("span",{children:A?"enabled":"disabled"})]}),i.jsxs("div",{className:"af-node-preview-actions",children:[i.jsxs("button",{type:"button",className:"af-node-preview-run",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"play_arrow"}),"立即运行"]}),i.jsxs("button",{type:"button",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"article"}),"日志"]})]})]}):i.jsxs("div",{className:"af-node-preview-card af-node-preview-card--default",children:[i.jsxs("div",{className:"af-node-preview-card__head",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:N}),i.jsx("strong",{children:g.title||y.name||"Untitled Node"}),i.jsx("code",{children:XC(g)})]}),i.jsxs("div",{className:"af-node-preview-default-body",children:[i.jsx("p",{children:y.description||"这个节点还没有描述。AI 生成 runtime、prompt 或 script 后,内部信息会显示在右侧。"}),i.jsxs("div",{children:[i.jsxs("span",{children:[Array.isArray(y.inputs)?y.inputs.length:0," inputs"]}),i.jsxs("span",{children:[Array.isArray(y.outputs)?y.outputs.length:0," outputs"]}),i.jsx("span",{children:((z=y.runtime)==null?void 0:z.type)||y.baseDefinitionId||"agent_subAgent"})]})]})]}):i.jsxs("div",{className:"af-node-preview-empty",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add_box"}),i.jsx("strong",{children:"暂无预览"}),i.jsx("p",{children:"先在左侧描述你要创建的节点,AI 生成 draft 后这里会展示节点卡片。"})]})}),i.jsxs("div",{className:"af-node-studio-test",children:[i.jsxs("div",{className:"af-node-studio-subhead",children:[i.jsx("strong",{children:"Test Inputs"}),i.jsxs("button",{type:"button",onClick:B,children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:s?"sync":"play_arrow"}),"Run"]})]}),i.jsxs("div",{className:"af-node-studio-inputs",children:[i.jsxs("label",{children:[i.jsx("span",{children:"project"}),i.jsx("input",{value:w.project||"",readOnly:!0,placeholder:"-"})]}),i.jsxs("label",{children:[i.jsx("span",{children:"date"}),i.jsx("input",{value:w.date||"",readOnly:!0,placeholder:"-"})]})]}),i.jsx("div",{className:"af-node-studio-log",children:(s?["running..."]:C.length?C:["No test run yet."]).map((E,Q)=>i.jsx("span",{children:E},`${E}-${Q}`))})]})]})]}),i.jsxs("aside",{className:"af-node-studio-internals","aria-label":"Internals",children:[i.jsxs("div",{className:"af-node-studio-panel-head",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"fact_check"}),i.jsx("strong",{children:"Internals"})]}),i.jsx("div",{className:"af-node-studio-tabs",role:"tablist","aria-label":"Internals sections",children:k.map(E=>i.jsxs("button",{type:"button",className:E.id===n?"af-node-studio-tab af-node-studio-tab--active":"af-node-studio-tab",onClick:()=>r(E.id),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:E.icon}),E.label]},E.id))}),i.jsx("div",{className:"af-node-studio-internal-list",children:b.rows.map(([E,Q])=>i.jsxs("div",{className:"af-node-studio-internal-row",children:[i.jsx("span",{children:E}),i.jsx("strong",{children:Q})]},E))}),i.jsx("pre",{className:"af-node-studio-code",children:b.id==="ui"?JSON.stringify(y.ui||{},null,2):b.id==="contract"?JSON.stringify({inputs:y.inputs||[],outputs:y.outputs||[],configSchema:y.configSchema||{}},null,2):b.id==="tests"?JSON.stringify((g==null?void 0:g.test)||{},null,2):JSON.stringify({runtime:y.runtime||{},files:(g==null?void 0:g.files)||{}},null,2)})]})]})]})}function Fse(){return`ws_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function zse(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function sh(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 Bse(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 sw(){return{id:"",label:"",kind:"git",path:"",repoUrl:"",branch:"master",mountPath:"",credentialRef:"",type:"code",description:"",enabled:!0}}function Ap(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 Hse(e){const t=e.kind==="local"?"local":"git",n=t==="git"?String(e.repoUrl||"").trim():"",r=t==="git"?String(e.mountPath||sh(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 Fi(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 Wse({ok:e}){return i.jsx("span",{className:"af-workspaces-dot"+(e?" af-workspaces-dot--ok":""),"aria-hidden":!0})}function QC({item:e,selected:t,onClick:n,readOnly:r}){return i.jsxs("button",{type:"button",className:"af-workspaces-card"+(t?" af-workspaces-card--selected":""),onClick:n,children:[i.jsxs("div",{className:"af-workspaces-card__head",children:[i.jsx("strong",{children:e.label||"知识库"}),i.jsx("span",{children:e.kind==="git"?"Git":"Local"})]}),i.jsx("p",{children:e.description||e.repoUrl||e.path||"-"}),i.jsxs("div",{className:"af-workspaces-card__meta",children:[i.jsx(Wse,{ok:e.exists!==!1}),i.jsx("span",{children:e.exists===!1?"路径未就绪":"路径可用"}),r?i.jsx("em",{children:"内置"}):e.enabled===!1?i.jsx("em",{children:"disabled"}):null]})]})}function Vse(){const[e,t]=m.useState(!1),[n,r]=m.useState(!1),[s,o]=m.useState(!1),[a,l]=m.useState(""),[c,u]=m.useState(""),[d,p]=m.useState(""),[f,h]=m.useState([]),[g,k]=m.useState([]),[b,y]=m.useState(sw),[v,w]=m.useState(""),[C,N]=m.useState([]),[j,A]=m.useState(""),I=m.useMemo(()=>g.findIndex((V,$)=>Fi(V,$)===j),[g,j]),B=!!m.useMemo(()=>f.find((V,$)=>Fi(V,$)===j)||null,[f,j]),W=m.useMemo(()=>{const V=String(b.credentialRef||"").trim();return V?C.some($=>String(($==null?void 0:$.key)||"").trim()===V&&String(($==null?void 0:$.value)??"")!==""):!1},[b.credentialRef,C]),F=m.useCallback(async()=>{t(!0),l("");try{const[V,$]=await Promise.all([fetch("/api/workspaces"),fetch("/api/user-env")]),ne=await V.json().catch(()=>({})),ce=await $.json().catch(()=>({}));if(!$.ok)throw new Error(typeof ce.error=="string"?ce.error:"ENV HTTP "+$.status);if(!V.ok)throw new Error(typeof ne.error=="string"?ne.error:"HTTP "+V.status);const X=Array.isArray(ne.workspaces)?ne.workspaces:[],re=Array.isArray(ne.customWorkspaces)?ne.customWorkspaces:[];p(String(ne.path||"")),h(X.filter(Z=>Z==null?void 0:Z.builtin)),k(re),N(Array.isArray(ce.env)?ce.env.map(Z=>({key:String((Z==null?void 0:Z.key)||""),value:String((Z==null?void 0:Z.value)??"")})):[])}catch(V){l(String(V.message||V))}finally{t(!1)}},[]);m.useEffect(()=>{F()},[F]);const T=m.useCallback(async(V,$="")=>{r(!0),l(""),u("");try{const ne=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaces:V})}),ce=await ne.json().catch(()=>({}));if(!ne.ok)throw new Error(typeof ce.error=="string"?ce.error:"HTTP "+ne.status);const X=Array.isArray(ce.customWorkspaces)?ce.customWorkspaces:V;k(X),h((Array.isArray(ce.workspaces)?ce.workspaces:[]).filter(re=>re==null?void 0:re.builtin)),p(String(ce.path||d)),$&&A($),u("已保存")}catch(ne){l(String(ne.message||ne))}finally{r(!1)}},[d]),M=m.useCallback(()=>{A(""),y(sw()),w(""),u(""),l("")},[]),q=m.useCallback((V,$)=>{A(Fi(V,$)),y(Ap(V)),w(""),u("")},[]),H=m.useCallback((V,$)=>{A(Fi(V,$)),y(Ap(V)),w(""),u("")},[]),L=m.useCallback(async(V,$)=>{const ne=String(V||"").trim(),ce=String($??"");if(!ne||!ce)return;const X=C.filter(ie=>String((ie==null?void 0:ie.key)||"").trim()!==ne);X.push({key:ne,value:ce});const re=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:X})}),Z=await re.json().catch(()=>({}));if(!re.ok)throw new Error(typeof Z.error=="string"?Z.error:"ENV HTTP "+re.status);N(Array.isArray(Z.env)?Z.env.map(ie=>({key:String((ie==null?void 0:ie.key)||""),value:String((ie==null?void 0:ie.value)??"")})):X)},[C]),R=m.useCallback(()=>{const V=Hse({...b,id:b.id||Fse()}),$=v.trim();if(V.kind==="git"&&$&&!V.credentialRef&&(V.credentialRef=Bse(b,V)),V.kind==="local"&&!V.path){l("本地知识库需要填写路径");return}if(V.kind==="git"&&!V.repoUrl){l("Git 知识库需要填写 repoUrl");return}if(!V.label){l("请填写名称");return}if(V.kind==="git"&&V.credentialRef&&!zse(V.credentialRef)){l("凭证环境变量只能使用字母、数字和下划线,且不能以数字开头");return}const ne=I>=0?g.map((ce,X)=>X===I?V:ce):[V,...g];y(Ap(V)),(async()=>{r(!0);try{$&&await L(V.credentialRef,$),w(""),await T(ne,Fi(V))}catch(ce){l(String(ce.message||ce)),r(!1)}})()},[g,b,T,L,I,v]),z=m.useCallback(()=>{if(I<0)return;const V=g.filter(($,ne)=>ne!==I);y(sw()),A(""),T(V)},[g,T,I]),E=m.useCallback(async()=>{if(!B){if(I<0||!b.id){l("请先保存知识库配置,再拉取更新");return}if(b.kind!=="git"){l("只有 Git 知识库支持拉取更新");return}o(!0),l(""),u("");try{const V=await fetch("/api/workspaces/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:b.id})}),$=await V.json().catch(()=>({}));if(!V.ok)throw new Error(typeof $.error=="string"?$.error:"HTTP "+V.status);const ne=Array.isArray($.customWorkspaces)?$.customWorkspaces:g;k(ne),h((Array.isArray($.workspaces)?$.workspaces:[]).filter(re=>re==null?void 0:re.builtin));const ce=ne.find(re=>String((re==null?void 0:re.id)||"")===String(b.id||""));ce&&y(Ap(ce));const X=String($.commit||"").trim();u($.changed?`已拉取更新${X?`:${X.slice(0,8)}`:""}`:`已是最新${X?`:${X.slice(0,8)}`:""}`)}catch(V){l(String(V.message||V))}finally{o(!1)}}},[g,b,B,I]),Q=m.useCallback(V=>{y($=>({...$,...V}))},[]);return i.jsxs("div",{className:"af-workspaces-page",children:[i.jsxs("header",{className:"af-settings-top",children:[i.jsxs("div",{className:"af-settings-crumb","aria-label":"知识库",children:[i.jsx("span",{className:"af-settings-crumb-muted",children:"AgentFlow"}),i.jsx("span",{className:"af-settings-crumb-sep","aria-hidden":!0,children:"/"}),i.jsx("span",{className:"af-settings-crumb-active",children:"知识库"})]}),i.jsxs("button",{type:"button",className:"af-schedules-refresh",onClick:F,disabled:e,children:[i.jsx("span",{className:"material-symbols-outlined",children:"refresh"}),"刷新"]})]}),i.jsx("main",{className:"af-settings-body",children:i.jsxs("div",{className:"af-workspaces-inner",children:[i.jsxs("header",{className:"af-settings-hero",children:[i.jsx("h1",{className:"af-settings-h1",children:"知识库"}),i.jsx("p",{className:"af-settings-lead",children:"维护可被加载知识库、一键任务和后续 Agent 使用的只读上下文源。Git 字段与 mengmai 的资源配置保持一致。"}),d?i.jsxs("p",{className:"af-workspaces-config",children:["配置文件:",d]}):null,a?i.jsx("p",{className:"af-err af-settings-api-hint",children:a}):null,c?i.jsx("p",{className:"af-workspaces-status",children:c}):null]}),i.jsxs("section",{className:"af-workspaces-summary",children:[i.jsxs("div",{children:[i.jsx("span",{children:"内置"}),i.jsx("strong",{children:f.length})]}),i.jsxs("div",{children:[i.jsx("span",{children:"自定义"}),i.jsx("strong",{children:g.length})]}),i.jsxs("div",{children:[i.jsx("span",{children:"Git"}),i.jsx("strong",{children:g.filter(V=>V.kind==="git").length})]})]}),i.jsxs("div",{className:"af-workspaces-layout",children:[i.jsxs("section",{className:"af-workspaces-list",children:[i.jsxs("div",{className:"af-workspaces-section-head",children:[i.jsx("h2",{children:"自定义知识库"}),i.jsxs("button",{type:"button",onClick:M,children:[i.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新增"]})]}),g.length?g.map((V,$)=>i.jsx(QC,{item:V,selected:Fi(V,$)===j,onClick:()=>q(V,$)},Fi(V,$))):i.jsx("div",{className:"af-workspaces-empty",children:"暂无自定义知识库。新增 Git 或本地目录后,画布里的加载知识库和一键任务就可以选择它。"}),i.jsx("div",{className:"af-workspaces-section-head af-workspaces-section-head--sub",children:i.jsx("h2",{children:"内置知识库"})}),f.map((V,$)=>i.jsx(QC,{item:V,selected:Fi(V,$)===j,onClick:()=>H(V,$),readOnly:!0},Fi(V,$)))]}),i.jsxs("section",{className:"af-workspaces-editor",children:[i.jsxs("div",{className:"af-workspaces-editor__head",children:[i.jsxs("div",{children:[i.jsx("h2",{children:B?"查看内置知识库":I>=0?"编辑知识库":"新增知识库"}),i.jsx("p",{children:B?"内置项由当前运行环境提供,不能在这里修改。":"本地路径用于读取上下文,Git 字段用于后续同步和上下文挂载。"})]}),i.jsxs("label",{className:"af-workspaces-switch",children:[i.jsx("input",{type:"checkbox",checked:b.enabled!==!1,disabled:B,onChange:V=>Q({enabled:V.target.checked})}),i.jsx("span",{children:"启用"})]})]}),i.jsxs("div",{className:"af-workspaces-kind",children:[i.jsxs("button",{type:"button",className:b.kind==="git"?"active":"",disabled:B,onClick:()=>Q({kind:"git",type:b.type==="local"?"code":b.type}),children:[i.jsx("span",{className:"material-symbols-outlined",children:"account_tree"}),"Git"]}),i.jsxs("button",{type:"button",className:b.kind==="local"?"active":"",disabled:B,onClick:()=>Q({kind:"local",type:"local"}),children:[i.jsx("span",{className:"material-symbols-outlined",children:"folder_open"}),"本地目录"]})]}),i.jsxs("div",{className:"af-workspaces-form",children:[i.jsxs("label",{children:[i.jsx("span",{children:"名称"}),i.jsx("input",{value:b.label,disabled:B,onChange:V=>Q({label:V.target.value}),placeholder:"Likee Android"})]}),i.jsxs("label",{children:[i.jsx("span",{children:"类型"}),i.jsxs("select",{value:b.type,disabled:B,onChange:V=>Q({type:V.target.value}),children:[i.jsx("option",{value:"code",children:"code"}),i.jsx("option",{value:"docs",children:"docs"}),i.jsx("option",{value:"analytics",children:"analytics"}),i.jsx("option",{value:"config",children:"config"}),i.jsx("option",{value:"local",children:"local"}),i.jsx("option",{value:"other",children:"other"})]})]}),i.jsxs("label",{className:"af-workspaces-form__wide",children:[i.jsx("span",{children:"本地路径"}),i.jsx("input",{value:b.path,disabled:B,onChange:V=>Q({path:V.target.value}),placeholder:b.kind==="git"?"可空,默认保存到全局资源目录/repos/<仓库名>":"/Users/.../project"})]}),b.kind==="git"?i.jsxs(i.Fragment,{children:[i.jsxs("label",{className:"af-workspaces-form__wide",children:[i.jsx("span",{children:"Git URL"}),i.jsx("input",{value:b.repoUrl,disabled:B,onChange:V=>{const $=V.target.value,ne=sh(b.repoUrl),ce=String(b.mountPath||"").trim();Q({repoUrl:$,...!ce||ce===ne?{mountPath:sh($)}:{}})},placeholder:"https://git.example.com/group/repo.git"})]}),i.jsxs("label",{children:[i.jsx("span",{children:"分支"}),i.jsx("input",{value:b.branch,disabled:B,onChange:V=>Q({branch:V.target.value}),placeholder:"master"})]}),i.jsxs("label",{children:[i.jsx("span",{children:"挂载目录"}),i.jsx("input",{value:b.mountPath,disabled:B,onChange:V=>Q({mountPath:V.target.value}),placeholder:sh(b.repoUrl)||"repo_name"})]}),i.jsxs("label",{className:"af-workspaces-form__wide",children:[i.jsx("span",{children:"凭证环境变量"}),i.jsx("input",{value:b.credentialRef,disabled:B,onChange:V=>Q({credentialRef:V.target.value}),placeholder:"LIKEE_GIT_READONLY_TOKEN"})]}),i.jsxs("label",{className:"af-workspaces-form__wide",children:[i.jsx("span",{children:"Token"}),i.jsx("input",{type:"password",value:v,disabled:B,onChange:V=>w(V.target.value),placeholder:W?"已在个人环境变量中配置;留空则不修改":"保存到个人环境变量,不写入 workspace 配置"}),i.jsx("small",{children:"保存后只在知识库配置中保留 credentialRef,token 会写入当前用户的个人环境变量。"})]})]}):null,i.jsxs("label",{className:"af-workspaces-form__wide",children:[i.jsx("span",{children:"说明"}),i.jsx("textarea",{value:b.description,disabled:B,onChange:V=>Q({description:V.target.value}),placeholder:"这个知识库包含哪些代码、文档或需求上下文"})]})]}),i.jsxs("div",{className:"af-workspaces-actions",children:[!B&&I>=0?i.jsxs("button",{type:"button",className:"af-workspaces-danger",onClick:z,disabled:n||s,children:[i.jsx("span",{className:"material-symbols-outlined",children:"delete"}),"删除"]}):i.jsx("span",{}),i.jsxs("div",{children:[b.kind==="git"&&I>=0?i.jsxs("button",{type:"button",onClick:E,disabled:B||n||s,children:[i.jsx("span",{className:"material-symbols-outlined",children:s?"sync":"download"}),s?"拉取中":"拉取更新"]}):null,i.jsx("button",{type:"button",onClick:M,disabled:n||s,children:"重置"}),i.jsxs("button",{type:"button",className:"af-workspaces-primary",onClick:R,disabled:B||n||s,children:[i.jsx("span",{className:"material-symbols-outlined",children:"save"}),n?"保存中":"保存"]})]})]})]})]})]})})]})}const Kse=[{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"}],qse=[{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 长文档","客户端原型预览","图表与表格","统一展示链接"]}],Use=[{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"}],Yse=[["知识库","查客户端、后台、前端逻辑","广告、Feed、会员、增长、配置、接口调用链"],["数据","查 CK / Hive 并输出 SQL","PV、UV、转化、分页面、分国家、分实验组"],["产物","生成原型、PRD、Display 面板","Markdown、HTML 原型、图表、表格、交互预览"],["协作","同步 TAPD 与 Git 仓库","需求正文、变更记录、MR 链接、评审材料"]];function Pp({icon:e,title:t,label:n,tone:r="violet"}){return i.jsxs("div",{className:`likee-flow-node likee-flow-node-${r}`,children:[i.jsx("span",{className:"material-symbols-outlined",children:e}),i.jsxs("div",{children:[i.jsx("strong",{children:t}),i.jsx("small",{children:n})]})]})}function Gse(){return i.jsxs("div",{className:"likee-workspace-scene","aria-hidden":"true",children:[i.jsx("div",{className:"likee-scene-grid"}),i.jsxs("svg",{className:"likee-scene-lines",viewBox:"0 0 980 560",fill:"none",children:[i.jsx("path",{d:"M96 154 C236 96 330 122 444 194 C552 262 654 260 814 160"}),i.jsx("path",{d:"M118 350 C248 288 344 304 458 372 C578 444 704 420 858 310"}),i.jsx("path",{d:"M472 196 C512 248 524 302 486 372"}),i.jsx("path",{d:"M622 126 C670 198 696 258 682 354"})]}),i.jsx("div",{className:"likee-node-pos likee-node-a",children:i.jsx(Pp,{icon:"travel_explore",title:"全局上下文",label:"Likee 业务、代码、数据",tone:"pink"})}),i.jsx("div",{className:"likee-node-pos likee-node-b",children:i.jsx(Pp,{icon:"database",title:"CK / Hive",label:"自动 SQL 与指标口径",tone:"cyan"})}),i.jsx("div",{className:"likee-node-pos likee-node-c",children:i.jsx(Pp,{icon:"article",title:"需求文档",label:"PRD、变更说明、评审稿",tone:"amber"})}),i.jsx("div",{className:"likee-node-pos likee-node-d",children:i.jsx(Pp,{icon:"sync_alt",title:"TAPD / Git",label:"同步需求与版本资产",tone:"green"})}),i.jsxs("div",{className:"likee-phone-preview",children:[i.jsxs("div",{className:"likee-phone-top",children:[i.jsx("span",{children:"关注"}),i.jsx("strong",{children:"推荐"}),i.jsx("span",{children:"直播"})]}),i.jsxs("div",{className:"likee-phone-card",children:[i.jsx("div",{className:"likee-gift",children:"AD"}),i.jsx("h4",{children:"广告个性化引导弹框"}),i.jsx("p",{children:"保持推荐体验,同时解释权益与关闭路径。"}),i.jsx("button",{children:"继续"}),i.jsx("button",{className:"secondary",children:"稍后"})]})]}),i.jsxs("div",{className:"likee-display-panel",children:[i.jsxs("div",{className:"likee-panel-header",children:[i.jsx("span",{children:"DISPLAY"}),i.jsx("strong",{children:"需求资产面板"})]}),i.jsxs("div",{className:"likee-table-row",children:[i.jsx("span",{children:"需求"}),i.jsx("strong",{children:"首页广告个性化引导"})]}),i.jsxs("div",{className:"likee-table-row",children:[i.jsx("span",{children:"数据"}),i.jsx("strong",{children:"m09 PV Top 1"})]}),i.jsxs("div",{className:"likee-table-row",children:[i.jsx("span",{children:"同步"}),i.jsx("strong",{children:"TAPD + Git MR"})]})]})]})}function ih({kicker:e,title:t,children:n}){return i.jsxs("div",{className:"likee-section-copy",children:[i.jsx("p",{className:"likee-section-kicker",children:e}),i.jsx("h2",{children:t}),i.jsx("p",{children:n})]})}function Jse(){return i.jsx("section",{id:"likee-skills",className:"likee-section likee-section-dark",children:i.jsxs("div",{className:"likee-section-inner likee-two-column likee-two-column-skills",children:[i.jsx(ih,{kicker:"SKILLS",title:"用 Skills 把 Likee 上下文变成可复用能力",children:"Skills 是工作区里可加载的能力包。手动搭建工作区时,只需要按场景加载对应 Skill。"}),i.jsx("div",{className:"likee-skill-grid",children:Use.map(e=>i.jsxs("article",{className:`likee-skill-card likee-skill-${e.tone}`,children:[i.jsxs("div",{className:"likee-skill-head",children:[i.jsx("div",{className:"likee-skill-icon",children:i.jsx("span",{className:"material-symbols-outlined",children:e.icon})}),i.jsxs("div",{children:[i.jsx("h3",{children:e.name}),i.jsx("span",{children:e.namespace})]})]}),i.jsx("div",{className:"likee-skill-mode",children:e.mode}),i.jsx("p",{children:e.usage}),i.jsx("div",{className:"likee-skill-examples",children:e.examples.map(t=>i.jsx("strong",{children:t},t))})]},e.name))})]})})}function QT(){return i.jsxs("div",{className:"likee-page",children:[i.jsx("div",{className:"likee-top-actions",children:i.jsxs("a",{href:"/projects",className:"likee-home-link",children:[i.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"}),"返回首页"]})}),i.jsxs("section",{className:"likee-hero",children:[i.jsx(Gse,{}),i.jsxs("div",{className:"likee-hero-content",children:[i.jsx("p",{className:"likee-eyebrow",children:"LIKEE CONTEXT WORKSPACE"}),i.jsx("h1",{children:"Likee Agent 工作台"}),i.jsx("p",{className:"likee-hero-subtitle",children:"提供 Likee 全局上下文,赋能需求挖掘、书写和运营。"}),i.jsxs("div",{className:"likee-signal-row",children:[i.jsx("span",{children:"查业务逻辑"}),i.jsx("span",{children:"查 CK / Hive"}),i.jsx("span",{children:"生成原型"}),i.jsx("span",{children:"生成 PRD"}),i.jsx("span",{children:"同步 TAPD / Git"})]}),i.jsxs("div",{className:"likee-hero-actions",children:[i.jsxs("a",{href:"/projects",className:"likee-primary-action",children:[i.jsx("span",{className:"material-symbols-outlined",children:"rocket_launch"}),"立即使用"]}),i.jsxs("a",{href:"#likee-scenarios",className:"likee-secondary-action",children:[i.jsx("span",{className:"material-symbols-outlined",children:"ads_click"}),"按场景查看"]}),i.jsxs("a",{href:"#likee-usecases",className:"likee-secondary-action",children:[i.jsx("span",{className:"material-symbols-outlined",children:"view_timeline"}),"查看 Use Cases"]}),i.jsxs("a",{href:"#likee-skills",className:"likee-secondary-action",children:[i.jsx("span",{className:"material-symbols-outlined",children:"extension"}),"查看 Skills"]})]})]})]}),i.jsx("section",{id:"likee-scenarios",className:"likee-section",children:i.jsxs("div",{className:"likee-section-inner",children:[i.jsx(ih,{kicker:"SCENARIO TRIGGERS",title:"打造 Likee 团队全景上下文",children:"不要求先会写 Prompt,也不要求知道该找哪个系统。选择一个业务场景,工作台会把需要的 Likee 上下文、数据查询和最终产物组织起来。"}),i.jsx("div",{className:"likee-scenario-grid",children:Kse.map(e=>i.jsxs("article",{className:`likee-scenario-card likee-scenario-${e.tone}`,children:[i.jsx("div",{className:"likee-scenario-icon",children:i.jsx("span",{className:"material-symbols-outlined",children:e.icon})}),i.jsxs("div",{children:[i.jsx("h3",{children:e.title}),i.jsx("p",{children:e.question})]}),i.jsx("div",{className:"likee-scenario-context",children:e.context.map(t=>i.jsx("span",{children:t},t))}),i.jsxs("div",{className:"likee-scenario-result",children:[i.jsx("span",{children:"产出"}),i.jsx("strong",{children:e.result})]})]},e.title))})]})}),i.jsx("section",{id:"likee-usecases",className:"likee-section likee-section-muted",children:i.jsxs("div",{className:"likee-section-inner likee-two-column likee-usecase-layout",children:[i.jsx(ih,{kicker:"USE CASES",title:"沉淀 Likee 业务流水线",children:"这里展示的是平台里实际可跑的工作流:加载流程片段,在子 Agent 或 Run 节点输入业务问题,执行当前 line,最终在 Display、TAPD 和 Git 中拿到结果。"}),i.jsx("div",{className:"likee-usecase-stack",children:qse.map(e=>i.jsxs("article",{className:"likee-usecase-card",children:[i.jsx("div",{className:`likee-usecase-media ${e.images.length>1?"likee-usecase-media-split":""}`,children:e.images.map((t,n)=>i.jsx("img",{src:t,alt:`${e.title} 工作区截图 ${n+1}`,loading:"lazy"},t))}),i.jsxs("div",{className:"likee-usecase-body",children:[i.jsx("div",{className:"likee-usecase-label",children:e.label}),i.jsx("h3",{children:e.title}),i.jsx("p",{children:e.trigger}),i.jsx("ol",{className:"likee-usecase-steps",children:e.steps.map(t=>i.jsx("li",{children:t},t))}),i.jsxs("div",{className:"likee-usecase-output",children:[i.jsx("span",{children:"实际产物"}),i.jsx("div",{children:e.outputs.map(t=>i.jsx("strong",{children:t},t))})]})]})]},e.label))})]})}),i.jsx(Jse,{}),i.jsx("section",{className:"likee-section",children:i.jsxs("div",{className:"likee-section-inner likee-two-column likee-capability-layout",children:[i.jsx(ih,{kicker:"CAPABILITY MAP",title:"每个场景背后,都连接同一套 Likee 上下文能力",children:"工作台把知识库、CK / Hive、原型、PRD、TAPD 和 Git 放到同一条链路里。用户看到的是业务场景,系统处理的是上下文、产物和同步。"}),i.jsx("div",{className:"likee-capability-table",children:Yse.map(([e,t,n])=>i.jsxs("div",{className:"likee-capability-row",children:[i.jsx("span",{children:e}),i.jsx("strong",{children:t}),i.jsx("p",{children:n})]},e))})]})})]})}function ZT(e){return t=>typeof t===e}var Xse=ZT("function"),Qse=e=>e===null,ZC=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",e_=e=>!Zse(e)&&!Qse(e)&&(Xse(e)||typeof e=="object"),Zse=ZT("undefined");function eie(e,t,n){return aie(n,e,t)?!0:(lie(n,e,t),e.constructor!==t.constructor?!1:Array.isArray(e)&&Array.isArray(t)?tie(e,t,n):e instanceof Map&&t instanceof Map?sie(e,t,n):e instanceof Set&&t instanceof Set?oie(e,t):e instanceof WeakMap||e instanceof WeakSet?!1:ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)?nie(e,t):ZC(e)&&ZC(t)?e.source===t.source&&e.flags===t.flags:e instanceof Error&&t instanceof Error?rie(e,t,n):e.valueOf!==Object.prototype.valueOf?e.valueOf()===t.valueOf():e.toString!==Object.prototype.toString?e.toString()===t.toString():iie(e,t,n))}function of(e,t,n){return e===t||Number.isNaN(e)&&Number.isNaN(t)?!0:!e||!e_(e)||!t||!e_(t)?!1:eie(e,t,n)}function tie(e,t,n){const{length:r}=e;if(r!==t.length)return!1;for(let s=r;s--!==0;)if(!of(e[s],t[s],n))return!1;return!0}function nie(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 rie(e,t,n){return e.message===t.message&&e.name===t.name&&of(e.cause,t.cause,n)}function sie(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(!of(r[1],t.get(r[0]),n))return!1;return!0}function iie(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 o=r[s];if(!(o==="_owner"&&e.$$typeof)&&!of(e[o],t[o],n))return!1}return!0}function oie(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 aie(e,t,n){var r;return((r=e.get(t))==null?void 0:r.has(n))??!1}function lie(e,t,n){let r=e.get(t);r||(r=new WeakSet,e.set(t,r)),r.add(n)}function sv(e,t){return of(e,t,new WeakMap)}function iw(){var e;return!!(typeof window<"u"&&((e=window==null?void 0:window.document)!=null&&e.createElement))}function cie(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}function uie(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function die(){const e=m.useRef(!0);return e.current?(e.current=!1,!0):e.current}function fie(e,t){const n=die();m.useEffect(()=>{if(!n)return e()},t)}function eM(e){const t=m.useRef(void 0);return m.useEffect(()=>{t.current=e}),t.current}function pie(e,t){const n=m.useRef(t);return sv(t,n.current)||(n.current=t),m.useMemo(e,n.current)}function hie(e){m.useEffect(()=>{e()},[])}function mie(e=0){const[t,n]=m.useState({height:iw()?window.innerHeight:0,width:iw()?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(!iw())return()=>{};const o=s.current;return n({height:window.innerHeight,width:window.innerWidth}),uie(window,"resize",o),()=>{cie(window,"resize",o)}},[]),t}var gie=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","URL","WeakMap","WeakSet"],yie=["bigint","boolean","null","number","string","symbol","undefined"];function af(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(wie(t))return t}function ni(e){return t=>af(t)===e}function wie(e){return gie.includes(e)}function Lc(e){return t=>typeof t===e}function xie(e){return yie.includes(e)}var bie=["innerHTML","ownerDocument","style","attributes","nodeValue"],lf=e=>Array.isArray(e),kie=e=>af(e)==="AsyncGeneratorFunction",vie=ni("AsyncFunction"),Sie=Lc("bigint"),Nie=e=>e===!0||e===!1,jie=ni("Date"),Cie=ni("Error"),Xo=Lc("function"),_ie=ni("GeneratorFunction"),Eie=e=>typeof e=="number"&&Number.isInteger(e),ob=ni("Map"),tM=e=>Number.isNaN(e),iv=e=>e===null,nM=ni("Function"),Aie=ni("Promise"),Pie=ni("RegExp"),ab=ni("Set"),cf=Lc("string"),Iie=Lc("symbol"),ov=Lc("undefined"),Rie=ni("WeakMap"),Tie=ni("WeakSet"),av=e=>iv(e)||ov(e),rM=e=>!ov(e),Mie=e=>Lc("number")(e)&&!tM(e),$ie=e=>cf(e)&&e.trim().length>0,Lie=e=>{if(!cf(e)||e.length===0)return!1;const t=e.trim();return t.length>0&&Number.isFinite(Number(t))},Zm=e=>!av(e)&&(Xo(e)||typeof e=="object"),sM=e=>{if(af(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})},Oie=e=>iv(e)||xie(typeof e),Die=e=>af(e)==="URL",iM=e=>!av(e)&&Xo(e[Symbol.iterator]),Fie=e=>iM(e)&&Xo(e.next)&&Xo(e.throw),zie=e=>Xo(e)&&/^class\s/.test(e.toString()),Bie=(e,t)=>!lf(e)||!Xo(t)?!1:e.every(n=>t(n)),Hie=e=>Zm(e)&&!sM(e)&&e.nodeType===1&&cf(e.nodeName)&&bie.every(t=>t in e),Wie=e=>cf(e)&&e.length===0||lf(e)&&e.length===0||Zm(e)&&!ob(e)&&!ab(e)&&Object.keys(e).length===0||ab(e)&&e.size===0||ob(e)&&e.size===0,Vie=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype,Kie=(e,t)=>lf(e)?e.indexOf(t)>-1:!1,qie=(e,t,n)=>{if(!Zm(e)||!t)return!1;const r=e[t];return Xo(n)?n(r):rM(r)};function St(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(lf(e))return"Array";if(nM(e))return"Function";const t=af(e);return t||"Object"}St.array=lf;St.arrayOf=Bie;St.asyncGeneratorFunction=kie;St.asyncFunction=vie;St.bigint=Sie;St.boolean=Nie;St.class=zie;St.date=jie;St.defined=rM;St.domElement=Hie;St.empty=Wie;St.error=Cie;St.function=Xo;St.generator=Fie;St.generatorFunction=_ie;St.instanceOf=Vie;St.integer=Eie;St.iterable=iM;St.map=ob;St.nan=tM;St.null=iv;St.nullOrUndefined=av;St.nonEmptyString=$ie;St.number=Mie;St.numericString=Lie;St.object=Zm;St.oneOf=Kie;St.plainFunction=nM;St.plainObject=sM;St.primitive=Oie;St.promise=Aie;St.propertyOf=qie;St.regexp=Pie;St.set=ab;St.string=cf;St.symbol=Iie;St.undefined=ov;St.url=Die;St.weakMap=Rie;St.weakSet=Tie;var Nr=St;/* v8 ignore next -- @preserve */var Uie=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},Yie=function(e,t){return e+Bd(t)},Bd=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(Yie,""):Uie(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?Bd(e.props.children):""};Bd.default=Bd;var Gie=Bd;const ow=Zo(Gie);var oM={exports:{}};(function(e){const t=Object.getPrototypeOf({});function n(){return function(o){return typeof o=="object"&&o!==null&&!(o instanceof RegExp)&&!(o instanceof Date)}}function r(s){function o(N){return N!=="constructor"&&N!=="prototype"&&N!=="__proto__"}function a(N){let j=0;const A=N.length,I=new Array(A);for(j;j<A;++j)I[j]=y(N[j]);return I}function l(N){const j={};if(f&&Object.getPrototypeOf(N)!==t)return f(N);const A=p(N);let I,D,B;for(I=0,D=A.length;I<D;++I)o(B=A[I])&&(j[B]=y(N[B]));return j}function c(N,j){const A=N.length,I=j.length;let D=0;const B=new Array(A+I);for(D;D<A;++D)B[D]=y(N[D]);for(D=0;D<I;++D)B[D+A]=y(j[D]);return B}const u=Object.prototype.propertyIsEnumerable;function d(N){const j=Object.keys(N),A=Object.getOwnPropertySymbols(N);for(let I=0,D=A.length;I<D;++I)u.call(N,A[I])&&j.push(A[I]);return j}const p=s!=null&&s.symbols?d:Object.keys,f=typeof(s==null?void 0:s.cloneProtoObject)=="function"?s.cloneProtoObject:void 0,h=typeof(s==null?void 0:s.isMergeableObject)=="function"?s.isMergeableObject:n(),g=(s==null?void 0:s.onlyDefinedProperties)===!0;function k(N){return typeof N!="object"||N===null}const b=s&&typeof s.mergeArray=="function"?s.mergeArray({clone:y,deepmerge:w,getKeys:p,isMergeableObject:h}):c;function y(N){return h(N)?Array.isArray(N)?a(N):l(N):N}function v(N,j){const A={},I=p(N),D=p(j);let B,W,F;for(B=0,W=I.length;B<W;++B)o(F=I[B])&&D.indexOf(F)===-1&&(A[F]=y(N[F]));for(B=0,W=D.length;B<W;++B)if(o(F=D[B]))if(F in N)I.indexOf(F)!==-1&&(f&&h(j[F])&&Object.getPrototypeOf(j[F])!==t?A[F]=f(j[F]):A[F]=w(N[F],j[F]));else{if(g&&typeof j[F]>"u")continue;A[F]=y(j[F])}return A}function w(N,j){if(g&&typeof j>"u")return y(N);const A=Array.isArray(j),I=Array.isArray(N);return k(j)?j:h(N)?A&&I?b(N,j):A!==I?y(j):v(N,j):y(j)}function C(){switch(arguments.length){case 0:return{};case 1:return y(arguments[0]);case 2:return w(arguments[0],arguments[1])}let N;for(let j=0,A=arguments.length;j<A;++j)N=w(N,arguments[j]);return N}return s!=null&&s.all?C:w}e.exports=r,e.exports.default=r,e.exports.deepmerge=r,Object.defineProperty(e.exports,"isMergeableObject",{get:n})})(oM);var Jie=oM.exports;const Xie=Zo(Jie);var Qie=new Error("Element already at target scroll position"),Zie=new Error("Scroll cancelled"),eoe=Math.min,t_=Date.now,toe={left:n_("scrollLeft"),top:n_("scrollTop")};function n_(e){return function(n,r,s,o){s=s||{},typeof s=="function"&&(o=s,s={}),typeof o!="function"&&(o=roe);var a=t_(),l=n[e],c=s.ease||noe,u=isNaN(s.duration)?350:+s.duration,d=!1;return l===r?o(Qie,n[e]):requestAnimationFrame(f),p;function p(){d=!0}function f(h){if(d)return o(Zie,n[e]);var g=t_(),k=eoe(1,(g-a)/u),b=c(k);n[e]=b*(r-l)+l,k<1?requestAnimationFrame(f):requestAnimationFrame(function(){o(null,n[e])})}}}function noe(e){return .5*(1-Math.cos(Math.PI*e))}function roe(){}const soe=Zo(toe);var aM={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(rd,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})})(aM);var ioe=aM.exports;const lM=Zo(ioe),ooe=["top","right","bottom","left"],r_=["start","end"],s_=ooe.reduce((e,t)=>e.concat(t,t+"-"+r_[0],t+"-"+r_[1]),[]),Cc=Math.min,La=Math.max,lm=Math.round,Ip=Math.floor,ji=e=>({x:e,y:e}),aoe={left:"right",right:"left",bottom:"top",top:"bottom"};function lb(e,t,n){return La(e,Cc(t,n))}function Oc(e,t){return typeof e=="function"?e(t):e}function so(e){return e.split("-")[0]}function Ci(e){return e.split("-")[1]}function cM(e){return e==="x"?"y":"x"}function lv(e){return e==="y"?"height":"width"}function $o(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function cv(e){return cM($o(e))}function uM(e,t,n){n===void 0&&(n=!1);const r=Ci(e),s=cv(e),o=lv(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=um(a)),[a,um(a)]}function loe(e){const t=um(e);return[cm(e),t,cm(t)]}function cm(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const i_=["left","right"],o_=["right","left"],coe=["top","bottom"],uoe=["bottom","top"];function doe(e,t,n){switch(e){case"top":case"bottom":return n?t?o_:i_:t?i_:o_;case"left":case"right":return t?coe:uoe;default:return[]}}function foe(e,t,n,r){const s=Ci(e);let o=doe(so(e),n==="start",r);return s&&(o=o.map(a=>a+"-"+s),t&&(o=o.concat(o.map(cm)))),o}function um(e){const t=so(e);return aoe[t]+e.slice(t.length)}function poe(e){return{top:0,right:0,bottom:0,left:0,...e}}function dM(e){return typeof e!="number"?poe(e):{top:e,right:e,bottom:e,left:e}}function dm(e){const{x:t,y:n,width:r,height:s}=e;return{width:r,height:s,top:n,left:t,right:t+r,bottom:n+s,x:t,y:n}}function a_(e,t,n){let{reference:r,floating:s}=e;const o=$o(t),a=cv(t),l=lv(a),c=so(t),u=o==="y",d=r.x+r.width/2-s.width/2,p=r.y+r.height/2-s.height/2,f=r[l]/2-s[l]/2;let h;switch(c){case"top":h={x:d,y:r.y-s.height};break;case"bottom":h={x:d,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:p};break;case"left":h={x:r.x-s.width,y:p};break;default:h={x:r.x,y:r.y}}switch(Ci(t)){case"start":h[a]-=f*(n&&u?-1:1);break;case"end":h[a]+=f*(n&&u?-1:1);break}return h}async function hoe(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:o,rects:a,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:p="floating",altBoundary:f=!1,padding:h=0}=Oc(t,e),g=dM(h),b=l[f?p==="floating"?"reference":"floating":p],y=dm(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(b)))==null||n?b:b.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),v=p==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,w=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),C=await(o.isElement==null?void 0:o.isElement(w))?await(o.getScale==null?void 0:o.getScale(w))||{x:1,y:1}:{x:1,y:1},N=dm(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:w,strategy:c}):v);return{top:(y.top-N.top+g.top)/C.y,bottom:(N.bottom-y.bottom+g.bottom)/C.y,left:(y.left-N.left+g.left)/C.x,right:(N.right-y.right+g.right)/C.x}}const moe=50,goe=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:hoe},c=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:d,y:p}=a_(u,r,c),f=r,h=0;const g={};for(let k=0;k<o.length;k++){const b=o[k];if(!b)continue;const{name:y,fn:v}=b,{x:w,y:C,data:N,reset:j}=await v({x:d,y:p,initialPlacement:r,placement:f,strategy:s,middlewareData:g,rects:u,platform:l,elements:{reference:e,floating:t}});d=w??d,p=C??p,g[y]={...g[y],...N},j&&h<moe&&(h++,typeof j=="object"&&(j.placement&&(f=j.placement),j.rects&&(u=j.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):j.rects),{x:d,y:p}=a_(u,f,c)),k=-1)}return{x:d,y:p,placement:f,strategy:s,middlewareData:g}},yoe=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:o,platform:a,elements:l,middlewareData:c}=t,{element:u,padding:d=0}=Oc(e,t)||{};if(u==null)return{};const p=dM(d),f={x:n,y:r},h=cv(s),g=lv(h),k=await a.getDimensions(u),b=h==="y",y=b?"top":"left",v=b?"bottom":"right",w=b?"clientHeight":"clientWidth",C=o.reference[g]+o.reference[h]-f[h]-o.floating[g],N=f[h]-o.reference[h],j=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let A=j?j[w]:0;(!A||!await(a.isElement==null?void 0:a.isElement(j)))&&(A=l.floating[w]||o.floating[g]);const I=C/2-N/2,D=A/2-k[g]/2-1,B=Cc(p[y],D),W=Cc(p[v],D),F=B,T=A-k[g]-W,M=A/2-k[g]/2+I,q=lb(F,M,T),H=!c.arrow&&Ci(s)!=null&&M!==q&&o.reference[g]/2-(M<F?B:W)-k[g]/2<0,L=H?M<F?M-F:M-T:0;return{[h]:f[h]+L,data:{[h]:q,centerOffset:M-q-L,...H&&{alignmentOffset:L}},reset:H}}});function woe(e,t,n){return(e?[...n.filter(s=>Ci(s)===e),...n.filter(s=>Ci(s)!==e)]:n.filter(s=>so(s)===s)).filter(s=>e?Ci(s)===e||(t?cm(s)!==s:!1):!0)}const xoe=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,s;const{rects:o,middlewareData:a,placement:l,platform:c,elements:u}=t,{crossAxis:d=!1,alignment:p,allowedPlacements:f=s_,autoAlignment:h=!0,...g}=Oc(e,t),k=p!==void 0||f===s_?woe(p||null,h,f):f,b=await c.detectOverflow(t,g),y=((n=a.autoPlacement)==null?void 0:n.index)||0,v=k[y];if(v==null)return{};const w=uM(v,o,await(c.isRTL==null?void 0:c.isRTL(u.floating)));if(l!==v)return{reset:{placement:k[0]}};const C=[b[so(v)],b[w[0]],b[w[1]]],N=[...((r=a.autoPlacement)==null?void 0:r.overflows)||[],{placement:v,overflows:C}],j=k[y+1];if(j)return{data:{index:y+1,overflows:N},reset:{placement:j}};const A=N.map(B=>{const W=Ci(B.placement);return[B.placement,W&&d?B.overflows.slice(0,2).reduce((F,T)=>F+T,0):B.overflows[0],B.overflows]}).sort((B,W)=>B[1]-W[1]),D=((s=A.filter(B=>B[2].slice(0,Ci(B[0])?2:3).every(W=>W<=0))[0])==null?void 0:s[0])||A[0][0];return D!==l?{data:{index:y+1,overflows:N},reset:{placement:D}}:{}}}},boe=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:o,rects:a,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:p=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:k=!0,...b}=Oc(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const y=so(s),v=$o(l),w=so(l)===l,C=await(c.isRTL==null?void 0:c.isRTL(u.floating)),N=f||(w||!k?[um(l)]:loe(l)),j=g!=="none";!f&&j&&N.push(...foe(l,k,g,C));const A=[l,...N],I=await c.detectOverflow(t,b),D=[];let B=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&D.push(I[y]),p){const M=uM(s,a,C);D.push(I[M[0]],I[M[1]])}if(B=[...B,{placement:s,overflows:D}],!D.every(M=>M<=0)){var W,F;const M=(((W=o.flip)==null?void 0:W.index)||0)+1,q=A[M];if(q&&(!(p==="alignment"?v!==$o(q):!1)||B.every(R=>$o(R.placement)===v?R.overflows[0]>0:!0)))return{data:{index:M,overflows:B},reset:{placement:q}};let H=(F=B.filter(L=>L.overflows[0]<=0).sort((L,R)=>L.overflows[1]-R.overflows[1])[0])==null?void 0:F.placement;if(!H)switch(h){case"bestFit":{var T;const L=(T=B.filter(R=>{if(j){const z=$o(R.placement);return z===v||z==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(z=>z>0).reduce((z,E)=>z+E,0)]).sort((R,z)=>R[1]-z[1])[0])==null?void 0:T[0];L&&(H=L);break}case"initialPlacement":H=l;break}if(s!==H)return{reset:{placement:H}}}return{}}}},koe=new Set(["left","top"]);async function voe(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=so(n),l=Ci(n),c=$o(n)==="y",u=koe.has(a)?-1:1,d=o&&c?-1:1,p=Oc(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:g}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return l&&typeof g=="number"&&(h=l==="end"?g*-1:g),c?{x:h*d,y:f*u}:{x:f*u,y:h*d}}const Soe=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:o,placement:a,middlewareData:l}=t,c=await voe(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:a}}}}},Noe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:o}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:y=>{let{x:v,y:w}=y;return{x:v,y:w}}},...u}=Oc(e,t),d={x:n,y:r},p=await o.detectOverflow(t,u),f=$o(so(s)),h=cM(f);let g=d[h],k=d[f];if(a){const y=h==="y"?"top":"left",v=h==="y"?"bottom":"right",w=g+p[y],C=g-p[v];g=lb(w,g,C)}if(l){const y=f==="y"?"top":"left",v=f==="y"?"bottom":"right",w=k+p[y],C=k-p[v];k=lb(w,k,C)}const b=c.fn({...t,[h]:g,[f]:k});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[h]:a,[f]:l}}}}}};function eg(){return typeof window<"u"}function Dc(e){return fM(e)?(e.nodeName||"").toLowerCase():"#document"}function ls(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Pi(e){var t;return(t=(fM(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function fM(e){return eg()?e instanceof Node||e instanceof ls(e).Node:!1}function Qs(e){return eg()?e instanceof Element||e instanceof ls(e).Element:!1}function lo(e){return eg()?e instanceof HTMLElement||e instanceof ls(e).HTMLElement:!1}function l_(e){return!eg()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ls(e).ShadowRoot}function uf(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=Zs(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function joe(e){return/^(table|td|th)$/.test(Dc(e))}function tg(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Coe=/transform|translate|scale|rotate|perspective|filter/,_oe=/paint|layout|strict|content/,ga=e=>!!e&&e!=="none";let aw;function uv(e){const t=Qs(e)?Zs(e):e;return ga(t.transform)||ga(t.translate)||ga(t.scale)||ga(t.rotate)||ga(t.perspective)||!dv()&&(ga(t.backdropFilter)||ga(t.filter))||Coe.test(t.willChange||"")||_oe.test(t.contain||"")}function Eoe(e){let t=Qo(e);for(;lo(t)&&!_c(t);){if(uv(t))return t;if(tg(t))return null;t=Qo(t)}return null}function dv(){return aw==null&&(aw=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),aw}function _c(e){return/^(html|body|#document)$/.test(Dc(e))}function Zs(e){return ls(e).getComputedStyle(e)}function ng(e){return Qs(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qo(e){if(Dc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||l_(e)&&e.host||Pi(e);return l_(t)?t.host:t}function pM(e){const t=Qo(e);return _c(t)?e.ownerDocument?e.ownerDocument.body:e.body:lo(t)&&uf(t)?t:pM(t)}function Hd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=pM(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),a=ls(s);if(o){const l=cb(a);return t.concat(a,a.visualViewport||[],uf(s)?s:[],l&&n?Hd(l):[])}else return t.concat(s,Hd(s,[],n))}function cb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function hM(e){const t=Zs(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=lo(e),o=s?e.offsetWidth:n,a=s?e.offsetHeight:r,l=lm(n)!==o||lm(r)!==a;return l&&(n=o,r=a),{width:n,height:r,$:l}}function fv(e){return Qs(e)?e:e.contextElement}function uc(e){const t=fv(e);if(!lo(t))return ji(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=hM(t);let a=(o?lm(n.width):n.width)/r,l=(o?lm(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const Aoe=ji(0);function mM(e){const t=ls(e);return!dv()||!t.visualViewport?Aoe:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Poe(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ls(e)?!1:t}function el(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=fv(e);let a=ji(1);t&&(r?Qs(r)&&(a=uc(r)):a=uc(e));const l=Poe(o,n,r)?mM(o):ji(0);let c=(s.left+l.x)/a.x,u=(s.top+l.y)/a.y,d=s.width/a.x,p=s.height/a.y;if(o){const f=ls(o),h=r&&Qs(r)?ls(r):r;let g=f,k=cb(g);for(;k&&r&&h!==g;){const b=uc(k),y=k.getBoundingClientRect(),v=Zs(k),w=y.left+(k.clientLeft+parseFloat(v.paddingLeft))*b.x,C=y.top+(k.clientTop+parseFloat(v.paddingTop))*b.y;c*=b.x,u*=b.y,d*=b.x,p*=b.y,c+=w,u+=C,g=ls(k),k=cb(g)}}return dm({width:d,height:p,x:c,y:u})}function rg(e,t){const n=ng(e).scrollLeft;return t?t.left+n:el(Pi(e)).left+n}function gM(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-rg(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Ioe(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",a=Pi(r),l=t?tg(t.floating):!1;if(r===a||l&&o)return n;let c={scrollLeft:0,scrollTop:0},u=ji(1);const d=ji(0),p=lo(r);if((p||!p&&!o)&&((Dc(r)!=="body"||uf(a))&&(c=ng(r)),p)){const h=el(r);u=uc(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}const f=a&&!p&&!o?gM(a,c):ji(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+f.x,y:n.y*u.y-c.scrollTop*u.y+d.y+f.y}}function Roe(e){return Array.from(e.getClientRects())}function Toe(e){const t=Pi(e),n=ng(e),r=e.ownerDocument.body,s=La(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=La(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+rg(e);const l=-n.scrollTop;return Zs(r).direction==="rtl"&&(a+=La(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:a,y:l}}const c_=25;function Moe(e,t){const n=ls(e),r=Pi(e),s=n.visualViewport;let o=r.clientWidth,a=r.clientHeight,l=0,c=0;if(s){o=s.width,a=s.height;const d=dv();(!d||d&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const u=rg(r);if(u<=0){const d=r.ownerDocument,p=d.body,f=getComputedStyle(p),h=d.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,g=Math.abs(r.clientWidth-p.clientWidth-h);g<=c_&&(o-=g)}else u<=c_&&(o+=u);return{width:o,height:a,x:l,y:c}}function $oe(e,t){const n=el(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=lo(e)?uc(e):ji(1),a=e.clientWidth*o.x,l=e.clientHeight*o.y,c=s*o.x,u=r*o.y;return{width:a,height:l,x:c,y:u}}function u_(e,t,n){let r;if(t==="viewport")r=Moe(e,n);else if(t==="document")r=Toe(Pi(e));else if(Qs(t))r=$oe(t,n);else{const s=mM(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return dm(r)}function yM(e,t){const n=Qo(e);return n===t||!Qs(n)||_c(n)?!1:Zs(n).position==="fixed"||yM(n,t)}function Loe(e,t){const n=t.get(e);if(n)return n;let r=Hd(e,[],!1).filter(l=>Qs(l)&&Dc(l)!=="body"),s=null;const o=Zs(e).position==="fixed";let a=o?Qo(e):e;for(;Qs(a)&&!_c(a);){const l=Zs(a),c=uv(a);!c&&l.position==="fixed"&&(s=null),(o?!c&&!s:!c&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||uf(a)&&!c&&yM(e,a))?r=r.filter(d=>d!==a):s=l,a=Qo(a)}return t.set(e,r),r}function Ooe(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?tg(t)?[]:Loe(t,this._c):[].concat(n),r],l=u_(t,a[0],s);let c=l.top,u=l.right,d=l.bottom,p=l.left;for(let f=1;f<a.length;f++){const h=u_(t,a[f],s);c=La(h.top,c),u=Cc(h.right,u),d=Cc(h.bottom,d),p=La(h.left,p)}return{width:u-p,height:d-c,x:p,y:c}}function Doe(e){const{width:t,height:n}=hM(e);return{width:t,height:n}}function Foe(e,t,n){const r=lo(t),s=Pi(t),o=n==="fixed",a=el(e,!0,o,t);let l={scrollLeft:0,scrollTop:0};const c=ji(0);function u(){c.x=rg(s)}if(r||!r&&!o)if((Dc(t)!=="body"||uf(s))&&(l=ng(t)),r){const h=el(t,!0,o,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else s&&u();o&&!r&&s&&u();const d=s&&!r&&!o?gM(s,l):ji(0),p=a.left+l.scrollLeft-c.x-d.x,f=a.top+l.scrollTop-c.y-d.y;return{x:p,y:f,width:a.width,height:a.height}}function lw(e){return Zs(e).position==="static"}function d_(e,t){if(!lo(e)||Zs(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Pi(e)===n&&(n=n.ownerDocument.body),n}function wM(e,t){const n=ls(e);if(tg(e))return n;if(!lo(e)){let s=Qo(e);for(;s&&!_c(s);){if(Qs(s)&&!lw(s))return s;s=Qo(s)}return n}let r=d_(e,t);for(;r&&joe(r)&&lw(r);)r=d_(r,t);return r&&_c(r)&&lw(r)&&!uv(r)?n:r||Eoe(e)||n}const zoe=async function(e){const t=this.getOffsetParent||wM,n=this.getDimensions,r=await n(e.floating);return{reference:Foe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Boe(e){return Zs(e).direction==="rtl"}const Hoe={convertOffsetParentRelativeRectToViewportRelativeRect:Ioe,getDocumentElement:Pi,getClippingRect:Ooe,getOffsetParent:wM,getElementRects:zoe,getClientRects:Roe,getDimensions:Doe,getScale:uc,isElement:Qs,isRTL:Boe};function xM(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Woe(e,t){let n=null,r;const s=Pi(e);function o(){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),o();const u=e.getBoundingClientRect(),{left:d,top:p,width:f,height:h}=u;if(l||t(),!f||!h)return;const g=Ip(p),k=Ip(s.clientWidth-(d+f)),b=Ip(s.clientHeight-(p+h)),y=Ip(d),w={rootMargin:-g+"px "+-k+"px "+-b+"px "+-y+"px",threshold:La(0,Cc(1,c))||1};let C=!0;function N(j){const A=j[0].intersectionRatio;if(A!==c){if(!C)return a();A?a(!1,A):r=setTimeout(()=>{a(!1,1e-7)},1e3)}A===1&&!xM(u,e.getBoundingClientRect())&&a(),C=!1}try{n=new IntersectionObserver(N,{...w,root:s.ownerDocument})}catch{n=new IntersectionObserver(N,w)}n.observe(e)}return a(!0),o}function f_(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=fv(e),d=s||o?[...u?Hd(u):[],...t?Hd(t):[]]:[];d.forEach(y=>{s&&y.addEventListener("scroll",n,{passive:!0}),o&&y.addEventListener("resize",n)});const p=u&&l?Woe(u,n):null;let f=-1,h=null;a&&(h=new ResizeObserver(y=>{let[v]=y;v&&v.target===u&&h&&t&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(t)})),n()}),u&&!c&&h.observe(u),t&&h.observe(t));let g,k=c?el(e):null;c&&b();function b(){const y=el(e);k&&!xM(k,y)&&n(),k=y,g=requestAnimationFrame(b)}return n(),()=>{var y;d.forEach(v=>{s&&v.removeEventListener("scroll",n),o&&v.removeEventListener("resize",n)}),p==null||p(),(y=h)==null||y.disconnect(),h=null,c&&cancelAnimationFrame(g)}}const Voe=Soe,Koe=xoe,qoe=Noe,Uoe=boe,p_=yoe,Yoe=(e,t,n)=>{const r=new Map,s={platform:Hoe,...n},o={...s.platform,_c:r};return goe(e,t,{...s,platform:o})};var Goe=typeof document<"u",Joe=function(){},oh=Goe?m.useLayoutEffect:Joe;function fm(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!fm(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const o=s[r];if(!(o==="_owner"&&e.$$typeof)&&!fm(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function bM(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function h_(e,t){const n=bM(e);return Math.round(t*n)/n}function cw(e){const t=m.useRef(e);return oh(()=>{t.current=e}),t}function m_(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:o,floating:a}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[d,p]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=m.useState(r);fm(f,r)||h(r);const[g,k]=m.useState(null),[b,y]=m.useState(null),v=m.useCallback(R=>{R!==j.current&&(j.current=R,k(R))},[]),w=m.useCallback(R=>{R!==A.current&&(A.current=R,y(R))},[]),C=o||g,N=a||b,j=m.useRef(null),A=m.useRef(null),I=m.useRef(d),D=c!=null,B=cw(c),W=cw(s),F=cw(u),T=m.useCallback(()=>{if(!j.current||!A.current)return;const R={placement:t,strategy:n,middleware:f};W.current&&(R.platform=W.current),Yoe(j.current,A.current,R).then(z=>{const E={...z,isPositioned:F.current!==!1};M.current&&!fm(I.current,E)&&(I.current=E,sr.flushSync(()=>{p(E)}))})},[f,t,n,W,F]);oh(()=>{u===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,p(R=>({...R,isPositioned:!1})))},[u]);const M=m.useRef(!1);oh(()=>(M.current=!0,()=>{M.current=!1}),[]),oh(()=>{if(C&&(j.current=C),N&&(A.current=N),C&&N){if(B.current)return B.current(C,N,T);T()}},[C,N,T,B,D]);const q=m.useMemo(()=>({reference:j,floating:A,setReference:v,setFloating:w}),[v,w]),H=m.useMemo(()=>({reference:C,floating:N}),[C,N]),L=m.useMemo(()=>{const R={position:n,left:0,top:0};if(!H.floating)return R;const z=h_(H.floating,d.x),E=h_(H.floating,d.y);return l?{...R,transform:"translate("+z+"px, "+E+"px)",...bM(H.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:z,top:E}},[n,l,H.floating,d.x,d.y]);return m.useMemo(()=>({...d,update:T,refs:q,elements:H,floatingStyles:L}),[d,T,q,H,L])}const Xoe=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?p_({element:r.current,padding:s}).fn(n):{}:r?p_({element:r,padding:s}).fn(n):{}}}},g_=(e,t)=>{const n=Voe(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qoe=(e,t)=>{const n=qoe(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zoe=(e,t)=>{const n=Uoe(e);return{name:n.name,fn:n.fn,options:[e,t]}},eae=(e,t)=>{const n=Koe(e);return{name:n.name,fn:n.fn,options:[e,t]}},tae=(e,t)=>{const n=Xoe(e);return{name:n.name,fn:n.fn,options:[e,t]}},nae={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},rae={beaconOptions:{offset:-18}},kM={back:"Back",close:"Close",last:"Last",next:"Next",nextWithProgress:"Next ({current} of {total})",open:"Open the dialog",skip:"Skip"},sae={isFixed:!1,locale:kM,placement:"bottom"},iae={continuous:!1,debug:!1,run:!1,scrollToFirstStep:!1,steps:[]},Rt={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update",COMPLETE:"complete"},rr={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"},Xe={INIT:"init",READY:"ready",BEACON_BEFORE:"beacon_before",BEACON:"beacon",TOOLTIP_BEFORE:"tooltip_before",TOOLTIP:"tooltip",COMPLETE:"complete"},pi={BUTTON_BACK:"button_back",BUTTON_CLOSE:"button_close",BUTTON_PRIMARY:"button_primary",BUTTON_SKIP:"button_skip",KEYBOARD:"keyboard",OVERLAY:"overlay"},_t={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"},oae="react-joyride-portal";function aae(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function Xl(...e){return Xie({all:!0,isMergeableObject:t=>!(!Nr.plainObject(t)||m.isValidElement(t))})(...e)}function vM(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function Hi(e,t={}){const{defaultValue:n,step:r,steps:s}=t;let o=ow(e);if(o)(o.includes("{current}")||o.includes("{total}"))&&r&&s&&(o=o.replace("{current}",r.toString()).replace("{total}",s.toString()));else if(m.isValidElement(e)&&!Object.values(e.props).length&&vM(e.type)==="function")try{o=Hi(e.type({}),t)}catch{o=ow(n)}else o=ow(n);return o}function or(e,t,n,...r){if(!e)return;const s=new Date,o=`${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 ${o}`,"font-weight: bold","color: gray; font-weight: normal",...r)}function lae(e,t){const n=aae(t);return{...e,...n}}function Wd(){}function cae(e){return Object.keys(e)}function pm(e,...t){if(!Nr.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 y_(e,...t){if(!Nr.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 ub(e,t,n){const r=o=>o.replace("{current}",String(t)).replace("{total}",String(n));if(vM(e)==="string")return r(e);if(!m.isValidElement(e))return e;const{children:s}=e.props;if(Nr.string(s)&&s.includes("{current}"))return m.cloneElement(e,{children:r(s)});if(Array.isArray(s))return m.cloneElement(e,{children:s.map(o=>typeof o=="string"?r(o):ub(o,t,n))});if(Nr.function(e.type)&&!Object.values(e.props).length)try{return ub(e.type({}),t,n)}catch{return e}return e}function w_(e){return cae(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})}function pv(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function x_(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 hv(e){return e?e.getBoundingClientRect():null}function uae(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((o,a)=>o-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 Ns(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 dae(e,t,n){const r=hv(e),s=Fc(e),o=s?!s.isSameNode(Kr()):!1,a=n??zc(e);let l=0,c=(r==null?void 0:r.top)??0;return o&&a?c=(r==null?void 0:r.top)??0:s instanceof HTMLElement&&(l=s.scrollTop,!o&&!a&&(c+=l),s.isSameNode(Kr())||(c+=Kr().scrollTop)),Math.floor(c-t)}function Fc(e,t){if(!e)return Kr();const n=lM(e);if(n){if(n.isSameNode(Kr()))return t?document:Kr();if(!(n.scrollHeight>n.offsetHeight))return Kr()}return n}function fae(e){const t=e.getBoundingClientRect(),n=Kr(),r=t.top+t.height/2,s=window.innerHeight/2;return Math.max(0,n.scrollTop+r-s)}function pae(e,t){if(!e)return 0;const n=lM(e)??Kr(),r=parseFloat(getComputedStyle(e).scrollMarginTop)||0,s=hv(n),o=n.scrollTop??0,{offsetTop:a=0,scrollTop:l=0}=n;let c=e.getBoundingClientRect().top+l;if(a&&(SM(e)||hae(e))){const d=e.getBoundingClientRect(),p=d.top-((s==null?void 0:s.top)??0),f=p+d.height,h=n.clientHeight,g=h*.2;p>=g&&f<=h-g?c=o:c=p+o}const u=Math.floor(c-t-r);return u<0?0:u}function hae(e){return e.offsetParent!==document.body}function SM(e){if(!e)return!1;const t=Fc(e);return t?!t.isSameNode(Kr()):!1}function zc(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?zc(e.parentNode,t):!1}function Rp(e){if(!e)return!1;let t=e;for(;t&&t!==document.body;){if(t instanceof HTMLElement){const{display:n,visibility:r}=getComputedStyle(t);if(n==="none"||r==="hidden")return!1}t=t.parentElement??null}return!0}function b_(e){const{isFirstStep:t,scrollToFirstStep:n,step:r,target:s,targetLifecycle:o}=e;if(r.skipScroll||t&&!n&&o!==Xe.TOOLTIP||r.placement==="center")return!1;const a=s!=null&&s.isConnected?Fc(s):Kr(),l=a?!a.isSameNode(Kr()):!1;return(r.isFixed||zc(s))&&!l?!1:a.scrollHeight>a.clientHeight}function Kr(){return document.scrollingElement??document.documentElement}function k_(e,t){const{duration:n,element:r}=t;let s=()=>{};const o=new Promise(a=>{const{scrollTop:l}=r,c=e>l?e-l:l-e;s=soe.top(r,e,{duration:c<100?50:n},()=>{a()})});return{cancel:s,promise:o}}function mae(e){const t=e.replace(/^#?([\da-f])([\da-f])([\da-f])$/i,(r,s,o,a)=>s+s+o+o+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 NM={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555555",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,WebkitAppearance:"none"},Tp={...NM,borderRadius:4,padding:8};function gae(e,t){const{styles:n}=e,r=Xl(n??{},t.styles??{});let{width:s}=t;pv()&&(s=typeof s=="number"&&window.innerWidth<s?window.innerWidth-30:s);const o={bottom:0,left:0,overflow:"hidden",position:"absolute",right:0,top:0,zIndex:t.zIndex};return Xl({arrow:{alignItems:"center",color:t.arrowColor,display:"inline-flex",justifyContent:"center",position:"absolute"},beaconWrapper:{...NM,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(${mae(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:{...Tp,color:t.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{...Tp,color:t.textColor,height:12,padding:8,position:"absolute",right:0,top:0,width:12},buttonPrimary:{...Tp,backgroundColor:t.primaryColor,color:t.backgroundColor},buttonSkip:{...Tp,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:{...o,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 yae=["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 mv(e,t){if(!t)return null;const n=Xl(sae,y_(e,"arrowComponent","beaconComponent","floatingOptions","loaderComponent","locale","styles","tooltipComponent"),t),r=Xl(nae,e.options??{},y_(t,...yae)),s=gae(e,{...n,...r}),o=Xl(rae,e.floatingOptions??{},n.floatingOptions??{});return{...n,...r,locale:Xl(kM,e.locale??{},n.locale||{}),floatingOptions:o,spotlightPadding:wae(r.spotlightPadding),styles:s}}function wae(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 xae(e,t,n){const{action:r}=t,s=n&&[Rt.PREV,Rt.NEXT].includes(r);return e.skipBeacon||e.placement==="center"||s}function jM(e,t=!1){return Nr.plainObject(e)?e.target?!0:(or(t,"tour","target is missing from the step"),!1):(or(t,"tour","step must be an object"),!1)}function CM(e,t=!1){return Nr.array(e)?e.every(n=>jM(n,t)):(or(t,"tour","steps must be an array"),!1)}var bae=class{constructor(e){Rn(this,"beaconPosition",null);Rn(this,"debug");Rn(this,"eventListeners",new Map);Rn(this,"listeners",new Set);Rn(this,"props");Rn(this,"snapshot");Rn(this,"state");Rn(this,"steps");Rn(this,"tooltipPosition",null);Rn(this,"cleanupPositionData",()=>{this.beaconPosition=null,this.tooltipPosition=null});Rn(this,"getPositionData",e=>e==="beacon"?this.beaconPosition:this.tooltipPosition);Rn(this,"getServerSnapshot",()=>this.snapshot);Rn(this,"getSnapshot",()=>this.snapshot);Rn(this,"getEventState",()=>pm(this.snapshot,"positioned"));Rn(this,"getState",()=>pm(this.snapshot,"positioned"));Rn(this,"setPositionData",(e,t)=>{var r,s,o;((r=e==="beacon"?this.beaconPosition:this.tooltipPosition)==null?void 0:r.placement)!==t.placement&&or(this.debug,`step:${this.state.index}`,"positioned",`${e} ${t.placement}`),e==="beacon"?this.beaconPosition=t:this.tooltipPosition=t,(this.state.lifecycle===Xe.BEACON_BEFORE||this.state.lifecycle===Xe.TOOLTIP_BEFORE)&&!this.state.positioned&&this.updateState({positioned:!0});const n=(o=(s=this.getStep())==null?void 0:s.floatingOptions)==null?void 0:o.onPosition;n&&n(t)});Rn(this,"setSteps",e=>{this.steps=e,this.updateState({size:e.length})});Rn(this,"dispatch",(e,t)=>{const n=this.eventListeners.get(e.type);if(n)for(const r of n)try{r(e,t)}catch{}});Rn(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)}});Rn(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));Rn(this,"updateState",(e,t=!1)=>{const{controlled:n,index:r}=this.state,s=this.snapshot,o=n&&!t&&e.index!==void 0?r:e.index??r,a={action:e.action??this.state.action,controlled:n,index:o,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,!sv(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=Nr.number(n);let o=0;this.debug=(e==null?void 0:e.debug)??!1,s?(o=n,Nr.number(t)&&or(this.debug,"tour","initialStepIndex is ignored in controlled mode")):Nr.number(t)&&(t>=0&&t<r.length?o=t:r.length>0&&or(this.debug,"tour","initialStepIndex is out of bounds")),this.props=e??{steps:[]},this.steps=r,this.state={action:Rt.INIT,controlled:s,index:o,lifecycle:Xe.INIT,origin:null,positioned:!1,scrolling:!1,size:r.length,status:r.length?_t.READY:_t.IDLE,waiting:!1},this.snapshot=Object.freeze({...this.state})}applyTransitions(e){return e.status===_t.WAITING&&e.size>0?{...e,status:_t.RUNNING}:e}getStep(e){return mv(this.props,this.steps[e??this.state.index])}};function kae(e){return new bae(e)}function v_(e,t){return Math.min(Math.max(e,0),t)}function vae(e,t,n){const r=m.useRef(t),s=m.useRef(n);return r.current=t,s.current=n,m.useMemo(()=>{const o=()=>e.current.getSnapshot();return{close:(b=null)=>{const{index:y,status:v}=o();v===_t.RUNNING&&e.current.updateState({action:Rt.CLOSE,index:y+1,origin:b,lifecycle:Xe.COMPLETE,positioned:!1,scrolling:!1,waiting:!1})},go:b=>{const{controlled:y,size:v,status:w}=o();if(y){or(r.current,"tour","go() is not supported in controlled mode");return}w===_t.RUNNING&&e.current.updateState({action:Rt.GO,index:b,lifecycle:Xe.COMPLETE,positioned:!1,scrolling:!1,status:b<v?w:_t.FINISHED,waiting:!1})},info:()=>pm(e.current.getSnapshot(),"positioned"),next:b=>{const{index:y,size:v,status:w}=o();w===_t.RUNNING&&e.current.updateState({action:Rt.NEXT,index:v_(y+1,v),lifecycle:Xe.COMPLETE,origin:b,positioned:!1,scrolling:!1,waiting:!1})},open:()=>{const{status:b}=o();b===_t.RUNNING&&e.current.updateState({action:Rt.UPDATE,lifecycle:Xe.TOOLTIP_BEFORE,positioned:!1,scrolling:!1,waiting:!1})},prev:b=>{const{index:y,size:v,status:w}=o();w===_t.RUNNING&&e.current.updateState({action:Rt.PREV,index:v_(y-1,v),lifecycle:Xe.COMPLETE,origin:b,positioned:!1,scrolling:!1,waiting:!1})},reset:(b=!1)=>{const{controlled:y}=o();if(y){or(r.current,"tour","reset() is not supported in controlled mode");return}s.current(),e.current.updateState({action:Rt.RESET,index:0,lifecycle:Xe.INIT,positioned:!1,scrolling:!1,status:b?_t.RUNNING:_t.READY,waiting:!1})},skip:b=>{const{status:y}=o();y===_t.RUNNING&&e.current.updateState({action:Rt.SKIP,lifecycle:Xe.COMPLETE,origin:b,positioned:!1,scrolling:!1,status:_t.SKIPPED,waiting:!1})},start:b=>{const{index:y,size:v}=o();s.current(),e.current.updateState({action:Rt.START,index:Nr.number(b)?b:y,lifecycle:Xe.INIT,positioned:!1,scrolling:!1,status:v?_t.RUNNING:_t.WAITING,waiting:!1},!0)},stop:(b=!1)=>{const{index:y,status:v}=o();[_t.FINISHED,_t.SKIPPED].includes(v)||e.current.updateState({action:Rt.STOP,index:y+(b?1:0),lifecycle:Xe.COMPLETE,positioned:!1,scrolling:!1,status:_t.PAUSED,waiting:!1})}}},[e])}const Sae=new Set(["origin","positioned"]);function Nae(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!t)return;const r=e.current.getSnapshot();return or(!0,"tour","init",r),n.current=r,e.current.subscribe(s=>{const o=n.current;if(n.current=s,!o)return;const a={};let l=!1;for(const c of Object.keys(s))s[c]!==o[c]&&!Sae.has(c)&&(a[c]={from:o[c],to:s[c]},(c==="status"||c==="size")&&(l=!0));Object.keys(a).length&&(!l&&s.index>=s.size||or(!0,l?"tour":`step:${s.index}`,"state",a))})},[t,e])}function jae(e,t,n){const r=m.useRef(e),s=m.useRef(t);return r.current=e,s.current=t,m.useCallback((o,a,l)=>{var u;const c={...n.current.getEventState(),error:null,scroll:null,step:a,type:o,...l};(u=r.current)==null||u.call(r,c,s.current),n.current.dispatch(c,s.current)},[n])}function Eo(e,t){return{hasChanged(n){return e[n]!==t[n]},hasChangedTo(n,r){const s=e[n],o=t[n];return Array.isArray(r)?r.includes(s)&&!r.includes(o):s===r&&o!==r},previous:t}}function Cae(e){const{addFailure:t,controls:n,emitEvent:r,previousState:s,props:o,state:a,step:l,store:c}=e,{action:u,index:d,lifecycle:p,positioned:f,scrolling:h,size:g,status:k}=a,b=eM(l)??null,y=m.useRef(null),v=m.useRef(o),w=m.useRef(a),C=m.useRef(s),N=m.useRef(l),j=m.useRef(b),A=m.useRef(n),I=m.useRef(null),D=m.useRef(null),B=m.useRef(null);v.current=o,w.current=a,C.current=s,N.current=l,j.current=b,A.current=n;const W=()=>{I.current&&(clearInterval(I.current),I.current=null),D.current=null,B.current&&(B.current.cancel(),B.current=null)};m.useEffect(()=>{if(!C.current)return;const{hasChangedTo:F}=Eo(w.current,C.current);(F("action",[Rt.NEXT,Rt.PREV,Rt.SKIP,Rt.CLOSE])||y.current===Rt.CLOSE&&u===Rt.START)&&(y.current=u)},[u]),m.useEffect(()=>{if(!C.current)return()=>{W()};const{hasChanged:F}=Eo(w.current,C.current),T=N.current;if(F("index")&&W(),k!==_t.RUNNING||!T||p!==Xe.INIT)return()=>{W()};const{hasChangedTo:M}=Eo(w.current,C.current);M("status",_t.RUNNING)&&[_t.IDLE,_t.READY,_t.PAUSED].includes(C.current.status)&&r(rr.TOUR_START,T),c.current.cleanupPositionData();const{debug:q}=v.current;if(T.before&&!B.current){or(q,`step:${d}`,"before()",T),B.current={cancel:()=>{}},c.current.updateState({waiting:!0}),r(rr.STEP_BEFORE_HOOK,T,{action:y.current??w.current.action});const H=()=>{B.current=null,c.current.updateState({action:y.current??w.current.action,waiting:!1,lifecycle:Xe.READY})},L=new AbortController,R=T.beforeTimeout;B.current={cancel:()=>L.abort()};const z=R?setTimeout(()=>{L.signal.aborted||(or(q,`step:${d}`,"before()","timed out",`${R}ms`),L.abort(),t(T,"before_hook"),r(rr.ERROR,T,{error:new Error("Step before hook timed out")}),H())},R):null;T.before({...c.current.getState(),action:y.current??c.current.getState().action,step:T}).then(()=>{L.signal.aborted||(z&&clearTimeout(z),H())}).catch(E=>{L.signal.aborted||(z&&clearTimeout(z),t(T,"before_hook"),r(rr.ERROR,T,{error:E instanceof Error?E:new Error(String(E))}),H())})}else if(!B.current){I.current&&D.current!==T.target&&W();const H=Ns(T.target);if(H&&Rp(H))W(),c.current.updateState({action:y.current??Rt.UPDATE,lifecycle:Xe.READY,waiting:!1});else if(T.targetWaitTimeout===0)c.current.updateState({action:y.current??Rt.UPDATE,lifecycle:Xe.READY,waiting:!1});else if(!I.current){const{targetWaitTimeout:L}=T,R=Date.now();D.current=T.target,or(q,`step:${d}`,"polling","started",`${L}ms`),c.current.updateState({waiting:!0}),I.current=setInterval(()=>{const z=Ns(T.target),E=Date.now()-R,Q=E>=L;(z&&Rp(z)||Q)&&(or(q,`step:${d}`,"polling",z&&Rp(z)?"found":"timed out",`${E}ms`),W(),c.current.updateState({action:y.current??Rt.UPDATE,lifecycle:Xe.READY,waiting:!1}))},100)}}return()=>{W()}},[t,r,d,p,k,c]),m.useEffect(()=>{if(!C.current)return;const{hasChanged:F,hasChangedTo:T,previous:M}=Eo(w.current,C.current),q=N.current;if(!q)return;const H=Ns(q.target),L=!!H;if(L&&Rp(H)){if(T("lifecycle",Xe.READY)&&M.lifecycle===Xe.INIT&&r(rr.STEP_BEFORE,q,{action:y.current??w.current.action}),T("lifecycle",Xe.READY)){const R=w.current,z=xae(q,R,v.current.continuous)?Xe.TOOLTIP:Xe.BEACON,E=Ns(q.scrollTarget??q.spotlightTarget??q.target),Q=b_({isFirstStep:R.index===0,scrollToFirstStep:v.current.scrollToFirstStep,step:q,target:E,targetLifecycle:z}),V=z===Xe.TOOLTIP?Xe.TOOLTIP_BEFORE:Xe.BEACON_BEFORE;or(v.current.debug,`step:${d}`,"scroll",Q?"needed":"skipped"),c.current.updateState({action:Rt.UPDATE,lifecycle:V,scrolling:Q})}}else if(w.current.status===_t.RUNNING&&p!==Xe.INIT&&p!==Xe.COMPLETE&&F("lifecycle")){or(v.current.debug,`step:${d}`,L?"Target not visible":"Target not mounted",q),t(q,"target_not_found"),r(rr.TARGET_NOT_FOUND,q);const R=w.current;R.controlled||c.current.updateState({action:Rt.UPDATE,index:R.index+(R.action===Rt.PREV?-1:1),lifecycle:Xe.INIT})}},[t,r,d,p,c]),m.useEffect(()=>{if(!C.current)return;const{hasChangedTo:F,previous:T}=Eo(w.current,C.current),M=N.current,q=j.current;if(M&&F("lifecycle",Xe.TOOLTIP_BEFORE)&&T.lifecycle===Xe.BEACON){const R=Ns(M.scrollTarget??M.spotlightTarget??M.target);if(b_({isFirstStep:w.current.index===0,scrollToFirstStep:v.current.scrollToFirstStep,step:M,target:R,targetLifecycle:Xe.TOOLTIP})){c.current.updateState({scrolling:!0,positioned:!1});return}}const H=p===Xe.BEACON_BEFORE||p===Xe.TOOLTIP_BEFORE;if(M&&H&&!h){const R=p===Xe.TOOLTIP_BEFORE?Xe.TOOLTIP:Xe.BEACON;c.current.updateState({action:Rt.UPDATE,lifecycle:R})}M&&F("lifecycle",Xe.BEACON)&&r(rr.BEACON,M),M&&F("lifecycle",Xe.TOOLTIP)&&r(rr.TOOLTIP,M);const L=w.current;if((L.status===_t.RUNNING||L.controlled&&L.status===_t.PAUSED&&M)&&q&&F("lifecycle",Xe.COMPLETE)&&T.lifecycle===Xe.TOOLTIP&&(r(rr.STEP_AFTER,q,{action:y.current??Rt.UPDATE,index:T.index??L.index,lifecycle:L.lifecycle}),q.after)){r(rr.STEP_AFTER_HOOK,q,{action:y.current??Rt.UPDATE,index:T.index??L.index,lifecycle:L.lifecycle});try{q.after({...c.current.getState(),action:y.current??Rt.UPDATE,index:T.index??L.index,lifecycle:L.lifecycle,step:q})}catch{}}},[r,p,f,h,c]),m.useEffect(()=>{if(!C.current)return;const{hasChangedTo:F,previous:T}=Eo(w.current,C.current),M=N.current,q=j.current;g&&!M&&p===Xe.INIT&&c.current.updateState({action:Rt.UPDATE,lifecycle:Xe.COMPLETE,status:_t.FINISHED}),!w.current.controlled&&k===_t.RUNNING&&F("lifecycle",Xe.COMPLETE)&&d<g&&c.current.updateState({action:Rt.UPDATE,lifecycle:Xe.INIT}),F("lifecycle",Xe.COMPLETE)&&d>=g&&c.current.updateState({action:Rt.UPDATE,lifecycle:Xe.COMPLETE,status:_t.FINISHED});const H=M??q??mv(v.current,v.current.steps[d-1]);if(H&&F("status",[_t.FINISHED,_t.SKIPPED])){let L;M?L=d:q?L=T.index??d:L=d-1,r(rr.TOUR_END,H,{index:L}),w.current.controlled||A.current.reset(),y.current=null}M&&F("action",Rt.STOP)&&(y.current=null,r(rr.TOUR_STATUS,M)),M&&F("action",Rt.RESET)&&(r(rr.TOUR_STATUS,M),y.current=null)},[u,r,d,p,g,k,c])}function _ae({controls:e,emitEvent:t,props:n,state:r,store:s}){const{debug:o,initialStepIndex:a,run:l,stepIndex:c,steps:u}=n,d=m.useRef(void 0),p=m.useRef(r),f=m.useRef(e);p.current=r,f.current=e,m.useEffect(()=>{const h=d.current;if(d.current=n,!h||n===h)return;const{hasChanged:g}=Eo(n,h);if(sv(h.steps,u)||(CM(u,o)?s.current.setSteps(u):(or(o,"tour","Steps are not valid",u),t(rr.ERROR,u[0]??{target:"",content:""},{error:new Error("Steps are not valid")}))),g("run"))l?s.current.getState().size&&f.current.start(c??a):f.current.stop();else if(Nr.number(c)&&g("stepIndex")){const k=Nr.number(h.stepIndex)&&h.stepIndex<c?Rt.NEXT:Rt.PREV;[_t.FINISHED,_t.SKIPPED].includes(p.current.status)||s.current.updateState({action:k,index:c,lifecycle:Xe.INIT,positioned:!1},!0)}},[o,t,a,n,l,c,u,s])}function Eae(e,t){var l,c,u,d;const{beaconPosition:n,lifecycle:r,scrollOffset:s,step:o}=t;if(o.scrollTarget||o.spotlightTarget)return Math.max(0,e);let a=e-o.spotlightPadding.top;if(r===Xe.BEACON_BEFORE&&(n!=null&&n.placement)){const p=Aae(n);["bottom"].includes(n.placement)||(a+=Math.floor(p-s))}else if(r===Xe.TOOLTIP_BEFORE){const{placement:p}=o;if(p==="top"){const f=((l=document.querySelector(".react-joyride__floater"))==null?void 0:l.getBoundingClientRect().height)??0,h=(c=o.floatingOptions)!=null&&c.hideArrow?0:o.arrowSize,g=o.offset+o.spotlightPadding.top+h;a-=f+g}else if(p==="left"||p==="right"){const f=((u=document.querySelector(".react-joyride__floater"))==null?void 0:u.getBoundingClientRect().height)??0,h=((d=Ns(o.target))==null?void 0:d.getBoundingClientRect().height)??0,g=s+o.spotlightPadding.top+h/2-f/2;g<s&&(a-=s-g)}}return Math.max(0,a)}function Aae(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 Pae({emitEvent:e,previousState:t,props:n,state:r,step:s,store:o}){const{index:a,lifecycle:l,positioned:c,scrolling:u,status:d}=r,p=m.useRef(null),f=m.useRef(r),h=m.useRef(t),g=m.useRef(n),k=m.useRef(s);f.current=r,h.current=t,g.current=n,k.current=s,m.useEffect(()=>()=>{var b;(b=p.current)==null||b.call(p)},[]),m.useEffect(()=>{var N;if(!h.current||!k.current)return;const{hasChangedTo:b}=Eo(f.current,h.current),y=k.current,{debug:v}=g.current,{scrollDuration:w}=y,C=l===Xe.BEACON_BEFORE||l===Xe.TOOLTIP_BEFORE;if(d===_t.RUNNING&&C&&u&&b("positioned",!0)){const j=Ns(y.scrollTarget??y.spotlightTarget??y.target),A=o.current.getPositionData("beacon"),I=Fc(j),D=I?!I.isSameNode(Kr()):!1;(N=p.current)==null||N.call(p),(async()=>{if(D&&!zc(I)){const L=Kr(),R=fae(I),z={initial:L.scrollTop,target:R,element:L,duration:w};e(rr.SCROLL_START,y,{scroll:z});const{cancel:E,promise:Q}=k_(R,{element:L,duration:w});p.current=E,await Q,e(rr.SCROLL_END,y,{scroll:z})}const W=Math.floor(pae(j,y.scrollOffset))||0,F=D?W:Eae(W,{beaconPosition:A,lifecycle:l,scrollOffset:y.scrollOffset,step:y});or(v,`step:${a}`,"scroll",D?"custom":"document",`${W} → ${F}`);const T=I,M={initial:T.scrollTop,target:F,element:T,duration:w};e(rr.SCROLL_START,y,{scroll:M});const{cancel:q,promise:H}=k_(F,{element:T,duration:w});p.current=q,await H,e(rr.SCROLL_END,y,{scroll:M}),o.current.updateState({scrolling:!1})})().catch(()=>{o.current.updateState({scrolling:!1})})}},[e,a,l,c,u,d,o])}function Iae(e){const t=pie(()=>lae(iae,e),[e]),{debug:n,initialStepIndex:r,onEvent:s,run:o,stepIndex:a,steps:l}=t,c=m.useRef(kae(t)),u=fI.useSyncExternalStore(c.current.subscribe,c.current.getSnapshot,c.current.getServerSnapshot),[d,p]=m.useState([]),f=m.useCallback((N,j)=>{p(A=>[...A,{reason:j,step:N}])},[]),h=m.useCallback(()=>{p([])},[]);Nae(c,n);const g=vae(c,n,h),k=jae(s,g,c),{index:b,size:y,status:v}=u,w=eM(u),C=m.useMemo(()=>mv(t,l[b]),[b,t,l]);return hie(()=>{o&&y&&CM(l,n)&&g.start(a??r)}),fie(()=>{o&&y&&v===_t.IDLE&&c.current.updateState({status:_t.READY})},[o,y,v]),_ae({controls:g,emitEvent:k,props:t,state:u,store:c}),Cae({addFailure:f,controls:g,emitEvent:k,previousState:w,props:t,state:u,step:C,store:c}),Pae({emitEvent:k,previousState:w,props:t,state:u,step:C,store:c}),{controls:g,failures:d,mergedProps:t,state:u,step:C,store:c}}function Rae(e){const[t,n]=m.useState(null);return m.useEffect(()=>{let r=null,s=!1;if(e)if(Nr.domElement(e))r=e,s=!0;else{const o=document.querySelector(e);o&&(r=o)}else{const o=document.createElement("div");o.id=oae,document.body.appendChild(o),r=o}return n(r),()=>{!r||s||r.parentNode===document.body&&document.body.removeChild(r)}},[e]),t}const Tae={animation:"joyride-loader-spin 1s linear infinite",border:"5px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",borderTopColor:"#555"};function Mae({nonce:e,step:t}){const{loaderComponent:n}=t,r=!!n;if(m.useEffect(()=>{if(r||document.getElementById("joyride-loader-animation"))return Wd;const c=document.createElement("style");return c.id="joyride-loader-animation",e&&c.setAttribute("nonce",e),c.appendChild(document.createTextNode(`
|
|
319
|
-
@keyframes joyride-loader-spin {
|
|
320
|
-
to { transform: rotate(360deg); }
|
|
321
|
-
}
|
|
322
|
-
`)),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:o,...a}=t.styles.loader;let l;if(n){const c=n;l=dt.createElement(c,{step:t})}else l=dt.createElement("div",{style:{...Tae,height:s,width:o,borderTopColor:t.primaryColor}});return dt.createElement("div",{className:"react-joyride__loader","data-testid":"loader",style:a},l)}const $ae={height:0,isFixed:!1,left:0,top:0,width:0};function _u(e,t){const n=Ns(e);if(!n)return $ae;const r=hv(n),s=zc(n),o=dae(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:o,width:Math.round(((r==null?void 0:r.width)??0)+t.left+t.right)}}function Lae(e,t,n){const[r,s]=m.useState(()=>_u(e,t)),o=m.useRef(void 0),a=m.useRef(null),l=m.useRef(n),c=m.useRef(null),u=m.useCallback(()=>{clearTimeout(o.current),o.current=window.setTimeout(()=>{s(p=>{const f=_u(e,t);return p.top===f.top&&p.left===f.left&&p.width===f.width&&p.height===f.height&&p.isFixed===f.isFixed?p:f})},100)},[e,t]);m.useEffect(()=>{let p=null;const f=g=>{a.current=Fc(g,!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(g)),s(_u(e,t))},h=Ns(e);return h?f(h):(p=new MutationObserver(()=>{const g=Ns(e);g&&(p==null||p.disconnect(),p=null,f(g))}),p.observe(document.body,{childList:!0,subtree:!0})),()=>{var g;p==null||p.disconnect(),a.current&&a.current.removeEventListener("scroll",u),window.removeEventListener("scroll",u),window.removeEventListener("resize",u),(g=c.current)==null||g.disconnect(),clearTimeout(o.current)}},[e,t,u]),m.useEffect(()=>{l.current&&!n&&s(_u(e,t)),l.current=n},[n,e,t]);let d=r;return l.current&&!n&&(d=_u(e,t)),d}function Oae(e,t,n){let r=`M0 0H${e}V${t}H0Z`;return n&&(r+=` ${n}`),r}function S_(e,t,n,r,s){if(n<=0||r<=0)return"";const o=Math.max(0,Math.min(s,n/2,r/2));let a=`M${e+o} ${t}`;return a+=`H${e+n-o}`,a+=`A${o} ${o} 0 0 1 ${e+n} ${t+o}`,a+=`V${t+r-o}`,a+=`A${o} ${o} 0 0 1 ${e+n-o} ${t+r}`,a+=`H${e+o}`,a+=`A${o} ${o} 0 0 1 ${e} ${t+r-o}`,a+=`V${t+o}`,a+=`A${o} ${o} 0 0 1 ${e+o} ${t}Z`,a}const Dae=[Xe.BEACON_BEFORE,Xe.BEACON];function Fae(e){var H,L;const{blockTargetInteraction:t,continuous:n,hideOverlay:r,lifecycle:s,onClickOverlay:o,overlayClickAction:a,placement:l,portalElement:c,scrolling:u,spotlightPadding:d,spotlightRadius:p,spotlightTarget:f,styles:h,target:g,waiting:k}=e,b=mie(),y=Lae(f??g,d,u||k),v=m.useRef(null),w=(s===Xe.TOOLTIP||s===Xe.TOOLTIP_BEFORE)&&l!=="center",[C,N]=m.useState(!1),j=c?(H=v.current)==null?void 0:H.offsetParent:null,A=(j==null?void 0:j.clientWidth)??b.width,I=(j==null?void 0:j.clientHeight)??uae()??b.height,D=((L=h.overlay)==null?void 0:L.backgroundColor)??"rgba(0, 0, 0, 0.5)",B=m.useMemo(()=>{const{backgroundColor:R,mixBlendMode:z,...E}=h.overlay;return{height:I,pointerEvents:"none",...E}},[I,h.overlay]),W=w&&!u&&!k;m.useEffect(()=>{W?requestAnimationFrame(()=>N(!0)):N(!1)},[W]);const F=n&&Dae.includes(s),T=!n&&s!==Xe.TOOLTIP;if(r||!k&&(F||T))return null;let M="";if(W)if(c&&j){const R=Ns(f??g);if(R){const z=x_(R),E=x_(j);M=S_(z.left-E.left-d.left,z.top-E.top-d.top,R.offsetWidth+d.left+d.right,R.offsetHeight+d.top+d.bottom,p)}}else M=S_(y.left,y.top,y.width,y.height,p);const q=Oae(A,I,M);return dt.createElement("div",{ref:v,"aria-hidden":"true",className:"react-joyride__overlay","data-testid":"overlay",style:B},dt.createElement("svg",{className:"react-joyride__spotlight","data-testid":"spotlight",style:{height:I,left:0,position:y.isFixed?"fixed":"absolute",top:0,width:A}},dt.createElement("path",{d:q,fill:D,fillRule:"evenodd",onClick:o,style:{cursor:a?"pointer":"default",pointerEvents:"auto"}}),M&&dt.createElement("path",{d:M,fill:D,style:{opacity:C?0:1,pointerEvents:t?"auto":"none",transition:"opacity 0.2s"}}),M&&Object.keys(h.spotlight).length>0&&dt.createElement("path",{d:M,fill:"none",style:{pointerEvents:"none"},...h.spotlight})))}function _M(e){const{children:t,element:n}=e;return n?sr.createPortal(t,n):null}const zae='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), area[href], [tabindex]:not([tabindex="-1"]), [contenteditable]';function Bae(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!e)return Wd;n.current=document.activeElement;const r=o=>{if(o.key!=="Tab")return;const a=[...e.querySelectorAll(zae)],{shiftKey:l}=o;if(!a.length)return;o.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 o=e.querySelector(t);o&&(s=setTimeout(()=>{o.focus({preventScroll:!0})},100))}return()=>{var o;e.removeEventListener("keydown",r),s!==void 0&&clearTimeout(s),(o=n.current)==null||o.focus({preventScroll:!0})}},[e,t])}function Ui(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 Hae(e,t,n){const[r]=e.split("-");switch(r){case"top":return{points:`0,0 ${t/2},${n} ${t},0`,...Ui(e,t,n)};case"bottom":return{points:`${t},${n} ${t/2},0 0,${n}`,...Ui(e,t,n)};case"left":return{points:`0,0 ${n},${t/2} 0,${t}`,...Ui(e,t,n)};case"right":return{points:`${n},${t} ${n},0 0,${t/2}`,...Ui(e,t,n)};default:return null}}function Wae(e,t,n,r){if(!t)return{};const[s]=e.split("-");switch(s){case"top":return{bottom:-n,left:t.x??0,...Ui(e,r,n)};case"bottom":return{top:-n,left:t.x??0,...Ui(e,r,n)};case"left":return{right:-n,top:t.y??0,...Ui(e,r,n)};case"right":return{left:-n,top:t.y??0,...Ui(e,r,n)};default:return{}}}function Vae({arrowComponent:e,arrowRef:t,base:n,placement:r,position:s,size:o,styles:a}){const l=e;let c=null;if(l){if(!Ui(r,n,o))return null;c=dt.createElement("span",{style:{flexShrink:0}},dt.createElement(l,{base:n,placement:r,size:o}))}else{const u=Hae(r,n,o);if(!u)return null;c=dt.createElement("svg",{height:u.height,width:u.width,xmlns:"http://www.w3.org/2000/svg"},dt.createElement("polygon",{fill:"currentColor",points:u.points}))}return dt.createElement("span",{ref:t,className:"react-joyride__arrow","data-testid":"arrow",style:{...a,...Wae(r,s,o,n),...s?{}:{visibility:"hidden"}}},c)}function Kae(e){const{beaconComponent:t,continuous:n,index:r,isLastStep:s,locale:o,nonce:a,onInteract:l,shouldFocus:c,size:u,step:d,styles:p}=e,f=m.useRef(null),h=!!t;m.useEffect(()=>{if(h||document.getElementById("joyride-beacon-animation"))return Wd;const b=document.createElement("style");b.id="joyride-beacon-animation",a&&b.setAttribute("nonce",a),b.appendChild(document.createTextNode(`
|
|
323
|
-
@keyframes joyride-beacon-inner {
|
|
324
|
-
20% {
|
|
325
|
-
opacity: 0.9;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
90% {
|
|
329
|
-
opacity: 0.7;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
@keyframes joyride-beacon-outer {
|
|
334
|
-
0% {
|
|
335
|
-
transform: scale(1);
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
45% {
|
|
339
|
-
opacity: 0.7;
|
|
340
|
-
transform: scale(0.75);
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
100% {
|
|
344
|
-
opacity: 0.9;
|
|
345
|
-
transform: scale(1);
|
|
346
|
-
}
|
|
347
|
-
}
|
|
348
|
-
`)),document.head.appendChild(b);const y=setTimeout(()=>{Nr.domElement(f.current)&&c&&f.current.focus()},0);return()=>{clearTimeout(y);const v=document.getElementById("joyride-beacon-animation");v!=null&&v.parentNode&&v.parentNode.removeChild(v)}},[h,a,c]);const g=Hi(o.open);let k;if(t){const b=t;k=dt.createElement(b,{continuous:n,index:r,isLastStep:s,size:u,step:d})}else k=dt.createElement("span",{style:p.beacon},dt.createElement("span",{style:p.beaconOuter}),dt.createElement("span",{style:p.beaconInner}));return dt.createElement("button",{ref:f,"aria-label":g,className:"react-joyride__beacon","data-testid":"button-beacon",onClick:l,onMouseEnter:l,style:p.beaconWrapper,title:g,type:"button"},k)}function qae({styles:e,...t}){const{color:n,height:r,width:s,...o}=e;return dt.createElement("button",{style:o,type:"button",...t},dt.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"},dt.createElement("g",null,dt.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 Uae(e){const{backProps:t,closeProps:n,index:r,isLastStep:s,primaryProps:o,skipProps:a,step:l,tooltipProps:c}=e,{buttons:u,content:d,styles:p,title:f}=l,h={};u.includes("primary")&&(h.primary=dt.createElement("button",{"data-testid":"button-primary",style:p.buttonPrimary,type:"button",...o})),u.includes("skip")&&!s&&(h.skip=dt.createElement("button",{"aria-live":"off","data-testid":"button-skip",style:p.buttonSkip,type:"button",...a})),u.includes("back")&&r>0&&(h.back=dt.createElement("button",{"data-testid":"button-back",style:p.buttonBack,type:"button",...t})),h.close=u.includes("close")&&dt.createElement(qae,{"data-testid":"button-close",styles:p.buttonClose,...n});const g=f?{"aria-labelledby":"joyride-tooltip-title","aria-describedby":"joyride-tooltip-content"}:{"aria-label":Hi(d),"aria-describedby":"joyride-tooltip-content"};return dt.createElement("div",{key:"JoyrideTooltip",className:"react-joyride__tooltip","data-joyride-step":r,...l.id&&{"data-joyride-id":l.id},style:p.tooltip,...c,...g},dt.createElement("div",{style:p.tooltipContainer},f&&dt.createElement("h4",{id:"joyride-tooltip-title",style:p.tooltipTitle},f),dt.createElement("div",{id:"joyride-tooltip-content",style:p.tooltipContent},d)),u.some(k=>k==="back"||k==="primary"||k==="skip")&&dt.createElement("div",{style:p.tooltipFooter},dt.createElement("div",{style:p.tooltipFooterSpacer},h.skip),h.back,h.primary),h.close)}function Yae(e){const{continuous:t,controls:n,index:r,isLastStep:s,size:o,step:a}=e,l=y=>{y.preventDefault(),n.prev(pi.BUTTON_BACK)},c=y=>{y.preventDefault(),a.closeButtonAction==="skip"?n.skip(pi.BUTTON_CLOSE):n.close(pi.BUTTON_CLOSE)},u=y=>{if(y.preventDefault(),!t){n.close(pi.BUTTON_PRIMARY);return}n.next(pi.BUTTON_PRIMARY)},d=y=>{y.preventDefault(),n.skip(pi.BUTTON_SKIP)},p=()=>{const{back:y,close:v,last:w,next:C,nextWithProgress:N,skip:j}=a.locale,A=Hi(y),I=Hi(v),D=Hi(w),B=Hi(C),W=Hi(j);let F=v,T=I;if(t){if(F=C,T=B,a.showProgress&&!s){const M=Hi(N,{step:r+1,steps:o});F=ub(N,r+1,o),T=M}s&&(F=w,T=D)}return{backProps:{"aria-label":A,children:y,"data-action":"back",onClick:l,role:"button",title:A},closeProps:{"aria-label":I,children:v,"data-action":"close",onClick:c,role:"button",title:I},primaryProps:{"aria-label":T,children:F,"data-action":"primary",onClick:u,role:"button",title:T},skipProps:{"aria-label":W,children:j,"data-action":"skip",onClick:d,role:"button",title:W},tooltipProps:{"aria-modal":!0,role:"alertdialog"}}},{arrowComponent:f,beaconComponent:h,tooltipComponent:g,...k}=a;let b;if(g){const y=g;b=dt.createElement(y,{...p(),continuous:t,controls:n,index:r,isLastStep:s,size:o,step:k})}else b=dt.createElement(Uae,{...p(),continuous:t,controls:n,index:r,isLastStep:s,size:o,step:k});return b}function Gae(e){if(e.startsWith("left"))return["top","bottom"];if(e.startsWith("right"))return["bottom","top"]}function Jae(e,t,n){var r,s;return e?[eae()]:((r=t.floatingOptions)==null?void 0:r.flipOptions)===!1?[]:[Zoe({crossAxis:!1,fallbackPlacements:Gae(n),padding:20,...(s=t.floatingOptions)==null?void 0:s.flipOptions})]}function Xae(e){var z,E,Q,V,$;const{continuous:t,controls:n,index:r,lifecycle:s,nonce:o,open:a,portalElement:l,setPositionData:c,setTooltipRef:u,shouldScroll:d,size:p,step:f,target:h,updateState:g}=e,k=m.useRef(null),b=m.useRef({}),y=m.useRef({}),v=f.placement==="center",w=f.placement==="auto",C=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})}),[]),N=m.useMemo(()=>SM(h)?Fc(h):void 0,[h]),j=m.useMemo(()=>zc(h),[h]),A=m.useMemo(()=>N?{boundary:N,rootBoundary:"viewport"}:{},[N]),I=v||w?"bottom":f.placement,D=v?"fixed":((z=f.floatingOptions)==null?void 0:z.strategy)??(f.isFixed||j?"fixed":"absolute"),B=m.useMemo(()=>{var ne,ce,X,re;return v?[{name:"center",fn:({rects:Z})=>({x:(window.innerWidth-Z.floating.width)/2,y:(window.innerHeight-Z.floating.height)/2})}]:[g_(({placement:Z})=>{var ue;let ie="right";Z.startsWith("top")?ie="top":Z.startsWith("bottom")?ie="bottom":Z.startsWith("left")&&(ie="left");const te=f.spotlightTarget?0:f.spotlightPadding[ie];return f.offset+te+((ue=f.floatingOptions)!=null&&ue.hideArrow?0:f.arrowSize)},[f.offset,f.spotlightPadding,f.spotlightTarget,f.arrowSize,(ne=f.floatingOptions)==null?void 0:ne.hideArrow]),...Jae(w,f,I),Qoe({padding:10,...A,...(ce=f.floatingOptions)==null?void 0:ce.shiftOptions}),...(X=f.floatingOptions)!=null&&X.hideArrow?[]:[tae({element:k,padding:f.arrowSpacing},[f.arrowSpacing,f.arrowBase])],...((re=f.floatingOptions)==null?void 0:re.middleware)??[]]},[v,f,w,I,A]),W=m_({...v?{elements:{reference:C}}:{},placement:I,strategy:D,middleware:B}),F=m_({strategy:D,placement:f.beaconPlacement??(w||v?"bottom":f.placement),middleware:m.useMemo(()=>{var ne,ce;return[g_(((ce=(ne=f.floatingOptions)==null?void 0:ne.beaconOptions)==null?void 0:ce.offset)??-18)]},[(Q=(E=f.floatingOptions)==null?void 0:E.beaconOptions)==null?void 0:Q.offset]),whileElementsMounted:f_});y.current=W.middlewareData,b.current=F.middlewareData,m.useEffect(()=>{var X;const{floating:ne,reference:ce}=W.elements;if(!(!ce||!ne||s!==Xe.TOOLTIP))return f_(ce,ne,W.update,(X=f.floatingOptions)==null?void 0:X.autoUpdate)},[s,W.update,(V=f.floatingOptions)==null?void 0:V.autoUpdate,f.target,W.elements]),m.useEffect(()=>{!v&&h&&W.refs.setReference(h),h&&F.refs.setReference(h)},[F.refs,v,h,W.refs]),m.useEffect(()=>{W.isPositioned&&c("tooltip",{placement:W.placement,x:W.x??0,y:W.y??0,middlewareData:y.current})},[c,W.isPositioned,W.placement,W.x,W.y]),m.useEffect(()=>{F.isPositioned&&c("beacon",{placement:F.placement,x:F.x??0,y:F.y??0,middlewareData:b.current})},[c,F.isPositioned,F.placement,F.x,F.y]);const T=f.zIndex+100,M=m.useCallback(ne=>{ne.type==="mouseenter"&&f.beaconTrigger!=="hover"||g({lifecycle:Xe.TOOLTIP_BEFORE,positioned:!1})},[f.beaconTrigger,g]),q=m.useCallback(ne=>{ne&&(W.refs.setFloating(ne),u(ne))},[W.refs,u]),{arrow:H,floater:L}=f.styles;let R=null;if(s===Xe.TOOLTIP||s===Xe.TOOLTIP_BEFORE){const ne=w_({...L,...W.floatingStyles,zIndex:T,opacity:a&&W.isPositioned?1:0,...!a&&{transition:"none"}});R=dt.createElement("div",{ref:q,className:"react-joyride__floater","data-testid":"floater",id:`react-joyride-step-${r}`,style:ne},dt.createElement(Yae,{continuous:t,controls:n,index:r,isLastStep:r+1===p,size:p,step:f}),!v&&!(($=f.floatingOptions)!=null&&$.hideArrow)&&dt.createElement(Vae,{arrowComponent:f.arrowComponent,arrowRef:k,base:f.arrowBase,placement:W.placement,position:W.middlewareData.arrow,size:f.arrowSize,styles:H}))}else(s===Xe.BEACON||s===Xe.BEACON_BEFORE)&&(R=dt.createElement("div",{ref:F.refs.setFloating,className:"react-joyride__floater","data-testid":"floater-beacon",id:`react-joyride-step-${r}-beacon`,style:w_({...F.floatingStyles,zIndex:T})},dt.createElement(Kae,{beaconComponent:f.beaconComponent,continuous:t,index:r,isLastStep:r+1===p,locale:f.locale,nonce:o,onInteract:M,shouldFocus:d,size:p,step:f,styles:f.styles})));return dt.createElement(_M,{element:l},R)}function Qae(e){const{continuous:t,controls:n,index:r,lifecycle:s,nonce:o,portalElement:a,setPositionData:l,shouldScroll:c,size:u,step:d,updateState:p}=e,[f,h]=m.useState(null);Bae(d.disableFocusTrap?null:f,"[data-action=primary]");const g=Ns(d.target),k=s===Xe.TOOLTIP;return!jM(d)||!Nr.domElement(g)?null:dt.createElement(Xae,{key:`JoyrideStep-${r}`,continuous:t,controls:n,index:r,lifecycle:s,nonce:o,open:k,portalElement:a,setPositionData:l,setTooltipRef:h,shouldScroll:c,size:u,step:d,target:g,updateState:p})}function Zae({controls:e,mergedProps:t,state:n,step:r,store:s}){const{continuous:o,debug:a,nonce:l,portalElement:c,scrollToFirstStep:u}=t,d=Rae(c),{index:p,lifecycle:f,status:h}=n,g=h===_t.RUNNING,[k,b]=m.useState(!1),y=m.useRef(null),v=(r==null?void 0:r.loaderDelay)??0;m.useEffect(()=>(n.waiting?v===0?b(!0):y.current=setTimeout(()=>{b(!0)},v):b(!1),()=>{y.current&&(clearTimeout(y.current),y.current=null)}),[v,n.waiting]),m.useEffect(()=>{if(!g)return;const N=j=>{!r||f!==Xe.TOOLTIP||j.key==="Escape"&&r.dismissKeyAction&&(r.dismissKeyAction==="next"?e.next(pi.KEYBOARD):e.close(pi.KEYBOARD))};return document.body.addEventListener("keydown",N,{passive:!0}),()=>{document.body.removeEventListener("keydown",N)}},[e,g,f,r]);const w=m.useCallback(()=>{(r==null?void 0:r.overlayClickAction)==="close"?e.close(pi.OVERLAY):(r==null?void 0:r.overlayClickAction)==="next"&&e.next(pi.OVERLAY)},[e,r==null?void 0:r.overlayClickAction]);if(!r||!g)return null;const C=n.action===Rt.START&&!r.skipBeacon&&r.placement!=="center";return dt.createElement(dt.Fragment,null,f!==Xe.INIT&&dt.createElement(Qae,{...n,continuous:o,controls:e,debug:a,nonce:l,portalElement:d,setPositionData:s.current.setPositionData,shouldScroll:!r.skipScroll&&(p!==0||u),step:r,updateState:s.current.updateState}),dt.createElement(_M,{element:d},dt.createElement(dt.Fragment,null,k&&dt.createElement(Mae,{nonce:l,step:r}),!C&&dt.createElement(Fae,{...r,continuous:o,lifecycle:f,onClickOverlay:w,portalElement:c?d:null,scrolling:n.scrolling,waiting:n.waiting}))))}function ele(e){const{controls:t,failures:n,mergedProps:r,state:s,step:o,store:a}=Iae(e);return{controls:t,failures:n,on:m.useCallback((l,c)=>a.current.on(l,c),[a]),state:m.useMemo(()=>pm(s,"positioned"),[s]),step:o,Tour:pv()?dt.createElement(Zae,{controls:t,mergedProps:r,state:s,step:o,store:a}):null}}function tle(e){const{Tour:t}=ele(e);return t}function nle(e){return pv()?dt.createElement(tle,e):null}function rle(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 sle(e){return[{target:"body",content:e("onboarding:flow.intro"),disableBeacon:!0,placement:"center"}]}function ile(e){return[{target:"body",content:e("onboarding:flow.introEmpty"),disableBeacon:!0,placement:"center"}]}const Mp="af:onboarding";function ole({page:e,hasNodes:t=!1}){const{t:n}=Lr(),[r,s]=m.useState(!1),[o,a]=m.useState([]),l=m.useRef(null),c=m.useMemo(()=>e==="projects"?rle(n):t?sle(n):ile(n),[e,t,n]);return m.useEffect(()=>{const u=localStorage.getItem(Mp),d=u?JSON.parse(u):{};if(d.completed||d[e]){s(!1),a([]);return}localStorage.setItem(Mp,JSON.stringify({...d,[e]:!0})),a(c),s(!0)},[e,t,c]),m.useEffect(()=>{if(!r)return;const u=d=>{var g;const p=d.target.closest("button");if(!p||!p.closest(".react-joyride__tooltip"))return;const h=(g=p.textContent)==null?void 0:g.trim();if(h===n("onboarding:done")||h===n("onboarding:startCreate")||h===n("onboarding:skip")){const k=localStorage.getItem(Mp)||"{}",b=JSON.parse(k);h===n("onboarding:skip")?(b.projects=!0,b.flow=!0,b.completed=!0):b[e]=!0,localStorage.setItem(Mp,JSON.stringify(b)),a([]),s(!1),e==="projects"&&(h===n("onboarding:done")||h===n("onboarding:startCreate"))&&(localStorage.setItem("af:newPipelineGuide","true"),setTimeout(()=>{const y=document.querySelector(".af-create-btn");y&&y.click()},500))}};return document.addEventListener("click",u,!0),()=>document.removeEventListener("click",u,!0)},[r,e,n]),!r||o.length===0?null:i.jsx(nle,{ref:l,steps:o,run:r,continuous:!0,showSkipButton:!0,showProgress:o.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 ale(){const{navigate:e,path:t}=ei(),[n,r]=m.useState([]),[s,o]=m.useState(!1);if(m.useEffect(()=>{let d=!1;const p=async()=>{try{const h=await fetch("/api/pipeline-recent-runs");if(!h.ok)return;const g=await h.json();if(d)return;const k=Array.isArray(g.runs)?g.runs:[];r(k.filter(b=>b&&b.status==="running"))}catch{}};p();const f=window.setInterval(p,3e3);return()=>{d=!0,window.clearInterval(f)}},[]),n.length===0)return null;const a=d=>{const p=new URLSearchParams({flowId:d.flowId,flowSource:d.flowSource||"workspace"});e(`/flow?${p.toString()}`),o(!1)},l=t==="/flow"?new URLSearchParams(window.location.search):null,c=(l==null?void 0:l.get("flowId"))||"",u=n.length===1;return i.jsxs("div",{className:"af-run-indicator",role:"status","aria-live":"polite",children:[s&&!u&&i.jsx("div",{className:"af-run-indicator__menu",onMouseLeave:()=>o(!1),children:n.map(d=>i.jsxs("button",{type:"button",className:"af-run-indicator__item"+(d.flowId===c?" af-run-indicator__item--current":""),onClick:()=>a(d),title:`${d.flowId} · ${d.runId}`,children:[i.jsx("span",{className:"af-run-indicator__dot"}),i.jsx("span",{className:"af-run-indicator__flow",children:d.flowId}),i.jsx("span",{className:"af-run-indicator__run",children:d.runId.slice(0,12)})]},`${d.flowId}:${d.runId}`))}),i.jsxs("button",{type:"button",className:"af-run-indicator__btn",onClick:()=>u?a(n[0]):o(d=>!d),title:u?`${n[0].flowId} 运行中,点击跳转`:`${n.length} 个 pipeline 运行中`,children:[i.jsx("span",{className:"af-run-indicator__pulse"}),i.jsx("span",{className:"af-run-indicator__label",children:u?n[0].flowId:`${n.length} running`})]})]})}const uw="0.1.105",lle=6e4,cle=30*6e4;function Ec(e){return String(e||"").trim().replace(/^v/i,"")}function ule(e,t){const n=Ec(e),r=Ec(t);return!!(n&&r&&n!==r)}function dle(e,t){return`agentflow.app-version.snooze:${Ec(e)}:${Ec(t)}`}function fle(e){if(!e)return 0;try{const t=Number(window.sessionStorage.getItem(e));return Number.isFinite(t)?t:0}catch{return 0}}function ple(){const[e,t]=m.useState(null);if(m.useEffect(()=>{let r=!1,s=!1;const o=async()=>{if(!(s||document.visibilityState==="hidden")){s=!0;try{const c=await fetch("/api/app-version",{cache:"no-store"}),u=await c.json().catch(()=>({}));if(!c.ok||r)return;const d=Ec(u.version);if(!ule(uw,d)){t(null);return}const p=dle(uw,d);if(fle(p)>Date.now())return;t({clientVersion:Ec(uw),serverVersion:d,startedAt:String(u.startedAt||""),snoozeKey:p})}catch{}finally{s=!1}}},a=()=>{document.visibilityState==="visible"&&o()},l=window.setInterval(()=>void o(),lle);return document.addEventListener("visibilitychange",a),window.addEventListener("focus",o),o(),()=>{r=!0,window.clearInterval(l),document.removeEventListener("visibilitychange",a),window.removeEventListener("focus",o)}},[]),!e)return null;const n=()=>{try{window.sessionStorage.setItem(e.snoozeKey,String(Date.now()+cle))}catch{}t(null)};return i.jsxs("aside",{className:"af-app-version-notice",role:"status","aria-live":"polite",children:[i.jsx("span",{className:"material-symbols-outlined af-app-version-notice__icon","aria-hidden":!0,children:"system_update"}),i.jsxs("div",{className:"af-app-version-notice__copy",children:[i.jsx("strong",{children:"AgentFlow 已更新"}),i.jsxs("span",{children:["v",e.clientVersion," → v",e.serverVersion,",刷新后生效"]})]}),i.jsxs("div",{className:"af-app-version-notice__actions",children:[i.jsx("button",{type:"button",className:"af-app-version-notice__later",onClick:n,children:"稍后"}),i.jsx("button",{type:"button",className:"af-app-version-notice__refresh",onClick:()=>window.location.reload(),children:"刷新更新"})]})]})}function EM(e){return e==="/likee-context"||e==="/likee_context"}function hle(){const{navigate:e}=ei();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 mle 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,o;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(((o=this.state.info)==null?void 0:o.componentStack)||"");return i.jsx("div",{className:"af-auth-screen",children:i.jsxs("div",{className:"af-auth-panel af-ui-error-panel",children:[i.jsxs("div",{className:"af-auth-brand",children:[i.jsx("span",{className:"material-symbols-outlined",children:"error"}),i.jsxs("div",{children:[i.jsx("h1",{children:"AgentFlow UI Error"}),i.jsx("p",{children:"页面渲染失败,下面是调试堆栈。"})]})]}),i.jsx("pre",{children:t}),n?i.jsx("pre",{children:n}):null]})})}}function gle({authUser:e}){const{path:t}=ei();return t==="/projects"||t==="/"?i.jsx(Nl,{authUser:e}):t==="/nodes"?i.jsx(Nl,{authUser:e,resourceKind:"nodes"}):t==="/my-nodes"?i.jsx(Nl,{authUser:e,resourceKind:"my-nodes"}):t==="/my-flows"?i.jsx(Nl,{authUser:e,resourceKind:"my-flows"}):t==="/skills"?i.jsx(Nl,{authUser:e,resourceKind:"skills"}):t==="/workspaces"?i.jsx(Vse,{authUser:e}):t==="/mcps"?i.jsx(Rse,{}):t==="/schedules"?i.jsx(Lse,{}):t==="/node-studio"?i.jsx(Dse,{}):t==="/flow"?i.jsx(hle,{}):t==="/workspace"?i.jsx(YG,{}):t.startsWith("/display")?i.jsx(FT,{}):t==="/settings"?i.jsx(kse,{authUser:e}):t==="/admin/usage"?i.jsx(jse,{authUser:e}):t==="/feedback"?i.jsx(_se,{authUser:e}):EM(t)?i.jsx(QT,{}):i.jsx(Nl,{})}function yle({children:e}){const[t,n]=m.useState({loading:!0,authenticated:!1,user:null,setupRequired:!1}),[r,s]=m.useState(""),[o,a]=m.useState(""),[l,c]=m.useState(!1),[u,d]=m.useState(""),p=async()=>{try{const g=await(await fetch("/api/auth/me")).json().catch(()=>({}));n({loading:!1,authenticated:!!g.authenticated,user:g.user||null,setupRequired:!!g.setupRequired}),d(g.error?String(g.error):"")}catch(h){n({loading:!1,authenticated:!1,user:null,setupRequired:!1}),d(String(h.message||h))}};m.useEffect(()=>{p()},[]);const f=async h=>{h.preventDefault(),c(!0),d("");try{const g=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,password:o})}),k=await g.json().catch(()=>({}));if(!g.ok)throw new Error(k.error||"登录失败");n({loading:!1,authenticated:!0,user:k.user||null,setupRequired:!1})}catch(g){d(String(g.message||g))}finally{c(!1)}};return t.loading?i.jsx("div",{className:"af-auth-screen",children:i.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})}}):i.jsx("div",{className:"af-auth-screen",children:i.jsxs("form",{className:"af-auth-panel",onSubmit:f,children:[i.jsxs("div",{className:"af-auth-brand",children:[i.jsx("span",{className:"material-symbols-outlined",children:"account_circle"}),i.jsxs("div",{children:[i.jsx("h1",{children:"AgentFlow"}),i.jsx("p",{children:t.setupRequired?"初始化管理员账号":"登录或创建用户"})]})]}),i.jsxs("label",{className:"af-auth-field",children:[i.jsx("span",{children:"用户名"}),i.jsx("input",{value:r,onChange:h=>s(h.target.value),autoComplete:"username",autoFocus:!0})]}),i.jsxs("label",{className:"af-auth-field",children:[i.jsx("span",{children:"密码"}),i.jsx("input",{type:"password",value:o,onChange:h=>a(h.target.value),autoComplete:t.setupRequired?"new-password":"current-password"})]}),u?i.jsx("p",{className:"af-auth-error",children:u}):null,i.jsx("button",{className:"af-auth-submit",type:"submit",disabled:l||!r.trim()||o.length<4,children:l?"处理中...":t.setupRequired?"创建并登录":"登录"})]})})}function wle({authUser:e,onLogout:t}){const{path:n}=ei(),r=n==="/flow"||n==="/workspace";return i.jsxs("div",{className:"af-app",children:[n!=="/settings"?i.jsx(ole,{page:r?"flow":"projects"}):null,r?null:i.jsx(QO,{authUser:e,onLogout:t}),i.jsx("div",{className:r?"af-main af-main--pipeline":"af-main",children:i.jsx(gle,{authUser:e})}),i.jsx(ale,{})]})}function xle(){return i.jsx(mle,{children:i.jsxs(TO,{children:[i.jsx(ble,{}),i.jsx(ple,{})]})})}function ble(){const{path:e}=ei();return e.startsWith("/display")?i.jsx(FT,{}):EM(e)?i.jsx(QT,{}):i.jsx(yle,{children:({user:t,onLogout:n})=>i.jsx(wle,{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 N_=document.querySelector('link[rel="icon"]');N_&&(N_.href=zA);dw.createRoot(document.getElementById("root")).render(i.jsx(dt.StrictMode,{children:i.jsx(xle,{})}));
|