@fieldwangai/agentflow 0.1.133 → 0.1.135
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/lib/prd-workflow-collaboration.mjs +24 -3
- package/bin/lib/teams.mjs +160 -0
- package/bin/lib/ui-server.mjs +297 -5
- package/bin/lib/workflow-report.mjs +88 -4
- package/bin/lib/workspace-collaboration.mjs +52 -2
- package/builtin/web-ui/dist/assets/index-BFQVTav-.css +1 -0
- package/builtin/web-ui/dist/assets/index-CmpbCHAj.js +420 -0
- package/builtin/web-ui/dist/index.html +2 -2
- package/package.json +1 -1
- package/skills/agentflow-cli/SKILL.md +3 -70
- package/skills/agentflow-cli/agents/openai.yaml +2 -2
- package/skills/agentflow-workflow-report/SKILL.md +77 -0
- package/skills/agentflow-workflow-report/agents/openai.yaml +4 -0
- package/skills/agentflow-workflow-report/references/protocol.md +337 -0
- package/builtin/web-ui/dist/assets/index-CtH_zTEj.js +0 -350
- package/builtin/web-ui/dist/assets/index-DQA8LAlU.css +0 -1
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
var e2=Object.defineProperty;var t2=(e,t,n)=>t in e?e2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var $n=(e,t,n)=>t2(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 vd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ca(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var lE={exports:{}},Mm={},cE={exports:{}},Mt={};/**
|
|
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 cf=Symbol.for("react.element"),n2=Symbol.for("react.portal"),r2=Symbol.for("react.fragment"),s2=Symbol.for("react.strict_mode"),i2=Symbol.for("react.profiler"),o2=Symbol.for("react.provider"),a2=Symbol.for("react.context"),l2=Symbol.for("react.forward_ref"),c2=Symbol.for("react.suspense"),u2=Symbol.for("react.memo"),d2=Symbol.for("react.lazy"),K0=Symbol.iterator;function f2(e){return e===null||typeof e!="object"?null:(e=K0&&e[K0]||e["@@iterator"],typeof e=="function"?e:null)}var uE={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},dE=Object.assign,fE={};function Vc(e,t,n){this.props=e,this.context=t,this.refs=fE,this.updater=n||uE}Vc.prototype.isReactComponent={};Vc.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")};Vc.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function pE(){}pE.prototype=Vc.prototype;function $b(e,t,n){this.props=e,this.context=t,this.refs=fE,this.updater=n||uE}var Lb=$b.prototype=new pE;Lb.constructor=$b;dE(Lb,Vc.prototype);Lb.isPureReactComponent=!0;var q0=Array.isArray,hE=Object.prototype.hasOwnProperty,Ob={current:null},mE={key:!0,ref:!0,__self:!0,__source:!0};function gE(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)hE.call(t,r)&&!mE.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:cf,type:e,key:o,ref:a,props:s,_owner:Ob.current}}function p2(e,t){return{$$typeof:cf,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Db(e){return typeof e=="object"&&e!==null&&e.$$typeof===cf}function h2(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var U0=/\/+/g;function cy(e,t){return typeof e=="object"&&e!==null&&e.key!=null?h2(""+e.key):t.toString(36)}function eh(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 cf:case n2:a=!0}}if(a)return a=e,s=s(a),e=r===""?"."+cy(a,0):r,q0(s)?(n="",e!=null&&(n=e.replace(U0,"$&/")+"/"),eh(s,t,n,"",function(u){return u})):s!=null&&(Db(s)&&(s=p2(s,n+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(U0,"$&/")+"/")+e)),t.push(s)),1;if(a=0,r=r===""?".":r+":",q0(e))for(var l=0;l<e.length;l++){o=e[l];var c=r+cy(o,l);a+=eh(o,t,n,c,s)}else if(c=f2(e),typeof c=="function")for(e=c.call(e),l=0;!(o=e.next()).done;)o=o.value,c=r+cy(o,l++),a+=eh(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 op(e,t,n){if(e==null)return e;var r=[],s=0;return eh(e,r,"","",function(o){return t.call(n,o,s++)}),r}function m2(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 Tr={current:null},th={transition:null},g2={ReactCurrentDispatcher:Tr,ReactCurrentBatchConfig:th,ReactCurrentOwner:Ob};function yE(){throw Error("act(...) is not supported in production builds of React.")}Mt.Children={map:op,forEach:function(e,t,n){op(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return op(e,function(){t++}),t},toArray:function(e){return op(e,function(t){return t})||[]},only:function(e){if(!Db(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Mt.Component=Vc;Mt.Fragment=r2;Mt.Profiler=i2;Mt.PureComponent=$b;Mt.StrictMode=s2;Mt.Suspense=c2;Mt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=g2;Mt.act=yE;Mt.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=dE({},e.props),s=e.key,o=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(o=t.ref,a=Ob.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)hE.call(t,c)&&!mE.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:cf,type:e.type,key:s,ref:o,props:r,_owner:a}};Mt.createContext=function(e){return e={$$typeof:a2,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:o2,_context:e},e.Consumer=e};Mt.createElement=gE;Mt.createFactory=function(e){var t=gE.bind(null,e);return t.type=e,t};Mt.createRef=function(){return{current:null}};Mt.forwardRef=function(e){return{$$typeof:l2,render:e}};Mt.isValidElement=Db;Mt.lazy=function(e){return{$$typeof:d2,_payload:{_status:-1,_result:e},_init:m2}};Mt.memo=function(e,t){return{$$typeof:u2,type:e,compare:t===void 0?null:t}};Mt.startTransition=function(e){var t=th.transition;th.transition={};try{e()}finally{th.transition=t}};Mt.unstable_act=yE;Mt.useCallback=function(e,t){return Tr.current.useCallback(e,t)};Mt.useContext=function(e){return Tr.current.useContext(e)};Mt.useDebugValue=function(){};Mt.useDeferredValue=function(e){return Tr.current.useDeferredValue(e)};Mt.useEffect=function(e,t){return Tr.current.useEffect(e,t)};Mt.useId=function(){return Tr.current.useId()};Mt.useImperativeHandle=function(e,t,n){return Tr.current.useImperativeHandle(e,t,n)};Mt.useInsertionEffect=function(e,t){return Tr.current.useInsertionEffect(e,t)};Mt.useLayoutEffect=function(e,t){return Tr.current.useLayoutEffect(e,t)};Mt.useMemo=function(e,t){return Tr.current.useMemo(e,t)};Mt.useReducer=function(e,t,n){return Tr.current.useReducer(e,t,n)};Mt.useRef=function(e){return Tr.current.useRef(e)};Mt.useState=function(e){return Tr.current.useState(e)};Mt.useSyncExternalStore=function(e,t,n){return Tr.current.useSyncExternalStore(e,t,n)};Mt.useTransition=function(){return Tr.current.useTransition()};Mt.version="18.3.1";cE.exports=Mt;var m=cE.exports;const ft=ca(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 y2=m,w2=Symbol.for("react.element"),x2=Symbol.for("react.fragment"),b2=Object.prototype.hasOwnProperty,k2=y2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,v2={key:!0,ref:!0,__self:!0,__source:!0};function wE(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)b2.call(t,r)&&!v2.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:w2,type:e,key:o,ref:a,props:s,_owner:k2.current}}Mm.Fragment=x2;Mm.jsx=wE;Mm.jsxs=wE;lE.exports=Mm;var i=lE.exports,Tw={},xE={exports:{}},hs={},bE={exports:{}},kE={};/**
|
|
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($,W){var E=$.length;$.push(W);e:for(;0<E;){var Q=E-1>>>1,V=$[Q];if(0<s(V,W))$[Q]=W,$[E]=V,E=Q;else break e}}function n($){return $.length===0?null:$[0]}function r($){if($.length===0)return null;var W=$[0],E=$.pop();if(E!==W){$[0]=E;e:for(var Q=0,V=$.length,B=V>>>1;Q<B;){var re=2*(Q+1)-1,ue=$[re],G=re+1,ee=$[G];if(0>s(ue,E))G<V&&0>s(ee,ue)?($[Q]=ee,$[G]=E,Q=G):($[Q]=ue,$[re]=E,Q=re);else if(G<V&&0>s(ee,E))$[Q]=ee,$[G]=E,Q=G;else break e}}return W}function s($,W){var E=$.sortIndex-W.sortIndex;return E!==0?E:$.id-W.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,f=null,p=3,h=!1,y=!1,v=!1,w=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function b($){for(var W=n(u);W!==null;){if(W.callback===null)r(u);else if(W.startTime<=$)r(u),W.sortIndex=W.expirationTime,t(c,W);else break;W=n(u)}}function j($){if(v=!1,b($),!y)if(n(c)!==null)y=!0,z(N);else{var W=n(u);W!==null&&F(j,W.startTime-$)}}function N($,W){y=!1,v&&(v=!1,g(R),R=-1),h=!0;var E=p;try{for(b(W),f=n(c);f!==null&&(!(f.expirationTime>W)||$&&!L());){var Q=f.callback;if(typeof Q=="function"){f.callback=null,p=f.priorityLevel;var V=Q(f.expirationTime<=W);W=e.unstable_now(),typeof V=="function"?f.callback=V:f===n(c)&&r(c),b(W)}else r(c);f=n(c)}if(f!==null)var B=!0;else{var re=n(u);re!==null&&F(j,re.startTime-W),B=!1}return B}finally{f=null,p=E,h=!1}}var C=!1,I=null,R=-1,H=5,A=-1;function L(){return!(e.unstable_now()-A<H)}function D(){if(I!==null){var $=e.unstable_now();A=$;var W=!0;try{W=I(!0,$)}finally{W?O():(C=!1,I=null)}}else C=!1}var O;if(typeof k=="function")O=function(){k(D)};else if(typeof MessageChannel<"u"){var M=new MessageChannel,K=M.port2;M.port1.onmessage=D,O=function(){K.postMessage(null)}}else O=function(){w(D,0)};function z($){I=$,C||(C=!0,O())}function F($,W){R=w(function(){$(e.unstable_now())},W)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function($){$.callback=null},e.unstable_continueExecution=function(){y||h||(y=!0,z(N))},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return p},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function($){switch(p){case 1:case 2:case 3:var W=3;break;default:W=p}var E=p;p=W;try{return $()}finally{p=E}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function($,W){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var E=p;p=$;try{return W()}finally{p=E}},e.unstable_scheduleCallback=function($,W,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,$){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,$={id:d++,callback:W,priorityLevel:$,startTime:E,expirationTime:V,sortIndex:-1},E>Q?($.sortIndex=E,t(u,$),n(c)===null&&$===n(u)&&(v?(g(R),R=-1):v=!0,F(j,E-Q))):($.sortIndex=V,t(c,$),y||h||(y=!0,z(N))),$},e.unstable_shouldYield=L,e.unstable_wrapCallback=function($){var W=p;return function(){var E=p;p=W;try{return $.apply(this,arguments)}finally{p=E}}}})(kE);bE.exports=kE;var S2=bE.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 j2=m,fs=S2;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 vE=new Set,Sd={};function cl(e,t){Nc(e,t),Nc(e+"Capture",t)}function Nc(e,t){for(Sd[e]=t,e=0;e<t.length;e++)vE.add(t[e])}var oo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Mw=Object.prototype.hasOwnProperty,N2=/^[: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={},G0={};function C2(e){return Mw.call(G0,e)?!0:Mw.call(Y0,e)?!1:N2.test(e)?G0[e]=!0:(Y0[e]=!0,!1)}function _2(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 E2(e,t,n,r){if(t===null||typeof t>"u"||_2(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 Mr(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 yr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){yr[e]=new Mr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];yr[t]=new Mr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){yr[e]=new Mr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){yr[e]=new Mr(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){yr[e]=new Mr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){yr[e]=new Mr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){yr[e]=new Mr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){yr[e]=new Mr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){yr[e]=new Mr(e,5,!1,e.toLowerCase(),null,!1,!1)});var Fb=/[\-:]([a-z])/g;function zb(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(Fb,zb);yr[t]=new Mr(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(Fb,zb);yr[t]=new Mr(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(Fb,zb);yr[t]=new Mr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){yr[e]=new Mr(e,1,!1,e.toLowerCase(),null,!1,!1)});yr.xlinkHref=new Mr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){yr[e]=new Mr(e,1,!1,e.toLowerCase(),null,!0,!0)});function Bb(e,t,n,r){var s=yr.hasOwnProperty(t)?yr[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(E2(t,n,s,r)&&(n=null),r||s===null?C2(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 mo=j2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,ap=Symbol.for("react.element"),Ul=Symbol.for("react.portal"),Yl=Symbol.for("react.fragment"),Hb=Symbol.for("react.strict_mode"),$w=Symbol.for("react.profiler"),SE=Symbol.for("react.provider"),jE=Symbol.for("react.context"),Wb=Symbol.for("react.forward_ref"),Lw=Symbol.for("react.suspense"),Ow=Symbol.for("react.suspense_list"),Vb=Symbol.for("react.memo"),Mo=Symbol.for("react.lazy"),NE=Symbol.for("react.offscreen"),J0=Symbol.iterator;function Cu(e){return e===null||typeof e!="object"?null:(e=J0&&e[J0]||e["@@iterator"],typeof e=="function"?e:null)}var Rn=Object.assign,uy;function Ku(e){if(uy===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);uy=t&&t[1]||""}return`
|
|
34
|
-
`+uy+e}var dy=!1;function fy(e,t){if(!e||dy)return"";dy=!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{dy=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ku(e):""}function A2(e){switch(e.tag){case 5:return Ku(e.type);case 16:return Ku("Lazy");case 13:return Ku("Suspense");case 19:return Ku("SuspenseList");case 0:case 2:case 15:return e=fy(e.type,!1),e;case 11:return e=fy(e.type.render,!1),e;case 1:return e=fy(e.type,!0),e;default:return""}}function Dw(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 Yl:return"Fragment";case Ul:return"Portal";case $w:return"Profiler";case Hb:return"StrictMode";case Lw:return"Suspense";case Ow:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case jE:return(e.displayName||"Context")+".Consumer";case SE:return(e._context.displayName||"Context")+".Provider";case Wb:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Vb:return t=e.displayName||null,t!==null?t:Dw(e.type)||"Memo";case Mo:t=e._payload,e=e._init;try{return Dw(e(t))}catch{}}return null}function P2(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 Dw(t);case 8:return t===Hb?"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 ta(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function CE(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function I2(e){var t=CE(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 lp(e){e._valueTracker||(e._valueTracker=I2(e))}function _E(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=CE(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Ch(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 Fw(e,t){var n=t.checked;return Rn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function X0(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=ta(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function EE(e,t){t=t.checked,t!=null&&Bb(e,"checked",t,!1)}function zw(e,t){EE(e,t);var n=ta(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")?Bw(e,t.type,n):t.hasOwnProperty("defaultValue")&&Bw(e,t.type,ta(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Q0(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 Bw(e,t,n){(t!=="number"||Ch(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var qu=Array.isArray;function dc(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=""+ta(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 Hw(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Ee(91));return Rn({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Z0(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(qu(n)){if(1<n.length)throw Error(Ee(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ta(n)}}function AE(e,t){var n=ta(t.value),r=ta(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 ej(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function PE(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 Ww(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?PE(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var cp,IE=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(cp=cp||document.createElement("div"),cp.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=cp.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function jd(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var rd={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},R2=["Webkit","ms","Moz","O"];Object.keys(rd).forEach(function(e){R2.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),rd[t]=rd[e]})});function RE(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||rd.hasOwnProperty(e)&&rd[e]?(""+t).trim():t+"px"}function TE(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=RE(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var T2=Rn({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(T2[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 Kw(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 qw=null;function Kb(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Uw=null,fc=null,pc=null;function tj(e){if(e=ff(e)){if(typeof Uw!="function")throw Error(Ee(280));var t=e.stateNode;t&&(t=Fm(t),Uw(e.stateNode,e.type,t))}}function ME(e){fc?pc?pc.push(e):pc=[e]:fc=e}function $E(){if(fc){var e=fc,t=pc;if(pc=fc=null,tj(e),t)for(e=0;e<t.length;e++)tj(t[e])}}function LE(e,t){return e(t)}function OE(){}var py=!1;function DE(e,t,n){if(py)return e(t,n);py=!0;try{return LE(e,t,n)}finally{py=!1,(fc!==null||pc!==null)&&(OE(),$E())}}function Nd(e,t){var n=e.stateNode;if(n===null)return null;var r=Fm(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 Yw=!1;if(oo)try{var _u={};Object.defineProperty(_u,"passive",{get:function(){Yw=!0}}),window.addEventListener("test",_u,_u),window.removeEventListener("test",_u,_u)}catch{Yw=!1}function M2(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 sd=!1,_h=null,Eh=!1,Gw=null,$2={onError:function(e){sd=!0,_h=e}};function L2(e,t,n,r,s,o,a,l,c){sd=!1,_h=null,M2.apply($2,arguments)}function O2(e,t,n,r,s,o,a,l,c){if(L2.apply(this,arguments),sd){if(sd){var u=_h;sd=!1,_h=null}else throw Error(Ee(198));Eh||(Eh=!0,Gw=u)}}function ul(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 FE(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 nj(e){if(ul(e)!==e)throw Error(Ee(188))}function D2(e){var t=e.alternate;if(!t){if(t=ul(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 nj(s),e;if(o===r)return nj(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 zE(e){return e=D2(e),e!==null?BE(e):null}function BE(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=BE(e);if(t!==null)return t;e=e.sibling}return null}var HE=fs.unstable_scheduleCallback,rj=fs.unstable_cancelCallback,F2=fs.unstable_shouldYield,z2=fs.unstable_requestPaint,Wn=fs.unstable_now,B2=fs.unstable_getCurrentPriorityLevel,qb=fs.unstable_ImmediatePriority,WE=fs.unstable_UserBlockingPriority,Ah=fs.unstable_NormalPriority,H2=fs.unstable_LowPriority,VE=fs.unstable_IdlePriority,$m=null,Ei=null;function W2(e){if(Ei&&typeof Ei.onCommitFiberRoot=="function")try{Ei.onCommitFiberRoot($m,e,void 0,(e.current.flags&128)===128)}catch{}}var ti=Math.clz32?Math.clz32:q2,V2=Math.log,K2=Math.LN2;function q2(e){return e>>>=0,e===0?32:31-(V2(e)/K2|0)|0}var up=64,dp=4194304;function Uu(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 Ph(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=Uu(l):(o&=a,o!==0&&(r=Uu(o)))}else a=n&~s,a!==0?r=Uu(a):o!==0&&(r=Uu(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-ti(t),s=1<<n,r|=e[n],t&=~s;return r}function U2(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 Y2(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,o=e.pendingLanes;0<o;){var a=31-ti(o),l=1<<a,c=s[a];c===-1?(!(l&n)||l&r)&&(s[a]=U2(l,t)):c<=t&&(e.expiredLanes|=l),o&=~l}}function Jw(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function KE(){var e=up;return up<<=1,!(up&4194240)&&(up=64),e}function hy(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function uf(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-ti(t),e[t]=n}function G2(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-ti(n),o=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~o}}function Ub(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ti(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var sn=0;function qE(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var UE,Yb,YE,GE,JE,Xw=!1,fp=[],Ko=null,qo=null,Uo=null,Cd=new Map,_d=new Map,Oo=[],J2="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 sj(e,t){switch(e){case"focusin":case"focusout":Ko=null;break;case"dragenter":case"dragleave":qo=null;break;case"mouseover":case"mouseout":Uo=null;break;case"pointerover":case"pointerout":Cd.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":_d.delete(t.pointerId)}}function Eu(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=ff(t),t!==null&&Yb(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function X2(e,t,n,r,s){switch(t){case"focusin":return Ko=Eu(Ko,e,t,n,r,s),!0;case"dragenter":return qo=Eu(qo,e,t,n,r,s),!0;case"mouseover":return Uo=Eu(Uo,e,t,n,r,s),!0;case"pointerover":var o=s.pointerId;return Cd.set(o,Eu(Cd.get(o)||null,e,t,n,r,s)),!0;case"gotpointercapture":return o=s.pointerId,_d.set(o,Eu(_d.get(o)||null,e,t,n,r,s)),!0}return!1}function XE(e){var t=Ma(e.target);if(t!==null){var n=ul(t);if(n!==null){if(t=n.tag,t===13){if(t=FE(n),t!==null){e.blockedOn=t,JE(e.priority,function(){YE(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 nh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Qw(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);qw=r,n.target.dispatchEvent(r),qw=null}else return t=ff(n),t!==null&&Yb(t),e.blockedOn=n,!1;t.shift()}return!0}function ij(e,t,n){nh(e)&&n.delete(t)}function Q2(){Xw=!1,Ko!==null&&nh(Ko)&&(Ko=null),qo!==null&&nh(qo)&&(qo=null),Uo!==null&&nh(Uo)&&(Uo=null),Cd.forEach(ij),_d.forEach(ij)}function Au(e,t){e.blockedOn===t&&(e.blockedOn=null,Xw||(Xw=!0,fs.unstable_scheduleCallback(fs.unstable_NormalPriority,Q2)))}function Ed(e){function t(s){return Au(s,e)}if(0<fp.length){Au(fp[0],e);for(var n=1;n<fp.length;n++){var r=fp[n];r.blockedOn===e&&(r.blockedOn=null)}}for(Ko!==null&&Au(Ko,e),qo!==null&&Au(qo,e),Uo!==null&&Au(Uo,e),Cd.forEach(t),_d.forEach(t),n=0;n<Oo.length;n++)r=Oo[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<Oo.length&&(n=Oo[0],n.blockedOn===null);)XE(n),n.blockedOn===null&&Oo.shift()}var hc=mo.ReactCurrentBatchConfig,Ih=!0;function Z2(e,t,n,r){var s=sn,o=hc.transition;hc.transition=null;try{sn=1,Gb(e,t,n,r)}finally{sn=s,hc.transition=o}}function eO(e,t,n,r){var s=sn,o=hc.transition;hc.transition=null;try{sn=4,Gb(e,t,n,r)}finally{sn=s,hc.transition=o}}function Gb(e,t,n,r){if(Ih){var s=Qw(e,t,n,r);if(s===null)jy(e,t,r,Rh,n),sj(e,r);else if(X2(s,e,t,n,r))r.stopPropagation();else if(sj(e,r),t&4&&-1<J2.indexOf(e)){for(;s!==null;){var o=ff(s);if(o!==null&&UE(o),o=Qw(e,t,n,r),o===null&&jy(e,t,r,Rh,n),o===s)break;s=o}s!==null&&r.stopPropagation()}else jy(e,t,r,null,n)}}var Rh=null;function Qw(e,t,n,r){if(Rh=null,e=Kb(r),e=Ma(e),e!==null)if(t=ul(e),t===null)e=null;else if(n=t.tag,n===13){if(e=FE(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 Rh=e,null}function QE(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(B2()){case qb:return 1;case WE:return 4;case Ah:case H2:return 16;case VE:return 536870912;default:return 16}default:return 16}}var Bo=null,Jb=null,rh=null;function ZE(){if(rh)return rh;var e,t=Jb,n=t.length,r,s="value"in Bo?Bo.value:Bo.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 rh=s.slice(e,1<r?1-r:void 0)}function sh(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 pp(){return!0}function oj(){return!1}function ms(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)?pp:oj,this.isPropagationStopped=oj,this}return Rn(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=pp)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=pp)},persist:function(){},isPersistent:pp}),t}var Kc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Xb=ms(Kc),df=Rn({},Kc,{view:0,detail:0}),tO=ms(df),my,gy,Pu,Lm=Rn({},df,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qb,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"?(my=e.screenX-Pu.screenX,gy=e.screenY-Pu.screenY):gy=my=0,Pu=e),my)},movementY:function(e){return"movementY"in e?e.movementY:gy}}),aj=ms(Lm),nO=Rn({},Lm,{dataTransfer:0}),rO=ms(nO),sO=Rn({},df,{relatedTarget:0}),yy=ms(sO),iO=Rn({},Kc,{animationName:0,elapsedTime:0,pseudoElement:0}),oO=ms(iO),aO=Rn({},Kc,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),lO=ms(aO),cO=Rn({},Kc,{data:0}),lj=ms(cO),uO={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},dO={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"},fO={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function pO(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=fO[e])?!!t[e]:!1}function Qb(){return pO}var hO=Rn({},df,{key:function(e){if(e.key){var t=uO[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=sh(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?dO[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qb,charCode:function(e){return e.type==="keypress"?sh(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?sh(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),mO=ms(hO),gO=Rn({},Lm,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),cj=ms(gO),yO=Rn({},df,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qb}),wO=ms(yO),xO=Rn({},Kc,{propertyName:0,elapsedTime:0,pseudoElement:0}),bO=ms(xO),kO=Rn({},Lm,{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}),vO=ms(kO),SO=[9,13,27,32],Zb=oo&&"CompositionEvent"in window,id=null;oo&&"documentMode"in document&&(id=document.documentMode);var jO=oo&&"TextEvent"in window&&!id,eA=oo&&(!Zb||id&&8<id&&11>=id),uj=" ",dj=!1;function tA(e,t){switch(e){case"keyup":return SO.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function nA(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Gl=!1;function NO(e,t){switch(e){case"compositionend":return nA(t);case"keypress":return t.which!==32?null:(dj=!0,uj);case"textInput":return e=t.data,e===uj&&dj?null:e;default:return null}}function CO(e,t){if(Gl)return e==="compositionend"||!Zb&&tA(e,t)?(e=ZE(),rh=Jb=Bo=null,Gl=!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 eA&&t.locale!=="ko"?null:t.data;default:return null}}var _O={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 fj(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!_O[e.type]:t==="textarea"}function rA(e,t,n,r){ME(r),t=Th(t,"onChange"),0<t.length&&(n=new Xb("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var od=null,Ad=null;function EO(e){hA(e,0)}function Om(e){var t=Ql(e);if(_E(t))return e}function AO(e,t){if(e==="change")return t}var sA=!1;if(oo){var wy;if(oo){var xy="oninput"in document;if(!xy){var pj=document.createElement("div");pj.setAttribute("oninput","return;"),xy=typeof pj.oninput=="function"}wy=xy}else wy=!1;sA=wy&&(!document.documentMode||9<document.documentMode)}function hj(){od&&(od.detachEvent("onpropertychange",iA),Ad=od=null)}function iA(e){if(e.propertyName==="value"&&Om(Ad)){var t=[];rA(t,Ad,e,Kb(e)),DE(EO,t)}}function PO(e,t,n){e==="focusin"?(hj(),od=t,Ad=n,od.attachEvent("onpropertychange",iA)):e==="focusout"&&hj()}function IO(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Om(Ad)}function RO(e,t){if(e==="click")return Om(t)}function TO(e,t){if(e==="input"||e==="change")return Om(t)}function MO(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var si=typeof Object.is=="function"?Object.is:MO;function Pd(e,t){if(si(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(!Mw.call(t,s)||!si(e[s],t[s]))return!1}return!0}function mj(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function gj(e,t){var n=mj(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=mj(n)}}function oA(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?oA(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function aA(){for(var e=window,t=Ch();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ch(e.document)}return t}function ek(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 $O(e){var t=aA(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&oA(n.ownerDocument.documentElement,n)){if(r!==null&&ek(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=gj(n,o);var a=gj(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 LO=oo&&"documentMode"in document&&11>=document.documentMode,Jl=null,Zw=null,ad=null,ex=!1;function yj(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;ex||Jl==null||Jl!==Ch(r)||(r=Jl,"selectionStart"in r&&ek(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}),ad&&Pd(ad,r)||(ad=r,r=Th(Zw,"onSelect"),0<r.length&&(t=new Xb("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Jl)))}function hp(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Xl={animationend:hp("Animation","AnimationEnd"),animationiteration:hp("Animation","AnimationIteration"),animationstart:hp("Animation","AnimationStart"),transitionend:hp("Transition","TransitionEnd")},by={},lA={};oo&&(lA=document.createElement("div").style,"AnimationEvent"in window||(delete Xl.animationend.animation,delete Xl.animationiteration.animation,delete Xl.animationstart.animation),"TransitionEvent"in window||delete Xl.transitionend.transition);function Dm(e){if(by[e])return by[e];if(!Xl[e])return e;var t=Xl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in lA)return by[e]=t[n];return e}var cA=Dm("animationend"),uA=Dm("animationiteration"),dA=Dm("animationstart"),fA=Dm("transitionend"),pA=new Map,wj="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 ua(e,t){pA.set(e,t),cl(t,[e])}for(var ky=0;ky<wj.length;ky++){var vy=wj[ky],OO=vy.toLowerCase(),DO=vy[0].toUpperCase()+vy.slice(1);ua(OO,"on"+DO)}ua(cA,"onAnimationEnd");ua(uA,"onAnimationIteration");ua(dA,"onAnimationStart");ua("dblclick","onDoubleClick");ua("focusin","onFocus");ua("focusout","onBlur");ua(fA,"onTransitionEnd");Nc("onMouseEnter",["mouseout","mouseover"]);Nc("onMouseLeave",["mouseout","mouseover"]);Nc("onPointerEnter",["pointerout","pointerover"]);Nc("onPointerLeave",["pointerout","pointerover"]);cl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));cl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));cl("onBeforeInput",["compositionend","keypress","textInput","paste"]);cl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));cl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));cl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Yu="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(" "),FO=new Set("cancel close invalid load scroll toggle".split(" ").concat(Yu));function xj(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,O2(r,t,void 0,e),e.currentTarget=null}function hA(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;xj(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;xj(s,l,u),o=c}}}if(Eh)throw e=Gw,Eh=!1,Gw=null,e}function wn(e,t){var n=t[ix];n===void 0&&(n=t[ix]=new Set);var r=e+"__bubble";n.has(r)||(mA(t,e,2,!1),n.add(r))}function Sy(e,t,n){var r=0;t&&(r|=4),mA(n,e,r,t)}var mp="_reactListening"+Math.random().toString(36).slice(2);function Id(e){if(!e[mp]){e[mp]=!0,vE.forEach(function(n){n!=="selectionchange"&&(FO.has(n)||Sy(n,!1,e),Sy(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[mp]||(t[mp]=!0,Sy("selectionchange",!1,t))}}function mA(e,t,n,r){switch(QE(t)){case 1:var s=Z2;break;case 4:s=eO;break;default:s=Gb}n=s.bind(null,t,n,e),s=void 0,!Yw||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(s=!0),r?s!==void 0?e.addEventListener(t,n,{capture:!0,passive:s}):e.addEventListener(t,n,!0):s!==void 0?e.addEventListener(t,n,{passive:s}):e.addEventListener(t,n,!1)}function jy(e,t,n,r,s){var 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=Ma(l),a===null)return;if(c=a.tag,c===5||c===6){r=o=a;continue e}l=l.parentNode}}r=r.return}DE(function(){var u=o,d=Kb(n),f=[];e:{var p=pA.get(e);if(p!==void 0){var h=Xb,y=e;switch(e){case"keypress":if(sh(n)===0)break e;case"keydown":case"keyup":h=mO;break;case"focusin":y="focus",h=yy;break;case"focusout":y="blur",h=yy;break;case"beforeblur":case"afterblur":h=yy;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=aj;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=rO;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=wO;break;case cA:case uA:case dA:h=oO;break;case fA:h=bO;break;case"scroll":h=tO;break;case"wheel":h=vO;break;case"copy":case"cut":case"paste":h=lO;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=cj}var v=(t&4)!==0,w=!v&&e==="scroll",g=v?p!==null?p+"Capture":null:p;v=[];for(var k=u,b;k!==null;){b=k;var j=b.stateNode;if(b.tag===5&&j!==null&&(b=j,g!==null&&(j=Nd(k,g),j!=null&&v.push(Rd(k,j,b)))),w)break;k=k.return}0<v.length&&(p=new h(p,y,null,n,d),f.push({event:p,listeners:v}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",p&&n!==qw&&(y=n.relatedTarget||n.fromElement)&&(Ma(y)||y[ao]))break e;if((h||p)&&(p=d.window===d?d:(p=d.ownerDocument)?p.defaultView||p.parentWindow:window,h?(y=n.relatedTarget||n.toElement,h=u,y=y?Ma(y):null,y!==null&&(w=ul(y),y!==w||y.tag!==5&&y.tag!==6)&&(y=null)):(h=null,y=u),h!==y)){if(v=aj,j="onMouseLeave",g="onMouseEnter",k="mouse",(e==="pointerout"||e==="pointerover")&&(v=cj,j="onPointerLeave",g="onPointerEnter",k="pointer"),w=h==null?p:Ql(h),b=y==null?p:Ql(y),p=new v(j,k+"leave",h,n,d),p.target=w,p.relatedTarget=b,j=null,Ma(d)===u&&(v=new v(g,k+"enter",y,n,d),v.target=b,v.relatedTarget=w,j=v),w=j,h&&y)t:{for(v=h,g=y,k=0,b=v;b;b=$l(b))k++;for(b=0,j=g;j;j=$l(j))b++;for(;0<k-b;)v=$l(v),k--;for(;0<b-k;)g=$l(g),b--;for(;k--;){if(v===g||g!==null&&v===g.alternate)break t;v=$l(v),g=$l(g)}v=null}else v=null;h!==null&&bj(f,p,h,v,!1),y!==null&&w!==null&&bj(f,w,y,v,!0)}}e:{if(p=u?Ql(u):window,h=p.nodeName&&p.nodeName.toLowerCase(),h==="select"||h==="input"&&p.type==="file")var N=AO;else if(fj(p))if(sA)N=TO;else{N=IO;var C=PO}else(h=p.nodeName)&&h.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(N=RO);if(N&&(N=N(e,u))){rA(f,N,n,d);break e}C&&C(e,p,u),e==="focusout"&&(C=p._wrapperState)&&C.controlled&&p.type==="number"&&Bw(p,"number",p.value)}switch(C=u?Ql(u):window,e){case"focusin":(fj(C)||C.contentEditable==="true")&&(Jl=C,Zw=u,ad=null);break;case"focusout":ad=Zw=Jl=null;break;case"mousedown":ex=!0;break;case"contextmenu":case"mouseup":case"dragend":ex=!1,yj(f,n,d);break;case"selectionchange":if(LO)break;case"keydown":case"keyup":yj(f,n,d)}var I;if(Zb)e:{switch(e){case"compositionstart":var R="onCompositionStart";break e;case"compositionend":R="onCompositionEnd";break e;case"compositionupdate":R="onCompositionUpdate";break e}R=void 0}else Gl?tA(e,n)&&(R="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(R="onCompositionStart");R&&(eA&&n.locale!=="ko"&&(Gl||R!=="onCompositionStart"?R==="onCompositionEnd"&&Gl&&(I=ZE()):(Bo=d,Jb="value"in Bo?Bo.value:Bo.textContent,Gl=!0)),C=Th(u,R),0<C.length&&(R=new lj(R,e,null,n,d),f.push({event:R,listeners:C}),I?R.data=I:(I=nA(n),I!==null&&(R.data=I)))),(I=jO?NO(e,n):CO(e,n))&&(u=Th(u,"onBeforeInput"),0<u.length&&(d=new lj("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=I))}hA(f,t)})}function Rd(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Th(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,o=s.stateNode;s.tag===5&&o!==null&&(s=o,o=Nd(e,n),o!=null&&r.unshift(Rd(e,o,s)),o=Nd(e,t),o!=null&&r.push(Rd(e,o,s))),e=e.return}return r}function $l(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function bj(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=Nd(n,o),c!=null&&a.unshift(Rd(n,c,l))):s||(c=Nd(n,o),c!=null&&a.push(Rd(n,c,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var zO=/\r\n?/g,BO=/\u0000|\uFFFD/g;function kj(e){return(typeof e=="string"?e:""+e).replace(zO,`
|
|
38
|
-
`).replace(BO,"")}function gp(e,t,n){if(t=kj(t),kj(e)!==t&&n)throw Error(Ee(425))}function Mh(){}var tx=null,nx=null;function rx(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 sx=typeof setTimeout=="function"?setTimeout:void 0,HO=typeof clearTimeout=="function"?clearTimeout:void 0,vj=typeof Promise=="function"?Promise:void 0,WO=typeof queueMicrotask=="function"?queueMicrotask:typeof vj<"u"?function(e){return vj.resolve(null).then(e).catch(VO)}:sx;function VO(e){setTimeout(function(){throw e})}function Ny(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),Ed(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);Ed(t)}function Yo(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function Sj(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 qc=Math.random().toString(36).slice(2),vi="__reactFiber$"+qc,Td="__reactProps$"+qc,ao="__reactContainer$"+qc,ix="__reactEvents$"+qc,KO="__reactListeners$"+qc,qO="__reactHandles$"+qc;function Ma(e){var t=e[vi];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ao]||n[vi]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Sj(e);e!==null;){if(n=e[vi])return n;e=Sj(e)}return t}e=n,n=e.parentNode}return null}function ff(e){return e=e[vi]||e[ao],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ql(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Ee(33))}function Fm(e){return e[Td]||null}var ox=[],Zl=-1;function da(e){return{current:e}}function bn(e){0>Zl||(e.current=ox[Zl],ox[Zl]=null,Zl--)}function fn(e,t){Zl++,ox[Zl]=e.current,e.current=t}var na={},jr=da(na),Yr=da(!1),Ua=na;function Cc(e,t){var n=e.type.contextTypes;if(!n)return na;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 Gr(e){return e=e.childContextTypes,e!=null}function $h(){bn(Yr),bn(jr)}function jj(e,t,n){if(jr.current!==na)throw Error(Ee(168));fn(jr,t),fn(Yr,n)}function gA(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,P2(e)||"Unknown",s));return Rn({},n,r)}function Lh(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||na,Ua=jr.current,fn(jr,e),fn(Yr,Yr.current),!0}function Nj(e,t,n){var r=e.stateNode;if(!r)throw Error(Ee(169));n?(e=gA(e,t,Ua),r.__reactInternalMemoizedMergedChildContext=e,bn(Yr),bn(jr),fn(jr,e)):bn(Yr),fn(Yr,n)}var Gi=null,zm=!1,Cy=!1;function yA(e){Gi===null?Gi=[e]:Gi.push(e)}function UO(e){zm=!0,yA(e)}function fa(){if(!Cy&&Gi!==null){Cy=!0;var e=0,t=sn;try{var n=Gi;for(sn=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Gi=null,zm=!1}catch(s){throw Gi!==null&&(Gi=Gi.slice(e+1)),HE(qb,fa),s}finally{sn=t,Cy=!1}}return null}var ec=[],tc=0,Oh=null,Dh=0,Ns=[],Cs=0,Ya=null,Xi=1,Qi="";function _a(e,t){ec[tc++]=Dh,ec[tc++]=Oh,Oh=e,Dh=t}function wA(e,t,n){Ns[Cs++]=Xi,Ns[Cs++]=Qi,Ns[Cs++]=Ya,Ya=e;var r=Xi;e=Qi;var s=32-ti(r)-1;r&=~(1<<s),n+=1;var o=32-ti(t)+s;if(30<o){var a=s-s%5;o=(r&(1<<a)-1).toString(32),r>>=a,s-=a,Xi=1<<32-ti(t)+s|n<<s|r,Qi=o+e}else Xi=1<<o|n<<s|r,Qi=e}function tk(e){e.return!==null&&(_a(e,1),wA(e,1,0))}function nk(e){for(;e===Oh;)Oh=ec[--tc],ec[tc]=null,Dh=ec[--tc],ec[tc]=null;for(;e===Ya;)Ya=Ns[--Cs],Ns[Cs]=null,Qi=Ns[--Cs],Ns[Cs]=null,Xi=Ns[--Cs],Ns[Cs]=null}var us=null,ls=null,kn=!1,Js=null;function xA(e,t){var n=As(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 Cj(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,us=e,ls=Yo(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,us=e,ls=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Ya!==null?{id:Xi,overflow:Qi}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=As(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,us=e,ls=null,!0):!1;default:return!1}}function ax(e){return(e.mode&1)!==0&&(e.flags&128)===0}function lx(e){if(kn){var t=ls;if(t){var n=t;if(!Cj(e,t)){if(ax(e))throw Error(Ee(418));t=Yo(n.nextSibling);var r=us;t&&Cj(e,t)?xA(r,n):(e.flags=e.flags&-4097|2,kn=!1,us=e)}}else{if(ax(e))throw Error(Ee(418));e.flags=e.flags&-4097|2,kn=!1,us=e}}}function _j(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;us=e}function yp(e){if(e!==us)return!1;if(!kn)return _j(e),kn=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!rx(e.type,e.memoizedProps)),t&&(t=ls)){if(ax(e))throw bA(),Error(Ee(418));for(;t;)xA(e,t),t=Yo(t.nextSibling)}if(_j(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){ls=Yo(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}ls=null}}else ls=us?Yo(e.stateNode.nextSibling):null;return!0}function bA(){for(var e=ls;e;)e=Yo(e.nextSibling)}function _c(){ls=us=null,kn=!1}function rk(e){Js===null?Js=[e]:Js.push(e)}var YO=mo.ReactCurrentBatchConfig;function Iu(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 wp(e,t){throw e=Object.prototype.toString.call(t),Error(Ee(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Ej(e){var t=e._init;return t(e._payload)}function kA(e){function t(g,k){if(e){var b=g.deletions;b===null?(g.deletions=[k],g.flags|=16):b.push(k)}}function n(g,k){if(!e)return null;for(;k!==null;)t(g,k),k=k.sibling;return null}function r(g,k){for(g=new Map;k!==null;)k.key!==null?g.set(k.key,k):g.set(k.index,k),k=k.sibling;return g}function s(g,k){return g=Qo(g,k),g.index=0,g.sibling=null,g}function o(g,k,b){return g.index=b,e?(b=g.alternate,b!==null?(b=b.index,b<k?(g.flags|=2,k):b):(g.flags|=2,k)):(g.flags|=1048576,k)}function a(g){return e&&g.alternate===null&&(g.flags|=2),g}function l(g,k,b,j){return k===null||k.tag!==6?(k=Ty(b,g.mode,j),k.return=g,k):(k=s(k,b),k.return=g,k)}function c(g,k,b,j){var N=b.type;return N===Yl?d(g,k,b.props.children,j,b.key):k!==null&&(k.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Mo&&Ej(N)===k.type)?(j=s(k,b.props),j.ref=Iu(g,k,b),j.return=g,j):(j=dh(b.type,b.key,b.props,null,g.mode,j),j.ref=Iu(g,k,b),j.return=g,j)}function u(g,k,b,j){return k===null||k.tag!==4||k.stateNode.containerInfo!==b.containerInfo||k.stateNode.implementation!==b.implementation?(k=My(b,g.mode,j),k.return=g,k):(k=s(k,b.children||[]),k.return=g,k)}function d(g,k,b,j,N){return k===null||k.tag!==7?(k=Ba(b,g.mode,j,N),k.return=g,k):(k=s(k,b),k.return=g,k)}function f(g,k,b){if(typeof k=="string"&&k!==""||typeof k=="number")return k=Ty(""+k,g.mode,b),k.return=g,k;if(typeof k=="object"&&k!==null){switch(k.$$typeof){case ap:return b=dh(k.type,k.key,k.props,null,g.mode,b),b.ref=Iu(g,null,k),b.return=g,b;case Ul:return k=My(k,g.mode,b),k.return=g,k;case Mo:var j=k._init;return f(g,j(k._payload),b)}if(qu(k)||Cu(k))return k=Ba(k,g.mode,b,null),k.return=g,k;wp(g,k)}return null}function p(g,k,b,j){var N=k!==null?k.key:null;if(typeof b=="string"&&b!==""||typeof b=="number")return N!==null?null:l(g,k,""+b,j);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case ap:return b.key===N?c(g,k,b,j):null;case Ul:return b.key===N?u(g,k,b,j):null;case Mo:return N=b._init,p(g,k,N(b._payload),j)}if(qu(b)||Cu(b))return N!==null?null:d(g,k,b,j,null);wp(g,b)}return null}function h(g,k,b,j,N){if(typeof j=="string"&&j!==""||typeof j=="number")return g=g.get(b)||null,l(k,g,""+j,N);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case ap:return g=g.get(j.key===null?b:j.key)||null,c(k,g,j,N);case Ul:return g=g.get(j.key===null?b:j.key)||null,u(k,g,j,N);case Mo:var C=j._init;return h(g,k,b,C(j._payload),N)}if(qu(j)||Cu(j))return g=g.get(b)||null,d(k,g,j,N,null);wp(k,j)}return null}function y(g,k,b,j){for(var N=null,C=null,I=k,R=k=0,H=null;I!==null&&R<b.length;R++){I.index>R?(H=I,I=null):H=I.sibling;var A=p(g,I,b[R],j);if(A===null){I===null&&(I=H);break}e&&I&&A.alternate===null&&t(g,I),k=o(A,k,R),C===null?N=A:C.sibling=A,C=A,I=H}if(R===b.length)return n(g,I),kn&&_a(g,R),N;if(I===null){for(;R<b.length;R++)I=f(g,b[R],j),I!==null&&(k=o(I,k,R),C===null?N=I:C.sibling=I,C=I);return kn&&_a(g,R),N}for(I=r(g,I);R<b.length;R++)H=h(I,g,R,b[R],j),H!==null&&(e&&H.alternate!==null&&I.delete(H.key===null?R:H.key),k=o(H,k,R),C===null?N=H:C.sibling=H,C=H);return e&&I.forEach(function(L){return t(g,L)}),kn&&_a(g,R),N}function v(g,k,b,j){var N=Cu(b);if(typeof N!="function")throw Error(Ee(150));if(b=N.call(b),b==null)throw Error(Ee(151));for(var C=N=null,I=k,R=k=0,H=null,A=b.next();I!==null&&!A.done;R++,A=b.next()){I.index>R?(H=I,I=null):H=I.sibling;var L=p(g,I,A.value,j);if(L===null){I===null&&(I=H);break}e&&I&&L.alternate===null&&t(g,I),k=o(L,k,R),C===null?N=L:C.sibling=L,C=L,I=H}if(A.done)return n(g,I),kn&&_a(g,R),N;if(I===null){for(;!A.done;R++,A=b.next())A=f(g,A.value,j),A!==null&&(k=o(A,k,R),C===null?N=A:C.sibling=A,C=A);return kn&&_a(g,R),N}for(I=r(g,I);!A.done;R++,A=b.next())A=h(I,g,R,A.value,j),A!==null&&(e&&A.alternate!==null&&I.delete(A.key===null?R:A.key),k=o(A,k,R),C===null?N=A:C.sibling=A,C=A);return e&&I.forEach(function(D){return t(g,D)}),kn&&_a(g,R),N}function w(g,k,b,j){if(typeof b=="object"&&b!==null&&b.type===Yl&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case ap:e:{for(var N=b.key,C=k;C!==null;){if(C.key===N){if(N=b.type,N===Yl){if(C.tag===7){n(g,C.sibling),k=s(C,b.props.children),k.return=g,g=k;break e}}else if(C.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===Mo&&Ej(N)===C.type){n(g,C.sibling),k=s(C,b.props),k.ref=Iu(g,C,b),k.return=g,g=k;break e}n(g,C);break}else t(g,C);C=C.sibling}b.type===Yl?(k=Ba(b.props.children,g.mode,j,b.key),k.return=g,g=k):(j=dh(b.type,b.key,b.props,null,g.mode,j),j.ref=Iu(g,k,b),j.return=g,g=j)}return a(g);case Ul:e:{for(C=b.key;k!==null;){if(k.key===C)if(k.tag===4&&k.stateNode.containerInfo===b.containerInfo&&k.stateNode.implementation===b.implementation){n(g,k.sibling),k=s(k,b.children||[]),k.return=g,g=k;break e}else{n(g,k);break}else t(g,k);k=k.sibling}k=My(b,g.mode,j),k.return=g,g=k}return a(g);case Mo:return C=b._init,w(g,k,C(b._payload),j)}if(qu(b))return y(g,k,b,j);if(Cu(b))return v(g,k,b,j);wp(g,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,k!==null&&k.tag===6?(n(g,k.sibling),k=s(k,b),k.return=g,g=k):(n(g,k),k=Ty(b,g.mode,j),k.return=g,g=k),a(g)):n(g,k)}return w}var Ec=kA(!0),vA=kA(!1),Fh=da(null),zh=null,nc=null,sk=null;function ik(){sk=nc=zh=null}function ok(e){var t=Fh.current;bn(Fh),e._currentValue=t}function cx(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 mc(e,t){zh=e,sk=nc=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Kr=!0),e.firstContext=null)}function Is(e){var t=e._currentValue;if(sk!==e)if(e={context:e,memoizedValue:t,next:null},nc===null){if(zh===null)throw Error(Ee(308));nc=e,zh.dependencies={lanes:0,firstContext:e}}else nc=nc.next=e;return t}var $a=null;function ak(e){$a===null?$a=[e]:$a.push(e)}function SA(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,ak(t)):(n.next=s.next,s.next=n),t.interleaved=n,lo(e,r)}function lo(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 lk(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function jA(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 no(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Go(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,qt&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,lo(e,n)}return s=r.interleaved,s===null?(t.next=t,ak(r)):(t.next=s.next,s.next=t),r.interleaved=t,lo(e,n)}function ih(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,Ub(e,n)}}function Aj(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 Bh(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 f=s.baseState;a=0,d=u=c=null,l=o;do{var p=l.lane,h=l.eventTime;if((r&p)===p){d!==null&&(d=d.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var y=e,v=l;switch(p=t,h=n,v.tag){case 1:if(y=v.payload,typeof y=="function"){f=y.call(h,f,p);break e}f=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=v.payload,p=typeof y=="function"?y.call(h,f,p):y,p==null)break e;f=Rn({},f,p);break e;case 2:$o=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,p=s.effects,p===null?s.effects=[l]:p.push(l))}else h={eventTime:h,lane:p,tag:l.tag,payload:l.payload,callback:l.callback,next:null},d===null?(u=d=h,c=f):d=d.next=h,a|=p;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;p=l,l=p.next,p.next=null,s.lastBaseUpdate=p,s.shared.pending=null}}while(!0);if(d===null&&(c=f),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);Ja|=a,e.lanes=a,e.memoizedState=f}}function Pj(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 pf={},Ai=da(pf),Md=da(pf),$d=da(pf);function La(e){if(e===pf)throw Error(Ee(174));return e}function ck(e,t){switch(fn($d,t),fn(Md,e),fn(Ai,pf),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ww(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ww(t,e)}bn(Ai),fn(Ai,t)}function Ac(){bn(Ai),bn(Md),bn($d)}function NA(e){La($d.current);var t=La(Ai.current),n=Ww(t,e.type);t!==n&&(fn(Md,e),fn(Ai,n))}function uk(e){Md.current===e&&(bn(Ai),bn(Md))}var An=da(0);function Hh(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var _y=[];function dk(){for(var e=0;e<_y.length;e++)_y[e]._workInProgressVersionPrimary=null;_y.length=0}var oh=mo.ReactCurrentDispatcher,Ey=mo.ReactCurrentBatchConfig,Ga=0,In=null,rr=null,dr=null,Wh=!1,ld=!1,Ld=0,GO=0;function xr(){throw Error(Ee(321))}function fk(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!si(e[n],t[n]))return!1;return!0}function pk(e,t,n,r,s,o){if(Ga=o,In=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,oh.current=e===null||e.memoizedState===null?ZO:eD,e=n(r,s),ld){o=0;do{if(ld=!1,Ld=0,25<=o)throw Error(Ee(301));o+=1,dr=rr=null,t.updateQueue=null,oh.current=tD,e=n(r,s)}while(ld)}if(oh.current=Vh,t=rr!==null&&rr.next!==null,Ga=0,dr=rr=In=null,Wh=!1,t)throw Error(Ee(300));return e}function hk(){var e=Ld!==0;return Ld=0,e}function wi(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dr===null?In.memoizedState=dr=e:dr=dr.next=e,dr}function Rs(){if(rr===null){var e=In.alternate;e=e!==null?e.memoizedState:null}else e=rr.next;var t=dr===null?In.memoizedState:dr.next;if(t!==null)dr=t,rr=e;else{if(e===null)throw Error(Ee(310));rr=e,e={memoizedState:rr.memoizedState,baseState:rr.baseState,baseQueue:rr.baseQueue,queue:rr.queue,next:null},dr===null?In.memoizedState=dr=e:dr=dr.next=e}return dr}function Od(e,t){return typeof t=="function"?t(e):t}function Ay(e){var t=Rs(),n=t.queue;if(n===null)throw Error(Ee(311));n.lastRenderedReducer=e;var r=rr,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((Ga&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 f={lane:d,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=f,a=r):c=c.next=f,In.lanes|=d,Ja|=d}u=u.next}while(u!==null&&u!==o);c===null?a=r:c.next=l,si(r,t.memoizedState)||(Kr=!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,In.lanes|=o,Ja|=o,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Py(e){var t=Rs(),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);si(o,t.memoizedState)||(Kr=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function CA(){}function _A(e,t){var n=In,r=Rs(),s=t(),o=!si(r.memoizedState,s);if(o&&(r.memoizedState=s,Kr=!0),r=r.queue,mk(PA.bind(null,n,r,e),[e]),r.getSnapshot!==t||o||dr!==null&&dr.memoizedState.tag&1){if(n.flags|=2048,Dd(9,AA.bind(null,n,r,s,t),void 0,null),hr===null)throw Error(Ee(349));Ga&30||EA(n,t,s)}return s}function EA(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=In.updateQueue,t===null?(t={lastEffect:null,stores:null},In.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function AA(e,t,n,r){t.value=n,t.getSnapshot=r,IA(t)&&RA(e)}function PA(e,t,n){return n(function(){IA(t)&&RA(e)})}function IA(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!si(e,n)}catch{return!0}}function RA(e){var t=lo(e,1);t!==null&&ni(t,e,1,-1)}function Ij(e){var t=wi();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Od,lastRenderedState:e},t.queue=e,e=e.dispatch=QO.bind(null,In,e),[t.memoizedState,e]}function Dd(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=In.updateQueue,t===null?(t={lastEffect:null,stores:null},In.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 TA(){return Rs().memoizedState}function ah(e,t,n,r){var s=wi();In.flags|=e,s.memoizedState=Dd(1|t,n,void 0,r===void 0?null:r)}function Bm(e,t,n,r){var s=Rs();r=r===void 0?null:r;var o=void 0;if(rr!==null){var a=rr.memoizedState;if(o=a.destroy,r!==null&&fk(r,a.deps)){s.memoizedState=Dd(t,n,o,r);return}}In.flags|=e,s.memoizedState=Dd(1|t,n,o,r)}function Rj(e,t){return ah(8390656,8,e,t)}function mk(e,t){return Bm(2048,8,e,t)}function MA(e,t){return Bm(4,2,e,t)}function $A(e,t){return Bm(4,4,e,t)}function LA(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 OA(e,t,n){return n=n!=null?n.concat([e]):null,Bm(4,4,LA.bind(null,t,e),n)}function gk(){}function DA(e,t){var n=Rs();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&fk(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function FA(e,t){var n=Rs();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&fk(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function zA(e,t,n){return Ga&21?(si(n,t)||(n=KE(),In.lanes|=n,Ja|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Kr=!0),e.memoizedState=n)}function JO(e,t){var n=sn;sn=n!==0&&4>n?n:4,e(!0);var r=Ey.transition;Ey.transition={};try{e(!1),t()}finally{sn=n,Ey.transition=r}}function BA(){return Rs().memoizedState}function XO(e,t,n){var r=Xo(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},HA(e))WA(t,n);else if(n=SA(e,t,n,r),n!==null){var s=Rr();ni(n,e,r,s),VA(n,t,r)}}function QO(e,t,n){var r=Xo(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(HA(e))WA(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,si(l,a)){var c=t.interleaved;c===null?(s.next=s,ak(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=SA(e,t,s,r),n!==null&&(s=Rr(),ni(n,e,r,s),VA(n,t,r))}}function HA(e){var t=e.alternate;return e===In||t!==null&&t===In}function WA(e,t){ld=Wh=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function VA(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Ub(e,n)}}var Vh={readContext:Is,useCallback:xr,useContext:xr,useEffect:xr,useImperativeHandle:xr,useInsertionEffect:xr,useLayoutEffect:xr,useMemo:xr,useReducer:xr,useRef:xr,useState:xr,useDebugValue:xr,useDeferredValue:xr,useTransition:xr,useMutableSource:xr,useSyncExternalStore:xr,useId:xr,unstable_isNewReconciler:!1},ZO={readContext:Is,useCallback:function(e,t){return wi().memoizedState=[e,t===void 0?null:t],e},useContext:Is,useEffect:Rj,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,ah(4194308,4,LA.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ah(4194308,4,e,t)},useInsertionEffect:function(e,t){return ah(4,2,e,t)},useMemo:function(e,t){var n=wi();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=wi();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=XO.bind(null,In,e),[r.memoizedState,e]},useRef:function(e){var t=wi();return e={current:e},t.memoizedState=e},useState:Ij,useDebugValue:gk,useDeferredValue:function(e){return wi().memoizedState=e},useTransition:function(){var e=Ij(!1),t=e[0];return e=JO.bind(null,e[1]),wi().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=In,s=wi();if(kn){if(n===void 0)throw Error(Ee(407));n=n()}else{if(n=t(),hr===null)throw Error(Ee(349));Ga&30||EA(r,t,n)}s.memoizedState=n;var o={value:n,getSnapshot:t};return s.queue=o,Rj(PA.bind(null,r,o,e),[e]),r.flags|=2048,Dd(9,AA.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=wi(),t=hr.identifierPrefix;if(kn){var n=Qi,r=Xi;n=(r&~(1<<32-ti(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ld++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=GO++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},eD={readContext:Is,useCallback:DA,useContext:Is,useEffect:mk,useImperativeHandle:OA,useInsertionEffect:MA,useLayoutEffect:$A,useMemo:FA,useReducer:Ay,useRef:TA,useState:function(){return Ay(Od)},useDebugValue:gk,useDeferredValue:function(e){var t=Rs();return zA(t,rr.memoizedState,e)},useTransition:function(){var e=Ay(Od)[0],t=Rs().memoizedState;return[e,t]},useMutableSource:CA,useSyncExternalStore:_A,useId:BA,unstable_isNewReconciler:!1},tD={readContext:Is,useCallback:DA,useContext:Is,useEffect:mk,useImperativeHandle:OA,useInsertionEffect:MA,useLayoutEffect:$A,useMemo:FA,useReducer:Py,useRef:TA,useState:function(){return Py(Od)},useDebugValue:gk,useDeferredValue:function(e){var t=Rs();return rr===null?t.memoizedState=e:zA(t,rr.memoizedState,e)},useTransition:function(){var e=Py(Od)[0],t=Rs().memoizedState;return[e,t]},useMutableSource:CA,useSyncExternalStore:_A,useId:BA,unstable_isNewReconciler:!1};function Us(e,t){if(e&&e.defaultProps){t=Rn({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function ux(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Rn({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Hm={isMounted:function(e){return(e=e._reactInternals)?ul(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Rr(),s=Xo(e),o=no(r,s);o.payload=t,n!=null&&(o.callback=n),t=Go(e,o,s),t!==null&&(ni(t,e,s,r),ih(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Rr(),s=Xo(e),o=no(r,s);o.tag=1,o.payload=t,n!=null&&(o.callback=n),t=Go(e,o,s),t!==null&&(ni(t,e,s,r),ih(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Rr(),r=Xo(e),s=no(n,r);s.tag=2,t!=null&&(s.callback=t),t=Go(e,s,r),t!==null&&(ni(t,e,r,n),ih(t,e,r))}};function Tj(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?!Pd(n,r)||!Pd(s,o):!0}function KA(e,t,n){var r=!1,s=na,o=t.contextType;return typeof o=="object"&&o!==null?o=Is(o):(s=Gr(t)?Ua:jr.current,r=t.contextTypes,o=(r=r!=null)?Cc(e,s):na),t=new t(n,o),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Hm,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=o),t}function Mj(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&&Hm.enqueueReplaceState(t,t.state,null)}function dx(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},lk(e);var o=t.contextType;typeof o=="object"&&o!==null?s.context=Is(o):(o=Gr(t)?Ua:jr.current,s.context=Cc(e,o)),s.state=e.memoizedState,o=t.getDerivedStateFromProps,typeof o=="function"&&(ux(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&&Hm.enqueueReplaceState(s,s.state,null),Bh(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Pc(e,t){try{var n="",r=t;do n+=A2(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 Iy(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function fx(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var nD=typeof WeakMap=="function"?WeakMap:Map;function qA(e,t,n){n=no(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){qh||(qh=!0,vx=r),fx(e,t)},n}function UA(e,t,n){n=no(-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(){fx(e,t)}}var o=e.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(n.callback=function(){fx(e,t),typeof r!="function"&&(Jo===null?Jo=new Set([this]):Jo.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function $j(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new nD;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=gD.bind(null,e,t,n),t.then(e,e))}function Lj(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 Oj(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=no(-1,1),t.tag=2,Go(n,t,1))),n.lanes|=1),e)}var rD=mo.ReactCurrentOwner,Kr=!1;function Ir(e,t,n,r){t.child=e===null?vA(t,null,n,r):Ec(t,e.child,n,r)}function Dj(e,t,n,r,s){n=n.render;var o=t.ref;return mc(t,s),r=pk(e,t,n,r,o,s),n=hk(),e!==null&&!Kr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,co(e,t,s)):(kn&&n&&tk(t),t.flags|=1,Ir(e,t,r,s),t.child)}function Fj(e,t,n,r,s){if(e===null){var o=n.type;return typeof o=="function"&&!jk(o)&&o.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=o,YA(e,t,o,r,s)):(e=dh(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:Pd,n(a,r)&&e.ref===t.ref)return co(e,t,s)}return t.flags|=1,e=Qo(o,r),e.ref=t.ref,e.return=t,t.child=e}function YA(e,t,n,r,s){if(e!==null){var o=e.memoizedProps;if(Pd(o,r)&&e.ref===t.ref)if(Kr=!1,t.pendingProps=r=o,(e.lanes&s)!==0)e.flags&131072&&(Kr=!0);else return t.lanes=e.lanes,co(e,t,s)}return px(e,t,n,r,s)}function GA(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},fn(sc,is),is|=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,fn(sc,is),is|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=o!==null?o.baseLanes:n,fn(sc,is),is|=r}else o!==null?(r=o.baseLanes|n,t.memoizedState=null):r=n,fn(sc,is),is|=r;return Ir(e,t,s,n),t.child}function JA(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function px(e,t,n,r,s){var o=Gr(n)?Ua:jr.current;return o=Cc(t,o),mc(t,s),n=pk(e,t,n,r,o,s),r=hk(),e!==null&&!Kr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,co(e,t,s)):(kn&&r&&tk(t),t.flags|=1,Ir(e,t,n,s),t.child)}function zj(e,t,n,r,s){if(Gr(n)){var o=!0;Lh(t)}else o=!1;if(mc(t,s),t.stateNode===null)lh(e,t),KA(t,n,r),dx(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=Is(u):(u=Gr(n)?Ua:jr.current,u=Cc(t,u));var d=n.getDerivedStateFromProps,f=typeof d=="function"||typeof a.getSnapshotBeforeUpdate=="function";f||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||c!==u)&&Mj(t,a,r,u),$o=!1;var p=t.memoizedState;a.state=p,Bh(t,r,a,s),c=t.memoizedState,l!==r||p!==c||Yr.current||$o?(typeof d=="function"&&(ux(t,n,d,r),c=t.memoizedState),(l=$o||Tj(t,n,l,r,p,c,u))?(f||typeof a.UNSAFE_componentWillMount!="function"&&typeof a.componentWillMount!="function"||(typeof a.componentWillMount=="function"&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount=="function"&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount=="function"&&(t.flags|=4194308)):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),a.props=r,a.state=c,a.context=u,r=l):(typeof a.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,jA(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Us(t.type,l),a.props=u,f=t.pendingProps,p=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=Is(c):(c=Gr(n)?Ua:jr.current,c=Cc(t,c));var h=n.getDerivedStateFromProps;(d=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==f||p!==c)&&Mj(t,a,r,c),$o=!1,p=t.memoizedState,a.state=p,Bh(t,r,a,s);var y=t.memoizedState;l!==f||p!==y||Yr.current||$o?(typeof h=="function"&&(ux(t,n,h,r),y=t.memoizedState),(u=$o||Tj(t,n,u,r,p,y,c)||!1)?(d||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,y,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,y,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=y),a.props=r,a.state=y,a.context=c,r=u):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return hx(e,t,n,r,o,s)}function hx(e,t,n,r,s,o){JA(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return s&&Nj(t,n,!1),co(e,t,o);r=t.stateNode,rD.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=Ec(t,e.child,null,o),t.child=Ec(t,null,l,o)):Ir(e,t,l,o),t.memoizedState=r.state,s&&Nj(t,n,!0),t.child}function XA(e){var t=e.stateNode;t.pendingContext?jj(e,t.pendingContext,t.pendingContext!==t.context):t.context&&jj(e,t.context,!1),ck(e,t.containerInfo)}function Bj(e,t,n,r,s){return _c(),rk(s),t.flags|=256,Ir(e,t,n,r),t.child}var mx={dehydrated:null,treeContext:null,retryLane:0};function gx(e){return{baseLanes:e,cachePool:null,transitions:null}}function QA(e,t,n){var r=t.pendingProps,s=An.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),fn(An,s&1),e===null)return lx(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=Km(a,r,0,null),e=Ba(e,r,n,null),o.return=t,e.return=t,o.sibling=e,t.child=o,t.child.memoizedState=gx(n),t.memoizedState=mx,e):yk(t,a));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return sD(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=Qo(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?o=Qo(l,o):(o=Ba(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?gx(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},o.memoizedState=a,o.childLanes=e.childLanes&~n,t.memoizedState=mx,r}return o=e.child,e=o.sibling,r=Qo(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 yk(e,t){return t=Km({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function xp(e,t,n,r){return r!==null&&rk(r),Ec(t,e.child,null,n),e=yk(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function sD(e,t,n,r,s,o,a){if(n)return t.flags&256?(t.flags&=-257,r=Iy(Error(Ee(422))),xp(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(o=r.fallback,s=t.mode,r=Km({mode:"visible",children:r.children},s,0,null),o=Ba(o,s,a,null),o.flags|=2,r.return=t,o.return=t,r.sibling=o,t.child=r,t.mode&1&&Ec(t,e.child,null,a),t.child.memoizedState=gx(a),t.memoizedState=mx,o);if(!(t.mode&1))return xp(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=Iy(o,r,void 0),xp(e,t,a,r)}if(l=(a&e.childLanes)!==0,Kr||l){if(r=hr,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,lo(e,s),ni(r,e,s,-1))}return Sk(),r=Iy(Error(Ee(421))),xp(e,t,a,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=yD.bind(null,e),s._reactRetry=t,null):(e=o.treeContext,ls=Yo(s.nextSibling),us=t,kn=!0,Js=null,e!==null&&(Ns[Cs++]=Xi,Ns[Cs++]=Qi,Ns[Cs++]=Ya,Xi=e.id,Qi=e.overflow,Ya=t),t=yk(t,r.children),t.flags|=4096,t)}function Hj(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),cx(e.return,t,n)}function Ry(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 ZA(e,t,n){var r=t.pendingProps,s=r.revealOrder,o=r.tail;if(Ir(e,t,r.children,n),r=An.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&&Hj(e,n,t);else if(e.tag===19)Hj(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(fn(An,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&&Hh(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Ry(t,!1,s,n,o);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&Hh(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Ry(t,!0,n,null,o);break;case"together":Ry(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function lh(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function co(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Ja|=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=Qo(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Qo(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function iD(e,t,n){switch(t.tag){case 3:XA(t),_c();break;case 5:NA(t);break;case 1:Gr(t.type)&&Lh(t);break;case 4:ck(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;fn(Fh,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(fn(An,An.current&1),t.flags|=128,null):n&t.child.childLanes?QA(e,t,n):(fn(An,An.current&1),e=co(e,t,n),e!==null?e.sibling:null);fn(An,An.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return ZA(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),fn(An,An.current),r)break;return null;case 22:case 23:return t.lanes=0,GA(e,t,n)}return co(e,t,n)}var eP,yx,tP,nP;eP=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}};yx=function(){};tP=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,La(Ai.current);var o=null;switch(n){case"input":s=Fw(e,s),r=Fw(e,r),o=[];break;case"select":s=Rn({},s,{value:void 0}),r=Rn({},r,{value:void 0}),o=[];break;case"textarea":s=Hw(e,s),r=Hw(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"&&wn("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)}};nP=function(e,t,n,r){n!==r&&(t.flags|=4)};function Ru(e,t){if(!kn)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 br(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 oD(e,t,n){var r=t.pendingProps;switch(nk(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return br(t),null;case 1:return Gr(t.type)&&$h(),br(t),null;case 3:return r=t.stateNode,Ac(),bn(Yr),bn(jr),dk(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(yp(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Js!==null&&(Nx(Js),Js=null))),yx(e,t),br(t),null;case 5:uk(t);var s=La($d.current);if(n=t.type,e!==null&&t.stateNode!=null)tP(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 br(t),null}if(e=La(Ai.current),yp(t)){r=t.stateNode,n=t.type;var o=t.memoizedProps;switch(r[vi]=t,r[Td]=o,e=(t.mode&1)!==0,n){case"dialog":wn("cancel",r),wn("close",r);break;case"iframe":case"object":case"embed":wn("load",r);break;case"video":case"audio":for(s=0;s<Yu.length;s++)wn(Yu[s],r);break;case"source":wn("error",r);break;case"img":case"image":case"link":wn("error",r),wn("load",r);break;case"details":wn("toggle",r);break;case"input":X0(r,o),wn("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!o.multiple},wn("invalid",r);break;case"textarea":Z0(r,o),wn("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&&gp(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(o.suppressHydrationWarning!==!0&&gp(r.textContent,l,e),s=["children",""+l]):Sd.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&wn("scroll",r)}switch(n){case"input":lp(r),Q0(r,o,!0);break;case"textarea":lp(r),ej(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=PE(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[vi]=t,e[Td]=r,eP(e,t,!1,!1),t.stateNode=e;e:{switch(a=Kw(n,r),n){case"dialog":wn("cancel",e),wn("close",e),s=r;break;case"iframe":case"object":case"embed":wn("load",e),s=r;break;case"video":case"audio":for(s=0;s<Yu.length;s++)wn(Yu[s],e);s=r;break;case"source":wn("error",e),s=r;break;case"img":case"image":case"link":wn("error",e),wn("load",e),s=r;break;case"details":wn("toggle",e),s=r;break;case"input":X0(e,r),s=Fw(e,r),wn("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=Rn({},r,{value:void 0}),wn("invalid",e);break;case"textarea":Z0(e,r),s=Hw(e,r),wn("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"?TE(e,c):o==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&IE(e,c)):o==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&jd(e,c):typeof c=="number"&&jd(e,""+c):o!=="suppressContentEditableWarning"&&o!=="suppressHydrationWarning"&&o!=="autoFocus"&&(Sd.hasOwnProperty(o)?c!=null&&o==="onScroll"&&wn("scroll",e):c!=null&&Bb(e,o,c,a))}switch(n){case"input":lp(e),Q0(e,r,!1);break;case"textarea":lp(e),ej(e);break;case"option":r.value!=null&&e.setAttribute("value",""+ta(r.value));break;case"select":e.multiple=!!r.multiple,o=r.value,o!=null?dc(e,!!r.multiple,o,!1):r.defaultValue!=null&&dc(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 br(t),null;case 6:if(e&&t.stateNode!=null)nP(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Ee(166));if(n=La($d.current),La(Ai.current),yp(t)){if(r=t.stateNode,n=t.memoizedProps,r[vi]=t,(o=r.nodeValue!==n)&&(e=us,e!==null))switch(e.tag){case 3:gp(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&gp(r.nodeValue,n,(e.mode&1)!==0)}o&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[vi]=t,t.stateNode=r}return br(t),null;case 13:if(bn(An),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(kn&&ls!==null&&t.mode&1&&!(t.flags&128))bA(),_c(),t.flags|=98560,o=!1;else if(o=yp(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[vi]=t}else _c(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;br(t),o=!1}else Js!==null&&(Nx(Js),Js=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||An.current&1?sr===0&&(sr=3):Sk())),t.updateQueue!==null&&(t.flags|=4),br(t),null);case 4:return Ac(),yx(e,t),e===null&&Id(t.stateNode.containerInfo),br(t),null;case 10:return ok(t.type._context),br(t),null;case 17:return Gr(t.type)&&$h(),br(t),null;case 19:if(bn(An),o=t.memoizedState,o===null)return br(t),null;if(r=(t.flags&128)!==0,a=o.rendering,a===null)if(r)Ru(o,!1);else{if(sr!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=Hh(e),a!==null){for(t.flags|=128,Ru(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 fn(An,An.current&1|2),t.child}e=e.sibling}o.tail!==null&&Wn()>Ic&&(t.flags|=128,r=!0,Ru(o,!1),t.lanes=4194304)}else{if(!r)if(e=Hh(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ru(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!kn)return br(t),null}else 2*Wn()-o.renderingStartTime>Ic&&n!==1073741824&&(t.flags|=128,r=!0,Ru(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=Wn(),t.sibling=null,n=An.current,fn(An,r?n&1|2:n&1),t):(br(t),null);case 22:case 23:return vk(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?is&1073741824&&(br(t),t.subtreeFlags&6&&(t.flags|=8192)):br(t),null;case 24:return null;case 25:return null}throw Error(Ee(156,t.tag))}function aD(e,t){switch(nk(t),t.tag){case 1:return Gr(t.type)&&$h(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ac(),bn(Yr),bn(jr),dk(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return uk(t),null;case 13:if(bn(An),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ee(340));_c()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return bn(An),null;case 4:return Ac(),null;case 10:return ok(t.type._context),null;case 22:case 23:return vk(),null;case 24:return null;default:return null}}var bp=!1,kr=!1,lD=typeof WeakSet=="function"?WeakSet:Set,Qe=null;function rc(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ln(e,t,r)}else n.current=null}function wx(e,t,n){try{n()}catch(r){Ln(e,t,r)}}var Wj=!1;function cD(e,t){if(tx=Ih,e=aA(),ek(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,f=e,p=null;t:for(;;){for(var h;f!==n||s!==0&&f.nodeType!==3||(l=a+s),f!==o||r!==0&&f.nodeType!==3||(c=a+r),f.nodeType===3&&(a+=f.nodeValue.length),(h=f.firstChild)!==null;)p=f,f=h;for(;;){if(f===e)break t;if(p===n&&++u===s&&(l=a),p===o&&++d===r&&(c=a),(h=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(nx={focusedElem:e,selectionRange:n},Ih=!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 y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var v=y.memoizedProps,w=y.memoizedState,g=t.stateNode,k=g.getSnapshotBeforeUpdate(t.elementType===t.type?v:Us(t.type,v),w);g.__reactInternalSnapshotBeforeUpdate=k}break;case 3:var b=t.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ee(163))}}catch(j){Ln(t,t.return,j)}if(e=t.sibling,e!==null){e.return=t.return,Qe=e;break}Qe=t.return}return y=Wj,Wj=!1,y}function cd(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&&wx(t,n,o)}s=s.next}while(s!==r)}}function Wm(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 xx(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 rP(e){var t=e.alternate;t!==null&&(e.alternate=null,rP(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[vi],delete t[Td],delete t[ix],delete t[KO],delete t[qO])),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 sP(e){return e.tag===5||e.tag===3||e.tag===4}function Vj(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||sP(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 bx(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(bx(e,t,n),e=e.sibling;e!==null;)bx(e,t,n),e=e.sibling}function kx(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(kx(e,t,n),e=e.sibling;e!==null;)kx(e,t,n),e=e.sibling}var mr=null,Ys=!1;function Eo(e,t,n){for(n=n.child;n!==null;)iP(e,t,n),n=n.sibling}function iP(e,t,n){if(Ei&&typeof Ei.onCommitFiberUnmount=="function")try{Ei.onCommitFiberUnmount($m,n)}catch{}switch(n.tag){case 5:kr||rc(n,t);case 6:var r=mr,s=Ys;mr=null,Eo(e,t,n),mr=r,Ys=s,mr!==null&&(Ys?(e=mr,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):mr.removeChild(n.stateNode));break;case 18:mr!==null&&(Ys?(e=mr,n=n.stateNode,e.nodeType===8?Ny(e.parentNode,n):e.nodeType===1&&Ny(e,n),Ed(e)):Ny(mr,n.stateNode));break;case 4:r=mr,s=Ys,mr=n.stateNode.containerInfo,Ys=!0,Eo(e,t,n),mr=r,Ys=s;break;case 0:case 11:case 14:case 15:if(!kr&&(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)&&wx(n,t,a),s=s.next}while(s!==r)}Eo(e,t,n);break;case 1:if(!kr&&(rc(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Ln(n,t,l)}Eo(e,t,n);break;case 21:Eo(e,t,n);break;case 22:n.mode&1?(kr=(r=kr)||n.memoizedState!==null,Eo(e,t,n),kr=r):Eo(e,t,n);break;default:Eo(e,t,n)}}function Kj(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new lD),t.forEach(function(r){var s=wD.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Vs(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:mr=l.stateNode,Ys=!1;break e;case 3:mr=l.stateNode.containerInfo,Ys=!0;break e;case 4:mr=l.stateNode.containerInfo,Ys=!0;break e}l=l.return}if(mr===null)throw Error(Ee(160));iP(o,a,s),mr=null,Ys=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){Ln(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)oP(t,e),t=t.sibling}function oP(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Vs(t,e),mi(e),r&4){try{cd(3,e,e.return),Wm(3,e)}catch(v){Ln(e,e.return,v)}try{cd(5,e,e.return)}catch(v){Ln(e,e.return,v)}}break;case 1:Vs(t,e),mi(e),r&512&&n!==null&&rc(n,n.return);break;case 5:if(Vs(t,e),mi(e),r&512&&n!==null&&rc(n,n.return),e.flags&32){var s=e.stateNode;try{jd(s,"")}catch(v){Ln(e,e.return,v)}}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&&EE(s,o),Kw(l,a);var u=Kw(l,o);for(a=0;a<c.length;a+=2){var d=c[a],f=c[a+1];d==="style"?TE(s,f):d==="dangerouslySetInnerHTML"?IE(s,f):d==="children"?jd(s,f):Bb(s,d,f,u)}switch(l){case"input":zw(s,o);break;case"textarea":AE(s,o);break;case"select":var p=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!o.multiple;var h=o.value;h!=null?dc(s,!!o.multiple,h,!1):p!==!!o.multiple&&(o.defaultValue!=null?dc(s,!!o.multiple,o.defaultValue,!0):dc(s,!!o.multiple,o.multiple?[]:"",!1))}s[Td]=o}catch(v){Ln(e,e.return,v)}}break;case 6:if(Vs(t,e),mi(e),r&4){if(e.stateNode===null)throw Error(Ee(162));s=e.stateNode,o=e.memoizedProps;try{s.nodeValue=o}catch(v){Ln(e,e.return,v)}}break;case 3:if(Vs(t,e),mi(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Ed(t.containerInfo)}catch(v){Ln(e,e.return,v)}break;case 4:Vs(t,e),mi(e);break;case 13:Vs(t,e),mi(e),s=e.child,s.flags&8192&&(o=s.memoizedState!==null,s.stateNode.isHidden=o,!o||s.alternate!==null&&s.alternate.memoizedState!==null||(bk=Wn())),r&4&&Kj(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(kr=(u=kr)||d,Vs(t,e),kr=u):Vs(t,e),mi(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(f=Qe=d;Qe!==null;){switch(p=Qe,h=p.child,p.tag){case 0:case 11:case 14:case 15:cd(4,p,p.return);break;case 1:rc(p,p.return);var y=p.stateNode;if(typeof y.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,y.props=t.memoizedProps,y.state=t.memoizedState,y.componentWillUnmount()}catch(v){Ln(r,n,v)}}break;case 5:rc(p,p.return);break;case 22:if(p.memoizedState!==null){Uj(f);continue}}h!==null?(h.return=p,Qe=h):Uj(f)}d=d.sibling}e:for(d=null,f=e;;){if(f.tag===5){if(d===null){d=f;try{s=f.stateNode,u?(o=s.style,typeof o.setProperty=="function"?o.setProperty("display","none","important"):o.display="none"):(l=f.stateNode,c=f.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=RE("display",a))}catch(v){Ln(e,e.return,v)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(v){Ln(e,e.return,v)}}else if((f.tag!==22&&f.tag!==23||f.memoizedState===null||f===e)&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===e)break e;for(;f.sibling===null;){if(f.return===null||f.return===e)break e;d===f&&(d=null),f=f.return}d===f&&(d=null),f.sibling.return=f.return,f=f.sibling}}break;case 19:Vs(t,e),mi(e),r&4&&Kj(e);break;case 21:break;default:Vs(t,e),mi(e)}}function mi(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(sP(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&&(jd(s,""),r.flags&=-33);var o=Vj(e);kx(e,o,s);break;case 3:case 4:var a=r.stateNode.containerInfo,l=Vj(e);bx(e,l,a);break;default:throw Error(Ee(161))}}catch(c){Ln(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function uD(e,t,n){Qe=e,aP(e)}function aP(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||bp;if(!a){var l=s.alternate,c=l!==null&&l.memoizedState!==null||kr;l=bp;var u=kr;if(bp=a,(kr=c)&&!u)for(Qe=s;Qe!==null;)a=Qe,c=a.child,a.tag===22&&a.memoizedState!==null?Yj(s):c!==null?(c.return=a,Qe=c):Yj(s);for(;o!==null;)Qe=o,aP(o),o=o.sibling;Qe=s,bp=l,kr=u}qj(e)}else s.subtreeFlags&8772&&o!==null?(o.return=s,Qe=o):qj(e)}}function qj(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:kr||Wm(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!kr)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:Us(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var o=t.updateQueue;o!==null&&Pj(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}Pj(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 f=d.dehydrated;f!==null&&Ed(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Ee(163))}kr||t.flags&512&&xx(t)}catch(p){Ln(t,t.return,p)}}if(t===e){Qe=null;break}if(n=t.sibling,n!==null){n.return=t.return,Qe=n;break}Qe=t.return}}function Uj(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 Yj(e){for(;Qe!==null;){var t=Qe;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Wm(4,t)}catch(c){Ln(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){Ln(t,s,c)}}var o=t.return;try{xx(t)}catch(c){Ln(t,o,c)}break;case 5:var a=t.return;try{xx(t)}catch(c){Ln(t,a,c)}}}catch(c){Ln(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 dD=Math.ceil,Kh=mo.ReactCurrentDispatcher,wk=mo.ReactCurrentOwner,Ps=mo.ReactCurrentBatchConfig,qt=0,hr=null,Un=null,gr=0,is=0,sc=da(0),sr=0,Fd=null,Ja=0,Vm=0,xk=0,ud=null,Wr=null,bk=0,Ic=1/0,Yi=null,qh=!1,vx=null,Jo=null,kp=!1,Ho=null,Uh=0,dd=0,Sx=null,ch=-1,uh=0;function Rr(){return qt&6?Wn():ch!==-1?ch:ch=Wn()}function Xo(e){return e.mode&1?qt&2&&gr!==0?gr&-gr:YO.transition!==null?(uh===0&&(uh=KE()),uh):(e=sn,e!==0||(e=window.event,e=e===void 0?16:QE(e.type)),e):1}function ni(e,t,n,r){if(50<dd)throw dd=0,Sx=null,Error(Ee(185));uf(e,n,r),(!(qt&2)||e!==hr)&&(e===hr&&(!(qt&2)&&(Vm|=n),sr===4&&Do(e,gr)),Jr(e,r),n===1&&qt===0&&!(t.mode&1)&&(Ic=Wn()+500,zm&&fa()))}function Jr(e,t){var n=e.callbackNode;Y2(e,t);var r=Ph(e,e===hr?gr:0);if(r===0)n!==null&&rj(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&rj(n),t===1)e.tag===0?UO(Gj.bind(null,e)):yA(Gj.bind(null,e)),WO(function(){!(qt&6)&&fa()}),n=null;else{switch(qE(r)){case 1:n=qb;break;case 4:n=WE;break;case 16:n=Ah;break;case 536870912:n=VE;break;default:n=Ah}n=mP(n,lP.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function lP(e,t){if(ch=-1,uh=0,qt&6)throw Error(Ee(327));var n=e.callbackNode;if(gc()&&e.callbackNode!==n)return null;var r=Ph(e,e===hr?gr:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Yh(e,r);else{t=r;var s=qt;qt|=2;var o=uP();(hr!==e||gr!==t)&&(Yi=null,Ic=Wn()+500,za(e,t));do try{hD();break}catch(l){cP(e,l)}while(!0);ik(),Kh.current=o,qt=s,Un!==null?t=0:(hr=null,gr=0,t=sr)}if(t!==0){if(t===2&&(s=Jw(e),s!==0&&(r=s,t=jx(e,s))),t===1)throw n=Fd,za(e,0),Do(e,r),Jr(e,Wn()),n;if(t===6)Do(e,r);else{if(s=e.current.alternate,!(r&30)&&!fD(s)&&(t=Yh(e,r),t===2&&(o=Jw(e),o!==0&&(r=o,t=jx(e,o))),t===1))throw n=Fd,za(e,0),Do(e,r),Jr(e,Wn()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(Ee(345));case 2:Ea(e,Wr,Yi);break;case 3:if(Do(e,r),(r&130023424)===r&&(t=bk+500-Wn(),10<t)){if(Ph(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){Rr(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=sx(Ea.bind(null,e,Wr,Yi),t);break}Ea(e,Wr,Yi);break;case 4:if(Do(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var a=31-ti(r);o=1<<a,a=t[a],a>s&&(s=a),r&=~o}if(r=s,r=Wn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*dD(r/1960))-r,10<r){e.timeoutHandle=sx(Ea.bind(null,e,Wr,Yi),r);break}Ea(e,Wr,Yi);break;case 5:Ea(e,Wr,Yi);break;default:throw Error(Ee(329))}}}return Jr(e,Wn()),e.callbackNode===n?lP.bind(null,e):null}function jx(e,t){var n=ud;return e.current.memoizedState.isDehydrated&&(za(e,t).flags|=256),e=Yh(e,t),e!==2&&(t=Wr,Wr=n,t!==null&&Nx(t)),e}function Nx(e){Wr===null?Wr=e:Wr.push.apply(Wr,e)}function fD(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(!si(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 Do(e,t){for(t&=~xk,t&=~Vm,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-ti(t),r=1<<n;e[n]=-1,t&=~r}}function Gj(e){if(qt&6)throw Error(Ee(327));gc();var t=Ph(e,0);if(!(t&1))return Jr(e,Wn()),null;var n=Yh(e,t);if(e.tag!==0&&n===2){var r=Jw(e);r!==0&&(t=r,n=jx(e,r))}if(n===1)throw n=Fd,za(e,0),Do(e,t),Jr(e,Wn()),n;if(n===6)throw Error(Ee(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Ea(e,Wr,Yi),Jr(e,Wn()),null}function kk(e,t){var n=qt;qt|=1;try{return e(t)}finally{qt=n,qt===0&&(Ic=Wn()+500,zm&&fa())}}function Xa(e){Ho!==null&&Ho.tag===0&&!(qt&6)&&gc();var t=qt;qt|=1;var n=Ps.transition,r=sn;try{if(Ps.transition=null,sn=1,e)return e()}finally{sn=r,Ps.transition=n,qt=t,!(qt&6)&&fa()}}function vk(){is=sc.current,bn(sc)}function za(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,HO(n)),Un!==null)for(n=Un.return;n!==null;){var r=n;switch(nk(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&$h();break;case 3:Ac(),bn(Yr),bn(jr),dk();break;case 5:uk(r);break;case 4:Ac();break;case 13:bn(An);break;case 19:bn(An);break;case 10:ok(r.type._context);break;case 22:case 23:vk()}n=n.return}if(hr=e,Un=e=Qo(e.current,null),gr=is=t,sr=0,Fd=null,xk=Vm=Ja=0,Wr=ud=null,$a!==null){for(t=0;t<$a.length;t++)if(n=$a[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}$a=null}return e}function cP(e,t){do{var n=Un;try{if(ik(),oh.current=Vh,Wh){for(var r=In.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Wh=!1}if(Ga=0,dr=rr=In=null,ld=!1,Ld=0,wk.current=null,n===null||n.return===null){sr=1,Fd=t,Un=null;break}e:{var o=e,a=n.return,l=n,c=t;if(t=gr,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,d=l,f=d.tag;if(!(d.mode&1)&&(f===0||f===11||f===15)){var p=d.alternate;p?(d.updateQueue=p.updateQueue,d.memoizedState=p.memoizedState,d.lanes=p.lanes):(d.updateQueue=null,d.memoizedState=null)}var h=Lj(a);if(h!==null){h.flags&=-257,Oj(h,a,l,o,t),h.mode&1&&$j(o,u,t),t=h,c=u;var y=t.updateQueue;if(y===null){var v=new Set;v.add(c),t.updateQueue=v}else y.add(c);break e}else{if(!(t&1)){$j(o,u,t),Sk();break e}c=Error(Ee(426))}}else if(kn&&l.mode&1){var w=Lj(a);if(w!==null){!(w.flags&65536)&&(w.flags|=256),Oj(w,a,l,o,t),rk(Pc(c,l));break e}}o=c=Pc(c,l),sr!==4&&(sr=2),ud===null?ud=[o]:ud.push(o),o=a;do{switch(o.tag){case 3:o.flags|=65536,t&=-t,o.lanes|=t;var g=qA(o,c,t);Aj(o,g);break e;case 1:l=c;var k=o.type,b=o.stateNode;if(!(o.flags&128)&&(typeof k.getDerivedStateFromError=="function"||b!==null&&typeof b.componentDidCatch=="function"&&(Jo===null||!Jo.has(b)))){o.flags|=65536,t&=-t,o.lanes|=t;var j=UA(o,l,t);Aj(o,j);break e}}o=o.return}while(o!==null)}fP(n)}catch(N){t=N,Un===n&&n!==null&&(Un=n=n.return);continue}break}while(!0)}function uP(){var e=Kh.current;return Kh.current=Vh,e===null?Vh:e}function Sk(){(sr===0||sr===3||sr===2)&&(sr=4),hr===null||!(Ja&268435455)&&!(Vm&268435455)||Do(hr,gr)}function Yh(e,t){var n=qt;qt|=2;var r=uP();(hr!==e||gr!==t)&&(Yi=null,za(e,t));do try{pD();break}catch(s){cP(e,s)}while(!0);if(ik(),qt=n,Kh.current=r,Un!==null)throw Error(Ee(261));return hr=null,gr=0,sr}function pD(){for(;Un!==null;)dP(Un)}function hD(){for(;Un!==null&&!F2();)dP(Un)}function dP(e){var t=hP(e.alternate,e,is);e.memoizedProps=e.pendingProps,t===null?fP(e):Un=t,wk.current=null}function fP(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=aD(n,t),n!==null){n.flags&=32767,Un=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{sr=6,Un=null;return}}else if(n=oD(n,t,is),n!==null){Un=n;return}if(t=t.sibling,t!==null){Un=t;return}Un=t=e}while(t!==null);sr===0&&(sr=5)}function Ea(e,t,n){var r=sn,s=Ps.transition;try{Ps.transition=null,sn=1,mD(e,t,n,r)}finally{Ps.transition=s,sn=r}return null}function mD(e,t,n,r){do gc();while(Ho!==null);if(qt&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(G2(e,o),e===hr&&(Un=hr=null,gr=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||kp||(kp=!0,mP(Ah,function(){return gc(),null})),o=(n.flags&15990)!==0,n.subtreeFlags&15990||o){o=Ps.transition,Ps.transition=null;var a=sn;sn=1;var l=qt;qt|=4,wk.current=null,cD(e,n),oP(n,e),$O(nx),Ih=!!tx,nx=tx=null,e.current=n,uD(n),z2(),qt=l,sn=a,Ps.transition=o}else e.current=n;if(kp&&(kp=!1,Ho=e,Uh=s),o=e.pendingLanes,o===0&&(Jo=null),W2(n.stateNode),Jr(e,Wn()),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(qh)throw qh=!1,e=vx,vx=null,e;return Uh&1&&e.tag!==0&&gc(),o=e.pendingLanes,o&1?e===Sx?dd++:(dd=0,Sx=e):dd=0,fa(),null}function gc(){if(Ho!==null){var e=qE(Uh),t=Ps.transition,n=sn;try{if(Ps.transition=null,sn=16>e?16:e,Ho===null)var r=!1;else{if(e=Ho,Ho=null,Uh=0,qt&6)throw Error(Ee(331));var s=qt;for(qt|=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:cd(8,d,o)}var f=d.child;if(f!==null)f.return=d,Qe=f;else for(;Qe!==null;){d=Qe;var p=d.sibling,h=d.return;if(rP(d),d===u){Qe=null;break}if(p!==null){p.return=h,Qe=p;break}Qe=h}}}var y=o.alternate;if(y!==null){var v=y.child;if(v!==null){y.child=null;do{var w=v.sibling;v.sibling=null,v=w}while(v!==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:cd(9,o,o.return)}var g=o.sibling;if(g!==null){g.return=o.return,Qe=g;break e}Qe=o.return}}var k=e.current;for(Qe=k;Qe!==null;){a=Qe;var b=a.child;if(a.subtreeFlags&2064&&b!==null)b.return=a,Qe=b;else e:for(a=k;Qe!==null;){if(l=Qe,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Wm(9,l)}}catch(N){Ln(l,l.return,N)}if(l===a){Qe=null;break e}var j=l.sibling;if(j!==null){j.return=l.return,Qe=j;break e}Qe=l.return}}if(qt=s,fa(),Ei&&typeof Ei.onPostCommitFiberRoot=="function")try{Ei.onPostCommitFiberRoot($m,e)}catch{}r=!0}return r}finally{sn=n,Ps.transition=t}}return!1}function Jj(e,t,n){t=Pc(n,t),t=qA(e,t,1),e=Go(e,t,1),t=Rr(),e!==null&&(uf(e,1,t),Jr(e,t))}function Ln(e,t,n){if(e.tag===3)Jj(e,e,n);else for(;t!==null;){if(t.tag===3){Jj(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Jo===null||!Jo.has(r))){e=Pc(n,e),e=UA(t,e,1),t=Go(t,e,1),e=Rr(),t!==null&&(uf(t,1,e),Jr(t,e));break}}t=t.return}}function gD(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Rr(),e.pingedLanes|=e.suspendedLanes&n,hr===e&&(gr&n)===n&&(sr===4||sr===3&&(gr&130023424)===gr&&500>Wn()-bk?za(e,0):xk|=n),Jr(e,t)}function pP(e,t){t===0&&(e.mode&1?(t=dp,dp<<=1,!(dp&130023424)&&(dp=4194304)):t=1);var n=Rr();e=lo(e,t),e!==null&&(uf(e,t,n),Jr(e,n))}function yD(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),pP(e,n)}function wD(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),pP(e,n)}var hP;hP=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Yr.current)Kr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Kr=!1,iD(e,t,n);Kr=!!(e.flags&131072)}else Kr=!1,kn&&t.flags&1048576&&wA(t,Dh,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;lh(e,t),e=t.pendingProps;var s=Cc(t,jr.current);mc(t,n),s=pk(null,t,r,e,s,n);var o=hk();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,Gr(r)?(o=!0,Lh(t)):o=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,lk(t),s.updater=Hm,t.stateNode=s,s._reactInternals=t,dx(t,r,e,n),t=hx(null,t,r,!0,o,n)):(t.tag=0,kn&&o&&tk(t),Ir(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(lh(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=bD(r),e=Us(r,e),s){case 0:t=px(null,t,r,e,n);break e;case 1:t=zj(null,t,r,e,n);break e;case 11:t=Dj(null,t,r,e,n);break e;case 14:t=Fj(null,t,r,Us(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:Us(r,s),px(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Us(r,s),zj(e,t,r,s,n);case 3:e:{if(XA(t),e===null)throw Error(Ee(387));r=t.pendingProps,o=t.memoizedState,s=o.element,jA(e,t),Bh(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=Pc(Error(Ee(423)),t),t=Bj(e,t,r,n,s);break e}else if(r!==s){s=Pc(Error(Ee(424)),t),t=Bj(e,t,r,n,s);break e}else for(ls=Yo(t.stateNode.containerInfo.firstChild),us=t,kn=!0,Js=null,n=vA(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(_c(),r===s){t=co(e,t,n);break e}Ir(e,t,r,n)}t=t.child}return t;case 5:return NA(t),e===null&&lx(t),r=t.type,s=t.pendingProps,o=e!==null?e.memoizedProps:null,a=s.children,rx(r,s)?a=null:o!==null&&rx(r,o)&&(t.flags|=32),JA(e,t),Ir(e,t,a,n),t.child;case 6:return e===null&&lx(t),null;case 13:return QA(e,t,n);case 4:return ck(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ec(t,null,r,n):Ir(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Us(r,s),Dj(e,t,r,s,n);case 7:return Ir(e,t,t.pendingProps,n),t.child;case 8:return Ir(e,t,t.pendingProps.children,n),t.child;case 12:return Ir(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,fn(Fh,r._currentValue),r._currentValue=a,o!==null)if(si(o.value,a)){if(o.children===s.children&&!Yr.current){t=co(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=no(-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),cx(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),cx(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}Ir(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,mc(t,n),s=Is(s),r=r(s),t.flags|=1,Ir(e,t,r,n),t.child;case 14:return r=t.type,s=Us(r,t.pendingProps),s=Us(r.type,s),Fj(e,t,r,s,n);case 15:return YA(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Us(r,s),lh(e,t),t.tag=1,Gr(r)?(e=!0,Lh(t)):e=!1,mc(t,n),KA(t,r,s),dx(t,r,s,n),hx(null,t,r,!0,e,n);case 19:return ZA(e,t,n);case 22:return GA(e,t,n)}throw Error(Ee(156,t.tag))};function mP(e,t){return HE(e,t)}function xD(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 As(e,t,n,r){return new xD(e,t,n,r)}function jk(e){return e=e.prototype,!(!e||!e.isReactComponent)}function bD(e){if(typeof e=="function")return jk(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Wb)return 11;if(e===Vb)return 14}return 2}function Qo(e,t){var n=e.alternate;return n===null?(n=As(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 dh(e,t,n,r,s,o){var a=2;if(r=e,typeof e=="function")jk(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case Yl:return Ba(n.children,s,o,t);case Hb:a=8,s|=8;break;case $w:return e=As(12,n,t,s|2),e.elementType=$w,e.lanes=o,e;case Lw:return e=As(13,n,t,s),e.elementType=Lw,e.lanes=o,e;case Ow:return e=As(19,n,t,s),e.elementType=Ow,e.lanes=o,e;case NE:return Km(n,s,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case SE:a=10;break e;case jE:a=9;break e;case Wb:a=11;break e;case Vb:a=14;break e;case Mo:a=16,r=null;break e}throw Error(Ee(130,e==null?e:typeof e,""))}return t=As(a,n,t,s),t.elementType=e,t.type=r,t.lanes=o,t}function Ba(e,t,n,r){return e=As(7,e,r,t),e.lanes=n,e}function Km(e,t,n,r){return e=As(22,e,r,t),e.elementType=NE,e.lanes=n,e.stateNode={isHidden:!1},e}function Ty(e,t,n){return e=As(6,e,null,t),e.lanes=n,e}function My(e,t,n){return t=As(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function kD(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=hy(0),this.expirationTimes=hy(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=hy(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function Nk(e,t,n,r,s,o,a,l,c){return e=new kD(e,t,n,l,c),t===1?(t=1,o===!0&&(t|=8)):t=0,o=As(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},lk(o),e}function vD(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Ul,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function gP(e){if(!e)return na;e=e._reactInternals;e:{if(ul(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(Gr(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(Gr(n))return gA(e,n,t)}return t}function yP(e,t,n,r,s,o,a,l,c){return e=Nk(n,r,!0,e,s,o,a,l,c),e.context=gP(null),n=e.current,r=Rr(),s=Xo(n),o=no(r,s),o.callback=t??null,Go(n,o,s),e.current.lanes=s,uf(e,s,r),Jr(e,r),e}function qm(e,t,n,r){var s=t.current,o=Rr(),a=Xo(s);return n=gP(n),t.context===null?t.context=n:t.pendingContext=n,t=no(o,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Go(s,t,a),e!==null&&(ni(e,s,a,o),ih(e,s,a)),a}function Gh(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 Xj(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Ck(e,t){Xj(e,t),(e=e.alternate)&&Xj(e,t)}function SD(){return null}var wP=typeof reportError=="function"?reportError:function(e){console.error(e)};function _k(e){this._internalRoot=e}Um.prototype.render=_k.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Ee(409));qm(e,t,null,null)};Um.prototype.unmount=_k.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Xa(function(){qm(null,e,null,null)}),t[ao]=null}};function Um(e){this._internalRoot=e}Um.prototype.unstable_scheduleHydration=function(e){if(e){var t=GE();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Oo.length&&t!==0&&t<Oo[n].priority;n++);Oo.splice(n,0,e),n===0&&XE(e)}};function Ek(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Ym(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Qj(){}function jD(e,t,n,r,s){if(s){if(typeof r=="function"){var o=r;r=function(){var u=Gh(a);o.call(u)}}var a=yP(t,r,e,0,null,!1,!1,"",Qj);return e._reactRootContainer=a,e[ao]=a.current,Id(e.nodeType===8?e.parentNode:e),Xa(),a}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var u=Gh(c);l.call(u)}}var c=Nk(e,0,!1,null,null,!1,!1,"",Qj);return e._reactRootContainer=c,e[ao]=c.current,Id(e.nodeType===8?e.parentNode:e),Xa(function(){qm(t,c,n,r)}),c}function Gm(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=Gh(a);l.call(c)}}qm(t,a,e,s)}else a=jD(n,t,e,s,r);return Gh(a)}UE=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Uu(t.pendingLanes);n!==0&&(Ub(t,n|1),Jr(t,Wn()),!(qt&6)&&(Ic=Wn()+500,fa()))}break;case 13:Xa(function(){var r=lo(e,1);if(r!==null){var s=Rr();ni(r,e,1,s)}}),Ck(e,1)}};Yb=function(e){if(e.tag===13){var t=lo(e,134217728);if(t!==null){var n=Rr();ni(t,e,134217728,n)}Ck(e,134217728)}};YE=function(e){if(e.tag===13){var t=Xo(e),n=lo(e,t);if(n!==null){var r=Rr();ni(n,e,t,r)}Ck(e,t)}};GE=function(){return sn};JE=function(e,t){var n=sn;try{return sn=e,t()}finally{sn=n}};Uw=function(e,t,n){switch(t){case"input":if(zw(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=Fm(r);if(!s)throw Error(Ee(90));_E(r),zw(r,s)}}}break;case"textarea":AE(e,n);break;case"select":t=n.value,t!=null&&dc(e,!!n.multiple,t,!1)}};LE=kk;OE=Xa;var ND={usingClientEntryPoint:!1,Events:[ff,Ql,Fm,ME,$E,kk]},Tu={findFiberByHostInstance:Ma,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},CD={bundleType:Tu.bundleType,version:Tu.version,rendererPackageName:Tu.rendererPackageName,rendererConfig:Tu.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:mo.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=zE(e),e===null?null:e.stateNode},findFiberByHostInstance:Tu.findFiberByHostInstance||SD,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 vp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!vp.isDisabled&&vp.supportsFiber)try{$m=vp.inject(CD),Ei=vp}catch{}}hs.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ND;hs.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ek(t))throw Error(Ee(200));return vD(e,t,null,n)};hs.createRoot=function(e,t){if(!Ek(e))throw Error(Ee(299));var n=!1,r="",s=wP;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=Nk(e,1,!1,null,null,n,!1,r,s),e[ao]=t.current,Id(e.nodeType===8?e.parentNode:e),new _k(t)};hs.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=zE(t),e=e===null?null:e.stateNode,e};hs.flushSync=function(e){return Xa(e)};hs.hydrate=function(e,t,n){if(!Ym(t))throw Error(Ee(200));return Gm(null,e,t,!0,n)};hs.hydrateRoot=function(e,t,n){if(!Ek(e))throw Error(Ee(405));var r=n!=null&&n.hydratedSources||null,s=!1,o="",a=wP;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=yP(t,null,e,1,n??null,s,!1,o,a),e[ao]=t.current,Id(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 Um(t)};hs.render=function(e,t,n){if(!Ym(t))throw Error(Ee(200));return Gm(null,e,t,!1,n)};hs.unmountComponentAtNode=function(e){if(!Ym(e))throw Error(Ee(40));return e._reactRootContainer?(Xa(function(){Gm(null,null,e,!1,function(){e._reactRootContainer=null,e[ao]=null})}),!0):!1};hs.unstable_batchedUpdates=kk;hs.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Ym(n))throw Error(Ee(200));if(e==null||e._reactInternals===void 0)throw Error(Ee(38));return Gm(e,t,n,!1,r)};hs.version="18.3.1-next-f1338f8080-20240426";function xP(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(xP)}catch(e){console.error(e)}}xP(),xE.exports=hs;var ur=xE.exports,Zj=ur;Tw.createRoot=Zj.createRoot,Tw.hydrateRoot=Zj.hydrateRoot;const bP=m.createContext(null);function Cx(e){let t=e||"/";return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t||"/"}function _D(){const e=Cx(window.location.pathname);return e==="/"?(window.history.replaceState({},"","/projects"),"/projects"):e}function ED({children:e}){const[t,n]=m.useState(_D);m.useEffect(()=>{const o=()=>n(Cx(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=Cx(l.pathname),u=l.search||"";window.history.pushState({},"",c+u),n(c)},[]),s=m.useMemo(()=>({path:t,navigate:r}),[t,r]);return i.jsx(bP.Provider,{value:s,children:e})}function gs(){const e=m.useContext(bP);if(!e)throw new Error("useRoute must be used within RouteProvider");return e}function AD(){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 eN={};function _x(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&eN[t[0]]||(typeof t[0]=="string"&&(eN[t[0]]=new Date),AD(...t))}const kP=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function tN(e,t,n){e.loadNamespaces(t,kP(e,n))}function nN(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,kP(e,r))}function PD(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 ID(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(_x("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}}):PD(e,t,n)}const RD=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,TD={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},MD=e=>TD[e],$D=e=>e.replace(RD,MD);let Ex={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:$D};function LD(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ex={...Ex,...e}}function OD(){return Ex}let vP;function DD(e){vP=e}function FD(){return vP}const zD={type:"3rdParty",init(e){LD(e.options.react),DD(e)}},BD=m.createContext();class HD{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const WD=(e,t)=>{const n=m.useRef();return m.useEffect(()=>{n.current=e},[e,t]),n.current};function $r(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:s}=m.useContext(BD)||{},o=n||r||FD();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new HD),!o){_x("You will need to pass in an i18next instance by using initReactI18next");const b=(N,C)=>typeof C=="string"?C:C&&typeof C=="object"&&typeof C.defaultValue=="string"?C.defaultValue:Array.isArray(N)?N[N.length-1]:N,j=[b,{},!1];return j.t=b,j.i18n={},j.ready=!1,j}o.options.react&&o.options.react.wait!==void 0&&_x("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...OD(),...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(b=>ID(b,o,a));function f(){return o.getFixedT(t.lng||null,a.nsMode==="fallback"?u:u[0],c)}const[p,h]=m.useState(f);let y=u.join();t.lng&&(y=`${t.lng}${y}`);const v=WD(y),w=m.useRef(!0);m.useEffect(()=>{const{bindI18n:b,bindI18nStore:j}=a;w.current=!0,!d&&!l&&(t.lng?nN(o,t.lng,u,()=>{w.current&&h(f)}):tN(o,u,()=>{w.current&&h(f)})),d&&v&&v!==y&&w.current&&h(f);function N(){w.current&&h(f)}return b&&o&&o.on(b,N),j&&o&&o.store.on(j,N),()=>{w.current=!1,b&&o&&b.split(" ").forEach(C=>o.off(C,N)),j&&o&&j.split(" ").forEach(C=>o.store.off(C,N))}},[o,y]);const g=m.useRef(!0);m.useEffect(()=>{w.current&&!g.current&&h(f),g.current=!1},[o,c]);const k=[p,o,d];if(k.t=p,k.i18n=o,k.ready=d,d||!d&&!l)return k;throw new Promise(b=>{t.lng?nN(o,t.lng,u,()=>b()):tN(o,u,()=>b())})}const SP="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",VD=[{to:"/projects",labelKey:"common:nav.projects",icon:"folder_open"},{to:"/workflows",label:"迭代",icon:"timeline"},{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"}],KD=[{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 qD(e,t){return t==="/projects"?e==="/projects"||e==="/":t==="/nodes"?e==="/nodes"||e==="/my-nodes":e===t||e.startsWith(t+"/")}function UD({authUser:e,onLogout:t}){const{path:n,navigate:r}=gs(),{t:s}=$r(),[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:SP,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:VD.filter(l=>!l.adminOnly||(e==null?void 0:e.isAdmin)).map(l=>i.jsxs("button",{type:"button",className:"af-nav-link"+(qD(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&&KD.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 YD="agentflow.pipelineRecent",GD=15;function JD(e){try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function XD(){if(typeof localStorage>"u")return[];const e=localStorage.getItem(YD);return e?JD(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 QD(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 rN(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 ZD(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:QD(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,GD)}var os=Uint8Array,ic=Uint16Array,eF=Int32Array,jP=new os([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]),NP=new os([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]),tF=new os([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),CP=function(e,t){for(var n=new ic(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var s=new eF(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}},_P=CP(jP,2),EP=_P.b,nF=_P.r;EP[28]=258,nF[258]=28;var rF=CP(NP,0),sF=rF.b,Ax=new ic(32768);for(var xn=0;xn<32768;++xn){var Ao=(xn&43690)>>1|(xn&21845)<<1;Ao=(Ao&52428)>>2|(Ao&13107)<<2,Ao=(Ao&61680)>>4|(Ao&3855)<<4,Ax[xn]=((Ao&65280)>>8|(Ao&255)<<8)>>1}var fd=function(e,t,n){for(var r=e.length,s=0,o=new ic(t);s<r;++s)e[s]&&++o[e[s]-1];var a=new ic(t);for(s=1;s<t;++s)a[s]=a[s-1]+o[s-1]<<1;var l;if(n){l=new ic(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],f=a[e[s]-1]++<<d,p=f|(1<<d)-1;f<=p;++f)l[Ax[f]>>c]=u}else for(l=new ic(r),s=0;s<r;++s)e[s]&&(l[s]=Ax[a[e[s]-1]++]>>15-e[s]);return l},hf=new os(288);for(var xn=0;xn<144;++xn)hf[xn]=8;for(var xn=144;xn<256;++xn)hf[xn]=9;for(var xn=256;xn<280;++xn)hf[xn]=7;for(var xn=280;xn<288;++xn)hf[xn]=8;var AP=new os(32);for(var xn=0;xn<32;++xn)AP[xn]=5;var iF=fd(hf,9,1),oF=fd(AP,5,1),$y=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Ks=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},Ly=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},aF=function(e){return(e+7)/8|0},Ak=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new os(e.subarray(t,n))},lF=["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"],js=function(e,t,n){var r=new Error(t||lF[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,js),!n)throw r;return r},cF=function(e,t,n,r){var s=e.length,o=r?r.length:0;if(!s||t.f&&!t.l)return n||new os(0);var a=!n,l=a||t.i!=2,c=t.i;a&&(n=new os(s*3));var u=function(ce){var de=n.length;if(ce>de){var me=new os(Math.max(de*2,ce));me.set(n),n=me}},d=t.f||0,f=t.p||0,p=t.b||0,h=t.l,y=t.d,v=t.m,w=t.n,g=s*8;do{if(!h){d=Ks(e,f,1);var k=Ks(e,f+1,3);if(f+=3,k)if(k==1)h=iF,y=oF,v=9,w=5;else if(k==2){var C=Ks(e,f,31)+257,I=Ks(e,f+10,15)+4,R=C+Ks(e,f+5,31)+1;f+=14;for(var H=new os(R),A=new os(19),L=0;L<I;++L)A[tF[L]]=Ks(e,f+L*3,7);f+=I*3;for(var D=$y(A),O=(1<<D)-1,M=fd(A,D,1),L=0;L<R;){var K=M[Ks(e,f,O)];f+=K&15;var b=K>>4;if(b<16)H[L++]=b;else{var z=0,F=0;for(b==16?(F=3+Ks(e,f,3),f+=2,z=H[L-1]):b==17?(F=3+Ks(e,f,7),f+=3):b==18&&(F=11+Ks(e,f,127),f+=7);F--;)H[L++]=z}}var $=H.subarray(0,C),W=H.subarray(C);v=$y($),w=$y(W),h=fd($,v,1),y=fd(W,w,1)}else js(1);else{var b=aF(f)+4,j=e[b-4]|e[b-3]<<8,N=b+j;if(N>s){c&&js(0);break}l&&u(p+j),n.set(e.subarray(b,N),p),t.b=p+=j,t.p=f=N*8,t.f=d;continue}if(f>g){c&&js(0);break}}l&&u(p+131072);for(var E=(1<<v)-1,Q=(1<<w)-1,V=f;;V=f){var z=h[Ly(e,f)&E],B=z>>4;if(f+=z&15,f>g){c&&js(0);break}if(z||js(2),B<256)n[p++]=B;else if(B==256){V=f,h=null;break}else{var re=B-254;if(B>264){var L=B-257,ue=jP[L];re=Ks(e,f,(1<<ue)-1)+EP[L],f+=ue}var G=y[Ly(e,f)&Q],ee=G>>4;G||js(3),f+=G&15;var W=sF[ee];if(ee>3){var ue=NP[ee];W+=Ly(e,f)&(1<<ue)-1,f+=ue}if(f>g){c&&js(0);break}l&&u(p+131072);var te=p+re;if(p<W){var ne=o-W,Z=Math.min(W,te);for(ne+p<0&&js(3);p<Z;++p)n[p]=r[ne+p]}for(;p<te;++p)n[p]=n[p-W]}}t.l=h,t.p=V,t.b=p,t.f=d,h&&(d=1,t.m=v,t.d=y,t.n=w)}while(!d);return p!=n.length&&a?Ak(n,0,p):n.subarray(0,p)},uF=new os(0),Si=function(e,t){return e[t]|e[t+1]<<8},Xs=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Oy=function(e,t){return Xs(e,t)+Xs(e,t+4)*4294967296};function dF(e,t){return cF(e,{i:2},t&&t.out,t&&t.dictionary)}var Px=typeof TextDecoder<"u"&&new TextDecoder,fF=0;try{Px.decode(uF,{stream:!0}),fF=1}catch{}var pF=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:Ak(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 hF(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(Px)return Px.decode(e);var s=pF(e),o=s.s,n=s.r;return n.length&&js(8),o}}var mF=function(e,t){return t+30+Si(e,t+26)+Si(e,t+28)},gF=function(e,t,n){var r=Si(e,t+28),s=hF(e.subarray(t+46,t+46+r),!(Si(e,t+8)&2048)),o=t+46+r,a=Xs(e,t+20),l=n&&a==4294967295?yF(e,o):[a,Xs(e,t+24),Xs(e,t+42)],c=l[0],u=l[1],d=l[2];return[Si(e,t+10),c,u,s,o+Si(e,t+30)+Si(e,t+32),d]},yF=function(e,t){for(;Si(e,t)!=1;t+=4+Si(e,t+2));return[Oy(e,t+12),Oy(e,t+4),Oy(e,t+20)]};function wF(e,t){for(var n={},r=e.length-22;Xs(e,r)!=101010256;--r)(!r||e.length-r>65558)&&js(13);var s=Si(e,r+8);if(!s)return{};var o=Xs(e,r+16),a=o==4294967295||s==65535;if(a){var l=Xs(e,r-12);a=Xs(e,l)==101075792,a&&(s=Xs(e,l+32),o=Xs(e,l+48))}for(var c=0;c<s;++c){var u=gF(e,o,a),d=u[0],f=u[1],p=u[2],h=u[3],y=u[4],v=u[5],w=mF(e,v);o=y,d?d==8?n[h]=dF(e.subarray(w,w+f),{out:new os(p)}):js(14,"unknown compression type "+d):n[h]=Ak(e,w,w+f)}return n}const xF=8*1024*1024,bF=500;function kF(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 vF(e){return e?e.split("/").some(n=>n==="__MACOSX"||n.startsWith("._")):!0}function SF(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 jF=/^[a-zA-Z][a-zA-Z0-9_-]*$/;async function NF(e){try{const t=new Uint8Array(await e.arrayBuffer()),n=wF(t),r=new Map;let s=0,o=0;for(const[c,u]of Object.entries(n)){if(c.endsWith("/"))continue;const d=kF(c);if(!d||vF(d))continue;const f=(u==null?void 0:u.length)??0;if(s+=f,s>xF||(o+=1,o>bF))return null;r.set(d,f)}if(r.size===0)return null;const a=new Set;for(const c of r.keys()){const u=SF(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 jF.test(l)?l:null}catch{return null}}const Dy=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function CF({file:e,onClose:t,onImported:n}){const{t:r}=$r(),s=m.useId(),o=m.useRef(null),a=m.useRef(null),[l,c]=m.useState(""),[u,d]=m.useState("user"),[f,p]=m.useState(!1),[h,y]=m.useState(""),[v,w]=m.useState(null),g=v??e;m.useEffect(()=>{const N=requestAnimationFrame(()=>{var C;return(C=o.current)==null?void 0:C.focus()});return()=>cancelAnimationFrame(N)},[]),m.useEffect(()=>{let N=!1;return(async()=>{const C=g.name||"",I=C.toLowerCase();let R="";if(I.endsWith(".zip")){if(R=await NF(g)||"",!R){const H=C.replace(/\.zip$/i,"");Dy.test(H)&&(R=H)}}else if(I.endsWith(".yaml")||I.endsWith(".yml")){const H=C.replace(/\.ya?ml$/i,"");Dy.test(H)&&(R=H)}N||c(R)})(),()=>{N=!0}},[g]);const k=l.trim(),b=k.length>0&&Dy.test(k);async function j(N){if(N.preventDefault(),!(!b||f)){p(!0),y("");try{const C=new FormData;C.set("flowId",k),C.set("targetSpace",u),C.set("file",g,g.name);const I=await fetch("/api/flows/import",{method:"POST",body:C}),R=await I.json().catch(()=>({}));if(!I.ok){y(typeof R.error=="string"?R.error:r("project:importModal.importFailed"));return}n({id:R.flowId,source:R.flowSource??"user"})}catch(C){y(String((C==null?void 0:C.message)||C))}finally{p(!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:j,children:[i.jsx("p",{className:"af-new-pipeline-lead",children:r("project:importModal.lead",{filename:g.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 I;const C=(I=N.target.files)==null?void 0:I[0];C&&w(C),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":k.length>0&&!b}),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:f,children:r("project:importModal.cancel")}),i.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!b||f,children:r(f?"project:importModal.importing":"project:importModal.importAndOpen")})]})]})]})})}const _F=/^[a-zA-Z][a-zA-Z0-9_-]*$/,sN="af:newPipelineGuide";function EF({open:e,onClose:t,onCreated:n}){const{t:r}=$r(),s=m.useId(),o=m.useRef(null),[a,l]=m.useState(""),[c,u]=m.useState(""),[d,f]=m.useState("user"),[p,h]=m.useState(!1),[y,v]=m.useState(""),[w,g]=m.useState(!1);m.useEffect(()=>{if(!e)return;l(""),u(""),f("user"),v(""),h(!1),localStorage.getItem(sN)==="true"&&g(!0);const I=requestAnimationFrame(()=>{var R;return(R=o.current)==null?void 0:R.focus()});return()=>cancelAnimationFrame(I)},[e]);const k=()=>{localStorage.removeItem(sN),g(!1)};if(!e)return null;const b=a.trim(),j=b.length>0&&_F.test(b);async function N(C){if(C.preventDefault(),!(!j||p)){h(!0),v(""),k();try{const I=await fetch("/api/flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:b,description:c.trim(),targetSpace:d})}),R=await I.json().catch(()=>({}));if(!I.ok){v(typeof R.error=="string"?R.error:r("project:newPipelineModal.createFailed"));return}n({id:R.flowId,source:R.flowSource??"user"})}catch(I){v(String((I==null?void 0:I.message)||I))}finally{h(!1)}}}return i.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:C=>{C.target===C.currentTarget&&(k(),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:C=>C.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:()=>{k(),t()},"aria-label":r("project:newPipelineModal.close"),children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),w?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:k,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:C=>l(C.target.value),"aria-invalid":b.length>0&&!j}),i.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r(w?"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(w?"onboarding:newPipeline.descPlaceholderGuide":"project:newPipelineModal.descPlaceholder"),value:c,onChange:C=>u(C.target.value)}),w?i.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-guide-hint",children:r("onboarding:newPipeline.descHintGuide")}):null]}),y?i.jsx("p",{className:"af-err af-new-pipeline-err",children:y}):null,i.jsxs("div",{className:"af-new-pipeline-actions",children:[i.jsx("button",{type:"button",className:"af-btn-secondary",onClick:()=>{k(),t()},disabled:p,children:r("project:newPipelineModal.cancel")}),i.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!j||p,children:r(p?"project:newPipelineModal.creating":w?"onboarding:newPipeline.createGuide":"project:newPipelineModal.createAndOpen")})]})]})]})})}const PP="agentflow.pipelineViewPreference";function IP(e,t="user",n=!1){return`${String(t||"user")}:${String(e||"")}:${n?"archived":"active"}`}function RP(){if(typeof localStorage>"u")return{};try{const e=JSON.parse(localStorage.getItem(PP)||"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function AF(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(PP,JSON.stringify(e))}catch{}}function Pk(e){return e==="display"?"display":"workspace"}function PF(e){const t=String(e||"").toLowerCase();return t==="builtin"||t==="admin"}function TP(e,t){const n=Pk(t);return n==="pipeline"&&PF(e==null?void 0:e.source)?"workspace":n}function IF(e){return(e==null?void 0:e.hasPipeline)!==!1&&(e==null?void 0:e.hasFlow)!==!1&&(e==null?void 0:e.flowYaml)!==!1}function RF(e,t,n,r=!1){if(!e)return;const s=RP();s[IP(e,t,r)]={view:Pk(n),at:Date.now()},AF(s)}function TF(e,t="workspace"){if(!(e!=null&&e.id))return Pk(t);const r=RP()[IP(e.id,e.source??"user",!!e.archived)],s=TP(e,(r==null?void 0:r.view)||t);return s==="pipeline"&&!IF(e)?"workspace":s}function MF(e,t="workspace"){var s;const n=TP(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 Sp(e,t="workspace"){return MF(e,TF(e,t))}function $F(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 Ix(e){return String((e==null?void 0:e.version)||"").trim()}function LF(e){const t=Ix(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 OF({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,f]=m.useState("keyword"),[p,h]=m.useState([]),[y,v]=m.useState({}),[w,g]=m.useState(""),[k,b]=m.useState(""),[j,N]=m.useState(""),C=m.useCallback(async()=>{b("");try{const[D,O]=await Promise.all([fetch("/api/skillhub/status"),fetch("/api/skillhub/list?target=agentflow&agent=codex")]),M=await D.json().catch(()=>({}));D.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 K=await O.json().catch(()=>({}));if(!O.ok)throw new Error(typeof K.error=="string"?K.error:"HTTP "+O.status);o(Array.isArray(K.skills)?K.skills:[]),l(typeof K.skillsRoot=="string"?K.skillsRoot:""),v({})}catch(D){b(String(D.message||D))}},[]);m.useEffect(()=>{C()},[C]);const I=m.useCallback(async()=>{const D=c.trim();if(D){g("search"),b(""),N("");try{const O=await fetch(`/api/skillhub/search?q=${encodeURIComponent(D)}&mode=${encodeURIComponent(d)}`),M=await O.json().catch(()=>({}));if(!O.ok)throw new Error(typeof M.error=="string"?M.error:"HTTP "+O.status);h(Array.isArray(M.items)?M.items:[])}catch(O){b(String(O.message||O))}finally{g("")}}},[c,d]),R=m.useCallback(async(D,O=!1)=>{if(!t)return;const M=D&&typeof D=="object"?D:null,K=String(M?M.slug||M.name||M.collection||M.skillId||M.id:D||"").trim();if(K){g(`install:${K}`),b(""),N("");try{const z=M?{slug:M.slug||"",skillId:M.skillId||"",collection:M.collection||"",collectionName:M.collection&&M.name||"",target:"agentflow",agent:"codex",force:O}:{slug:K,target:"agentflow",agent:"codex",force:O},F=await fetch("/api/skillhub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(z)}),$=await F.json().catch(()=>({}));if(!F.ok)throw new Error(typeof $.error=="string"?$.error:"HTTP "+F.status);N(O?`已更新 ${K}`:`已安装 ${K}`),await C(),typeof e=="function"&&await e()}catch(z){b(String(z.message||z))}finally{g("")}}},[t,C,e]),H=m.useCallback(async()=>{if(t&&s.length!==0){g("check-updates"),b(""),N("");try{const D=await Promise.all(s.map(async K=>{const z=String(K.name||"").trim();if(!z)return null;try{const F=await fetch(`/api/skillhub/search?q=${encodeURIComponent(z)}&mode=keyword`),$=await F.json().catch(()=>({}));if(!F.ok)throw new Error(typeof $.error=="string"?$.error:"HTTP "+F.status);const W=Array.isArray($.items)?$.items:[],E=W.find(re=>re.slug===z||re.name===z||re.id===z)||W[0],Q=Ix(K),V=String((E==null?void 0:E.version)||"").trim();let B="unknown";return E?Q&&V?B=$F(Q,V)<0?"update":"current":V&&(B="remote-only"):B="missing",[z,{state:B,latestVersion:V,installedVersion:Q,summary:(E==null?void 0:E.summary)||""}]}catch(F){return[z,{state:"error",error:String(F.message||F),installedVersion:Ix(K)}]}})),O={};for(const K of D)K&&(O[K[0]]=K[1]);v(O);const M=Object.values(O).filter(K=>K.state==="update").length;N(M>0?`发现 ${M} 个可更新 skill`:"已检查,暂无明确可更新项")}finally{g("")}}},[t,s]),A=m.useCallback(async D=>{if(!t)return;const O=String(D||"").trim();if(O){g(`uninstall:${O}`),b(""),N("");try{const M=await fetch("/api/skillhub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:O,target:"agentflow",agent:"codex"})}),K=await M.json().catch(()=>({}));if(!M.ok)throw new Error(typeof K.error=="string"?K.error:"HTTP "+M.status);N(`已卸载 ${O}`),await C(),typeof e=="function"&&await e()}catch(M){b(String(M.message||M))}finally{g("")}}},[t,C,e]),L=m.useCallback(async()=>{if(t){g("update-cli"),b(""),N("");try{const D=await fetch("/api/skillhub/update",{method:"POST"}),O=await D.json().catch(()=>({}));if(!D.ok)throw new Error(typeof O.error=="string"?O.error:"HTTP "+D.status);N("SkillHub CLI 已更新"),await C()}catch(D){b(String(D.message||D))}finally{g("")}}},[t,C]);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:C,disabled:!!w,children:"刷新"}),i.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:H,disabled:!t||!!w||s.length===0,children:w==="check-updates"?"检查中…":"检查更新"}),i.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:L,disabled:!t||!!w,children:w==="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:D=>{f(D.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:D=>u(D.target.value),onKeyDown:D=>{D.key==="Enter"&&I()},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:()=>I(),disabled:!c.trim()||w==="search",children:[i.jsx("span",{className:"material-symbols-outlined",children:"search"}),w==="search"?"搜索中…":"搜索"]})]}),k?i.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:k}):null,j?i.jsx("p",{className:"af-set-hint af-set-hint--inline",children:j}):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(D=>{const O=y[D.name],M=!O||O.state==="update"||O.state==="remote-only"||O.state==="unknown"||O.state==="error",K=w===`install:${D.name}`?"更新中…":(O==null?void 0:O.state)==="current"?"已最新":(O==null?void 0:O.state)==="update"&&O.latestVersion?`更新到 v${O.latestVersion}`:(O==null?void 0:O.state)==="remote-only"&&O.latestVersion?`安装 v${O.latestVersion}`:"重装";return i.jsxs("div",{className:"af-set-skillhub-item",children:[i.jsxs("div",{children:[i.jsx("div",{className:"af-set-skillhub-title",children:D.displayName||D.name}),i.jsx("div",{className:"af-set-skillhub-meta",children:LF(D)}),i.jsx("div",{className:"af-set-skillhub-version-row",children:O?O.state==="update"?i.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--warn",children:["可更新 ",O.installedVersion?`v${O.installedVersion} -> `:"","v",O.latestVersion]}):O.state==="current"?i.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--ok",children:["已最新 v",O.latestVersion||O.installedVersion]}):O.state==="remote-only"?i.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:["远端 v",O.latestVersion,",本地版本未知"]}):O.state==="missing"?i.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"未找到远端匹配项"}):O.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:()=>R(D.name,!0),disabled:!t||!!w||!M,children:K}),i.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>A(D.name),disabled:!t||!!w,children:"卸载"})]})]},`${D.agent}:${D.path}:${D.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:p.length})]}),i.jsx("div",{className:"af-set-skillhub-list",children:p.length===0?i.jsx("div",{className:"af-set-skillhub-empty",children:"输入关键词后搜索 SkillHub"}):p.map(D=>{const O=D.slug||D.name,M=D.kind==="collection"||D.collection,K=!M&&s.some(z=>z.name===O||z.name===D.name);return i.jsxs("div",{className:"af-set-skillhub-item",children:[i.jsxs("div",{children:[i.jsx("div",{className:"af-set-skillhub-title",children:D.name||O}),i.jsxs("div",{className:"af-set-skillhub-meta",children:[M?`collection:${D.collection}`:O,D.skillId?` · id:${D.skillId}`:"",D.version?` · ${D.version}`:""]}),D.summary?i.jsx("p",{className:"af-set-skillhub-summary",children:D.summary}):null]}),i.jsx("button",{type:"button",className:K?"af-set-btn-mini":"af-set-btn-add af-set-btn-add--compact",onClick:()=>R(D,K),disabled:!t||!!w,children:K?"更新":M?"安装合集":"安装"})]},D.id||O)})})]})]})]})}function Ha(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 DF(e){return{version:1,collections:Ha({collections:e})}}function FF(e){const t=String(e||"").trim(),n=t.indexOf(":");return n>=0?t.slice(n+1).trim():t}function MP(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(FF(s)))||""}}function ra(e,t){const n=MP(t);return Array.from(new Set((Array.isArray(e==null?void 0:e.skillKeys)?e.skillKeys:[]).map(r=>n(r)).filter(Boolean)))}function zF(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 BF(e,t){const n=new Set(Array.isArray(t)?t:[]);return(Array.isArray(e)?e:[]).filter(r=>!n.has(r))}function HF(e,t,n){const r=ra(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 WF(e,t,n){const r=String(e).trim().toLowerCase(),s=Ha({collections:n}).find(o=>o.id===r||o.name.toLowerCase()===r);return ra(s,t)}function VF(e,t,n,r){const s=(Array.isArray(n)?n:[]).map(u=>u.key).filter(Boolean),o=String(t).trim().toLowerCase(),a=Ha({collections:r}),l=WF(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 f=MP(n),p=Array.from(new Set(d.map(f).filter(Boolean)));if(s.length>0&&p.length===s.length)return c;const h=new Set(p),y=new Set(l),v=l.length>0&&l.every(g=>h.has(g)),w=a.some(g=>{if(!g.builtin||g.id===o||g.name.toLowerCase()===o)return!1;const k=ra(g,n);return k.length>0&&k.every(b=>h.has(b))});return l.length>0&&w&&!v?c:p}}}catch{}return c}function Ll(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 KF(e){const t=e??"user";return t==="builtin"||t==="admin"?"af-project-card af-project-card--builtin":"af-project-card"}function qF(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 Rx(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 $P(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 UF="project:defaultCardDesc";function LP(e,t){const n=e.description!=null?String(e.description).trim():"";return n!==""?n:t(UF)}function YF(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Bn({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(`(${YF(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 GF(e,t,n){const r=[String(e.id),LP(e,n),$P(e),Rx(e.source,n).label];return e.archived&&r.push(n("project:archived")),r.join(`
|
|
41
|
-
`).toLowerCase()}function JF(e,t,n){return t?GF(e,t,n).includes(t):!0}function XF(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 Fy(e,t){const n=e.trim().toLowerCase();return n?t.filter(Boolean).join(`
|
|
42
|
-
`).toLowerCase().includes(n):!0}function iN(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 oN(e){return e!=null&&e.packageDir?e.packageDir:`marketplace/flow-snippets / ${(e==null?void 0:e.id)||""}`}const QF=["all","agent","control","provide","marketplace"],ZF=["all","agent","control","provide"],OP="agentflow.projects.activityPanelOpen",Tx="agentflow.projects.activitySelected";function ez(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(OP);return e!=="0"}function aN(e){return`${(e==null?void 0:e.flowSource)||"user"}:${(e==null?void 0:e.flowId)||""}`}function tz(){return typeof localStorage>"u"?"":localStorage.getItem(Tx)||""}function jp(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,n])=>({key:t,...n&&typeof n=="object"?n:{}}))}function Hn(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 nz(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 Po(e){return`${(e==null?void 0:e.id)||""}:${(e==null?void 0:e.version)||""}:${(e==null?void 0:e.packageDir)||""}`}function DP(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 FP(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 Mx(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 lN(e,t){return String((e==null?void 0:e.label)||(e==null?void 0:e.displayName)||(e==null?void 0:e.name)||Mx(e,t))}function rz(e){return String((e==null?void 0:e.definitionId)||(e==null?void 0:e.type)||(e==null?void 0:e.runtimeType)||"").replace(/^marketplace:/,"")}function cN(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 sz(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 zy(e,t=16){const n=String(e||"").trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function iz(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 oz(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 f;!r.has(d.sourceId)||!r.has(d.targetId)||(s.set(d.targetId,(s.get(d.targetId)||0)+1),(f=o.get(d.sourceId))==null||f.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 f=l[d],p=(a.get(f)||0)+1;for(const h of o.get(f)||[])(!a.has(h)||p>a.get(h))&&(a.set(h,p),l.push(h))}n.forEach((d,f)=>{a.has(d)||a.set(d,f%3)});const c=new Map,u=new Map;return n.forEach(d=>{const f=a.get(d)||0,p=c.get(f)||0;c.set(f,p+1),u.set(d,{x:f*190,y:p*86})}),u}function az(e){var v,w,g,k;const t=DP(e),n=FP(e),r=new Map(t.map((b,j)=>[Mx(b,j),lN(b,j)])),s=t.map((b,j)=>({id:Mx(b,j),title:lN(b,j),meta:rz(b)})),o=n.map((b,j)=>{const N=cN(b,"source"),C=cN(b,"target");return{key:(b==null?void 0:b.id)||`${N}-${C}-${j}`,sourceId:N,targetId:C,source:r.get(N)||N||"?",target:r.get(C)||C||"?",label:sz(b)}}),a=(w=(v=e==null?void 0:e.snippet)==null?void 0:v.ui)!=null&&w.nodePositions&&typeof e.snippet.ui.nodePositions=="object"?e.snippet.ui.nodePositions:{},l=(k=(g=e==null?void 0:e.snippet)==null?void 0:g.ui)!=null&&k.nodeSizes&&typeof e.snippet.ui.nodeSizes=="object"?e.snippet.ui.nodeSizes:{},c=oz(s,o),u=s.map(b=>{const j=iz(a[b.id])||c.get(b.id)||{x:0,y:0},N=l[b.id]&&typeof l[b.id]=="object"?l[b.id]:{},C=Number(N.width),I=Number(N.height),R=Math.max(132,Math.min(210,Number.isFinite(C)?C*.62:150)),H=Math.max(48,Math.min(76,Number.isFinite(I)?I*.46:54));return{...b,x:j.x,y:j.y,width:R,height:H}}),d=new Map(u.map(b=>[b.id,b])),f=o.map(b=>{const j=d.get(b.sourceId),N=d.get(b.targetId);if(!j||!N)return null;const C=j.x+j.width,I=j.y+j.height/2,R=N.x,H=N.y+N.height/2,A=Math.max(48,Math.abs(R-C)*.45);return{...b,path:`M ${C} ${I} C ${C+A} ${I}, ${R-A} ${H}, ${R} ${H}`,labelX:(C+R)/2,labelY:(I+H)/2}}).filter(Boolean),p=u.reduce((b,j)=>({minX:Math.min(b.minX,j.x),minY:Math.min(b.minY,j.y),maxX:Math.max(b.maxX,j.x+j.width),maxY:Math.max(b.maxY,j.y+j.height)}),{minX:0,minY:0,maxX:420,maxY:220}),h=36,y=`${p.minX-h} ${p.minY-h} ${Math.max(360,p.maxX-p.minX+h*2)} ${Math.max(180,p.maxY-p.minY+h*2)}`;return{nodes:s,edges:o,diagram:{nodes:u,edges:f,viewBox:y}}}function Ol({resourceKind:e="",authUser:t=null}){var Re,kt,Tt,Qt,gn,zn;const{t:n}=$r(),{navigate:r,path:s}=gs(),o=!!(t!=null&&t.isAdmin),[a,l]=m.useState(e||"all"),[c,u]=m.useState([]),[d,f]=m.useState([]),[p,h]=m.useState([]),[y,v]=m.useState([]),[w,g]=m.useState([]),[k,b]=m.useState(""),[j,N]=m.useState(!1),[C,I]=m.useState([]),[R,H]=m.useState(""),[A,L]=m.useState(""),[D,O]=m.useState(!1),[M,K]=m.useState(!1),[z,F]=m.useState(!1),[$,W]=m.useState(null),[E,Q]=m.useState(!1),[V,B]=m.useState(""),[re,ue]=m.useState(ez),[G,ee]=m.useState(tz),[te,ne]=m.useState("all"),[Z,ce]=m.useState(""),[de,me]=m.useState("overview"),[$e,Ce]=m.useState({}),[_e,Be]=m.useState(""),[at,yt]=m.useState({}),[Te,it]=m.useState(""),[gt,$t]=m.useState(""),[be,He]=m.useState({}),[ie,ke]=m.useState(""),[Fe,Ze]=m.useState(""),[Ne,St]=m.useState(""),[Jt,Vt]=m.useState(""),[ot,On]=m.useState(""),[se,Ie]=m.useState(!1),[et,qe]=m.useState(""),[Et,vt]=m.useState({hiddenBuiltins:[],promoted:[]}),Jn=m.useRef(0),mn=m.useRef(0),Lr=m.useRef(0),Vn=m.useCallback(async()=>{var ge,Oe;const q=++mn.current;H("");try{const Ae=await fetch("/api/flows");if(q!==mn.current)return;if(!Ae.ok)throw new Error("HTTP "+Ae.status);const Ye=await Ae.json();if(q!==mn.current)return;u(Array.isArray(Ye)?Ye:[])}catch(Ae){if(q!==mn.current)return;u([]),H(String(Ae.message||Ae))}try{const Ae=await fetch("/api/pipeline-recent-runs");if(q!==mn.current)return;if(Ae.ok){const Ye=await Ae.json();if(q!==mn.current)return;I(Array.isArray(Ye.runs)?Ye.runs:[])}else I([])}catch{if(q!==mn.current)return;I([])}if(t!=null&&t.isAdmin)try{const Ae=await fetch("/api/admin/builtin-flows");if(q!==mn.current)return;const Ye=await Ae.json().catch(()=>({}));Ae.ok&&vt({hiddenBuiltins:Array.isArray((ge=Ye==null?void 0:Ye.config)==null?void 0:ge.hiddenBuiltins)?Ye.config.hiddenBuiltins:[],promoted:Array.isArray((Oe=Ye==null?void 0:Ye.config)==null?void 0:Oe.promoted)?Ye.config.promoted:[]})}catch{if(q!==mn.current)return;vt({hiddenBuiltins:[],promoted:[]})}else vt({hiddenBuiltins:[],promoted:[]});O(!0)},[t==null?void 0:t.isAdmin]),ir=m.useCallback(async(q,ge)=>{if(!(t!=null&&t.isAdmin)||!(q!=null&&q.id))return;const Oe=`${ge}:${q.source}:${q.id}`;qe(Oe),H("");try{const Ae=await fetch("/api/admin/builtin-flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:ge,flowId:q.id,ownerUserId:q.ownerUserId||t.userId})}),Ye=await Ae.json().catch(()=>({}));if(!Ae.ok)throw new Error(Ye.error||"更新内置配置失败");await Vn()}catch(Ae){H(String(Ae.message||Ae))}finally{qe("")}},[t==null?void 0:t.isAdmin,t==null?void 0:t.userId,Vn]),Xn=m.useCallback(async()=>{const q=++Lr.current;L(""),K(!1);const ge="/api/nodes",Oe=e==="my-flows"?"/api/marketplace/flow-snippets?scope=owned":"/api/marketplace/flow-snippets";f([]),v([]),ce("");try{const[Ae,Ye,Zt,At]=await Promise.all([fetch(ge),fetch("/api/skills"),fetch("/api/skill-collections"),fetch(Oe)]),en=await Ae.json().catch(()=>({})),ts=await Ye.json().catch(()=>({})),di=await Zt.json().catch(()=>({})),Ls=await At.json().catch(()=>({}));if(!Ae.ok)throw new Error(en.error||"Nodes HTTP "+Ae.status);if(!Ye.ok)throw new Error(ts.error||"Skills HTTP "+Ye.status);if(!Zt.ok)throw new Error(di.error||"Collections HTTP "+Zt.status);if(!At.ok)throw new Error(Ls.error||"Flow snippets HTTP "+At.status);if(q!==Lr.current)return;f(Array.isArray(en.nodes)?en.nodes:Array.isArray(en)?en:[]),h(Array.isArray(ts.skills)?ts.skills:[]),g(Ha(di)),v(Array.isArray(Ls.snippets)?Ls.snippets:[])}catch(Ae){if(q!==Lr.current)return;f([]),h([]),v([]),g([]),L(String(Ae.message||Ae))}finally{if(q!==Lr.current)return;K(!0)}},[e]);m.useEffect(()=>{O(!1),Vn(),Xn()},[Vn,Xn]),m.useEffect(()=>{try{localStorage.setItem(OP,re?"1":"0")}catch{}},[re]),m.useEffect(()=>{try{G?localStorage.setItem(Tx,G):localStorage.removeItem(Tx)}catch{}},[G]),m.useEffect(()=>{let q=!1;return fetch("/api/ui-context").then(ge=>ge.json()).then(ge=>{q||Ie(!!ge.hideCommunityLinks)}).catch(()=>{}),()=>{q=!0}},[]);const Qn=m.useCallback(async q=>{if(!o)return;const ge=Ha({collections:q});N(!0),L("");try{const Oe=await fetch("/api/skill-collections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(DF(ge))}),Ae=await Oe.json().catch(()=>({}));if(!Oe.ok)throw new Error(Ae.error||"Collections HTTP "+Oe.status);g(Ha(Ae))}catch(Oe){L(String(Oe.message||Oe))}finally{N(!1)}},[o]),Zn=m.useCallback(()=>{if(!o)return;const q=k.trim();if(!q)return;const ge=q.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"collection",Oe=new Set(w.map(At=>At.id));let Ae=ge,Ye=2;for(;Oe.has(Ae);)Ae=`${ge}-${Ye++}`;const Zt=Date.now();Qn([...w,{id:Ae,name:q,skillKeys:[],createdAt:Zt,updatedAt:Zt}]),b(""),ne(`collection:${Ae}`)},[o,k,Qn,w]),Cr=m.useCallback(q=>{if(!o)return;const ge=w.find(Ae=>Ae.id===q);if(ge!=null&&ge.builtin)return;const Oe=w.filter(Ae=>Ae.id!==q);te===`collection:${q}`&&ne("all"),Qn(Oe)},[o,te,Qn,w]),ys=m.useCallback((q,ge,Oe)=>{if(!o)return;const Ae=String(ge||"").trim();if(!Ae)return;const Ye=Date.now(),Zt=w.map(At=>{if(At.id!==q)return At;const en=new Set(At.skillKeys||[]);return Oe?en.add(Ae):en.delete(Ae),{...At,skillKeys:Array.from(en),updatedAt:Ye}});Qn(Zt)},[o,Qn,w]),Ts=m.useCallback(async q=>{const ge=q==null?void 0:q.packageId,Oe=q==null?void 0:q.version;if(!ge||!Oe||!window.confirm(n("project:deleteMyNodeConfirm",{id:ge,version:Oe})))return;const Ae=Hn(q);Ze(Ae),St(""),L("");try{const Ye=new URLSearchParams({id:ge,version:Oe}),Zt=await fetch(`/api/marketplace/node?${Ye.toString()}`,{method:"DELETE"}),At=await Zt.json().catch(()=>({}));if(!Zt.ok||(At==null?void 0:At.ok)===!1){const en=Array.isArray(At==null?void 0:At.usage)&&At.usage.length>0?` ${n("project:deleteMyNodeUsedBy",{count:At.usage.length})}`:"";throw new Error(((At==null?void 0:At.error)||"Delete failed")+en)}St(n("project:deleteMyNodeSuccess",{id:ge,version:Oe})),yt(en=>{const ts={...en};return delete ts[Ae],ts}),He(en=>{const ts={};for(const[di,Ls]of Object.entries(en))di.startsWith(`${Ae}:`)||(ts[di]=Ls);return ts}),ce(""),await Xn()}catch(Ye){St(String(Ye.message||Ye))}finally{Ze("")}},[Xn,n]),Sn=m.useCallback(async q=>{const ge=q==null?void 0:q.id,Oe=(q==null?void 0:q.version)||"1.0.0";if(!ge||!Oe||!window.confirm(n("project:deleteMyFlowConfirm",{id:ge,version:Oe})))return;const Ae=Po(q);Vt(Ae),On(""),L("");try{const Ye=new URLSearchParams({id:ge,version:Oe}),Zt=await fetch(`/api/marketplace/flow-snippet?${Ye.toString()}`,{method:"DELETE"}),At=await Zt.json().catch(()=>({}));if(!Zt.ok||(At==null?void 0:At.ok)===!1)throw new Error((At==null?void 0:At.error)||"Delete failed");On(n("project:deleteMyFlowSuccess",{id:ge,version:Oe})),ce(""),await Xn()}catch(Ye){On(String(Ye.message||Ye))}finally{Vt("")}},[Xn,n]);m.useEffect(()=>{if(e==="nodes"||e==="my-nodes"||e==="my-flows"||e==="skills"){l(e),ne("all"),ce(""),me("overview");return}l(q=>q==="archived"?"archived":"all")},[e]),m.useEffect(()=>{if(s!=="/projects"&&s!=="/")return;const q=new URLSearchParams(window.location.search),ge=q.get("tab");let Oe=!1;if(ge==="nodes"){r("/nodes");return}if(ge==="my-nodes"){r("/my-nodes");return}if(ge==="my-flows"){r("/my-flows");return}if(ge==="skills"){r("/skills");return}if(ge==="archived"?(l("archived"),q.delete("tab"),Oe=!0):ge&&(l("all"),q.delete("tab"),Oe=!0),q.get("new")==="1"&&(F(!0),q.delete("new"),Oe=!0),Oe){const Ae=q.toString();window.history.replaceState({},"",Ae?`/projects?${Ae}`:"/projects")}},[s,r]);const Dn=m.useMemo(()=>ZD(C,XD(),c),[C,c,s]),Zr=m.useMemo(()=>Dn.filter(q=>XF(V,q)),[Dn,V]),Tn=V.trim().toLowerCase(),Fn=m.useMemo(()=>a==="archived"?c.filter(q=>q.archived):c.filter(q=>!q.archived),[c,a]),es=m.useMemo(()=>Fn.filter(q=>JF(q,Tn,n)),[Fn,Tn,n]),Or=m.useMemo(()=>new Set((Et.promoted||[]).map(q=>String((q==null?void 0:q.id)||"").trim()).filter(Boolean)),[Et.promoted]),er=m.useMemo(()=>(Et.hiddenBuiltins||[]).map(q=>String(q||"").trim()).filter(Boolean),[Et.hiddenBuiltins]),Xt=a==="nodes"||a==="my-nodes",jn=a==="my-nodes",le=a==="my-flows",he=m.useMemo(()=>d.filter(q=>jn&&!nz(q,t)?!1:(te==="all"||(te==="marketplace"?q.source==="marketplace":q.type===te))&&Fy(V,[q.id,q.label,q.displayName,q.description,q.type,q.source,q.packageId,q.version])),[t,d,jn,V,te]),nt=m.useMemo(()=>{const q=new Map;for(const ge of w)q.set(ge.id,new Set(ra(ge,p)));return q},[p,w]),ct=m.useMemo(()=>[{id:"all",label:"全部"},...w.map(q=>{var ge;return{id:`collection:${q.id}`,label:q.name,count:((ge=nt.get(q.id))==null?void 0:ge.size)||0,collection:q}}),{id:"ungrouped",label:"未分组"}],[nt,w]),Ft=m.useMemo(()=>p.filter(q=>{var Ae;const ge=Hn(q);let Oe=te==="all";if(te.startsWith("collection:")){const Ye=te.slice(11);Oe=!!((Ae=nt.get(Ye))!=null&&Ae.has(ge))}else te==="ungrouped"&&(Oe=!Array.from(nt.values()).some(Ye=>Ye.has(ge)));return Oe&&Fy(V,[q.name,q.id,q.description,q.sourceLabel,q.source,q.path])}),[p,V,te,nt]),on=m.useMemo(()=>y.filter(q=>Fy(V,[q.id,q.name,q.displayName,q.description,q.version,q.packageDir,Array.isArray(q.tags)?q.tags.join(" "):""])),[y,V]),Dr=Xt||le||a==="skills",wt=m.useMemo(()=>he.find(q=>Hn(q)===Z)||he[0]||null,[he,Z]),Yt=m.useMemo(()=>Ft.find(q=>Hn(q)===Z)||Ft[0]||null,[Ft,Z]),zt=m.useMemo(()=>on.find(q=>Po(q)===Z)||on[0]||null,[on,Z]),tr=Yt?$e[Hn(Yt)]:null,tt=wt?at[Hn(wt)]:null,Mn=wt&>?be[`${Hn(wt)}:${gt}`]:null,Ms=n(Xt?"project:searchNodes":le?"project:searchFlows":a==="skills"?"project:searchSkills":"project:searchPipelines");m.useEffect(()=>{if(a!=="skills"||!Yt)return;const q=Hn(Yt);if($e[q])return;let ge=!1;return Be(q),fetch(`/api/skills/detail?key=${encodeURIComponent(q)}`).then(Oe=>Oe.json().then(Ae=>({ok:Oe.ok,json:Ae}))).then(({ok:Oe,json:Ae})=>{ge||Oe&&Ae.skill&&Ce(Ye=>({...Ye,[q]:Ae.skill}))}).catch(()=>{}).finally(()=>{ge||Be("")}),()=>{ge=!0}},[a,Yt,$e]),m.useEffect(()=>{if(!Xt||!wt)return;const q=Hn(wt);if(at[q])return;let ge=!1;return it(q),fetch(`/api/nodes/detail?id=${encodeURIComponent(wt.id)}`).then(Oe=>Oe.json().then(Ae=>({ok:Oe.ok,json:Ae}))).then(({ok:Oe,json:Ae})=>{ge||Oe&&yt(Ye=>({...Ye,[q]:Ae}))}).catch(()=>{}).finally(()=>{ge||it("")}),()=>{ge=!0}},[Xt,wt,at]),m.useEffect(()=>{if(!Xt)return;const q=Array.isArray(tt==null?void 0:tt.files)?tt.files:[];$t(ge=>{var Oe;return ge&&q.some(Ae=>Ae.path===ge)?ge:((Oe=q[0])==null?void 0:Oe.path)||""})},[Xt,tt]),m.useEffect(()=>{if(!Xt||!wt||!gt)return;const q=`${Hn(wt)}:${gt}`;if(be[q])return;let ge=!1;return ke(q),fetch(`/api/nodes/file?id=${encodeURIComponent(wt.id)}&path=${encodeURIComponent(gt)}`).then(Oe=>Oe.json().then(Ae=>({ok:Oe.ok,json:Ae}))).then(({ok:Oe,json:Ae})=>{ge||Oe&&He(Ye=>({...Ye,[q]:Ae}))}).catch(()=>{}).finally(()=>{ge||ke("")}),()=>{ge=!0}},[Xt,wt,gt,be]),m.useEffect(()=>{St("")},[Z,a]);const ci=q=>{r(Sp(q,"workspace"))},ui=q=>{ee(aN(q)),r(Sp({id:q.flowId,source:q.flowSource,archived:!!q.archived},"workspace"))},xo=m.useCallback(q=>{var ge,Oe;q.preventDefault(),q.stopPropagation(),(Oe=(ge=q.dataTransfer)==null?void 0:ge.types)!=null&&Oe.includes("Files")&&(Jn.current+=1,Q(!0))},[]),$s=m.useCallback(q=>{q.preventDefault(),q.stopPropagation(),Jn.current-=1,Jn.current<=0&&(Jn.current=0,Q(!1))},[]),oe=m.useCallback(q=>{q.preventDefault(),q.stopPropagation()},[]),ve=m.useCallback(q=>{var Ae,Ye;q.preventDefault(),q.stopPropagation(),Jn.current=0,Q(!1);const ge=(Ye=(Ae=q.dataTransfer)==null?void 0:Ae.files)==null?void 0:Ye[0];if(!ge)return;const Oe=ge.name.toLowerCase();!Oe.endsWith(".yaml")&&!Oe.endsWith(".yml")&&!Oe.endsWith(".zip")||W(ge)},[]);return i.jsxs("div",{className:"af-projects"+(E?" af-projects--drop-target":""),onDragEnter:xo,onDragLeave:$s,onDragOver:oe,onDrop:ve,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:Ms,"aria-label":Ms,autoComplete:"off",value:V,onChange:q=>B(q.target.value),onKeyDown:q=>{q.key==="Escape"&&(B(""),q.currentTarget.blur())}}),V.trim()?i.jsx("button",{type:"button",className:"af-search-clear","aria-label":"Clear search",onClick:()=>B(""),children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),Dr?i.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>Xn(),children:n("project:refreshResources")}):i.jsxs(i.Fragment,{children:[i.jsx("button",{type:"button",className:"af-icon-btn"+(re?" af-icon-btn--active":""),"aria-label":n("flow:palette.toggleRecentActivity"),"aria-expanded":re,"aria-controls":"af-recent-activity-panel",onClick:()=>ue(q=>!q),children:i.jsx("span",{className:"material-symbols-outlined",children:"notifications"})}),i.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>F(!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:Tn?n("project:filterResult",{count:a==="nodes"||a==="my-nodes"?he.length:a==="my-flows"?on.length:a==="skills"?Ft.length:es.length}):a==="my-nodes"?n("project:myNodesHint",{count:he.length}):a==="my-flows"?n("project:myFlowsHint",{count:on.length}):a==="nodes"?n("project:nodesHint",{count:d.length}):a==="skills"?n("project:skillsHint",{count:p.length}):n(a==="archived"?"project:archivedHint":"project:activeHint")}),R?i.jsx("p",{className:"af-err af-projects-api-hint",children:R}):null,A&&Dr?i.jsx("p",{className:"af-err af-projects-api-hint",children:A}):null]}),Dr?i.jsxs("div",{className:"af-resource-toolbar",children:[a==="skills"?i.jsx(OF,{onChanged:Xn,canManage:!!(t!=null&&t.isAdmin)}):null,i.jsxs("div",{className:"af-resource-purpose",children:[i.jsx("span",{className:"material-symbols-outlined",children:le?"schema":Xt?jn?"deployed_code":"account_tree":"extension"}),i.jsxs("div",{children:[i.jsx("h3",{children:n(le?"project:myFlowsPurposeTitle":jn?"project:myNodesPurposeTitle":Xt?"project:nodesPurposeTitle":"project:skillsPurposeTitle")}),i.jsx("p",{children:n(le?"project:myFlowsPurposeDesc":jn?"project:myNodesPurposeDesc":Xt?"project:nodesPurposeDesc":"project:skillsPurposeDesc")})]})]}),le?null:i.jsxs(i.Fragment,{children:[Xt?i.jsxs("div",{className:"af-resource-filter-row",children:[i.jsx("button",{type:"button",className:"af-resource-filter"+(jn?"":" af-resource-filter--active"),onClick:()=>{l("nodes"),ne("all"),ce("")},children:n("project:nodeScopeAll")}),i.jsx("button",{type:"button",className:"af-resource-filter"+(jn?" af-resource-filter--active":""),onClick:()=>{l("my-nodes"),ne("all"),ce("")},children:n("project:nodeScopeMine")})]}):null,i.jsx("div",{className:"af-resource-filter-row",children:(Xt?(jn?ZF:QF).map(q=>({id:q,label:n(`project:resourceFilter.${q}`)})):ct).map(q=>q.collection?i.jsxs("span",{className:"af-resource-filter-chip"+(te===q.id?" af-resource-filter-chip--active":""),children:[i.jsxs("button",{type:"button",className:"af-resource-filter af-resource-filter--embedded",onClick:()=>{ne(q.id),ce("")},children:[q.label,i.jsx("em",{children:q.count}),q.collection.builtin?i.jsx("strong",{children:"built-in"}):null]}),o&&!q.collection.builtin?i.jsx("button",{type:"button",className:"af-resource-filter-chip__delete",disabled:j,"aria-label":`删除 ${q.collection.name}`,onClick:()=>Cr(q.collection.id),children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})}):null]},q.id):i.jsx("button",{type:"button",className:"af-resource-filter"+(te===q.id?" af-resource-filter--active":""),onClick:()=>{ne(q.id),ce("")},children:q.label},q.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:k,onChange:q=>b(q.target.value),onKeyDown:q=>{q.key==="Enter"&&Zn()},placeholder:"新建 skill collection"}),i.jsxs("button",{type:"button",className:"af-set-btn-add af-set-btn-add--compact",disabled:!k.trim()||j,onClick:()=>Zn(),children:[i.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新建"]})]})}):null]}):null,Xt?i.jsx("div",{className:"af-resource-grid",children:he.length>0?he.map(q=>i.jsxs("button",{type:"button",className:"af-resource-card"+(wt&&Hn(q)===Hn(wt)?" af-resource-card--active":""),onClick:()=>ce(Hn(q)),children:[i.jsxs("div",{className:"af-resource-card-head",children:[i.jsx("span",{className:Ll(q.type==="control"?"secondary":q.type==="provide"?"primary":"muted"),children:i.jsx(Bn,{query:V,children:q.type||"node"})}),i.jsx("span",{className:"af-resource-source",children:i.jsx(Bn,{query:V,children:iN(q.source,n)})})]}),i.jsx("h3",{className:"af-project-title",children:i.jsx(Bn,{query:V,children:q.label||q.displayName||q.id})}),i.jsx("p",{className:"af-project-desc",children:i.jsx(Bn,{query:V,children:q.description||n("project:noDescription")})}),i.jsxs("div",{className:"af-resource-meta-row",children:[i.jsx("span",{children:i.jsx(Bn,{query:V,children:q.id})}),i.jsx("span",{children:n("project:nodeSlots",{inputs:Object.keys(q.inputs||{}).length,outputs:Object.keys(q.outputs||{}).length})})]}),q.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(Bn,{query:V,children:`${q.packageId}${q.version?` / ${q.version}`:""}`})})]}):null]},`${q.id}:${q.source||""}:${q.packageId||""}`)):M?i.jsx("div",{className:"af-projects-empty-block",children:i.jsx("p",{className:"af-projects-empty",children:Tn?n("project:noNodeMatch",{query:V.trim()}):n(jn?"project:noMyNodes":"project:noNodes")})}):i.jsx("div",{className:"af-projects-empty-block",children:i.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):le?i.jsx("div",{className:"af-resource-grid",children:on.length>0?on.map(q=>{const ge=DP(q),Oe=FP(q),Ae=Number.isFinite(Number(q.nodeCount))?Number(q.nodeCount):ge.length,Ye=Number.isFinite(Number(q.edgeCount))?Number(q.edgeCount):Oe.length;return i.jsxs("button",{type:"button",className:"af-resource-card"+(zt&&Po(q)===Po(zt)?" af-resource-card--active":""),onClick:()=>ce(Po(q)),children:[i.jsxs("div",{className:"af-resource-card-head",children:[i.jsx("span",{className:Ll("primary"),children:i.jsx(Bn,{query:V,children:q.version?`v${q.version}`:"flow"})}),i.jsx("span",{className:"af-resource-source",children:n("project:flowSnippet")})]}),i.jsx("h3",{className:"af-project-title",children:i.jsx(Bn,{query:V,children:q.displayName||q.name||q.id})}),i.jsx("p",{className:"af-project-desc",children:i.jsx(Bn,{query:V,children:q.description||n("project:noDescription")})}),i.jsxs("div",{className:"af-resource-meta-row",children:[i.jsx("span",{children:n("project:flowSnippetNodes",{nodes:Ae,edges:Ye})}),i.jsx("span",{children:i.jsx(Bn,{query:V,children:q.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(Bn,{query:V,children:oN(q)})})]})]},Po(q))}):M?i.jsx("div",{className:"af-projects-empty-block",children:i.jsx("p",{className:"af-projects-empty",children:Tn?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:Ft.length>0?Ft.map(q=>{const ge=Hn(q),Oe=w.filter(Ae=>{var Ye;return(Ye=nt.get(Ae.id))==null?void 0:Ye.has(ge)});return i.jsxs("button",{type:"button",className:"af-resource-card"+(Yt&&ge===Hn(Yt)?" af-resource-card--active":""),onClick:()=>ce(ge),children:[i.jsxs("div",{className:"af-resource-card-head",children:[i.jsx("span",{className:Ll(q.source==="builtin"?"muted":"primary"),children:i.jsx(Bn,{query:V,children:q.sourceLabel||q.source||"skill"})}),i.jsx("span",{className:"af-resource-source",children:n("project:skill")})]}),i.jsx("h3",{className:"af-project-title",children:i.jsx(Bn,{query:V,children:q.name||q.id})}),i.jsx("p",{className:"af-project-desc",children:i.jsx(Bn,{query:V,children:q.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(Bn,{query:V,children:q.path||q.key||""})})]}),i.jsxs("div",{className:"af-skill-card-collections",children:[Oe.slice(0,3).map(Ae=>i.jsx("span",{children:Ae.name},Ae.id)),Oe.length===0?i.jsx("span",{className:"af-skill-card-collection-empty",children:"未分组"}):null]})]},q.key||`${q.source}:${q.name}`)}):M?i.jsx("div",{className:"af-projects-empty-block",children:i.jsx("p",{className:"af-projects-empty",children:Tn?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"&&er.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:er.map(q=>{const ge=et===`show-builtin:builtin:${q}`;return i.jsxs("button",{type:"button",disabled:ge,onClick:()=>ir({id:q,source:"builtin"},"show-builtin"),children:[i.jsx("span",{children:q}),i.jsx("em",{children:ge?"恢复中":"恢复"})]},q)})})]}):null,i.jsxs("div",{className:"af-project-grid",children:[es.length>0?es.map(q=>{var Zt,At;const ge=(t==null?void 0:t.isAdmin)&&q.source==="user"&&!q.archived&&!Or.has(q.id),Oe=(t==null?void 0:t.isAdmin)&&q.source==="admin",Ae=(t==null?void 0:t.isAdmin)&&q.source==="builtin",Ye=et.endsWith(`:${q.source}:${q.id}`);return i.jsx("div",{className:KF(q.source),role:"button",tabIndex:0,onClick:()=>ci(q),onKeyDown:en=>{(en.key==="Enter"||en.key===" ")&&(en.preventDefault(),ci(q))},children:i.jsxs("div",{className:"af-project-card-body",children:[i.jsx("span",{className:Ll(Rx(q.source,n).tone),children:i.jsx(Bn,{query:V,children:Rx(q.source,n).label})}),q.source==="workspace"&&((Zt=q.collaboration)!=null&&Zt.role)?i.jsx("span",{className:Ll(q.collaboration.role==="owner"?"primary":"muted"),children:q.collaboration.role==="owner"?"我创建的":`${q.collaboration.ownerUsername||q.collaboration.ownerId} 分享`}):null,q.archived?i.jsx("span",{className:Ll("muted"),children:i.jsx(Bn,{query:V,children:n("project:archived")})}):null,i.jsx("h3",{className:"af-project-title",children:i.jsx(Bn,{query:V,children:q.id})}),i.jsx("p",{className:"af-project-desc",children:i.jsx(Bn,{query:V,children:LP(q,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(Bn,{query:V,children:$P(q)})})]}),t!=null&&t.isAdmin?i.jsxs("div",{className:"af-project-admin-actions",onClick:en=>en.stopPropagation(),onKeyDown:en=>en.stopPropagation(),children:[ge?i.jsx("button",{type:"button",disabled:Ye,onClick:()=>ir(q,"promote"),children:"设为内置"}):null,Oe?i.jsx("button",{type:"button",disabled:Ye,onClick:()=>ir(q,"unpromote"),children:"取消内置"}):null,Ae?i.jsx("button",{type:"button",disabled:Ye,onClick:()=>ir(q,"hide-builtin"),children:"隐藏内置"}):null]}):null]})},`${q.id}:${q.source??"user"}:${q.archived?"a":""}:${((At=q.collaboration)==null?void 0:At.id)||"own"}`)}):D?Fn.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(R?"project:loadFailed":"project:noPipelines")}),!R&&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:()=>F(!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")})]}),se?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")})]})]})]})]}),Dr?i.jsx("aside",{className:"af-resource-detail","aria-label":n(Xt?"project:nodeDetail":le?"project:flowDetail":"project:skillDetail"),children:Xt&&wt?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:wt.label||wt.displayName||wt.id}),i.jsx("p",{children:wt.id})]})]}),i.jsx("div",{className:"af-resource-detail-tabs",children:["overview","schema","runtime","files","usage"].map(q=>i.jsx("button",{type:"button",className:"af-resource-detail-tab"+(de===q?" af-resource-detail-tab--active":""),onClick:()=>me(q),children:n(`project:nodeDetailTabs.${q}`)},q))}),Te===Hn(wt)?i.jsx("p",{className:"af-resource-detail-desc",children:n("project:loadingResources")}):de==="overview"?i.jsxs(i.Fragment,{children:[i.jsx("p",{className:"af-resource-detail-desc",children:wt.description||((Re=tt==null?void 0:tt.node)==null?void 0:Re.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:wt.type||((kt=tt==null?void 0:tt.node)==null?void 0:kt.type)||"node"})]}),i.jsxs("div",{children:[i.jsx("dt",{children:n("project:detailSource")}),i.jsx("dd",{children:iN(wt.source,n)})]}),wt.packageId?i.jsxs("div",{children:[i.jsx("dt",{children:n("project:detailPackage")}),i.jsx("dd",{children:wt.packageId})]}):null,wt.version?i.jsxs("div",{children:[i.jsx("dt",{children:n("project:detailVersion")}),i.jsx("dd",{children:wt.version})]}):null,wt.packageDir||tt!=null&&tt.baseDir?i.jsxs("div",{children:[i.jsx("dt",{children:n("project:detailPath")}),i.jsx("dd",{children:wt.packageDir||(tt==null?void 0:tt.baseDir)})]}):null,i.jsxs("div",{children:[i.jsx("dt",{children:n("project:detailEditable")}),i.jsx("dd",{children:(tt==null?void 0:tt.readOnly)===!1?n("project:editable"):n("project:readOnly")})]})]}),jn&&wt.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:Fe===Hn(wt),onClick:()=>Ts(wt),children:[i.jsx("span",{className:"material-symbols-outlined",children:"delete"}),Fe===Hn(wt)?n("project:deletingMyNode"):n("project:deleteMyNode")]}),Ne?i.jsx("p",{className:"af-resource-action-message",children:Ne}):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")})]})]}):de==="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")}),jp(((Tt=tt==null?void 0:tt.node)==null?void 0:Tt.inputs)||wt.inputs).length>0?jp(((Qt=tt==null?void 0:tt.node)==null?void 0:Qt.inputs)||wt.inputs).map(q=>i.jsxs("code",{children:[q.name||q.key,q.type?`: ${q.type}`:""]},q.key)):i.jsx("em",{children:n("project:noSlots")})]}),i.jsxs("div",{className:"af-resource-slot-group",children:[i.jsx("span",{children:n("project:nodeOutputs")}),jp(((gn=tt==null?void 0:tt.node)==null?void 0:gn.outputs)||wt.outputs).length>0?jp(((zn=tt==null?void 0:tt.node)==null?void 0:zn.outputs)||wt.outputs).map(q=>i.jsxs("code",{children:[q.name||q.key,q.type?`: ${q.type}`:""]},q.key)):i.jsx("em",{children:n("project:noSlots")})]})]}):de==="runtime"?i.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[i.jsx("h4",{children:n("project:nodeRuntime")}),tt!=null&&tt.runtime?i.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(tt.runtime,null,2)}):i.jsx("p",{children:n("project:noRuntimeManifest")}),tt!=null&&tt.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:tt.body})]}):i.jsx("p",{children:n("project:noNodeBody")})]}):de==="files"?i.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[i.jsx("h4",{children:n("project:nodeFiles")}),Array.isArray(tt==null?void 0:tt.files)&&tt.files.length>0?i.jsxs("div",{className:"af-node-file-browser",children:[i.jsx("div",{className:"af-node-file-list",children:tt.files.map(q=>i.jsxs("button",{type:"button",className:"af-node-file-item"+(gt===q.path?" af-node-file-item--active":""),onClick:()=>$t(q.path),children:[i.jsx("span",{className:"material-symbols-outlined",children:"description"}),i.jsx("span",{children:q.path})]},q.path))}),i.jsxs("pre",{className:"af-resource-skill-preview",children:[ie===`${Hn(wt)}:${gt}`?n("project:loadingResources"):Mn!=null&&Mn.binary?n("project:binaryFile"):(Mn==null?void 0:Mn.content)||n("project:selectNodeFile"),Mn!=null&&Mn.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(tt==null?void 0:tt.usage)&&tt.usage.length>0?i.jsx("div",{className:"af-node-usage-list",children:tt.usage.map(q=>i.jsxs("div",{className:"af-node-usage-item",children:[i.jsx("strong",{children:q.flowId}),i.jsxs("span",{children:[q.flowSource,q.archived?` · ${n("project:archived")}`:""]}),i.jsx("em",{children:q.instances.map(ge=>ge.label||ge.instanceId).join(", ")})]},`${q.flowSource}:${q.flowId}:${q.archived?"a":""}`))}):i.jsx("p",{children:n("project:noNodeUsage")})]})]}):le&&zt?(()=>{const q=az(zt);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:zt.displayName||zt.name||zt.id}),i.jsx("p",{children:zt.id})]})]}),i.jsx("p",{className:"af-resource-detail-desc",children:zt.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:zt.version||"1.0.0"})]}),i.jsxs("div",{children:[i.jsx("dt",{children:n("project:detailPath")}),i.jsx("dd",{children:oN(zt)})]}),i.jsxs("div",{children:[i.jsx("dt",{children:n("project:flowSnippetScale")}),i.jsx("dd",{children:n("project:flowSnippetNodes",{nodes:Number.isFinite(Number(zt.nodeCount))?Number(zt.nodeCount):q.nodes.length,edges:Number.isFinite(Number(zt.edgeCount))?Number(zt.edgeCount):q.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:Jt===Po(zt),onClick:()=>Sn(zt),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"}),Jt===Po(zt)?n("project:deletingMyFlow"):n("project:deleteMyFlow")]}),ot?i.jsx("p",{className:"af-resource-action-message",children:ot}):null]}),i.jsxs("div",{className:"af-resource-detail-section",children:[i.jsx("h4",{children:n("project:flowSnippetPreview")}),q.diagram.nodes.length>0?i.jsx("div",{className:"af-flow-snippet-map",children:i.jsxs("svg",{viewBox:q.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:q.diagram.edges.map(ge=>i.jsxs("g",{children:[i.jsx("path",{d:ge.path}),ge.label?i.jsx("text",{x:ge.labelX,y:ge.labelY-5,textAnchor:"middle",children:zy(ge.label,18)}):null]},ge.key))}),i.jsx("g",{className:"af-flow-snippet-map__nodes",children:q.diagram.nodes.map((ge,Oe)=>i.jsxs("g",{transform:`translate(${ge.x} ${ge.y})`,children:[i.jsx("rect",{width:ge.width,height:ge.height,rx:"10"}),i.jsx("circle",{cx:"19",cy:ge.height/2,r:"12"}),i.jsx("text",{className:"af-flow-snippet-map__node-index",x:"19",y:ge.height/2+4,textAnchor:"middle",children:Oe+1}),i.jsx("text",{className:"af-flow-snippet-map__node-title",x:"40",y:ge.height/2-3,children:zy(ge.title)}),i.jsx("text",{className:"af-flow-snippet-map__node-meta",x:"40",y:ge.height/2+16,children:zy(ge.meta||ge.id,20)})]},ge.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(zt.snippet||{},null,2)})]})]})]})})():a==="skills"&&Yt?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:Yt.name||Yt.id}),i.jsx("p",{children:Yt.sourceLabel||Yt.source})]})]}),i.jsx("p",{className:"af-resource-detail-desc",children:Yt.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:Yt.sourceLabel||Yt.source})]}),i.jsxs("div",{children:[i.jsx("dt",{children:n("project:detailPath")}),i.jsx("dd",{children:Yt.path||Yt.key})]})]}),i.jsxs("div",{className:"af-resource-detail-section",children:[i.jsx("h4",{children:"Collections"}),w.length===0?i.jsx("p",{children:"暂无 collection。可在左侧新建后再添加。"}):i.jsx("div",{className:"af-skill-detail-collections",children:w.map(q=>{const ge=Hn(Yt),Oe=nt.get(q.id)||new Set,Ae=Oe.has(ge);return i.jsxs("label",{className:"af-composer-skill-option af-skill-detail-collection-option",children:[i.jsx("input",{type:"checkbox",checked:Ae,disabled:j||!o,onChange:Ye=>ys(q.id,ge,Ye.target.checked)}),i.jsxs("span",{className:"af-composer-skill-option-main",children:[i.jsx("span",{className:"af-composer-skill-option-title",children:q.name}),i.jsxs("span",{className:"af-composer-skill-option-desc",children:[Oe.size," skills"]})]})]},q.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:_e===Hn(Yt)?n("project:loadingResources"):(tr==null?void 0:tr.body)||(tr==null?void 0:tr.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"+(re?"":" af-activity--hidden"),"aria-hidden":!re,"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:Zr.length===0?i.jsx("p",{className:"af-activity-empty",children:Dn.length===0?n("project:noRecentActivity"):n("project:noMatchRecent")}):Zr.map(q=>{const ge=G===aN(q);return i.jsxs("button",{type:"button",className:"af-activity-row af-activity-row--action"+(ge?" af-activity-row--active":""),"aria-current":ge?"page":void 0,onClick:()=>ui(q),children:[i.jsxs("div",{className:"af-activity-row-top",children:[i.jsx("h4",{className:"af-activity-name",children:i.jsx(Bn,{query:V,children:q.flowId})}),i.jsx("span",{className:"af-activity-time",children:rN(q.at,n)})]}),i.jsxs("div",{className:"af-activity-meta",children:[i.jsx("span",{className:qF(q.kind),children:q.kind==="executed"?"play_arrow":"visibility"}),i.jsxs("p",{className:"af-activity-text",children:[q.kind==="executed"?n("project:recentRun"):n("project:recentOpen")," · ",rN(q.at,n)]})]})]},`${q.kind}-${q.flowId}-${q.flowSource}-${q.at}`)})})]})]}),i.jsx(EF,{open:z,onClose:()=>F(!1),onCreated:async q=>{F(!1),await Vn();const ge=q.source??"user";r(Sp({id:q.id,source:ge},"workspace"))}}),$?i.jsx(CF,{file:$,onClose:()=>W(null),onImported:async q=>{W(null),await Vn();const ge=q.source??"user";r(Sp({id:q.id,source:ge},"workspace"))}},`${$.name}-${$.size}-${$.lastModified}`):null]})}function Gn(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=Gn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var lz={value:()=>{}};function Jm(){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 fh(n)}function fh(e){this._=e}function cz(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}})}fh.prototype=Jm.prototype={constructor:fh,on:function(e,t){var n=this._,r=cz(e+"",n),s,o=-1,a=r.length;if(arguments.length<2){for(;++o<a;)if((s=(e=r[o]).type)&&(s=uz(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]=uN(n[s],e.name,t);else if(t==null)for(s in n)n[s]=uN(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 fh(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 uz(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function uN(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=lz,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var $x="http://www.w3.org/1999/xhtml";const dN={svg:"http://www.w3.org/2000/svg",xhtml:$x,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Xm(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),dN.hasOwnProperty(t)?{space:dN[t],local:e}:e}function dz(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===$x&&t.documentElement.namespaceURI===$x?t.createElement(e):t.createElementNS(n,e)}}function fz(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function zP(e){var t=Xm(e);return(t.local?fz:dz)(t)}function pz(){}function Ik(e){return e==null?pz:function(){return this.querySelector(e)}}function hz(e){typeof e!="function"&&(e=Ik(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 ps(r,this._parents)}function mz(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function gz(){return[]}function BP(e){return e==null?gz:function(){return this.querySelectorAll(e)}}function yz(e){return function(){return mz(e.apply(this,arguments))}}function wz(e){typeof e=="function"?e=yz(e):e=BP(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 ps(r,s)}function HP(e){return function(){return this.matches(e)}}function WP(e){return function(t){return t.matches(e)}}var xz=Array.prototype.find;function bz(e){return function(){return xz.call(this.children,e)}}function kz(){return this.firstElementChild}function vz(e){return this.select(e==null?kz:bz(typeof e=="function"?e:WP(e)))}var Sz=Array.prototype.filter;function jz(){return Array.from(this.children)}function Nz(e){return function(){return Sz.call(this.children,e)}}function Cz(e){return this.selectAll(e==null?jz:Nz(typeof e=="function"?e:WP(e)))}function _z(e){typeof e!="function"&&(e=HP(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 ps(r,this._parents)}function VP(e){return new Array(e.length)}function Ez(){return new ps(this._enter||this._groups.map(VP),this._parents)}function Jh(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Jh.prototype={constructor:Jh,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 Az(e){return function(){return e}}function Pz(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 Jh(e,o[a]);for(;a<c;++a)(l=t[a])&&(s[a]=l)}function Iz(e,t,n,r,s,o,a){var l,c,u=new Map,d=t.length,f=o.length,p=new Array(d),h;for(l=0;l<d;++l)(c=t[l])&&(p[l]=h=a.call(c,c.__data__,l,t)+"",u.has(h)?s[l]=c:u.set(h,c));for(l=0;l<f;++l)h=a.call(e,o[l],l,o)+"",(c=u.get(h))?(r[l]=c,c.__data__=o[l],u.delete(h)):n[l]=new Jh(e,o[l]);for(l=0;l<d;++l)(c=t[l])&&u.get(p[l])===c&&(s[l]=c)}function Rz(e){return e.__data__}function Tz(e,t){if(!arguments.length)return Array.from(this,Rz);var n=t?Iz:Pz,r=this._parents,s=this._groups;typeof e!="function"&&(e=Az(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],f=s[u],p=f.length,h=Mz(e.call(d,d&&d.__data__,u,r)),y=h.length,v=l[u]=new Array(y),w=a[u]=new Array(y),g=c[u]=new Array(p);n(d,f,v,w,g,h,t);for(var k=0,b=0,j,N;k<y;++k)if(j=v[k]){for(k>=b&&(b=k+1);!(N=w[b])&&++b<y;);j._next=N||null}}return a=new ps(a,r),a._enter=l,a._exit=c,a}function Mz(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function $z(){return new ps(this._exit||this._groups.map(VP),this._parents)}function Lz(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 Oz(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],f=u.length,p=l[c]=new Array(f),h,y=0;y<f;++y)(h=u[y]||d[y])&&(p[y]=h);for(;c<s;++c)l[c]=n[c];return new ps(l,this._parents)}function Dz(){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 Fz(e){e||(e=zz);function t(f,p){return f&&p?e(f.__data__,p.__data__):!f-!p}for(var n=this._groups,r=n.length,s=new Array(r),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 ps(s,this._parents).order()}function zz(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Bz(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Hz(){return Array.from(this)}function Wz(){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 Vz(){let e=0;for(const t of this)++e;return e}function Kz(){return!this.node()}function qz(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 Uz(e){return function(){this.removeAttribute(e)}}function Yz(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Gz(e,t){return function(){this.setAttribute(e,t)}}function Jz(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Xz(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Qz(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 Zz(e,t){var n=Xm(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?Yz:Uz:typeof t=="function"?n.local?Qz:Xz:n.local?Jz:Gz)(n,t))}function KP(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function e3(e){return function(){this.style.removeProperty(e)}}function t3(e,t,n){return function(){this.style.setProperty(e,t,n)}}function n3(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function r3(e,t,n){return arguments.length>1?this.each((t==null?e3:typeof t=="function"?n3:t3)(e,t,n??"")):Rc(this.node(),e)}function Rc(e,t){return e.style.getPropertyValue(t)||KP(e).getComputedStyle(e,null).getPropertyValue(t)}function s3(e){return function(){delete this[e]}}function i3(e,t){return function(){this[e]=t}}function o3(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function a3(e,t){return arguments.length>1?this.each((t==null?s3:typeof t=="function"?o3:i3)(e,t)):this.node()[e]}function qP(e){return e.trim().split(/^|\s+/)}function Rk(e){return e.classList||new UP(e)}function UP(e){this._node=e,this._names=qP(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 YP(e,t){for(var n=Rk(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function GP(e,t){for(var n=Rk(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function l3(e){return function(){YP(this,e)}}function c3(e){return function(){GP(this,e)}}function u3(e,t){return function(){(t.apply(this,arguments)?YP:GP)(this,e)}}function d3(e,t){var n=qP(e+"");if(arguments.length<2){for(var r=Rk(this.node()),s=-1,o=n.length;++s<o;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?u3:t?l3:c3)(n,t))}function f3(){this.textContent=""}function p3(e){return function(){this.textContent=e}}function h3(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function m3(e){return arguments.length?this.each(e==null?f3:(typeof e=="function"?h3:p3)(e)):this.node().textContent}function g3(){this.innerHTML=""}function y3(e){return function(){this.innerHTML=e}}function w3(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function x3(e){return arguments.length?this.each(e==null?g3:(typeof e=="function"?w3:y3)(e)):this.node().innerHTML}function b3(){this.nextSibling&&this.parentNode.appendChild(this)}function k3(){return this.each(b3)}function v3(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function S3(){return this.each(v3)}function j3(e){var t=typeof e=="function"?e:zP(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function N3(){return null}function C3(e,t){var n=typeof e=="function"?e:zP(e),r=t==null?N3:typeof t=="function"?t:Ik(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function _3(){var e=this.parentNode;e&&e.removeChild(this)}function E3(){return this.each(_3)}function A3(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function P3(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function I3(e){return this.select(e?P3:A3)}function R3(e){return arguments.length?this.property("__data__",e):this.node().__data__}function T3(e){return function(t){e.call(this,t,this.__data__)}}function M3(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 $3(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 L3(e,t,n){return function(){var r=this.__on,s,o=T3(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 O3(e,t,n){var r=M3(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?L3:$3,s=0;s<o;++s)this.each(l(r[s],t,n));return this}function JP(e,t,n){var r=KP(e),s=r.CustomEvent;typeof s=="function"?s=new s(t,n):(s=r.document.createEvent("Event"),n?(s.initEvent(t,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(t,!1,!1)),e.dispatchEvent(s)}function D3(e,t){return function(){return JP(this,e,t)}}function F3(e,t){return function(){return JP(this,e,t.apply(this,arguments))}}function z3(e,t){return this.each((typeof t=="function"?F3:D3)(e,t))}function*B3(){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 XP=[null];function ps(e,t){this._groups=e,this._parents=t}function mf(){return new ps([[document.documentElement]],XP)}function H3(){return this}ps.prototype=mf.prototype={constructor:ps,select:hz,selectAll:wz,selectChild:vz,selectChildren:Cz,filter:_z,data:Tz,enter:Ez,exit:$z,join:Lz,merge:Oz,selection:H3,order:Dz,sort:Fz,call:Bz,nodes:Hz,node:Wz,size:Vz,empty:Kz,each:qz,attr:Zz,style:r3,property:a3,classed:d3,text:m3,html:x3,raise:k3,lower:S3,append:j3,insert:C3,remove:E3,clone:I3,datum:R3,on:O3,dispatch:z3,[Symbol.iterator]:B3};function as(e){return typeof e=="string"?new ps([[document.querySelector(e)]],[document.documentElement]):new ps([[e]],XP)}function W3(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Gs(e,t){if(e=W3(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 V3={passive:!1},zd={capture:!0,passive:!1};function By(e){e.stopImmediatePropagation()}function yc(e){e.preventDefault(),e.stopImmediatePropagation()}function QP(e){var t=e.document.documentElement,n=as(e).on("dragstart.drag",yc,zd);"onselectstart"in t?n.on("selectstart.drag",yc,zd):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ZP(e,t){var n=e.document.documentElement,r=as(e).on("dragstart.drag",null);t&&(r.on("click.drag",yc,zd),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 Np=e=>()=>e;function Lx(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}})}Lx.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function K3(e){return!e.ctrlKey&&!e.button}function q3(){return this.parentNode}function U3(e,t){return t??{x:e.x,y:e.y}}function Y3(){return navigator.maxTouchPoints||"ontouchstart"in this}function eI(){var e=K3,t=q3,n=U3,r=Y3,s={},o=Jm("start","drag","end"),a=0,l,c,u,d,f=0;function p(j){j.on("mousedown.drag",h).filter(r).on("touchstart.drag",w).on("touchmove.drag",g,V3).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(j,N){if(!(d||!e.call(this,j,N))){var C=b(this,t.call(this,j,N),j,N,"mouse");C&&(as(j.view).on("mousemove.drag",y,zd).on("mouseup.drag",v,zd),QP(j.view),By(j),u=!1,l=j.clientX,c=j.clientY,C("start",j))}}function y(j){if(yc(j),!u){var N=j.clientX-l,C=j.clientY-c;u=N*N+C*C>f}s.mouse("drag",j)}function v(j){as(j.view).on("mousemove.drag mouseup.drag",null),ZP(j.view,u),yc(j),s.mouse("end",j)}function w(j,N){if(e.call(this,j,N)){var C=j.changedTouches,I=t.call(this,j,N),R=C.length,H,A;for(H=0;H<R;++H)(A=b(this,I,j,N,C[H].identifier,C[H]))&&(By(j),A("start",j,C[H]))}}function g(j){var N=j.changedTouches,C=N.length,I,R;for(I=0;I<C;++I)(R=s[N[I].identifier])&&(yc(j),R("drag",j,N[I]))}function k(j){var N=j.changedTouches,C=N.length,I,R;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),I=0;I<C;++I)(R=s[N[I].identifier])&&(By(j),R("end",j,N[I]))}function b(j,N,C,I,R,H){var A=o.copy(),L=Gs(H||C,N),D,O,M;if((M=n.call(j,new Lx("beforestart",{sourceEvent:C,target:p,identifier:R,active:a,x:L[0],y:L[1],dx:0,dy:0,dispatch:A}),I))!=null)return D=M.x-L[0]||0,O=M.y-L[1]||0,function K(z,F,$){var W=L,E;switch(z){case"start":s[R]=K,E=a++;break;case"end":delete s[R],--a;case"drag":L=Gs($||F,N),E=a;break}A.call(z,j,new Lx(z,{sourceEvent:F,subject:M,target:p,identifier:R,active:E,x:L[0]+D,y:L[1]+O,dx:L[0]-W[0],dy:L[1]-W[1],dispatch:A}),I)}}return p.filter=function(j){return arguments.length?(e=typeof j=="function"?j:Np(!!j),p):e},p.container=function(j){return arguments.length?(t=typeof j=="function"?j:Np(j),p):t},p.subject=function(j){return arguments.length?(n=typeof j=="function"?j:Np(j),p):n},p.touchable=function(j){return arguments.length?(r=typeof j=="function"?j:Np(!!j),p):r},p.on=function(){var j=o.on.apply(o,arguments);return j===o?p:j},p.clickDistance=function(j){return arguments.length?(f=(j=+j)*j,p):Math.sqrt(f)},p}function Tk(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function tI(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function gf(){}var Bd=.7,Xh=1/Bd,wc="\\s*([+-]?\\d+)\\s*",Hd="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Pi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",G3=/^#([0-9a-f]{3,8})$/,J3=new RegExp(`^rgb\\(${wc},${wc},${wc}\\)$`),X3=new RegExp(`^rgb\\(${Pi},${Pi},${Pi}\\)$`),Q3=new RegExp(`^rgba\\(${wc},${wc},${wc},${Hd}\\)$`),Z3=new RegExp(`^rgba\\(${Pi},${Pi},${Pi},${Hd}\\)$`),eB=new RegExp(`^hsl\\(${Hd},${Pi},${Pi}\\)$`),tB=new RegExp(`^hsla\\(${Hd},${Pi},${Pi},${Hd}\\)$`),fN={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};Tk(gf,Qa,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:pN,formatHex:pN,formatHex8:nB,formatHsl:rB,formatRgb:hN,toString:hN});function pN(){return this.rgb().formatHex()}function nB(){return this.rgb().formatHex8()}function rB(){return nI(this).formatHsl()}function hN(){return this.rgb().formatRgb()}function Qa(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=G3.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?mN(t):n===3?new qr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Cp(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Cp(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=J3.exec(e))?new qr(t[1],t[2],t[3],1):(t=X3.exec(e))?new qr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Q3.exec(e))?Cp(t[1],t[2],t[3],t[4]):(t=Z3.exec(e))?Cp(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=eB.exec(e))?wN(t[1],t[2]/100,t[3]/100,1):(t=tB.exec(e))?wN(t[1],t[2]/100,t[3]/100,t[4]):fN.hasOwnProperty(e)?mN(fN[e]):e==="transparent"?new qr(NaN,NaN,NaN,0):null}function mN(e){return new qr(e>>16&255,e>>8&255,e&255,1)}function Cp(e,t,n,r){return r<=0&&(e=t=n=NaN),new qr(e,t,n,r)}function sB(e){return e instanceof gf||(e=Qa(e)),e?(e=e.rgb(),new qr(e.r,e.g,e.b,e.opacity)):new qr}function Ox(e,t,n,r){return arguments.length===1?sB(e):new qr(e,t,n,r??1)}function qr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Tk(qr,Ox,tI(gf,{brighter(e){return e=e==null?Xh:Math.pow(Xh,e),new qr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Bd:Math.pow(Bd,e),new qr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new qr(Wa(this.r),Wa(this.g),Wa(this.b),Qh(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:gN,formatHex:gN,formatHex8:iB,formatRgb:yN,toString:yN}));function gN(){return`#${Oa(this.r)}${Oa(this.g)}${Oa(this.b)}`}function iB(){return`#${Oa(this.r)}${Oa(this.g)}${Oa(this.b)}${Oa((isNaN(this.opacity)?1:this.opacity)*255)}`}function yN(){const e=Qh(this.opacity);return`${e===1?"rgb(":"rgba("}${Wa(this.r)}, ${Wa(this.g)}, ${Wa(this.b)}${e===1?")":`, ${e})`}`}function Qh(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Wa(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Oa(e){return e=Wa(e),(e<16?"0":"")+e.toString(16)}function wN(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Qs(e,t,n,r)}function nI(e){if(e instanceof Qs)return new Qs(e.h,e.s,e.l,e.opacity);if(e instanceof gf||(e=Qa(e)),!e)return new Qs;if(e instanceof Qs)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 Qs(a,l,c,e.opacity)}function oB(e,t,n,r){return arguments.length===1?nI(e):new Qs(e,t,n,r??1)}function Qs(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Tk(Qs,oB,tI(gf,{brighter(e){return e=e==null?Xh:Math.pow(Xh,e),new Qs(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Bd:Math.pow(Bd,e),new Qs(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 qr(Hy(e>=240?e-240:e+120,s,r),Hy(e,s,r),Hy(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Qs(xN(this.h),_p(this.s),_p(this.l),Qh(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=Qh(this.opacity);return`${e===1?"hsl(":"hsla("}${xN(this.h)}, ${_p(this.s)*100}%, ${_p(this.l)*100}%${e===1?")":`, ${e})`}`}}));function xN(e){return e=(e||0)%360,e<0?e+360:e}function _p(e){return Math.max(0,Math.min(1,e||0))}function Hy(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 Mk=e=>()=>e;function aB(e,t){return function(n){return e+n*t}}function lB(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 cB(e){return(e=+e)==1?rI:function(t,n){return n-t?lB(t,n,e):Mk(isNaN(t)?n:t)}}function rI(e,t){var n=t-e;return n?aB(e,n):Mk(isNaN(e)?t:e)}const Zh=function e(t){var n=cB(t);function r(s,o){var a=n((s=Ox(s)).r,(o=Ox(o)).r),l=n(s.g,o.g),c=n(s.b,o.b),u=rI(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 uB(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 dB(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function fB(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]=pd(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 pB(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function bi(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function hB(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]=pd(e[s],t[s]):r[s]=t[s];return function(o){for(s in n)r[s]=n[s](o);return r}}var Dx=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Wy=new RegExp(Dx.source,"g");function mB(e){return function(){return e}}function gB(e){return function(t){return e(t)+""}}function sI(e,t){var n=Dx.lastIndex=Wy.lastIndex=0,r,s,o,a=-1,l=[],c=[];for(e=e+"",t=t+"";(r=Dx.exec(e))&&(s=Wy.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:bi(r,s)})),n=Wy.lastIndex;return n<t.length&&(o=t.slice(n),l[a]?l[a]+=o:l[++a]=o),l.length<2?c[0]?gB(c[0].x):mB(t):(t=c.length,function(u){for(var d=0,f;d<t;++d)l[(f=c[d]).i]=f.x(u);return l.join("")})}function pd(e,t){var n=typeof t,r;return t==null||n==="boolean"?Mk(t):(n==="number"?bi:n==="string"?(r=Qa(t))?(t=r,Zh):sI:t instanceof Qa?Zh:t instanceof Date?pB:dB(t)?uB:Array.isArray(t)?fB:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?hB:bi)(e,t)}var bN=180/Math.PI,Fx={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function iI(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)*bN,skewX:Math.atan(c)*bN,scaleX:a,scaleY:l}}var Ep;function yB(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Fx:iI(t.a,t.b,t.c,t.d,t.e,t.f)}function wB(e){return e==null||(Ep||(Ep=document.createElementNS("http://www.w3.org/2000/svg","g")),Ep.setAttribute("transform",e),!(e=Ep.transform.baseVal.consolidate()))?Fx:(e=e.matrix,iI(e.a,e.b,e.c,e.d,e.e,e.f))}function oI(e,t,n,r){function s(u){return u.length?u.pop()+" ":""}function o(u,d,f,p,h,y){if(u!==f||d!==p){var v=h.push("translate(",null,t,null,n);y.push({i:v-4,x:bi(u,f)},{i:v-2,x:bi(d,p)})}else(f||p)&&h.push("translate("+f+t+p+n)}function a(u,d,f,p){u!==d?(u-d>180?d+=360:d-u>180&&(u+=360),p.push({i:f.push(s(f)+"rotate(",null,r)-2,x:bi(u,d)})):d&&f.push(s(f)+"rotate("+d+r)}function l(u,d,f,p){u!==d?p.push({i:f.push(s(f)+"skewX(",null,r)-2,x:bi(u,d)}):d&&f.push(s(f)+"skewX("+d+r)}function c(u,d,f,p,h,y){if(u!==f||d!==p){var v=h.push(s(h)+"scale(",null,",",null,")");y.push({i:v-4,x:bi(u,f)},{i:v-2,x:bi(d,p)})}else(f!==1||p!==1)&&h.push(s(h)+"scale("+f+","+p+")")}return function(u,d){var f=[],p=[];return u=e(u),d=e(d),o(u.translateX,u.translateY,d.translateX,d.translateY,f,p),a(u.rotate,d.rotate,f,p),l(u.skewX,d.skewX,f,p),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,f,p),u=d=null,function(h){for(var y=-1,v=p.length,w;++y<v;)f[(w=p[y]).i]=w.x(h);return f.join("")}}}var xB=oI(yB,"px, ","px)","deg)"),bB=oI(wB,", ",")",")"),kB=1e-12;function kN(e){return((e=Math.exp(e))+1/e)/2}function vB(e){return((e=Math.exp(e))-1/e)/2}function SB(e){return((e=Math.exp(2*e))-1)/(e+1)}const ph=function e(t,n,r){function s(o,a){var l=o[0],c=o[1],u=o[2],d=a[0],f=a[1],p=a[2],h=d-l,y=f-c,v=h*h+y*y,w,g;if(v<kB)g=Math.log(p/u)/t,w=function(I){return[l+I*h,c+I*y,u*Math.exp(t*I*g)]};else{var k=Math.sqrt(v),b=(p*p-u*u+r*v)/(2*u*n*k),j=(p*p-u*u-r*v)/(2*p*n*k),N=Math.log(Math.sqrt(b*b+1)-b),C=Math.log(Math.sqrt(j*j+1)-j);g=(C-N)/t,w=function(I){var R=I*g,H=kN(N),A=u/(n*k)*(H*SB(t*R+N)-vB(N));return[l+A*h,c+A*y,u*H/kN(t*R+N)]}}return w.duration=g*1e3*t/Math.SQRT2,w}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 Tc=0,Gu=0,Mu=0,aI=1e3,em,Ju,tm=0,Za=0,Qm=0,Wd=typeof performance=="object"&&performance.now?performance:Date,lI=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function $k(){return Za||(lI(jB),Za=Wd.now()+Qm)}function jB(){Za=0}function nm(){this._call=this._time=this._next=null}nm.prototype=cI.prototype={constructor:nm,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?$k():+n)+(t==null?0:+t),!this._next&&Ju!==this&&(Ju?Ju._next=this:em=this,Ju=this),this._call=e,this._time=n,zx()},stop:function(){this._call&&(this._call=null,this._time=1/0,zx())}};function cI(e,t,n){var r=new nm;return r.restart(e,t,n),r}function NB(){$k(),++Tc;for(var e=em,t;e;)(t=Za-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Tc}function vN(){Za=(tm=Wd.now())+Qm,Tc=Gu=0;try{NB()}finally{Tc=0,_B(),Za=0}}function CB(){var e=Wd.now(),t=e-tm;t>aI&&(Qm-=t,tm=e)}function _B(){for(var e,t=em,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:em=n);Ju=e,zx(r)}function zx(e){if(!Tc){Gu&&(Gu=clearTimeout(Gu));var t=e-Za;t>24?(e<1/0&&(Gu=setTimeout(vN,e-Wd.now()-Qm)),Mu&&(Mu=clearInterval(Mu))):(Mu||(tm=Wd.now(),Mu=setInterval(CB,aI)),Tc=1,lI(vN))}}function SN(e,t,n){var r=new nm;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var EB=Jm("start","end","cancel","interrupt"),AB=[],uI=0,jN=1,Bx=2,hh=3,NN=4,Hx=5,mh=6;function Zm(e,t,n,r,s,o){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;PB(e,n,{name:t,index:r,group:s,on:EB,tween:AB,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:uI})}function Lk(e,t){var n=ai(e,t);if(n.state>uI)throw new Error("too late; already scheduled");return n}function Oi(e,t){var n=ai(e,t);if(n.state>hh)throw new Error("too late; already running");return n}function ai(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function PB(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=cI(o,0,n.time);function o(u){n.state=jN,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var d,f,p,h;if(n.state!==jN)return c();for(d in r)if(h=r[d],h.name===n.name){if(h.state===hh)return SN(a);h.state===NN?(h.state=mh,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[d]):+d<t&&(h.state=mh,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[d])}if(SN(function(){n.state===hh&&(n.state=NN,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=Bx,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Bx){for(n.state=hh,s=new Array(p=n.tween.length),d=0,f=-1;d<p;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(s[++f]=h);s.length=f+1}}function l(u){for(var d=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=Hx,1),f=-1,p=s.length;++f<p;)s[f].call(e,d);n.state===Hx&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=mh,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function gh(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>Bx&&r.state<Hx,r.state=mh,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}o&&delete e.__transition}}function IB(e){return this.each(function(){gh(this,e)})}function RB(e,t){var n,r;return function(){var s=Oi(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 TB(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var o=Oi(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 MB(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=ai(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?RB:TB)(n,e,t))}function Ok(e,t,n){var r=e._id;return e.each(function(){var s=Oi(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return ai(s,r).value[t]}}function dI(e,t){var n;return(typeof t=="number"?bi:t instanceof Qa?Zh:(n=Qa(t))?(t=n,Zh):sI)(e,t)}function $B(e){return function(){this.removeAttribute(e)}}function LB(e){return function(){this.removeAttributeNS(e.space,e.local)}}function OB(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 DB(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 FB(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 zB(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 BB(e,t){var n=Xm(e),r=n==="transform"?bB:dI;return this.attrTween(e,typeof t=="function"?(n.local?zB:FB)(n,r,Ok(this,"attr."+e,t)):t==null?(n.local?LB:$B)(n):(n.local?DB:OB)(n,r,t))}function HB(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function WB(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function VB(e,t){var n,r;function s(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&WB(e,o)),n}return s._value=t,s}function KB(e,t){var n,r;function s(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&HB(e,o)),n}return s._value=t,s}function qB(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=Xm(e);return this.tween(n,(r.local?VB:KB)(r,t))}function UB(e,t){return function(){Lk(this,e).delay=+t.apply(this,arguments)}}function YB(e,t){return t=+t,function(){Lk(this,e).delay=t}}function GB(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?UB:YB)(t,e)):ai(this.node(),t).delay}function JB(e,t){return function(){Oi(this,e).duration=+t.apply(this,arguments)}}function XB(e,t){return t=+t,function(){Oi(this,e).duration=t}}function QB(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?JB:XB)(t,e)):ai(this.node(),t).duration}function ZB(e,t){if(typeof t!="function")throw new Error;return function(){Oi(this,e).ease=t}}function eH(e){var t=this._id;return arguments.length?this.each(ZB(t,e)):ai(this.node(),t).ease}function tH(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Oi(this,e).ease=n}}function nH(e){if(typeof e!="function")throw new Error;return this.each(tH(this._id,e))}function rH(e){typeof e!="function"&&(e=HP(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 uo(r,this._parents,this._name,this._id)}function sH(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,f=a[l]=new Array(d),p,h=0;h<d;++h)(p=c[h]||u[h])&&(f[h]=p);for(;l<r;++l)a[l]=t[l];return new uo(a,this._parents,this._name,this._id)}function iH(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 oH(e,t,n){var r,s,o=iH(t)?Lk:Oi;return function(){var a=o(this,e),l=a.on;l!==r&&(s=(r=l).copy()).on(t,n),a.on=s}}function aH(e,t){var n=this._id;return arguments.length<2?ai(this.node(),n).on.on(e):this.each(oH(n,e,t))}function lH(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function cH(){return this.on("end.remove",lH(this._id))}function uH(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ik(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,f,p=0;p<c;++p)(d=l[p])&&(f=e.call(d,d.__data__,p,l))&&("__data__"in d&&(f.__data__=d.__data__),u[p]=f,Zm(u[p],t,n,p,u,ai(d,n)));return new uo(o,this._parents,t,n)}function dH(e){var t=this._name,n=this._id;typeof e!="function"&&(e=BP(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,f=0;f<u;++f)if(d=c[f]){for(var p=e.call(d,d.__data__,f,c),h,y=ai(d,n),v=0,w=p.length;v<w;++v)(h=p[v])&&Zm(h,t,n,v,p,y);o.push(p),a.push(d)}return new uo(o,a,t,n)}var fH=mf.prototype.constructor;function pH(){return new fH(this._groups,this._parents)}function hH(e,t){var n,r,s;return function(){var o=Rc(this,e),a=(this.style.removeProperty(e),Rc(this,e));return o===a?null:o===n&&a===r?s:s=t(n=o,r=a)}}function fI(e){return function(){this.style.removeProperty(e)}}function mH(e,t,n){var r,s=n+"",o;return function(){var a=Rc(this,e);return a===s?null:a===r?o:o=t(r=a,n)}}function gH(e,t,n){var r,s,o;return function(){var a=Rc(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),Rc(this,e))),a===c?null:a===r&&c===s?o:(s=c,o=t(r=a,l))}}function yH(e,t){var n,r,s,o="style."+t,a="end."+o,l;return function(){var c=Oi(this,e),u=c.on,d=c.value[o]==null?l||(l=fI(t)):void 0;(u!==n||s!==d)&&(r=(n=u).copy()).on(a,s=d),c.on=r}}function wH(e,t,n){var r=(e+="")=="transform"?xB:dI;return t==null?this.styleTween(e,hH(e,r)).on("end.style."+e,fI(e)):typeof t=="function"?this.styleTween(e,gH(e,r,Ok(this,"style."+e,t))).each(yH(this._id,e)):this.styleTween(e,mH(e,r,t),n).on("end.style."+e,null)}function xH(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function bH(e,t,n){var r,s;function o(){var a=t.apply(this,arguments);return a!==s&&(r=(s=a)&&xH(e,a,n)),r}return o._value=t,o}function kH(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,bH(e,t,n??""))}function vH(e){return function(){this.textContent=e}}function SH(e){return function(){var t=e(this);this.textContent=t??""}}function jH(e){return this.tween("text",typeof e=="function"?SH(Ok(this,"text",e)):vH(e==null?"":e+""))}function NH(e){return function(t){this.textContent=e.call(this,t)}}function CH(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&NH(s)),t}return r._value=e,r}function _H(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,CH(e))}function EH(){for(var e=this._name,t=this._id,n=pI(),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=ai(c,t);Zm(c,e,n,u,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new uo(r,this._parents,e,n)}function AH(){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=Oi(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 PH=0;function uo(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function pI(){return++PH}var Ki=mf.prototype;uo.prototype={constructor:uo,select:uH,selectAll:dH,selectChild:Ki.selectChild,selectChildren:Ki.selectChildren,filter:rH,merge:sH,selection:pH,transition:EH,call:Ki.call,nodes:Ki.nodes,node:Ki.node,size:Ki.size,empty:Ki.empty,each:Ki.each,on:aH,attr:BB,attrTween:qB,style:wH,styleTween:kH,text:jH,textTween:_H,remove:cH,tween:MB,delay:GB,duration:QB,ease:eH,easeVarying:nH,end:AH,[Symbol.iterator]:Ki[Symbol.iterator]};function IH(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var RH={time:null,delay:0,duration:250,ease:IH};function TH(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 MH(e){var t,n;e instanceof uo?(t=e._id,e=e._name):(t=pI(),(n=RH).time=$k(),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])&&Zm(c,e,t,u,a,n||TH(c,t));return new uo(r,this._parents,e,t)}mf.prototype.interrupt=IB;mf.prototype.transition=MH;const Ap=e=>()=>e;function $H(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 Zi(e,t,n){this.k=e,this.x=t,this.y=n}Zi.prototype={constructor:Zi,scale:function(e){return e===1?this:new Zi(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Zi(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 eg=new Zi(1,0,0);hI.prototype=Zi.prototype;function hI(e){for(;!e.__zoom;)if(!(e=e.parentNode))return eg;return e.__zoom}function Vy(e){e.stopImmediatePropagation()}function $u(e){e.preventDefault(),e.stopImmediatePropagation()}function LH(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function OH(){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 CN(){return this.__zoom||eg}function DH(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function FH(){return navigator.maxTouchPoints||"ontouchstart"in this}function zH(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 mI(){var e=LH,t=OH,n=zH,r=DH,s=FH,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=ph,u=Jm("start","zoom","end"),d,f,p,h=500,y=150,v=0,w=10;function g(M){M.property("__zoom",CN).on("wheel.zoom",R,{passive:!1}).on("mousedown.zoom",H).on("dblclick.zoom",A).filter(s).on("touchstart.zoom",L).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(M,K,z,F){var $=M.selection?M.selection():M;$.property("__zoom",CN),M!==$?N(M,K,z,F):$.interrupt().each(function(){C(this,arguments).event(F).start().zoom(null,typeof K=="function"?K.apply(this,arguments):K).end()})},g.scaleBy=function(M,K,z,F){g.scaleTo(M,function(){var $=this.__zoom.k,W=typeof K=="function"?K.apply(this,arguments):K;return $*W},z,F)},g.scaleTo=function(M,K,z,F){g.transform(M,function(){var $=t.apply(this,arguments),W=this.__zoom,E=z==null?j($):typeof z=="function"?z.apply(this,arguments):z,Q=W.invert(E),V=typeof K=="function"?K.apply(this,arguments):K;return n(b(k(W,V),E,Q),$,a)},z,F)},g.translateBy=function(M,K,z,F){g.transform(M,function(){return n(this.__zoom.translate(typeof K=="function"?K.apply(this,arguments):K,typeof z=="function"?z.apply(this,arguments):z),t.apply(this,arguments),a)},null,F)},g.translateTo=function(M,K,z,F,$){g.transform(M,function(){var W=t.apply(this,arguments),E=this.__zoom,Q=F==null?j(W):typeof F=="function"?F.apply(this,arguments):F;return n(eg.translate(Q[0],Q[1]).scale(E.k).translate(typeof K=="function"?-K.apply(this,arguments):-K,typeof z=="function"?-z.apply(this,arguments):-z),W,a)},F,$)};function k(M,K){return K=Math.max(o[0],Math.min(o[1],K)),K===M.k?M:new Zi(K,M.x,M.y)}function b(M,K,z){var F=K[0]-z[0]*M.k,$=K[1]-z[1]*M.k;return F===M.x&&$===M.y?M:new Zi(M.k,F,$)}function j(M){return[(+M[0][0]+ +M[1][0])/2,(+M[0][1]+ +M[1][1])/2]}function N(M,K,z,F){M.on("start.zoom",function(){C(this,arguments).event(F).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(F).end()}).tween("zoom",function(){var $=this,W=arguments,E=C($,W).event(F),Q=t.apply($,W),V=z==null?j(Q):typeof z=="function"?z.apply($,W):z,B=Math.max(Q[1][0]-Q[0][0],Q[1][1]-Q[0][1]),re=$.__zoom,ue=typeof K=="function"?K.apply($,W):K,G=c(re.invert(V).concat(B/re.k),ue.invert(V).concat(B/ue.k));return function(ee){if(ee===1)ee=ue;else{var te=G(ee),ne=B/te[2];ee=new Zi(ne,V[0]-te[0]*ne,V[1]-te[1]*ne)}E.zoom(null,ee)}})}function C(M,K,z){return!z&&M.__zooming||new I(M,K)}function I(M,K){this.that=M,this.args=K,this.active=0,this.sourceEvent=null,this.extent=t.apply(M,K),this.taps=0}I.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,K){return this.mouse&&M!=="mouse"&&(this.mouse[1]=K.invert(this.mouse[0])),this.touch0&&M!=="touch"&&(this.touch0[1]=K.invert(this.touch0[0])),this.touch1&&M!=="touch"&&(this.touch1[1]=K.invert(this.touch1[0])),this.that.__zoom=K,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(M){var K=as(this.that).datum();u.call(M,this.that,new $H(M,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:u}),K)}};function R(M,...K){if(!e.apply(this,arguments))return;var z=C(this,K).event(M),F=this.__zoom,$=Math.max(o[0],Math.min(o[1],F.k*Math.pow(2,r.apply(this,arguments)))),W=Gs(M);if(z.wheel)(z.mouse[0][0]!==W[0]||z.mouse[0][1]!==W[1])&&(z.mouse[1]=F.invert(z.mouse[0]=W)),clearTimeout(z.wheel);else{if(F.k===$)return;z.mouse=[W,F.invert(W)],gh(this),z.start()}$u(M),z.wheel=setTimeout(E,y),z.zoom("mouse",n(b(k(F,$),z.mouse[0],z.mouse[1]),z.extent,a));function E(){z.wheel=null,z.end()}}function H(M,...K){if(p||!e.apply(this,arguments))return;var z=M.currentTarget,F=C(this,K,!0).event(M),$=as(M.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",B,!0),W=Gs(M,z),E=M.clientX,Q=M.clientY;QP(M.view),Vy(M),F.mouse=[W,this.__zoom.invert(W)],gh(this),F.start();function V(re){if($u(re),!F.moved){var ue=re.clientX-E,G=re.clientY-Q;F.moved=ue*ue+G*G>v}F.event(re).zoom("mouse",n(b(F.that.__zoom,F.mouse[0]=Gs(re,z),F.mouse[1]),F.extent,a))}function B(re){$.on("mousemove.zoom mouseup.zoom",null),ZP(re.view,F.moved),$u(re),F.event(re).end()}}function A(M,...K){if(e.apply(this,arguments)){var z=this.__zoom,F=Gs(M.changedTouches?M.changedTouches[0]:M,this),$=z.invert(F),W=z.k*(M.shiftKey?.5:2),E=n(b(k(z,W),F,$),t.apply(this,K),a);$u(M),l>0?as(this).transition().duration(l).call(N,E,F,M):as(this).call(g.transform,E,F,M)}}function L(M,...K){if(e.apply(this,arguments)){var z=M.touches,F=z.length,$=C(this,K,M.changedTouches.length===F).event(M),W,E,Q,V;for(Vy(M),E=0;E<F;++E)Q=z[E],V=Gs(Q,this),V=[V,this.__zoom.invert(V),Q.identifier],$.touch0?!$.touch1&&$.touch0[2]!==V[2]&&($.touch1=V,$.taps=0):($.touch0=V,W=!0,$.taps=1+!!d);d&&(d=clearTimeout(d)),W&&($.taps<2&&(f=V[0],d=setTimeout(function(){d=null},h)),gh(this),$.start())}}function D(M,...K){if(this.__zooming){var z=C(this,K).event(M),F=M.changedTouches,$=F.length,W,E,Q,V;for($u(M),W=0;W<$;++W)E=F[W],Q=Gs(E,this),z.touch0&&z.touch0[2]===E.identifier?z.touch0[0]=Q:z.touch1&&z.touch1[2]===E.identifier&&(z.touch1[0]=Q);if(E=z.that.__zoom,z.touch1){var B=z.touch0[0],re=z.touch0[1],ue=z.touch1[0],G=z.touch1[1],ee=(ee=ue[0]-B[0])*ee+(ee=ue[1]-B[1])*ee,te=(te=G[0]-re[0])*te+(te=G[1]-re[1])*te;E=k(E,Math.sqrt(ee/te)),Q=[(B[0]+ue[0])/2,(B[1]+ue[1])/2],V=[(re[0]+G[0])/2,(re[1]+G[1])/2]}else if(z.touch0)Q=z.touch0[0],V=z.touch0[1];else return;z.zoom("touch",n(b(E,Q,V),z.extent,a))}}function O(M,...K){if(this.__zooming){var z=C(this,K).event(M),F=M.changedTouches,$=F.length,W,E;for(Vy(M),p&&clearTimeout(p),p=setTimeout(function(){p=null},h),W=0;W<$;++W)E=F[W],z.touch0&&z.touch0[2]===E.identifier?delete z.touch0:z.touch1&&z.touch1[2]===E.identifier&&delete z.touch1;if(z.touch1&&!z.touch0&&(z.touch0=z.touch1,delete z.touch1),z.touch0)z.touch0[1]=this.__zoom.invert(z.touch0[0]);else if(z.end(),z.taps===2&&(E=Gs(E,this),Math.hypot(f[0]-E[0],f[1]-E[1])<w)){var Q=as(this).on("dblclick.zoom");Q&&Q.apply(this,arguments)}}}return g.wheelDelta=function(M){return arguments.length?(r=typeof M=="function"?M:Ap(+M),g):r},g.filter=function(M){return arguments.length?(e=typeof M=="function"?M:Ap(!!M),g):e},g.touchable=function(M){return arguments.length?(s=typeof M=="function"?M:Ap(!!M),g):s},g.extent=function(M){return arguments.length?(t=typeof M=="function"?M:Ap([[+M[0][0],+M[0][1]],[+M[1][0],+M[1][1]]]),g):t},g.scaleExtent=function(M){return arguments.length?(o[0]=+M[0],o[1]=+M[1],g):[o[0],o[1]]},g.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],g):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},g.constrain=function(M){return arguments.length?(n=M,g):n},g.duration=function(M){return arguments.length?(l=+M,g):l},g.interpolate=function(M){return arguments.length?(c=M,g):c},g.on=function(){var M=u.on.apply(u,arguments);return M===u?g:M},g.clickDistance=function(M){return arguments.length?(v=(M=+M)*M,g):Math.sqrt(v)},g.tapDistance=function(M){return arguments.length?(w=+M,g):w},g}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."},Vd=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],gI=["Enter"," ","Escape"],yI={"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 Mc;(function(e){e.Strict="strict",e.Loose="loose"})(Mc||(Mc={}));var Va;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Va||(Va={}));var Kd;(function(e){e.Partial="partial",e.Full="full"})(Kd||(Kd={}));const wI={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Fo;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Fo||(Fo={}));var ji;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(ji||(ji={}));var Ue;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ue||(Ue={}));const _N={[Ue.Left]:Ue.Right,[Ue.Right]:Ue.Left,[Ue.Top]:Ue.Bottom,[Ue.Bottom]:Ue.Top};function xI(e){return e===null?null:e?"valid":"invalid"}const bI=e=>"id"in e&&"source"in e&&"target"in e,BH=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Dk=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),yf=(e,t=[0,0])=>{const{width:n,height:r}=go(e),s=e.origin??t,o=n*s[0],a=r*s[1];return{x:e.position.x-o,y:e.position.y-a}},HH=(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):Dk(s)?s:t.nodeLookup.get(s.id));const l=a?rm(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return tg(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return ng(n)},wf=(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=tg(n,rm(s)),r=!0)}),r?ng(n):{x:0,y:0,width:0,height:0}},Fk=(e,t,[n,r,s]=[0,0,1],o=!1,a=!1)=>{const l={...bf(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const u of e.values()){const{measured:d,selectable:f=!0,hidden:p=!1}=u;if(a&&!f||p)continue;const h=d.width??u.width??u.initialWidth??null,y=d.height??u.height??u.initialHeight??null,v=qd(l,Lc(u)),w=(h??0)*(y??0),g=o&&v>0;(!u.internals.handleBounds||g||v>=w||u.dragging)&&c.push(u)}return c},WH=(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 VH(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 KH({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:o},a){if(e.size===0)return Promise.resolve(!0);const l=VH(e,a),c=wf(l),u=zk(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 kI({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 f=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!l)o==null||o("005",$i.error005());else{const h=l.measured.width,y=l.measured.height;h&&y&&(f=[[c,u],[c+h,u+y]])}else l&&Oc(a.extent)&&(f=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const p=Oc(f)?el(t,f,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(o==null||o("015",$i.error015())),{position:{x:p.x-c+(a.measured.width??0)*d[0],y:p.y-u+(a.measured.height??0)*d[1]},positionAbsolute:p}}async function qH({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const o=new Set(e.map(p=>p.id)),a=[];for(const p of n){if(p.deletable===!1)continue;const h=o.has(p.id),y=!h&&p.parentId&&a.find(v=>v.id===p.parentId);(h||y)&&a.push(p)}const l=new Set(t.map(p=>p.id)),c=r.filter(p=>p.deletable!==!1),d=WH(a,c);for(const p of c)l.has(p.id)&&!d.find(y=>y.id===p.id)&&d.push(p);if(!s)return{edges:d,nodes:a};const f=await s({nodes:a,edges:d});return typeof f=="boolean"?f?{edges:d,nodes:a}:{edges:[],nodes:[]}:f}const $c=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),el=(e={x:0,y:0},t,n)=>({x:$c(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:$c(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function vI(e,t,n){const{width:r,height:s}=go(n),{x:o,y:a}=n.internals.positionAbsolute;return el(e,[[o,a],[o+r,a+s]],t)}const EN=(e,t,n)=>e<t?$c(Math.abs(e-t),1,t)/t:e>n?-$c(Math.abs(e-n),1,t)/t:0,SI=(e,t,n=15,r=40)=>{const s=EN(e.x,r,t.width-r)*n,o=EN(e.y,r,t.height-r)*n;return[s,o]},tg=(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)}),Wx=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),ng=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Lc=(e,t=[0,0])=>{var s,o;const{x:n,y:r}=Dk(e)?e.internals.positionAbsolute:yf(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}},rm=(e,t=[0,0])=>{var s,o;const{x:n,y:r}=Dk(e)?e.internals.positionAbsolute:yf(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)}},jI=(e,t)=>ng(tg(Wx(e),Wx(t))),qd=(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)},AN=e=>Zs(e.width)&&Zs(e.height)&&Zs(e.x)&&Zs(e.y),Zs=e=>!isNaN(e)&&isFinite(e),UH=(e,t)=>{},xf=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),bf=({x:e,y:t},[n,r,s],o=!1,a=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return o?xf(l,a):l},sm=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function Dl(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 YH(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Dl(e,n),s=Dl(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=Dl(e.top??e.y??0,n),s=Dl(e.bottom??e.y??0,n),o=Dl(e.left??e.x??0,t),a=Dl(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 GH(e,t,n,r,s,o){const{x:a,y:l}=sm(e,[t,n,r]),{x:c,y:u}=sm({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=s-c,f=o-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(d),bottom:Math.floor(f)}}const zk=(e,t,n,r,s,o)=>{const a=YH(o,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),d=$c(u,r,s),f=e.x+e.width/2,p=e.y+e.height/2,h=t/2-f*d,y=n/2-p*d,v=GH(e,h,y,d,t,n),w={left:Math.min(v.left-a.left,0),top:Math.min(v.top-a.top,0),right:Math.min(v.right-a.right,0),bottom:Math.min(v.bottom-a.bottom,0)};return{x:h-w.left+w.right,y:y-w.top+w.bottom,zoom:d}},Ud=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Oc(e){return e!=null&&e!=="parent"}function go(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 NI(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 CI(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 PN(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function JH(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function XH(e){return{...yI,...e||{}}}function hd(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:o,y:a}=ei(e),l=bf({x:o-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},r),{x:c,y:u}=n?xf(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const Bk=e=>({width:e.offsetWidth,height:e.offsetHeight}),_I=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},QH=["INPUT","SELECT","TEXTAREA"];function EI(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:QH.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const AI=e=>"clientX"in e,ei=(e,t)=>{var o,a;const n=AI(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)}},IN=(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,...Bk(a)}})};function PI({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),f=Math.abs(u-t);return[c,u,d,f]}function Pp(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function RN({pos:e,x1:t,y1:n,x2:r,y2:s,c:o}){switch(e){case Ue.Left:return[t-Pp(t-r,o),n];case Ue.Right:return[t+Pp(r-t,o),n];case Ue.Top:return[t,n-Pp(n-s,o)];case Ue.Bottom:return[t,n+Pp(s-n,o)]}}function II({sourceX:e,sourceY:t,sourcePosition:n=Ue.Bottom,targetX:r,targetY:s,targetPosition:o=Ue.Top,curvature:a=.25}){const[l,c]=RN({pos:n,x1:e,y1:t,x2:r,y2:s,c:a}),[u,d]=RN({pos:o,x1:r,y1:s,x2:e,y2:t,c:a}),[f,p,h,y]=PI({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}`,f,p,h,y]}function RI({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 ZH({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 e4({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const o=tg(rm(e),rm(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 qd(a,ng(o))>0}const t4=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,n4=(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)),yh=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||t4;let s;return bI(e)?s={...e}:s={...e,id:r(e)},n4(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function TI({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,o,a,l]=RI({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,o,a,l]}const TN={[Ue.Left]:{x:-1,y:0},[Ue.Right]:{x:1,y:0},[Ue.Top]:{x:0,y:-1},[Ue.Bottom]:{x:0,y:1}},r4=({source:e,sourcePosition:t=Ue.Bottom,target:n})=>t===Ue.Left||t===Ue.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},MN=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function s4({source:e,sourcePosition:t=Ue.Bottom,target:n,targetPosition:r=Ue.Top,center:s,offset:o,stepPosition:a}){const l=TN[t],c=TN[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},f=r4({source:u,sourcePosition:t,target:d}),p=f.x!==0?"x":"y",h=f[p];let y=[],v,w;const g={x:0,y:0},k={x:0,y:0},[,,b,j]=RI({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[p]*c[p]===-1){p==="x"?(v=s.x??u.x+(d.x-u.x)*a,w=s.y??(u.y+d.y)/2):(v=s.x??(u.x+d.x)/2,w=s.y??u.y+(d.y-u.y)*a);const R=[{x:v,y:u.y},{x:v,y:d.y}],H=[{x:u.x,y:w},{x:d.x,y:w}];l[p]===h?y=p==="x"?R:H:y=p==="x"?H:R}else{const R=[{x:u.x,y:d.y}],H=[{x:d.x,y:u.y}];if(p==="x"?y=l.x===h?H:R:y=l.y===h?R:H,t===r){const M=Math.abs(e[p]-n[p]);if(M<=o){const K=Math.min(o-1,o-M);l[p]===h?g[p]=(u[p]>e[p]?-1:1)*K:k[p]=(d[p]>n[p]?-1:1)*K}}if(t!==r){const M=p==="x"?"y":"x",K=l[p]===c[M],z=u[M]>d[M],F=u[M]<d[M];(l[p]===1&&(!K&&z||K&&F)||l[p]!==1&&(!K&&F||K&&z))&&(y=p==="x"?R:H)}const A={x:u.x+g.x,y:u.y+g.y},L={x:d.x+k.x,y:d.y+k.y},D=Math.max(Math.abs(A.x-y[0].x),Math.abs(L.x-y[0].x)),O=Math.max(Math.abs(A.y-y[0].y),Math.abs(L.y-y[0].y));D>=O?(v=(A.x+L.x)/2,w=y[0].y):(v=y[0].x,w=(A.y+L.y)/2)}const N={x:u.x+g.x,y:u.y+g.y},C={x:d.x+k.x,y:d.y+k.y};return[[e,...N.x!==y[0].x||N.y!==y[0].y?[N]:[],...y,...C.x!==y[y.length-1].x||C.y!==y[y.length-1].y?[C]:[],n],v,w,b,j]}function i4(e,t,n,r){const s=Math.min(MN(e,t)/2,MN(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=Ue.Bottom,targetX:r,targetY:s,targetPosition:o=Ue.Top,borderRadius:a=5,centerX:l,centerY:c,offset:u=20,stepPosition:d=.5}){const[f,p,h,y,v]=s4({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:o,center:{x:l,y:c},offset:u,stepPosition:d});let w=`M${f[0].x} ${f[0].y}`;for(let g=1;g<f.length-1;g++)w+=i4(f[g-1],f[g],f[g+1],a);return w+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[w,p,h,y,v]}function $N(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function o4(e){var f;const{sourceNode:t,targetNode:n}=e;if(!$N(t)||!$N(n))return null;const r=t.internals.handleBounds||LN(t.handles),s=n.internals.handleBounds||LN(n.handles),o=ON((r==null?void 0:r.source)??[],e.sourceHandle),a=ON(e.connectionMode===Mc.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(f=e.onError)==null||f.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)||Ue.Bottom,c=(a==null?void 0:a.position)||Ue.Top,u=tl(t,o,l),d=tl(n,a,c);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:l,targetPosition:c}}function LN(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 tl(e,t,n=Ue.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??go(e);if(r)return{x:s+a/2,y:o+l/2};switch((t==null?void 0:t.position)??n){case Ue.Top:return{x:s+a/2,y:o};case Ue.Right:return{x:s+a,y:o+l/2};case Ue.Bottom:return{x:s+a/2,y:o+l};case Ue.Left:return{x:s,y:o+l/2}}}function ON(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Kx(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function a4(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=Kx(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 MI=1e3,l4=10,Hk={nodeOrigin:[0,0],nodeExtent:Vd,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},c4={...Hk,checkEquality:!0};function Wk(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function u4(e,t,n){const r=Wk(Hk,n);for(const s of e.values())if(s.parentId)Kk(s,e,t,r);else{const o=yf(s,r.nodeOrigin),a=Oc(s.extent)?s.extent:r.nodeExtent,l=el(o,a,go(s));s.internals.positionAbsolute=l}}function d4(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 Vk(e){return e==="manual"}function qx(e,t,n,r={}){var d,f;const s=Wk(c4,r),o={i:0},a=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!Vk(s.zIndexMode)?MI:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const p of e){let h=a.get(p.id);if(s.checkEquality&&p===(h==null?void 0:h.internals.userNode))t.set(p.id,h);else{const y=yf(p,s.nodeOrigin),v=Oc(p.extent)?p.extent:s.nodeExtent,w=el(y,v,go(p));h={...s.defaults,...p,measured:{width:(d=p.measured)==null?void 0:d.width,height:(f=p.measured)==null?void 0:f.height},internals:{positionAbsolute:w,handleBounds:d4(p,h),z:$I(p,l,s.zIndexMode),userNode:p}},t.set(p.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),p.parentId&&Kk(h,t,n,r,o),u||(u=p.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function f4(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}=Wk(Hk,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}f4(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*l4),s&&d.internals.rootParentIndex!==void 0&&(s.i=d.internals.rootParentIndex);const f=o&&!Vk(c)?MI:0,{x:p,y:h,z:y}=p4(e,d,a,l,f,c),{positionAbsolute:v}=e.internals,w=p!==v.x||h!==v.y;(w||y!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:p,y:h}:v,z:y}})}function $I(e,t,n){const r=Zs(e.zIndex)?e.zIndex:0;return Vk(n)?r:r+(e.selected?t:0)}function p4(e,t,n,r,s,o){const{x:a,y:l}=t.internals.positionAbsolute,c=go(e),u=yf(e,n),d=Oc(e.extent)?el(u,e.extent,c):u;let f=el({x:a+d.x,y:l+d.y},r,c);e.extent==="parent"&&(f=vI(f,c,t));const p=$I(e,s,o),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=p?h+1:p}}function qk(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)??Lc(c),d=jI(u,l.rect);o.set(l.parentId,{expandedRect:d,parent:c})}return o.size>0&&o.forEach(({expandedRect:l,parent:c},u)=>{var b;const d=c.internals.positionAbsolute,f=go(c),p=c.origin??r,h=l.x<d.x?Math.round(Math.abs(d.x-l.x)):0,y=l.y<d.y?Math.round(Math.abs(d.y-l.y)):0,v=Math.max(f.width,Math.round(l.width)),w=Math.max(f.height,Math.round(l.height)),g=(v-f.width)*p[0],k=(w-f.height)*p[1];(h>0||y>0||g||k)&&(s.push({id:u,type:"position",position:{x:c.position.x-h+g,y:c.position.y-y+k}}),(b=n.get(u))==null||b.forEach(j=>{e.some(N=>N.id===j.id)||s.push({id:j.id,type:"position",position:{x:j.position.x+h,y:j.position.y+y}})})),(f.width<l.width||f.height<l.height||h||y)&&s.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:v+(h?p[0]*h-g:0),height:w+(y?p[1]*y-k:0)}})}),s}function h4(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:f}=new window.DOMMatrixReadOnly(d.transform),p=[];for(const h of e.values()){const y=t.get(h.id);if(!y)continue;if(y.hidden){t.set(y.id,{...y,internals:{...y.internals,handleBounds:void 0}}),c=!0;continue}const v=Bk(h.nodeElement),w=y.measured.width!==v.width||y.measured.height!==v.height;if(!!(v.width&&v.height&&(w||!y.internals.handleBounds||h.force))){const k=h.nodeElement.getBoundingClientRect(),b=Oc(y.extent)?y.extent:o;let{positionAbsolute:j}=y.internals;y.parentId&&y.extent==="parent"?j=vI(j,v,t.get(y.parentId)):b&&(j=el(j,b,v));const N={...y,measured:v,internals:{...y.internals,positionAbsolute:j,handleBounds:{source:IN("source",h.nodeElement,k,f,y.id),target:IN("target",h.nodeElement,k,f,y.id)}}};t.set(y.id,N),y.parentId&&Kk(N,t,n,{nodeOrigin:s,zIndexMode:a}),c=!0,w&&(u.push({id:y.id,type:"dimensions",dimensions:v}),y.expandParent&&y.parentId&&p.push({id:y.id,parentId:y.parentId,rect:Lc(N,s)}))}}if(p.length>0){const h=qk(p,t,n,s);u.push(...h)}return{changes:u,updatedInternals:c}}async function m4({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 DN(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 LI(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}`;DN("source",c,d,e,s,a),DN("target",c,u,e,o,l),t.set(r.id,r)}}function OI(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:OI(n,t):!1}function FN(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 g4(e,t,n,r){const s=new Map;for(const[o,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!OI(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 Ky({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,l,c;const s=[];for(const[u,d]of t){const f=(a=n.get(u))==null?void 0:a.internals.userNode;f&&s.push({...f,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 y4({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=xf(o,t);return{x:a.x-o.x,y:a.y-o.y}}function w4({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,f=!1,p=null,h=!1,y=!1,v=null;function w({noDragClassName:k,handleSelector:b,domNode:j,isSelectable:N,nodeId:C,nodeClickDistance:I=0}){p=as(j);function R({x:D,y:O}){const{nodeLookup:M,nodeExtent:K,snapGrid:z,snapToGrid:F,nodeOrigin:$,onNodeDrag:W,onSelectionDrag:E,onError:Q,updateNodePositions:V}=t();o={x:D,y:O};let B=!1;const re=l.size>1,ue=re&&K?Wx(wf(l)):null,G=re&&F?y4({dragItems:l,snapGrid:z,x:D,y:O}):null;for(const[ee,te]of l){if(!M.has(ee))continue;let ne={x:D-te.distance.x,y:O-te.distance.y};F&&(ne=G?{x:Math.round(ne.x+G.x),y:Math.round(ne.y+G.y)}:xf(ne,z));let Z=null;if(re&&K&&!te.extent&&ue){const{positionAbsolute:me}=te.internals,$e=me.x-ue.x+K[0][0],Ce=me.x+te.measured.width-ue.x2+K[1][0],_e=me.y-ue.y+K[0][1],Be=me.y+te.measured.height-ue.y2+K[1][1];Z=[[$e,_e],[Ce,Be]]}const{position:ce,positionAbsolute:de}=kI({nodeId:ee,nextPosition:ne,nodeLookup:M,nodeExtent:Z||K,nodeOrigin:$,onError:Q});B=B||te.position.x!==ce.x||te.position.y!==ce.y,te.position=ce,te.internals.positionAbsolute=de}if(y=y||B,!!B&&(V(l,!0),v&&(r||W||!C&&E))){const[ee,te]=Ky({nodeId:C,dragItems:l,nodeLookup:M});r==null||r(v,l,ee,te),W==null||W(v,ee,te),C||E==null||E(v,te)}}async function H(){if(!d)return;const{transform:D,panBy:O,autoPanSpeed:M,autoPanOnNodeDrag:K}=t();if(!K){c=!1,cancelAnimationFrame(a);return}const[z,F]=SI(u,d,M);(z!==0||F!==0)&&(o.x=(o.x??0)-z/D[2],o.y=(o.y??0)-F/D[2],await O({x:z,y:F})&&R(o)),a=requestAnimationFrame(H)}function A(D){var re;const{nodeLookup:O,multiSelectionActive:M,nodesDraggable:K,transform:z,snapGrid:F,snapToGrid:$,selectNodesOnDrag:W,onNodeDragStart:E,onSelectionDragStart:Q,unselectNodesAndEdges:V}=t();f=!0,(!W||!N)&&!M&&C&&((re=O.get(C))!=null&&re.selected||V()),N&&W&&C&&(e==null||e(C));const B=hd(D.sourceEvent,{transform:z,snapGrid:F,snapToGrid:$,containerBounds:d});if(o=B,l=g4(O,K,B,C),l.size>0&&(n||E||!C&&Q)){const[ue,G]=Ky({nodeId:C,dragItems:l,nodeLookup:O});n==null||n(D.sourceEvent,l,ue,G),E==null||E(D.sourceEvent,ue,G),C||Q==null||Q(D.sourceEvent,G)}}const L=eI().clickDistance(I).on("start",D=>{const{domNode:O,nodeDragThreshold:M,transform:K,snapGrid:z,snapToGrid:F}=t();d=(O==null?void 0:O.getBoundingClientRect())||null,h=!1,y=!1,v=D.sourceEvent,M===0&&A(D),o=hd(D.sourceEvent,{transform:K,snapGrid:z,snapToGrid:F,containerBounds:d}),u=ei(D.sourceEvent,d)}).on("drag",D=>{const{autoPanOnNodeDrag:O,transform:M,snapGrid:K,snapToGrid:z,nodeDragThreshold:F,nodeLookup:$}=t(),W=hd(D.sourceEvent,{transform:M,snapGrid:K,snapToGrid:z,containerBounds:d});if(v=D.sourceEvent,(D.sourceEvent.type==="touchmove"&&D.sourceEvent.touches.length>1||C&&!$.has(C))&&(h=!0),!h){if(!c&&O&&f&&(c=!0,H()),!f){const E=ei(D.sourceEvent,d),Q=E.x-u.x,V=E.y-u.y;Math.sqrt(Q*Q+V*V)>F&&A(D)}(o.x!==W.xSnapped||o.y!==W.ySnapped)&&l&&f&&(u=ei(D.sourceEvent,d),R(W))}}).on("end",D=>{if(!(!f||h)&&(c=!1,f=!1,cancelAnimationFrame(a),l.size>0)){const{nodeLookup:O,updateNodePositions:M,onNodeDragStop:K,onSelectionDragStop:z}=t();if(y&&(M(l,!1),y=!1),s||K||!C&&z){const[F,$]=Ky({nodeId:C,dragItems:l,nodeLookup:O,dragging:!1});s==null||s(D.sourceEvent,l,F,$),K==null||K(D.sourceEvent,F,$),C||z==null||z(D.sourceEvent,$)}}}).filter(D=>{const O=D.target;return!D.button&&(!k||!FN(O,`.${k}`,j))&&(!b||FN(O,b,j))});p.call(L)}function g(){p==null||p.on(".drag",null)}return{update:w,destroy:g}}function x4(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())qd(s,Lc(o))>0&&r.push(o);return r}const b4=250;function k4(e,t,n,r){var l,c;let s=[],o=1/0;const a=x4(e,n,t+b4);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 f of d){if(r.nodeId===f.nodeId&&r.type===f.type&&r.id===f.id)continue;const{x:p,y:h}=tl(u,f,f.position,!0),y=Math.sqrt(Math.pow(p-e.x,2)+Math.pow(h-e.y,2));y>t||(y<o?(s=[{...f,x:p,y:h}],o=y):y===o&&s.push({...f,x:p,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 DI(e,t,n,r,s,o=!1){var u,d,f;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)??[],...((f=a.internals.handleBounds)==null?void 0:f.target)??[]],c=(n?l==null?void 0:l.find(p=>p.id===n):l==null?void 0:l[0])??null;return c&&o?{...c,...tl(a,c,c.position,!0)}:c}function FI(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function v4(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const zI=()=>!0;function S4(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:o,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:f,panBy:p,cancelConnection:h,onConnectStart:y,onConnect:v,onConnectEnd:w,isValidConnection:g=zI,onReconnectEnd:k,updateConnection:b,getTransform:j,getFromHandle:N,autoPanSpeed:C,dragThreshold:I=1,handleDomNode:R}){const H=_I(e.target);let A=0,L;const{x:D,y:O}=ei(e),M=FI(o,R),K=l==null?void 0:l.getBoundingClientRect();let z=!1;if(!K||!M)return;const F=DI(s,M,r,c,t);if(!F)return;let $=ei(e,K),W=!1,E=null,Q=!1,V=null;function B(){if(!d||!K)return;const[ce,de]=SI($,K,C);p({x:ce,y:de}),A=requestAnimationFrame(B)}const re={...F,nodeId:s,type:M,position:F.position},ue=c.get(s);let ee={inProgress:!0,isValid:null,from:tl(ue,re,Ue.Left,!0),fromHandle:re,fromPosition:re.position,fromNode:ue,to:$,toHandle:null,toPosition:_N[re.position],toNode:null,pointer:$};function te(){z=!0,b(ee),y==null||y(e,{nodeId:s,handleId:r,handleType:M})}I===0&&te();function ne(ce){if(!z){const{x:Be,y:at}=ei(ce),yt=Be-D,Te=at-O;if(!(yt*yt+Te*Te>I*I))return;te()}if(!N()||!re){Z(ce);return}const de=j();$=ei(ce,K),L=k4(bf($,de,!1,[1,1]),n,c,re),W||(B(),W=!0);const me=BI(ce,{handle:L,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:a?"target":"source",isValidConnection:g,doc:H,lib:u,flowId:f,nodeLookup:c});V=me.handleDomNode,E=me.connection,Q=v4(!!L,me.isValid);const $e=c.get(s),Ce=$e?tl($e,re,Ue.Left,!0):ee.from,_e={...ee,from:Ce,isValid:Q,to:me.toHandle&&Q?sm({x:me.toHandle.x,y:me.toHandle.y},de):$,toHandle:me.toHandle,toPosition:Q&&me.toHandle?me.toHandle.position:_N[re.position],toNode:me.toHandle?c.get(me.toHandle.nodeId):null,pointer:$};b(_e),ee=_e}function Z(ce){if(!("touches"in ce&&ce.touches.length>0)){if(z){(L||V)&&E&&Q&&(v==null||v(E));const{inProgress:de,...me}=ee,$e={...me,toPosition:ee.toHandle?ee.toPosition:null};w==null||w(ce,$e),o&&(k==null||k(ce,$e))}h(),cancelAnimationFrame(A),W=!1,Q=!1,E=null,V=null,H.removeEventListener("mousemove",ne),H.removeEventListener("mouseup",Z),H.removeEventListener("touchmove",ne),H.removeEventListener("touchend",Z)}}H.addEventListener("mousemove",ne),H.addEventListener("mouseup",Z),H.addEventListener("touchmove",ne),H.addEventListener("touchend",Z)}function BI(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:o,doc:a,lib:l,flowId:c,isValidConnection:u=zI,nodeLookup:d}){const f=o==="target",p=t?a.querySelector(`.${l}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y}=ei(e),v=a.elementFromPoint(h,y),w=v!=null&&v.classList.contains(`${l}-flow__handle`)?v:p,g={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const k=FI(void 0,w),b=w.getAttribute("data-nodeid"),j=w.getAttribute("data-handleid"),N=w.classList.contains("connectable"),C=w.classList.contains("connectableend");if(!b||!k)return g;const I={source:f?b:r,sourceHandle:f?j:s,target:f?r:b,targetHandle:f?s:j};g.connection=I;const H=N&&C&&(n===Mc.Strict?f&&k==="source"||!f&&k==="target":b!==r||j!==s);g.isValid=H&&u(I),g.toHandle=DI(b,k,j,d,n,!0)}return g}const Ux={onPointerDown:S4,isValid:BI};function j4({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=as(e);function o({translateExtent:l,width:c,height:u,zoomStep:d=1,pannable:f=!0,zoomable:p=!0,inversePan:h=!1}){const y=b=>{if(b.sourceEvent.type!=="wheel"||!t)return;const j=n(),N=b.sourceEvent.ctrlKey&&Ud()?10:1,C=-b.sourceEvent.deltaY*(b.sourceEvent.deltaMode===1?.05:b.sourceEvent.deltaMode?1:.002)*d,I=j[2]*Math.pow(2,C*N);t.scaleTo(I)};let v=[0,0];const w=b=>{(b.sourceEvent.type==="mousedown"||b.sourceEvent.type==="touchstart")&&(v=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY])},g=b=>{const j=n();if(b.sourceEvent.type!=="mousemove"&&b.sourceEvent.type!=="touchmove"||!t)return;const N=[b.sourceEvent.clientX??b.sourceEvent.touches[0].clientX,b.sourceEvent.clientY??b.sourceEvent.touches[0].clientY],C=[N[0]-v[0],N[1]-v[1]];v=N;const I=r()*Math.max(j[2],Math.log(j[2]))*(h?-1:1),R={x:j[0]-C[0]*I,y:j[1]-C[1]*I},H=[[0,0],[c,u]];t.setViewportConstrained({x:R.x,y:R.y,zoom:j[2]},H,l)},k=mI().on("start",w).on("zoom",f?g:null).on("zoom.wheel",p?y:null);s.call(k,{})}function a(){s.on("zoom",null)}return{update:o,destroy:a,pointer:Gs}}const rg=e=>({x:e.x,y:e.y,zoom:e.k}),qy=({x:e,y:t,zoom:n})=>eg.translate(e,t).scale(n),oc=(e,t)=>e.target.closest(`.${t}`),HI=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),N4=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Uy=(e,t=0,n=N4,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},WI=e=>{const t=e.ctrlKey&&Ud()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function C4({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:o,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(oc(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(d.ctrlKey&&a){const w=Gs(d),g=WI(d),k=f*Math.pow(2,g);r.scaleTo(n,k,w,d);return}const p=d.deltaMode===1?20:1;let h=s===Va.Vertical?0:d.deltaX*p,y=s===Va.Horizontal?0:d.deltaY*p;!Ud()&&d.shiftKey&&s!==Va.Vertical&&(h=d.deltaY*p,y=0),r.translateBy(n,-(h/f)*o,-(y/f)*o,{internal:!0});const v=rg(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,v),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,v),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(d,v))}}function _4({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const o=r.type==="wheel",a=!t&&o&&!r.ctrlKey,l=oc(r,e);if(r.ctrlKey&&o&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,s)}}function E4({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var o,a,l;if((o=r.sourceEvent)!=null&&o.internal)return;const s=rg(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 A4({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return o=>{var a,l;e.usedRightMouseButton=!!(n&&HI(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,rg(o.transform)))}}function P4({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&&HI(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&o(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=rg(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,c)},n?150:0)}}}function I4({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:o,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:d}){return f=>{var w;const p=e||t,h=n&&f.ctrlKey,y=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(oc(f,`${u}-flow__node`)||oc(f,`${u}-flow__edge`)))return!0;if(!r&&!p&&!s&&!o&&!n||a||d&&!y||oc(f,l)&&y||oc(f,c)&&(!y||s&&y&&!e)||!n&&f.ctrlKey&&y)return!1;if(!n&&f.type==="touchstart"&&((w=f.touches)==null?void 0:w.length)>1)return f.preventDefault(),!1;if(!p&&!s&&!h&&y||!r&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(r)&&!r.includes(f.button)&&f.type==="mousedown")return!1;const v=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||y)&&v}}function R4({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(),f=mI().scaleExtent([t,n]).translateExtent(r),p=as(e).call(f);k({x:s.x,y:s.y,zoom:$c(s.zoom,t,n)},[[0,0],[d.width,d.height]],r);const h=p.on("wheel.zoom"),y=p.on("dblclick.zoom");f.wheelDelta(WI);function v(L,D){return p?new Promise(O=>{f==null||f.interpolate((D==null?void 0:D.interpolate)==="linear"?pd:ph).transform(Uy(p,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>O(!0)),L)}):Promise.resolve(!1)}function w({noWheelClassName:L,noPanClassName:D,onPaneContextMenu:O,userSelectionActive:M,panOnScroll:K,panOnDrag:z,panOnScrollMode:F,panOnScrollSpeed:$,preventScrolling:W,zoomOnPinch:E,zoomOnScroll:Q,zoomOnDoubleClick:V,zoomActivationKeyPressed:B,lib:re,onTransformChange:ue,connectionInProgress:G,paneClickDistance:ee,selectionOnDrag:te}){M&&!u.isZoomingOrPanning&&g();const ne=K&&!B&&!M;f.clickDistance(te?1/0:!Zs(ee)||ee<0?0:ee);const Z=ne?C4({zoomPanValues:u,noWheelClassName:L,d3Selection:p,d3Zoom:f,panOnScrollMode:F,panOnScrollSpeed:$,zoomOnPinch:E,onPanZoomStart:a,onPanZoom:o,onPanZoomEnd:l}):_4({noWheelClassName:L,preventScrolling:W,d3ZoomHandler:h});if(p.on("wheel.zoom",Z,{passive:!1}),!M){const de=E4({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});f.on("start",de);const me=A4({zoomPanValues:u,panOnDrag:z,onPaneContextMenu:!!O,onPanZoom:o,onTransformChange:ue});f.on("zoom",me);const $e=P4({zoomPanValues:u,panOnDrag:z,panOnScroll:K,onPaneContextMenu:O,onPanZoomEnd:l,onDraggingChange:c});f.on("end",$e)}const ce=I4({zoomActivationKeyPressed:B,panOnDrag:z,zoomOnScroll:Q,panOnScroll:K,zoomOnDoubleClick:V,zoomOnPinch:E,userSelectionActive:M,noPanClassName:D,noWheelClassName:L,lib:re,connectionInProgress:G});f.filter(ce),V?p.on("dblclick.zoom",y):p.on("dblclick.zoom",null)}function g(){f.on("zoom",null)}async function k(L,D,O){const M=qy(L),K=f==null?void 0:f.constrain()(M,D,O);return K&&await v(K),new Promise(z=>z(K))}async function b(L,D){const O=qy(L);return await v(O,D),new Promise(M=>M(O))}function j(L){if(p){const D=qy(L),O=p.property("__zoom");(O.k!==L.zoom||O.x!==L.x||O.y!==L.y)&&(f==null||f.transform(p,D,null,{sync:!0}))}}function N(){const L=p?hI(p.node()):{x:0,y:0,k:1};return{x:L.x,y:L.y,zoom:L.k}}function C(L,D){return p?new Promise(O=>{f==null||f.interpolate((D==null?void 0:D.interpolate)==="linear"?pd:ph).scaleTo(Uy(p,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>O(!0)),L)}):Promise.resolve(!1)}function I(L,D){return p?new Promise(O=>{f==null||f.interpolate((D==null?void 0:D.interpolate)==="linear"?pd:ph).scaleBy(Uy(p,D==null?void 0:D.duration,D==null?void 0:D.ease,()=>O(!0)),L)}):Promise.resolve(!1)}function R(L){f==null||f.scaleExtent(L)}function H(L){f==null||f.translateExtent(L)}function A(L){const D=!Zs(L)||L<0?0:L;f==null||f.clickDistance(D)}return{update:w,destroy:g,setViewport:b,setViewportConstrained:k,getViewport:N,scaleTo:C,scaleBy:I,setScaleExtent:R,setTranslateExtent:H,syncViewport:j,setClickDistance:A}}var Dc;(function(e){e.Line="line",e.Handle="handle"})(Dc||(Dc={}));function T4({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 zN(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 Io(e,t){return Math.max(0,t-e)}function Ro(e,t){return Math.max(0,e-t)}function Ip(e,t,n){return Math.max(0,t-e,e-n)}function BN(e,t){return e?!t:t}function M4(e,t,n,r,s,o,a,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:f}=t,p=d&&f,{xSnapped:h,ySnapped:y}=n,{minWidth:v,maxWidth:w,minHeight:g,maxHeight:k}=r,{x:b,y:j,width:N,height:C,aspectRatio:I}=e;let R=Math.floor(d?h-e.pointerX:0),H=Math.floor(f?y-e.pointerY:0);const A=N+(c?-R:R),L=C+(u?-H:H),D=-o[0]*N,O=-o[1]*C;let M=Ip(A,v,w),K=Ip(L,g,k);if(a){let $=0,W=0;c&&R<0?$=Io(b+R+D,a[0][0]):!c&&R>0&&($=Ro(b+A+D,a[1][0])),u&&H<0?W=Io(j+H+O,a[0][1]):!u&&H>0&&(W=Ro(j+L+O,a[1][1])),M=Math.max(M,$),K=Math.max(K,W)}if(l){let $=0,W=0;c&&R>0?$=Ro(b+R,l[0][0]):!c&&R<0&&($=Io(b+A,l[1][0])),u&&H>0?W=Ro(j+H,l[0][1]):!u&&H<0&&(W=Io(j+L,l[1][1])),M=Math.max(M,$),K=Math.max(K,W)}if(s){if(d){const $=Ip(A/I,g,k)*I;if(M=Math.max(M,$),a){let W=0;!c&&!u||c&&!u&&p?W=Ro(j+O+A/I,a[1][1])*I:W=Io(j+O+(c?R:-R)/I,a[0][1])*I,M=Math.max(M,W)}if(l){let W=0;!c&&!u||c&&!u&&p?W=Io(j+A/I,l[1][1])*I:W=Ro(j+(c?R:-R)/I,l[0][1])*I,M=Math.max(M,W)}}if(f){const $=Ip(L*I,v,w)/I;if(K=Math.max(K,$),a){let W=0;!c&&!u||u&&!c&&p?W=Ro(b+L*I+D,a[1][0])/I:W=Io(b+(u?H:-H)*I+D,a[0][0])/I,K=Math.max(K,W)}if(l){let W=0;!c&&!u||u&&!c&&p?W=Io(b+L*I,l[1][0])/I:W=Ro(b+(u?H:-H)*I,l[0][0])/I,K=Math.max(K,W)}}}H=H+(H<0?K:-K),R=R+(R<0?M:-M),s&&(p?A>L*I?H=(BN(c,u)?-R:R)/I:R=(BN(c,u)?-H:H)*I:d?(H=R/I,u=c):(R=H*I,c=u));const z=c?b+R:b,F=u?j+H:j;return{width:N+(c?-R:R),height:C+(u?-H:H),x:o[0]*R*(c?-1:1)+z,y:o[1]*H*(u?-1:1)+F}}const VI={width:0,height:0,x:0,y:0},$4={...VI,pointerX:0,pointerY:0,aspectRatio:1};function L4(e){return[[0,0],[e.measured.width,e.measured.height]]}function O4(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 D4({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const o=as(e);let a={controlDirection:zN("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:f,resizeDirection:p,onResizeStart:h,onResize:y,onResizeEnd:v,shouldResize:w}){let g={...VI},k={...$4};a={boundaries:d,resizeDirection:p,keepAspectRatio:f,controlDirection:zN(u)};let b,j=null,N=[],C,I,R,H=!1;const A=eI().on("start",L=>{const{nodeLookup:D,transform:O,snapGrid:M,snapToGrid:K,nodeOrigin:z,paneDomNode:F}=n();if(b=D.get(t),!b)return;j=(F==null?void 0:F.getBoundingClientRect())??null;const{xSnapped:$,ySnapped:W}=hd(L.sourceEvent,{transform:O,snapGrid:M,snapToGrid:K,containerBounds:j});g={width:b.measured.width??0,height:b.measured.height??0,x:b.position.x??0,y:b.position.y??0},k={...g,pointerX:$,pointerY:W,aspectRatio:g.width/g.height},C=void 0,b.parentId&&(b.extent==="parent"||b.expandParent)&&(C=D.get(b.parentId),I=C&&b.extent==="parent"?L4(C):void 0),N=[],R=void 0;for(const[E,Q]of D)if(Q.parentId===t&&(N.push({id:E,position:{...Q.position},extent:Q.extent}),Q.extent==="parent"||Q.expandParent)){const V=O4(Q,b,Q.origin??z);R?R=[[Math.min(V[0][0],R[0][0]),Math.min(V[0][1],R[0][1])],[Math.max(V[1][0],R[1][0]),Math.max(V[1][1],R[1][1])]]:R=V}h==null||h(L,{...g})}).on("drag",L=>{const{transform:D,snapGrid:O,snapToGrid:M,nodeOrigin:K}=n(),z=hd(L.sourceEvent,{transform:D,snapGrid:O,snapToGrid:M,containerBounds:j}),F=[];if(!b)return;const{x:$,y:W,width:E,height:Q}=g,V={},B=b.origin??K,{width:re,height:ue,x:G,y:ee}=M4(k,a.controlDirection,z,a.boundaries,a.keepAspectRatio,B,I,R),te=re!==E,ne=ue!==Q,Z=G!==$&&te,ce=ee!==W&≠if(!Z&&!ce&&!te&&!ne)return;if((Z||ce||B[0]===1||B[1]===1)&&(V.x=Z?G:g.x,V.y=ce?ee:g.y,g.x=V.x,g.y=V.y,N.length>0)){const Ce=G-$,_e=ee-W;for(const Be of N)Be.position={x:Be.position.x-Ce+B[0]*(re-E),y:Be.position.y-_e+B[1]*(ue-Q)},F.push(Be)}if((te||ne)&&(V.width=te&&(!a.resizeDirection||a.resizeDirection==="horizontal")?re:g.width,V.height=ne&&(!a.resizeDirection||a.resizeDirection==="vertical")?ue:g.height,g.width=V.width,g.height=V.height),C&&b.expandParent){const Ce=B[0]*(V.width??0);V.x&&V.x<Ce&&(g.x=Ce,k.x=k.x-(V.x-Ce));const _e=B[1]*(V.height??0);V.y&&V.y<_e&&(g.y=_e,k.y=k.y-(V.y-_e))}const de=T4({width:g.width,prevWidth:E,height:g.height,prevHeight:Q,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),me={...g,direction:de};(w==null?void 0:w(L,me))!==!1&&(H=!0,y==null||y(L,me),r(V,F))}).on("end",L=>{H&&(v==null||v(L,{...g}),s==null||s({...g}),H=!1)});o.call(A)}function c(){o.on(".drag",null)}return{update:l,destroy:c}}var KI={exports:{}},qI={},UI={exports:{}},YI={};/**
|
|
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 Fc=m;function F4(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var z4=typeof Object.is=="function"?Object.is:F4,B4=Fc.useState,H4=Fc.useEffect,W4=Fc.useLayoutEffect,V4=Fc.useDebugValue;function K4(e,t){var n=t(),r=B4({inst:{value:n,getSnapshot:t}}),s=r[0].inst,o=r[1];return W4(function(){s.value=n,s.getSnapshot=t,Yy(s)&&o({inst:s})},[e,n,t]),H4(function(){return Yy(s)&&o({inst:s}),e(function(){Yy(s)&&o({inst:s})})},[e]),V4(n),n}function Yy(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!z4(e,n)}catch{return!0}}function q4(e,t){return t()}var U4=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?q4:K4;YI.useSyncExternalStore=Fc.useSyncExternalStore!==void 0?Fc.useSyncExternalStore:U4;UI.exports=YI;var GI=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 sg=m,Y4=GI;function G4(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var J4=typeof Object.is=="function"?Object.is:G4,X4=Y4.useSyncExternalStore,Q4=sg.useRef,Z4=sg.useEffect,eW=sg.useMemo,tW=sg.useDebugValue;qI.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var o=Q4(null);if(o.current===null){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=eW(function(){function c(h){if(!u){if(u=!0,d=h,h=r(h),s!==void 0&&a.hasValue){var y=a.value;if(s(y,h))return f=y}return f=h}if(y=f,J4(d,h))return y;var v=r(h);return s!==void 0&&s(y,v)?(d=h,y):(d=h,f=v)}var u=!1,d,f,p=n===void 0?null:n;return[function(){return c(t())},p===null?void 0:function(){return c(p())}]},[t,n,r,s]);var l=X4(e,o[0],o[1]);return Z4(function(){a.hasValue=!0,a.value=l},[l]),tW(l),l};KI.exports=qI;var nW=KI.exports;const rW=ca(nW),sW={},HN=e=>{let t;const n=new Set,r=(d,f)=>{const p=typeof d=="function"?d(t):d;if(!Object.is(p,t)){const h=t;t=f??(typeof p!="object"||p===null)?p:Object.assign({},t,p),n.forEach(y=>y(t,h))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>u,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(sW?"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},iW=e=>e?HN(e):HN,{useDebugValue:oW}=ft,{useSyncExternalStoreWithSelector:aW}=rW,lW=e=>e;function JI(e,t=lW,n){const r=aW(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return oW(r),r}const WN=(e,t)=>{const n=iW(e),r=(s,o=t)=>JI(n,s,o);return Object.assign(r,n),r},cW=(e,t)=>e?WN(e,t):WN;function vn(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,s]of e)if(!Object.is(s,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const ig=m.createContext(null),uW=ig.Provider,XI=$i.error001();function Wt(e,t){const n=m.useContext(ig);if(n===null)throw new Error(XI);return JI(n,e,t)}function hn(){const e=m.useContext(ig);if(e===null)throw new Error(XI);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const VN={display:"none"},dW={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},QI="react-flow__node-desc",ZI="react-flow__edge-desc",fW="react-flow__aria-live",pW=e=>e.ariaLiveMessage,hW=e=>e.ariaLabelConfig;function mW({rfId:e}){const t=Wt(pW);return i.jsx("div",{id:`${fW}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:dW,children:t})}function gW({rfId:e,disableKeyboardA11y:t}){const n=Wt(hW);return i.jsxs(i.Fragment,{children:[i.jsx("div",{id:`${QI}-${e}`,style:VN,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),i.jsx("div",{id:`${ZI}-${e}`,style:VN,children:n["edge.a11yDescription.default"]}),!t&&i.jsx(mW,{rfId:e})]})}const og=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},o)=>{const a=`${e}`.split("-");return i.jsx("div",{className:Gn(["react-flow__panel",n,...a]),style:r,ref:o,...s,children:t})});og.displayName="Panel";function yW({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:i.jsx(og,{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 wW=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}},Rp=e=>e.id;function xW(e,t){return vn(e.selectedNodes.map(Rp),t.selectedNodes.map(Rp))&&vn(e.selectedEdges.map(Rp),t.selectedEdges.map(Rp))}function bW({onSelectionChange:e}){const t=hn(),{selectedNodes:n,selectedEdges:r}=Wt(wW,xW);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 kW=e=>!!e.onSelectionChangeHandlers;function vW({onSelectionChange:e}){const t=Wt(kW);return e||t?i.jsx(bW,{onSelectionChange:e}):null}const Yx=typeof window<"u"?m.useLayoutEffect:m.useEffect,eR=[0,0],SW={x:0,y:0,zoom:1},jW=["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"],KN=[...jW,"rfId"],NW=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}),qN={translateExtent:Vd,nodeOrigin:eR,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function CW(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:o,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=Wt(NW,vn),u=hn();Yx(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=qN,l()}),[]);const d=m.useRef(qN);return Yx(()=>{for(const f of KN){const p=e[f],h=d.current[f];p!==h&&(typeof e[f]>"u"||(f==="nodes"?t(p):f==="edges"?n(p):f==="minZoom"?r(p):f==="maxZoom"?s(p):f==="translateExtent"?o(p):f==="nodeExtent"?a(p):f==="ariaLabelConfig"?u.setState({ariaLabelConfig:XH(p)}):f==="fitView"?u.setState({fitViewQueued:p}):f==="fitViewOptions"?u.setState({fitViewOptions:p}):u.setState({[f]:p})))}d.current=e},KN.map(f=>e[f])),null}function UN(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function _W(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const s=UN(),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=UN())!=null&&r.matches?"dark":"light"}const YN=typeof document<"u"?document:null;function Yd(e=null,t={target:YN,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(f=>typeof f=="string").map(f=>f.replace("+",`
|
|
61
|
-
`).replace(`
|
|
62
|
-
|
|
63
|
-
`,`
|
|
64
|
-
+`).split(`
|
|
65
|
-
`)),d=u.reduce((f,p)=>f.concat(...p),[]);return[u,d]}return[[],[]]},[e]);return m.useEffect(()=>{const c=(t==null?void 0:t.target)??YN,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=h=>{var w,g;if(s.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!s.current||s.current&&!u)&&EI(h))return!1;const v=JN(h.code,l);if(o.current.add(h[v]),GN(a,o.current,!1)){const k=((g=(w=h.composedPath)==null?void 0:w.call(h))==null?void 0:g[0])||h.target,b=(k==null?void 0:k.nodeName)==="BUTTON"||(k==null?void 0:k.nodeName)==="A";t.preventDefault!==!1&&(s.current||!b)&&h.preventDefault(),r(!0)}},f=h=>{const y=JN(h.code,l);GN(a,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(h[y]),h.key==="Meta"&&o.current.clear(),s.current=!1},p=()=>{o.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",f),window.addEventListener("blur",p),window.addEventListener("contextmenu",p),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",f),window.removeEventListener("blur",p),window.removeEventListener("contextmenu",p)}}},[e,r]),n}function GN(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function JN(e,t){return t.includes(e)?"code":"key"}const EW=()=>{const e=hn();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=zk(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,f=n.snapToGrid??o;return bf(u,r,f,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:o}=r.getBoundingClientRect(),a=sm(t,n);return{x:a.x+s,y:a.y+o}}}),[])};function tR(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)AW(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 AW(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 md(e,t){return tR(e,t)}function im(e,t){return tR(e,t)}function Aa(e,t){return{id:e,type:"select",selected:t}}function ac(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(Aa(o.id,a)))}return r}function XN({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 QN(e){return{id:e.id,type:"remove"}}const ZN=e=>BH(e),PW=e=>bI(e);function nR(e){return m.forwardRef(e)}function e1(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>IW(()=>n(s=>s+BigInt(1))));return Yx(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function IW(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const rR=m.createContext(null);function RW({children:e}){const t=hn(),n=m.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:d,onNodesChange:f,nodeLookup:p,fitViewQueued:h,onNodesChangeMiddlewareMap:y}=t.getState();let v=c;for(const g of l)v=typeof g=="function"?g(v):g;let w=XN({items:v,lookup:p});for(const g of y.values())w=g(w);d&&u(v),w.length>0?f==null||f(w):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:g,nodes:k,setNodes:b}=t.getState();g&&b(k)})},[]),r=e1(n),s=m.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:d,onEdgesChange:f,edgeLookup:p}=t.getState();let h=c;for(const y of l)h=typeof y=="function"?y(h):y;d?u(h):f&&f(XN({items:h,lookup:p}))},[]),o=e1(s),a=m.useMemo(()=>({nodeQueue:r,edgeQueue:o}),[]);return i.jsx(rR.Provider,{value:a,children:e})}function TW(){const e=m.useContext(rR);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const MW=e=>!!e.panZoom;function Uc(){const e=EW(),t=hn(),n=TW(),r=Wt(MW),s=m.useMemo(()=>{const o=f=>t.getState().nodeLookup.get(f),a=f=>{n.nodeQueue.push(f)},l=f=>{n.edgeQueue.push(f)},c=f=>{var g,k;const{nodeLookup:p,nodeOrigin:h}=t.getState(),y=ZN(f)?f:p.get(f.id),v=y.parentId?CI(y.position,y.measured,y.parentId,p,h):y.position,w={...y,position:v,width:((g=y.measured)==null?void 0:g.width)??y.width,height:((k=y.measured)==null?void 0:k.height)??y.height};return Lc(w)},u=(f,p,h={replace:!1})=>{a(y=>y.map(v=>{if(v.id===f){const w=typeof p=="function"?p(v):p;return h.replace&&ZN(w)?w:{...v,...w}}return v}))},d=(f,p,h={replace:!1})=>{l(y=>y.map(v=>{if(v.id===f){const w=typeof p=="function"?p(v):p;return h.replace&&PW(w)?w:{...v,...w}}return v}))};return{getNodes:()=>t.getState().nodes.map(f=>({...f})),getNode:f=>{var p;return(p=o(f))==null?void 0:p.internals.userNode},getInternalNode:o,getEdges:()=>{const{edges:f=[]}=t.getState();return f.map(p=>({...p}))},getEdge:f=>t.getState().edgeLookup.get(f),setNodes:a,setEdges:l,addNodes:f=>{const p=Array.isArray(f)?f:[f];n.nodeQueue.push(h=>[...h,...p])},addEdges:f=>{const p=Array.isArray(f)?f:[f];n.edgeQueue.push(h=>[...h,...p])},toObject:()=>{const{nodes:f=[],edges:p=[],transform:h}=t.getState(),[y,v,w]=h;return{nodes:f.map(g=>({...g})),edges:p.map(g=>({...g})),viewport:{x:y,y:v,zoom:w}}},deleteElements:async({nodes:f=[],edges:p=[]})=>{const{nodes:h,edges:y,onNodesDelete:v,onEdgesDelete:w,triggerNodeChanges:g,triggerEdgeChanges:k,onDelete:b,onBeforeDelete:j}=t.getState(),{nodes:N,edges:C}=await qH({nodesToRemove:f,edgesToRemove:p,nodes:h,edges:y,onBeforeDelete:j}),I=C.length>0,R=N.length>0;if(I){const H=C.map(QN);w==null||w(C),k(H)}if(R){const H=N.map(QN);v==null||v(N),g(H)}return(R||I)&&(b==null||b({nodes:N,edges:C})),{deletedNodes:N,deletedEdges:C}},getIntersectingNodes:(f,p=!0,h)=>{const y=AN(f),v=y?f:c(f),w=h!==void 0;return v?(h||t.getState().nodes).filter(g=>{const k=t.getState().nodeLookup.get(g.id);if(k&&!y&&(g.id===f.id||!k.internals.positionAbsolute))return!1;const b=Lc(w?g:k),j=qd(b,v);return p&&j>0||j>=b.width*b.height||j>=v.width*v.height}):[]},isNodeIntersecting:(f,p,h=!0)=>{const v=AN(f)?f:c(f);if(!v)return!1;const w=qd(v,p);return h&&w>0||w>=p.width*p.height||w>=v.width*v.height},updateNode:u,updateNodeData:(f,p,h={replace:!1})=>{u(f,y=>{const v=typeof p=="function"?p(y):p;return h.replace?{...y,data:v}:{...y,data:{...y.data,...v}}},h)},updateEdge:d,updateEdgeData:(f,p,h={replace:!1})=>{d(f,y=>{const v=typeof p=="function"?p(y):p;return h.replace?{...y,data:v}:{...y,data:{...y.data,...v}}},h)},getNodesBounds:f=>{const{nodeLookup:p,nodeOrigin:h}=t.getState();return HH(f,{nodeLookup:p,nodeOrigin:h})},getHandleConnections:({type:f,id:p,nodeId:h})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${h}-${f}${p?`-${p}`:""}`))==null?void 0:y.values())??[])},getNodeConnections:({type:f,handleId:p,nodeId:h})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${h}${f?p?`-${f}-${p}`:`-${f}`:""}`))==null?void 0:y.values())??[])},fitView:async f=>{const p=t.getState().fitViewResolver??JH();return t.setState({fitViewQueued:!0,fitViewOptions:f,fitViewResolver:p}),n.nodeQueue.push(h=>[...h]),p.promise}}},[]);return m.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const t1=e=>e.selected,$W=typeof window<"u"?window:void 0;function LW({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=hn(),{deleteElements:r}=Uc(),s=Yd(e,{actInsideInputWithModifier:!1}),o=Yd(t,{target:$W});m.useEffect(()=>{if(s){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(t1),edges:a.filter(t1)}),n.setState({nodesSelectionActive:!1})}},[s]),m.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])}function OW(e){const t=hn();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=Bk(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 ag={position:"absolute",width:"100%",height:"100%",top:0,left:0},DW=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function FW({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:o=Va.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:d,maxZoom:f,zoomActivationKeyCode:p,preventScrolling:h=!0,children:y,noWheelClassName:v,noPanClassName:w,onViewportChange:g,isControlledViewport:k,paneClickDistance:b,selectionOnDrag:j}){const N=hn(),C=m.useRef(null),{userSelectionActive:I,lib:R,connectionInProgress:H}=Wt(DW,vn),A=Yd(p),L=m.useRef();OW(C);const D=m.useCallback(O=>{g==null||g({x:O[0],y:O[1],zoom:O[2]}),k||N.setState({transform:O})},[g,k]);return m.useEffect(()=>{if(C.current){L.current=R4({domNode:C.current,minZoom:d,maxZoom:f,translateExtent:u,viewport:c,onDraggingChange:z=>N.setState(F=>F.paneDragging===z?F:{paneDragging:z}),onPanZoomStart:(z,F)=>{const{onViewportChangeStart:$,onMoveStart:W}=N.getState();W==null||W(z,F),$==null||$(F)},onPanZoom:(z,F)=>{const{onViewportChange:$,onMove:W}=N.getState();W==null||W(z,F),$==null||$(F)},onPanZoomEnd:(z,F)=>{const{onViewportChangeEnd:$,onMoveEnd:W}=N.getState();W==null||W(z,F),$==null||$(F)}});const{x:O,y:M,zoom:K}=L.current.getViewport();return N.setState({panZoom:L.current,transform:[O,M,K],domNode:C.current.closest(".react-flow")}),()=>{var z;(z=L.current)==null||z.destroy()}}},[]),m.useEffect(()=>{var O;(O=L.current)==null||O.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:o,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:A,preventScrolling:h,noPanClassName:w,userSelectionActive:I,noWheelClassName:v,lib:R,onTransformChange:D,connectionInProgress:H,selectionOnDrag:j,paneClickDistance:b})},[e,t,n,r,s,o,a,l,A,h,w,I,v,R,D,H,j,b]),i.jsx("div",{className:"react-flow__renderer",ref:C,style:ag,children:y})}const zW=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function BW(){const{userSelectionActive:e,userSelectionRect:t}=Wt(zW,vn);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 Gy=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},HW=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function WW({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Kd.Full,panOnDrag:r,paneClickDistance:s,selectionOnDrag:o,onSelectionStart:a,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:h,children:y}){const v=hn(),{userSelectionActive:w,elementsSelectable:g,dragging:k,connectionInProgress:b}=Wt(HW,vn),j=g&&(e||w),N=m.useRef(null),C=m.useRef(),I=m.useRef(new Set),R=m.useRef(new Set),H=m.useRef(!1),A=$=>{if(H.current||b){H.current=!1;return}c==null||c($),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},L=$=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){$.preventDefault();return}u==null||u($)},D=d?$=>d($):void 0,O=$=>{H.current&&($.stopPropagation(),H.current=!1)},M=$=>{var ue,G;const{domNode:W}=v.getState();if(C.current=W==null?void 0:W.getBoundingClientRect(),!C.current)return;const E=$.target===N.current;if(!E&&!!$.target.closest(".nokey")||!e||!(o&&E||t)||$.button!==0||!$.isPrimary)return;(G=(ue=$.target)==null?void 0:ue.setPointerCapture)==null||G.call(ue,$.pointerId),H.current=!1;const{x:B,y:re}=ei($.nativeEvent,C.current);v.setState({userSelectionRect:{width:0,height:0,startX:B,startY:re,x:B,y:re}}),E||($.stopPropagation(),$.preventDefault())},K=$=>{const{userSelectionRect:W,transform:E,nodeLookup:Q,edgeLookup:V,connectionLookup:B,triggerNodeChanges:re,triggerEdgeChanges:ue,defaultEdgeOptions:G,resetSelectedElements:ee}=v.getState();if(!C.current||!W)return;const{x:te,y:ne}=ei($.nativeEvent,C.current),{startX:Z,startY:ce}=W;if(!H.current){const _e=t?0:s;if(Math.hypot(te-Z,ne-ce)<=_e)return;ee(),a==null||a($)}H.current=!0;const de={startX:Z,startY:ce,x:te<Z?te:Z,y:ne<ce?ne:ce,width:Math.abs(te-Z),height:Math.abs(ne-ce)},me=I.current,$e=R.current;I.current=new Set(Fk(Q,de,E,n===Kd.Partial,!0).map(_e=>_e.id)),R.current=new Set;const Ce=(G==null?void 0:G.selectable)??!0;for(const _e of I.current){const Be=B.get(_e);if(Be)for(const{edgeId:at}of Be.values()){const yt=V.get(at);yt&&(yt.selectable??Ce)&&R.current.add(at)}}if(!PN(me,I.current)){const _e=ac(Q,I.current,!0);re(_e)}if(!PN($e,R.current)){const _e=ac(V,R.current);ue(_e)}v.setState({userSelectionRect:de,userSelectionActive:!0,nodesSelectionActive:!1})},z=$=>{var W,E;$.button===0&&((E=(W=$.target)==null?void 0:W.releasePointerCapture)==null||E.call(W,$.pointerId),!w&&$.target===N.current&&v.getState().userSelectionRect&&(A==null||A($)),v.setState({userSelectionActive:!1,userSelectionRect:null}),H.current&&(l==null||l($),v.setState({nodesSelectionActive:I.current.size>0})))},F=r===!0||Array.isArray(r)&&r.includes(0);return i.jsxs("div",{className:Gn(["react-flow__pane",{draggable:F,dragging:k,selection:e}]),onClick:j?void 0:Gy(A,N),onContextMenu:Gy(L,N),onWheel:Gy(D,N),onPointerEnter:j?void 0:f,onPointerMove:j?K:p,onPointerUp:j?z:void 0,onPointerDownCapture:j?M:void 0,onClickCapture:j?O:void 0,onPointerLeave:h,ref:N,style:ag,children:[y,i.jsx(BW,{})]})}function Gx({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 sR({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:o,nodeClickDistance:a}){const l=hn(),[c,u]=m.useState(!1),d=m.useRef();return m.useEffect(()=>{d.current=w4({getStoreItems:()=>l.getState(),onNodeMouseDown:f=>{Gx({id:f,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 f;(f=d.current)==null||f.destroy()}},[n,r,t,o,e,s,a]),c}const VW=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function iR(){const e=hn();return m.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:o,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:d}=e.getState(),f=new Map,p=VW(a),h=s?o[0]:5,y=s?o[1]:5,v=n.direction.x*h*n.factor,w=n.direction.y*y*n.factor;for(const[,g]of u){if(!p(g))continue;let k={x:g.internals.positionAbsolute.x+v,y:g.internals.positionAbsolute.y+w};s&&(k=xf(k,o));const{position:b,positionAbsolute:j}=kI({nodeId:g.id,nextPosition:k,nodeLookup:u,nodeExtent:r,nodeOrigin:d,onError:l});g.position=b,g.internals.positionAbsolute=j,f.set(g.id,g)}c(f)},[])}const Uk=m.createContext(null),KW=Uk.Provider;Uk.Consumer;const oR=()=>m.useContext(Uk),qW=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),UW=(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===Mc.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 YW({type:e="source",position:t=Ue.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:o=!0,id:a,onConnect:l,children:c,className:u,onMouseDown:d,onTouchStart:f,...p},h){var K,z;const y=a||null,v=e==="target",w=hn(),g=oR(),{connectOnClick:k,noPanClassName:b,rfId:j}=Wt(qW,vn),{connectingFrom:N,connectingTo:C,clickConnecting:I,isPossibleEndHandle:R,connectionInProcess:H,clickConnectionInProcess:A,valid:L}=Wt(UW(g,y,e),vn);g||(z=(K=w.getState()).onError)==null||z.call(K,"010",$i.error010());const D=F=>{const{defaultEdgeOptions:$,onConnect:W,hasDefaultEdges:E}=w.getState(),Q={...$,...F};if(E){const{edges:V,setEdges:B}=w.getState();B(yh(Q,V))}W==null||W(Q),l==null||l(Q)},O=F=>{if(!g)return;const $=AI(F.nativeEvent);if(s&&($&&F.button===0||!$)){const W=w.getState();Ux.onPointerDown(F.nativeEvent,{handleDomNode:F.currentTarget,autoPanOnConnect:W.autoPanOnConnect,connectionMode:W.connectionMode,connectionRadius:W.connectionRadius,domNode:W.domNode,nodeLookup:W.nodeLookup,lib:W.lib,isTarget:v,handleId:y,nodeId:g,flowId:W.rfId,panBy:W.panBy,cancelConnection:W.cancelConnection,onConnectStart:W.onConnectStart,onConnectEnd:(...E)=>{var Q,V;return(V=(Q=w.getState()).onConnectEnd)==null?void 0:V.call(Q,...E)},updateConnection:W.updateConnection,onConnect:D,isValidConnection:n||((...E)=>{var Q,V;return((V=(Q=w.getState()).isValidConnection)==null?void 0:V.call(Q,...E))??!0}),getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:W.autoPanSpeed,dragThreshold:W.connectionDragThreshold})}$?d==null||d(F):f==null||f(F)},M=F=>{const{onClickConnectStart:$,onClickConnectEnd:W,connectionClickStartHandle:E,connectionMode:Q,isValidConnection:V,lib:B,rfId:re,nodeLookup:ue,connection:G}=w.getState();if(!g||!E&&!s)return;if(!E){$==null||$(F.nativeEvent,{nodeId:g,handleId:y,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:g,type:e,id:y}});return}const ee=_I(F.target),te=n||V,{connection:ne,isValid:Z}=Ux.isValid(F.nativeEvent,{handle:{nodeId:g,id:y,type:e},connectionMode:Q,fromNodeId:E.nodeId,fromHandleId:E.id||null,fromType:E.type,isValidConnection:te,flowId:re,doc:ee,lib:B,nodeLookup:ue});Z&&ne&&D(ne);const ce=structuredClone(G);delete ce.inProgress,ce.toPosition=ce.toHandle?ce.toHandle.position:null,W==null||W(F,ce),w.setState({connectionClickStartHandle:null})};return i.jsx("div",{"data-handleid":y,"data-nodeid":g,"data-handlepos":t,"data-id":`${j}-${g}-${y}-${e}`,className:Gn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",b,u,{source:!v,target:v,connectable:r,connectablestart:s,connectableend:o,clickconnecting:I,connectingfrom:N,connectingto:C,valid:L,connectionindicator:r&&(!H||R)&&(H||A?o:s)}]),onMouseDown:O,onTouchStart:O,onClick:k?M:void 0,ref:h,...p,children:c})}const Yn=m.memo(nR(YW));function GW({data:e,isConnectable:t,sourcePosition:n=Ue.Bottom}){return i.jsxs(i.Fragment,{children:[e==null?void 0:e.label,i.jsx(Yn,{type:"source",position:n,isConnectable:t})]})}function JW({data:e,isConnectable:t,targetPosition:n=Ue.Top,sourcePosition:r=Ue.Bottom}){return i.jsxs(i.Fragment,{children:[i.jsx(Yn,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,i.jsx(Yn,{type:"source",position:r,isConnectable:t})]})}function XW(){return null}function QW({data:e,isConnectable:t,targetPosition:n=Ue.Top}){return i.jsxs(i.Fragment,{children:[i.jsx(Yn,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const om={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},n1={input:GW,default:JW,output:QW,group:XW};function ZW(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 e5=e=>{const{width:t,height:n,x:r,y:s}=wf(e.nodeLookup,{filter:o=>!!o.selected});return{width:Zs(t)?t:null,height:Zs(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 t5({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=hn(),{width:s,height:o,transformString:a,userSelectionActive:l}=Wt(e5,vn),c=iR(),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(sR({nodeRef:u,disabled:!d}),!d)return null;const f=e?h=>{const y=r.getState().nodes.filter(v=>v.selected);e(h,y)}:void 0,p=h=>{Object.prototype.hasOwnProperty.call(om,h.key)&&(h.preventDefault(),c({direction:om[h.key],factor:h.shiftKey?4:1}))};return i.jsx("div",{className:Gn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:i.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:p,style:{width:s,height:o}})})}const r1=typeof window<"u"?window:void 0,n5=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function aR({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:d,selectionMode:f,onSelectionStart:p,onSelectionEnd:h,multiSelectionKeyCode:y,panActivationKeyCode:v,zoomActivationKeyCode:w,elementsSelectable:g,zoomOnScroll:k,zoomOnPinch:b,panOnScroll:j,panOnScrollSpeed:N,panOnScrollMode:C,zoomOnDoubleClick:I,panOnDrag:R,defaultViewport:H,translateExtent:A,minZoom:L,maxZoom:D,preventScrolling:O,onSelectionContextMenu:M,noWheelClassName:K,noPanClassName:z,disableKeyboardA11y:F,onViewportChange:$,isControlledViewport:W}){const{nodesSelectionActive:E,userSelectionActive:Q}=Wt(n5,vn),V=Yd(u,{target:r1}),B=Yd(v,{target:r1}),re=B||R,ue=B||j,G=d&&re!==!0,ee=V||Q||G;return LW({deleteKeyCode:c,multiSelectionKeyCode:y}),i.jsx(FW,{onPaneContextMenu:o,elementsSelectable:g,zoomOnScroll:k,zoomOnPinch:b,panOnScroll:ue,panOnScrollSpeed:N,panOnScrollMode:C,zoomOnDoubleClick:I,panOnDrag:!V&&re,defaultViewport:H,translateExtent:A,minZoom:L,maxZoom:D,zoomActivationKeyCode:w,preventScrolling:O,noWheelClassName:K,noPanClassName:z,onViewportChange:$,isControlledViewport:W,paneClickDistance:l,selectionOnDrag:G,children:i.jsxs(WW,{onSelectionStart:p,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:o,onPaneScroll:a,panOnDrag:re,isSelecting:!!ee,selectionMode:f,selectionKeyPressed:V,paneClickDistance:l,selectionOnDrag:G,children:[e,E&&i.jsx(t5,{onSelectionContextMenu:M,noPanClassName:z,disableKeyboardA11y:F})]})})}aR.displayName="FlowRenderer";const r5=m.memo(aR),s5=e=>t=>e?Fk(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 i5(e){return Wt(m.useCallback(s5(e),[e]),vn)}const o5=e=>e.updateNodeInternals;function a5(){const e=Wt(o5),[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 l5({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=hn(),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 f=u.current!==t,p=l.current!==e.sourcePosition,h=c.current!==e.targetPosition;(f||p||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 c5({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:o,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:f,noDragClassName:p,noPanClassName:h,disableKeyboardA11y:y,rfId:v,nodeTypes:w,nodeClickDistance:g,onError:k}){const{node:b,internals:j,isParent:N}=Wt(te=>{const ne=te.nodeLookup.get(e),Z=te.parentLookup.has(e);return{node:ne,internals:ne.internals,isParent:Z}},vn);let C=b.type||"default",I=(w==null?void 0:w[C])||n1[C];I===void 0&&(k==null||k("003",$i.error003(C)),C="default",I=(w==null?void 0:w.default)||n1.default);const R=!!(b.draggable||l&&typeof b.draggable>"u"),H=!!(b.selectable||c&&typeof b.selectable>"u"),A=!!(b.connectable||u&&typeof b.connectable>"u"),L=!!(b.focusable||d&&typeof b.focusable>"u"),D=hn(),O=NI(b),M=l5({node:b,nodeType:C,hasDimensions:O,resizeObserver:f}),K=sR({nodeRef:M,disabled:b.hidden||!R,noDragClassName:p,handleSelector:b.dragHandle,nodeId:e,isSelectable:H,nodeClickDistance:g}),z=iR();if(b.hidden)return null;const F=go(b),$=ZW(b),W=H||R||t||n||r||s,E=n?te=>n(te,{...j.userNode}):void 0,Q=r?te=>r(te,{...j.userNode}):void 0,V=s?te=>s(te,{...j.userNode}):void 0,B=o?te=>o(te,{...j.userNode}):void 0,re=a?te=>a(te,{...j.userNode}):void 0,ue=te=>{const{selectNodesOnDrag:ne,nodeDragThreshold:Z}=D.getState();H&&(!ne||!R||Z>0)&&Gx({id:e,store:D,nodeRef:M}),t&&t(te,{...j.userNode})},G=te=>{if(!(EI(te.nativeEvent)||y)){if(gI.includes(te.key)&&H){const ne=te.key==="Escape";Gx({id:e,store:D,unselect:ne,nodeRef:M})}else if(R&&b.selected&&Object.prototype.hasOwnProperty.call(om,te.key)){te.preventDefault();const{ariaLabelConfig:ne}=D.getState();D.setState({ariaLiveMessage:ne["node.a11yDescription.ariaLiveMessage"]({direction:te.key.replace("Arrow","").toLowerCase(),x:~~j.positionAbsolute.x,y:~~j.positionAbsolute.y})}),z({direction:om[te.key],factor:te.shiftKey?4:1})}}},ee=()=>{var $e;if(y||!(($e=M.current)!=null&&$e.matches(":focus-visible")))return;const{transform:te,width:ne,height:Z,autoPanOnNodeFocus:ce,setCenter:de}=D.getState();if(!ce)return;Fk(new Map([[e,b]]),{x:0,y:0,width:ne,height:Z},te,!0).length>0||de(b.position.x+F.width/2,b.position.y+F.height/2,{zoom:te[2]})};return i.jsx("div",{className:Gn(["react-flow__node",`react-flow__node-${C}`,{[h]:R},b.className,{selected:b.selected,selectable:H,parent:N,draggable:R,dragging:K}]),ref:M,style:{zIndex:j.z,transform:`translate(${j.positionAbsolute.x}px,${j.positionAbsolute.y}px)`,pointerEvents:W?"all":"none",visibility:O?"visible":"hidden",...b.style,...$},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:E,onMouseMove:Q,onMouseLeave:V,onContextMenu:B,onClick:ue,onDoubleClick:re,onKeyDown:L?G:void 0,tabIndex:L?0:void 0,onFocus:L?ee:void 0,role:b.ariaRole??(L?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${QI}-${v}`,"aria-label":b.ariaLabel,...b.domAttributes,children:i.jsx(KW,{value:e,children:i.jsx(I,{id:e,data:b.data,type:C,positionAbsoluteX:j.positionAbsolute.x,positionAbsoluteY:j.positionAbsolute.y,selected:b.selected??!1,selectable:H,draggable:R,deletable:b.deletable??!0,isConnectable:A,sourcePosition:b.sourcePosition,targetPosition:b.targetPosition,dragging:K,dragHandle:b.dragHandle,zIndex:j.z,parentId:b.parentId,...F})})})}var u5=m.memo(c5);const d5=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function lR(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:o}=Wt(d5,vn),a=i5(e.onlyRenderVisibleElements),l=a5();return i.jsx("div",{className:"react-flow__nodes",style:ag,children:a.map(c=>i.jsx(u5,{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))})}lR.displayName="NodeRenderer";const f5=m.memo(lR);function p5(e){return Wt(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&&e4({sourceNode:o,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),vn)}const h5=({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"})},m5=({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"})},s1={[ji.Arrow]:h5,[ji.ArrowClosed]:m5};function g5(e){const t=hn();return m.useMemo(()=>{var s,o;return Object.prototype.hasOwnProperty.call(s1,e)?s1[e]:((o=(s=t.getState()).onError)==null||o.call(s,"009",$i.error009(e)),null)},[e])}const y5=({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=g5(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},cR=({defaultColor:e,rfId:t})=>{const n=Wt(o=>o.edges),r=Wt(o=>o.defaultEdgeOptions),s=m.useMemo(()=>a4(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(y5,{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};cR.displayName="MarkerDefinitions";var w5=m.memo(cR);function uR({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[f,p]=m.useState({x:1,y:0,width:0,height:0}),h=Gn(["react-flow__edge-textwrapper",u]),y=m.useRef(null);return m.useEffect(()=>{if(y.current){const v=y.current.getBBox();p({x:v.x,y:v.y,width:v.width,height:v.height})}},[n]),n?i.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:h,visibility:f.width?"visible":"hidden",...d,children:[s&&i.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:o,rx:l,ry:l}),i.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:y,style:r,children:n}),c]}):null}uR.displayName="EdgeText";const x5=m.memo(uR);function lg({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:Gn(["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&&Zs(t)&&Zs(n)?i.jsx(x5,{x:t,y:n,label:r,labelStyle:s,labelShowBg:o,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function i1({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===Ue.Left||e===Ue.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function dR({sourceX:e,sourceY:t,sourcePosition:n=Ue.Bottom,targetX:r,targetY:s,targetPosition:o=Ue.Top}){const[a,l]=i1({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,u]=i1({pos:o,x1:r,y1:s,x2:e,y2:t}),[d,f,p,h]=PI({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,f,p,h]}function fR(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:f,labelBgPadding:p,labelBgBorderRadius:h,style:y,markerEnd:v,markerStart:w,interactionWidth:g})=>{const[k,b,j]=dR({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:o,targetPosition:l}),N=e.isInternal?void 0:t;return i.jsx(lg,{id:N,path:k,labelX:b,labelY:j,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:y,markerEnd:v,markerStart:w,interactionWidth:g})})}const b5=fR({isInternal:!1}),pR=fR({isInternal:!0});b5.displayName="SimpleBezierEdge";pR.displayName="SimpleBezierEdgeInternal";function hR(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:f,style:p,sourcePosition:h=Ue.Bottom,targetPosition:y=Ue.Top,markerEnd:v,markerStart:w,pathOptions:g,interactionWidth:k})=>{const[b,j,N]=Vx({sourceX:n,sourceY:r,sourcePosition:h,targetX:s,targetY:o,targetPosition:y,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset,stepPosition:g==null?void 0:g.stepPosition}),C=e.isInternal?void 0:t;return i.jsx(lg,{id:C,path:b,labelX:j,labelY:N,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:p,markerEnd:v,markerStart:w,interactionWidth:k})})}const mR=hR({isInternal:!1}),gR=hR({isInternal:!0});mR.displayName="SmoothStepEdge";gR.displayName="SmoothStepEdgeInternal";function yR(e){return m.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return i.jsx(mR,{...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 k5=yR({isInternal:!1}),wR=yR({isInternal:!0});k5.displayName="StepEdge";wR.displayName="StepEdgeInternal";function xR(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:f,style:p,markerEnd:h,markerStart:y,interactionWidth:v})=>{const[w,g,k]=TI({sourceX:n,sourceY:r,targetX:s,targetY:o}),b=e.isInternal?void 0:t;return i.jsx(lg,{id:b,path:w,labelX:g,labelY:k,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:p,markerEnd:h,markerStart:y,interactionWidth:v})})}const v5=xR({isInternal:!1}),bR=xR({isInternal:!0});v5.displayName="StraightEdge";bR.displayName="StraightEdgeInternal";function kR(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:o,sourcePosition:a=Ue.Bottom,targetPosition:l=Ue.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:y,markerEnd:v,markerStart:w,pathOptions:g,interactionWidth:k})=>{const[b,j,N]=II({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:o,targetPosition:l,curvature:g==null?void 0:g.curvature}),C=e.isInternal?void 0:t;return i.jsx(lg,{id:C,path:b,labelX:j,labelY:N,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:p,labelBgBorderRadius:h,style:y,markerEnd:v,markerStart:w,interactionWidth:k})})}const S5=kR({isInternal:!1}),vR=kR({isInternal:!0});S5.displayName="BezierEdge";vR.displayName="BezierEdgeInternal";const o1={default:vR,straight:bR,step:wR,smoothstep:gR,simplebezier:pR},a1={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},j5=(e,t,n)=>n===Ue.Left?e-t:n===Ue.Right?e+t:e,N5=(e,t,n)=>n===Ue.Top?e-t:n===Ue.Bottom?e+t:e,l1="react-flow__edgeupdater";function c1({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:Gn([l1,`${l1}-${l}`]),cx:j5(t,r,e),cy:N5(n,r,e),r,stroke:"transparent",fill:"transparent"})}function C5({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:o,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:p,setUpdateHover:h}){const y=hn(),v=(j,N)=>{if(j.button!==0)return;const{autoPanOnConnect:C,domNode:I,connectionMode:R,connectionRadius:H,lib:A,onConnectStart:L,cancelConnection:D,nodeLookup:O,rfId:M,panBy:K,updateConnection:z}=y.getState(),F=N.type==="target",$=(Q,V)=>{p(!1),f==null||f(Q,n,N.type,V)},W=Q=>u==null?void 0:u(n,Q),E=(Q,V)=>{p(!0),d==null||d(j,n,N.type),L==null||L(Q,V)};Ux.onPointerDown(j.nativeEvent,{autoPanOnConnect:C,connectionMode:R,connectionRadius:H,domNode:I,handleId:N.id,nodeId:N.nodeId,nodeLookup:O,isTarget:F,edgeUpdaterType:N.type,lib:A,flowId:M,cancelConnection:D,panBy:K,isValidConnection:(...Q)=>{var V,B;return((B=(V=y.getState()).isValidConnection)==null?void 0:B.call(V,...Q))??!0},onConnect:W,onConnectStart:E,onConnectEnd:(...Q)=>{var V,B;return(B=(V=y.getState()).onConnectEnd)==null?void 0:B.call(V,...Q)},onReconnectEnd:$,updateConnection:z,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,dragThreshold:y.getState().connectionDragThreshold,handleDomNode:j.currentTarget})},w=j=>v(j,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),g=j=>v(j,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),k=()=>h(!0),b=()=>h(!1);return i.jsxs(i.Fragment,{children:[(e===!0||e==="source")&&i.jsx(c1,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:w,onMouseEnter:k,onMouseOut:b,type:"source"}),(e===!0||e==="target")&&i.jsx(c1,{position:c,centerX:o,centerY:a,radius:t,onMouseDown:g,onMouseEnter:k,onMouseOut:b,type:"target"})]})}function _5({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:o,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:d,onReconnect:f,onReconnectStart:p,onReconnectEnd:h,rfId:y,edgeTypes:v,noPanClassName:w,onError:g,disableKeyboardA11y:k}){let b=Wt(de=>de.edgeLookup.get(e));const j=Wt(de=>de.defaultEdgeOptions);b=j?{...j,...b}:b;let N=b.type||"default",C=(v==null?void 0:v[N])||o1[N];C===void 0&&(g==null||g("011",$i.error011(N)),N="default",C=(v==null?void 0:v.default)||o1.default);const I=!!(b.focusable||t&&typeof b.focusable>"u"),R=typeof f<"u"&&(b.reconnectable||n&&typeof b.reconnectable>"u"),H=!!(b.selectable||r&&typeof b.selectable>"u"),A=m.useRef(null),[L,D]=m.useState(!1),[O,M]=m.useState(!1),K=hn(),{zIndex:z,sourceX:F,sourceY:$,targetX:W,targetY:E,sourcePosition:Q,targetPosition:V}=Wt(m.useCallback(de=>{const me=de.nodeLookup.get(b.source),$e=de.nodeLookup.get(b.target);if(!me||!$e)return{zIndex:b.zIndex,...a1};const Ce=o4({id:e,sourceNode:me,targetNode:$e,sourceHandle:b.sourceHandle||null,targetHandle:b.targetHandle||null,connectionMode:de.connectionMode,onError:g});return{zIndex:ZH({selected:b.selected,zIndex:b.zIndex,sourceNode:me,targetNode:$e,elevateOnSelect:de.elevateEdgesOnSelect,zIndexMode:de.zIndexMode}),...Ce||a1}},[b.source,b.target,b.sourceHandle,b.targetHandle,b.selected,b.zIndex]),vn),B=m.useMemo(()=>b.markerStart?`url('#${Kx(b.markerStart,y)}')`:void 0,[b.markerStart,y]),re=m.useMemo(()=>b.markerEnd?`url('#${Kx(b.markerEnd,y)}')`:void 0,[b.markerEnd,y]);if(b.hidden||F===null||$===null||W===null||E===null)return null;const ue=de=>{var _e;const{addSelectedEdges:me,unselectNodesAndEdges:$e,multiSelectionActive:Ce}=K.getState();H&&(K.setState({nodesSelectionActive:!1}),b.selected&&Ce?($e({nodes:[],edges:[b]}),(_e=A.current)==null||_e.blur()):me([e])),s&&s(de,b)},G=o?de=>{o(de,{...b})}:void 0,ee=a?de=>{a(de,{...b})}:void 0,te=l?de=>{l(de,{...b})}:void 0,ne=c?de=>{c(de,{...b})}:void 0,Z=u?de=>{u(de,{...b})}:void 0,ce=de=>{var me;if(!k&&gI.includes(de.key)&&H){const{unselectNodesAndEdges:$e,addSelectedEdges:Ce}=K.getState();de.key==="Escape"?((me=A.current)==null||me.blur(),$e({edges:[b]})):Ce([e])}};return i.jsx("svg",{style:{zIndex:z},children:i.jsxs("g",{className:Gn(["react-flow__edge",`react-flow__edge-${N}`,b.className,w,{selected:b.selected,animated:b.animated,inactive:!H&&!s,updating:L,selectable:H}]),onClick:ue,onDoubleClick:G,onContextMenu:ee,onMouseEnter:te,onMouseMove:ne,onMouseLeave:Z,onKeyDown:I?ce:void 0,tabIndex:I?0:void 0,role:b.ariaRole??(I?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":b.ariaLabel===null?void 0:b.ariaLabel||`Edge from ${b.source} to ${b.target}`,"aria-describedby":I?`${ZI}-${y}`:void 0,ref:A,...b.domAttributes,children:[!O&&i.jsx(C,{id:e,source:b.source,target:b.target,type:b.type,selected:b.selected,animated:b.animated,selectable:H,deletable:b.deletable??!0,label:b.label,labelStyle:b.labelStyle,labelShowBg:b.labelShowBg,labelBgStyle:b.labelBgStyle,labelBgPadding:b.labelBgPadding,labelBgBorderRadius:b.labelBgBorderRadius,sourceX:F,sourceY:$,targetX:W,targetY:E,sourcePosition:Q,targetPosition:V,data:b.data,style:b.style,sourceHandleId:b.sourceHandle,targetHandleId:b.targetHandle,markerStart:B,markerEnd:re,pathOptions:"pathOptions"in b?b.pathOptions:void 0,interactionWidth:b.interactionWidth}),R&&i.jsx(C5,{edge:b,isReconnectable:R,reconnectRadius:d,onReconnect:f,onReconnectStart:p,onReconnectEnd:h,sourceX:F,sourceY:$,targetX:W,targetY:E,sourcePosition:Q,targetPosition:V,setUpdateHover:D,setReconnecting:M})]})})}var E5=m.memo(_5);const A5=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function SR({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:o,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:d,reconnectRadius:f,onEdgeDoubleClick:p,onReconnectStart:h,onReconnectEnd:y,disableKeyboardA11y:v}){const{edgesFocusable:w,edgesReconnectable:g,elementsSelectable:k,onError:b}=Wt(A5,vn),j=p5(t);return i.jsxs("div",{className:"react-flow__edges",children:[i.jsx(w5,{defaultColor:e,rfId:n}),j.map(N=>i.jsx(E5,{id:N,edgesFocusable:w,edgesReconnectable:g,elementsSelectable:k,noPanClassName:s,onReconnect:o,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:d,reconnectRadius:f,onDoubleClick:p,onReconnectStart:h,onReconnectEnd:y,rfId:n,onError:b,edgeTypes:r,disableKeyboardA11y:v},N))]})}SR.displayName="EdgeRenderer";const P5=m.memo(SR),I5=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function R5({children:e}){const t=Wt(I5);return i.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function T5(e){const t=Uc(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const M5=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function $5(e){const t=Wt(M5),n=hn();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function L5(e){return e.connection.inProgress?{...e.connection,to:bf(e.connection.to,e.transform)}:{...e.connection}}function O5(e){return L5}function D5(e){const t=O5();return Wt(t,vn)}const F5=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function z5({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:o,height:a,isValid:l,inProgress:c}=Wt(F5,vn);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:Gn(["react-flow__connection",xI(l)]),children:i.jsx(jR,{style:t,type:n,CustomComponent:r,isValid:l})})})}const jR=({style:e,type:t=Fo.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:o,fromNode:a,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:p,pointer:h}=D5();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:p,connectionStatus:xI(r),toNode:d,toHandle:f,pointer:h});let y="";const v={sourceX:o.x,sourceY:o.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:p};switch(t){case Fo.Bezier:[y]=II(v);break;case Fo.SimpleBezier:[y]=dR(v);break;case Fo.Step:[y]=Vx({...v,borderRadius:0});break;case Fo.SmoothStep:[y]=Vx(v);break;default:[y]=TI(v)}return i.jsx("path",{d:y,fill:"none",className:"react-flow__connection-path",style:e})};jR.displayName="ConnectionLine";const B5={};function u1(e=B5){m.useRef(e),hn(),m.useEffect(()=>{},[e])}function H5(){hn(),m.useRef(!1),m.useEffect(()=>{},[])}function NR({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:o,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,onSelectionContextMenu:f,onSelectionStart:p,onSelectionEnd:h,connectionLineType:y,connectionLineStyle:v,connectionLineComponent:w,connectionLineContainerStyle:g,selectionKeyCode:k,selectionOnDrag:b,selectionMode:j,multiSelectionKeyCode:N,panActivationKeyCode:C,zoomActivationKeyCode:I,deleteKeyCode:R,onlyRenderVisibleElements:H,elementsSelectable:A,defaultViewport:L,translateExtent:D,minZoom:O,maxZoom:M,preventScrolling:K,defaultMarkerColor:z,zoomOnScroll:F,zoomOnPinch:$,panOnScroll:W,panOnScrollSpeed:E,panOnScrollMode:Q,zoomOnDoubleClick:V,panOnDrag:B,onPaneClick:re,onPaneMouseEnter:ue,onPaneMouseMove:G,onPaneMouseLeave:ee,onPaneScroll:te,onPaneContextMenu:ne,paneClickDistance:Z,nodeClickDistance:ce,onEdgeContextMenu:de,onEdgeMouseEnter:me,onEdgeMouseMove:$e,onEdgeMouseLeave:Ce,reconnectRadius:_e,onReconnect:Be,onReconnectStart:at,onReconnectEnd:yt,noDragClassName:Te,noWheelClassName:it,noPanClassName:gt,disableKeyboardA11y:$t,nodeExtent:be,rfId:He,viewport:ie,onViewportChange:ke}){return u1(e),u1(t),H5(),T5(n),$5(ie),i.jsx(r5,{onPaneClick:re,onPaneMouseEnter:ue,onPaneMouseMove:G,onPaneMouseLeave:ee,onPaneContextMenu:ne,onPaneScroll:te,paneClickDistance:Z,deleteKeyCode:R,selectionKeyCode:k,selectionOnDrag:b,selectionMode:j,onSelectionStart:p,onSelectionEnd:h,multiSelectionKeyCode:N,panActivationKeyCode:C,zoomActivationKeyCode:I,elementsSelectable:A,zoomOnScroll:F,zoomOnPinch:$,zoomOnDoubleClick:V,panOnScroll:W,panOnScrollSpeed:E,panOnScrollMode:Q,panOnDrag:B,defaultViewport:L,translateExtent:D,minZoom:O,maxZoom:M,onSelectionContextMenu:f,preventScrolling:K,noDragClassName:Te,noWheelClassName:it,noPanClassName:gt,disableKeyboardA11y:$t,onViewportChange:ke,isControlledViewport:!!ie,children:i.jsxs(R5,{children:[i.jsx(P5,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:Be,onReconnectStart:at,onReconnectEnd:yt,onlyRenderVisibleElements:H,onEdgeContextMenu:de,onEdgeMouseEnter:me,onEdgeMouseMove:$e,onEdgeMouseLeave:Ce,reconnectRadius:_e,defaultMarkerColor:z,noPanClassName:gt,disableKeyboardA11y:$t,rfId:He}),i.jsx(z5,{style:v,type:y,component:w,containerStyle:g}),i.jsx("div",{className:"react-flow__edgelabel-renderer"}),i.jsx(f5,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:o,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:d,nodeClickDistance:ce,onlyRenderVisibleElements:H,noPanClassName:gt,noDragClassName:Te,disableKeyboardA11y:$t,nodeExtent:be,rfId:He}),i.jsx("div",{className:"react-flow__viewport-portal"})]})})}NR.displayName="GraphView";const W5=m.memo(NR),d1=({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:f,zIndexMode:p="basic"}={})=>{const h=new Map,y=new Map,v=new Map,w=new Map,g=r??t??[],k=n??e??[],b=d??[0,0],j=f??Vd;LI(v,w,g);const{nodesInitialized:N}=qx(k,h,y,{nodeOrigin:b,nodeExtent:j,zIndexMode:p});let C=[0,0,1];if(a&&s&&o){const I=wf(h,{filter:L=>!!((L.width||L.initialWidth)&&(L.height||L.initialHeight))}),{x:R,y:H,zoom:A}=zk(I,s,o,c,u,(l==null?void 0:l.padding)??.1);C=[R,H,A]}return{rfId:"1",width:s??0,height:o??0,transform:C,nodes:k,nodesInitialized:N,nodeLookup:h,parentLookup:y,edges:g,edgeLookup:w,connectionLookup:v,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Vd,nodeExtent:j,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Mc.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:b,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:{...wI},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:UH,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:yI,zIndexMode:p,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},V5=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:o,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p})=>cW((h,y)=>{async function v(){const{nodeLookup:w,panZoom:g,fitViewOptions:k,fitViewResolver:b,width:j,height:N,minZoom:C,maxZoom:I}=y();g&&(await KH({nodes:w,width:j,height:N,panZoom:g,minZoom:C,maxZoom:I},k),b==null||b.resolve(!0),h({fitViewResolver:null}))}return{...d1({nodes:e,edges:t,width:s,height:o,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:d,nodeExtent:f,defaultNodes:n,defaultEdges:r,zIndexMode:p}),setNodes:w=>{const{nodeLookup:g,parentLookup:k,nodeOrigin:b,elevateNodesOnSelect:j,fitViewQueued:N,zIndexMode:C,nodesSelectionActive:I}=y(),{nodesInitialized:R,hasSelectedNodes:H}=qx(w,g,k,{nodeOrigin:b,nodeExtent:f,elevateNodesOnSelect:j,checkEquality:!0,zIndexMode:C}),A=I&&H;N&&R?(v(),h({nodes:w,nodesInitialized:R,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:A})):h({nodes:w,nodesInitialized:R,nodesSelectionActive:A})},setEdges:w=>{const{connectionLookup:g,edgeLookup:k}=y();LI(g,k,w),h({edges:w})},setDefaultNodesAndEdges:(w,g)=>{if(w){const{setNodes:k}=y();k(w),h({hasDefaultNodes:!0})}if(g){const{setEdges:k}=y();k(g),h({hasDefaultEdges:!0})}},updateNodeInternals:w=>{const{triggerNodeChanges:g,nodeLookup:k,parentLookup:b,domNode:j,nodeOrigin:N,nodeExtent:C,debug:I,fitViewQueued:R,zIndexMode:H}=y(),{changes:A,updatedInternals:L}=h4(w,k,b,j,N,C,H);L&&(u4(k,b,{nodeOrigin:N,nodeExtent:C,zIndexMode:H}),R?(v(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(A==null?void 0:A.length)>0&&(I&&console.log("React Flow: trigger node changes",A),g==null||g(A)))},updateNodePositions:(w,g=!1)=>{const k=[];let b=[];const{nodeLookup:j,triggerNodeChanges:N,connection:C,updateConnection:I,onNodesChangeMiddlewareMap:R}=y();for(const[H,A]of w){const L=j.get(H),D=!!(L!=null&&L.expandParent&&(L!=null&&L.parentId)&&(A!=null&&A.position)),O={id:H,type:"position",position:D?{x:Math.max(0,A.position.x),y:Math.max(0,A.position.y)}:A.position,dragging:g};if(L&&C.inProgress&&C.fromNode.id===L.id){const M=tl(L,C.fromHandle,Ue.Left,!0);I({...C,from:M})}D&&L.parentId&&k.push({id:H,parentId:L.parentId,rect:{...A.internals.positionAbsolute,width:A.measured.width??0,height:A.measured.height??0}}),b.push(O)}if(k.length>0){const{parentLookup:H,nodeOrigin:A}=y(),L=qk(k,j,H,A);b.push(...L)}for(const H of R.values())b=H(b);N(b)},triggerNodeChanges:w=>{const{onNodesChange:g,setNodes:k,nodes:b,hasDefaultNodes:j,debug:N}=y();if(w!=null&&w.length){if(j){const C=md(w,b);k(C)}N&&console.log("React Flow: trigger node changes",w),g==null||g(w)}},triggerEdgeChanges:w=>{const{onEdgesChange:g,setEdges:k,edges:b,hasDefaultEdges:j,debug:N}=y();if(w!=null&&w.length){if(j){const C=im(w,b);k(C)}N&&console.log("React Flow: trigger edge changes",w),g==null||g(w)}},addSelectedNodes:w=>{const{multiSelectionActive:g,edgeLookup:k,nodeLookup:b,triggerNodeChanges:j,triggerEdgeChanges:N}=y();if(g){const C=w.map(I=>Aa(I,!0));j(C);return}j(ac(b,new Set([...w]),!0)),N(ac(k))},addSelectedEdges:w=>{const{multiSelectionActive:g,edgeLookup:k,nodeLookup:b,triggerNodeChanges:j,triggerEdgeChanges:N}=y();if(g){const C=w.map(I=>Aa(I,!0));N(C);return}N(ac(k,new Set([...w]))),j(ac(b,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:g}={})=>{const{edges:k,nodes:b,nodeLookup:j,triggerNodeChanges:N,triggerEdgeChanges:C}=y(),I=w||b,R=g||k,H=[];for(const L of I){if(!L.selected)continue;const D=j.get(L.id);D&&(D.selected=!1),H.push(Aa(L.id,!1))}const A=[];for(const L of R)L.selected&&A.push(Aa(L.id,!1));N(H),C(A)},setMinZoom:w=>{const{panZoom:g,maxZoom:k}=y();g==null||g.setScaleExtent([w,k]),h({minZoom:w})},setMaxZoom:w=>{const{panZoom:g,minZoom:k}=y();g==null||g.setScaleExtent([k,w]),h({maxZoom:w})},setTranslateExtent:w=>{var g;(g=y().panZoom)==null||g.setTranslateExtent(w),h({translateExtent:w})},resetSelectedElements:()=>{const{edges:w,nodes:g,triggerNodeChanges:k,triggerEdgeChanges:b,elementsSelectable:j}=y();if(!j)return;const N=g.reduce((I,R)=>R.selected?[...I,Aa(R.id,!1)]:I,[]),C=w.reduce((I,R)=>R.selected?[...I,Aa(R.id,!1)]:I,[]);k(N),b(C)},setNodeExtent:w=>{const{nodes:g,nodeLookup:k,parentLookup:b,nodeOrigin:j,elevateNodesOnSelect:N,nodeExtent:C,zIndexMode:I}=y();w[0][0]===C[0][0]&&w[0][1]===C[0][1]&&w[1][0]===C[1][0]&&w[1][1]===C[1][1]||(qx(g,k,b,{nodeOrigin:j,nodeExtent:w,elevateNodesOnSelect:N,checkEquality:!1,zIndexMode:I}),h({nodeExtent:w}))},panBy:w=>{const{transform:g,width:k,height:b,panZoom:j,translateExtent:N}=y();return m4({delta:w,panZoom:j,transform:g,translateExtent:N,width:k,height:b})},setCenter:async(w,g,k)=>{const{width:b,height:j,maxZoom:N,panZoom:C}=y();if(!C)return Promise.resolve(!1);const I=typeof(k==null?void 0:k.zoom)<"u"?k.zoom:N;return await C.setViewport({x:b/2-w*I,y:j/2-g*I,zoom:I},{duration:k==null?void 0:k.duration,ease:k==null?void 0:k.ease,interpolate:k==null?void 0:k.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...wI}})},updateConnection:w=>{h({connection:w})},reset:()=>h({...d1()})}},Object.is);function Yk({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:o,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:d,nodeExtent:f,zIndexMode:p,children:h}){const[y]=m.useState(()=>V5({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:o,fitView:u,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:d,nodeExtent:f,zIndexMode:p}));return i.jsx(uW,{value:y,children:i.jsx(RW,{children:h})})}function K5({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:o,height:a,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:d,nodeOrigin:f,nodeExtent:p,zIndexMode:h}){return m.useContext(ig)?i.jsx(i.Fragment,{children:e}):i.jsx(Yk,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:o,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:d,nodeOrigin:f,nodeExtent:p,zIndexMode:h,children:e})}const q5={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function U5({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:o,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:d,onMoveStart:f,onMoveEnd:p,onConnect:h,onConnectStart:y,onConnectEnd:v,onClickConnectStart:w,onClickConnectEnd:g,onNodeMouseEnter:k,onNodeMouseMove:b,onNodeMouseLeave:j,onNodeContextMenu:N,onNodeDoubleClick:C,onNodeDragStart:I,onNodeDrag:R,onNodeDragStop:H,onNodesDelete:A,onEdgesDelete:L,onDelete:D,onSelectionChange:O,onSelectionDragStart:M,onSelectionDrag:K,onSelectionDragStop:z,onSelectionContextMenu:F,onSelectionStart:$,onSelectionEnd:W,onBeforeDelete:E,connectionMode:Q,connectionLineType:V=Fo.Bezier,connectionLineStyle:B,connectionLineComponent:re,connectionLineContainerStyle:ue,deleteKeyCode:G="Backspace",selectionKeyCode:ee="Shift",selectionOnDrag:te=!1,selectionMode:ne=Kd.Full,panActivationKeyCode:Z="Space",multiSelectionKeyCode:ce=Ud()?"Meta":"Control",zoomActivationKeyCode:de=Ud()?"Meta":"Control",snapToGrid:me,snapGrid:$e,onlyRenderVisibleElements:Ce=!1,selectNodesOnDrag:_e,nodesDraggable:Be,autoPanOnNodeFocus:at,nodesConnectable:yt,nodesFocusable:Te,nodeOrigin:it=eR,edgesFocusable:gt,edgesReconnectable:$t,elementsSelectable:be=!0,defaultViewport:He=SW,minZoom:ie=.5,maxZoom:ke=2,translateExtent:Fe=Vd,preventScrolling:Ze=!0,nodeExtent:Ne,defaultMarkerColor:St="#b1b1b7",zoomOnScroll:Jt=!0,zoomOnPinch:Vt=!0,panOnScroll:ot=!1,panOnScrollSpeed:On=.5,panOnScrollMode:se=Va.Free,zoomOnDoubleClick:Ie=!0,panOnDrag:et=!0,onPaneClick:qe,onPaneMouseEnter:Et,onPaneMouseMove:vt,onPaneMouseLeave:Jn,onPaneScroll:mn,onPaneContextMenu:Lr,paneClickDistance:Vn=1,nodeClickDistance:ir=0,children:Xn,onReconnect:Qn,onReconnectStart:Zn,onReconnectEnd:Cr,onEdgeContextMenu:ys,onEdgeDoubleClick:Ts,onEdgeMouseEnter:Sn,onEdgeMouseMove:Dn,onEdgeMouseLeave:Zr,reconnectRadius:Tn=10,onNodesChange:Fn,onEdgesChange:es,noDragClassName:Or="nodrag",noWheelClassName:er="nowheel",noPanClassName:Xt="nopan",fitView:jn,fitViewOptions:le,connectOnClick:he,attributionPosition:nt,proOptions:ct,defaultEdgeOptions:Ft,elevateNodesOnSelect:on=!0,elevateEdgesOnSelect:Dr=!1,disableKeyboardA11y:wt=!1,autoPanOnConnect:Yt,autoPanOnNodeDrag:zt,autoPanSpeed:tr,connectionRadius:tt,isValidConnection:Mn,onError:Ms,style:ci,id:ui,nodeDragThreshold:xo,connectionDragThreshold:$s,viewport:oe,onViewportChange:ve,width:Re,height:kt,colorMode:Tt="light",debug:Qt,onScroll:gn,ariaLabelConfig:zn,zIndexMode:q="basic",...ge},Oe){const Ae=ui||"1",Ye=_W(Tt),Zt=m.useCallback(At=>{At.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),gn==null||gn(At)},[gn]);return i.jsx("div",{"data-testid":"rf__wrapper",...ge,onScroll:Zt,style:{...ci,...q5},ref:Oe,className:Gn(["react-flow",s,Ye]),id:ui,role:"application",children:i.jsxs(K5,{nodes:e,edges:t,width:Re,height:kt,fitView:jn,fitViewOptions:le,minZoom:ie,maxZoom:ke,nodeOrigin:it,nodeExtent:Ne,zIndexMode:q,children:[i.jsx(CW,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:y,onConnectEnd:v,onClickConnectStart:w,onClickConnectEnd:g,nodesDraggable:Be,autoPanOnNodeFocus:at,nodesConnectable:yt,nodesFocusable:Te,edgesFocusable:gt,edgesReconnectable:$t,elementsSelectable:be,elevateNodesOnSelect:on,elevateEdgesOnSelect:Dr,minZoom:ie,maxZoom:ke,nodeExtent:Ne,onNodesChange:Fn,onEdgesChange:es,snapToGrid:me,snapGrid:$e,connectionMode:Q,translateExtent:Fe,connectOnClick:he,defaultEdgeOptions:Ft,fitView:jn,fitViewOptions:le,onNodesDelete:A,onEdgesDelete:L,onDelete:D,onNodeDragStart:I,onNodeDrag:R,onNodeDragStop:H,onSelectionDrag:K,onSelectionDragStart:M,onSelectionDragStop:z,onMove:d,onMoveStart:f,onMoveEnd:p,noPanClassName:Xt,nodeOrigin:it,rfId:Ae,autoPanOnConnect:Yt,autoPanOnNodeDrag:zt,autoPanSpeed:tr,onError:Ms,connectionRadius:tt,isValidConnection:Mn,selectNodesOnDrag:_e,nodeDragThreshold:xo,connectionDragThreshold:$s,onBeforeDelete:E,debug:Qt,ariaLabelConfig:zn,zIndexMode:q}),i.jsx(W5,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:k,onNodeMouseMove:b,onNodeMouseLeave:j,onNodeContextMenu:N,onNodeDoubleClick:C,nodeTypes:o,edgeTypes:a,connectionLineType:V,connectionLineStyle:B,connectionLineComponent:re,connectionLineContainerStyle:ue,selectionKeyCode:ee,selectionOnDrag:te,selectionMode:ne,deleteKeyCode:G,multiSelectionKeyCode:ce,panActivationKeyCode:Z,zoomActivationKeyCode:de,onlyRenderVisibleElements:Ce,defaultViewport:He,translateExtent:Fe,minZoom:ie,maxZoom:ke,preventScrolling:Ze,zoomOnScroll:Jt,zoomOnPinch:Vt,zoomOnDoubleClick:Ie,panOnScroll:ot,panOnScrollSpeed:On,panOnScrollMode:se,panOnDrag:et,onPaneClick:qe,onPaneMouseEnter:Et,onPaneMouseMove:vt,onPaneMouseLeave:Jn,onPaneScroll:mn,onPaneContextMenu:Lr,paneClickDistance:Vn,nodeClickDistance:ir,onSelectionContextMenu:F,onSelectionStart:$,onSelectionEnd:W,onReconnect:Qn,onReconnectStart:Zn,onReconnectEnd:Cr,onEdgeContextMenu:ys,onEdgeDoubleClick:Ts,onEdgeMouseEnter:Sn,onEdgeMouseMove:Dn,onEdgeMouseLeave:Zr,reconnectRadius:Tn,defaultMarkerColor:St,noDragClassName:Or,noWheelClassName:er,noPanClassName:Xt,rfId:Ae,disableKeyboardA11y:wt,nodeExtent:Ne,viewport:oe,onViewportChange:ve}),i.jsx(vW,{onSelectionChange:O}),Xn,i.jsx(yW,{proOptions:ct,position:nt}),i.jsx(gW,{rfId:Ae,disableKeyboardA11y:wt})]})})}var CR=nR(U5);function Y5(){const e=hn();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 G5(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(o=>md(s,o)),[]);return[t,n,r]}function J5(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(o=>im(s,o)),[]);return[t,n,r]}function X5({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:Gn(["react-flow__background-pattern",n,r])})}function Q5({radius:e,className:t}){return i.jsx("circle",{cx:e,cy:e,r:e,className:Gn(["react-flow__background-pattern","dots",t])})}var Zo;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Zo||(Zo={}));const Z5={[Zo.Dots]:1,[Zo.Lines]:1,[Zo.Cross]:6},e6=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function _R({id:e,variant:t=Zo.Dots,gap:n=20,size:r,lineWidth:s=1,offset:o=0,color:a,bgColor:l,style:c,className:u,patternClassName:d}){const f=m.useRef(null),{transform:p,patternId:h}=Wt(e6,vn),y=r||Z5[t],v=t===Zo.Dots,w=t===Zo.Cross,g=Array.isArray(n)?n:[n,n],k=[g[0]*p[2]||1,g[1]*p[2]||1],b=y*p[2],j=Array.isArray(o)?o:[o,o],N=w?[b,b]:k,C=[j[0]*p[2]||1+N[0]/2,j[1]*p[2]||1+N[1]/2],I=`${h}${e||""}`;return i.jsxs("svg",{className:Gn(["react-flow__background",u]),style:{...c,...ag,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:f,"data-testid":"rf__background",children:[i.jsx("pattern",{id:I,x:p[0]%k[0],y:p[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:v?i.jsx(Q5,{radius:b/2,className:d}):i.jsx(X5,{dimensions:N,lineWidth:s,variant:t,className:d})}),i.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${I})`})]})}_R.displayName="Background";const ER=m.memo(_R);function t6(){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 n6(){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 r6(){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 s6(){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 i6(){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 Tp({children:e,className:t,...n}){return i.jsx("button",{type:"button",className:Gn(["react-flow__controls-button",t]),...n,children:e})}const o6=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function AR({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:f="bottom-left",orientation:p="vertical","aria-label":h}){const y=hn(),{isInteractive:v,minZoomReached:w,maxZoomReached:g,ariaLabelConfig:k}=Wt(o6,vn),{zoomIn:b,zoomOut:j,fitView:N}=Uc(),C=()=>{b(),o==null||o()},I=()=>{j(),a==null||a()},R=()=>{N(s),l==null||l()},H=()=>{y.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),c==null||c(!v)},A=p==="horizontal"?"horizontal":"vertical";return i.jsxs(og,{className:Gn(["react-flow__controls",A,u]),position:f,style:e,"data-testid":"rf__controls","aria-label":h??k["controls.ariaLabel"],children:[t&&i.jsxs(i.Fragment,{children:[i.jsx(Tp,{onClick:C,className:"react-flow__controls-zoomin",title:k["controls.zoomIn.ariaLabel"],"aria-label":k["controls.zoomIn.ariaLabel"],disabled:g,children:i.jsx(t6,{})}),i.jsx(Tp,{onClick:I,className:"react-flow__controls-zoomout",title:k["controls.zoomOut.ariaLabel"],"aria-label":k["controls.zoomOut.ariaLabel"],disabled:w,children:i.jsx(n6,{})})]}),n&&i.jsx(Tp,{className:"react-flow__controls-fitview",onClick:R,title:k["controls.fitView.ariaLabel"],"aria-label":k["controls.fitView.ariaLabel"],children:i.jsx(r6,{})}),r&&i.jsx(Tp,{className:"react-flow__controls-interactive",onClick:H,title:k["controls.interactive.ariaLabel"],"aria-label":k["controls.interactive.ariaLabel"],children:v?i.jsx(i6,{}):i.jsx(s6,{})}),d]})}AR.displayName="Controls";m.memo(AR);function a6({id:e,x:t,y:n,width:r,height:s,style:o,color:a,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:p,onClick:h}){const{background:y,backgroundColor:v}=o||{},w=a||y||v;return i.jsx("rect",{className:Gn(["react-flow__minimap-node",{selected:p},u]),x:t,y:n,rx:d,ry:d,width:r,height:s,style:{fill:w,stroke:l,strokeWidth:c},shapeRendering:f,onClick:h?g=>h(g,e):void 0})}const l6=m.memo(a6),c6=e=>e.nodes.map(t=>t.id),Jy=e=>e instanceof Function?e:()=>e;function u6({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:o=l6,onClick:a}){const l=Wt(c6,vn),c=Jy(t),u=Jy(e),d=Jy(n),f=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return i.jsx(i.Fragment,{children:l.map(p=>i.jsx(f6,{id:p,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:o,onClick:a,shapeRendering:f},p))})}function d6({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:o,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:u,x:d,y:f,width:p,height:h}=Wt(y=>{const v=y.nodeLookup.get(e);if(!v)return{node:void 0,x:0,y:0,width:0,height:0};const w=v.internals.userNode,{x:g,y:k}=v.internals.positionAbsolute,{width:b,height:j}=go(w);return{node:w,x:g,y:k,width:b,height:j}},vn);return!u||u.hidden||!NI(u)?null:i.jsx(l,{x:d,y:f,width:p,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 f6=m.memo(d6);var p6=m.memo(u6);const h6=200,m6=150,g6=e=>!e.hidden,y6=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?jI(wf(e.nodeLookup,{filter:g6}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},w6="react-flow__minimap-desc";function PR({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:o=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:d,maskStrokeWidth:f,position:p="bottom-right",onClick:h,onNodeClick:y,pannable:v=!1,zoomable:w=!1,ariaLabel:g,inversePan:k,zoomStep:b=1,offsetScale:j=5}){const N=hn(),C=m.useRef(null),{boundingRect:I,viewBB:R,rfId:H,panZoom:A,translateExtent:L,flowWidth:D,flowHeight:O,ariaLabelConfig:M}=Wt(y6,vn),K=(e==null?void 0:e.width)??h6,z=(e==null?void 0:e.height)??m6,F=I.width/K,$=I.height/z,W=Math.max(F,$),E=W*K,Q=W*z,V=j*W,B=I.x-(E-I.width)/2-V,re=I.y-(Q-I.height)/2-V,ue=E+V*2,G=Q+V*2,ee=`${w6}-${H}`,te=m.useRef(0),ne=m.useRef();te.current=W,m.useEffect(()=>{if(C.current&&A)return ne.current=j4({domNode:C.current,panZoom:A,getTransform:()=>N.getState().transform,getViewScale:()=>te.current}),()=>{var me;(me=ne.current)==null||me.destroy()}},[A]),m.useEffect(()=>{var me;(me=ne.current)==null||me.update({translateExtent:L,width:D,height:O,inversePan:k,pannable:v,zoomStep:b,zoomable:w})},[v,w,k,b,L,D,O]);const Z=h?me=>{var _e;const[$e,Ce]=((_e=ne.current)==null?void 0:_e.pointer(me))||[0,0];h(me,{x:$e,y:Ce})}:void 0,ce=y?m.useCallback((me,$e)=>{const Ce=N.getState().nodeLookup.get($e).internals.userNode;y(me,Ce)},[]):void 0,de=g??M["minimap.ariaLabel"];return i.jsx(og,{position:p,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 f=="number"?f*W: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:Gn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:i.jsxs("svg",{width:K,height:z,viewBox:`${B} ${re} ${ue} ${G}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ee,ref:C,onClick:Z,children:[de&&i.jsx("title",{id:ee,children:de}),i.jsx(p6,{onClick:ce,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:o,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:l}),i.jsx("path",{className:"react-flow__minimap-mask",d:`M${B-V},${re-V}h${ue+V*2}v${G+V*2}h${-ue-V*2}z
|
|
66
|
-
M${R.x},${R.y}h${R.width}v${R.height}h${-R.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}PR.displayName="MiniMap";m.memo(PR);const x6=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,b6={[Dc.Line]:"right",[Dc.Handle]:"bottom-right"};function k6({nodeId:e,position:t,variant:n=Dc.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:f=!1,resizeDirection:p,autoScale:h=!0,shouldResize:y,onResizeStart:v,onResize:w,onResizeEnd:g}){const k=oR(),b=typeof e=="string"?e:k,j=hn(),N=m.useRef(null),C=n===Dc.Handle,I=Wt(m.useCallback(x6(C&&h),[C,h]),vn),R=m.useRef(null),H=t??b6[n];m.useEffect(()=>{if(!(!N.current||!b))return R.current||(R.current=D4({domNode:N.current,nodeId:b,getStoreItems:()=>{const{nodeLookup:L,transform:D,snapGrid:O,snapToGrid:M,nodeOrigin:K,domNode:z}=j.getState();return{nodeLookup:L,transform:D,snapGrid:O,snapToGrid:M,nodeOrigin:K,paneDomNode:z}},onChange:(L,D)=>{const{triggerNodeChanges:O,nodeLookup:M,parentLookup:K,nodeOrigin:z}=j.getState(),F=[],$={x:L.x,y:L.y},W=M.get(b);if(W&&W.expandParent&&W.parentId){const E=W.origin??z,Q=L.width??W.measured.width??0,V=L.height??W.measured.height??0,B={id:W.id,parentId:W.parentId,rect:{width:Q,height:V,...CI({x:L.x??W.position.x,y:L.y??W.position.y},{width:Q,height:V},W.parentId,M,E)}},re=qk([B],M,K,z);F.push(...re),$.x=L.x?Math.max(E[0]*Q,L.x):void 0,$.y=L.y?Math.max(E[1]*V,L.y):void 0}if($.x!==void 0&&$.y!==void 0){const E={id:b,type:"position",position:{...$}};F.push(E)}if(L.width!==void 0&&L.height!==void 0){const Q={id:b,type:"dimensions",resizing:!0,setAttributes:p?p==="horizontal"?"width":"height":!0,dimensions:{width:L.width,height:L.height}};F.push(Q)}for(const E of D){const Q={...E,type:"position"};F.push(Q)}O(F)},onEnd:({width:L,height:D})=>{const O={id:b,type:"dimensions",resizing:!1,dimensions:{width:L,height:D}};j.getState().triggerNodeChanges([O])}})),R.current.update({controlPosition:H,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:d},keepAspectRatio:f,resizeDirection:p,onResizeStart:v,onResize:w,onResizeEnd:g,shouldResize:y}),()=>{var L;(L=R.current)==null||L.destroy()}},[H,l,c,u,d,f,v,w,g,y]);const A=H.split("-");return i.jsx("div",{className:Gn(["react-flow__resize-control","nodrag",...A,n,r]),ref:N,style:{...s,scale:I,...a&&{[C?"backgroundColor":"borderColor"]:a}},children:o})}const Gk=m.memo(k6),v6="modulepreload",S6=function(e){return"/"+e},f1={},j6=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=S6(c),c in f1)return;f1[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":v6,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((p,h)=>{f.addEventListener("load",p),f.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 N6(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const C6=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,_6=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,E6={};function p1(e,t){return(E6.jsx?_6:C6).test(e)}const A6=/[ \t\n\f\r]/g;function P6(e){return typeof e=="object"?e.type==="text"?h1(e.value):!1:h1(e)}function h1(e){return e.replace(A6,"")===""}class kf{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}kf.prototype.normal={};kf.prototype.property={};kf.prototype.space=void 0;function IR(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new kf(n,r,t)}function Jx(e){return e.toLowerCase()}class Qr{constructor(t,n){this.attribute=n,this.property=t}}Qr.prototype.attribute="";Qr.prototype.booleanish=!1;Qr.prototype.boolean=!1;Qr.prototype.commaOrSpaceSeparated=!1;Qr.prototype.commaSeparated=!1;Qr.prototype.defined=!1;Qr.prototype.mustUseProperty=!1;Qr.prototype.number=!1;Qr.prototype.overloadedBoolean=!1;Qr.prototype.property="";Qr.prototype.spaceSeparated=!1;Qr.prototype.space=void 0;let I6=0;const Nt=dl(),qn=dl(),Xx=dl(),Pe=dl(),dn=dl(),xc=dl(),ss=dl();function dl(){return 2**++I6}const Qx=Object.freeze(Object.defineProperty({__proto__:null,boolean:Nt,booleanish:qn,commaOrSpaceSeparated:ss,commaSeparated:xc,number:Pe,overloadedBoolean:Xx,spaceSeparated:dn},Symbol.toStringTag,{value:"Module"})),Xy=Object.keys(Qx);class Jk extends Qr{constructor(t,n,r,s){let o=-1;if(super(t,n),m1(this,"space",s),typeof r=="number")for(;++o<Xy.length;){const a=Xy[o];m1(this,Xy[o],(r&Qx[a])===Qx[a])}}}Jk.prototype.defined=!0;function m1(e,t,n){n&&(e[t]=n)}function Yc(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const o=new Jk(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[Jx(r)]=r,n[Jx(o.attribute)]=r}return new kf(t,n,e.space)}const RR=Yc({properties:{ariaActiveDescendant:null,ariaAtomic:qn,ariaAutoComplete:null,ariaBusy:qn,ariaChecked:qn,ariaColCount:Pe,ariaColIndex:Pe,ariaColSpan:Pe,ariaControls:dn,ariaCurrent:null,ariaDescribedBy:dn,ariaDetails:null,ariaDisabled:qn,ariaDropEffect:dn,ariaErrorMessage:null,ariaExpanded:qn,ariaFlowTo:dn,ariaGrabbed:qn,ariaHasPopup:null,ariaHidden:qn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:dn,ariaLevel:Pe,ariaLive:null,ariaModal:qn,ariaMultiLine:qn,ariaMultiSelectable:qn,ariaOrientation:null,ariaOwns:dn,ariaPlaceholder:null,ariaPosInSet:Pe,ariaPressed:qn,ariaReadOnly:qn,ariaRelevant:null,ariaRequired:qn,ariaRoleDescription:dn,ariaRowCount:Pe,ariaRowIndex:Pe,ariaRowSpan:Pe,ariaSelected:qn,ariaSetSize:Pe,ariaSort:null,ariaValueMax:Pe,ariaValueMin:Pe,ariaValueNow:Pe,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function TR(e,t){return t in e?e[t]:t}function MR(e,t){return TR(e,t.toLowerCase())}const R6=Yc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:xc,acceptCharset:dn,accessKey:dn,action:null,allow:null,allowFullScreen:Nt,allowPaymentRequest:Nt,allowUserMedia:Nt,alt:null,as:null,async:Nt,autoCapitalize:null,autoComplete:dn,autoFocus:Nt,autoPlay:Nt,blocking:dn,capture:null,charSet:null,checked:Nt,cite:null,className:dn,cols:Pe,colSpan:null,content:null,contentEditable:qn,controls:Nt,controlsList:dn,coords:Pe|xc,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Nt,defer:Nt,dir:null,dirName:null,disabled:Nt,download:Xx,draggable:qn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Nt,formTarget:null,headers:dn,height:Pe,hidden:Xx,high:Pe,href:null,hrefLang:null,htmlFor:dn,httpEquiv:dn,id:null,imageSizes:null,imageSrcSet:null,inert:Nt,inputMode:null,integrity:null,is:null,isMap:Nt,itemId:null,itemProp:dn,itemRef:dn,itemScope:Nt,itemType:dn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Nt,low:Pe,manifest:null,max:null,maxLength:Pe,media:null,method:null,min:null,minLength:Pe,multiple:Nt,muted:Nt,name:null,nonce:null,noModule:Nt,noValidate:Nt,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:Nt,optimum:Pe,pattern:null,ping:dn,placeholder:null,playsInline:Nt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Nt,referrerPolicy:null,rel:dn,required:Nt,reversed:Nt,rows:Pe,rowSpan:Pe,sandbox:dn,scope:null,scoped:Nt,seamless:Nt,selected:Nt,shadowRootClonable:Nt,shadowRootDelegatesFocus:Nt,shadowRootMode:null,shape:null,size:Pe,sizes:null,slot:null,span:Pe,spellCheck:qn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Pe,step:null,style:null,tabIndex:Pe,target:null,title:null,translate:null,type:null,typeMustMatch:Nt,useMap:null,value:qn,width:Pe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:dn,axis:null,background:null,bgColor:null,border:Pe,borderColor:null,bottomMargin:Pe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Nt,declare:Nt,event:null,face:null,frame:null,frameBorder:null,hSpace:Pe,leftMargin:Pe,link:null,longDesc:null,lowSrc:null,marginHeight:Pe,marginWidth:Pe,noResize:Nt,noHref:Nt,noShade:Nt,noWrap:Nt,object:null,profile:null,prompt:null,rev:null,rightMargin:Pe,rules:null,scheme:null,scrolling:qn,standby:null,summary:null,text:null,topMargin:Pe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Pe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Nt,disableRemotePlayback:Nt,prefix:null,property:null,results:Pe,security:null,unselectable:null},space:"html",transform:MR}),T6=Yc({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:ss,accentHeight:Pe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Pe,amplitude:Pe,arabicForm:null,ascent:Pe,attributeName:null,attributeType:null,azimuth:Pe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Pe,by:null,calcMode:null,capHeight:Pe,className:dn,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:Pe,diffuseConstant:Pe,direction:null,display:null,dur:null,divisor:Pe,dominantBaseline:null,download:Nt,dx:null,dy:null,edgeMode:null,editable:null,elevation:Pe,enableBackground:null,end:null,event:null,exponent:Pe,externalResourcesRequired:null,fill:null,fillOpacity:Pe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:xc,g2:xc,glyphName:xc,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Pe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Pe,horizOriginX:Pe,horizOriginY:Pe,id:null,ideographic:Pe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Pe,k:Pe,k1:Pe,k2:Pe,k3:Pe,k4:Pe,kernelMatrix:ss,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Pe,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:Pe,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:Pe,overlineThickness:Pe,paintOrder:null,panose1:null,path:null,pathLength:Pe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:dn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Pe,pointsAtY:Pe,pointsAtZ:Pe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:ss,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:ss,rev:ss,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:ss,requiredFeatures:ss,requiredFonts:ss,requiredFormats:ss,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:Pe,specularExponent:Pe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Pe,strikethroughThickness:Pe,string:null,stroke:null,strokeDashArray:ss,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Pe,strokeOpacity:Pe,strokeWidth:null,style:null,surfaceScale:Pe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:ss,tabIndex:Pe,tableValues:null,target:null,targetX:Pe,targetY:Pe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:ss,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Pe,underlineThickness:Pe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Pe,values:null,vAlphabetic:Pe,vMathematical:Pe,vectorEffect:null,vHanging:Pe,vIdeographic:Pe,version:null,vertAdvY:Pe,vertOriginX:Pe,vertOriginY:Pe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Pe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:TR}),$R=Yc({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()}}),LR=Yc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:MR}),OR=Yc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),M6={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"},$6=/[A-Z]/g,g1=/-[a-z]/g,L6=/^data[-\w.:]+$/i;function O6(e,t){const n=Jx(t);let r=t,s=Qr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&L6.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(g1,F6);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!g1.test(o)){let a=o.replace($6,D6);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=Jk}return new s(r,t)}function D6(e){return"-"+e.toLowerCase()}function F6(e){return e.charAt(1).toUpperCase()}const z6=IR([RR,R6,$R,LR,OR],"html"),Xk=IR([RR,T6,$R,LR,OR],"svg");function B6(e){return e.join(" ").trim()}var Qk={},y1=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,H6=/\n/g,W6=/^\s*/,V6=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,K6=/^:\s*/,q6=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,U6=/^[;\s]*/,Y6=/^\s+|\s+$/g,G6=`
|
|
67
|
-
`,w1="/",x1="*",Ia="",J6="comment",X6="declaration";function Q6(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(y){var v=y.match(H6);v&&(n+=v.length);var w=y.lastIndexOf(G6);r=~w?y.length-w:r+y.length}function o(){var y={line:n,column:r};return function(v){return v.position=new a(y),u(),v}}function a(y){this.start=y,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function l(y){var v=new Error(t.source+":"+n+":"+r+": "+y);if(v.reason=y,v.filename=t.source,v.line=n,v.column=r,v.source=e,!t.silent)throw v}function c(y){var v=y.exec(e);if(v){var w=v[0];return s(w),e=e.slice(w.length),v}}function u(){c(W6)}function d(y){var v;for(y=y||[];v=f();)v!==!1&&y.push(v);return y}function f(){var y=o();if(!(w1!=e.charAt(0)||x1!=e.charAt(1))){for(var v=2;Ia!=e.charAt(v)&&(x1!=e.charAt(v)||w1!=e.charAt(v+1));)++v;if(v+=2,Ia===e.charAt(v-1))return l("End of comment missing");var w=e.slice(2,v-2);return r+=2,s(w),e=e.slice(v),r+=2,y({type:J6,comment:w})}}function p(){var y=o(),v=c(V6);if(v){if(f(),!c(K6))return l("property missing ':'");var w=c(q6),g=y({type:X6,property:b1(v[0].replace(y1,Ia)),value:w?b1(w[0].replace(y1,Ia)):Ia});return c(U6),g}}function h(){var y=[];d(y);for(var v;v=p();)v!==!1&&(y.push(v),d(y));return y}return u(),h()}function b1(e){return e?e.replace(Y6,Ia):Ia}var Z6=Q6,e8=vd&&vd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Qk,"__esModule",{value:!0});Qk.default=n8;const t8=e8(Z6);function n8(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,t8.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 cg={};Object.defineProperty(cg,"__esModule",{value:!0});cg.camelCase=void 0;var r8=/^--[a-zA-Z0-9_-]+$/,s8=/-([a-z])/g,i8=/^[^-]+$/,o8=/^-(webkit|moz|ms|o|khtml)-/,a8=/^-(ms)-/,l8=function(e){return!e||i8.test(e)||r8.test(e)},c8=function(e,t){return t.toUpperCase()},k1=function(e,t){return"".concat(t,"-")},u8=function(e,t){return t===void 0&&(t={}),l8(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(a8,k1):e=e.replace(o8,k1),e.replace(s8,c8))};cg.camelCase=u8;var d8=vd&&vd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},f8=d8(Qk),p8=cg;function Zx(e,t){var n={};return!e||typeof e!="string"||(0,f8.default)(e,function(r,s){r&&s&&(n[(0,p8.camelCase)(r,t)]=s)}),n}Zx.default=Zx;var h8=Zx;const m8=ca(h8),DR=FR("end"),Zk=FR("start");function FR(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 g8(e){const t=Zk(e),n=DR(e);if(t&&n)return{start:t,end:n}}function gd(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?v1(e.position):"start"in e||"end"in e?v1(e):"line"in e||"column"in e?eb(e):""}function eb(e){return S1(e&&e.line)+":"+S1(e&&e.column)}function v1(e){return eb(e&&e.start)+"-"+eb(e&&e.end)}function S1(e){return e&&typeof e=="number"?e:1}class Nr 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=gd(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}}Nr.prototype.file="";Nr.prototype.name="";Nr.prototype.reason="";Nr.prototype.message="";Nr.prototype.stack="";Nr.prototype.column=void 0;Nr.prototype.line=void 0;Nr.prototype.ancestors=void 0;Nr.prototype.cause=void 0;Nr.prototype.fatal=void 0;Nr.prototype.place=void 0;Nr.prototype.ruleId=void 0;Nr.prototype.source=void 0;const ev={}.hasOwnProperty,y8=new Map,w8=/[A-Z]/g,x8=new Set(["table","tbody","thead","tfoot","tr"]),b8=new Set(["td","th"]),zR="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function k8(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=A8(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=E8(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"?Xk:z6,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},o=BR(s,e,void 0);return o&&typeof o!="string"?o:s.create(e,s.Fragment,{children:o||void 0},void 0)}function BR(e,t,n){if(t.type==="element")return v8(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return S8(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return N8(e,t,n);if(t.type==="mdxjsEsm")return j8(e,t);if(t.type==="root")return C8(e,t,n);if(t.type==="text")return _8(e,t)}function v8(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Xk,e.schema=s),e.ancestors.push(t);const o=WR(e,t.tagName,!1),a=P8(e,t);let l=nv(e,t);return x8.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!P6(c):!0})),HR(e,a,o,t),tv(a,l),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function S8(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)}Gd(e,t.position)}function j8(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Gd(e,t.position)}function N8(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Xk,e.schema=s),e.ancestors.push(t);const o=t.name===null?e.Fragment:WR(e,t.name,!0),a=I8(e,t),l=nv(e,t);return HR(e,a,o,t),tv(a,l),e.ancestors.pop(),e.schema=r,e.create(t,o,a,n)}function C8(e,t,n){const r={};return tv(r,nv(e,t)),e.create(t,e.Fragment,r,n)}function _8(e,t){return t.value}function HR(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function tv(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function E8(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 A8(e,t){return n;function n(r,s,o,a){const l=Array.isArray(o.children),c=Zk(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 P8(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&ev.call(t.properties,s)){const o=R8(e,s,t.properties[s]);if(o){const[a,l]=o;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&b8.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 I8(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 Gd(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 Gd(e,t.position);else o=r.value===null?!0:r.value;n[s]=o}return n}function nv(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:y8;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=BR(e,o,a);l!==void 0&&n.push(l)}return n}function R8(e,t,n){const r=O6(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?N6(n):B6(n)),r.property==="style"){let s=typeof n=="object"?n:T8(e,String(n));return e.stylePropertyNameCase==="css"&&(s=M8(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?M6[r.property]||r.property:r.attribute,n]}}function T8(e,t){try{return m8(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new Nr("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=zR+"#cannot-parse-style-attribute",s}}function WR(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=p1(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=p1(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return ev.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Gd(e)}function Gd(e,t){const n=new Nr("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=zR+"#cannot-handle-mdx-estrees-without-createevaluater",n}function M8(e){const t={};let n;for(n in e)ev.call(e,n)&&(t[$8(n)]=e[n]);return t}function $8(e){let t=e.replace(w8,L8);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function L8(e){return"-"+e.toLowerCase()}const Qy={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"]},O8={};function D8(e,t){const n=O8,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return VR(e,r,s)}function VR(e,t,n){if(F8(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 j1(e.children,t,n)}return Array.isArray(e)?j1(e,t,n):""}function j1(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=VR(e[s],t,n);return r.join("")}function F8(e){return!!(e&&typeof e=="object")}const N1=document.createElement("i");function rv(e){const t="&"+e+";";N1.innerHTML=t;const n=N1.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Li(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 _s(e,t){return e.length>0?(Li(e,e.length,0,t),e):t}const C1={}.hasOwnProperty;function z8(e){const t={};let n=-1;for(;++n<e.length;)B8(t,e[n]);return t}function B8(e,t){let n;for(n in t){const s=(C1.call(e,n)?e[n]:void 0)||(e[n]={}),o=t[n];let a;if(o)for(a in o){C1.call(s,a)||(s[a]=[]);const l=o[a];H8(s[a],Array.isArray(l)?l:l?[l]:[])}}}function H8(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Li(e,0,0,r)}function KR(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 bc(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ni=pa(/[A-Za-z]/),cs=pa(/[\dA-Za-z]/),W8=pa(/[#-'*+\--9=?A-Z^-~]/);function tb(e){return e!==null&&(e<32||e===127)}const nb=pa(/\d/),V8=pa(/[\dA-Fa-f]/),K8=pa(/[!-/:-@[-`{-~]/);function xt(e){return e!==null&&e<-2}function Xr(e){return e!==null&&(e<0||e===32)}function Gt(e){return e===-2||e===-1||e===32}const q8=pa(new RegExp("\\p{P}|\\p{S}","u")),U8=pa(/\s/);function pa(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function Gc(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const o=e.charCodeAt(n);let a="";if(o===37&&cs(e.charCodeAt(n+1))&&cs(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 pn(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let o=0;return a;function a(c){return Gt(c)?(e.enter(n),l(c)):t(c)}function l(c){return Gt(c)&&o++<s?(e.consume(c),l):(e.exit(n),t(c))}}const Y8={tokenize:G8};function G8(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"),pn(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 xt(l)?(e.consume(l),e.exit("chunkText"),o):(e.consume(l),a)}}const J8={tokenize:X8},_1={tokenize:Q8};function X8(e){const t=this,n=[];let r=0,s,o,a;return l;function l(b){if(r<n.length){const j=n[r];return t.containerState=j[1],e.attempt(j[0].continuation,c,u)(b)}return u(b)}function c(b){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&k();const j=t.events.length;let N=j,C;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){C=t.events[N][1].end;break}g(r);let I=j;for(;I<t.events.length;)t.events[I][1].end={...C},I++;return Li(t.events,N+1,0,t.events.slice(j)),t.events.length=I,u(b)}return l(b)}function u(b){if(r===n.length){if(!s)return p(b);if(s.currentConstruct&&s.currentConstruct.concrete)return y(b);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(_1,d,f)(b)}function d(b){return s&&k(),g(r),p(b)}function f(b){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,y(b)}function p(b){return t.containerState={},e.attempt(_1,h,y)(b)}function h(b){return r++,n.push([t.currentConstruct,t.containerState]),p(b)}function y(b){if(b===null){s&&k(),g(0),e.consume(b);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:o}),v(b)}function v(b){if(b===null){w(e.exit("chunkFlow"),!0),g(0),e.consume(b);return}return xt(b)?(e.consume(b),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(b),v)}function w(b,j){const N=t.sliceStream(b);if(j&&N.push(null),b.previous=o,o&&(o.next=b),o=b,s.defineSkip(b.start),s.write(N),t.parser.lazy[b.start.line]){let C=s.events.length;for(;C--;)if(s.events[C][1].start.offset<a&&(!s.events[C][1].end||s.events[C][1].end.offset>a))return;const I=t.events.length;let R=I,H,A;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(H){A=t.events[R][1].end;break}H=!0}for(g(r),C=I;C<t.events.length;)t.events[C][1].end={...A},C++;Li(t.events,R+1,0,t.events.slice(I)),t.events.length=C}}function g(b){let j=n.length;for(;j-- >b;){const N=n[j];t.containerState=N[1],N[0].exit.call(t,e)}n.length=b}function k(){s.write([null]),o=void 0,s=void 0,t.containerState._closeFlow=void 0}}function Q8(e,t,n){return pn(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function E1(e){if(e===null||Xr(e)||U8(e))return 1;if(q8(e))return 2}function sv(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 rb={name:"attention",resolveAll:Z8,tokenize:e9};function Z8(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 f={...e[r][1].end},p={...e[n][1].start};A1(f,-c),A1(p,c),a={type:c>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},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=_s(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=_s(u,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",o,t]]),u=_s(u,sv(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=_s(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=_s(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):d=0,Li(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 e9(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=E1(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=E1(c),f=!d||d===2&&s||n.includes(c),p=!s||s===2&&d||n.includes(r);return u._open=!!(o===42?f:f&&(s||!p)),u._close=!!(o===42?p:p&&(d||!f)),t(c)}}function A1(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const t9={name:"autolink",tokenize:n9};function n9(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 Ni(h)?(e.consume(h),a):h===64?n(h):u(h)}function a(h){return h===43||h===45||h===46||cs(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||cs(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||tb(h)?n(h):(e.consume(h),c)}function u(h){return h===64?(e.consume(h),d):W8(h)?(e.consume(h),u):n(h)}function d(h){return cs(h)?f(h):n(h)}function f(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):p(h)}function p(h){if((h===45||cs(h))&&r++<63){const y=h===45?p:f;return e.consume(h),y}return n(h)}}const ug={partial:!0,tokenize:r9};function r9(e,t,n){return r;function r(o){return Gt(o)?pn(e,s,"linePrefix")(o):s(o)}function s(o){return o===null||xt(o)?t(o):n(o)}}const qR={continuation:{tokenize:i9},exit:o9,name:"blockQuote",tokenize:s9};function s9(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 Gt(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function i9(e,t,n){const r=this;return s;function s(a){return Gt(a)?pn(e,o,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):o(a)}function o(a){return e.attempt(qR,t,n)(a)}}function o9(e){e.exit("blockQuote")}const UR={name:"characterEscape",tokenize:a9};function a9(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 K8(o)?(e.enter("characterEscapeValue"),e.consume(o),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(o)}}const YR={name:"characterReference",tokenize:l9};function l9(e,t,n){const r=this;let s=0,o,a;return l;function l(f){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),c}function c(f){return f===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(f),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),o=31,a=cs,d(f))}function u(f){return f===88||f===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(f),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),o=6,a=V8,d):(e.enter("characterReferenceValue"),o=7,a=nb,d(f))}function d(f){if(f===59&&s){const p=e.exit("characterReferenceValue");return a===cs&&!rv(r.sliceSerialize(p))?n(f):(e.enter("characterReferenceMarker"),e.consume(f),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(f)&&s++<o?(e.consume(f),d):n(f)}}const P1={partial:!0,tokenize:u9},I1={concrete:!0,name:"codeFenced",tokenize:c9};function c9(e,t,n){const r=this,s={partial:!0,tokenize:N};let o=0,a=0,l;return c;function c(C){return u(C)}function u(C){const I=r.events[r.events.length-1];return o=I&&I[1].type==="linePrefix"?I[2].sliceSerialize(I[1],!0).length:0,l=C,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),d(C)}function d(C){return C===l?(a++,e.consume(C),d):a<3?n(C):(e.exit("codeFencedFenceSequence"),Gt(C)?pn(e,f,"whitespace")(C):f(C))}function f(C){return C===null||xt(C)?(e.exit("codeFencedFence"),r.interrupt?t(C):e.check(P1,v,j)(C)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(C))}function p(C){return C===null||xt(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),f(C)):Gt(C)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),pn(e,h,"whitespace")(C)):C===96&&C===l?n(C):(e.consume(C),p)}function h(C){return C===null||xt(C)?f(C):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(C))}function y(C){return C===null||xt(C)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),f(C)):C===96&&C===l?n(C):(e.consume(C),y)}function v(C){return e.attempt(s,j,w)(C)}function w(C){return e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),g}function g(C){return o>0&&Gt(C)?pn(e,k,"linePrefix",o+1)(C):k(C)}function k(C){return C===null||xt(C)?e.check(P1,v,j)(C):(e.enter("codeFlowValue"),b(C))}function b(C){return C===null||xt(C)?(e.exit("codeFlowValue"),k(C)):(e.consume(C),b)}function j(C){return e.exit("codeFenced"),t(C)}function N(C,I,R){let H=0;return A;function A(K){return C.enter("lineEnding"),C.consume(K),C.exit("lineEnding"),L}function L(K){return C.enter("codeFencedFence"),Gt(K)?pn(C,D,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(K):D(K)}function D(K){return K===l?(C.enter("codeFencedFenceSequence"),O(K)):R(K)}function O(K){return K===l?(H++,C.consume(K),O):H>=a?(C.exit("codeFencedFenceSequence"),Gt(K)?pn(C,M,"whitespace")(K):M(K)):R(K)}function M(K){return K===null||xt(K)?(C.exit("codeFencedFence"),I(K)):R(K)}}}function u9(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 Zy={name:"codeIndented",tokenize:f9},d9={partial:!0,tokenize:p9};function f9(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),pn(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):xt(u)?e.attempt(d9,a,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||xt(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function p9(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):xt(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):pn(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):xt(a)?s(a):n(a)}}const h9={name:"codeText",previous:g9,resolve:m9,tokenize:y9};function m9(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 g9(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function y9(e,t,n){let r=0,s,o;return a;function a(f){return e.enter("codeText"),e.enter("codeTextSequence"),l(f)}function l(f){return f===96?(e.consume(f),r++,l):(e.exit("codeTextSequence"),c(f))}function c(f){return f===null?n(f):f===32?(e.enter("space"),e.consume(f),e.exit("space"),c):f===96?(o=e.enter("codeTextSequence"),s=0,d(f)):xt(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(f))}function u(f){return f===null||f===32||f===96||xt(f)?(e.exit("codeTextData"),c(f)):(e.consume(f),u)}function d(f){return f===96?(e.consume(f),s++,d):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(f)):(o.type="codeTextData",u(f))}}class w9{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&&Lu(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),Lu(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Lu(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);Lu(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Lu(this.left,n.reverse())}}}function Lu(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 GR(e){const t={};let n=-1,r,s,o,a,l,c,u;const d=new w9(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,x9(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 Li(e,0,Number.POSITIVE_INFINITY,d.slice(0)),!u}function x9(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,f,p=-1,h=n,y=0,v=0;const w=[v];for(;h;){for(;e.get(++s)[1]!==h;);o.push(s),h._tokenizer||(d=r.sliceStream(h),h.next||d.push(null),f&&a.defineSkip(h.start),h._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(d),h._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),f=h,h=h.next}for(h=n;++p<l.length;)l[p][0]==="exit"&&l[p-1][0]==="enter"&&l[p][1].type===l[p-1][1].type&&l[p][1].start.line!==l[p][1].end.line&&(v=p+1,w.push(v),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(a.events=[],h?(h._tokenizer=void 0,h.previous=void 0):w.pop(),p=w.length;p--;){const g=l.slice(w[p],w[p+1]),k=o.pop();c.push([k,k+g.length-1]),e.splice(k,2,g)}for(c.reverse(),p=-1;++p<c.length;)u[y+c[p][0]]=y+c[p][1],y+=c[p][1]-c[p][0]-1;return u}const b9={resolve:v9,tokenize:S9},k9={partial:!0,tokenize:j9};function v9(e){return GR(e),e}function S9(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):xt(l)?e.check(k9,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 j9(e,t,n){const r=this;return s;function s(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),pn(e,o,"linePrefix")}function o(a){if(a===null||xt(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 JR(e,t,n,r,s,o,a,l,c){const u=c||Number.POSITIVE_INFINITY;let d=0;return f;function f(g){return g===60?(e.enter(r),e.enter(s),e.enter(o),e.consume(g),e.exit(o),p):g===null||g===32||g===41||tb(g)?n(g):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),v(g))}function p(g){return g===62?(e.enter(o),e.consume(g),e.exit(o),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===62?(e.exit("chunkString"),e.exit(l),p(g)):g===null||g===60||xt(g)?n(g):(e.consume(g),g===92?y:h)}function y(g){return g===60||g===62||g===92?(e.consume(g),h):h(g)}function v(g){return!d&&(g===null||g===41||Xr(g))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(g)):d<u&&g===40?(e.consume(g),d++,v):g===41?(e.consume(g),d--,v):g===null||g===32||g===40||tb(g)?n(g):(e.consume(g),g===92?w:v)}function w(g){return g===40||g===41||g===92?(e.consume(g),v):v(g)}}function XR(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):xt(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),d):(e.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||xt(h)||l++>999?(e.exit("chunkString"),d(h)):(e.consume(h),c||(c=!Gt(h)),h===92?p:f)}function p(h){return h===91||h===92||h===93?(e.consume(h),l++,f):f(h)}}function QR(e,t,n,r,s,o){let a;return l;function l(p){return p===34||p===39||p===40?(e.enter(r),e.enter(s),e.consume(p),e.exit(s),a=p===40?41:p,c):n(p)}function c(p){return p===a?(e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):(e.enter(o),u(p))}function u(p){return p===a?(e.exit(o),c(a)):p===null?n(p):xt(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),pn(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===a||p===null||xt(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?f:d)}function f(p){return p===a||p===92?(e.consume(p),d):d(p)}}function yd(e,t){let n;return r;function r(s){return xt(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Gt(s)?pn(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const N9={name:"definition",tokenize:_9},C9={partial:!0,tokenize:E9};function _9(e,t,n){const r=this;let s;return o;function o(h){return e.enter("definition"),a(h)}function a(h){return XR.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function l(h){return s=bc(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 Xr(h)?yd(e,u)(h):u(h)}function u(h){return JR(e,d,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function d(h){return e.attempt(C9,f,f)(h)}function f(h){return Gt(h)?pn(e,p,"whitespace")(h):p(h)}function p(h){return h===null||xt(h)?(e.exit("definition"),r.parser.defined.push(s),t(h)):n(h)}}function E9(e,t,n){return r;function r(l){return Xr(l)?yd(e,s)(l):n(l)}function s(l){return QR(e,o,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function o(l){return Gt(l)?pn(e,a,"whitespace")(l):a(l)}function a(l){return l===null||xt(l)?t(l):n(l)}}const A9={name:"hardBreakEscape",tokenize:P9};function P9(e,t,n){return r;function r(o){return e.enter("hardBreakEscape"),e.consume(o),s}function s(o){return xt(o)?(e.exit("hardBreakEscape"),t(o)):n(o)}}const I9={name:"headingAtx",resolve:R9,tokenize:T9};function R9(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"},Li(e,r,n-r+1,[["enter",s,t],["enter",o,t],["exit",o,t],["exit",s,t]])),e}function T9(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||Xr(d)?(e.exit("atxHeadingSequence"),l(d)):n(d)}function l(d){return d===35?(e.enter("atxHeadingSequence"),c(d)):d===null||xt(d)?(e.exit("atxHeading"),t(d)):Gt(d)?pn(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||Xr(d)?(e.exit("atxHeadingText"),l(d)):(e.consume(d),u)}}const M9=["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"],R1=["pre","script","style","textarea"],$9={concrete:!0,name:"htmlFlow",resolveTo:D9,tokenize:F9},L9={partial:!0,tokenize:B9},O9={partial:!0,tokenize:z9};function D9(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 F9(e,t,n){const r=this;let s,o,a,l,c;return u;function u(B){return d(B)}function d(B){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(B),f}function f(B){return B===33?(e.consume(B),p):B===47?(e.consume(B),o=!0,v):B===63?(e.consume(B),s=3,r.interrupt?t:E):Ni(B)?(e.consume(B),a=String.fromCharCode(B),w):n(B)}function p(B){return B===45?(e.consume(B),s=2,h):B===91?(e.consume(B),s=5,l=0,y):Ni(B)?(e.consume(B),s=4,r.interrupt?t:E):n(B)}function h(B){return B===45?(e.consume(B),r.interrupt?t:E):n(B)}function y(B){const re="CDATA[";return B===re.charCodeAt(l++)?(e.consume(B),l===re.length?r.interrupt?t:D:y):n(B)}function v(B){return Ni(B)?(e.consume(B),a=String.fromCharCode(B),w):n(B)}function w(B){if(B===null||B===47||B===62||Xr(B)){const re=B===47,ue=a.toLowerCase();return!re&&!o&&R1.includes(ue)?(s=1,r.interrupt?t(B):D(B)):M9.includes(a.toLowerCase())?(s=6,re?(e.consume(B),g):r.interrupt?t(B):D(B)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(B):o?k(B):b(B))}return B===45||cs(B)?(e.consume(B),a+=String.fromCharCode(B),w):n(B)}function g(B){return B===62?(e.consume(B),r.interrupt?t:D):n(B)}function k(B){return Gt(B)?(e.consume(B),k):A(B)}function b(B){return B===47?(e.consume(B),A):B===58||B===95||Ni(B)?(e.consume(B),j):Gt(B)?(e.consume(B),b):A(B)}function j(B){return B===45||B===46||B===58||B===95||cs(B)?(e.consume(B),j):N(B)}function N(B){return B===61?(e.consume(B),C):Gt(B)?(e.consume(B),N):b(B)}function C(B){return B===null||B===60||B===61||B===62||B===96?n(B):B===34||B===39?(e.consume(B),c=B,I):Gt(B)?(e.consume(B),C):R(B)}function I(B){return B===c?(e.consume(B),c=null,H):B===null||xt(B)?n(B):(e.consume(B),I)}function R(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||Xr(B)?N(B):(e.consume(B),R)}function H(B){return B===47||B===62||Gt(B)?b(B):n(B)}function A(B){return B===62?(e.consume(B),L):n(B)}function L(B){return B===null||xt(B)?D(B):Gt(B)?(e.consume(B),L):n(B)}function D(B){return B===45&&s===2?(e.consume(B),z):B===60&&s===1?(e.consume(B),F):B===62&&s===4?(e.consume(B),Q):B===63&&s===3?(e.consume(B),E):B===93&&s===5?(e.consume(B),W):xt(B)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(L9,V,O)(B)):B===null||xt(B)?(e.exit("htmlFlowData"),O(B)):(e.consume(B),D)}function O(B){return e.check(O9,M,V)(B)}function M(B){return e.enter("lineEnding"),e.consume(B),e.exit("lineEnding"),K}function K(B){return B===null||xt(B)?O(B):(e.enter("htmlFlowData"),D(B))}function z(B){return B===45?(e.consume(B),E):D(B)}function F(B){return B===47?(e.consume(B),a="",$):D(B)}function $(B){if(B===62){const re=a.toLowerCase();return R1.includes(re)?(e.consume(B),Q):D(B)}return Ni(B)&&a.length<8?(e.consume(B),a+=String.fromCharCode(B),$):D(B)}function W(B){return B===93?(e.consume(B),E):D(B)}function E(B){return B===62?(e.consume(B),Q):B===45&&s===2?(e.consume(B),E):D(B)}function Q(B){return B===null||xt(B)?(e.exit("htmlFlowData"),V(B)):(e.consume(B),Q)}function V(B){return e.exit("htmlFlow"),t(B)}}function z9(e,t,n){const r=this;return s;function s(a){return xt(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 B9(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(ug,t,n)}}const H9={name:"htmlText",tokenize:W9};function W9(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),b):Ni(E)?(e.consume(E),R):n(E)}function u(E){return E===45?(e.consume(E),d):E===91?(e.consume(E),o=0,y):Ni(E)?(e.consume(E),k):n(E)}function d(E){return E===45?(e.consume(E),h):n(E)}function f(E){return E===null?n(E):E===45?(e.consume(E),p):xt(E)?(a=f,F(E)):(e.consume(E),f)}function p(E){return E===45?(e.consume(E),h):f(E)}function h(E){return E===62?z(E):E===45?p(E):f(E)}function y(E){const Q="CDATA[";return E===Q.charCodeAt(o++)?(e.consume(E),o===Q.length?v:y):n(E)}function v(E){return E===null?n(E):E===93?(e.consume(E),w):xt(E)?(a=v,F(E)):(e.consume(E),v)}function w(E){return E===93?(e.consume(E),g):v(E)}function g(E){return E===62?z(E):E===93?(e.consume(E),g):v(E)}function k(E){return E===null||E===62?z(E):xt(E)?(a=k,F(E)):(e.consume(E),k)}function b(E){return E===null?n(E):E===63?(e.consume(E),j):xt(E)?(a=b,F(E)):(e.consume(E),b)}function j(E){return E===62?z(E):b(E)}function N(E){return Ni(E)?(e.consume(E),C):n(E)}function C(E){return E===45||cs(E)?(e.consume(E),C):I(E)}function I(E){return xt(E)?(a=I,F(E)):Gt(E)?(e.consume(E),I):z(E)}function R(E){return E===45||cs(E)?(e.consume(E),R):E===47||E===62||Xr(E)?H(E):n(E)}function H(E){return E===47?(e.consume(E),z):E===58||E===95||Ni(E)?(e.consume(E),A):xt(E)?(a=H,F(E)):Gt(E)?(e.consume(E),H):z(E)}function A(E){return E===45||E===46||E===58||E===95||cs(E)?(e.consume(E),A):L(E)}function L(E){return E===61?(e.consume(E),D):xt(E)?(a=L,F(E)):Gt(E)?(e.consume(E),L):H(E)}function D(E){return E===null||E===60||E===61||E===62||E===96?n(E):E===34||E===39?(e.consume(E),s=E,O):xt(E)?(a=D,F(E)):Gt(E)?(e.consume(E),D):(e.consume(E),M)}function O(E){return E===s?(e.consume(E),s=void 0,K):E===null?n(E):xt(E)?(a=O,F(E)):(e.consume(E),O)}function M(E){return E===null||E===34||E===39||E===60||E===61||E===96?n(E):E===47||E===62||Xr(E)?H(E):(e.consume(E),M)}function K(E){return E===47||E===62||Xr(E)?H(E):n(E)}function z(E){return E===62?(e.consume(E),e.exit("htmlTextData"),e.exit("htmlText"),t):n(E)}function F(E){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(E),e.exit("lineEnding"),$}function $(E){return Gt(E)?pn(e,W,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(E):W(E)}function W(E){return e.enter("htmlTextData"),a(E)}}const iv={name:"labelEnd",resolveAll:U9,resolveTo:Y9,tokenize:G9},V9={tokenize:J9},K9={tokenize:X9},q9={tokenize:Q9};function U9(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&&Li(e,0,e.length,n),e}function Y9(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=_s(l,e.slice(o+1,o+r+3)),l=_s(l,[["enter",d,t]]),l=_s(l,sv(t.parser.constructs.insideSpan.null,e.slice(o+r+4,a-3),t)),l=_s(l,[["exit",d,t],e[a-2],e[a-1],["exit",u,t]]),l=_s(l,e.slice(a+1)),l=_s(l,[["exit",c,t]]),Li(e,o,e.length,l),e}function G9(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(p){return o?o._inactive?f(p):(a=r.parser.defined.includes(bc(r.sliceSerialize({start:o.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),c):n(p)}function c(p){return p===40?e.attempt(V9,d,a?d:f)(p):p===91?e.attempt(K9,d,a?u:f)(p):a?d(p):f(p)}function u(p){return e.attempt(q9,d,f)(p)}function d(p){return t(p)}function f(p){return o._balanced=!0,n(p)}}function J9(e,t,n){return r;function r(f){return e.enter("resource"),e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),s}function s(f){return Xr(f)?yd(e,o)(f):o(f)}function o(f){return f===41?d(f):JR(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(f)}function a(f){return Xr(f)?yd(e,c)(f):d(f)}function l(f){return n(f)}function c(f){return f===34||f===39||f===40?QR(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(f):d(f)}function u(f){return Xr(f)?yd(e,d)(f):d(f)}function d(f){return f===41?(e.enter("resourceMarker"),e.consume(f),e.exit("resourceMarker"),e.exit("resource"),t):n(f)}}function X9(e,t,n){const r=this;return s;function s(l){return XR.call(r,e,o,a,"reference","referenceMarker","referenceString")(l)}function o(l){return r.parser.defined.includes(bc(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function Q9(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 Z9={name:"labelStartImage",resolveAll:iv.resolveAll,tokenize:eV};function eV(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 tV={name:"labelStartLink",resolveAll:iv.resolveAll,tokenize:nV};function nV(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 ew={name:"lineEnding",tokenize:rV};function rV(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),pn(e,t,"linePrefix")}}const wh={name:"thematicBreak",tokenize:sV};function sV(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||xt(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),Gt(u)?pn(e,l,"whitespace")(u):l(u))}}const Hr={continuation:{tokenize:lV},exit:uV,name:"list",tokenize:aV},iV={partial:!0,tokenize:dV},oV={partial:!0,tokenize:cV};function aV(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 y=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:nb(h)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(wh,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 nb(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(ug,r.interrupt?n:d,e.attempt(iV,p,f))}function d(h){return r.containerState.initialBlankLine=!0,o++,p(h)}function f(h){return Gt(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),p):n(h)}function p(h){return r.containerState.size=o+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function lV(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(ug,s,o);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,pn(e,t,"listItemIndent",r.containerState.size+1)(l)}function o(l){return r.containerState.furtherBlankLines||!Gt(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(oV,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,pn(e,e.attempt(Hr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function cV(e,t,n){const r=this;return pn(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 uV(e){e.exit(this.containerState.type)}function dV(e,t,n){const r=this;return pn(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!Gt(o)&&a&&a[1].type==="listItemPrefixWhitespace"?t(o):n(o)}}const T1={name:"setextUnderline",resolveTo:fV,tokenize:pV};function fV(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 pV(e,t,n){const r=this;let s;return o;function o(u){let d=r.events.length,f;for(;d--;)if(r.events[d][1].type!=="lineEnding"&&r.events[d][1].type!=="linePrefix"&&r.events[d][1].type!=="content"){f=r.events[d][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),s=u,a(u)):n(u)}function a(u){return e.enter("setextHeadingLineSequence"),l(u)}function l(u){return u===s?(e.consume(u),l):(e.exit("setextHeadingLineSequence"),Gt(u)?pn(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||xt(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const hV={tokenize:mV};function mV(e){const t=this,n=e.attempt(ug,r,e.attempt(this.parser.constructs.flowInitial,s,pn(e,e.attempt(this.parser.constructs.flow,s,e.attempt(b9,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 gV={resolveAll:eT()},yV=ZR("string"),wV=ZR("text");function ZR(e){return{resolveAll:eT(e==="text"?xV: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 f=s[d];let p=-1;if(f)for(;++p<f.length;){const h=f[p];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function eT(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 xV(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 bV={42:Hr,43:Hr,45:Hr,48:Hr,49:Hr,50:Hr,51:Hr,52:Hr,53:Hr,54:Hr,55:Hr,56:Hr,57:Hr,62:qR},kV={91:N9},vV={[-2]:Zy,[-1]:Zy,32:Zy},SV={35:I9,42:wh,45:[T1,wh],60:$9,61:T1,95:wh,96:I1,126:I1},jV={38:YR,92:UR},NV={[-5]:ew,[-4]:ew,[-3]:ew,33:Z9,38:YR,42:rb,60:[t9,H9],91:tV,92:[A9,UR],93:iv,95:rb,96:h9},CV={null:[rb,gV]},_V={null:[42,95]},EV={null:[]},AV=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:_V,contentInitial:kV,disable:EV,document:bV,flow:SV,flowInitial:vV,insideSpan:CV,string:jV,text:NV},Symbol.toStringTag,{value:"Module"}));function PV(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:I(N),check:I(C),consume:k,enter:b,exit:j,interrupt:I(C,{interrupt:!0})},u={code:null,containerState:{},defineSkip:v,events:[],now:y,parser:e,previous:null,sliceSerialize:p,sliceStream:h,write:f};let d=t.tokenize.call(u,c);return t.resolveAll&&o.push(t),u;function f(L){return a=_s(a,L),w(),a[a.length-1]!==null?[]:(R(t,0),u.events=sv(o,u.events,u),u.events)}function p(L,D){return RV(h(L),D)}function h(L){return IV(a,L)}function y(){const{_bufferIndex:L,_index:D,line:O,column:M,offset:K}=r;return{_bufferIndex:L,_index:D,line:O,column:M,offset:K}}function v(L){s[L.line]=L.column,A()}function w(){let L;for(;r._index<a.length;){const D=a[r._index];if(typeof D=="string")for(L=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===L&&r._bufferIndex<D.length;)g(D.charCodeAt(r._bufferIndex));else g(D)}}function g(L){d=d(L)}function k(L){xt(L)?(r.line++,r.column=1,r.offset+=L===-3?2:1,A()):L!==-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=L}function b(L,D){const O=D||{};return O.type=L,O.start=y(),u.events.push(["enter",O,u]),l.push(O),O}function j(L){const D=l.pop();return D.end=y(),u.events.push(["exit",D,u]),D}function N(L,D){R(L,D.from)}function C(L,D){D.restore()}function I(L,D){return O;function O(M,K,z){let F,$,W,E;return Array.isArray(M)?V(M):"tokenize"in M?V([M]):Q(M);function Q(G){return ee;function ee(te){const ne=te!==null&&G[te],Z=te!==null&&G.null,ce=[...Array.isArray(ne)?ne:ne?[ne]:[],...Array.isArray(Z)?Z:Z?[Z]:[]];return V(ce)(te)}}function V(G){return F=G,$=0,G.length===0?z:B(G[$])}function B(G){return ee;function ee(te){return E=H(),W=G,G.partial||(u.currentConstruct=G),G.name&&u.parser.constructs.disable.null.includes(G.name)?ue():G.tokenize.call(D?Object.assign(Object.create(u),D):u,c,re,ue)(te)}}function re(G){return L(W,E),K}function ue(G){return E.restore(),++$<F.length?B(F[$]):z}}}function R(L,D){L.resolveAll&&!o.includes(L)&&o.push(L),L.resolve&&Li(u.events,D,u.events.length-D,L.resolve(u.events.slice(D),u)),L.resolveTo&&(u.events=L.resolveTo(u.events,u))}function H(){const L=y(),D=u.previous,O=u.currentConstruct,M=u.events.length,K=Array.from(l);return{from:M,restore:z};function z(){r=L,u.previous=D,u.currentConstruct=O,u.events.length=M,l=K,A()}}function A(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function IV(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 RV(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 TV(e){const r={constructs:z8([AV,...(e||{}).extensions||[]]),content:s(Y8),defined:[],document:s(J8),flow:s(hV),lazy:{},string:s(yV),text:s(wV)};return r;function s(o){return a;function a(l){return PV(r,o,l)}}}function MV(e){for(;!GR(e););return e}const M1=/[\0\t\n\r]/g;function $V(){let e=1,t="",n=!0,r;return s;function s(o,a,l){const c=[];let u,d,f,p,h;for(o=t+(typeof o=="string"?o.toString():new TextDecoder(a||void 0).decode(o)),f=0,t="",n&&(o.charCodeAt(0)===65279&&f++,n=void 0);f<o.length;){if(M1.lastIndex=f,u=M1.exec(o),p=u&&u.index!==void 0?u.index:o.length,h=o.charCodeAt(p),!u){t=o.slice(f);break}if(h===10&&f===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),f<p&&(c.push(o.slice(f,p)),e+=p-f),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}f=p+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const LV=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function OV(e){return e.replace(LV,DV)}function DV(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),o=s===120||s===88;return KR(n.slice(o?2:1),o?16:10)}return rv(n)||e}const tT={}.hasOwnProperty;function FV(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),zV(n)(MV(TV(n).document().write($V()(e,t,!0))))}function zV(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:o(yt),autolinkProtocol:H,autolinkEmail:H,atxHeading:o(Ce),blockQuote:o(Z),characterEscape:H,characterReference:H,codeFenced:o(ce),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:o(ce,a),codeText:o(de,a),codeTextData:H,data:H,codeFlowValue:H,definition:o(me),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:o($e),hardBreakEscape:o(_e),hardBreakTrailing:o(_e),htmlFlow:o(Be,a),htmlFlowData:H,htmlText:o(Be,a),htmlTextData:H,image:o(at),label:a,link:o(yt),listItem:o(it),listItemValue:p,listOrdered:o(Te,f),listUnordered:o(Te),paragraph:o(gt),reference:B,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:o(Ce),strong:o($t),thematicBreak:o(He)},exit:{atxHeading:c(),atxHeadingSequence:N,autolink:c(),autolinkEmail:ne,autolinkProtocol:te,blockQuote:c(),characterEscapeValue:A,characterReferenceMarkerHexadecimal:ue,characterReferenceMarkerNumeric:ue,characterReferenceValue:G,characterReference:ee,codeFenced:c(w),codeFencedFence:v,codeFencedFenceInfo:h,codeFencedFenceMeta:y,codeFlowValue:A,codeIndented:c(g),codeText:c(K),codeTextData:A,data:A,definition:c(),definitionDestinationString:j,definitionLabelString:k,definitionTitleString:b,emphasis:c(),hardBreakEscape:c(D),hardBreakTrailing:c(D),htmlFlow:c(O),htmlFlowData:A,htmlText:c(M),htmlTextData:A,image:c(F),label:W,labelText:$,lineEnding:L,link:c(z),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:re,resourceDestinationString:E,resourceTitleString:Q,resource:V,setextHeading:c(R),setextHeadingLineSequence:I,setextHeadingText:C,strong:c(),thematicBreak:c()}};nT(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(ie){let ke={type:"root",children:[]};const Fe={stack:[ke],tokenStack:[],config:t,enter:l,exit:u,buffer:a,resume:d,data:n},Ze=[];let Ne=-1;for(;++Ne<ie.length;)if(ie[Ne][1].type==="listOrdered"||ie[Ne][1].type==="listUnordered")if(ie[Ne][0]==="enter")Ze.push(Ne);else{const St=Ze.pop();Ne=s(ie,St,Ne)}for(Ne=-1;++Ne<ie.length;){const St=t[ie[Ne][0]];tT.call(St,ie[Ne][1].type)&&St[ie[Ne][1].type].call(Object.assign({sliceSerialize:ie[Ne][2].sliceSerialize},Fe),ie[Ne][1])}if(Fe.tokenStack.length>0){const St=Fe.tokenStack[Fe.tokenStack.length-1];(St[1]||$1).call(Fe,void 0,St[0])}for(ke.position={start:To(ie.length>0?ie[0][1].start:{line:1,column:1,offset:0}),end:To(ie.length>0?ie[ie.length-2][1].end:{line:1,column:1,offset:0})},Ne=-1;++Ne<t.transforms.length;)ke=t.transforms[Ne](ke)||ke;return ke}function s(ie,ke,Fe){let Ze=ke-1,Ne=-1,St=!1,Jt,Vt,ot,On;for(;++Ze<=Fe;){const se=ie[Ze];switch(se[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{se[0]==="enter"?Ne++:Ne--,On=void 0;break}case"lineEndingBlank":{se[0]==="enter"&&(Jt&&!On&&!Ne&&!ot&&(ot=Ze),On=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:On=void 0}if(!Ne&&se[0]==="enter"&&se[1].type==="listItemPrefix"||Ne===-1&&se[0]==="exit"&&(se[1].type==="listUnordered"||se[1].type==="listOrdered")){if(Jt){let Ie=Ze;for(Vt=void 0;Ie--;){const et=ie[Ie];if(et[1].type==="lineEnding"||et[1].type==="lineEndingBlank"){if(et[0]==="exit")continue;Vt&&(ie[Vt][1].type="lineEndingBlank",St=!0),et[1].type="lineEnding",Vt=Ie}else if(!(et[1].type==="linePrefix"||et[1].type==="blockQuotePrefix"||et[1].type==="blockQuotePrefixWhitespace"||et[1].type==="blockQuoteMarker"||et[1].type==="listItemIndent"))break}ot&&(!Vt||ot<Vt)&&(Jt._spread=!0),Jt.end=Object.assign({},Vt?ie[Vt][1].start:se[1].end),ie.splice(Vt||Ze,0,["exit",Jt,se[2]]),Ze++,Fe++}if(se[1].type==="listItemPrefix"){const Ie={type:"listItem",_spread:!1,start:Object.assign({},se[1].start),end:void 0};Jt=Ie,ie.splice(Ze,0,["enter",Ie,se[2]]),Ze++,Fe++,ot=void 0,On=!0}}}return ie[ke][1]._spread=St,Fe}function o(ie,ke){return Fe;function Fe(Ze){l.call(this,ie(Ze),Ze),ke&&ke.call(this,Ze)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(ie,ke,Fe){this.stack[this.stack.length-1].children.push(ie),this.stack.push(ie),this.tokenStack.push([ke,Fe||void 0]),ie.position={start:To(ke.start),end:void 0}}function c(ie){return ke;function ke(Fe){ie&&ie.call(this,Fe),u.call(this,Fe)}}function u(ie,ke){const Fe=this.stack.pop(),Ze=this.tokenStack.pop();if(Ze)Ze[0].type!==ie.type&&(ke?ke.call(this,ie,Ze[0]):(Ze[1]||$1).call(this,ie,Ze[0]));else throw new Error("Cannot close `"+ie.type+"` ("+gd({start:ie.start,end:ie.end})+"): it’s not open");Fe.position.end=To(ie.end)}function d(){return D8(this.stack.pop())}function f(){this.data.expectingFirstListItemValue=!0}function p(ie){if(this.data.expectingFirstListItemValue){const ke=this.stack[this.stack.length-2];ke.start=Number.parseInt(this.sliceSerialize(ie),10),this.data.expectingFirstListItemValue=void 0}}function h(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.lang=ie}function y(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.meta=ie}function v(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.value=ie.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.value=ie.replace(/(\r?\n|\r)$/g,"")}function k(ie){const ke=this.resume(),Fe=this.stack[this.stack.length-1];Fe.label=ke,Fe.identifier=bc(this.sliceSerialize(ie)).toLowerCase()}function b(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.title=ie}function j(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.url=ie}function N(ie){const ke=this.stack[this.stack.length-1];if(!ke.depth){const Fe=this.sliceSerialize(ie).length;ke.depth=Fe}}function C(){this.data.setextHeadingSlurpLineEnding=!0}function I(ie){const ke=this.stack[this.stack.length-1];ke.depth=this.sliceSerialize(ie).codePointAt(0)===61?1:2}function R(){this.data.setextHeadingSlurpLineEnding=void 0}function H(ie){const Fe=this.stack[this.stack.length-1].children;let Ze=Fe[Fe.length-1];(!Ze||Ze.type!=="text")&&(Ze=be(),Ze.position={start:To(ie.start),end:void 0},Fe.push(Ze)),this.stack.push(Ze)}function A(ie){const ke=this.stack.pop();ke.value+=this.sliceSerialize(ie),ke.position.end=To(ie.end)}function L(ie){const ke=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Fe=ke.children[ke.children.length-1];Fe.position.end=To(ie.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ke.type)&&(H.call(this,ie),A.call(this,ie))}function D(){this.data.atHardBreak=!0}function O(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.value=ie}function M(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.value=ie}function K(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.value=ie}function z(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const ke=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=ke,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function F(){const ie=this.stack[this.stack.length-1];if(this.data.inReference){const ke=this.data.referenceType||"shortcut";ie.type+="Reference",ie.referenceType=ke,delete ie.url,delete ie.title}else delete ie.identifier,delete ie.label;this.data.referenceType=void 0}function $(ie){const ke=this.sliceSerialize(ie),Fe=this.stack[this.stack.length-2];Fe.label=OV(ke),Fe.identifier=bc(ke).toLowerCase()}function W(){const ie=this.stack[this.stack.length-1],ke=this.resume(),Fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,Fe.type==="link"){const Ze=ie.children;Fe.children=Ze}else Fe.alt=ke}function E(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.url=ie}function Q(){const ie=this.resume(),ke=this.stack[this.stack.length-1];ke.title=ie}function V(){this.data.inReference=void 0}function B(){this.data.referenceType="collapsed"}function re(ie){const ke=this.resume(),Fe=this.stack[this.stack.length-1];Fe.label=ke,Fe.identifier=bc(this.sliceSerialize(ie)).toLowerCase(),this.data.referenceType="full"}function ue(ie){this.data.characterReferenceType=ie.type}function G(ie){const ke=this.sliceSerialize(ie),Fe=this.data.characterReferenceType;let Ze;Fe?(Ze=KR(ke,Fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ze=rv(ke);const Ne=this.stack[this.stack.length-1];Ne.value+=Ze}function ee(ie){const ke=this.stack.pop();ke.position.end=To(ie.end)}function te(ie){A.call(this,ie);const ke=this.stack[this.stack.length-1];ke.url=this.sliceSerialize(ie)}function ne(ie){A.call(this,ie);const ke=this.stack[this.stack.length-1];ke.url="mailto:"+this.sliceSerialize(ie)}function Z(){return{type:"blockquote",children:[]}}function ce(){return{type:"code",lang:null,meta:null,value:""}}function de(){return{type:"inlineCode",value:""}}function me(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function $e(){return{type:"emphasis",children:[]}}function Ce(){return{type:"heading",depth:0,children:[]}}function _e(){return{type:"break"}}function Be(){return{type:"html",value:""}}function at(){return{type:"image",title:null,url:"",alt:null}}function yt(){return{type:"link",title:null,url:"",children:[]}}function Te(ie){return{type:"list",ordered:ie.type==="listOrdered",start:null,spread:ie._spread,children:[]}}function it(ie){return{type:"listItem",spread:ie._spread,checked:null,children:[]}}function gt(){return{type:"paragraph",children:[]}}function $t(){return{type:"strong",children:[]}}function be(){return{type:"text",value:""}}function He(){return{type:"thematicBreak"}}}function To(e){return{line:e.line,column:e.column,offset:e.offset}}function nT(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?nT(e,r):BV(e,r)}}function BV(e,t){let n;for(n in t)if(tT.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 $1(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+gd({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+gd({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+gd({start:t.start,end:t.end})+") is still open")}function HV(e){const t=this;t.parser=n;function n(r){return FV(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function WV(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 VV(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
70
|
-
`}]}function KV(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 qV(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function UV(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function YV(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=Gc(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 GV(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 JV(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function rT(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 XV(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return rT(e,t);const s={src:Gc(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 QV(e,t){const n={src:Gc(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 ZV(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 eK(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return rT(e,t);const s={href:Gc(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 tK(e,t){const n={href:Gc(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 nK(e,t,n){const r=e.all(t),s=n?rK(n):sT(t),o={},a=[];if(typeof t.checked=="boolean"){const d=r[0];let f;d&&d.type==="element"&&d.tagName==="p"?f=d:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),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 rK(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=sT(n[r])}return t}function sT(e){const t=e.spread;return t??e.children.length>1}function sK(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 iK(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function oK(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function aK(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function lK(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=Zk(t.children[1]),c=DR(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 cK(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 f=t.children[c],p={},h=a?a[c]:void 0;h&&(p.align=h);let y={type:"element",tagName:o,properties:p,children:[]};f&&(y.children=e.all(f),e.patch(f,y),y=e.applyData(f,y)),u.push(y)}const d={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,d),e.applyData(t,d)}function uK(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const L1=9,O1=32;function dK(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const o=[];for(;r;)o.push(D1(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return o.push(D1(t.slice(s),s>0,!1)),o.join("")}function D1(e,t,n){let r=0,s=e.length;if(t){let o=e.codePointAt(r);for(;o===L1||o===O1;)r++,o=e.codePointAt(r)}if(n){let o=e.codePointAt(s-1);for(;o===L1||o===O1;)s--,o=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function fK(e,t){const n={type:"text",value:dK(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function pK(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const hK={blockquote:WV,break:VV,code:KV,delete:qV,emphasis:UV,footnoteReference:YV,heading:GV,html:JV,imageReference:XV,image:QV,inlineCode:ZV,linkReference:eK,link:tK,listItem:nK,list:sK,paragraph:iK,root:oK,strong:aK,table:lK,tableCell:uK,tableRow:cK,text:fK,thematicBreak:pK,toml:Mp,yaml:Mp,definition:Mp,footnoteDefinition:Mp};function Mp(){}const iT=-1,dg=0,wd=1,am=2,ov=3,av=4,lv=5,cv=6,oT=7,aT=8,F1=typeof self=="object"?self:globalThis,mK=(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 dg:case iT:return n(a,s);case wd:{const l=n([],s);for(const c of a)l.push(r(c));return l}case am:{const l=n({},s);for(const[c,u]of a)l[r(c)]=r(u);return l}case ov:return n(new Date(a),s);case av:{const{source:l,flags:c}=a;return n(new RegExp(l,c),s)}case lv:{const l=n(new Map,s);for(const[c,u]of a)l.set(r(c),r(u));return l}case cv:{const l=n(new Set,s);for(const c of a)l.add(r(c));return l}case oT:{const{name:l,message:c}=a;return n(new F1[l](c),s)}case aT: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 F1[o](a),s)};return r},z1=e=>mK(new Map,e)(0),Fl="",{toString:gK}={},{keys:yK}=Object,Ou=e=>{const t=typeof e;if(t!=="object"||!e)return[dg,t];const n=gK.call(e).slice(8,-1);switch(n){case"Array":return[wd,Fl];case"Object":return[am,Fl];case"Date":return[ov,Fl];case"RegExp":return[av,Fl];case"Map":return[lv,Fl];case"Set":return[cv,Fl];case"DataView":return[wd,n]}return n.includes("Array")?[wd,n]:n.includes("Error")?[oT,n]:[am,n]},$p=([e,t])=>e===dg&&(t==="function"||t==="symbol"),wK=(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]=Ou(a);switch(l){case dg:{let d=a;switch(c){case"bigint":l=aT,d=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);d=null;break;case"undefined":return s([iT],a)}return s([l,d],a)}case wd:{if(c){let p=a;return c==="DataView"?p=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(p=new Uint8Array(a)),s([c,[...p]],a)}const d=[],f=s([l,d],a);for(const p of a)d.push(o(p));return f}case am:{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=[],f=s([l,d],a);for(const p of yK(a))(e||!$p(Ou(a[p])))&&d.push([o(p),o(a[p])]);return f}case ov:return s([l,a.toISOString()],a);case av:{const{source:d,flags:f}=a;return s([l,{source:d,flags:f}],a)}case lv:{const d=[],f=s([l,d],a);for(const[p,h]of a)(e||!($p(Ou(p))||$p(Ou(h))))&&d.push([o(p),o(h)]);return f}case cv:{const d=[],f=s([l,d],a);for(const p of a)(e||!$p(Ou(p)))&&d.push(o(p));return f}}const{message:u}=a;return s([l,{name:c,message:u}],a)};return o},B1=(e,{json:t,lossy:n}={})=>{const r=[];return wK(!(t||n),!!t,new Map,r)(e),r},lm=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?z1(B1(e,t)):structuredClone(e):(e,t)=>z1(B1(e,t));function xK(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 bK(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function kK(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||xK,r=e.options.footnoteBackLabel||bK,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),f=String(u.identifier).toUpperCase(),p=Gc(f.toLowerCase());let h=0;const y=[],v=e.footnoteCounts.get(f);for(;v!==void 0&&++h<=v;){y.length>0&&y.push({type:"text",value:" "});let k=typeof n=="string"?n:n(c,h);typeof k=="string"&&(k={type:"text",value:k}),y.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+p+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,h),className:["data-footnote-backref"]},children:Array.isArray(k)?k:[k]})}const w=d[d.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const k=w.children[w.children.length-1];k&&k.type==="text"?k.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...y)}else d.push(...y);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+p},children:e.wrap(d,!0)};e.patch(u,g),l.push(g)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...lm(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 lT=function(e){if(e==null)return NK;if(typeof e=="function")return fg(e);if(typeof e=="object")return Array.isArray(e)?vK(e):SK(e);if(typeof e=="string")return jK(e);throw new Error("Expected function, string, or object as test")};function vK(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=lT(e[n]);return fg(r);function r(...s){let o=-1;for(;++o<t.length;)if(t[o].apply(this,s))return!0;return!1}}function SK(e){const t=e;return fg(n);function n(r){const s=r;let o;for(o in e)if(s[o]!==t[o])return!1;return!0}}function jK(e){return fg(t);function t(n){return n&&n.type===e}}function fg(e){return t;function t(n,r,s){return!!(CK(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function NK(){return!0}function CK(e){return e!==null&&typeof e=="object"&&"type"in e}const cT=[],_K=!0,H1=!1,EK="skip";function AK(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const o=lT(s),a=r?-1:1;l(e,void 0,[])();function l(c,u,d){const f=c&&typeof c=="object"?c:{};if(typeof f.type=="string"){const h=typeof f.tagName=="string"?f.tagName:typeof f.name=="string"?f.name:void 0;Object.defineProperty(p,"name",{value:"node ("+(c.type+(h?"<"+h+">":""))+")"})}return p;function p(){let h=cT,y,v,w;if((!t||o(c,u,d[d.length-1]||void 0))&&(h=PK(n(c,d)),h[0]===H1))return h;if("children"in c&&c.children){const g=c;if(g.children&&h[0]!==EK)for(v=(r?g.children.length:-1)+a,w=d.concat(g);v>-1&&v<g.children.length;){const k=g.children[v];if(y=l(k,v,w)(),y[0]===H1)return y;v=typeof y[1]=="number"?y[1]:v+a}}return h}}}function PK(e){return Array.isArray(e)?e:typeof e=="number"?[_K,e]:e==null?cT:[e]}function uT(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),AK(e,o,l,s);function l(c,u){const d=u[u.length-1],f=d?d.children.indexOf(c):void 0;return a(c,f,d)}}const sb={}.hasOwnProperty,IK={};function RK(e,t){const n=t||IK,r=new Map,s=new Map,o=new Map,a={...hK,...n.handlers},l={all:u,applyData:MK,definitionById:r,footnoteById:s,footnoteCounts:o,footnoteOrder:[],handlers:a,one:c,options:n,patch:TK,wrap:LK};return uT(e,function(d){if(d.type==="definition"||d.type==="footnoteDefinition"){const f=d.type==="definition"?r:s,p=String(d.identifier).toUpperCase();f.has(p)||f.set(p,d)}}),l;function c(d,f){const p=d.type,h=l.handlers[p];if(sb.call(l.handlers,p)&&h)return h(l,d,f);if(l.options.passThrough&&l.options.passThrough.includes(p)){if("children"in d){const{children:v,...w}=d,g=lm(w);return g.children=l.all(d),g}return lm(d)}return(l.options.unknownHandler||$K)(l,d,f)}function u(d){const f=[];if("children"in d){const p=d.children;let h=-1;for(;++h<p.length;){const y=l.one(p[h],d);if(y){if(h&&p[h-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=W1(y.value)),!Array.isArray(y)&&y.type==="element")){const v=y.children[0];v&&v.type==="text"&&(v.value=W1(v.value))}Array.isArray(y)?f.push(...y):f.push(y)}}}return f}}function TK(e,t){e.position&&(t.position=g8(e))}function MK(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,lm(o)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function $K(e,t){const n=t.data||{},r="value"in t&&!(sb.call(n,"hProperties")||sb.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 LK(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 W1(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function V1(e,t){const n=RK(e,t),r=n.one(e,void 0),s=kK(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 OK(e,t){return e&&"run"in e?async function(n,r){const s=V1(n,{file:r,...t});await e.run(s,r)}:function(n,r){return V1(n,{file:r,...e||t})}}function K1(e){if(e)throw e}var xh=Object.prototype.hasOwnProperty,dT=Object.prototype.toString,q1=Object.defineProperty,U1=Object.getOwnPropertyDescriptor,Y1=function(t){return typeof Array.isArray=="function"?Array.isArray(t):dT.call(t)==="[object Array]"},G1=function(t){if(!t||dT.call(t)!=="[object Object]")return!1;var n=xh.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&xh.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||xh.call(t,s)},J1=function(t,n){q1&&n.name==="__proto__"?q1(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},X1=function(t,n){if(n==="__proto__")if(xh.call(t,n)){if(U1)return U1(t,n).value}else return;return t[n]},DK=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=X1(l,n),s=X1(t,n),l!==s&&(d&&s&&(G1(s)||(o=Y1(s)))?(o?(o=!1,a=r&&Y1(r)?r:[]):a=r&&G1(r)?r:{},J1(l,{name:n,newValue:e(d,a,s)})):typeof s<"u"&&J1(l,{name:n,newValue:s}));return l};const tw=ca(DK);function ib(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 FK(){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 f=-1;if(c){a(c);return}for(;++f<s.length;)(u[f]===null||u[f]===void 0)&&(u[f]=s[f]);s=u,d?zK(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 zK(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 xi={basename:BK,dirname:HK,extname:WK,join:VK,sep:"/"};function BK(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');vf(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 HK(e){if(vf(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 WK(e){vf(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 VK(...e){let t=-1,n;for(;++t<e.length;)vf(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":KK(n)}function KK(e){vf(e);const t=e.codePointAt(0)===47;let n=qK(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function qK(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 vf(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const UK={cwd:YK};function YK(){return"/"}function ob(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function GK(e){if(typeof e=="string")e=new URL(e);else if(!ob(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 JK(e)}function JK(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 nw=["history","path","basename","stem","extname","dirname"];class fT{constructor(t){let n;t?ob(t)?n={path:t}:typeof t=="string"||XK(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":UK.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<nw.length;){const o=nw[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)nw.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?xi.basename(this.path):void 0}set basename(t){sw(t,"basename"),rw(t,"basename"),this.path=xi.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?xi.dirname(this.path):void 0}set dirname(t){Q1(this.basename,"dirname"),this.path=xi.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?xi.extname(this.path):void 0}set extname(t){if(rw(t,"extname"),Q1(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=xi.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){ob(t)&&(t=GK(t)),sw(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?xi.basename(this.path,this.extname):void 0}set stem(t){sw(t,"stem"),rw(t,"stem"),this.path=xi.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 Nr(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 rw(e,t){if(e&&e.includes(xi.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+xi.sep+"`")}function sw(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Q1(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function XK(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const QK=function(e){const r=this.constructor.prototype,s=r[e],o=function(){return s.apply(o,arguments)};return Object.setPrototypeOf(o,r),o},ZK={}.hasOwnProperty;class uv extends QK{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=FK()}copy(){const t=new uv;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(tw(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(aw("data",this.frozen),this.namespace[t]=n,this):ZK.call(this.namespace,t)&&this.namespace[t]||void 0:t?(aw("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=Lp(t),r=this.parser||this.Parser;return iw("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),iw("process",this.parser||this.Parser),ow("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(o,a){const l=Lp(t),c=r.parse(l);r.run(c,l,function(d,f,p){if(d||!f||!p)return u(d);const h=f,y=r.stringify(h,p);n7(y)?p.value=y:p.result=y,u(d,p)});function u(d,f){d||!f?a(d):o?o(f):n(void 0,f)}}}processSync(t){let n=!1,r;return this.freeze(),iw("processSync",this.parser||this.Parser),ow("processSync",this.compiler||this.Compiler),this.process(t,s),eC("processSync","process",n),r;function s(o,a){n=!0,K1(o),r=a}}run(t,n,r){Z1(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=Lp(n);s.run(t,c,u);function u(d,f,p){const h=f||t;d?l(d):a?a(h):r(void 0,h,p)}}}runSync(t,n){let r=!1,s;return this.run(t,n,o),eC("runSync","run",r),s;function o(a,l){K1(a),s=l,r=!0}}stringify(t,n){this.freeze();const r=Lp(n),s=this.compiler||this.Compiler;return ow("stringify",s),Z1(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(aw("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,...f]=u;c(d,f)}else a(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function a(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(u.plugins),u.settings&&(s.settings=tw(!0,s.settings,u.settings))}function l(u){let d=-1;if(u!=null)if(Array.isArray(u))for(;++d<u.length;){const f=u[d];o(f)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,d){let f=-1,p=-1;for(;++f<r.length;)if(r[f][0]===u){p=f;break}if(p===-1)r.push([u,...d]);else if(d.length>0){let[h,...y]=d;const v=r[p][1];ib(v)&&ib(h)&&(h=tw(!0,v,h)),r[p]=[u,h,...y]}}}}const e7=new uv().freeze();function iw(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function ow(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function aw(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 Z1(e){if(!ib(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function eC(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Lp(e){return t7(e)?e:new fT(e)}function t7(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function n7(e){return typeof e=="string"||r7(e)}function r7(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const s7="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",tC=[],nC={allowDangerousHtml:!0},i7=/^(https?|ircs?|mailto|xmpp)$/i,o7=[{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 pT(e){const t=a7(e),n=l7(e);return c7(t.runSync(t.parse(n),n),e)}function a7(e){const t=e.rehypePlugins||tC,n=e.remarkPlugins||tC,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...nC}:nC;return e7().use(HV).use(n).use(OK,r).use(t)}function l7(e){const t=e.children||"",n=new fT;return typeof t=="string"&&(n.value=t),n}function c7(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,o=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||u7;for(const d of o7)Object.hasOwn(t,d.from)&&(""+d.from+(d.to?"use `"+d.to+"` instead":"remove it")+s7+d.id,void 0);return uT(e,u),k8(e,{Fragment:i.Fragment,components:s,ignoreInvalidStyle:!0,jsx:i.jsx,jsxs:i.jsxs,passKeys:!0,passNode:!0});function u(d,f,p){if(d.type==="raw"&&p&&typeof f=="number")return a?p.children.splice(f,1):p.children[f]={type:"text",value:d.value},f;if(d.type==="element"){let h;for(h in Qy)if(Object.hasOwn(Qy,h)&&Object.hasOwn(d.properties,h)){const y=d.properties[h],v=Qy[h];(v===null||v.includes(d.tagName))&&(d.properties[h]=c(String(y||""),h,d))}}if(d.type==="element"){let h=n?!n.includes(d.tagName):o?o.includes(d.tagName):!1;if(!h&&r&&typeof f=="number"&&(h=!r(d,f,p)),h&&p&&typeof f=="number")return l&&d.children?p.children.splice(f,1,...d.children):p.children.splice(f,1),f}}}function u7(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||i7.test(e.slice(0,t))?e:""}const d7=new Set(["echarts"]),f7=new Set(["line","bar","pie","scatter","radar","heatmap","tree","treemap","sunburst","sankey","graph","gauge","funnel"]),p7=new Set(["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","oncontextmenu","onkeydown","onkeyup","onkeypress","onload","onerror"]),h7=["#7c9cff","#a8e66f","#ffcf5c","#68d8d6","#ff8fb3","#b79cff","#f59e73","#8bd17c"];function ea(e){return e&&typeof e=="object"&&!Array.isArray(e)}function nl(e,t){if(!ea(e))return{...t};const n={...e};for(const[r,s]of Object.entries(t))n[r]==null?n[r]=s:ea(n[r])&&ea(s)&&(n[r]=nl(n[r],s));return n}function pg(e,t){return e==null?e:Array.isArray(e)?e.map(n=>ea(n)?nl(n,t):n):ea(e)?nl(e,t):e}function m7(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 ab(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)=>ab(n,`${t}[${r}]`));return}if(typeof e=="object")for(const[n,r]of Object.entries(e)){if(/^on[A-Z]/.test(n)||p7.has(n.toLowerCase()))throw new Error(`${t}.${n} is not allowed`);ab(r,`${t}.${n}`)}}}function g7(e){const t=Array.isArray(e)?e:[e].filter(Boolean);if(!t.length)throw new Error("option.series is required");for(const n of t){const r=String((n==null?void 0:n.type)||"").trim();if(!f7.has(r))throw new Error(`series.type "${r||"(empty)"}" is not allowed`)}return t}function y7(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:nl(e,t)}function w7(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(!ea(r))return r;const o=s===0&&t&&r.text==null?{...r,text:t}:r;return nl(o,n)}):ea(e)?nl(t&&e.text==null?{...e,text:t}:e,n):t?{...n,text:t}:e}function x7(e,t){const n={top:t?42:14,textStyle:{color:"rgba(255, 255, 255, 0.72)"},itemGap:14};return e==null?e:pg(e,n)}function rC(e,t="rgba(255, 255, 255, 0.62)"){return pg(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 b7(e,t){const n={left:52,right:42,top:t?78:42,bottom:42,containLabel:!0};return e==null?n:pg(e,n)}function k7(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:pg(e,t)}function v7(e,t,n){const r=w7(e.title,n),s=!!(Array.isArray(r)?r:[r]).filter(Boolean).some(a=>ea(a)&&a.text),o=e.legend!=null&&e.legend!==!1;return{...e,backgroundColor:e.backgroundColor??"transparent",color:e.color??h7,textStyle:nl(e.textStyle,{color:"rgba(255, 255, 255, 0.78)"}),title:r,tooltip:y7(e.tooltip),legend:x7(e.legend,s),grid:e.xAxis!=null||e.yAxis!=null?b7(e.grid,s||o):e.grid,xAxis:rC(e.xAxis),yAxis:rC(e.yAxis),radar:k7(e.radar),series:t}}function S7(e){const t=m7(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(!d7.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");ab(n);const r=g7(n.option.series),s=n.title==null?"":String(n.title),o=v7(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 Op(e,t){let n=0;for(let r=t-1;r>=0&&e[r]==="\\";r-=1)n+=1;return n%2===1}function j7(e,t){let n=t;for(;n<e.length&&e[n]==="`";)n+=1;return n-t}function eo(e){let t=String(e||"").trim();if(!t.includes("|"))return[];t.startsWith("|")&&(t=t.slice(1)),t.endsWith("|")&&!Op(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==="`"&&!Op(t,o)){const l=j7(t,o);r+=t.slice(o,o+l),s===0?s=l:s===l&&(s=0),o+=l-1;continue}if(s===0&&a==="|"&&!Op(t,o)){n.push(r.trim()),r="";continue}if(s===0&&a==="\\"&&t[o+1]==="|"&&Op(t,o+1)){r+="|",o+=1;continue}r+=a}return n.push(r.trim()),n}function hT(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 mT(e){const t=eo(e);return t.length>1&&t.every(n=>/^:?-{3,}:?$/.test(n))}function gT(e){return eo(e).map(t=>t.startsWith(":")&&t.endsWith(":")?"center":t.endsWith(":")?"right":"left")}function N7(e){return/^\s*(sequenceDiagram|flowchart\s+(?:TD|TB|BT|LR|RL)|graph\s+(?:TD|TB|BT|LR|RL))\b/i.test(String(e||""))}function C7(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 _7({code:e}){const t=m.useMemo(()=>C7(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,f)=>{l.set(d.id,{x:28+(n?f*(r+o):f%3*(r+o)),y:28+(n?f%3*(s+a):f*(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,f)=>{const p=l.get(d.from),h=l.get(d.to);if(!p||!h)return null;const y=n?`M ${p.x+r} ${p.y+s/2} C ${(p.x+h.x+r)/2} ${p.y+s/2}, ${(p.x+h.x+r)/2} ${h.y+s/2}, ${h.x} ${h.y+s/2}`:`M ${p.x+r/2} ${p.y+s} C ${p.x+r/2} ${p.y+s+28}, ${h.x+r/2} ${h.y-28}, ${h.x+r/2} ${h.y}`;return i.jsx("path",{className:"af-md-mermaid-edge",d:y,markerEnd:"url(#af-md-mermaid-arrow)"},`${d.from}-${d.to}-${f}`)}),t.nodes.map(d=>{const f=l.get(d.id);return i.jsxs("g",{children:[i.jsx("rect",{className:"af-md-mermaid-box",x:f.x,y:f.y,width:r,height:s,rx:"8"}),i.jsx("text",{className:"af-md-mermaid-text",x:f.x+r/2,y:f.y+s/2+5,textAnchor:"middle",children:d.label.slice(0,24)})]},d.id)})]})}function E7(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 A7({code:e}){const t=m.useMemo(()=>E7(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=f=>{const p=Math.max(0,n.findIndex(h=>h.id===f));return s+p*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((f,p)=>{const h=s+p*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:f.label.slice(0,18)}),i.jsx("line",{className:"af-md-sequence-life",x1:h,y1:o+a,x2:h,y2:u-18})]},f.id)}),t.rows.map((f,p)=>{const h=o+a+p*l+24;if(f.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:f.text.slice(0,120)})]},`note-${p}`);const y=d(f.from),v=d(f.to),w=(y+v)/2;return i.jsxs("g",{children:[i.jsx("line",{className:"af-md-mermaid-edge",x1:y,y1:h,x2:v,y2:h,markerEnd:"url(#af-md-sequence-arrow)"}),i.jsx("text",{className:"af-md-sequence-label",x:w,y:h-8,textAnchor:"middle",children:f.text.slice(0,72)})]},`msg-${p}`)})]})}function yT({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(A7,{code:t}):i.jsx(_7,{code:t})})}function P7(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&&N7(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&&eo(l).length>1&&mT(t[a+1])){o();const u=eo(l),d=gT(t[a+1]),f=[];for(a+=2;a<t.length&&t[a].trim()&&eo(t[a]).length>1;)f.push(hT(eo(t[a]),u.length)),a++;n.push({type:"table",headers:u,align:d,rows:f});continue}r.push(l),a++}return o(),n}function sC(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 wT(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 f=r.slice(o,d),p="";for(;/[.,;:!?)}\]]$/.test(f);)p=f.slice(-1)+p,f=f.slice(0,-1);f?s+=`[${f}](${f})${p}`:s+=r.slice(o,d),o=d}return s}).join(`
|
|
87
|
-
`)}function xT(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=sC(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(yT,{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(sC(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 iC({children:e,resolveSrc:t,basePath:n=""}){return i.jsx(pT,{components:xT(t,!0,n),children:wT(e)})}function dv({content:e,resolveSrc:t,basePath:n=""}){const r=m.useMemo(()=>P7(e),[e]),s=m.useMemo(()=>xT(t,!1,n),[n,t]);return i.jsx(i.Fragment,{children:r.map((o,a)=>o.type==="mermaid"?i.jsx(yT,{code:o.text},`mermaid-${a}`):o.type!=="table"?i.jsx(pT,{components:s,children:wT(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(iC,{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(iC,{resolveSrc:t,basePath:n,children:l[d]||""})},d))},c))})]})},`table-${a}`))})}function I7(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 yi(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 R7(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=>yi(o[a])))}}if(e.every(Array.isArray)&&e.length>0){const s=e[0].map((o,a)=>yi(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)=>yi(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:yi(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:yi(s)||`Column ${o+1}`,align:"left"})),{columns:r,rows:n.slice(1).map(s=>r.map((o,a)=>yi(s[a])))}):{columns:r,rows:n.map(s=>Array.isArray(s)?r.map((o,a)=>yi(s[a])):s&&typeof s=="object"?r.map(o=>yi(s[o.key])):r.map((o,a)=>a===0?yi(s):""))}}function T7(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=R7(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&&eo(s[0]).length>1&&mT(s[1])){const l=eo(s[0]),c=gT(s[1]);return{columns:l.map((u,d)=>({key:String(d),label:u,align:c[d]||"left"})),rows:s.slice(2).map(u=>hT(eo(u),l.length)),error:""}}const o=r.includes(" ")?" ":",",a=I7(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 fv({content:e}){const t=m.useMemo(()=>T7(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:yi(n[o])},`${s.key}-${o}`))},r))})]})})}function pv({content:e}){const t=m.useRef(null),n=m.useMemo(()=>S7(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:""}),j6(()=>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 bT(e){return typeof e>"u"||e===null}function M7(e){return typeof e=="object"&&e!==null}function $7(e){return Array.isArray(e)?e:bT(e)?[]:[e]}function L7(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 O7(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function D7(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var F7=bT,z7=M7,B7=$7,H7=O7,W7=D7,V7=L7,hv={isNothing:F7,isObject:z7,toArray:B7,repeat:H7,isNegativeZero:W7,extend:V7};function kT(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 Jd(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=kT(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Jd.prototype=Object.create(Error.prototype);Jd.prototype.constructor=Jd;Jd.prototype.toString=function(t){return this.name+": "+kT(this,t)};var Ra=Jd,K7=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],q7=["scalar","sequence","mapping"];function U7(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function Y7(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(K7.indexOf(n)===-1)throw new Ra('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=U7(t.styleAliases||null),q7.indexOf(this.kind)===-1)throw new Ra('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var vr=Y7;function oC(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 G7(){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 lb(e){return this.extend(e)}lb.prototype.extend=function(t){var n=[],r=[];if(t instanceof vr)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 Ra("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(o){if(!(o instanceof vr))throw new Ra("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(o.loadKind&&o.loadKind!=="scalar")throw new Ra("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 Ra("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 vr))throw new Ra("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var s=Object.create(lb.prototype);return s.implicit=(this.implicit||[]).concat(n),s.explicit=(this.explicit||[]).concat(r),s.compiledImplicit=oC(s,"implicit"),s.compiledExplicit=oC(s,"explicit"),s.compiledTypeMap=G7(s.compiledImplicit,s.compiledExplicit),s};var J7=lb,X7=new vr("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),Q7=new vr("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Z7=new vr("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),eq=new J7({explicit:[X7,Q7,Z7]});function tq(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function nq(){return null}function rq(e){return e===null}var sq=new vr("tag:yaml.org,2002:null",{kind:"scalar",resolve:tq,construct:nq,predicate:rq,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function iq(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 oq(e){return e==="true"||e==="True"||e==="TRUE"}function aq(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var lq=new vr("tag:yaml.org,2002:bool",{kind:"scalar",resolve:iq,construct:oq,predicate:aq,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 cq(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function uq(e){return 48<=e&&e<=55}function dq(e){return 48<=e&&e<=57}function fq(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(!cq(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}if(s==="o"){for(n++;n<t;n++)if(s=e[n],s!=="_"){if(!uq(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}}if(s==="_")return!1;for(;n<t;n++)if(s=e[n],s!=="_"){if(!dq(e.charCodeAt(n)))return!1;r=!0}return!(!r||s==="_")}function pq(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 hq(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!hv.isNegativeZero(e)}var mq=new vr("tag:yaml.org,2002:int",{kind:"scalar",resolve:fq,construct:pq,predicate:hq,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"]}}),gq=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function yq(e){return!(e===null||!gq.test(e)||e[e.length-1]==="_")}function wq(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 xq=/^[-+]?[0-9]+e/;function bq(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(hv.isNegativeZero(e))return"-0.0";return n=e.toString(10),xq.test(n)?n.replace("e",".e"):n}function kq(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||hv.isNegativeZero(e))}var vq=new vr("tag:yaml.org,2002:float",{kind:"scalar",resolve:yq,construct:wq,predicate:kq,represent:bq,defaultStyle:"lowercase"}),Sq=eq.extend({implicit:[sq,lq,mq,vq]}),jq=Sq,vT=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),ST=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 Nq(e){return e===null?!1:vT.exec(e)!==null||ST.exec(e)!==null}function Cq(e){var t,n,r,s,o,a,l,c=0,u=null,d,f,p;if(t=vT.exec(e),t===null&&(t=ST.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],f=+(t[11]||0),u=(d*60+f)*6e4,t[9]==="-"&&(u=-u)),p=new Date(Date.UTC(n,r,s,o,a,l,c)),u&&p.setTime(p.getTime()-u),p}function _q(e){return e.toISOString()}var Eq=new vr("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:Nq,construct:Cq,instanceOf:Date,represent:_q});function Aq(e){return e==="<<"||e===null}var Pq=new vr("tag:yaml.org,2002:merge",{kind:"scalar",resolve:Aq}),mv=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
94
|
-
\r`;function Iq(e){if(e===null)return!1;var t,n,r=0,s=e.length,o=mv;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 Rq(e){var t,n,r=e.replace(/[\r\n=]/g,""),s=r.length,o=mv,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 Tq(e){var t="",n=0,r,s,o=e.length,a=mv;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 Mq(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var $q=new vr("tag:yaml.org,2002:binary",{kind:"scalar",resolve:Iq,construct:Rq,predicate:Mq,represent:Tq}),Lq=Object.prototype.hasOwnProperty,Oq=Object.prototype.toString;function Dq(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,Oq.call(s)!=="[object Object]")return!1;for(o in s)if(Lq.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 Fq(e){return e!==null?e:[]}var zq=new vr("tag:yaml.org,2002:omap",{kind:"sequence",resolve:Dq,construct:Fq}),Bq=Object.prototype.toString;function Hq(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],Bq.call(r)!=="[object Object]"||(s=Object.keys(r),s.length!==1))return!1;o[t]=[s[0],r[s[0]]]}return!0}function Wq(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 Vq=new vr("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:Hq,construct:Wq}),Kq=Object.prototype.hasOwnProperty;function qq(e){if(e===null)return!0;var t,n=e;for(t in n)if(Kq.call(n,t)&&n[t]!==null)return!1;return!0}function Uq(e){return e!==null?e:{}}var Yq=new vr("tag:yaml.org,2002:set",{kind:"mapping",resolve:qq,construct:Uq});jq.extend({implicit:[Eq,Pq],explicit:[$q,zq,Vq,Yq]});function aC(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 Gq=new Array(256),Jq=new Array(256);for(var zl=0;zl<256;zl++)Gq[zl]=aC(zl)?1:0,Jq[zl]=aC(zl);const Xd=["requirement","planning","code","test","normal"],lC={普通:"normal",技术规划:"planning",代码执行:"code",测试回归:"test",需求拆解:"requirement"};function gv(e,t){var s,o,a,l,c,u,d,f,p,h,y,v,w,g;const n=k=>{const b={type:(k==null?void 0:k.type)??"node",name:(k==null?void 0:k.name)??"",value:(k==null?void 0:k.value)??(k==null?void 0:k.default)??""};return(k==null?void 0:k.required)===!0&&(b.required=!0),(k==null?void 0:k.description)!=null&&String(k.description).trim()&&(b.description=String(k.description)),(k==null?void 0:k.showOnNode)!=null&&(b.showOnNode=!!k.showOnNode),b},r={};for(const k of e){if((s=k==null?void 0:k.data)!=null&&s.isWorkspaceGroup)continue;const b=t[k.id]&&typeof t[k.id]=="object"?{...t[k.id]}:{},j=((o=k.data)==null?void 0:o.definitionId)||k.id,N=((a=k.data)==null?void 0:a.inputs)??[],C=((l=k.data)==null?void 0:l.outputs)??[],I=((c=k.data)==null?void 0:c.role)!=null?String(k.data.role).trim():"",R=b.role!=null?String(b.role).trim():"",H=lC[I]||I,A=lC[R]||R,L=Xd.includes(H)?H:Xd.includes(A)?A:"normal",D=Array.isArray(N)?N.map(n):Array.isArray(b.input)?b.input.map(ue=>n(ue)):[],O=Array.isArray(C)?C.map(n):Array.isArray(b.output)?b.output.map(ue=>n(ue)):[],M=((u=k.data)==null?void 0:u.label)!=null?String(k.data.label):b.label!=null?String(b.label):k.id,K=(d=k.data)==null?void 0:d.body,z=K!=null?String(K):b.body!=null?String(b.body):"";let F=((f=k.data)==null?void 0:f.model)!=null&&String(k.data.model).trim()!==""?String(k.data.model).trim():b.model!=null&&String(b.model).trim()!==""?String(b.model).trim():void 0;(F===""||F==="default")&&(F=void 0);const $={...b,definitionId:j,label:M,role:L,model:F,input:D,output:O},W=((p=k.data)==null?void 0:p.marketplaceRef)||b.marketplaceRef;W?$.marketplaceRef=String(W):delete $.marketplaceRef;const E=((h=k.data)==null?void 0:h.marketplacePackageId)||b.marketplacePackageId;E?$.marketplacePackageId=String(E):delete $.marketplacePackageId;const Q=((y=k.data)==null?void 0:y.marketplaceVersion)||b.marketplaceVersion;Q?$.marketplaceVersion=String(Q):delete $.marketplaceVersion,j.startsWith("provide_")||z.trim()===""?delete $.body:$.body=z;const V=Array.isArray((v=k.data)==null?void 0:v.images)?k.data.images:Array.isArray(b.images)?b.images:[];V.length>0?$.images=V:delete $.images;const B=(w=k.data)==null?void 0:w.script,re=B!=null?String(B):b.script!=null?String(b.script):"";re.trim()===""?delete $.script:$.script=re;for(const ue of["scriptRef","implementationRef","implementationMode"]){const G=(g=k.data)==null?void 0:g[ue],ee=G!=null?String(G):b[ue]!=null?String(b[ue]):"";ee.trim()===""?delete $[ue]:$[ue]=ee.trim()}delete $.temperature,delete $.maxTokens,delete $.description,r[k.id]=$}return r}function xd(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function Xq(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 Qq(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=>xd(a)),edges:o.map(a=>xd(a)),instances:gv(r,n||{})}}function Zq(e,t,n,r,s={}){var f;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(p=>p.id)),l=new Map;for(const p of e.nodes)l.set(p.id,Xq(p.id,a));const c=e.nodes.map(p=>{var y,v;const h=l.get(p.id);return{...xd(p),id:h,selected:!0,dragging:!1,position:{x:Number(((y=p.position)==null?void 0:y.x)||0)+o.x,y:Number(((v=p.position)==null?void 0:v.y)||0)+o.y}}}),u=(e.edges||[]).filter(p=>l.has(p.source)&&l.has(p.target)).map((p,h)=>{const y=l.get(p.source),v=l.get(p.target);return{...xd(p),id:`e-${y}-${v}-${Date.now()}-${h}`,source:y,target:v,selected:!1}}),d={...r||{}};for(const[p,h]of l.entries()){const y=(f=e.instances)==null?void 0:f[p];y&&(d[h]={...xd(y),label:y.label!=null?String(y.label):h})}return{nodes:[...(t||[]).map(p=>({...p,selected:!1})),...c],edges:[...(n||[]).map(p=>({...p,selected:!1})),...u],instances:d,pastedNodeIds:c.map(p=>p.id)}}function Pn(e){switch(cm(e)){case"text":return"#2196f3";case"file":return"#4caf50";case"node":return"#ff9800";case"bool":return"#9c27b0";default:return"#9e9e9e"}}function cm(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 eU(e,t){const n=cm(e),r=cm(t);return!n||!r?!1:n==="any"||r==="any"?!0:n===r}const tU=new Set(["knowledgeContext","workspaceContext","skillsContext","mcpContext"]);function cb(e){const t=cm(e==null?void 0:e.type),n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim();return t==="text"&&tU.has(n)?`${t}+${n}`:t}function nU(e){return cb(e)}function Qd(e,t){if(!e||!t||!eU(e.type,t.type))return!1;const n=cb(e),r=cb(t),s=n.includes("+"),o=r.includes("+");return s||o?n===r:!0}function rU(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 ub(e,t,n){var l;const r=n==="source"?"outputs":"inputs",o=rU(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 um=/\[image\s+(\d+)\]/gi;function yo(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 sU(e){return`image ${yo(e).length+1}`}function iU(e,t){const n=String(e||""),r=`[${t}]`;return n.trim()?`${n.replace(/[ \t]+$/u,"")} ${r}`:r}function oU(e,t){const n=yo(e),r=String(t||""),s=new Set;um.lastIndex=0;let o;for(;o=um.exec(r);)s.add(`image ${o[1]}`.toLowerCase());return s.size===0?[]:n.filter(a=>s.has(String(a.label||"").toLowerCase()))}function aU(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 jT(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 bd(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 NT({files:e,body:t,images:n}){const r=Array.from(e||[]);if(r.length===0)return null;let s=String(t||"");const o=yo(n);for(const a of r){const l=await aU(a),c=sU(o);o.push({id:`${Date.now().toString(36)}-${o.length+1}`,label:c,...l}),s=iU(s,c)}return{body:s,images:o}}function vs(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function lU(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 cU(e){return["true","1","yes","on"].includes(String((e==null?void 0:e.value)??(e==null?void 0:e.default)??"").trim().toLowerCase())}function nn(e){e.stopPropagation()}function uU(e){return String(e||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function dU(e,t){const n=`\\[${uU(t)}\\]`;return String(e||"").replace(new RegExp(`[ \\t]*${n}`,"gi"),"").replace(/[ \t]+\n/g,`
|
|
96
|
-
`).replace(/\n{3,}/g,`
|
|
97
|
-
|
|
98
|
-
`).trimEnd()}function lw(e){return String(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function fU(e){const t=String(e||"");let n="",r=0;um.lastIndex=0;let s;for(;s=um.exec(t);)n+=lw(t.slice(r,s.index)),n+=`<span class="af-flow-node__image-token">${lw(s[0])}</span>`,r=s.index+s[0].length;return n+=lw(t.slice(r)),n||" "}function pU(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 hU({data:e,selected:t,id:n,deleteNode:r,onProvideExpand:s,onProvideValueChange:o,onNodeBodyChange:a,onNodeImagesChange:l,modelLists:c,onModelChange:u,deferTextCommit:d=!1}){var Xt,jn;const{t:f}=$r(),p=(e==null?void 0:e.inputs)??[],h=(e==null?void 0:e.outputs)??[],y=((e==null?void 0:e.schemaType)??"agent").toLowerCase(),v=lU(e),w=(e==null?void 0:e.isRunMode)??!1,g=!!(e!=null&&e.readOnly),k=(e==null?void 0:e.isExecuting)??!1,b=(e==null?void 0:e.isDim)??!1,j=(e==null?void 0:e.nodeStatus)??null,N=(e==null?void 0:e.nodeElapsed)??null,C=(e==null?void 0:e.definitionId)||"",I=C.startsWith("provide_"),R=C==="provide_bool",H=C==="provide_str",A=C==="provide_file",L=C==="provide_password",D=C==="agent_subAgent",O=C==="control_agent_toBool",M=(D||O)&&!w,K=R?cU(h[0]):!1,z=I?String(((Xt=h[0])==null?void 0:Xt.value)??((jn=h[0])==null?void 0:jn.default)??(e==null?void 0:e.body)??""):"",F=String((e==null?void 0:e.body)||""),$=(e==null?void 0:e.displayLabel)||(e==null?void 0:e.label)||f("flow:node.fallbackLabel"),W=!I&&!M&&(e!=null&&e.showBodyPreview)?String((e==null?void 0:e.body)||"").trim():"",E=yo(e==null?void 0:e.images),Q=R||H||A||L||M||!!W,V=m.useRef(!1),B=m.useRef(!1),re=m.useRef(null),ue=m.useRef(null),G=m.useRef(null),ee=m.useRef(null),te=m.useRef(null),[ne,Z]=m.useState(z),[ce,de]=m.useState(!1),[me,$e]=m.useState(F),[Ce,_e]=m.useState(!1),[Be,at]=m.useState({visible:!1,top:0,height:100}),[yt,Te]=m.useState(!1),it=m.useCallback(()=>{const le=ue.current;if(!le)return;const he=Math.max(1,le.scrollHeight),nt=Math.max(1,le.clientHeight),ct=he>nt+1,Ft=ct?Math.max(12,nt/he*100):100,on=Math.max(0,100-Ft),Dr=ct?Math.min(on,le.scrollTop/Math.max(1,he-nt)*on):0;at({visible:ct,top:Dr,height:Ft})},[]);m.useEffect(()=>{V.current||Z(z)},[n,z]),m.useEffect(()=>{B.current||$e(F)},[n,F]),m.useEffect(()=>{const le=ue.current;if(!le)return;if(M){le.style.minHeight="",le.style.height="",G.current&&(G.current.style.minHeight="",G.current.style.height="");return}const he=pU(le,me);le.style.minHeight=`${he}px`,le.style.height="",G.current&&(G.current.style.minHeight=`${he}px`,G.current.style.height="")},[me,M]),m.useEffect(()=>{if(!M)return;const le=window.requestAnimationFrame(it),he=ue.current;if(!he||typeof ResizeObserver>"u")return()=>window.cancelAnimationFrame(le);const nt=new ResizeObserver(it);return nt.observe(he),()=>{window.cancelAnimationFrame(le),nt.disconnect()}},[me,M,it]),m.useEffect(()=>{const le=re.current,he=e==null?void 0:e.onNodeContentResize;if(!M||!le||!he||typeof ResizeObserver>"u")return;let nt=0;const ct=()=>{window.cancelAnimationFrame(nt),nt=window.requestAnimationFrame(()=>he(n))},Ft=new ResizeObserver(ct);return Ft.observe(le),ct(),()=>{window.cancelAnimationFrame(nt),Ft.disconnect()}},[e==null?void 0:e.onNodeContentResize,M,n]),m.useEffect(()=>{if(!yt)return;const le=window.setTimeout(()=>{const he=te.current;if(!he)return;he.focus();const nt=he.value.length;he.setSelectionRange(nt,nt)},0);return()=>window.clearTimeout(le)},[yt]);const gt=Array.isArray(c==null?void 0:c.cursor)?c.cursor:[],$t=Array.isArray(c==null?void 0:c.opencode)?c.opencode:[],be=Array.isArray(c==null?void 0:c.claudeCode)?c.claudeCode:[],He=Array.isArray(c==null?void 0:c.codex)?c.codex:[],ie=((e==null?void 0:e.model)??"").trim(),ke=y==="agent"&&!C.startsWith("tool_nodejs"),Fe=new Set(gt.map(vs)),Ze=new Set($t.map(vs)),Ne=new Set(be.map(vs)),St=new Set(He.map(vs)),Jt=ie?ie.startsWith("cursor:")||ie.startsWith("opencode:")||ie.startsWith("codex:")||ie.startsWith("claude-code:")?ie:Ne.has(ie)?`claude-code:${ie}`:St.has(ie)?`codex:${ie}`:Ze.has(ie)?`opencode:${ie}`:Fe.has(ie)?`cursor:${ie}`:ie:"",Vt=ie&&!Jt.startsWith("cursor:")&&!Jt.startsWith("opencode:")&&!Jt.startsWith("codex:")&&!Jt.startsWith("claude-code:")&&!Fe.has(ie)&&!Ze.has(ie)&&!Ne.has(ie)&&!St.has(ie),ot=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,On=le=>{if(g)return;const he=le.target.value;u&&u(n,he)},se=le=>{le.stopPropagation(),!g&&r&&r(n)},Ie=le=>{le.stopPropagation(),s&&s()},et=le=>{le.stopPropagation(),!g&&(o==null||o(n,le.target.value==="true"?"true":"false"))},qe=le=>{if(le.stopPropagation(),g)return;const he=le.target.value;Z(he),!d&&!V.current&&(o==null||o(n,he))},Et=le=>{le.stopPropagation(),V.current=!0},vt=le=>{if(le.stopPropagation(),g)return;V.current=!1;const he=le.currentTarget.value;Z(he),d||o==null||o(n,he)},Jn=()=>{g||d&&ne===z||o==null||o(n,ne)},mn=le=>{if(le.stopPropagation(),g)return;if(typeof(e==null?void 0:e.onOpenProvideFilePicker)=="function"){e.onOpenProvideFilePicker(n,ne);return}const he=window.prompt("文件路径",ne);he!=null&&(Z(he),o==null||o(n,he))},Lr=le=>{le.stopPropagation(),de(he=>!he)},Vn=le=>{if($e(le),a==null||a(n,le),l){const he=oU(E,le);(he.length!==E.length||he.some((nt,ct)=>{var Ft;return nt.id!==((Ft=E[ct])==null?void 0:Ft.id)}))&&l(n,he)}},ir=le=>{if(le.stopPropagation(),g)return;const he=le.target.value;d||B.current?$e(he):Vn(he)},Xn=le=>{le.stopPropagation(),!g&&(B.current=!0,_e(!0))},Qn=le=>{if(le.stopPropagation(),g)return;B.current=!1,_e(!1);const he=le.currentTarget.value;d?$e(he):Vn(he)},Zn=()=>{g||(B.current=!1,_e(!1),!(d&&me===F)&&Vn(me))},Cr=le=>{le.stopPropagation(),le.preventDefault(),!g&&Te(!0)},ys=()=>{Te(!1),Zn()},Ts=le=>{le.stopPropagation(),le.key==="Escape"&&(le.preventDefault(),ys())},Sn=m.useCallback(le=>{const he=ue.current;if(!he)return;const nt=Math.max(0,he.scrollHeight-he.clientHeight);he.scrollTop=Math.min(1,Math.max(0,le))*nt,it()},[it]),Dn=m.useCallback((le,he=0)=>{const nt=ee.current;if(!nt)return 0;const ct=nt.getBoundingClientRect(),Ft=Be.height/100*ct.height,on=Math.max(1,ct.height-Ft);return(le-ct.top-he)/on},[Be.height]),Zr=m.useCallback(le=>{var tr,tt;if(!Be.visible)return;le.preventDefault(),le.stopPropagation();const he=ee.current;if(!he)return;const nt=he.getBoundingClientRect(),ct=Be.top/100*nt.height,Ft=Be.height/100*nt.height,Dr=le.clientY>=nt.top+ct&&le.clientY<=nt.top+ct+Ft?le.clientY-nt.top-ct:Ft/2;Sn(Dn(le.clientY,Dr));const wt=le.pointerId;(tt=(tr=le.currentTarget).setPointerCapture)==null||tt.call(tr,wt);const Yt=Mn=>{Mn.preventDefault(),Sn(Dn(Mn.clientY,Dr))},zt=()=>{window.removeEventListener("pointermove",Yt),window.removeEventListener("pointerup",zt),window.removeEventListener("pointercancel",zt)};window.addEventListener("pointermove",Yt),window.addEventListener("pointerup",zt),window.addEventListener("pointercancel",zt)},[Dn,Be.height,Be.top,Be.visible,Sn]),Tn=async le=>{if(g)return;const he=await NT({files:le,body:me,images:E});he&&($e(he.body),a==null||a(n,he.body),l==null||l(n,he.images))},Fn=(le,he)=>{if(le.stopPropagation(),g)return;const nt=E.filter(Ft=>Ft.id!==he.id),ct=dU(me,he.label);$e(ct),a==null||a(n,ct),l==null||l(n,nt)},es=le=>{if(g)return;const he=jT(le);he.length!==0&&(le.preventDefault(),le.stopPropagation(),Tn(he).catch(()=>{}))},Or=le=>{if(g)return;const he=bd(le);he.length!==0&&(le.preventDefault(),le.stopPropagation(),Tn(he).catch(()=>{}))},er=()=>{const le=ue.current,he=G.current;!le||!he||(he.scrollTop=le.scrollTop,he.scrollLeft=le.scrollLeft)};return i.jsxs("div",{className:"af-flow-node"+(t?" af-flow-node--selected":"")+(k?" af-flow-node--executing":"")+(j==="success"?" af-flow-node--done":"")+(j==="failed"?" af-flow-node--failed":"")+(j==="running"&&!k?" af-flow-node--running-disk":"")+(b?" af-flow-node--dim":"")+(M?" af-flow-node--inline-body-editor":"")+(H?" af-flow-node--provide-text":"")+(L?" af-flow-node--provide-password":"")+" af-flow-node--"+y.replace(/[^a-z0-9_-]/g,""),"data-schema":y,children:[i.jsxs("div",{className:"af-flow-node__chrome",children:[i.jsx("span",{className:"af-flow-node__title af-flow-node__title--chrome",title:`${$}${n?` (${n})`:""}${v?` · ${v}`:""}`,children:$}),!w&&ke&&i.jsxs("div",{className:"af-flow-node__model-wrap nodrag",onPointerDown:nn,onMouseDown:nn,onClick:nn,children:[i.jsxs("select",{className:"af-flow-node__model nodrag",value:Jt,onChange:On,onPointerDown:nn,onMouseDown:nn,onClick:nn,"aria-label":f("flow:node.model"),title:ot||f("flow:node.defaultModel"),disabled:g,children:[i.jsx("option",{value:"",children:f("flow:node.defaultModel")}),Vt&&i.jsx("option",{value:ie,children:ie}),gt.length>0&&i.jsx("optgroup",{label:"Cursor",children:gt.map(le=>i.jsx("option",{value:`cursor:${vs(le)}`,children:vs(le)},`c-${le}`))}),$t.length>0&&i.jsx("optgroup",{label:"OpenCode",children:$t.map(le=>i.jsx("option",{value:`opencode:${vs(le)}`,children:vs(le)},`o-${le}`))}),He.length>0&&i.jsx("optgroup",{label:"Codex",children:He.map(le=>i.jsx("option",{value:`codex:${vs(le)}`,children:vs(le)},`codex-${le}`))}),be.length>0&&i.jsx("optgroup",{label:"Claude Code",children:be.map(le=>i.jsx("option",{value:`claude-code:${vs(le)}`,children:vs(le)},`cc-${le}`))})]}),i.jsx("span",{className:"af-flow-node__model-arrow material-symbols-outlined",children:"expand_more"})]}),k&&i.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--executing",children:"EXECUTING"}),j==="running"&&!k&&i.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--running-disk",title:f("flow:node.diskRunning"),children:"RUNNING"}),j==="success"&&i.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--done",children:N!=null&&String(N).trim()!==""?N:"--"}),j==="failed"&&i.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--failed",children:"FAILED"}),!w&&I&&!R&&!H&&!A&&!L&&i.jsx("button",{type:"button",className:"af-flow-node__expand",onClick:Ie,"aria-label":f("flow:node.expandProvide"),title:f("flow:node.expandProvide"),children:i.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),!w&&i.jsx("button",{type:"button",className:"af-flow-node__delete",disabled:g,onClick:se,"aria-label":f("flow:node.deleteNode"),title:f("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((le,he)=>{if(le.showOnNode===!1)return null;const nt=f("flow:node.inputTooltip",{name:le.name||`#${he}`,type:le.type})+(le.default!=null&&le.default!==""?f("flow:node.defaultSuffix",{value:le.default}):""),ct=le.name||`#${he+1}`;return i.jsxs("div",{className:"af-flow-node__port-row",title:nt,children:[i.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--in",children:[ct,le.required?i.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),i.jsx(Yn,{type:"target",position:Ue.Left,id:`input-${he}`,className:"af-flow-node__handle",style:{background:Pn(le.type)},title:nt})]},`in-${he}`)})}),i.jsxs("div",{className:"af-flow-node__title-wrap",children:[R?i.jsxs("select",{className:"af-flow-node__bool-select nodrag"+(K?" af-flow-node__bool-select--true":""),value:K?"true":"false",onChange:et,onPointerDown:nn,onMouseDown:nn,onClick:nn,"aria-label":"Boolean value",title:K?"true":"false",disabled:g,children:[i.jsx("option",{value:"false",children:"false"}),i.jsx("option",{value:"true",children:"true"})]}):H?i.jsx("textarea",{className:"af-flow-node__inline-text nodrag",value:ne,onChange:qe,onCompositionStart:Et,onCompositionEnd:vt,onBlur:Jn,onPointerDown:nn,onMouseDown:nn,onClick:nn,placeholder:"输入文本",rows:2,readOnly:g}):A?i.jsxs("div",{className:"af-flow-node__file-value nodrag",onPointerDown:nn,onMouseDown:nn,onClick:nn,children:[i.jsx("input",{className:"af-flow-node__file-input nodrag",value:ne,onChange:qe,onCompositionStart:Et,onCompositionEnd:vt,onBlur:Jn,placeholder:"选择或输入文件路径",title:ne||"选择或输入文件路径",readOnly:g}),i.jsx("button",{type:"button",className:"af-flow-node__file-picker nodrag",disabled:g,onClick:mn,"aria-label":"选择文件",title:"选择文件",children:i.jsx("span",{className:"material-symbols-outlined",children:"folder_open"})})]}):L?i.jsxs("div",{className:"af-flow-node__password-value nodrag",onPointerDown:nn,onMouseDown:nn,onClick:nn,children:[i.jsx("input",{className:"af-flow-node__password-input nodrag",type:ce?"text":"password",value:ne,onChange:qe,onCompositionStart:Et,onCompositionEnd:vt,onBlur:Jn,placeholder:"输入密码或密钥",title:ce?ne:"密码已隐藏",autoComplete:"off",readOnly:g}),i.jsx("button",{type:"button",className:"af-flow-node__password-toggle nodrag",disabled:g,onClick:Lr,"aria-label":ce?"隐藏密码":"预览密码",title:ce?"隐藏密码":"预览密码",children:i.jsx("span",{className:"material-symbols-outlined",children:ce?"visibility_off":"visibility"})})]}):M?i.jsxs("div",{ref:re,className:"af-flow-node__prompt-stack nodrag"+(Ce?" af-flow-node__prompt-stack--composing":""),children:[i.jsx("pre",{ref:G,className:"af-flow-node__prompt-backdrop","aria-hidden":"true",dangerouslySetInnerHTML:{__html:fU(me)+`
|
|
99
|
-
`}}),i.jsx("textarea",{ref:ue,className:"af-flow-node__prompt-editor nodrag",value:me,onChange:ir,onCompositionStart:Xn,onCompositionEnd:Qn,onBlur:Zn,onPaste:es,onDrop:Or,onScroll:le=>{er(),it()},onPointerDown:nn,onMouseDown:nn,onClick:nn,onKeyDown:nn,onDragOver:le=>{bd(le).length>0&&le.preventDefault()},placeholder:O?"输入判断条件 / prompt":"输入 prompt",rows:2,readOnly:g}),!g&&i.jsx("button",{type:"button",className:"af-flow-node__prompt-expand nodrag",onPointerDown:nn,onMouseDown:nn,onClick:Cr,"aria-label":"放大编辑",title:"放大编辑",children:i.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),i.jsx("div",{ref:ee,className:"af-flow-node__prompt-scrollbar"+(Be.visible?" af-flow-node__prompt-scrollbar--visible":""),onPointerDown:Zr,"aria-hidden":"true",children:i.jsx("span",{style:{height:`${Be.height}%`,top:`${Be.top}%`}})})]}):null,M&&E.length>0?i.jsx("div",{className:"af-flow-node__image-chips",children:E.map((le,he)=>i.jsxs("span",{className:"af-flow-node__image-chip",title:le.name,children:[i.jsx("img",{src:le.dataUrl,alt:""}),i.jsxs("span",{children:["[",le.label||`image ${he+1}`,"]"]}),i.jsx("button",{type:"button",className:"af-flow-node__image-remove nodrag",disabled:g,onClick:nt=>Fn(nt,le),onPointerDown:nn,onMouseDown:nn,"aria-label":`删除 ${le.label||`image ${he+1}`}`,title:"删除图片",children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},le.id||he))}):null,W?i.jsx("span",{className:"af-flow-node__prompt-preview",title:W,children:W}):null,Q?null:i.jsx("span",{className:"af-flow-node__body-title",title:$,children:$})]}),i.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--out",children:h.map((le,he)=>{if(le.showOnNode===!1)return null;const nt=f("flow:node.outputTooltip",{name:le.name||`#${he}`,type:le.type})+(le.default!=null&&le.default!==""?f("flow:node.defaultSuffix",{value:le.default}):""),ct=le.name||`#${he+1}`;return i.jsxs("div",{className:"af-flow-node__port-row",title:nt,children:[i.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--out",children:[ct,le.required?i.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),i.jsx(Yn,{type:"source",position:Ue.Right,id:`output-${he}`,className:"af-flow-node__handle",style:{background:Pn(le.type)},title:nt})]},`out-${he}`)})})]}),yt?ur.createPortal(i.jsx("div",{className:"af-flow-node-full-editor nodrag",onPointerDown:nn,onMouseDown:nn,onClick:nn,onWheel:nn,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:$}),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:ys,"aria-label":"关闭",title:"关闭",children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),i.jsx("textarea",{ref:te,className:"af-flow-node-full-editor__textarea",value:me,onChange:ir,onCompositionStart:Xn,onCompositionEnd:Qn,onPaste:es,onDrop:Or,onKeyDown:Ts,onDragOver:le=>{bd(le).length>0&&le.preventDefault()},placeholder:O?"输入判断条件 / prompt":"输入 prompt",readOnly:g})]})}),document.body):null]})}const kc="flowNode";function db(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 mU={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 gU(e,t,n){const r=String((n==null?void 0:n.displayName)||"").trim(),s=String(t||"").trim();return!r||!s||r===s?s:(mU[e]||[]).includes(s)?r:s}const yU={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"])},wU={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"])},xU={agent_subAgent:new Set(["knowledgeContext","skillsContext"])},bU=new Set(["display_markdown","display_mermaid","display_ascii","display_html","display_react_app","display_image","display_chart","display_table"]);function kU(e,t){if(!bU.has(String(e||"")))return!1;const n=String((t==null?void 0:t.name)||"");return n==="content"||n==="src"}function vU(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function SU(e,t){const n=String((e==null?void 0:e.baseDefinitionId)||"").trim();return n||t}function CT(e){const t=String(e??"");return/^[A-Za-z0-9_@%+=:,./-]+$/.test(t)?t:"'"+t.replace(/'/g,"'\\''")+"'"}function jU(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 NU(e){const t=String(e??"").trim();return t?t.includes("${")?t:CT(t):""}function CU(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(NU).filter(Boolean):[];return[jU(t,n),CT(s),...o].join(" ")}return String(t.command||"").trim()}function cC(e,t,n){return!Array.isArray(t)||!Array.isArray(n)||n.length===0?t:t.map((r,s)=>{var u,d,f;const o=n[s],l=n.find(p=>(p==null?void 0:p.name)&&p.name===r.name)||o;if(!l)return r;const c=r.showOnNode===!1&&l.showOnNode==null&&((u=yU[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&&kU(e,r)?{showOnNode:!0}:{},...(d=xU[e])!=null&&d.has(r.name)?{showOnNode:!0}:{},...(f=wU[e])!=null&&f.has(r.name)?{showOnNode:!1}:{}}})}function _U(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=db(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 fb(e,t,n,r,s){var $,W,E,Q,V,B,re,ue,G,ee,te,ne,Z,ce,de,me,$e,Ce,_e,Be,at,yt;const o=(($=e.data)==null?void 0:$.definitionId)||String(e.id).replace(/-\d+$/,""),a=n.find(Te=>Te.id===o),l=t[e.id];let c=[],u=[],d=((W=e.data)==null?void 0:W.label)??e.id,f,p,h,y,v;const w=!!l;l&&(Array.isArray(l.input)&&(c=l.input.map(db)),Array.isArray(l.output)&&(u=l.output.map(db)),l.label&&(d=String(l.label)),l.role&&typeof l.role=="string"&&(f=l.role),l.model!=null&&(p=String(l.model).trim()),l.body!=null&&(h=String(l.body)),Array.isArray(l.images)&&(y=l.images),l.script!=null&&(v=String(l.script)));const g=f??(typeof((E=e.data)==null?void 0:E.role)=="string"?e.data.role:"普通"),k=p??((Q=e.data)==null?void 0:Q.model)??void 0,b=(a==null?void 0:a.description)!=null?String(a.description).trim():"",j=b!==""?b:void 0,N=h??((V=e.data)==null?void 0:V.body)??"",C=Array.isArray(y)?y:Array.isArray((B=e.data)==null?void 0:B.images)?e.data.images:[],I=CU(a),R=v!==void 0?v:((re=e.data)==null?void 0:re.script)!=null?String(e.data.script):I,H=String(e.id),A=(ue=r==null?void 0:r[s])==null?void 0:ue[H],L=(G=A==null?void 0:A.label)==null?void 0:G.label,D=A==null?void 0:A.body,O=A==null?void 0:A.description;w||(c.length===0&&((ee=a==null?void 0:a.inputs)!=null&&ee.length)&&(c=a.inputs.map(Te=>({...Te}))),u.length===0&&((te=a==null?void 0:a.outputs)!=null&&te.length)&&(u=a.outputs.map(Te=>({...Te}))));const M=SU(a,(a==null?void 0:a.id)??o),K=(l==null?void 0:l.marketplaceRef)||((ne=e.data)==null?void 0:ne.marketplaceRef)||vU(a);if(M==="agent_subAgent"&&!u.some(Te=>(Te==null?void 0:Te.name)==="result")){const Te=(Z=a==null?void 0:a.outputs)==null?void 0:Z.find(it=>(it==null?void 0:it.name)==="result");u=[...u,Te?{...Te}:{type:"text",name:"result",default:""}]}if(M==="agent_subAgent"&&!c.some(Te=>(Te==null?void 0:Te.name)==="knowledgeContext")){const Te=(ce=a==null?void 0:a.inputs)==null?void 0:ce.find(it=>(it==null?void 0:it.name)==="knowledgeContext");c=[...c,Te?{...Te}:{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(Te=>(Te==null?void 0:Te.name)==="next")){const Te=(de=a==null?void 0:a.outputs)==null?void 0:de.find(it=>(it==null?void 0:it.name)==="next");u=[...u,Te?{...Te}:{type:"node",name:"next",default:""}]}if(M==="workspace_run"){if(!c.some(Te=>(Te==null?void 0:Te.name)==="prev")){const Te=(me=a==null?void 0:a.inputs)==null?void 0:me.find(it=>(it==null?void 0:it.name)==="prev");c=[Te?{...Te}:{type:"node",name:"prev",default:""},...c]}if(!u.some(Te=>(Te==null?void 0:Te.name)==="next")){const Te=($e=a==null?void 0:a.outputs)==null?void 0:$e.find(it=>(it==null?void 0:it.name)==="next");u=[...u,Te?{...Te}:{type:"node",name:"next",default:""}]}}c=cC(M,c,a==null?void 0:a.inputs),u=cC(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((Te,it)=>it===0?{...Te,default:N,value:N}:Te));const z=gU(M,d,a),F=M==="tool_nodejs"||String(R).trim()!=="";return{...e,type:"flowNode",data:{...e.data,label:L||d,displayLabel:z,definitionDisplayName:a==null?void 0:a.displayName,definitionId:M,...K?{marketplaceRef:K}:{},...l!=null&&l.marketplacePackageId||(Ce=e.data)!=null&&Ce.marketplacePackageId||a!=null&&a.packageId?{marketplacePackageId:(l==null?void 0:l.marketplacePackageId)||((_e=e.data)==null?void 0:_e.marketplacePackageId)||(a==null?void 0:a.packageId)}:{},...l!=null&&l.marketplaceVersion||(Be=e.data)!=null&&Be.marketplaceVersion||a!=null&&a.version?{marketplaceVersion:(l==null?void 0:l.marketplaceVersion)||((at=e.data)==null?void 0:at.marketplaceVersion)||(a==null?void 0:a.version)}:{},schemaType:((yt=e.data)==null?void 0:yt.schemaType)??e.type??"agent",role:g,model:k,body:D||N,images:C,script:R,inputs:c,outputs:u,description:O||j,originalLabel:d,originalBody:N,...F?{script:R}:{}}}}function EU(e,t){const n=new Map(t.map(r=>[r.id,r]));return e.filter(r=>{var d,f,p,h;const s=n.get(r.source),o=n.get(r.target),a=((f=(d=s==null?void 0:s.data)==null?void 0:d.outputs)==null?void 0:f.length)??0,l=((h=(p=o==null?void 0:o.data)==null?void 0:p.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 uC(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 dC(e,t){return!Array.isArray(e)||!e[t]||e[t].showOnNode===!0?e:e.map((n,r)=>r===t?{...n,showOnNode:!0}:n)}function cw(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=uC(t==null?void 0:t.sourceHandle,"output"),o=uC(t==null?void 0:t.targetHandle,"input");let a=!1;const l=(e||[]).map(c=>{var u,d,f,p;if(c.id===n){const h=dC((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=dC((f=c.data)==null?void 0:f.inputs,o);if(h!==((p=c.data)==null?void 0:p.inputs))return a=!0,{...c,data:{...c.data,inputs:h}}}return c});return a?l:e}function AU(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 fC(e){return e.key==="?"||e.key==="/"&&e.shiftKey}function PU(){return typeof navigator>"u"?!1:/Mac|iPhone|iPod|iPad/i.test(navigator.platform||navigator.userAgent||"")}function IU({children:e}){return i.jsx("kbd",{className:"af-kbd",children:e})}function qs({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(IU,{children:t})]},n))})}function RU({open:e,onClose:t}){const{t:n}=$r(),r=m.useRef(null);if(m.useEffect(()=>{if(!e)return;const a=requestAnimationFrame(()=>{var l;return(l=r.current)==null?void 0:l.focus()});return()=>cancelAnimationFrame(a)},[e]),!e)return null;const o=PU()?"⌘":"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(qs,{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(qs,{keys:["?"]})]}),i.jsxs("li",{className:"af-shortcuts-row",children:[i.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.jumpToNode")}),i.jsx(qs,{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(qs,{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(qs,{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(qs,{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(qs,{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(qs,{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(qs,{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(qs,{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(qs,{keys:[o,"Shift","Z"]})]})]})]})]})]})})}function TU(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 MU({open:e,onClose:t,onJump:n,nodes:r}){const{t:s}=$r(),[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 y=requestAnimationFrame(()=>{var v;return(v=u.current)==null?void 0:v.focus()});return()=>cancelAnimationFrame(y)},[e]);const f=m.useMemo(()=>{const y=(r||[]).map(g=>{var k,b,j;return{id:g.id,label:((k=g.data)==null?void 0:k.label)||"",definitionId:((b=g.data)==null?void 0:b.definitionId)||"",schemaType:((j=g.data)==null?void 0:j.schemaType)||""}}),v=o.trim(),w=y.map(g=>({e:g,s:TU(g,v)})).filter(g=>g.s>0);return w.sort((g,k)=>k.s-g.s||g.e.id.localeCompare(k.e.id)),w.slice(0,50).map(g=>g.e)},[r,o]);if(m.useEffect(()=>{l>=f.length&&c(0)},[f.length,l]),m.useEffect(()=>{var v;const y=(v=d.current)==null?void 0:v.querySelector(`[data-idx="${l}"]`);y&&y.scrollIntoView({block:"nearest"})},[l]),!e)return null;const p=y=>{const v=f[y];v&&(n(v.id),t())},h=y=>{if(y.key==="Escape"){y.preventDefault(),t();return}if(y.key==="ArrowDown"){y.preventDefault(),c(v=>Math.min(f.length-1,v+1));return}if(y.key==="ArrowUp"){y.preventDefault(),c(v=>Math.max(0,v-1));return}y.key==="Enter"&&(y.preventDefault(),p(l))};return i.jsx("div",{className:"af-jump-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&t()},children:i.jsxs("div",{className:"af-jump-panel",role:"dialog","aria-modal":"true","aria-label":s("flow:jumpPalette.title"),onMouseDown:y=>y.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:y=>{a(y.target.value),c(0)},onKeyDown:h,spellCheck:!1,autoComplete:"off"}),i.jsx("span",{className:"af-jump-panel__count",children:f.length})]}),f.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:f.map((y,v)=>i.jsxs("li",{"data-idx":v,role:"option","aria-selected":v===l,className:"af-jump-panel__item"+(v===l?" af-jump-panel__item--active":""),onMouseEnter:()=>c(v),onMouseDown:w=>{w.preventDefault(),p(v)},children:[i.jsx("span",{className:"af-jump-panel__id",children:y.id}),y.label&&y.label!==y.id&&i.jsx("span",{className:"af-jump-panel__label",children:y.label}),y.definitionId&&i.jsx("span",{className:"af-jump-panel__tag",children:y.definitionId})]},y.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 pC(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 $U(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 hC(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 uw(e){return String((e==null?void 0:e.nodeId)||(e==null?void 0:e.runNodeId)||"")}function mC(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 LU({flowParams:e,scheduleNodeId:t="",runNodeId:n="",lastRunId:r="",label:s="",onClose:o}){const[a,l]=m.useState([]),[c,u]=m.useState(""),[d,f]=m.useState(null),[p,h]=m.useState(!1),[y,v]=m.useState(!1),[w,g]=m.useState(""),[k,b]=m.useState(""),j=m.useCallback(async()=>{if(e!=null&&e.flowId){h(!0),g("");try{const R=new URLSearchParams;R.set("flowId",e.flowId),R.set("flowSource",e.flowSource||"user"),t?R.set("scheduleNodeId",t):n&&R.set("runNodeId",n),R.set("limit","80");const H=await fetch(`/api/workspace/run-logs?${R.toString()}`),A=await H.json().catch(()=>({}));if(!H.ok)throw new Error(A.error||"读取日志失败");const L=Array.isArray(A.runs)?A.runs:[];l(L),u(D=>{const O=L[0]||null;return O&&String(O.status||"")==="running"&&O.runId!==D?O.runId:D&&L.some(M=>M.runId===D)?D:r&&L.some(M=>M.runId===r)?r:(O==null?void 0:O.runId)||""})}catch(R){g(String(R.message||R)),l([])}finally{h(!1)}}},[e==null?void 0:e.flowId,e==null?void 0:e.flowSource,r,n,t]),N=m.useCallback(async R=>{if(!R){f(null);return}v(!0);try{const H=new URLSearchParams({flowId:(e==null?void 0:e.flowId)||"",flowSource:(e==null?void 0:e.flowSource)||"user"});e!=null&&e.archived&&H.set("archived","1");const A=await fetch(`/api/workspace/run-logs/${encodeURIComponent(R)}?${H.toString()}`),L=await A.json().catch(()=>({}));if(!A.ok)throw new Error(L.error||"读取日志详情失败");f(L)}catch(H){f({error:String(H.message||H),events:[]})}finally{v(!1)}},[e==null?void 0:e.archived,e==null?void 0:e.flowId,e==null?void 0:e.flowSource]);m.useEffect(()=>{j()},[j]),m.useEffect(()=>{N(c)},[N,c]),m.useEffect(()=>{const R=a.find(A=>A.runId===c),H=window.setInterval(()=>{j(),(!R||R.status==="running")&&c&&N(c)},2e3);return()=>window.clearInterval(H)},[N,j,a,c]);const C=m.useMemo(()=>{const R=Array.isArray(d==null?void 0:d.events)?d.events:[],H=k.trim().toLowerCase();return H?R.filter(A=>String(A.type||"").toLowerCase().includes(H)||uw(A).toLowerCase().includes(H)||hC(A).toLowerCase().includes(H)):R},[d==null?void 0:d.events,k]),I=(d==null?void 0:d.run)||a.find(R=>R.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 j(),title:"刷新日志","aria-label":"刷新日志",children:i.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]}),w?i.jsx("div",{className:"af-work-run-logs__error",children:w}):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:"最近执行"}),p?i.jsx("div",{className:"af-work-run-logs__empty",children:"Loading..."}):null,!p&&a.length===0?i.jsx("div",{className:"af-work-run-logs__empty",children:"暂无执行日志"}):null,a.map(R=>i.jsxs("button",{type:"button",className:"af-work-run-logs__run"+(R.runId===c?" af-work-run-logs__run--active":""),onClick:()=>u(R.runId),title:R.runId,children:[i.jsx("span",{className:`af-work-run-logs__status af-work-run-logs__status--${mC(R.status)}`,children:R.status||"unknown"}),i.jsx("span",{className:"af-work-run-logs__run-label",children:R.label||R.runNodeId||R.scheduleNodeId||"Workspace Run"}),i.jsx("span",{children:pC(R.startedAt)}),i.jsx("span",{children:$U(R.durationMs)})]},R.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:"详情"}),I!=null&&I.label?i.jsx("div",{className:"af-work-run-logs__detail-label",children:I.label}):null,i.jsx("div",{className:"af-work-run-logs__run-id",children:(I==null?void 0:I.runId)||"-"})]}),I?i.jsx("span",{className:`af-work-run-logs__status af-work-run-logs__status--${mC(I.status)}`,children:I.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:k,onChange:R=>b(R.target.value),placeholder:"搜索事件、节点、错误"})]}),y?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,!y&&!C.length?i.jsx("div",{className:"af-work-run-logs__empty",children:"暂无事件"}):null,i.jsx("div",{className:"af-work-run-logs__events",children:C.map((R,H)=>i.jsxs("div",{className:"af-work-run-logs__event",children:[i.jsx("span",{className:"af-work-run-logs__event-time",children:pC(R.ts)}),i.jsx("span",{className:"af-work-run-logs__event-type",children:R.type||"event"}),uw(R)?i.jsx("span",{className:"af-work-run-logs__event-node",children:uw(R)}):null,i.jsx("pre",{children:hC(R)})]},`${R.ts||H}-${H}`))})]})]})]})}function OU(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 _T(e){const t=OU(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 DU(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 FU(e){return String(e).replace(/<\/script/gi,"<\\/script")}function hg(e){const t=_T(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 yv(e,t=""){const n=_T(e),r=n.files||{},s=r[n.entry]!=null?n.entry:Object.keys(r).find(p=>/(?:^|\/)App\.[jt]sx$/i.test(p))||Object.keys(r).find(p=>/\.[jt]sx?$/i.test(p))||n.entry,o=DU(r[s]||""),a=Object.entries(r).filter(([p])=>/\.css$/i.test(p)).map(([,p])=>String(p||"")).join(`
|
|
101
|
-
|
|
102
|
-
`),l=String(n.title||"React App"),c=JSON.stringify(String(t||"")),u=JSON.stringify(n.inputs||{}),d=FU(o||"function App() { return <main><h1>React App</h1><p>No entry file content.</p></main>; }"),f=a||`
|
|
103
|
-
* { box-sizing: border-box; }
|
|
104
|
-
body { margin: 0; min-height: 100vh; background: #111112; color: #f4f0ff; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
|
|
105
|
-
main { min-height: 100vh; padding: 24px; }
|
|
106
|
-
button, input, select, textarea { font: inherit; }
|
|
107
|
-
`;return`<!doctype html>
|
|
108
|
-
<html>
|
|
109
|
-
<head>
|
|
110
|
-
<meta charset="utf-8" />
|
|
111
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
112
|
-
<base target="_blank" />
|
|
113
|
-
<title>${l.replace(/[<&>]/g,p=>({"<":"<",">":">","&":"&"})[p])}</title>
|
|
114
|
-
<style>${f.replace(/<\/style/gi,"<\\/style")}</style>
|
|
115
|
-
</head>
|
|
116
|
-
<body>
|
|
117
|
-
<div id="root"></div>
|
|
118
|
-
<script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"><\/script>
|
|
119
|
-
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"><\/script>
|
|
120
|
-
<script crossorigin src="https://unpkg.com/@babel/standalone/babel.min.js"><\/script>
|
|
121
|
-
<script>
|
|
122
|
-
window.AGENTFLOW_INPUTS = ${u};
|
|
123
|
-
window.addEventListener("error", (event) => {
|
|
124
|
-
const root = document.getElementById("root");
|
|
125
|
-
if (root && !root.__agentflowRendered) {
|
|
126
|
-
root.innerHTML = '<pre style="margin:16px;padding:16px;border:1px solid rgba(255,117,117,.35);border-radius:8px;background:rgba(127,29,29,.18);color:#ffb8b8;white-space:pre-wrap;">' + String(event.message || event.error || 'React app failed').replace(/[<>&]/g, (ch) => ({'<':'<','>':'>','&':'&'}[ch])) + '</pre>';
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
document.addEventListener("click", (event) => {
|
|
130
|
-
const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
|
|
131
|
-
if (!link) return;
|
|
132
|
-
const rawHref = String(link.getAttribute("href") || "").trim();
|
|
133
|
-
if (!rawHref || rawHref.startsWith("#")) return;
|
|
134
|
-
if (/^javascript:/i.test(rawHref)) {
|
|
135
|
-
event.preventDefault();
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
event.preventDefault();
|
|
139
|
-
window.open(link.href, "_blank", "noopener,noreferrer");
|
|
140
|
-
}, true);
|
|
141
|
-
<\/script>
|
|
142
|
-
<script type="text/babel">
|
|
143
|
-
const { useCallback, useEffect, useMemo, useRef, useState } = React;
|
|
144
|
-
${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 ET=new Set(["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"]),zU=["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"];function BU(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 HU(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 gC(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 AT(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(ET.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 PT(e){return{inputNames:gC(e==null?void 0:e.inputs),outputNames:gC(e==null?void 0:e.outputs)}}function WU(e,t,n){const r=PT(t),s=HU(e),o=[];for(const a of s)if(!AT(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 VU(e,t){const n=PT(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=AT(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 KU(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function qU(e){return e.map(t=>{const n=KU(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 UU(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 zU)ET.has(r)&&n.push({section:"runtime",insert:r,label:r,subtitle:t("flow:placeholder.runtimeConst")});return n}function YU(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 GU(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 Dp({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}=$r(),f=m.useId(),p=m.useRef(null),h=m.useRef(null),[y,v]=m.useState(0),[w,g]=m.useState(0),[k,b]=m.useState(null),j=m.useMemo(()=>yo(c),[c]),N=m.useMemo(()=>WU(e,a,d),[e,a,d]),C=N.length>0,I=m.useMemo(()=>VU(e,a),[e,a]),R=m.useMemo(()=>qU(I),[I]),H=m.useMemo(()=>n?null:BU(e,y),[e,y,n]),A=m.useMemo(()=>{if(!H)return[];const z=UU(a,d);return YU(z,H.query)},[H,a,d]);m.useEffect(()=>{g(z=>{const F=Math.max(0,A.length-1);return Math.min(Math.max(0,z),F)})},[A.length]);const L=m.useCallback(()=>{const z=p.current;if(!z||!H||A.length===0){b(null);return}const F=GU(z,y);if(!F){b(null);return}const $=4,W=44,E=13.5*16,Q=Math.min(A.length*W+8,E);let V=F.bottom+$;V+Q>window.innerHeight-8&&(V=Math.max(8,F.top-Q-$));const B=288;let re=F.left;re=Math.max(8,Math.min(re,window.innerWidth-B-8)),b({top:V,left:re})},[H,A.length,y]);m.useLayoutEffect(()=>{if(!H||A.length===0){b(null);return}const z=requestAnimationFrame(()=>L());return()=>cancelAnimationFrame(z)},[H,A.length,y,e,L]),m.useEffect(()=>{if(!H||A.length===0)return;const z=()=>L();return window.addEventListener("scroll",z,!0),window.addEventListener("resize",z),()=>{window.removeEventListener("scroll",z,!0),window.removeEventListener("resize",z)}},[H,A.length,L]);const D=m.useCallback(z=>{if(!H)return;const{atIndex:F}=H,$=e.slice(0,F)+"${"+z+"}"+e.slice(y);t($);const W=F+z.length+3;queueMicrotask(()=>{const E=p.current;E&&(E.focus(),E.setSelectionRange(W,W)),v(W)})},[H,e,y,t]),O=m.useCallback(()=>{const z=p.current,F=h.current;!z||!F||(F.scrollTop=z.scrollTop,F.scrollLeft=z.scrollLeft,H&&A.length>0&&queueMicrotask(()=>L()))},[H,A.length,L]),M=m.useCallback(z=>{if(!n&&H&&A.length>0&&(z.key==="ArrowDown"||z.key==="ArrowUp"||z.key==="Enter")){if(z.key==="ArrowDown")z.preventDefault(),g(F=>(F+1)%A.length);else if(z.key==="ArrowUp")z.preventDefault(),g(F=>(F-1+A.length)%A.length);else if(z.key==="Enter"&&!z.shiftKey){z.preventDefault();const F=A[w];F&&D(F.insert)}}},[n,H,A,w,D]),K=m.useCallback(async z=>{if(n||typeof u!="function")return!1;const F=await NT({files:z,body:e,images:j});return F?(t(F.body),u(F.images),queueMicrotask(()=>{const $=p.current;if(!$)return;$.focus();const W=F.body.length;$.setSelectionRange(W,W),v(W)}),!0):!1},[n,j,t,u,e]);return i.jsxs("div",{className:"af-body-prompt-editor"+(l==="expand"?" af-body-prompt-editor--expand":""),children:[j.length>0?i.jsx("div",{className:"af-body-image-list","aria-label":"image attachments",children:j.map((z,F)=>i.jsxs("span",{className:"af-body-image-chip",title:z.name,children:[i.jsx("img",{src:z.dataUrl,alt:""}),i.jsxs("span",{children:["[",z.label||`image ${F+1}`,"]"]})]},z.id||F))}):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:R+`
|
|
182
|
-
`}}),i.jsx("textarea",{ref:p,className:"af-body-prompt-textarea "+o,rows:s,value:e,disabled:n,placeholder:r,spellCheck:!1,"aria-invalid":C,"aria-describedby":C?f:void 0,onChange:z=>{t(z.target.value),v(z.target.selectionStart??z.target.value.length)},onSelect:z=>{const F=z.target;F instanceof HTMLTextAreaElement&&v(F.selectionStart??0)},onClick:z=>{const F=z.target;F instanceof HTMLTextAreaElement&&v(F.selectionStart??0)},onKeyUp:z=>{const F=z.target;F instanceof HTMLTextAreaElement&&v(F.selectionStart??F.value.length)},onKeyDown:M,onPaste:z=>{const F=jT(z);F.length!==0&&(z.preventDefault(),K(F).catch(()=>{}))},onDragOver:z=>{bd(z).length>0&&z.preventDefault()},onDrop:z=>{const F=bd(z);F.length!==0&&(z.preventDefault(),K(F).catch(()=>{}))},onScroll:O})]}),H&&A.length>0&&k?ur.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:k.top,left:k.left,right:"auto",bottom:"auto",margin:0,zIndex:2e4},children:A.map((z,F)=>i.jsx("li",{role:"option","aria-selected":F===w,children:i.jsxs("button",{type:"button",className:"af-composer-mention-item"+(F===w?" af-composer-mention-item--active":""),onMouseDown:$=>$.preventDefault(),onMouseEnter:()=>g(F),onClick:()=>D(z.insert),children:[i.jsx("span",{className:"af-composer-mention-id",children:`\${${z.insert}}`}),z.subtitle?i.jsx("span",{className:"af-composer-mention-sub",children:z.subtitle}):null]})},`${z.section}-${z.insert}`))}),document.body):null,C?i.jsx("p",{id:f,className:"af-body-ph-issues",role:"status",children:N.map(z=>z.message).join(" · ")}):null]})}const JU=/^[a-zA-Z_][a-zA-Z0-9_-]*$/;function Du(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function yC({kind:e,label:t,slots:n,onSlotsChange:r,disabled:s,requiredReadonly:o=!0}){const{t:a}=$r(),l=()=>r([...n,{type:"text",name:"",default:"",required:!1,showOnNode:!1}]),c=f=>r(n.filter((p,h)=>h!==f)),u=(f,p,h)=>{const y=n.map((v,w)=>{if(w!==f)return v;const g={...v,[p]:h};return p==="required"&&h===!0&&(g.showOnNode=!0),g});r(y)},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((f,p)=>i.jsxs("div",{className:"af-node-props-io-row",children:[i.jsxs("span",{className:"af-node-props-io-handle",title:`${d}-${p}`,children:[d,"-",p]}),i.jsx("select",{className:"af-node-props-input af-node-props-io-cell",value:f.type,onChange:h=>u(p,"type",h.target.value),disabled:s,"aria-label":a("flow:nodeProps.pinTypeAriaLabel",{label:t,index:p}),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:f.name,onChange:h=>u(p,"name",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinNameAriaLabel",{label:t,index:p})}),i.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:f.default,onChange:h=>u(p,"default",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinDefaultAriaLabel",{label:t,index:p})}),i.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:f.description||"",onChange:h=>u(p,"description",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinDescriptionAriaLabel",{label:t,index:p})}),i.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.requiredHint"),children:i.jsx("input",{type:"checkbox",checked:!!f.required,onChange:h=>{o||u(p,"required",h.target.checked)},disabled:s||o,"aria-label":a("flow:nodeProps.pinRequiredAriaLabel",{label:t,index:p})})}),i.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.showOnNodeHint"),children:i.jsx("input",{type:"checkbox",checked:f.showOnNode!==!1,onChange:h=>u(p,"showOnNode",h.target.checked),disabled:s,"aria-label":a("flow:nodeProps.pinShowOnNodeAriaLabel",{label:t,index:p})})}),i.jsx("button",{type:"button",className:"af-icon-btn af-node-props-io-remove",onClick:()=>c(p),disabled:s,"aria-label":a("flow:nodeProps.deletePinAriaLabel",{label:t,index:p}),title:a("flow:nodeProps.deletePin"),children:i.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},`${d}-${p}`))]}):null]})}function XU({draft:e,setDraft:t,definitionId:n,systemPromptReadonly:r,modelLists:s,disabled:o,onIdBlur:a,onClose:l,onPublishToMarketplace:c,allowEditRequiredPins:u=!1,error:d,ioSlots:f}){const{t:p}=$r(),[h,y]=m.useState(!1),[v,w]=m.useState(!1),[g,k]=m.useState({status:"idle",message:""}),b=m.useCallback(O=>{t(M=>M&&{...M,...O})},[t]),{cursorList:j,opencodeList:N,claudeCodeList:C,codexList:I,currentNotInLists:R}=m.useMemo(()=>{const O=Array.isArray(s==null?void 0:s.cursor)?s.cursor:[],M=Array.isArray(s==null?void 0:s.opencode)?s.opencode:[],K=Array.isArray(s==null?void 0:s.claudeCode)?s.claudeCode:[],z=Array.isArray(s==null?void 0:s.codex)?s.codex:[],F=new Set([...O,...M,...K,...z].map(Du)),$=((e==null?void 0:e.model)??"").trim(),W=$.startsWith("cursor:")?$.slice(7):$.startsWith("opencode:")?$.slice(9):$.startsWith("codex:")?$.slice(6):$.startsWith("claude-code:")?$.slice(12):$,E=$&&!F.has(W)?$:"";return{cursorList:O,opencodeList:M,claudeCodeList:K,codexList:z,currentNotInLists:E}},[s,e==null?void 0:e.model]);if(!e)return null;const H=String(e.script??""),A=n==="tool_nodejs"||H.trim()!=="",L=typeof c=="function"&&!o&&(e==null?void 0:e.newId),D=async()=>{if(L){k({status:"running",message:p("flow:nodeProps.publishRunning")});try{const O=await c(e,n);k({status:"success",message:O!=null&&O.definitionId?p("flow:nodeProps.publishSuccessWithId",{id:O.definitionId}):p("flow:nodeProps.publishSuccess")})}catch(O){k({status:"error",message:String((O==null?void 0:O.message)||O)})}}};return 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:p("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:D,disabled:!L||g.status==="running",title:p("flow:nodeProps.publishToMarketplaceHint"),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"inventory_2"}),g.status==="running"?p("flow:nodeProps.publishing"):p("flow:nodeProps.publishToMarketplace")]}),i.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-close-secondary",onClick:l,children:p("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,g.message?i.jsx("p",{className:`af-node-props-market-status af-node-props-market-status--${g.status}`,children:g.message}):null,i.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[i.jsx("span",{className:"af-node-props-label",children:p("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:[p("flow:nodeProps.instanceId"),i.jsx("span",{className:"af-node-props-hint",children:p("flow:node.displayNameHint")})]}),i.jsx("input",{type:"text",className:"af-node-props-input",value:e.newId,onChange:O=>b({newId:O.target.value}),onBlur:a,disabled:o,spellCheck:!1,autoComplete:"off","aria-label":p("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:[p("flow:node.displayName"),"(LABEL)"]}),i.jsx("input",{type:"text",className:"af-node-props-input",value:e.label,onChange:O=>b({label:O.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:[p("flow:node.role"),"(ROLE)"]}),i.jsx("select",{className:"af-node-props-select",value:Xd.includes(e.role)?e.role:p("flow:roles.normal"),onChange:O=>b({role:O.target.value}),disabled:o,children:Xd.map(O=>i.jsx("option",{value:O,children:O},O))})]}),i.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[i.jsxs("span",{className:"af-node-props-label",children:[p("flow:node.model"),"(MODEL)"]}),i.jsx("span",{className:"af-node-props-sublabel",children:p("flow:node.modelHint")}),i.jsxs("select",{className:"af-node-props-select",value:(()=>{const O=(e.model||"").trim();return O?R||O:""})(),onChange:O=>b({model:O.target.value}),disabled:o,"aria-label":p("flow:nodeProps.modelAriaLabel"),children:[i.jsx("option",{value:"",children:p("flow:node.defaultModel")}),R?i.jsxs("option",{value:R,children:[R,p("flow:nodeProps.yamlValueNotInList")]}):null,j.length>0?i.jsx("optgroup",{label:"Cursor",children:j.map(O=>i.jsx("option",{value:Du(O),children:O},`c-${O}`))}):null,N.length>0?i.jsx("optgroup",{label:"OpenCode",children:N.map(O=>i.jsx("option",{value:`opencode:${Du(O)}`,children:O},`o-${O}`))}):null,I.length>0?i.jsx("optgroup",{label:"Codex",children:I.map(O=>i.jsx("option",{value:`codex:${Du(O)}`,children:O},`codex-${O}`))}):null,C.length>0?i.jsx("optgroup",{label:"Claude Code",children:C.map(O=>i.jsx("option",{value:`claude-code:${Du(O)}`,children:O},`cc-${O}`))}):null]})]}),i.jsx(yC,{kind:"input",label:p("flow:nodeProps.inputPins"),slots:Array.isArray(e.inputs)?e.inputs:[],onSlotsChange:O=>b({inputs:O}),disabled:o,requiredReadonly:!u}),i.jsx(yC,{kind:"output",label:p("flow:nodeProps.outputPins"),slots:Array.isArray(e.outputs)?e.outputs:[],onSlotsChange:O=>b({outputs:O}),disabled:o,requiredReadonly:!u}),A?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:[p("flow:node.directCommand"),"(script)",i.jsx("span",{className:"af-node-props-hint",children:p("flow:node.scriptHint")})]}),i.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>w(!0),"aria-label":p("flow:nodeProps.expandEditScript"),title:p("flow:nodeProps.expand"),disabled:o,children:i.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),i.jsx(Dp,{value:H,onChange:O=>b({script:O}),disabled:o,placeholder:p("flow:nodeProps.scriptPlaceholder"),rows:6,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea af-node-props-script-textarea",ioSlots:f,variant:"drawer"})]}):null,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:O=>b({scriptRef:O.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:O=>b({implementationRef:O.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:O=>b({implementationMode:O.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:p("flow:node.userPrompt")}),i.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>y(!0),"aria-label":p("flow:nodeProps.expandEdit"),title:p("flow:nodeProps.expand"),disabled:o,children:i.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),i.jsx(Dp,{value:e.body,onChange:O=>b({body:O}),images:e.images,onImagesChange:O=>b({images:O}),disabled:o,placeholder:p("flow:nodeProps.bodyPlaceholder"),rows:8,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea",ioSlots:f,variant:"drawer"})]}),i.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[i.jsx("span",{className:"af-node-props-label",children:p("flow:node.systemDescription")}),i.jsx("textarea",{className:"af-pipeline-drawer-textarea af-node-props-system-readonly",rows:4,readOnly:!0,value:r||p("flow:nodeProps.noDescription"),spellCheck:!1})]})]}),v?i.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":p("flow:nodeProps.editScript"),onMouseDown:O=>{O.target===O.currentTarget&&w(!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:p("flow:node.directCommand")}),i.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>w(!1),"aria-label":p("flow:nodeProps.collapse"),children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),i.jsx(Dp,{value:H,onChange:O=>b({script:O}),disabled:o,placeholder:p("flow:nodeProps.scriptPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:f,variant:"expand"})]})}):null,h?i.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":p("flow:nodeProps.editUserPrompt"),onMouseDown:O=>{O.target===O.currentTarget&&y(!1)},children: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:p("flow:node.body")}),i.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>y(!1),"aria-label":p("flow:nodeProps.collapse"),children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),i.jsx(Dp,{value:e.body,onChange:O=>b({body:O}),images:e.images,onImagesChange:O=>b({images:O}),disabled:o,placeholder:p("flow:nodeProps.bodyPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:f,variant:"expand"})]})}):null]})}function QU({open:e,onClose:t,flowId:n,flowSource:r,onArchived:s}){const{t:o}=$r(),a=m.useId(),l=m.useRef(null),[c,u]=m.useState(""),[d,f]=m.useState(!1),[p,h]=m.useState("");if(m.useEffect(()=>{if(!e)return;u(""),h(""),f(!1);const g=requestAnimationFrame(()=>{var k;return(k=l.current)==null?void 0:k.focus()});return()=>cancelAnimationFrame(g)},[e,n]),!e)return null;const y=c.trim(),v=y===n;async function w(g){if(g.preventDefault(),!(!v||d)){f(!0),h("");try{const k=await fetch("/api/flow/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:y})}),b=await k.json().catch(()=>({}));if(!k.ok){h(typeof b.error=="string"?b.error:o("project:archiveModal.archiveFailed"));return}s()}catch(k){h(String((k==null?void 0:k.message)||k))}finally{f(!1)}}}return i.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:g=>{g.target===g.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:g=>g.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:w,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:g=>u(g.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":y.length>0&&!v})]}),p?i.jsx("p",{className:"af-err af-new-pipeline-err",children:p}):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:!v||d,children:o(d?"project:archiveModal.archiving":"project:archiveModal.confirmArchive")})]})]})]})})}function ZU({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,workspaceId:o="",leaveShared:a=!1,onDeleted:l}){const{t:c}=$r(),u=m.useId(),d=m.useRef(null),[f,p]=m.useState(""),[h,y]=m.useState(!1),[v,w]=m.useState("");if(m.useEffect(()=>{if(!e)return;p(""),w(""),y(!1);const j=requestAnimationFrame(()=>{var N;return(N=d.current)==null?void 0:N.focus()});return()=>cancelAnimationFrame(j)},[e,n]),!e)return null;const g=f.trim(),k=a||g===n;async function b(j){if(j.preventDefault(),!k||h)return;y(!0),w("");let N=null;try{const C=new AbortController;N=setTimeout(()=>C.abort(),15e3);const I=await fetch("/api/flow/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:a?n:g,flowArchived:s,workspaceId:o}),signal:C.signal}),R=await I.json().catch(()=>({}));if(!I.ok){w(typeof R.error=="string"?R.error:c("project:deleteModal.deleteFailed"));return}try{for(let H=localStorage.length-1;H>=0;H--){const A=localStorage.key(H);A&&(A.startsWith(`af:composer-sessions:${n}:${r}`)||A.startsWith(`af:composer-active-session:${n}:${r}`)||A.startsWith(`af:workspace-composer:${n}:${r}`))&&localStorage.removeItem(A)}}catch{}await l()}catch(C){if((C==null?void 0:C.name)==="AbortError"){w(c("project:deleteModal.deleteTimeout"));return}w(String((C==null?void 0:C.message)||C))}finally{N&&clearTimeout(N),y(!1)}}return i.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:j=>{j.target===j.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:j=>j.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:b,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:f,onChange:j=>p(j.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":g.length>0&&!k})]}),v?i.jsx("p",{className:"af-err af-new-pipeline-err",children:v}):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:!k||h,children:h?a?"退出中...":c("project:deleteModal.deleting"):a?"确认退出":c("project:deleteModal.confirmDelete")})]})]})]})})}const wC=80,eY=220;function tY(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 nY(e){if(!e||typeof e!="object")return e;const{selected:t,className:n,...r}=e;return r}function Fp(e,t,n){const r={nodes:Array.isArray(e)?e.map(tY):[],edges:Array.isArray(t)?t.map(nY):[],extra:n&&typeof n=="object"?n:{}},s=JSON.stringify(r);return{value:JSON.parse(s),signature:s}}function dw(e,t){const n=[...e,t];return n.length>wC?n.slice(n.length-wC):n}function rY({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),f=m.useRef(null),p=m.useRef(null),h=m.useRef(!1),y=m.useCallback(()=>a(N=>N+1),[]),v=m.useCallback(()=>{p.current&&(window.clearTimeout(p.current),p.current=null)},[]),w=m.useCallback(()=>{v();const N=d.current,C=f.current;return d.current=null,f.current=null,!N||!C||N.signature===C.signature?(C&&(u.current=C),!1):(l.current=dw(l.current,N),c.current=[],u.current=C,y(),!0)},[y,v]),g=m.useCallback((N=[],C=[],I={})=>{v(),l.current=[],c.current=[],d.current=null,f.current=null,u.current=Fp(N,C,I),h.current=!1,y()},[y,v]),k=m.useCallback(N=>{h.current=!0,u.current=N,d.current=null,f.current=null,v(),s==null||s(N.value),y()},[y,v,s]),b=m.useCallback(()=>{w();const N=u.current||Fp(e,t,n),C=l.current.pop();return C?(c.current=dw(c.current,N),k(C),!0):(y(),!1)},[y,t,n,w,e,k]),j=m.useCallback(()=>{w();const N=u.current||Fp(e,t,n),C=c.current.pop();return C?(l.current=dw(l.current,N),k(C),!0):(y(),!1)},[y,t,n,w,e,k]);return m.useEffect(()=>()=>v(),[v]),m.useEffect(()=>{if(!r)return;const N=Fp(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),f.current=N,v(),p.current=window.setTimeout(()=>{w()},eY))},[v,t,r,n,w,e]),{canUndo:l.current.length>0||!!d.current,canRedo:c.current.length>0,resetHistory:g,undo:b,redo:j,version:o}}function fo(e){return String(e??"").trim()}function xC(e){return e===!0?!0:["true","yes","done","waived","not_required"].includes(fo(e).toLowerCase())}function sY(e){return e===!1?!0:["false","no","not_required","waived"].includes(fo(e).toLowerCase())}function iY(e,t=""){return fo((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 IT(e){return fo((e==null?void 0:e.platform)||"all").toLowerCase()||"all"}function RT(e){return IT(e)==="all"}function oY(e,t=[]){const n=fo((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=IT(e),s=iY(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=>fo(l))).has(a)?a:""}function dm(e){const t=fo(e==null?void 0:e.label).toLowerCase(),n=fo((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 aY(e=[]){const t={issue:0,mr:1,other:2};return[...e].sort((n,r)=>t[dm(n)]-t[dm(r)])}function lY(e){const t=fo((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 cY(e,t=[]){if(RT(e))return{kind:"aggregate",label:"双端汇总",detail:"由 Android / iOS 端侧 Issue 承接"};const n=t.map(dm);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 xC(e==null?void 0:e.implementationNotRequired)||xC(e==null?void 0:e.implementation_not_required)||sY(r)?{kind:"not-required",label:lY(e)||"无需实现 MR",detail:""}:n.includes("issue")?{kind:"pending",label:"MR 尚未记录",detail:""}:{kind:"missing-issue",label:"GitLab Issue 未绑定",detail:"端侧执行项应先创建或绑定 GitLab Issue"}}function pb(e=[]){return e.reduce((t,n)=>t+1+pb(Array.isArray(n==null?void 0:n.children)?n.children:[]),0)}function fr(e){return String(e||"").trim()}function zo(e){return fr(e).toLowerCase()}function fm(e){return typeof e=="string"?zo(e):!e||typeof e!="object"||Array.isArray(e)?"":zo(e.kind||e.type||e.persistence||e.durability)}function TT(e,t="http://localhost"){const n=fr(e);if(!n)return"";try{const r=new URL(n,t);return r.origin==="null"?`${r.protocol}//${r.host}${r.pathname}`:`${r.origin}${r.pathname}`}catch{return n.split(/[?#]/)[0]}}function MT(e={}){const t=fr(e.href||e.url);if(!t)return!1;const n=zo(e.kind||e.type),r=zo(e.durability),s=zo(e.persistence),o=zo(e.truth||e.stateTruth||e.state_truth),a=zo(e.authority),l=fm(e.source)||fm(e.sourceArtifact||e.source_artifact),c=[e.label,n].map(fr).join(" "),u=[e.label,e.title,n,s,a,l,t].map(fr).join(" ");if(r==="temporary"||s==="runtime"&&l&&l!=="ai-doc"||l==="local-draft"||n==="temporary-review"||/临时\s*(markdown)?\s*(预览|review)|local[-_ ]?draft/i.test(u)||/gitlab[-_ ]?(issue|epic|mr)|merge[-_ ]?request|jenkins|tapd|实现\s*mr|修复\s*mr|提测\s*mr|集成\s*mr|安装包|二维码/i.test(c)||/tapd[-_ ]?(baseline|snapshot)|baseline[-_ ]?snapshot|tapd_snapshot|snapshot_v\d+\.md/i.test(`${c} ${t}`))return!1;const p=/ai[-_ ]?doc|方案文档|技术方案|设计文档|代码审查|code[-_ ]?review|文档预览|markdown[-_ ]?review/i.test(c),h=n==="ai-doc"||l==="ai-doc"||a==="ai-doc"||s==="ai-doc"&&p,y=o==="durable_fact"||o==="project_fact"||e.confirmed===!0;return h&&(r==="durable"||h||y)}function $T(e={}){const t=[e.label,e.kind,e.title,e.documentType].map(fr).join(" ");return/技术方案|tech(?:nical)?[-_ ]?design/i.test(t)?"tech-design":/方案文档|方案已确认|plan(?:[-_ ]?doc)?/i.test(t)?"plan":/代码审查|code[-_ ]?review/i.test(t)?"code-review":/设计文档|design[-_ ]?doc/i.test(t)?"design":"document"}function uY(e={},{issueTitle:t="",requirementTitle:n=""}={}){const r=fr(e.articleTitle||e.article_title||e.documentTitle||e.document_title||e.docTitle||e.doc_title);return r||(fr(t)?fr(t):$T(e)==="tech-design"&&fr(n)?fr(n):fr(e.title||e.label))}function dY(e={},t="http://localhost"){const n=fr(e.issueKey||e.issue_key||e.issue),r=$T(e);if(n)return`issue:${n}:${r}`;if(r==="tech-design")return"requirement:tech-design";const s=fr(e.documentPath||e.document_path||e.path);return s?`path:${s.replace(/\\/g,"/").replace(/\/+/g,"/")}`:`url:${TT(e.href||e.url,t)}`}function bC(e={}){const t=fr(e.href||e.url),n=zo(e.kind||e.type),r=fm(e.source)||fm(e.sourceArtifact||e.source_artifact),s=fr(e.label);let o=0;return e.confirmed===!0&&(o+=100),r==="ai-doc"&&(o+=80),n==="ai-doc"&&(o+=70),/^https?:\/\//i.test(t)&&(o+=30),/\/api\/prd-workflow\/review\//.test(t)&&(o+=20),/预览|review/i.test(s)||(o+=10),o}function fY(e,t){const n=bC(t)>bC(e)?t:e,r=n===t?e:t;return{...r,...n,title:kC(e.title)>=kC(t.title)?e.title:t.title,issueKey:e.issueKey||t.issueKey,platform:e.platform||t.platform,documentPath:n.documentPath||r.documentPath,source:n.source||r.source}}function kC(e){const t=fr(e);if(!t)return 0;const n=t.replace(/^Issue\s*\d+\s*/i,"").trim();return/^(方案文档预览|方案文档|技术方案|设计文档|代码审查|Markdown Review|文档预览)$/i.test(n)?10:100+Math.min(t.length,100)}function fw(e,t){const n=new Map,r=[];for(const s of e){const o=t(s);if(!o){r.push(s);continue}const a=n.get(o);if(a===void 0){n.set(o,r.length),r.push(s);continue}r[a]=fY(r[a],s)}return r}function pY(e=[],t="http://localhost"){const n=(Array.isArray(e)?e:[]).filter(o=>MT(o)),r=fw(n,o=>TT(o.href||o.url,t)),s=fw(r,o=>fr(o.documentPath||o.document_path||o.path).replace(/\\/g,"/").replace(/\/+/g,"/"));return fw(s,o=>dY(o,t))}function Rt(e){return String(e||"").trim()}function po(e){return typeof e=="string"?Rt(e).toLowerCase():!e||typeof e!="object"||Array.isArray(e)?"":Rt(e.kind||e.type||e.persistence||e.durability).toLowerCase()}function lc(e){return Rt((e==null?void 0:e.key)||(e==null?void 0:e.artifactKey)||(e==null?void 0:e.artifact_key))}function LT(e){return Rt((e==null?void 0:e.canonicalUrl)||(e==null?void 0:e.canonical_url)||(e==null?void 0:e.reviewUrl)||(e==null?void 0:e.review_url)||(e==null?void 0:e.href)||(e==null?void 0:e.url))}function OT(e){const t=Rt(e);if(!t)return"";try{const n=new URL(t,"http://agentflow.local");return`${n.origin}${n.pathname}`}catch{return t.split(/[?#]/)[0]}}function hY(e){const t=Rt(e);if(!t)return"";try{const n=new URL(t,"http://agentflow.local");return n.hash="",n.searchParams.sort(),n.href}catch{return t.split("#")[0]}}function mY(e={}){if(!e||typeof e!="object"||Array.isArray(e))return"";const t=Rt(e.issueKey||e.issue_key||e.issue),n=Rt(e.action||e.actionId||e.action_id),r=Rt(e.stageKey||e.stage_key||e.stage||e.phase||e.code||n),s=r.toLowerCase(),o=[r,n,e.code,e.type].map(a=>Rt(a).toLowerCase()).filter(Boolean);return t?/^(?:issue-plan|issue-gitlab|implementation|bugfix|integration):/.test(s)?r:o.some(a=>/^code-review(?::|$)/.test(a)||a==="code_review_completed")?`implementation:${t}`:o.some(a=>/plan_draft_local|submit-plan|plan-doc/.test(a)||["plan_mr","plan_approved","issue-plan"].includes(a))?`issue-plan:${t}`:o.some(a=>/gitlab_issue_missing|ensure-gitlab-issue/.test(a)||a==="issue-gitlab")?`issue-gitlab:${t}`:o.some(a=>["fix_mr","bugfix"].includes(a))?`bugfix:${t}`:o.some(a=>["integration_mr","integrated","integration"].includes(a))?`integration:${t}`:o.some(a=>["implementation_mr","implementation_done","implementation_merged","impl_mr","impl_done","impl_merged","runtime_marker","status","implementation"].includes(a))?`implementation:${t}`:r||n:r||n}function gY(e={}){var o,a;if(!e||typeof e!="object"||Array.isArray(e)||Rt(e.type||e.kind).toLowerCase()!=="workflow-report")return!1;const n=!!Rt(e.action||e.actionId||e.action_id||((o=e.actionModel)==null?void 0:o.key)||((a=e.action_model)==null?void 0:a.key)),r=Rt(e.artifactScope||e.artifact_scope||e.scope).toLowerCase()==="global",s=e.aggregateByStage??e.aggregate_by_stage;return!n&&(r||s===!1)}function zc(e){const t=lc(e);if(/^prd-review:/i.test(t)||Rt((e==null?void 0:e.reviewId)||(e==null?void 0:e.review_id))||/\/api\/prd-workflow\/review\//.test(LT(e)))return!0;const n=Rt((e==null?void 0:e.href)||(e==null?void 0:e.url)||(e==null?void 0:e.shortUrl)||(e==null?void 0:e.short_url)),r=Rt((e==null?void 0:e.kind)||(e==null?void 0:e.type)).toLowerCase(),s=Rt(e==null?void 0:e.durability).toLowerCase(),o=po(e==null?void 0:e.source)||po((e==null?void 0:e.sourceArtifact)||(e==null?void 0:e.source_artifact));return(r==="review"||r==="temporary-review"||s==="temporary"||s==="durable"||o==="local-draft"||o==="ai-doc")&&/\/r\/[A-Za-z0-9_-]{8,32}(?:[?#]|$)/.test(n)}function vC(e){const t=[e==null?void 0:e.label,e==null?void 0:e.kind,e==null?void 0:e.type,e==null?void 0:e.durability,po(e==null?void 0:e.source)].map(Rt).join(" ");return/方案文档/.test(t)?50:/临时/.test(t)?40:/Markdown Review/i.test(t)?20:/预览|review/i.test(t)?10:0}function SC(e){const t=[],n=lc(e);if(n&&t.push(`key:${n}`),zc(e)){const s=OT(LT(e));s&&t.push(`review:${s}`)}const r=hY((e==null?void 0:e.href)||(e==null?void 0:e.url));return r&&t.push(`url:${r}`),t.length||t.push(`link:${Rt(e==null?void 0:e.label)}
|
|
183
|
-
${r}`),t}function yY(e){const t=[],n=new Map;for(const r of e){if(!r)continue;const s=SC(r),o=s.map(h=>n.get(h)).find(h=>h!=null);if(o==null){s.forEach(h=>n.set(h,t.length)),t.push(r);continue}const a=t[o],l=vC(r)>=vC(a)?Rt(r==null?void 0:r.label)||Rt(a==null?void 0:a.label):Rt(a==null?void 0:a.label)||Rt(r==null?void 0:r.label),c=!!lc(a),u=!!lc(r),d=c&&!u?a:r,f=d===a?r:a,p=lc(d)&&!lc(f)&&Rt(d==null?void 0:d.label)||l;t[o]={...f,...d,...p?{label:p}:{}},SC(t[o]).forEach(h=>n.set(h,o))}return t}function DT(e){const t=Rt((e==null?void 0:e.kind)||(e==null?void 0:e.type)).toLowerCase(),n=Rt(e==null?void 0:e.durability).toLowerCase(),r=Rt(e==null?void 0:e.persistence).toLowerCase(),s=po(e==null?void 0:e.source)||po((e==null?void 0:e.sourceArtifact)||(e==null?void 0:e.source_artifact)),o=[e==null?void 0:e.label,t,n,r,s].map(Rt).join(" ");return t==="temporary-review"||n==="temporary"||s==="local-draft"||/临时\s*(markdown)?\s*(预览|review)|local[-_ ]?draft/i.test(o)}function wY(e){if(!zc(e)||DT(e))return!1;const t=Rt((e==null?void 0:e.kind)||(e==null?void 0:e.type)).toLowerCase(),n=Rt(e==null?void 0:e.durability).toLowerCase(),r=Rt(e==null?void 0:e.persistence).toLowerCase(),s=po(e==null?void 0:e.source)||po((e==null?void 0:e.sourceArtifact)||(e==null?void 0:e.source_artifact)),o=[e==null?void 0:e.label,t,n,r,s].map(Rt).join(" ");return t==="review"||n==="durable"||s==="ai-doc"||r==="ai-doc"||/方案文档预览|durable/i.test(o)}function xY(e){if(zc(e))return!1;const t=Rt((e==null?void 0:e.kind)||(e==null?void 0:e.type)).toLowerCase(),n=Rt(e==null?void 0:e.persistence).toLowerCase(),r=po(e==null?void 0:e.source)||po((e==null?void 0:e.sourceArtifact)||(e==null?void 0:e.source_artifact)),s=[e==null?void 0:e.label,t].map(Rt).join(" ");return t==="ai-doc"||n==="ai-doc"||r==="ai-doc"||/方案文档|技术方案/.test(s)}function bY(e={}){const t=[e.stage,e.stageKey,e.stage_key,e.action,e.id,e.title].map(Rt).join(" ");return/(?:^|[:_-])issue[-_:]?plan(?:$|[:_-])|plan[-_:]?doc|submit[-_:]?plan/i.test(t)||/方案(?:文档)?(?:已确认|预览)/.test(t)}function kY(e=[],t={}){const n=yY(Array.isArray(e)?e:[]);if(!bY(t))return n;const r=n.filter(zc);if(r.length===0)return n;const s=r.filter(wY),a=s.length>0||n.some(xY)?s.at(-1):r.filter(DT).at(-1);return n.filter(l=>!zc(l)||l===a)}function Ci(e,t){const n=[],r=new Map,s=a=>{if(typeof a=="string")return[`value:${a}`];if(!a||typeof a!="object")return[];const l=[],c=Rt(a.key||a.artifactKey||a.artifact_key);c&&l.push(`key:${c}`);const u=OT(a.canonicalUrl||a.canonical_url||a.reviewUrl||a.review_url||a.href||a.url);u&&l.push(`url:${u}`);const d=Rt(a.path);return d&&l.push(`path:${d}`),l.length||l.push(`value:${JSON.stringify(a)}`),l},o=a=>{if(!a)return;const l=s(a);if(!l.length)return;const c=l.map(u=>r.get(u)).find(u=>u!=null);if(c==null){const u=n.length;n.push(a),l.forEach(d=>r.set(d,u));return}n[c]=a,s(a).forEach(u=>r.set(u,c))};return(Array.isArray(e)?e:[]).forEach(o),(Array.isArray(t)?t:[]).forEach(o),n}function Vr(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function pm(e){return Array.isArray(e)?e.map(pm):Vr(e)?Object.fromEntries(Object.keys(e).sort().map(t=>[t,pm(e[t])])):e}function ro(e,t){return JSON.stringify(pm(e))===JSON.stringify(pm(t))}function FT(e){return Vr(e==null?void 0:e.instances)?e.instances:{}}function Zd(e){return Vr(e==null?void 0:e.ui)?e.ui:{}}function zp(e,t){if(!Vr(e))return{};const n=new Set(t);return Object.fromEntries(Object.entries(e).filter(([r])=>!n.has(r)))}function vY(e,t){if(!Vr(e)||!Vr(t)||!Vr(e.instances)||!Vr(t.instances)||!Array.isArray(e.edges)||!Array.isArray(t.edges)||!Vr(e.ui)||!Vr(t.ui)||Number(e.version||1)!==Number(t.version||1))return!1;const n=zp(e,["version","instances","edges","ui"]),r=zp(t,["version","instances","edges","ui"]);if(!ro(n,r))return!1;const s=["nodePositions","nodeSizes","groups","displayPage","viewport"];return ro(zp(e.ui,s),zp(t.ui,s))}function zT(e){const t=Array.isArray(Zd(e).groups)?Zd(e).groups:[];return new Map(t.filter(n=>n==null?void 0:n.id).map(n=>[String(n.id),n]))}function jC(e){const t=new Set(Object.keys(FT(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 zT(e).keys())t.add(n);return t}function NC(e,t){const n=FT(e),r=Zd(e),s=zT(e);return{instance:Object.prototype.hasOwnProperty.call(n,t)?n[t]:null,position:Vr(r.nodePositions)&&Object.prototype.hasOwnProperty.call(r.nodePositions,t)?r.nodePositions[t]:null,size:Vr(r.nodeSizes)&&Object.prototype.hasOwnProperty.call(r.nodeSizes,t)?r.nodeSizes[t]:null,group:s.get(t)||null}}function CC(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 SY(e,t){if(!vY(e,t))return{safe:!1,changedNodeIds:[],nodesChanged:!0,edgesChanged:!0,displayPageChanged:!0};const n=new Set([...jC(e),...jC(t)]),r=Array.from(n).filter(s=>!ro(NC(e,s),NC(t,s)));return{safe:!0,changedNodeIds:r,nodesChanged:r.length>0,edgesChanged:!ro(CC(e),CC(t)),displayPageChanged:!ro(Zd(e).displayPage||null,Zd(t).displayPage||null)}}function jY(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 _C(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 EC(e){if(!e||typeof e!="object")return e;const t={...e};return delete t.selected,t}function NY(e,t){const n=new Map((Array.isArray(e)?e:[]).map(r=>[_C(r),r]));return(Array.isArray(t)?t:[]).map(r=>{const s=n.get(_C(r));return s?ro(EC(s),EC(r))?s:{...r,selected:s.selected===!0}:r})}function CY(e,t,n){const r=Vr(e)?e:{},s=Vr(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 _Y({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 EY({savedGraph:e,sentGraph:t,savedRevision:n="",currentRevision:r=""}={}){return{graph:e||t||null,revision:String(n||r||"")}}function BT(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 AY({nodeInteraction:e=!1,pointerCount:t=0,viewportInteraction:n=!1}={}){return!!(e||n||Number(t)>0)}function PY(e=[]){const t=BT(e);return t.mutated&&!t.active}function IY(e){return!!((e==null?void 0:e.type)==="position"&&e.position&&e.dragging===!0||(e==null?void 0:e.type)==="dimensions"&&e.dimensions&&e.resizing===!0)}function RY(e){return!!((e==null?void 0:e.type)==="position"&&e.position&&e.dragging===!1||(e==null?void 0:e.type)==="dimensions"&&e.dimensions&&e.resizing===!1)}function TY(e=[]){const t=[],n=[];let r=!1;for(const s of Array.isArray(e)?e:[]){if(IY(s)){t.push(s);continue}n.push(s),RY(s)&&(r=!0)}return{transient:t,committed:n,finishesInteraction:r}}function hb(e=[]){const t=[],n=new Map;for(const r of Array.isArray(e)?e:[]){const s=String((r==null?void 0:r.id)||"").trim();if(!(s&&((r==null?void 0:r.type)==="position"||(r==null?void 0:r.type)==="dimensions"))){t.push(r);continue}const a=`${r.type}:${s}`,l=n.get(a);l==null?(n.set(a,t.length),t.push(r)):t[l]=r}return t}function MY(e=[]){return hb(e).map(t=>(t==null?void 0:t.type)==="position"&&t.position&&t.dragging===!0?{...t,dragging:!1}:(t==null?void 0:t.type)==="dimensions"&&t.dimensions&&t.resizing===!0?{...t,resizing:!1}:t)}function AC(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 $Y({background:e=!1}={}){return{graph:!0,nodes:!e,files:!e}}function LY({eventType:e="",revision:t="",currentRevision:n="",targetRevision:r="",refreshPending:s=!1}={}){return e!=="graph.committed"||!t?!1:t===n?!0:t===r&&s}const OY="af:workspace-graph:v2",PC="agentflow.workspace.sidebarCollapsed",Vl=["DISPLAY","CONTROL","TOOL","PROVIDE","AGENT"],DY=new Set(["control_start","control_end","control_load_skills","control_load_mcp","control_cd_workspace","control_user_workspace"]),FY={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:""}]},zY={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:""}]},BY={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}]},HY={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}]},WY={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}]},VY={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}]},KY=new Set(["png","jpg","jpeg","gif","webp","svg"]),HT=320,WT=180,VT=960,hm=96,KT=900,mb=520,gb=320,Bp=52,rl=240,sl=160,yb="display-ref:",ef="0 9 * * *",qY="Asia/Shanghai",UY="0.1.133";function YY(){const e=new URLSearchParams(window.location.search);return{flowId:e.get("flowId")||"",flowSource:e.get("flowSource")||"user",workspaceId:e.get("workspaceId")||"",workflowShare:e.get("workflowShare")||"",adminOwnerId:e.get("adminOwnerId")||"",archived:e.get("archived")==="1"||e.get("flowArchived")==="1"}}function Pr(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.workflowShare&&t.set("workflowShare",e.workflowShare),e.adminOwnerId&&t.set("adminOwnerId",e.adminOwnerId),e.archived&&t.set("archived","1"),t}function wv(e,t=4e3){const n=String(e??"").trim();return n?n.length>t?`${n.slice(0,t)}
|
|
184
|
-
...[truncated ${n.length-t} chars]`:n:""}function GY(e){const t=wv(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 xv(e,t=80){return(Array.isArray(e)?e:[]).map(GY).filter(Boolean).slice(-t)}function JY(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=xv(s.messages,40),l=wv(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 XY(e){return(Array.isArray(e)?e:[]).map(t=>{const n=String((t==null?void 0:t.id)||"").trim();if(!n)return null;const r=xv(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:wv((t==null?void 0:t.label)||n,120),status:s==="failed"?"failed":"done",messages:r}}).filter(Boolean).slice(-20)}function IC(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:xv(n.messages,100),runSessions:XY(n.runSessions)},nodeChats:JY(t.nodeChats)}}function mm(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 KY.has(n)}function tf(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=Pr(t||{});return s.set("path",r),n.download&&s.set("download","1"),`/api/workspace/file/raw?${s.toString()}`}function QY(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",r=String((e==null?void 0:e.adminOwnerId)||"").trim();return`af:composer-skills:workspace:${t}:${n}${r?`:admin:${r}`:""}${e!=null&&e.archived?":archived":""}`}function ZY(e){const t=String((e==null?void 0:e.username)||(e==null?void 0:e.userId)||"").trim();return t?`${PC}:${t}`:PC}function eG(e){try{const t=window.localStorage.getItem(e);if(t==="false")return!1;if(t==="true")return!0}catch{}return!0}function RC(e){return!e||typeof e.closest!="function"?!1:!!e.closest("input, textarea, select, [contenteditable='true']")}function tG(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 nG(e){return!e||typeof e.closest!="function"?!1:!!e.closest(".af-flow-node__prompt-stack")&&!tG(e)}function rG(e){const t=String(e||"").trim();if(!t||sG(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 sG(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 iG(e){const t=String(e||"").trim();return t?/^模型/.test(t)?"model":/^(执行|完成|耗时):/.test(t)?"tool":/^运行/.test(t)?"run":/^\[stderr\]/.test(t)?"error":"other":"other"}function pw(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 hw(e,t,n="Workspace Run"){const r=String(e||"").trim()||n,s=String(t||"").trim();return!s||r===s?r:`${r} (${s})`}function Ta(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 TC(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 oG(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 aG(e){const t=oG(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 qT(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 s=window.location.hostname;n.hostname=s&&s!=="0.0.0.0"&&s!=="::"?s:"127.0.0.1"}const r=String(new URLSearchParams(window.location.search).get("workflowShare")||"").trim();return r&&n.pathname.startsWith("/api/prd-workflow/review/")&&!n.searchParams.has("workflowShare")&&n.searchParams.set("workflowShare",r),n.href}catch{return t}}function vc(e){const t=String((e==null?void 0:e.url)||(e==null?void 0:e.href)||"").trim();if(t)return qT(t);const n=String((e==null?void 0:e.path)||"").trim();return n?`file://${n}`:""}function ha(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 sa(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 bv(e){return ha(e==null?void 0:e.status)==="done"&&sa(e)!=="observation"}function so(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 bh(e){return!e||typeof e!="object"?"":String(e.detail||e.description||e.summary||e.message||e.reason||"")}function kv(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 lG(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 cG(e,t){const n=so(e,t),r=ha(e==null?void 0:e.status),s=bv(e),a=`${il(e)} ${kv(e)}`,l=lG(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"||sa(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"||sa(e)==="observation")return`${l} GitLab Issue 状态已观察`}return/implementation_in_progress|impl_in_progress/.test(a)?`正在实现 ${l}`:/implementation_ready/.test(a)?`可以开始实现 ${l}`:n}function uG(e){if(!e||typeof e!="object")return"";const t=ha(e.status),n=sa(e),r=bv(e),o=`${il(e)} ${kv(e)}`,a=vv(e),l=a.some(f=>/方案|plan|markdown|review|预览/i.test(String(f.label||""))),c=a.some(f=>/gitlab issue/i.test(String(f.label||""))),u=a.some(f=>/gitlab epic/i.test(String(f.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=bh(e);return d?d.length>180&&a.length?"相关结果和产物已更新;可从下方链接查看。":d:""}function gm(e){return!e||typeof e!="object"?"":String(e.stageEnteredAt||e.stage_entered_at||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 UT="Asia/Shanghai",dG=new Intl.DateTimeFormat("zh-CN",{timeZone:UT,year:"numeric",month:"2-digit",day:"2-digit"}),fG=new Intl.DateTimeFormat("zh-CN",{timeZone:UT,hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1});function YT(e){const t=gm(e);if(!t)return null;const n=Date.parse(t);return Number.isFinite(n)?new Date(n):null}function pG(e){const t=YT(e);return t?dG.format(t).replace(/\//g,"-"):"无时间"}function hG(e){const t=YT(e);return t?fG.format(t):""}function mG(e=[]){const t=[];return(Array.isArray(e)?e:[]).forEach((n,r)=>{const s=pG(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 GT(e){const t=ha(e);return t==="done"?"完成":t==="current"?"当前":t==="observed"?"已观察":t==="superseded"?"已更新":t==="blocked"?"阻塞":"待处理"}function Da(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 gG(e){const t=ha(e==null?void 0:e.status);return sa(e)==="observation"&&t==="done"?"已观察":GT(t)}function JT(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=ha(e.status),s=sa(e)==="observation"&&r==="done"?"observed":r;return n("status",GT(s),s),n("issue",e.issueKey||e.issue_key||e.issue,e.issueKey||e.issue_key||e.issue),n("platform",Da(e.platform),e.platform),t}function yG(e=[]){const t=new Map;return(Array.isArray(e)?e:[]).forEach(n=>{JT(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 wG(e,t){const n=String(t||"all");return!n||n==="all"?!0:JT(e).some(r=>r.key===n)}function xG(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("平台",Da(e.platform)),t}function vv(e){const t=[],n=(c,u,d={})=>{const f=qT(u);f&&t.push({...d,label:String(c||f).trim()||f,href:f})},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((p,h)=>r(p,`${u} ${h+1}`,d+1));return}if(typeof c!="object")return;const f=c.label||c.title||c.name||c.kind||c.type||u;n(f,c.url||c.href||c.path||c.file||c.filePath||c.file_path,c);for(const p of["links","urls","artifacts","outputs","output","results","result","files"])c[p]!=null&&r(c[p],p,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),c);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",vc(c),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=zc(c),d=String(c.key||c.artifactKey||c.artifact_key||"").trim(),f=d?`key:${d}`:u?`review:${o(c.canonicalUrl||c.canonical_url||c.href)}`:`${c.label}
|
|
185
|
-
${c.href}`,p=l.get(f);if(!p){l.set(f,c);continue}if(u){const h=a(p.label),y=a(c.label);(y>h||y===h&&String(c.label||"").length>String(p.label||"").length)&&l.set(f,c)}}return kY(Array.from(l.values()),e)}function bG(e,t=[]){var a,l,c,u;const n=[],r=new Map,s=String(((l=(a=e==null?void 0:e.overall)==null?void 0:a.requirement)==null?void 0:l.title)||((u=(c=e==null?void 0:e.overall)==null?void 0:c.requirement)==null?void 0:u.name)||"").trim();for(const d of wb(e)){const f=Ii(d),p=String((d==null?void 0:d.title)||(d==null?void 0:d.name)||(d==null?void 0:d.summary)||"").trim();f&&p&&r.set(f,p)}const o=(d,f={})=>{if(!d||typeof d!="object")return;const p=(y,v={})=>{if(!y||typeof y!="object")return;const w=String(f.issueKey||(d==null?void 0:d.issueKey)||(d==null?void 0:d.issue_key)||(d==null?void 0:d.issue)||"").trim(),g=y.source||y.sourceArtifact||y.source_artifact||d.sourceArtifact||d.source_artifact||d.source||f.source||null,k=uY({...y,title:y.title||f.documentTitle||(d==null?void 0:d.title)||"",documentTitle:y.documentTitle||y.document_title||(d==null?void 0:d.documentTitle)||(d==null?void 0:d.document_title)||""},{issueTitle:r.get(w)||"",requirementTitle:s}),b={label:String(y.label||"ai-doc").trim()||"ai-doc",href:String(y.href||y.url||"").trim(),kind:String(y.kind||y.type||d.kind||d.type||"").trim(),title:k,issueKey:w,platform:f.platform||Da(d.platform),durability:y.durability||d.durability||f.durability||"",persistence:y.persistence||d.persistence||f.persistence||"",truth:y.truth||y.stateTruth||y.state_truth||sa(d)||f.truth||"",authority:y.authority||d.authority||f.authority||"",confirmed:y.confirmed??d.confirmed??f.confirmed,source:g,documentPath:y.documentPath||y.document_path||y.path||v.documentPath||(g==null?void 0:g.path)||(g==null?void 0:g.documentPath)||(g==null?void 0:g.document_path)||""};b.href&&n.push(b)};for(const y of Array.isArray(d==null?void 0:d.artifacts)?d.artifacts:[])!y||typeof y!="object"||p({...y,label:y.label||y.title||y.kind||"ai-doc",href:vc(y)},{documentPath:y.path});for(const y of Array.isArray(d==null?void 0:d.links)?d.links:[])!y||typeof y!="object"||p({...y,label:y.label||y.title||y.kind||"ai-doc",href:vc(y)},{documentPath:y.path});const h=vc(d);h&&p({...d,label:d.label||d.title||d.kind||"ai-doc",href:h},{documentPath:d.path})};o(e);for(const d of Array.isArray(t)?t:[])o(d,{issueKey:String((d==null?void 0:d.issueKey)||(d==null?void 0:d.issue_key)||(d==null?void 0:d.issue)||"").trim(),platform:Da(d==null?void 0:d.platform),documentTitle:String((d==null?void 0:d.documentTitle)||(d==null?void 0:d.document_title)||(d==null?void 0:d.title)||"").trim()});for(const d of["actions","workflowActions","workflow_actions","timeline","history","events","runtimeEvents","runtime_events"])for(const f of Array.isArray(e==null?void 0:e[d])?e[d]:[])o(f,{issueKey:String((f==null?void 0:f.issueKey)||(f==null?void 0:f.issue_key)||(f==null?void 0:f.issue)||"").trim(),platform:Da(f==null?void 0:f.platform),documentTitle:String((f==null?void 0:f.documentTitle)||(f==null?void 0:f.document_title)||(f==null?void 0:f.title)||"").trim()});for(const d of wb(e))o(d,{issueKey:Ii(d),platform:Da(d==null?void 0:d.platform),documentTitle:String((d==null?void 0:d.title)||(d==null?void 0:d.name)||(d==null?void 0:d.summary)||"").trim()});return pY(n,window.location.origin)}function kG(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 Ii(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 vG(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)||Ii(e,t)||`Issue ${t+1}`).trim()}function SG(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 jG(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 NG(e){const t=vv(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}
|
|
186
|
-
${o}`;return r.has(a)?!1:(r.add(a),!0)})}function CG(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(SG(a)).issues.push(a);const o=a=>{const l=new Map,c=[],u=a.map((d,f)=>Ii(d,f));return a.forEach((d,f)=>{const p=Ii(d,f);l.set(p,{issue:d,children:[]})}),a.forEach((d,f)=>{const p=Ii(d,f),h=jG(d)||oY(d,u),y=l.get(p);h&&l.has(h)?l.get(h).children.push(y):c.push(y)}),c};return Array.from(r.values()).map(a=>({...a,issues:o(a.issues)}))}function ym(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 il(e){return mY(e)}function wm(e){const t=gm(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 wb(e){var s,o,a,l,c,u,d,f,p,h,y,v;const t=[],n=w=>{w&&typeof w=="object"&&!Array.isArray(w)&&t.push(w)},r=w=>{if(!w||typeof w!="object"||Array.isArray(w))return;const g=Array.isArray(w.issues)?w.issues:Array.isArray(w.children)?w.children:Array.isArray(w.items)?w.items:[];for(const k of g)!k||typeof k!="object"||Array.isArray(k)||(k.issue&&typeof k.issue=="object"?(n(k.issue),Array.isArray(k.children)&&k.children.forEach(b=>n((b==null?void 0:b.issue)||b))):n(k))};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(w=>{Array.isArray(w)&&w.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,(f=(d=e==null?void 0:e.raw)==null?void 0:d.prd)==null?void 0:f.epics,(h=(p=e==null?void 0:e.raw)==null?void 0:p.prd)==null?void 0:h.epicGroups,(v=(y=e==null?void 0:e.raw)==null?void 0:y.prd)==null?void 0:v.epic_groups].forEach(w=>{Array.isArray(w)&&w.forEach(r)}),t}function _G(e,t){const n=String(t||"").trim();return n&&wb(e).find((r,s)=>Ii(r,s)===n)||null}function EG(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 AG(e,t){if(!t||typeof t!="object")return t;const n=String(t.issueKey||t.issue_key||t.issue||"").trim(),r=_G(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=EG(e);if(!a&&!l)return o;const c=il(o),u=`${c} ${kv(o)}`;if(!/issue-gitlab:|gitlab_issue_missing|ensure-gitlab-issue|implementation|impl_|fix_|testing|submit-test|self-test/i.test(u))return o;const f=[];a&&f.push({key:`gitlab-issue:${n}:${(s||"all").toLowerCase()}`,label:"GitLab Issue",kind:"gitlab-issue",durability:"durable",url:a}),l&&f.push({key:"gitlab-epic:requirement",label:"GitLab Epic",kind:"gitlab-epic",durability:"durable",url:l});const p=ha(o.status),h=a&&p==="done"&&/^issue-gitlab:/.test(c)&&/需要.*GitLab Issue/.test(String(o.title||o.label||""));return{...o,...h?{title:String(o.title||o.label||"GitLab Issue 已绑定").replace(/^需要为/,"已为").replace("创建或绑定","创建/绑定"),label:String(o.label||o.title||"GitLab Issue 已绑定").replace(/^需要为/,"已为").replace("创建或绑定","创建/绑定")}:{},artifacts:Ci(o.artifacts,f)}}function MC(e,t){const n=wm(t),r=wm(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:so(s,0)||so(t,0)||so(e,0),detail:bh(s)||bh(t)||bh(e),status:o,links:Ci(e==null?void 0:e.links,t==null?void 0:t.links),artifacts:Ci(e==null?void 0:e.artifacts,t==null?void 0:t.artifacts),outputs:Ci(e==null?void 0:e.outputs,t==null?void 0:t.outputs),results:Ci(e==null?void 0:e.results,t==null?void 0:t.results),events:Ci(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 PG(e,t){const n=[],r=new Map,s=new Map,o=new Map,a=f=>{var p,h;return!!(!f||typeof f!="object"||f.auxiliary===!0||f.auxiliary_event===!0||gY(f)||String(f.type||"")==="review-link"||String(f.type||"")==="action-preview"||f.preview===!0||String(f.type||"")==="same-platform-stage-conflict"&&/\/api\/prd-workflow\/review\//.test(String(((p=f.conflict)==null?void 0:p.previousArtifact)||((h=f.conflict)==null?void 0:h.incomingArtifact)||"")))},l=(f,p)=>({...f,links:Ci(f==null?void 0:f.links,p==null?void 0:p.links),artifacts:Ci(f==null?void 0:f.artifacts,p==null?void 0:p.artifacts),outputs:Ci(f==null?void 0:f.outputs,p==null?void 0:p.outputs),results:Ci(f==null?void 0:f.results,p==null?void 0:p.results)}),c=(f,p)=>{if(!f)return;const h=r.get(f);if(h!=null){n[h]=l(n[h],p);return}o.set(f,l(o.get(f)||{},p))},u=(f,p)=>f&&o.has(f)?l(p,o.get(f)):p,d=f=>{if(Array.isArray(f))for(const p of f){const h=il(p);if(a(p)){c(h,p);continue}const y=String(p.id||p.eventId||p.event_id||p.actionId||p.action_id||"").trim(),v=h||y,w=v?r.get(v)??s.get(y):null;v&&w!=null?(n[w]=u(h,MC(n[w],p)),h&&r.set(h,w),y&&s.set(y,w)):(v&&r.set(v,n.length),y&&s.set(y,n.length),n.push(u(h,p)))}};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 f=ym(t),p=il(t),h=p?r.get(p):f?s.get(f):null,y={...t,status:t.status||"next",kind:"next_action"};h!=null&&(n[h]=MC(n[h],y))}return n.map((f,p)=>({item:f,index:p,ts:wm(f)})).filter(f=>Number.isFinite(f.ts)).sort((f,p)=>p.ts-f.ts||f.index-p.index).map(f=>AG(e,f.item))}function IG(e){const t=Array.isArray(e==null?void 0:e.runtimeEvents)?e.runtimeEvents:Array.isArray(e==null?void 0:e.runtime_events)?e.runtime_events:[],n=Array.isArray(e==null?void 0:e.snapshotAudit)?e.snapshotAudit:Array.isArray(e==null?void 0:e.snapshot_audit)?e.snapshot_audit:[];return[...t,...n].filter(s=>s&&typeof s=="object").map((s,o)=>({item:s,index:o,ts:wm(s)})).sort((s,o)=>{const a=Number.isFinite(s.ts),l=Number.isFinite(o.ts);return a&&l?o.ts-s.ts||o.index-s.index:a?-1:l?1:o.index-s.index}).slice(0,8).map(s=>s.item)}function RG(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 TG(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)?`(+${Ta(r)} / 总 ${Ta(s)})`:"";return`${t+1}. ${n}${o}`}function XT(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 Kl(...e){for(const t of e){const n=Number(t);if(Number.isFinite(n))return n}return NaN}function MG(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 $G(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 LG(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 OG(e){var o,a,l;const t=XT(e);if(!t||typeof t!="object")return null;const n=String(t.type||""),r=String(t.subtype||""),s=Kl(t.timestamp_ms,t.completedAtMs,t.startedAtMs,e==null?void 0:e.ts,Date.now());if(n==="tool_call"&&r==="completed"){const c=$G(t),u=MG(t),d=Kl(t.startedAtMs,c==null?void 0:c.startedAtMs),f=Kl(t.completedAtMs,c==null?void 0:c.completedAtMs),p=((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(f)?Math.max(0,f-d):Kl(p.executionTime,p.localExecutionTimeMs),y=String(((l=c==null?void 0:c.args)==null?void 0:l.command)||p.command||"").trim(),v=y?y.split(`
|
|
187
|
-
`).find(Boolean)||y:"";return{kind:"tool",label:LG(u,c),durationMs:Number.isFinite(h)?h:null,at:s,detail:v?v.slice(0,90):""}}if(n==="result"){const c=Kl(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 $C(e,t,n,r){const s=(Array.isArray(e)?e:[]).map(w=>typeof w=="string"?{text:w}:w).filter(w=>w&&String(w.text||"").trim()),o=Array.isArray(t)?t:[],a=[...o].reverse().find(w=>(w==null?void 0:w.kind)==="total"&&Number.isFinite(Number(w.durationMs))),l=[...s].reverse().find(w=>Number.isFinite(Number(w.totalMs))),c=Number.isFinite(Number(r))&&Number.isFinite(Number(n))?Math.max(0,Number(r)-Number(n)):NaN,u=Kl(a==null?void 0:a.durationMs,l==null?void 0:l.totalMs,c),d=s.filter(w=>w.kind==="model").reduce((w,g)=>w+(Number(g.stepMs)||0),0),f=o.filter(w=>(w==null?void 0:w.kind)==="tool"),p=f.reduce((w,g)=>w+(Number(g.durationMs)||0),0),h=o.filter(w=>(w==null?void 0:w.kind)==="network").length,y=[...s.filter(w=>Number(w.stepMs)>=1e3).map(w=>({label:w.text,durationMs:Number(w.stepMs),detail:"Activity 间隔"})),...f.filter(w=>Number(w.durationMs)>=1e3).map(w=>({label:w.label,durationMs:Number(w.durationMs),detail:w.detail||"工具实际执行"}))].sort((w,g)=>g.durationMs-w.durationMs).slice(0,6),v=["耗时概览"];return Number.isFinite(u)&&v.push(`- 当前总耗时:${Ta(u)}`),d>0&&v.push(`- 模型相关间隔:约 ${Ta(d)}(按 Activity 间隔估算)`),f.length>0&&v.push(`- 工具实际执行:${Ta(p)}(${f.length} 次完成事件)`),h>0&&v.push(`- 网络/会话恢复事件:${h} 次`),y.length>0&&(v.push(""),v.push("慢步骤"),y.forEach((w,g)=>{const k=w.detail?` · ${w.detail}`:"";v.push(`${g+1}. ${w.label}:${Ta(w.durationMs)}${k}`)})),s.length>0&&(v.push(""),v.push("最近 Activity"),s.slice(-10).forEach((w,g)=>{v.push(TG(w,g))})),f.length>0&&(v.push(""),v.push("最近工具完成"),f.slice(-8).forEach((w,g)=>{const k=Number.isFinite(Number(w.durationMs))?` ${Ta(w.durationMs)}`:"",b=w.detail?` · ${w.detail}`:"";v.push(`${g+1}. ${w.label}${k}${b}`)})),v.join(`
|
|
188
|
-
`)}function LC(e){if(String((e==null?void 0:e.type)||"")!=="raw"||String((e==null?void 0:e.eventType)||"")!=="thinking")return"";const t=XT(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 QT(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 ZT(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function Sv(e){if(!e)return"";const t=String(e.baseDefinitionId||"").trim();return t||String(e.id||"").trim()}function eM(e){const t=String(e??"");return/^[A-Za-z0-9_@%+=:,./-]+$/.test(t)?t:"'"+t.replace(/'/g,"'\\''")+"'"}function DG(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 FG(e){const t=String(e??"").trim();return t?t.includes("${")?t:eM(t):""}function tM(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(FG).filter(Boolean):[];return[DG(t,n),eM(o),...a].join(" ")}return String(t.command||"").trim()}function Xu(e){const t=String(Sv(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 OC(e){return e==="DISPLAY"?"preview":e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function xm(e){return String((e==null?void 0:e.displayName)||(e==null?void 0:e.label)||(e==null?void 0:e.id)||"Node")}function Qu(e){return xm(e)}function xb(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function Hp(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 DC(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 FC(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 mw(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=ub(s.get(n),e.sourceHandle||"output-0","source"),a=ub(s.get(r),e.targetHandle||"input-0","target");return!!(o&&a&&Qd(o,a))}function zG(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=ub(o,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:nU(a)}:null}function BG(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"?Qd(t.slot,a):Qd(a,t.slot)))continue;const c=Xu(n);return{def:n,order:r,category:c,categoryRank:Vl.indexOf(c),slot:a,slotIndex:o,displayLabel:Qu(n),description:xb(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 HG(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 f=0;f<d.length;f+=1){const p=d[f];if((p==null?void 0:p.showOnNode)===!1||!(s?Qd(n.slot,p):Qd(p,n.slot)))continue;const y=s?{source:n.nodeId,sourceHandle:n.handleId,target:u.id,targetHandle:`input-${f}`}:{source:u.id,sourceHandle:`output-${f}`,target:n.nodeId,targetHandle:n.handleId},v=(t||[]).some(w=>w.target===y.target&&w.targetHandle===y.targetHandle);r.push({node:u,nodeId:u.id,nodeLabel:((l=u.data)==null?void 0:l.label)||u.id,definitionId:((c=u.data)==null?void 0:c.definitionId)||"",slot:p,slotIndex:f,handleId:s?y.targetHandle:y.sourceHandle,connection:y,occupied:v})}}return r.sort((u,d)=>{var v,w,g,k,b,j,N,C;const f=Number(((w=(v=u.node)==null?void 0:v.position)==null?void 0:w.y)||0),p=Number(((k=(g=d.node)==null?void 0:g.position)==null?void 0:k.y)||0),h=Number(((j=(b=u.node)==null?void 0:b.position)==null?void 0:j.x)||0),y=Number(((C=(N=d.node)==null?void 0:N.position)==null?void 0:C.x)||0);return f-p||h-y||u.slotIndex-d.slotIndex||String(u.nodeId).localeCompare(String(d.nodeId))})}function cc(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 WG(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 VG(e){return(e==null?void 0:e.default)!=null?String(e.default):(e==null?void 0:e.value)!=null?String(e.value):""}function KG(e){const t=Number(e);if(!Number.isFinite(t)||t<=0)return ef;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} * * *`:ef}function Wo(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 jv(e){const t=String(e||"").trim().match(/^(\d{1,2}):(\d{1,2})$/);return t?`${Wo(t[1],9,0,23)}:${Wo(t[2],0,0,59)}`:"09:00"}function Zu(e,t,n,r,s){const o=jv(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()||ef:`${l} ${a} * * *`}function qG(e){const n=String(e||ef).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),f=d?`${Wo(u,9,0,23)}:${Wo(c,0,0,59)}`:"09:00";return d&&o==="*"&&a==="*"&&l==="*"?{scheduleType:"daily",time:f,weekday:1,monthDay:1}:d&&o==="*"&&a==="*"&&/^\d+$/.test(l)?{scheduleType:"weekly",time:f,weekday:Math.max(0,Math.min(6,Number.parseInt(l,10))),monthDay:1}:d&&/^\d+$/.test(o)&&a==="*"&&l==="*"?{scheduleType:"monthly",time:f,weekday:1,monthDay:Math.max(1,Math.min(31,Number.parseInt(o,10)))}:{scheduleType:"custom",time:f,weekday:1,monthDay:1}}function Nv(e){let t={};const n=String(e||"").trim();if(n)try{t=JSON.parse(n)}catch{t={}}const r=Number(t.intervalMinutes),s=KG(r),o=typeof t.cron=="string"&&t.cron.trim()?t.cron.trim():s,a=qG(o),l=["daily","weekly","monthly","custom"].includes(t.scheduleType)?t.scheduleType:a.scheduleType,c=jv(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)),f=Zu(l,c,u,d,o);return{enabled:t.enabled===!0,scheduleType:l,time:c,weekday:u,monthDay:d,cron:f,timezone:qY,targetRunNodeId:typeof t.targetRunNodeId=="string"?t.targetRunNodeId.trim():"",overlapPolicy:"skip"}}function UG(e){const t=Nv(JSON.stringify(e||{}));return JSON.stringify(t)}function YG(e){const t=Number(e||0);return!Number.isFinite(t)||t<=0?"-":new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function GG(e){return e==="weekly"?"每周":e==="monthly"?"每月":e==="custom"?"高级 Cron":"每天"}function zC(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 Wp(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:zC(n.nextRunAt),lastAt:zC(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 bm(e){var t;return!!((t=e==null?void 0:e.data)!=null&&t.isWorkspaceGroup)}function km(e){return e>0?`Group ${e+1}`:"Group"}function JG(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)||km(r)).trim()||km(r),color:String((n==null?void 0:n.color)||"purple").trim()||"purple",x:o,y:a,width:Math.max(rl,Math.round(l)),height:Math.max(sl,Math.round(c))}}).filter(Boolean)}function XG(e){var n;return JG((n=e==null?void 0:e.ui)==null?void 0:n.groups).map(r=>({id:r.id,type:kc,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 bb(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(rl,Math.round(t)),height:Math.max(sl,Math.round(n))}}function ed(e){return(Array.isArray(e)?e:[]).map(t=>({type:(t==null?void 0:t.type)||"node",name:(t==null?void 0:t.name)||"",default:VG(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 nM(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 QG(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=mg(t);return[nM(e),En(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 BC(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}const ZG=new Map,eJ=[];function Fu(e,t){var h,y;const n=e!=null&&e.instances&&typeof e.instances=="object"?e.instances:{},r=iM(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=(y=e==null?void 0:e.ui)!=null&&y.nodeSizes&&typeof e.ui.nodeSizes=="object"?e.ui.nodeSizes:{},l=new Set(Object.keys(r));for(const v of s)v!=null&&v.source&&l.add(String(v.source)),v!=null&&v.target&&l.add(String(v.target));const u=Array.from(l).map(v=>{const w=r[v]||{},g=w.definitionId||v,k=t.find(D=>D.id===g),b=Sv(k)||g,j=t.find(D=>D.id===b)||k,N=w.marketplaceRef||ZT(k),C=tM(k),I=o[v]&&typeof o[v].x=="number"&&typeof o[v].y=="number"?o[v]:{x:320+l.size*20,y:180+l.size*12},R=!!En({definitionId:b,inputs:w.input,outputs:w.output}),H=a[v]&&typeof a[v].width=="number"&&typeof a[v].height=="number"?{width:a[v].width,height:a[v].height}:null,A=Ka(H,{display:R}),L=A&&!ri(b);return{id:v,type:kc,position:I,...L?{width:A.width,height:A.height}:{},data:{label:w.label||xm(k)||xm(j)||v,definitionId:b,...N?{marketplaceRef:N}:{},...k!=null&&k.packageId?{marketplacePackageId:k.packageId}:{},...k!=null&&k.version?{marketplaceVersion:k.version}:{},schemaType:QT(b,j||k),role:w.role||"normal",model:w.model||void 0,body:w.body||"",script:w.script||C||"",scriptRef:w.scriptRef||"",implementationRef:w.implementationRef||"",implementationMode:w.implementationMode||"",displayReloadKey:w.displayReloadKey||"",...L?{nodeSize:A}:{},...R&&L?{displaySize:A}:{}}}}).map(v=>fb(v,r,t)),d=XG(e),f=s.filter(v=>(v==null?void 0:v.source)&&(v==null?void 0:v.target)).filter(v=>!d.some(w=>w.id===String(v.source)||w.id===String(v.target))).map((v,w)=>({id:v.id||`we-${v.source}-${v.target}-${w}`,source:String(v.source),target:String(v.target),sourceHandle:v.sourceHandle??void 0,targetHandle:v.targetHandle??void 0,markerEnd:{type:ji.ArrowClosed}})),p=[...d,...u];return{nodes:p,edges:EU(f,p),instances:r}}function HC(e){return`${yb}${e}`}function Vp(e){const t=String(e||"");return t.startsWith(yb)?t.slice(yb.length):t}function kb(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 kh(e,t=[]){const n=new Map((Array.isArray(t)?t:[]).filter(f=>{var p;return ol((p=f==null?void 0:f.data)==null?void 0:p.definitionId)}).map(f=>[f.id,f])),r=Array.isArray(e==null?void 0:e.nodeIds)?e.nodeIds:[],s=[],o=new Set;for(const f of r){const p=String(f||"").trim();!p||o.has(p)||!n.has(p)||(o.add(p),s.push(p))}const a={},l=e!=null&&e.nodePositions&&typeof e.nodePositions=="object"?e.nodePositions:{};s.forEach((f,p)=>{const h=l[f];a[f]=h&&typeof h.x=="number"&&typeof h.y=="number"?{x:h.x,y:h.y}:{x:180+p*36,y:120+p*28}});const c={},u=e!=null&&e.nodeSizes&&typeof e.nodeSizes=="object"?e.nodeSizes:{};s.forEach(f=>{const p=Ka(u[f],{display:!0});p&&(c[f]=p)});const d=kb(e==null?void 0:e.viewport);return{nodeIds:s,nodePositions:a,nodeSizes:c,...d?{viewport:d}:{}}}function WC(e,t=[]){return kh(e,t)}const gw=[{value:"1",label:"1 天"},{value:"7",label:"7 天"},{value:"30",label:"30 天"},{value:"90",label:"90 天"},{value:"365",label:"1 年"},{value:"permanent",label:"永久"}];function yw(e={}){return{title:"",layout:"gallery",nodeIds:[],expiresInDays:30,permanent:!1,...e}}function VC(e={}){return e.permanent?"permanent":String(e.expiresInDays||30)}function KC(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 tJ(e={}){if(!e.expiresAt)return"永久有效";const t=Date.parse(String(e.expiresAt||""));return Number.isFinite(t)?`有效期至 ${new Date(t).toLocaleString()}`:"永久有效"}function qC(e={}){return new URL(e.url||`/display/${e.id||""}`,window.location.origin).href}const rM="af:workspace:canvas-clipboard",sM="agentflow.workspace.canvas-clipboard";function nJ(e){return JSON.stringify({type:sM,version:1,clipboard:e})}function rJ(e){try{const t=JSON.parse(String(e||""));if((t==null?void 0:t.type)!==sM)return null;const n=t.clipboard;return!n||!Array.isArray(n.nodes)||n.nodes.length===0?null:n}catch{return null}}function sJ(e){try{localStorage.setItem(rM,nJ(e))}catch{}}function iJ(){try{return rJ(localStorage.getItem(rM))}catch{return null}}function oJ(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}async function vb(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 UC(e,t,n){const r=Number(e);return!Number.isFinite(r)||r<=0?0:Math.min(n,Math.max(t,Math.round(r)))}function Ka(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:UC(n,WT,VT)||HT,height:UC(r,hm,KT)||hm}}function vm(e){const t=Ka(e,{display:!0});return t?{width:Math.max(320,Math.round(t.width)),height:Math.max(180,Math.round(t.height))}:null}function aJ(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:mb,height:gb}}function lJ(e,t=""){const n=vm(e==null?void 0:e.displaySize);if(n)return n;const r=vm(e==null?void 0:e.nodeSize);if(r)return r;const s=ol(t)||Sf(oa((e==null?void 0:e.inputs)||(e==null?void 0:e.input)||[],"displayType","markdown"));return aJ(s)}function ql(e){var s,o,a,l,c,u,d,f,p,h,y;if(ri((s=e==null?void 0:e.data)==null?void 0:s.definitionId))return null;const t=!!En(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(((f=(d=e==null?void 0:e.data)==null?void 0:d.displaySize)==null?void 0:f.height)||((h=(p=e==null?void 0:e.data)==null?void 0:p.nodeSize)==null?void 0:h.height)||(e==null?void 0:e.height)||(t?(y=e==null?void 0:e.measured)==null?void 0:y.height:0)||0);return Ka({width:n,height:r},{display:t})}function Bl(e,t,n){var d,f,p,h,y,v,w,g,k,b,j,N,C;const r=(e||[]).filter(I=>!bm(I)),s=(e||[]).filter(bm),o=iM(gv(r,n||{})),a=t.map(I=>({source:I.source,target:I.target,sourceHandle:I.sourceHandle??null,targetHandle:I.targetHandle??null})).filter(I=>!s.some(R=>R.id===I.source||R.id===I.target)),l={},c={},u=[];for(const I of r){l[I.id]={x:((d=I.position)==null?void 0:d.x)||0,y:((f=I.position)==null?void 0:f.y)||0};const R=ql(I);R&&(c[I.id]=R)}for(const I of s){const R=Number(((h=(p=I.data)==null?void 0:p.nodeSize)==null?void 0:h.width)||I.width||((y=I.measured)==null?void 0:y.width)||0),H=Number(((w=(v=I.data)==null?void 0:v.nodeSize)==null?void 0:w.height)||I.height||((g=I.measured)==null?void 0:g.height)||0);u.push({id:I.id,title:String(((k=I.data)==null?void 0:k.title)||((b=I.data)==null?void 0:b.label)||"Group"),color:String(((j=I.data)==null?void 0:j.color)||"purple"),x:Number(((N=I.position)==null?void 0:N.x)||0),y:Number(((C=I.position)==null?void 0:C.y)||0),width:Math.max(rl,Math.round(R||rl)),height:Math.max(sl,Math.round(H||sl))})}return{version:1,instances:o,edges:a,ui:{nodePositions:l,nodeSizes:c,groups:u}}}function iM(e){const t={};for(const[n,r]of Object.entries(e||{})){const s=String((r==null?void 0:r.definitionId)||n);if(!!ol(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 ol(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 En(e){const t=ol(e==null?void 0:e.definitionId);return t||(ri(e==null?void 0:e.definitionId)&&mg(e)?Sf(oa((e==null?void 0:e.inputs)||(e==null?void 0:e.input)||[],"displayType","markdown")):"")}function io(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],n=En(e),r=ri(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 ia(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 cJ(e){let t=String(e||"").replace(/\r\n/g,`
|
|
189
|
-
`).trim();return t.includes(`
|
|
190
|
-
`)||(t=t.replace(/\s+(resultFile|result|outParams|outParams\.[A-Za-z_][A-Za-z0-9_-]*)\s*:/g,`
|
|
191
|
-
$1:`).replace(/(^|\n)outParams:\s+([A-Za-z_][A-Za-z0-9_-]*\s*:)/g,`$1outParams:
|
|
192
|
-
$2`)),t}function Ri(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=cJ(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(`
|
|
193
|
-
`).filter(p=>/^\s+/.test(p)||!p.trim()).map(p=>p.replace(/^\s{2}/,"")).join(`
|
|
194
|
-
`).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 al(e,t){const n=Pr(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 Sb(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 uJ(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(`
|
|
195
|
-
`)}).filter(Boolean).join(`
|
|
196
|
-
|
|
197
|
-
`)}function Jc(e){let t=Ri(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 dJ(e){const t=Jc(e);return t.trim()?/<[^>]*$/g.test(t)?"HTML 内容末尾存在未闭合标签,可能是生成或保存时被截断。":/^(?:<!doctype\b|<html\b)/i.test(t)&&!/<\/html\s*>/i.test(t)?"完整 HTML 文档缺少 </html> 结束标签,可能是生成或保存时被截断。":"":""}function Fa(e,t){return e==="html"?dJ(t):""}function oM(e,t=""){const n=Jc(e);if(!n.trim())return"";const s=`<base target="_blank"><script data-agentflow-display-link-guard="1">
|
|
198
|
-
(() => {
|
|
199
|
-
const frameId = ${JSON.stringify(String(t||""))};
|
|
200
|
-
const postSize = () => {
|
|
201
|
-
const doc = document.documentElement;
|
|
202
|
-
const body = document.body;
|
|
203
|
-
const height = Math.ceil(Math.max(
|
|
204
|
-
doc ? doc.scrollHeight : 0,
|
|
205
|
-
doc ? doc.offsetHeight : 0,
|
|
206
|
-
doc ? doc.clientHeight : 0,
|
|
207
|
-
body ? body.scrollHeight : 0,
|
|
208
|
-
body ? body.offsetHeight : 0,
|
|
209
|
-
body ? body.clientHeight : 0,
|
|
210
|
-
window.innerHeight || 0
|
|
211
|
-
));
|
|
212
|
-
window.parent.postMessage({ source: "agentflow-html-display-size", frameId, height }, "*");
|
|
213
|
-
};
|
|
214
|
-
document.addEventListener("click", (event) => {
|
|
215
|
-
const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
|
|
216
|
-
if (!link) return;
|
|
217
|
-
const rawHref = String(link.getAttribute("href") || "").trim();
|
|
218
|
-
if (!rawHref || rawHref.startsWith("#")) return;
|
|
219
|
-
if (/^javascript:/i.test(rawHref)) {
|
|
220
|
-
event.preventDefault();
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
event.preventDefault();
|
|
224
|
-
window.open(link.href, "_blank", "noopener,noreferrer");
|
|
225
|
-
}, true);
|
|
226
|
-
window.addEventListener("load", postSize);
|
|
227
|
-
window.addEventListener("resize", postSize);
|
|
228
|
-
requestAnimationFrame(postSize);
|
|
229
|
-
setTimeout(postSize, 60);
|
|
230
|
-
setTimeout(postSize, 300);
|
|
231
|
-
if (typeof ResizeObserver !== "undefined") {
|
|
232
|
-
const resizeObserver = new ResizeObserver(postSize);
|
|
233
|
-
resizeObserver.observe(document.documentElement);
|
|
234
|
-
if (document.body) resizeObserver.observe(document.body);
|
|
235
|
-
}
|
|
236
|
-
if (typeof MutationObserver !== "undefined") {
|
|
237
|
-
const mutationObserver = new MutationObserver(postSize);
|
|
238
|
-
mutationObserver.observe(document.documentElement, { childList: true, subtree: true, attributes: true, characterData: true });
|
|
239
|
-
}
|
|
240
|
-
})();
|
|
241
|
-
<\/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 fJ(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 pJ(e,t){const n=document.createElement("a");n.href=e,n.download=t,document.body.appendChild(n),n.click(),n.remove()}function hJ(e,t){const n=URL.createObjectURL(e);try{pJ(n,t)}finally{window.setTimeout(()=>URL.revokeObjectURL(n),1e3)}}function aM(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 mJ(e){const t=aM(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>"}
|
|
242
|
-
${t.documentElement.outerHTML}`:""}function ww(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 gJ(e,t,n,r={}){var w;const s=(w=e==null?void 0:e.getBoundingClientRect)==null?void 0:w.call(e),o=aM(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,f=(r==null?void 0:r.displaySize)||null,p={fallbackWidth:Number(t)||null,fallbackHeight:Number(n)||null,displaySizeWidth:Number((f==null?void 0:f.width)||0)||null,displaySizeHeight:Number((f==null?void 0:f.height)||0)||null,rectWidth:s!=null&&s.width?Math.round(s.width):null,rectHeight:s!=null&&s.height?Math.round(s.height):null,iframeClientWidth:(e==null?void 0:e.clientWidth)||null,iframeClientHeight:(e==null?void 0:e.clientHeight)||null,docScrollWidth:(a==null?void 0:a.scrollWidth)||null,docScrollHeight:(a==null?void 0:a.scrollHeight)||null,bodyScrollWidth:(l==null?void 0:l.scrollWidth)||null,bodyScrollHeight:(l==null?void 0:l.scrollHeight)||null,docOffsetWidth:(a==null?void 0:a.offsetWidth)||null,bodyOffsetWidth:(l==null?void 0:l.offsetWidth)||null,card:ww(c),displayBody:ww(u),scroller:ww(d)},h=[Number(t)||0,Number((f==null?void 0:f.width)||0),Number((c==null?void 0:c.clientWidth)||0),Number((c==null?void 0:c.scrollWidth)||0),Number((u==null?void 0:u.clientWidth)||0),Number((u==null?void 0:u.scrollWidth)||0),Number((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(g=>Math.ceil(g)).filter(g=>g>0),y=Math.max(1,...h.length?h:[960]),v=Math.max(1,Math.round(Number(n)||(s==null?void 0:s.height)||(e==null?void 0:e.clientHeight)||640),Math.ceil(Number((a==null?void 0:a.scrollHeight)||0)),Math.ceil(Number((l==null?void 0:l.scrollHeight)||0)));return{width:y,height:v,debug:p}}async function yJ({flowParams:e,content:t,sourceFilePath:n,iframe:r,width:s,height:o,filename:a,snapshotElements:l,displaySize:c}){const u=gJ(r,s,o,{...l||{},displaySize:c}),d=mJ(r),f=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(!f.ok){const h=await f.json().catch(()=>({}));throw new Error(h.error||"截图失败")}const p=await f.blob();hJ(p,a)}function wJ(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 lM(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 xJ(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 cM({code:e}){const t=m.useMemo(()=>xJ(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,f)=>{l.set(d.id,{x:24+(n?f*(r+o):f%3*(r+o)),y:24+(n?f%3*(s+a):f*(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,f)=>{const p=l.get(d.from),h=l.get(d.to);if(!p||!h)return null;const y=n?`M ${p.x+r} ${p.y+s/2} C ${(p.x+h.x+r)/2} ${p.y+s/2}, ${(p.x+h.x+r)/2} ${h.y+s/2}, ${h.x} ${h.y+s/2}`:`M ${p.x+r/2} ${p.y+s} C ${p.x+r/2} ${p.y+s+28}, ${h.x+r/2} ${h.y-28}, ${h.x+r/2} ${h.y}`;return i.jsx("path",{className:"af-work-node__mermaid-edge",d:y,markerEnd:"url(#af-work-arrow)"},`${d.from}-${d.to}-${f}`)}),t.nodes.map(d=>{const f=l.get(d.id);return i.jsxs("g",{children:[i.jsx("rect",{className:"af-work-node__mermaid-box",x:f.x,y:f.y,width:r,height:s,rx:"8"}),i.jsx("text",{className:"af-work-node__mermaid-text",x:f.x+r/2,y:f.y+s/2+5,textAnchor:"middle",children:d.label.slice(0,22)})]},d.id)})]})})}function gi({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 f=Math.max(1,d.scrollHeight),p=Math.max(1,d.clientHeight),h=f>p+1,y=h?Math.max(12,p/f*100):100,v=Math.max(0,100-y),w=h?Math.min(v,d.scrollTop/Math.max(1,f-p)*v):0;o({visible:h,top:w,height:y})},[]);m.useEffect(()=>{const d=requestAnimationFrame(a),f=n.current;if(!f||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(d);const p=new ResizeObserver(a);p.observe(f);for(const h of Array.from(f.children))p.observe(h);return()=>{cancelAnimationFrame(d),p.disconnect()}},[t,a]);const l=m.useCallback(d=>{const f=n.current;if(!f)return;const p=Math.max(0,f.scrollHeight-f.clientHeight);f.scrollTop=Math.min(1,Math.max(0,d))*p,a()},[a]),c=m.useCallback((d,f=0)=>{const p=r.current;if(!p)return 0;const h=p.getBoundingClientRect(),y=s.height/100*h.height,v=Math.max(1,h.height-y);return(d-h.top-f)/v},[s.height]),u=m.useCallback(d=>{var j,N;if(!s.visible)return;d.preventDefault(),d.stopPropagation();const f=r.current;if(!f)return;const p=f.getBoundingClientRect(),h=s.top/100*p.height,y=s.height/100*p.height,w=d.clientY>=p.top+h&&d.clientY<=p.top+h+y?d.clientY-p.top-h:y/2;l(c(d.clientY,w));const g=d.pointerId;(N=(j=d.currentTarget).setPointerCapture)==null||N.call(j,g);const k=C=>{C.preventDefault(),l(c(C.clientY,w))},b=()=>{window.removeEventListener("pointermove",k),window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",b)};window.addEventListener("pointermove",k),window.addEventListener("pointerup",b),window.addEventListener("pointercancel",b)},[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 uM({data:e,flowParams:t,htmlFrameRef:n,htmlFrameVersion:r=0}){const s=En(e),o=io(e),a=s==="image"?o:Ri(o),l=s==="image"?"":ia(a,s),[c,u]=m.useState(""),[d,f]=m.useState(""),[p,h]=m.useState(!1);m.useEffect(()=>{let k=!1;return l?(h(!0),f(""),u(""),al(t,l).then(b=>{k||u(b)}).catch(b=>{k||f(String(b.message||b))}).finally(()=>{k||h(!1)}),()=>{k=!0}):(u(""),f(""),h(!1),()=>{k=!0})},[l,t==null?void 0:t.flowId,t==null?void 0:t.flowSource,t==null?void 0:t.archived,e==null?void 0:e.displayReloadKey]);const y=l?c:a,v=s==="html"?Jc(y):s==="react"?hg(y):Ri(y),w=m.useRef("");if(w.current||(w.current=`html-display-${Math.random().toString(36).slice(2,10)}`),!s)return null;const g=Fa(s,v);if(p)return i.jsxs(gi,{className:"af-work-display-empty",children:["Loading ",l,"..."]});if(d)return i.jsx(gi,{className:"af-work-display-empty",children:d});if(g)return i.jsx(gi,{className:"af-work-display-empty",children:g});if(!v.trim())return i.jsx(gi,{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"?yv(v,w.current):oM(v,w.current)},r)});if(s==="image"){const k=tf(v,t);return i.jsx(gi,{className:"af-work-display-body af-work-display-body--image",children:i.jsx("img",{className:"af-work-display-image",src:k,alt:wJ(e),loading:"lazy"})})}return s==="markdown"?i.jsx(gi,{className:"af-work-display-body af-work-display-body--markdown",children:i.jsx(dv,{content:v,basePath:l,resolveSrc:(k,b)=>tf(k,t,b)})}):s==="chart"?i.jsx(gi,{className:"af-work-display-body af-work-display-body--chart",children:i.jsx(pv,{content:v})}):s==="table"?i.jsx(gi,{className:"af-work-display-body af-work-display-body--table",children:i.jsx(fv,{content:v})}):s==="mermaid"?i.jsxs(gi,{className:"af-work-display-body",children:[i.jsx(cM,{code:v}),i.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--mermaid",children:v})]}):i.jsx(gi,{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:v})})}function bJ({node:e,onClose:t}){var k,b,j,N,C,I,R,H,A,L,D;const n=m.useRef(null),r=En(e==null?void 0:e.data),s=((k=e==null?void 0:e.data)==null?void 0:k.label)||(r==="html"?"HTML 展示":r==="markdown"?"Markdown 展示":"Display 预览"),o=!!((b=e==null?void 0:e.data)!=null&&b.readOnly),[a,l]=m.useState(!1),[c,u]=m.useState(""),[d,f]=m.useState(""),[p,h]=m.useState(!1),y=io(e==null?void 0:e.data),v=r==="markdown"?Ri(y):"",w=r==="markdown"?ia(v,"markdown"):"",g=r==="markdown"?w?d:v:"";return m.useEffect(()=>{const O=M=>{if(M.key==="Escape"){if(a){u(String(g||"")),l(!1);return}t==null||t()}};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)},[g,a,t]),m.useEffect(()=>{var M;let O=!1;return r!=="markdown"||!w?(f(""),h(!1),()=>{O=!0}):(h(!0),al(((M=e==null?void 0:e.data)==null?void 0:M.flowParams)||{},w).then(K=>{O||f(K)}).catch(K=>{var z,F;O||(f(""),(F=(z=e==null?void 0:e.data)==null?void 0:z.onStatus)==null||F.call(z,String(K.message||K)))}).finally(()=>{O||h(!1)}),()=>{O=!0})},[r,w,(N=(j=e==null?void 0:e.data)==null?void 0:j.flowParams)==null?void 0:N.flowId,(I=(C=e==null?void 0:e.data)==null?void 0:C.flowParams)==null?void 0:I.flowSource,(H=(R=e==null?void 0:e.data)==null?void 0:R.flowParams)==null?void 0:H.archived,(A=e==null?void 0:e.data)==null?void 0:A.displayReloadKey]),m.useEffect(()=>{a||u(String(g||""))},[g,a]),e?ur.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:lM(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||p,onClick:async()=>{var O,M;try{await fM({nodeId:e.id,data:e.data,filePath:w,content:c,setFileContent:f}),l(!1)}catch(K){(M=(O=e==null?void 0:e.data)==null?void 0:O.onStatus)==null||M.call(O,String(K.message||K))}},"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(g||"")),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||p,onClick:()=>{u(String(g||"")),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(dM,{value:c,onChange:u,onUploadImage:(L=e.data)==null?void 0:L.onUploadWorkspaceImage,readOnly:o}):i.jsx(uM,{data:e.data,flowParams:(D=e.data)==null?void 0:D.flowParams,htmlFrameRef:n})})]})}),document.body):null}function kJ({node:e}){var p,h,y,v,w,g,k,b,j,N;const t=En(e==null?void 0:e.data),n=io(e==null?void 0:e.data),r=t==="image"?n:Ri(n),s=t==="image"?"":ia(r,t),[o,a]=m.useState(""),[l,c]=m.useState(!1);m.useEffect(()=>{var I;let C=!1;return s?(c(!0),a(""),al(((I=e==null?void 0:e.data)==null?void 0:I.flowParams)||{},s).then(R=>{C||a(R)}).catch(()=>{C||a("")}).finally(()=>{C||c(!1)}),()=>{C=!0}):(a(""),c(!1),()=>{C=!0})},[s,(h=(p=e==null?void 0:e.data)==null?void 0:p.flowParams)==null?void 0:h.flowId,(v=(y=e==null?void 0:e.data)==null?void 0:y.flowParams)==null?void 0:v.flowSource,(g=(w=e==null?void 0:e.data)==null?void 0:w.flowParams)==null?void 0:g.archived,(k=e==null?void 0:e.data)==null?void 0:k.displayReloadKey]);const u=s?o:r,d=t==="html"?Jc(u):t==="react"?hg(u):Ri(u),f=Fa(t,d);return l?i.jsx("div",{className:"af-display-picker-preview__empty",children:"Loading"}):f?i.jsx("div",{className:"af-display-picker-preview__empty",children:f}):d.trim()?t==="html"||t==="react"?i.jsx("iframe",{title:((b=e==null?void 0:e.data)==null?void 0:b.label)||(e==null?void 0:e.id),sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox",srcDoc:t==="react"?yv(d):oM(d)}):t==="image"?i.jsx("img",{src:tf(d,(j=e==null?void 0:e.data)==null?void 0:j.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(dv,{content:d,basePath:s,resolveSrc:(C,I)=>{var R;return tf(C,(R=e==null?void 0:e.data)==null?void 0:R.flowParams,I)}})}):t==="chart"?i.jsx(pv,{content:d}):t==="table"?i.jsx(fv,{content:d}):t==="mermaid"?i.jsxs("div",{className:"af-display-picker-preview__diagram",children:[i.jsx(cM,{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 dM({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}),f=m.useCallback(()=>{const g=s.current;if(!g)return;const k=Math.max(1,g.scrollHeight),b=Math.max(1,g.clientHeight),j=k>b+1,N=j?Math.max(12,b/k*100):100,C=Math.max(0,100-N),I=j?Math.min(C,g.scrollTop/Math.max(1,k-b)*C):0;d({visible:j,top:I,height:N})},[]);m.useEffect(()=>{const g=requestAnimationFrame(f),k=s.current;if(!k||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(g);const b=new ResizeObserver(f);return b.observe(k),()=>{cancelAnimationFrame(g),b.disconnect()}},[f,e]);const p=m.useCallback(g=>{const k=s.current;if(!k)return;const b=Math.max(0,k.scrollHeight-k.clientHeight);k.scrollTop=Math.min(1,Math.max(0,g))*b,f()},[f]),h=m.useCallback((g,k=0)=>{const b=a.current;if(!b)return 0;const j=b.getBoundingClientRect(),N=u.height/100*j.height,C=Math.max(1,j.height-N);return(g-j.top-k)/C},[u.height]),y=m.useCallback(g=>{if(!u.visible)return;g.preventDefault(),g.stopPropagation();const k=a.current;if(!k)return;const b=k.getBoundingClientRect(),j=u.top/100*b.height,N=u.height/100*b.height,I=g.clientY>=b.top+j&&g.clientY<=b.top+j+N?g.clientY-b.top-j:N/2;p(h(g.clientY,I));const R=A=>{A.preventDefault(),p(h(A.clientY,I))},H=()=>{window.removeEventListener("pointermove",R),window.removeEventListener("pointerup",H),window.removeEventListener("pointercancel",H)};window.addEventListener("pointermove",R),window.addEventListener("pointerup",H),window.addEventListener("pointercancel",H)},[h,p,u.height,u.top,u.visible]),v=m.useCallback(g=>{const k=String(e||""),b=s.current,j=Number((b==null?void 0:b.selectionStart)??k.length),N=Number((b==null?void 0:b.selectionEnd)??j),C=k.slice(0,j),I=k.slice(N),R=C&&!C.endsWith(`
|
|
243
|
-
`)?`
|
|
244
|
-
`:"",H=I&&!I.startsWith(`
|
|
245
|
-
`)?`
|
|
246
|
-
`:"",A=`${C}${R}${g}${H}${I}`;t==null||t(A),window.requestAnimationFrame(()=>{var D,O;const L=C.length+R.length+g.length;(D=s.current)==null||D.focus(),(O=s.current)==null||O.setSelectionRange(L,L)})},[t,e]),w=m.useCallback(async g=>{if(!r&&!(!g||l)){c(!0);try{const k=await(n==null?void 0:n(g)),b=String(k||"").trim();if(b){const j=String(g.name||"image").replace(/\.[^.]+$/g,"").trim()||"image";v(``)}}finally{c(!1)}}},[v,n,r,l]);return i.jsxs("div",{className:"af-work-display-editor nodrag nopan",onClick:g=>g.stopPropagation(),onDragOver:g=>{var b;Array.from(((b=g.dataTransfer)==null?void 0:b.items)||[]).some(j=>String((j==null?void 0:j.type)||"").startsWith("image/"))&&(g.preventDefault(),g.dataTransfer.dropEffect="copy")},onDrop:g=>{var b;const k=Array.from(((b=g.dataTransfer)==null?void 0:b.files)||[]).find(mm);k&&(g.preventDefault(),w(k))},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 g;return(g=o.current)==null?void 0:g.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:g=>{var b;const k=(b=g.target.files)==null?void 0:b[0];g.target.value="",k&&w(k)}})]}),i.jsx("textarea",{ref:s,className:"af-work-display-editor__textarea",value:e,onChange:g=>t==null?void 0:t(g.target.value),onScroll:f,onKeyDown:g=>{g.key==="Escape"&&g.stopPropagation()},placeholder:"输入 Markdown 内容",spellCheck:!1,readOnly:r}),i.jsx("div",{ref:a,className:"af-work-display-editor__scrollbar"+(u.visible?" af-work-display-editor__scrollbar--visible":""),onPointerDown:y,"aria-hidden":"true",children:i.jsx("span",{style:{height:`${u.height}%`,top:`${u.top}%`}})})]})}function vJ({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||""),f=!!s.running,p=!!(t!=null&&t.readOnly),h=String(s.error||""),y=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:v=>v.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 v;return(v=t==null?void 0:t.onCloseNodeChat)==null?void 0:v.call(t)},"aria-label":"关闭节点微调",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.length>0||f||h?i.jsxs("div",{className:"af-work-node-chat__messages",children:[y.map((v,w)=>i.jsxs("div",{className:`af-work-node-chat__msg af-work-node-chat__msg--${v.role==="assistant"?"assistant":"user"}`,children:[i.jsx("span",{children:v.role==="assistant"?"AI":"你"}),i.jsx("p",{children:v.text})]},`${v.at||w}-${w}`)),f?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:f||p,"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:f||p,placeholder:"描述你想怎么调整这个展示",onCompositionStart:()=>{u.current=!0},onCompositionEnd:v=>{var g;u.current=!1;const w=v.currentTarget.value;c(w),(g=t==null?void 0:t.onUpdateNodeChatDraft)==null||g.call(t,e,w)},onChange:v=>{var g;const w=v.target.value;c(w),u.current||(g=t==null?void 0:t.onUpdateNodeChatDraft)==null||g.call(t,e,w)},onKeyDown:v=>{var w,g;v.isComposing||(w=v.nativeEvent)!=null&&w.isComposing||v.keyCode===229||(v.metaKey||v.ctrlKey)&&v.key==="Enter"&&(v.preventDefault(),(g=t==null?void 0:t.onSendNodeChat)==null||g.call(t,e,l))}}),i.jsx("button",{type:"button",className:"af-work-node-chat__send",disabled:f||p||!l.trim(),onClick:()=>{var v;return(v=t==null?void 0:t.onSendNodeChat)==null?void 0:v.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:v=>{var w;v.stopPropagation(),(w=t==null?void 0:t.onToggleNodeChat)==null||w.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 SJ(e){return e==="mermaid"?"mmd":e==="ascii"?"txt":e==="html"?"html":e==="react"?"json":e==="image"?"txt":e==="chart"||e==="table"?"json":"md"}function jJ(e){return String(e).trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)||"display"}function NJ(e){return String(e||"node").trim().replace(/[^a-zA-Z0-9._-]+/g,"_").replace(/^_+|_+$/g,"").slice(0,120)||"node"}function YC(e,t=""){const n=ia(e,t).replace(/^\/+/,"");return n.startsWith("outputs/")?n:""}function CJ(e,t){const n=NJ(e),r=new Set,s=En(t)||"";ri(t==null?void 0:t.definitionId)&&r.add(`outputs/${n}`);const o=YC(io(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=YC(u,s);return d&&r.add(d),u===`outputs/${n}`||u.startsWith(`outputs/${n}/`)})&&r.add(`outputs/${n}`),Array.from(r)}function GC(e,t){const n=En(t)||"markdown";return`outputs/${jJ((t==null?void 0:t.label)||e||n)}.${SJ(n)}`}async function fM({nodeId:e,data:t,filePath:n,content:r,setFileContent:s}){var o,a;if(n){const l=await Sb((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 pM({id:e,data:t,selected:n,deleteNode:r}){var ee,te,ne;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],a=(Array.isArray(t==null?void 0:t.outputs)?t.outputs:[]).map((Z,ce)=>({slot:Z,idx:ce})).sort((Z,ce)=>{var _e,Be,at,yt;const de=String(((_e=Z.slot)==null?void 0:_e.name)||"").trim(),me=String(((Be=ce.slot)==null?void 0:Be.name)||"").trim();if(de==="next"&&me!=="next")return-1;if(me==="next"&&de!=="next")return 1;const $e=String(((at=Z.slot)==null?void 0:at.type)||"").trim(),Ce=String(((yt=ce.slot)==null?void 0:yt.type)||"").trim();return $e==="node"&&Ce!=="node"?-1:Ce==="node"&&$e!=="node"?1:Z.idx-ce.idx}),l=En(t),c=m.useRef(null),u=m.useRef(null),[d,f]=m.useState(0),[p,h]=m.useState(!1),[y,v]=m.useState(!1),[w,g]=m.useState(!1),[k,b]=m.useState(""),[j,N]=m.useState(""),[C,I]=m.useState(!1),[R,H]=m.useState(!1),A=m.useRef(null),L=io(t),D=l==="markdown"?Ri(L):"",O=l==="markdown"?ia(D,"markdown"):"",M=l==="markdown"?O?j:D:"",K=!!(t!=null&&t.readOnly),z=!!(t!=null&&t.displayPageMode);m.useEffect(()=>{let Z=!1;return l!=="markdown"||!O?(N(""),I(!1),()=>{Z=!0}):(I(!0),al((t==null?void 0:t.flowParams)||{},O).then(ce=>{Z||N(ce)}).catch(ce=>{var de;Z||(N(""),(de=t==null?void 0:t.onStatus)==null||de.call(t,String(ce.message||ce)))}).finally(()=>{Z||I(!1)}),()=>{Z=!0})},[l,O,(ee=t==null?void 0:t.flowParams)==null?void 0:ee.flowId,(te=t==null?void 0:t.flowParams)==null?void 0:te.flowSource,(ne=t==null?void 0:t.flowParams)==null?void 0:ne.archived,t==null?void 0:t.displayReloadKey]),m.useEffect(()=>{if(!y)return;const Z=()=>v(!1);return window.addEventListener("pointerup",Z,!0),window.addEventListener("pointercancel",Z,!0),window.addEventListener("mouseup",Z,!0),window.addEventListener("blur",Z),()=>{window.removeEventListener("pointerup",Z,!0),window.removeEventListener("pointercancel",Z,!0),window.removeEventListener("mouseup",Z,!0),window.removeEventListener("blur",Z)}},[y]),m.useEffect(()=>{w||b(String(M||""))},[M,w]);const F=(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"),$=String((t==null?void 0:t.sourceNodeId)||e),W=(t==null?void 0:t.sharingDisplayNodeId)===$,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 Te,it,gt,$t,be,He,ie,ke,Fe,Ze;if(l!=="html"||p)return;const Z=io(t),ce=ia(Z,l);let de=Z;if(ce)try{de=await al((t==null?void 0:t.flowParams)||{},ce)}catch(Ne){h(!1),console.warn("Failed to read HTML display file before saving image.",Ne);return}const me=Jc(de);if(!me.trim())return;const $e=Fa(l,me);if($e){console.warn($e);return}const Ce=(it=(Te=u.current)==null?void 0:Te.getBoundingClientRect)==null?void 0:it.call(Te),_e=($t=(gt=c.current)==null?void 0:gt.querySelector)==null?void 0:$t.call(gt,".af-work-display-body"),Be=(He=(be=c.current)==null?void 0:be.querySelector)==null?void 0:He.call(be,".af-visible-scroll-frame__scroller"),at=Math.round(Math.max(Number((Ce==null?void 0:Ce.width)||0),Number((E==null?void 0:E.width)||0),Number(((ie=c.current)==null?void 0:ie.clientWidth)||0),Number((_e==null?void 0:_e.clientWidth)||0),Number((Be==null?void 0:Be.clientWidth)||0),Math.max(320,Number((E==null?void 0:E.width)||960)-2))),yt=Math.round(Math.max(Number((Ce==null?void 0:Ce.height)||0),Number((E==null?void 0:E.height)||0),Number(((ke=c.current)==null?void 0:ke.clientHeight)||0),Number((_e==null?void 0:_e.clientHeight)||0),Number((Be==null?void 0:Be.clientHeight)||0),Math.max(180,Number((E==null?void 0:E.height)||640)-46)));h(!0);try{await yJ({flowParams:(t==null?void 0:t.flowParams)||{},content:me,sourceFilePath:ce,iframe:u.current,width:at,height:yt,filename:fJ((t==null?void 0:t.label)||e||"html-render","png"),snapshotElements:{card:c.current,displayBody:_e,scroller:Be},displaySize:E}),(Fe=t==null?void 0:t.onStatus)==null||Fe.call(t,"已导出 HTML 展示截图")}catch(Ne){const St=String((Ne==null?void 0:Ne.message)||Ne||"截图失败");(Ze=t==null?void 0:t.onStatus)==null||Ze.call(t,`HTML 截图失败:${St}`),console.warn("Failed to save HTML display as PNG.",Ne)}finally{h(!1)}},[t,E==null?void 0:E.height,E==null?void 0:E.width,e,l,p]),V=m.useCallback(Z=>{var ce;K||!Z||l!=="image"||(ce=t==null?void 0:t.onUploadImageToDisplayNode)==null||ce.call(t,e,Z)},[t,e,l,K]),B=m.useCallback(Z=>{var ce,de;(ce=Z==null?void 0:Z.stopPropagation)==null||ce.call(Z),!K&&((de=t==null?void 0:t.onSetDisplayNodeContent)==null||de.call(t,e,"","replace",{logChat:!1,reloadDisplay:!0,statusMessage:"已清空 Display 内容"}),l==="markdown"&&(b(""),g(!1)))},[t,e,l,K]),re=m.useCallback(Z=>{var me,$e;K||l!=="image"||!(Array.from(((me=Z.dataTransfer)==null?void 0:me.files)||[]).some(mm)||Array.from((($e=Z.dataTransfer)==null?void 0:$e.items)||[]).some(Ce=>String((Ce==null?void 0:Ce.type)||"").startsWith("image/")))||(Z.preventDefault(),Z.stopPropagation(),Z.dataTransfer.dropEffect="copy",H(!0))},[l,K]),ue=m.useCallback(Z=>{l==="image"&&(Z.currentTarget.contains(Z.relatedTarget)||H(!1))},[l]),G=m.useCallback(Z=>{var de;if(l!=="image")return;const ce=Array.from(((de=Z.dataTransfer)==null?void 0:de.files)||[]).find(mm);ce&&(Z.preventDefault(),Z.stopPropagation(),H(!1),V(ce))},[l,V]);return i.jsxs("div",{className:"af-work-display-card"+(E?" af-work-display-card--sized":"")+(n?" af-work-display-card--selected":"")+(y?" af-work-display-card--resizing":"")+(R?" af-work-display-card--image-drop":"")+(z?" 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:re,onDragLeave:ue,onDrop:G,children:[i.jsx(Gk,{className:"af-work-display-resize nodrag",position:"bottom-right",minWidth:320,minHeight:180,onResizeStart:()=>v(!0),onResizeEnd:()=>v(!1),children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),s.map((Z,ce)=>{if(Z.showOnNode===!1)return null;const de=`${4.15+ce*1.75}rem`,me=Z.name||`#${ce+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:de},children:me}),i.jsx(Yn,{type:"target",position:Ue.Left,id:`input-${ce}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:de,background:Pn(Z.type)},title:`${me} · ${Z.type}`})]},`in-${ce}`)}),a.map(({slot:Z,idx:ce},de)=>{if(Z.showOnNode===!1)return null;const me=`${4.15+de*1.75}rem`,$e=Z.name||`#${ce+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:me},children:$e}),i.jsx(Yn,{type:"source",position:Ue.Right,id:`output-${ce}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:me,background:Pn(Z.type)},title:`${$e} · ${Z.type}`})]},`out-${ce}`)}),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:lM(l)}),i.jsx("strong",{children:F}),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:Z=>Z.stopPropagation(),children:[i.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var Z,ce,de,me;try{(me=(de=(ce=(Z=u.current)==null?void 0:Z.contentWindow)==null?void 0:ce.history)==null?void 0:de.back)==null||me.call(de)}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 Z,ce,de,me;try{(me=(de=(ce=(Z=u.current)==null?void 0:Z.contentWindow)==null?void 0:ce.history)==null?void 0:de.forward)==null||me.call(de)}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:()=>f(Z=>Z+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:p,onClick:Q,"aria-label":"截图另存为图片",title:"截图另存为图片",children:i.jsx("span",{className:"material-symbols-outlined",children:p?"hourglass_empty":"photo_camera"})})]}):null,l==="markdown"?w?i.jsxs("div",{className:"af-work-display-card__html-controls nodrag",onClick:Z=>Z.stopPropagation(),children:[i.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:K||C,onClick:async()=>{var Z;try{await fM({nodeId:e,data:t,filePath:O,content:k,setFileContent:N}),g(!1)}catch(ce){(Z=t==null?void 0:t.onStatus)==null||Z.call(t,String(ce.message||ce))}},"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:()=>{b(String(M||"")),g(!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:K||C,onClick:Z=>{Z.stopPropagation(),b(String(M||"")),g(!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:A,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:Z=>{var de;const ce=(de=Z.target.files)==null?void 0:de[0];Z.target.value="",ce&&V(ce)}}),i.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:K,onClick:Z=>{var ce;Z.stopPropagation(),(ce=A.current)==null||ce.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:Z=>{var ce;Z.stopPropagation(),(ce=t==null?void 0:t.onOpenDisplayPreview)==null||ce.call(t,$)},"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:W,onClick:Z=>{var ce;Z.stopPropagation(),(ce=t==null?void 0:t.onShareDisplayNode)==null||ce.call(t,$)},"aria-label":"分享展示",title:"分享展示",children:i.jsx("span",{className:"material-symbols-outlined",children:W?"hourglass_empty":"ios_share"})}),i.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:K,onClick:B,"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:K,onClick:()=>{var Z;return(Z=t==null?void 0:t.onSaveDisplayNodeToFile)==null?void 0:Z.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:K,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:i.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l==="markdown"&&w?i.jsx(dM,{value:k,onChange:b,onUploadImage:t==null?void 0:t.onUploadWorkspaceImage,readOnly:K}):i.jsx(uM,{data:t,flowParams:t==null?void 0:t.flowParams,htmlFrameRef:u,htmlFrameVersion:d}),i.jsx(vJ,{nodeId:e,data:t})]})}function _J({id:e,data:t,selected:n,deleteNode:r}){var d,f,p;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],o=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],a=((f=(d=t==null?void 0:t.runningRunNodeIds)==null?void 0:d.has)==null?void 0:f.call(d,e))||((p=t==null?void 0:t.runningRunNodeIds)==null?void 0:p[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,y)=>{if(h.showOnNode===!1)return null;const v=`${2.25+y*1.75}rem`,w=h.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(Yn,{type:"target",position:Ue.Left,id:`input-${y}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:v,background:Pn(h.type)},title:`${w} · ${h.type}`})]},`in-${y}`)}),o.map((h,y)=>{if(h.showOnNode===!1)return null;const v=`${2.25+y*1.75}rem`,w=h.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(Yn,{type:"source",position:Ue.Right,id:`output-${y}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:v,background:Pn(h.type)},title:`${w} · ${h.type}`})]},`out-${y}`)}),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 y,v;h.stopPropagation(),a?(y=t==null?void 0:t.onStopWorkspaceNode)==null||y.call(t,e):(v=t==null?void 0:t.onRunWorkspaceNode)==null||v.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 y;h.stopPropagation(),(y=t==null?void 0:t.onOptimizeWorkspaceRun)==null||y.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 y;h.stopPropagation(),(y=t==null?void 0:t.onOpenWorkspaceRunLogs)==null||y.call(t,{nodeId:e,runNodeId:e,scheduleNodeId:"",label:(t==null?void 0:t.label)||"Run"})},children:i.jsx("span",{className:"material-symbols-outlined",children:"article"})})]})]})}function EJ({id:e,data:t,selected:n,deleteNode:r,skills:s,skillCollections:o,workspaces:a}){var Ze,Ne,St,Jt,Vt,ot,On;const l=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],c=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],u=VJ(t),[d,f]=m.useState(u.task),p=m.useRef(!1),h=m.useRef(u.task),y=((Ne=(Ze=t==null?void 0:t.runningRunNodeIds)==null?void 0:Ze.has)==null?void 0:Ne.call(Ze,e))||((St=t==null?void 0:t.runningRunNodeIds)==null?void 0:St[e])===!0||(t==null?void 0:t.isExecuting)||(t==null?void 0:t.nodeStatus)==="running",v=(t==null?void 0:t.nodeStatus)==="stopped",w=!!(t!=null&&t.readOnly),g=Array.isArray(s)?s:[],k=Array.isArray(o)?o:[],b=m.useMemo(()=>(Array.isArray(a)?a:[]).map(se=>({id:String((se==null?void 0:se.id)||""),label:String((se==null?void 0:se.label)||(se==null?void 0:se.name)||"知识库"),kind:(se==null?void 0:se.kind)==="git"?"git":"local",path:String((se==null?void 0:se.path)||""),repoUrl:String((se==null?void 0:se.repoUrl)||""),branch:String((se==null?void 0:se.branch)||""),mountPath:String((se==null?void 0:se.mountPath)||""),builtin:(se==null?void 0:se.builtin)===!0,exists:(se==null?void 0:se.exists)!==!1,type:String((se==null?void 0:se.type)||"")})).filter(se=>se.path),[a]),[j,N]=m.useState(!1),[C,I]=m.useState(""),[R,H]=m.useState(()=>new Set),[A,L]=m.useState(!1),[D,O]=m.useState(""),[M,K]=m.useState("config"),z=mg(t),F=!!z,$=bM(u.displayType),W=m.useMemo(()=>lJ(t,$),[t==null?void 0:t.displaySize,t==null?void 0:t.nodeSize,t==null?void 0:t.inputs,t==null?void 0:t.input,$]),E=m.useMemo(()=>({...t,sourceNodeId:e,label:t!=null&&t.label&&t.label!=="Context Run"?t.label:"一键任务",definitionId:$,displaySize:W,nodeSize:W,body:z,inputs:[{type:"text",name:$==="display_image"?"src":"content",value:z,default:z}],outputs:c.length?c:[{type:"node",name:"next",default:""}]}),[t,$,e,z,c,W]),Q=Array.isArray((Jt=t==null?void 0:t.modelLists)==null?void 0:Jt.cursor)?t.modelLists.cursor:[],V=Array.isArray((Vt=t==null?void 0:t.modelLists)==null?void 0:Vt.opencode)?t.modelLists.opencode:[],B=Array.isArray((ot=t==null?void 0:t.modelLists)==null?void 0:ot.claudeCode)?t.modelLists.claudeCode:[],re=Array.isArray((On=t==null?void 0:t.modelLists)==null?void 0:On.codex)?t.modelLists.codex:[],ue=m.useMemo(()=>new Set(Q.map(Ss)),[Q]),G=m.useMemo(()=>new Set(V.map(Ss)),[V]),ee=m.useMemo(()=>new Set(B.map(Ss)),[B]),te=m.useMemo(()=>new Set(re.map(Ss)),[re]),ne=u.model,Z=m.useMemo(()=>ne?ne.startsWith("cursor:")||ne.startsWith("opencode:")||ne.startsWith("codex:")||ne.startsWith("claude-code:")?ne:ee.has(ne)?`claude-code:${ne}`:te.has(ne)?`codex:${ne}`:G.has(ne)?`opencode:${ne}`:ue.has(ne)?`cursor:${ne}`:ne:"",[ee,te,ue,G,ne]),ce=ne.startsWith("cursor:")?ne.slice(7):ne.startsWith("opencode:")?ne.slice(9):ne.startsWith("codex:")?ne.slice(6):ne.startsWith("claude-code:")?ne.slice(12):ne,de=ce,me=!!ne&&!ue.has(de)&&!G.has(de)&&!ee.has(de)&&!te.has(de),$e=m.useMemo(()=>new Set(u.skillKeys),[u.skillKeys]),Ce=m.useMemo(()=>new Map(g.map(se=>[se.key,se])),[g]),_e=m.useMemo(()=>{const se=new Set,Ie=k.map(qe=>{const Et=ra(qe,g).map(vt=>Ce.get(vt)).filter(Boolean);for(const vt of Et)se.add(vt.key);return{...qe,skills:Et}}).filter(qe=>qe.skills.length>0),et=g.filter(qe=>!se.has(qe.key));return{collectionGroups:Ie,ungrouped:et}},[k,Ce,g]);m.useEffect(()=>{H(se=>{let Ie=!1;const et=new Set(se);for(const qe of _e.collectionGroups)et.has(qe.id)||(et.add(qe.id),Ie=!0);return Ie?et:se})},[_e.collectionGroups]);const Be=m.useMemo(()=>{const se=C.trim().toLowerCase();if(!se)return _e;const Ie=qe=>[qe==null?void 0:qe.key,qe==null?void 0:qe.name,qe==null?void 0:qe.description].map(Et=>String(Et||"").toLowerCase()).join(" ").includes(se);return{collectionGroups:_e.collectionGroups.map(qe=>{const Et=[qe==null?void 0:qe.id,qe==null?void 0:qe.name,qe==null?void 0:qe.description].map(vt=>String(vt||"").toLowerCase()).join(" ").includes(se);return{...qe,skills:Et?qe.skills:qe.skills.filter(Ie)}}).filter(qe=>qe.skills.length>0),ungrouped:_e.ungrouped.filter(Ie)}},[_e,C]),at=jb(j,[Be.collectionGroups.length,Be.ungrouped.length,R.size,u.skillKeys.length,C]),yt=m.useMemo(()=>{const se=D.trim().toLowerCase();return se?b.filter(Ie=>[Ie.id,Ie.label,Ie.path,Ie.repoUrl,Ie.branch,Ie.mountPath,Ie.type].join(" ").toLowerCase().includes(se)):b},[b,D]),Te=m.useMemo(()=>jM(u.knowledgeContext),[u.knowledgeContext]),it=m.useMemo(()=>new Set(Te.map(se=>se.id||se.path||se.repoPath).filter(Boolean)),[Te]),gt=jb(A,[yt.length,Te.length,D]);m.useEffect(()=>{u.task!==h.current&&(h.current=u.task,p.current||f(u.task))},[u.task]),m.useEffect(()=>{if(!F){K("config");return}y||K("result")},[F,z,y]),m.useEffect(()=>{var Ie,et;if(!(M==="result"&&F))return;(Ie=t==null?void 0:t.onEnsureWorkspaceNodeDisplaySize)==null||Ie.call(t,e,W),(et=t==null?void 0:t.onRefreshNodeInternals)==null||et.call(t,e);const se=window.setTimeout(()=>{var qe;return(qe=t==null?void 0:t.onRefreshNodeInternals)==null?void 0:qe.call(t,e)},120);return()=>window.clearTimeout(se)},[t==null?void 0:t.onEnsureWorkspaceNodeDisplaySize,t==null?void 0:t.onRefreshNodeInternals,$,F,e,z,W,M]);const $t=se=>{var Ie;(Ie=t==null?void 0:t.onChangeContextRunConfig)==null||Ie.call(t,e,{...u,task:d,...se})},be=(se=d)=>{var et;const Ie=String(se??"");Ie!==u.task&&(h.current=Ie,(et=t==null?void 0:t.onChangeContextRunConfig)==null||et.call(t,e,{...u,task:Ie}))},He=(se,Ie)=>{const et=new Set(u.skillKeys);for(const qe of se){const Et=String(qe||"").trim();Et&&(Ie?et.add(Et):et.delete(Et))}$t({skillKeys:Array.from(et)})},ie=se=>{H(Ie=>{const et=new Set(Ie);return et.has(se)?et.delete(se):et.add(se),et})},ke=(se,Ie)=>{const et=(se==null?void 0:se.id)||(se==null?void 0:se.path)||"";if(!et)return;const qe=b.filter(Et=>{const vt=Et.id||Et.path||"";return vt===et?Ie:it.has(vt)});$t({knowledgeContext:gg(qe)})},Fe=()=>{$t({knowledgeContext:null})};return M==="result"&&F?i.jsx(pM,{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"&&F?" af-work-context-run-card--result":"")+(y?" af-work-context-run-card--running":"")+((t==null?void 0:t.nodeStatus)==="success"?" af-work-context-run-card--done":"")+((t==null?void 0:t.nodeStatus)==="failed"?" af-work-context-run-card--failed":"")+(v?" af-work-context-run-card--stopped":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[l.map((se,Ie)=>{if(se.showOnNode===!1)return null;const et=`${2.25+Ie*1.75}rem`,qe=se.name||`#${Ie+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:et},children:qe}),i.jsx(Yn,{type:"target",position:Ue.Left,id:`input-${Ie}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:et,background:Pn(se.type)},title:`${qe} · ${se.type}`})]},`in-${Ie}`)}),c.map((se,Ie)=>{if(se.showOnNode===!1)return null;const et=`${2.25+Ie*1.75}rem`,qe=se.name||`#${Ie+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:et},children:qe}),i.jsx(Yn,{type:"source",position:Ue.Right,id:`output-${Ie}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:et,background:Pn(se.type)},title:`${qe} · ${se.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:se=>se.stopPropagation(),onMouseDown:se=>se.stopPropagation(),onClick:se=>se.stopPropagation(),children:[i.jsxs("select",{className:"af-work-context-run-card__model",value:Z,disabled:w,"aria-label":"模型",title:ce||"默认模型",onChange:se=>$t({model:se.target.value}),children:[i.jsx("option",{value:"",children:"默认"}),me?i.jsx("option",{value:ne,children:ne}):null,Q.length?i.jsx("optgroup",{label:"Cursor",children:Q.map(se=>i.jsx("option",{value:`cursor:${Ss(se)}`,children:Ss(se)},`context-cursor-${se}`))}):null,V.length?i.jsx("optgroup",{label:"OpenCode",children:V.map(se=>i.jsx("option",{value:`opencode:${Ss(se)}`,children:Ss(se)},`context-opencode-${se}`))}):null,re.length?i.jsx("optgroup",{label:"Codex",children:re.map(se=>i.jsx("option",{value:`codex:${Ss(se)}`,children:Ss(se)},`context-codex-${se}`))}):null,B.length?i.jsx("optgroup",{label:"Claude Code",children:B.map(se=>i.jsx("option",{value:`claude-code:${Ss(se)}`,children:Ss(se)},`context-claude-${se}`))}):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:ri(t==null?void 0:t.definitionId)?"workspace_one_click_task":(t==null?void 0:t.definitionId)||"workspace_one_click_task"}),F?i.jsxs("div",{className:"af-work-context-run-card__view-switch nodrag",onClick:se=>se.stopPropagation(),children:[i.jsx("button",{type:"button",className:M==="config"?"is-active":"",onClick:()=>K("config"),"aria-label":"切换到任务配置",children:i.jsx("span",{className:"material-symbols-outlined",children:"tune"})}),i.jsx("button",{type:"button",className:M==="result"?"is-active":"",onClick:()=>K("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:w,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:w,placeholder:"输入任务,例如:基于选中的知识库总结需求并生成展示页",onCompositionStart:()=>{p.current=!0},onCompositionEnd:se=>{p.current=!1,f(se.currentTarget.value),be(se.currentTarget.value)},onChange:se=>{f(se.target.value)},onBlur:se=>be(se.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:w,className:"af-work-context-run-card__select",onClick:se=>{var Ie;se.stopPropagation(),j||(Ie=t==null?void 0:t.onRefreshSkills)==null||Ie.call(t),N(et=>!et)},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"})]}),j?i.jsxs("div",{className:"af-work-context-run-card__skills-menu",onClick:se=>se.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:C,onChange:se=>I(se.target.value),placeholder:"搜索 Skills...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Skills"}),C?i.jsx("button",{type:"button",onClick:()=>I(""),"aria-label":"清空搜索",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),i.jsxs("div",{ref:at.menuRef,className:"af-work-load-skills-menu af-work-context-run-card__menu-scroll",onScroll:at.updateMenuScrollbar,children:[Be.collectionGroups.map(se=>{const Ie=se.skills.map(vt=>vt.key),et=Ie.filter(vt=>$e.has(vt)).length,qe=Ie.length>0&&et===Ie.length,Et=R.has(se.id);return i.jsxs("section",{className:"af-work-load-skills-menu__group"+(Et?" 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:qe,disabled:w,onChange:vt=>He(Ie,vt.target.checked),"aria-label":`选择 ${se.name}`}),i.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-toggle",onClick:()=>ie(se.id),"aria-expanded":!Et,children:i.jsxs("span",{className:"af-work-load-skills-menu__group-main",children:[i.jsx("span",{children:se.name}),se.description?i.jsx("em",{children:se.description}):null]})}),i.jsxs("small",{children:[et,"/",Ie.length]}),i.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-arrow",onClick:()=>ie(se.id),"aria-label":Et?`展开 ${se.name}`:`收起 ${se.name}`,children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Et?"chevron_right":"expand_more"})})]}),Et?null:i.jsx("div",{className:"af-work-load-skills-menu__options",children:se.skills.map(vt=>i.jsxs("label",{className:"af-work-load-skills-menu__option",children:[i.jsx("input",{type:"checkbox",checked:$e.has(vt.key),disabled:w,onChange:Jn=>He([vt.key],Jn.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:vt.name}),vt.description?i.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:vt.description}):null]})]},`${se.id}:${vt.key}`))})]},se.id)}),Be.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:Be.ungrouped.length})]}),i.jsx("div",{className:"af-work-load-skills-menu__options",children:Be.ungrouped.map(se=>i.jsxs("label",{className:"af-work-load-skills-menu__option",children:[i.jsx("input",{type:"checkbox",checked:$e.has(se.key),disabled:w,onChange:Ie=>He([se.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:se.name}),se.description?i.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:se.description}):null]})]},`ungrouped:${se.key}`))})]}):null,Be.collectionGroups.length===0&&Be.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:()=>$t({skillKeys:[]}),children:"清空"})]}),i.jsx("div",{ref:at.scrollbarTrackRef,className:"af-work-load-skills-scrollbar"+(at.scrollbar.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:at.handleScrollbarPointerDown,"aria-hidden":"true",children:i.jsx("span",{style:{height:`${at.scrollbar.height}%`,top:`${at.scrollbar.top}%`}})})]}):null]}),i.jsxs("div",{className:"af-work-context-run-card__workspace",children:[i.jsxs("button",{type:"button",disabled:w,className:"af-work-context-run-card__select",onClick:se=>{var Ie;se.stopPropagation(),A||(Ie=t==null?void 0:t.onRefreshWorkspaces)==null||Ie.call(t),L(et=>!et)},children:[i.jsx("span",{className:"material-symbols-outlined",children:Te.length?"folder_open":"folder_off"}),i.jsx("span",{children:Te.length?`${Te.length} 知识库`:"知识库"}),i.jsx("span",{className:"material-symbols-outlined",children:"expand_more"})]}),A?i.jsxs("div",{className:"af-work-context-run-card__workspace-menu",onClick:se=>se.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:se=>O(se.target.value),placeholder:"搜索知识库...",spellCheck:!1,autoComplete:"off","aria-label":"搜索知识库"}),D?i.jsx("button",{type:"button",onClick:()=>O(""),"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:[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:yt.length})]}),i.jsx("div",{className:"af-work-load-skills-menu__options",children:yt.map(se=>i.jsxs("label",{className:"af-work-load-skills-menu__option",children:[i.jsx("input",{type:"checkbox",checked:it.has(se.id||se.path),disabled:w,onChange:Ie=>ke(se,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:se.label}),i.jsxs("span",{className:"af-work-load-skills-menu__option-desc",children:[se.kind==="git"&&se.repoUrl?`${se.repoUrl}${se.branch?` · ${se.branch}`:""}${se.mountPath?` · ${se.mountPath}`:""}`:se.path,se.exists?"":" · 路径未就绪"]})]})]},`${se.id}:${se.path}`))})]}),yt.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:Fe,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("select",{value:u.displayType,disabled:w,onChange:se=>$t({displayType:se.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"})]})]}),z?i.jsx("pre",{className:"af-work-context-run-card__preview",children:z.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"+(y?" af-work-run-card__button--stop":""),disabled:w,onClick:se=>{var Ie,et;se.stopPropagation(),be(),y?(Ie=t==null?void 0:t.onStopWorkspaceNode)==null||Ie.call(t,e):(et=t==null?void 0:t.onRunWorkspaceNode)==null||et.call(t,e)},children:[i.jsx("span",{className:"material-symbols-outlined",children:y?"stop_circle":"play_arrow"}),i.jsx("span",{children:y?"Stop":"Run"})]}),i.jsx("button",{type:"button",className:"af-work-run-card__button af-work-context-run-card__logs nodrag",onClick:se=>{var Ie;se.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 AJ({id:e,data:t,selected:n,deleteNode:r}){var I,R,H;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],o=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],a=Nv((t==null?void 0:t.body)||""),[l,c]=m.useState(a.cron),u=(t==null?void 0:t.scheduledRunState)||{},d=((R=(I=t==null?void 0:t.runningRunNodeIds)==null?void 0:I.has)==null?void 0:R.call(I,e))||((H=t==null?void 0:t.runningRunNodeIds)==null?void 0:H[e])===!0||(t==null?void 0:t.isExecuting)||(t==null?void 0:t.nodeStatus)==="running",f=(t==null?void 0:t.optimizingRun)===!0,p=(t==null?void 0:t.nodeStatus)==="stopped",h=!!(t!=null&&t.readOnly),y=A=>{var L;(L=t==null?void 0:t.onChangeScheduledRunConfig)==null||L.call(t,e,{...a,...A})},v=A=>{y({scheduleType:A,cron:Zu(A,a.time,a.weekday,a.monthDay,a.cron)})},w=A=>{y({time:A,cron:Zu(a.scheduleType,A,a.weekday,a.monthDay,a.cron)})},[g,k]=jv(a.time).split(":"),b=(A,L)=>{w(`${Wo(A,9,0,23)}:${Wo(L,0,0,59)}`)},j=A=>{y({weekday:A,cron:Zu(a.scheduleType,a.time,A,a.monthDay,a.cron)})},N=A=>{y({monthDay:A,cron:Zu(a.scheduleType,a.time,a.weekday,A,a.cron)})};m.useEffect(()=>{c(a.cron)},[a.cron,e]);const C=()=>{h||l===a.cron||y({cron:l})};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":"")+(d?" af-work-run-card--running":"")+(t!=null&&t.isExecuting?" af-work-run-card--executing":"")+((t==null?void 0:t.nodeStatus)==="success"?" af-work-run-card--done":"")+((t==null?void 0:t.nodeStatus)==="failed"?" af-work-run-card--failed":"")+(p?" af-work-run-card--stopped":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[s.map((A,L)=>{if(A.showOnNode===!1)return null;const D=`${2.25+L*1.75}rem`,O=A.name||`#${L+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:D},children:O}),i.jsx(Yn,{type:"target",position:Ue.Left,id:`input-${L}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:D,background:Pn(A.type)},title:`${O} · ${A.type}`})]},`in-${L}`)}),o.map((A,L)=>{if(A.showOnNode===!1)return null;const D=`${2.25+L*1.75}rem`,O=A.name||`#${L+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:D},children:O}),i.jsx(Yn,{type:"source",position:Ue.Right,id:`output-${L}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:D,background:Pn(A.type)},title:`${O} · ${A.type}`})]},`out-${L}`)}),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:h,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:h,onChange:A=>y({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:h,onChange:A=>v(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:g,disabled:h,"aria-label":"小时",onChange:A=>b(A.target.value,k),children:Array.from({length:24},(A,L)=>Wo(L,0,0,23)).map(A=>i.jsxs("option",{value:A,children:[A," 时"]},A))}),i.jsx("select",{value:k,disabled:h,"aria-label":"分钟",onChange:A=>b(g,A.target.value),children:Array.from({length:12},(A,L)=>Wo(L*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:h,onChange:A=>j(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:h,onChange:A=>N(A.target.value),children:Array.from({length:31},(A,L)=>L+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:l,disabled:h,spellCheck:!1,placeholder:ef,onChange:A=>c(A.target.value),onBlur:C,onKeyDown:A=>{A.key==="Enter"&&A.currentTarget.blur()}})]}):null,i.jsxs("div",{className:"af-work-schedule-card__meta",children:[i.jsxs("span",{children:[GG(a.scheduleType)," ",a.scheduleType==="custom"?"":a.time]}),i.jsxs("span",{children:["Next ",YG(u.nextAt)]}),i.jsx("span",{children:d?"running":u.lastStatus||"idle"})]}),u.lastError?i.jsx("div",{className:"af-work-schedule-card__error",children:u.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"+(d?" af-work-run-card__button--stop":""),disabled:h||f,onClick:A=>{var L,D;A.stopPropagation(),d?(L=t==null?void 0:t.onStopWorkspaceNode)==null||L.call(t,e):(D=t==null?void 0:t.onRunWorkspaceNode)==null||D.call(t,e)},children:[i.jsx("span",{className:"material-symbols-outlined",children:d?"stop_circle":"play_arrow"}),i.jsx("span",{children:d?"停止":"立即运行"})]}),i.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-schedule-card__optimize nodrag"+(f?" af-work-schedule-card__optimize--running":""),disabled:h||d||f,title:"为下游节点提前生成 implementation",onClick:A=>{var L;A.stopPropagation(),(L=t==null?void 0:t.onOptimizeWorkspaceSchedule)==null||L.call(t,e)},children:[i.jsx("span",{className:"material-symbols-outlined",children:f?"sync":"auto_fix_high"}),i.jsx("span",{children:f?"优化中":"优化"})]}),i.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-schedule-card__logs nodrag",onClick:A=>{var L;A.stopPropagation(),(L=t==null?void 0:t.onOpenWorkspaceRunLogs)==null||L.call(t,{nodeId:e,scheduleNodeId:e,runNodeId:u.targetRunNodeId||e,lastRunId:u.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 PJ({id:e,data:t,selected:n,deleteNode:r}){const{setNodes:s}=Uc(),o=!!(t!=null&&t.readOnly),a=bb(t==null?void 0:t.nodeSize)||{width:rl,height:sl},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(f=>gM(f,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(Gk,{className:"af-work-group-node__resize nodrag",minWidth:rl,minHeight:sl,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 IJ(e){var y,v,w,g,k,b,j,N,C,I,R,H,A,L,D,O,M,K,z,F,$,W,E,Q,V,B,re,ue;const{setEdges:t,setNodes:n}=Uc(),r=(y=e.data)==null?void 0:y.onSyncNodePropDraft,s=!!((v=e.data)!=null&&v.readOnly),[o,a]=m.useState(!1),l=(w=e.data)!=null&&w.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(G=>{var ne,Z,ce;if(s)return;(Z=(ne=e.data)==null?void 0:ne.onCleanupWorkspaceNodeOutputs)==null||Z.call(ne,G,e.data);const ee=ri((ce=e.data)==null?void 0:ce.definitionId)?kM(G):"",te=new Set([G,ee].filter(Boolean));n(de=>de.filter(me=>!te.has(me.id))),t(de=>de.filter(me=>!te.has(me.source)&&!te.has(me.target)))},[e.data,s,t,n]),u=m.useCallback(G=>{var ee,te;G.button!==0||G.metaKey||G.ctrlKey||G.shiftKey||(te=(ee=G.target)==null?void 0:ee.closest)!=null&&te.call(ee,".react-flow__handle, .af-work-display-resize")||(n(ne=>gM(ne,e.id)),t(ne=>$J(ne)))},[e.id,t,n]),d=m.useCallback((G,ee)=>{s||(n(te=>te.map(ne=>ne.id===G?{...ne,data:{...ne.data,model:ee}}:ne)),r==null||r(G,{model:ee}))},[s,n,r]),f=m.useCallback((G,ee)=>{s||(n(te=>te.map(ne=>{var ce;if(ne.id!==G)return ne;const Z=Array.isArray((ce=ne.data)==null?void 0:ce.outputs)&&ne.data.outputs.length?ne.data.outputs.map((de,me)=>me===0?{...de,default:ee,value:ee}:de):[{type:"bool",name:"value",default:ee,value:ee}];return{...ne,data:{...ne.data,body:"",outputs:Z}}})),r==null||r(G,te=>({body:"",outputs:Array.isArray(te==null?void 0:te.outputs)&&te.outputs.length?te.outputs.map((Z,ce)=>ce===0?{...Z,default:ee,value:ee}:Z):[{type:"bool",name:"value",default:ee,value:ee}]})))},[s,n,r]),p=m.useCallback((G,ee)=>{s||(n(te=>te.map(ne=>ne.id===G?{...ne,data:{...ne.data,body:ee}}:ne)),r==null||r(G,{body:ee}))},[s,n,r]),h=m.useCallback((G,ee)=>{if(s)return;const te=yo(ee);n(ne=>ne.map(Z=>Z.id===G?{...Z,data:{...Z.data,images:te}}:Z)),r==null||r(G,{images:te})},[s,n,r]);return(g=e.data)!=null&&g.isWorkspaceGroup?i.jsx(PJ,{...e,deleteNode:c}):ol((k=e.data)==null?void 0:k.definitionId)?i.jsx(pM,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):((b=e.data)==null?void 0:b.definitionId)==="workspace_run"?i.jsx(_J,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):((j=e.data)==null?void 0:j.definitionId)==="workspace_scheduled_run"?i.jsx(AJ,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):ri((N=e.data)==null?void 0:N.definitionId)?i.jsx(EJ,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,skills:(C=e.data)==null?void 0:C.skills,skillCollections:(I=e.data)==null?void 0:I.skillCollections,workspaces:(R=e.data)==null?void 0:R.workspaceTargets}):((H=e.data)==null?void 0:H.definitionId)==="control_load_skills"?i.jsx(XJ,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,skills:(A=e.data)==null?void 0:A.skills,skillCollections:(L=e.data)==null?void 0:L.skillCollections,onChangeSkillKeys:(D=e.data)==null?void 0:D.onChangeLoadSkillKeys}):((O=e.data)==null?void 0:O.definitionId)==="control_load_mcp"?i.jsx(QJ,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,servers:(M=e.data)==null?void 0:M.mcpServers,onChangeMcpNames:(K=e.data)==null?void 0:K.onChangeLoadMcpNames}):((z=e.data)==null?void 0:z.definitionId)==="control_cd_workspace"?i.jsx(ZJ,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,workspaces:(F=e.data)==null?void 0:F.workspaceTargets,onChangeWorkspace:($=e.data)==null?void 0:$.onChangeLoadWorkspace,onRefreshWorkspaces:(W=e.data)==null?void 0:W.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":"")+(((B=e.data)==null?void 0:B.nodeStatus)==="failed"?" af-work-flow-node--failed":"")+(((re=e.data)==null?void 0:re.nodeStatus)==="stopped"?" af-work-flow-node--stopped":""),style:l?{width:l.width,height:l.height}:void 0,onPointerDownCapture:u,children:[s?null:i.jsx(Gk,{className:"af-work-display-resize af-work-flow-resize nodrag",position:"bottom-right",minWidth:WT,minHeight:hm,maxWidth:VT,maxHeight:KT,onResizeStart:()=>a(!0),onResizeEnd:()=>a(!1),children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),i.jsx(hU,{...e,deleteNode:c,deferTextCommit:!0,modelLists:(ue=e.data)==null?void 0:ue.modelLists,onModelChange:d,onProvideValueChange:f,onNodeBodyChange:p,onNodeImagesChange:h})]})}const RJ={[kc]:m.memo(IJ)};function Cv(e,t=[]){for(const n of e||[])n.type==="file"&&t.push(n),Array.isArray(n.children)&&Cv(n.children,t);return t}function hM(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)?hM(r.children,n):null;if(s)return s}return null}function TJ(e){const t=String(e||"").replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");return!t||!t.includes("/")?"":t.split("/").slice(0,-1).join("/")}function mM(e,t=[]){for(const n of e||[])n.type==="directory"&&(t.push(n.path),Array.isArray(n.children)&&mM(n.children,t));return t}function Kp(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 MJ(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 gM(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:MJ(e,n)}function $J(e){let t=!1;const n=(e||[]).map(r=>r.selected?(t=!0,{...r,selected:!1}):r);return t?n:e}function LJ(e){return[...e||[]].sort((t,n)=>t.type!==n.type?t.type==="directory"?-1:1:String(t.name||"").localeCompare(String(n.name||"")))}function OJ(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 f=!1;const p=(Array.isArray(o)?o:[]).map(h=>h.name!==c?h:(f=!0,d?{...h,type:"file",name:c,path:u,icon:cc(c),size:n}:{...h,type:"directory",name:c,path:u,icon:cc(c,!0),children:s(h.children||[],a+1,u)}));return f||p.push(d?{type:"file",name:c,path:u,icon:cc(c),size:n}:{type:"directory",name:c,path:u,icon:cc(c,!0),children:s([],a+1,u)}),LJ(p)};return s(e||[],0,"")}function DJ(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 yM({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",f=d&&(r==null?void 0:r.has(u.path)),p=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+(p?" af-work-file--selected":""),draggable:!d,onDragStart:y=>{d||a==null||a(y,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:f?"chevron_right":"expand_more"}):null,i.jsx("span",{className:"material-symbols-outlined",children:u.icon||cc(u.name,d)}),i.jsx("span",{children:u.name})]}),p?i.jsxs("div",{className:"af-work-file-actions",children:[d?null:i.jsx("button",{type:"button",className:"af-work-file-action",onClick:y=>{y.stopPropagation(),c==null||c(u)},"aria-label":`下载 ${u.name}`,title:`下载 ${u.path}`,children: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:y=>{y.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&&!f&&((h=u.children)!=null&&h.length)?i.jsx(yM,{items:u.children,onOpen:t,selectedPath:n,collapsedDirs:r,onToggleDir:s,onSelect:o,onFileDragStart:a,onDelete:l,onDownload:c}):null]},u.path)})})}function FJ({files:e,query:t,onQueryChange:n,onSelect:r,onUpload:s,onClose:o}){const a=m.useMemo(()=>Cv(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||cc(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:DJ(u.size)}):null]},u.path)),c.length===0?i.jsx("div",{className:"af-work-file-picker-modal__empty",children:"没有匹配文件,可先上传或调整搜索词。"}):null]})]})]})})}function JC({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 wM(e){const t=String((e==null?void 0:e.kind)||"");return["run-log","run-summary","activity","prompt","raw","thinking"].includes(t)}function zJ(e,t=!1){const n=Array.isArray(e)?e:[],r=n.filter(o=>!wM(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 BJ(e){return(Array.isArray(e)?e:[]).filter(wM)}function nf(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 HJ(e){const t=nf((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 nf((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function WJ(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 nf((n==null?void 0:n.default)||(n==null?void 0:n.value)||"")}function xM(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 XC(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function oa(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 Sm(e,t){const n=oa(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 Ss(e){const t=String(e||""),n=t.indexOf(" - ");return n>=0?t.slice(0,n).trim():t.trim()}function bM(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 kM(e){return`${String(e||"context_run").trim()||"context_run"}__display`}function vM(e){return e==="display_image"?"src":"content"}function QC(e,t,n){const r=vM(t),s=ed(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 ZC(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 e_(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 mg(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 VJ(e){const t=Array.isArray(e==null?void 0:e.inputs)?e.inputs:[],n=oa(t,"includeWorkspaceContext","true").toLowerCase(),r=Sm(t,"knowledgeContext"),s=Sm(t,"workspaceContext");return{task:String((e==null?void 0:e.body)||""),skillKeys:WJ(e),includeWorkspaceContext:n!=="false"&&n!=="0"&&n!=="off",knowledgeContext:r||(s?gg([s]):null),workspaceContext:s,displayType:Sf(oa(t,"displayType","markdown")),model:String((e==null?void 0:e.model)||"").trim()}}function ri(e){const t=String(e||"");return t==="workspace_one_click_task"||t==="workspace_context_run"}function KJ(e){const t=nf((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 nf((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function qJ(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function SM(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 gg(e=[]){const t=(Array.isArray(e)?e:[e]).map((n,r)=>SM(n,r===0?"primary":"context")).filter(Boolean);return t.length?{version:1,sources:t}:null}function jM(e){return(e&&typeof e=="object"&&Array.isArray(e.sources)?e.sources:[]).map(n=>SM(n,(n==null?void 0:n.role)||"context")).filter(Boolean)}function UJ(e){const t=Array.isArray(e==null?void 0:e.inputs)?e.inputs:[],n=Sm(t,"knowledgeContext"),r=Sm(t,"workspaceContext");return{sources:jM(n||(r?gg([r]):null)),path:oa(t,"path",""),label:oa(t,"label","")}}function t_(e){var r,s,o,a,l,c,u,d,f;if(!e)return null;const{inputs:t,outputs:n}=_U(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:yo((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(((f=e.data)==null?void 0:f.implementationMode)??""),inputs:t,outputs:n}}function n_(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 r_(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 YJ(e,t,n){var d,f;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=Xd.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?[]:yo(t==null?void 0:t.images),inputs:r_(t==null?void 0:t.inputs),outputs:s&&Array.isArray((f=e.data)==null?void 0:f.outputs)?e.data.outputs:r_(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 p of["scriptRef","implementationRef","implementationMode"]){const h=String((t==null?void 0:t[p])??"").trim();h?c[p]=h:delete c[p]}return c}function s_({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(!JU.test(c))return{ok:!1,error:"Invalid instance id"};if(e.some(v=>v.id===c&&v.id!==a))return{ok:!1,error:"Duplicate instance id"}}const u=YJ(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(yo(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 p=e.map(v=>v.id===a?{...v,id:c,selected:!0,data:u}:v);let h=t,y=n;if(c!==a){y={...n||{}};const v={...y[a]||{}};delete y[a],y[c]=v,h=t.map((w,g)=>({...w,source:w.source===a?c:w.source,target:w.target===a?c:w.target,id:`we-${w.source===a?c:w.source}-${w.target===a?c:w.target}-${g}`}))}return{ok:!0,changed:!0,nextId:c,nodes:p,edges:h,instances:y}}function GJ(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function JJ(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"])GJ(e[s],t[s])&&(r[s]=n[s]);return r}function jb(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 f=Math.max(1,d.scrollHeight),p=Math.max(1,d.clientHeight),h=f>p+1,y=h?Math.max(12,p/f*100):100,v=Math.max(0,100-y),w=h?Math.min(v,d.scrollTop/Math.max(1,f-p)*v):0;o({visible:h,top:w,height:y})},[]);m.useEffect(()=>{if(!e)return;const d=requestAnimationFrame(a);return()=>cancelAnimationFrame(d)},[e,a,...t]);const l=m.useCallback(d=>{const f=n.current;if(!f)return;const p=Math.max(0,f.scrollHeight-f.clientHeight);f.scrollTop=Math.min(1,Math.max(0,d))*p,a()},[a]),c=m.useCallback((d,f=0)=>{const p=r.current;if(!p)return 0;const h=p.getBoundingClientRect(),y=s.height/100*h.height,v=Math.max(1,h.height-y);return(d-h.top-f)/v},[s.height]),u=m.useCallback(d=>{var j,N;if(!s.visible)return;d.preventDefault(),d.stopPropagation();const f=r.current;if(!f)return;const p=f.getBoundingClientRect(),h=s.top/100*p.height,y=s.height/100*p.height,w=d.clientY>=p.top+h&&d.clientY<=p.top+h+y?d.clientY-p.top-h:y/2;l(c(d.clientY,w));const g=d.pointerId;(N=(j=d.currentTarget).setPointerCapture)==null||N.call(j,g);const k=C=>{C.preventDefault(),l(c(C.clientY,w))},b=()=>{window.removeEventListener("pointermove",k),window.removeEventListener("pointerup",b),window.removeEventListener("pointercancel",b)};window.addEventListener("pointermove",k),window.addEventListener("pointerup",b),window.addEventListener("pointercancel",b)},[c,l,s.height,s.top,s.visible]);return{menuRef:n,scrollbarTrackRef:r,scrollbar:s,updateMenuScrollbar:a,handleScrollbarPointerDown:u}}function XJ({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:[],[f,p]=m.useState(!1),[h,y]=m.useState(""),[v,w]=m.useState(()=>new Set),g=m.useRef(null),k=m.useRef(null),[b,j]=m.useState({visible:!1,top:0,height:100}),N=m.useMemo(()=>new Set(HJ(t)),[t]),C=m.useMemo(()=>new Map(u.map(F=>[F.key,F])),[u]),I=m.useMemo(()=>Array.from(N).map(F=>{var $;return(($=C.get(F))==null?void 0:$.name)||F}),[C,N]),R=m.useMemo(()=>xM(I,"选择 Skills"),[I]),H=m.useMemo(()=>{const F=new Set,$=d.map(E=>{const Q=ra(E,u).map(V=>C.get(V)).filter(Boolean);for(const V of Q)F.add(V.key);return{...E,skills:Q}}).filter(E=>E.skills.length>0),W=u.filter(E=>!F.has(E.key));return{collectionGroups:$,ungrouped:W}},[C,d,u]);m.useEffect(()=>{w(F=>{let $=!1;const W=new Set(F);for(const E of H.collectionGroups)W.has(E.id)||(W.add(E.id),$=!0);return $?W:F})},[H.collectionGroups]);const A=m.useMemo(()=>{const F=h.trim().toLowerCase();if(!F)return H;const $=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(F);return{collectionGroups:H.collectionGroups.map(E=>{const V=[E==null?void 0:E.id,E==null?void 0:E.name,E==null?void 0:E.description].map(B=>String(B||"").toLowerCase()).join(" ").includes(F)?E.skills:E.skills.filter($);return{...E,skills:V}}).filter(E=>E.skills.length>0),ungrouped:H.ungrouped.filter($)}},[H,h]),L=m.useCallback((F,$)=>{const W=new Set(N);for(const E of F)$?W.add(E):W.delete(E);a==null||a(e,Array.from(W))},[e,N,a]),D=m.useCallback(F=>{w($=>{const W=new Set($);return W.has(F)?W.delete(F):W.add(F),W})},[]),O=m.useCallback(()=>{const F=g.current;if(!F)return;const $=Math.max(1,F.scrollHeight),W=Math.max(1,F.clientHeight),E=$>W+1,Q=E?Math.max(12,W/$*100):100,V=Math.max(0,100-Q),B=E?Math.min(V,F.scrollTop/Math.max(1,$-W)*V):0;j({visible:E,top:B,height:Q})},[]);m.useEffect(()=>{if(!f)return;const F=requestAnimationFrame(O);return()=>cancelAnimationFrame(F)},[v,A,N.size,f,O]);const M=m.useCallback(F=>{const $=g.current;if(!$)return;const W=Math.max(0,$.scrollHeight-$.clientHeight);$.scrollTop=Math.min(1,Math.max(0,F))*W,O()},[O]),K=m.useCallback((F,$=0)=>{const W=k.current;if(!W)return 0;const E=W.getBoundingClientRect(),Q=b.height/100*E.height,V=Math.max(1,E.height-Q);return(F-E.top-$)/V},[b.height]),z=m.useCallback(F=>{var ee,te;if(!b.visible)return;F.preventDefault(),F.stopPropagation();const $=k.current;if(!$)return;const W=$.getBoundingClientRect(),E=b.top/100*W.height,Q=b.height/100*W.height,B=F.clientY>=W.top+E&&F.clientY<=W.top+E+Q?F.clientY-W.top-E:Q/2;M(K(F.clientY,B));const re=F.pointerId;(te=(ee=F.currentTarget).setPointerCapture)==null||te.call(ee,re);const ue=ne=>{ne.preventDefault(),M(K(ne.clientY,B))},G=()=>{window.removeEventListener("pointermove",ue),window.removeEventListener("pointerup",G),window.removeEventListener("pointercancel",G)};window.addEventListener("pointermove",ue),window.addEventListener("pointerup",G),window.addEventListener("pointercancel",G)},[K,M,b.height,b.top,b.visible]);return i.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":"")+(f?" af-work-load-skills-card--menu-open":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[l.map((F,$)=>{if(F.showOnNode===!1)return null;const W=`${2.6+$*1.7}rem`,E=F.name||`#${$+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:W},children:E}),i.jsx(Yn,{type:"target",position:Ue.Left,id:`input-${$}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:W,background:Pn(F.type)},title:`${E} · ${F.type}`})]},`in-${$}`)}),c.map((F,$)=>{if(F.showOnNode===!1)return null;const W=`${2.6+$*1.7}rem`,E=F.name||`#${$+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:W},children:E}),i.jsx(Yn,{type:"source",position:Ue.Right,id:`output-${$}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:W,background:Pn(F.type)},title:`${E} · ${F.type}`})]},`out-${$}`)}),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:F=>{var $;F.stopPropagation(),f||($=t==null?void 0:t.onRefreshSkills)==null||$.call(t),p(W=>!W)},children:[i.jsxs("span",{className:"af-work-load-skills-card__summary",title:R.title,children:[i.jsx("span",{className:"af-work-load-skills-card__summary-main",children:R.head}),R.extra?i.jsx("span",{className:"af-work-load-skills-card__summary-extra",children:R.extra}):null]}),i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:f?"expand_less":"expand_more"})]}),f?i.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick:F=>F.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:F=>y(F.target.value),placeholder:"搜索 Skills...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Skills"}),h?i.jsx("button",{type:"button",onClick:()=>y(""),"aria-label":"清空搜索",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),i.jsxs("div",{ref:g,className:"af-work-load-skills-menu",onScroll:O,children:[A.collectionGroups.map(F=>{const $=F.skills.map(V=>V.key),W=$.filter(V=>N.has(V)).length,E=$.length>0&&W===$.length,Q=v.has(F.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=>L($,V.target.checked),"aria-label":`选择 ${F.name}`}),i.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-toggle",onClick:()=>D(F.id),"aria-expanded":!Q,children:i.jsxs("span",{className:"af-work-load-skills-menu__group-main",children:[i.jsx("span",{children:F.name}),F.description?i.jsx("em",{children:F.description}):null]})}),i.jsxs("small",{children:[W,"/",$.length]}),i.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-arrow",onClick:()=>D(F.id),"aria-label":Q?`展开 ${F.name}`:`收起 ${F.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:F.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:B=>L([V.key],B.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]})]},`${F.id}:${V.key}`))})]},F.id)}),A.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:A.ungrouped.length})]}),i.jsx("div",{className:"af-work-load-skills-menu__options",children:A.ungrouped.map(F=>i.jsxs("label",{className:"af-work-load-skills-menu__option",children:[i.jsx("input",{type:"checkbox",checked:N.has(F.key),onChange:$=>L([F.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:F.name}),F.description?i.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:F.description}):null]})]},`ungrouped:${F.key}`))})]}):null,A.collectionGroups.length===0&&A.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:k,className:"af-work-load-skills-scrollbar"+(b.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:z,"aria-hidden":"true",children:i.jsx("span",{style:{height:`${b.height}%`,top:`${b.top}%`}})})]}):null]})]})}function QJ({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,f]=m.useState(""),p=m.useMemo(()=>new Set(KJ(t)),[t]),h=m.useMemo(()=>(Array.isArray(s)?s:[]).map(w=>({name:String((w==null?void 0:w.name)||""),description:String((w==null?void 0:w.description)||""),detail:String((w==null?void 0:w.url)||[w==null?void 0:w.command,...Array.isArray(w==null?void 0:w.args)?w.args:[]].filter(Boolean).join(" ")||""),type:String((w==null?void 0:w.type)||"")})).filter(w=>w.name),[s]),y=m.useMemo(()=>{const w=d.trim().toLowerCase();return w?h.filter(g=>[g.name,g.description,g.detail,g.type].join(" ").toLowerCase().includes(w)):h},[d,h]),v=m.useCallback((w,g)=>{const k=new Set(p);for(const b of w)g?k.add(b):k.delete(b);o==null||o(e,Array.from(k))},[e,p,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((w,g)=>{if(w.showOnNode===!1)return null;const k=`${2.6+g*1.7}rem`,b=w.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(Yn,{type:"target",position:Ue.Left,id:`input-${g}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:k,background:Pn(w.type)},title:`${b} · ${w.type}`})]},`in-${g}`)}),l.map((w,g)=>{if(w.showOnNode===!1)return null;const k=`${2.6+g*1.7}rem`,b=w.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(Yn,{type:"source",position:Ue.Right,id:`output-${g}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:k,background:Pn(w.type)},title:`${b} · ${w.type}`})]},`out-${g}`)}),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:w=>{var g;w.stopPropagation(),c||(g=t==null?void 0:t.onRefreshMcps)==null||g.call(t),u(k=>!k)},children:[i.jsx("span",{children:p.size>0?`${p.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:w=>w.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:w=>f(w.target.value),placeholder:"搜索 MCP...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 MCP"}),d?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",{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:y.length})]}),i.jsx("div",{className:"af-work-load-skills-menu__options",children:y.map(w=>i.jsxs("label",{className:"af-work-load-skills-menu__option",children:[i.jsx("input",{type:"checkbox",checked:p.has(w.name),onChange:g=>v([w.name],g.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:w.name}),w.description||w.detail?i.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:w.description||w.detail}):null]})]},w.name))})]}),y.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 ZJ({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),[f,p]=m.useState(""),h=UJ(t),y=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]),v=m.useMemo(()=>{const N=f.trim().toLowerCase();return N?y.filter(C=>[C.id,C.label,C.path,C.repoUrl,C.branch,C.mountPath].join(" ").toLowerCase().includes(N)):y},[f,y]),w=m.useMemo(()=>new Set((h.sources||[]).map(N=>N.id||N.path||N.repoPath).filter(Boolean)),[h.sources]),g=m.useMemo(()=>(h.sources||[]).map(N=>N.label||N.id||N.mountPath||N.path),[h.sources]),k=m.useMemo(()=>xM(g,"选择知识库"),[g]),b=jb(u,[v.length,g.length,f]),j=(N,C)=>{const I=(N==null?void 0:N.id)||(N==null?void 0:N.path)||"",R=y.filter(H=>{const A=H.id||H.path||"";return A===I?C:w.has(A)});o==null||o(e,R)};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,C)=>{if(N.showOnNode===!1)return null;const I=`${2.6+C*1.7}rem`,R=N.name||`#${C+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:I},children:R}),i.jsx(Yn,{type:"target",position:Ue.Left,id:`input-${C}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:I,background:Pn(N.type)},title:`${R} · ${N.type}`})]},`in-${C}`)}),c.map((N,C)=>{if(N.showOnNode===!1)return null;const I=`${2.6+C*1.7}rem`,R=N.name||`#${C+1}`;return i.jsxs(m.Fragment,{children:[i.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:I},children:R}),i.jsx(Yn,{type:"source",position:Ue.Right,id:`output-${C}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:I,background:Pn(N.type)},title:`${R} · ${N.type}`})]},`out-${C}`)}),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(C=>!C)},children:[i.jsxs("span",{className:"af-work-load-skills-card__summary",title:k.title,children:[i.jsx("span",{className:"af-work-load-skills-card__summary-main",children:k.head}),k.extra?i.jsx("span",{className:"af-work-load-skills-card__summary-extra",children:k.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:f,onChange:N=>p(N.target.value),placeholder:"搜索知识库...",spellCheck:!1,autoComplete:"off","aria-label":"搜索知识库"}),f?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",{ref:b.menuRef,className:"af-work-load-skills-menu",onScroll:b.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:v.length})]}),i.jsx("div",{className:"af-work-load-skills-menu__options",children:v.map(N=>i.jsxs("label",{className:"af-work-load-skills-menu__option",children:[i.jsx("input",{type:"checkbox",checked:w.has(N.id||N.path),onChange:C=>j(N,C.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}`))})]}),v.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:b.scrollbarTrackRef,className:"af-work-load-skills-scrollbar"+(b.scrollbar.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:b.handleScrollbarPointerDown,"aria-hidden":"true",children:i.jsx("span",{style:{height:`${b.scrollbar.height}%`,top:`${b.scrollbar.top}%`}})})]}):null]})]})}function NM({row:e,index:t=0,child:n=!1}){const r=(e==null?void 0:e.issue)||{},s=RT(r),o=aY(NG(r)),a=s?o.filter(p=>!["issue","mr"].includes(dm(p))):o,l=cY(r,o),c=Ii(r,t),u=s?"":Da(r.platform),d=Array.isArray(e==null?void 0:e.children)?e.children.length:0,f=[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:vG(r,t)}),i.jsx("small",{children:f.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(p=>i.jsx("a",{href:p.href,target:"_blank",rel:"noreferrer",children:p.label},`${p.label}-${p.href}`))}):null,d?i.jsx("div",{className:"af-prd-workflow-issue__children",children:e.children.map((p,h)=>i.jsx(NM,{row:p,index:h,child:!0},Ii((p==null?void 0:p.issue)||{},h)))}):null]})}function CM(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 _M(e){return(Array.isArray(e)?e:e==null||e===""?[]:[e]).map(n=>CM(n)).filter(Boolean)}function eX({fieldKey:e,field:t}){if(!t||typeof t!="object"||Array.isArray(t))return null;const n=String(t.label||e||"").trim(),r=String(t.type||"text").trim().toLowerCase(),s=["text","user","chips","list","link"].includes(r)?r:"text",o=_M(t.value);if(!o.length)return null;if(s==="list")return i.jsxs("div",{className:"af-prd-overall-platform__rules",children:[i.jsx("small",{children:n}),i.jsx("ul",{children:o.map((a,l)=>i.jsx("li",{children:a},`${e}-${l}-${a}`))})]});if(s==="link"){const a=t.value&&typeof t.value=="object"&&!Array.isArray(t.value)?t.value:{},l=String(t.href||t.url||a.href||a.url||"").trim();return i.jsxs("div",{className:"af-prd-overall-platform__row af-prd-overall-platform__row--link",children:[i.jsx("small",{children:n}),l?i.jsxs("a",{href:l,target:"_blank",rel:"noreferrer",children:[i.jsx("span",{children:o[0]}),i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"})]}):i.jsx("strong",{children:o[0]})]})}return i.jsxs("div",{className:`af-prd-overall-platform__row af-prd-overall-platform__row--${s}`,children:[i.jsx("small",{children:n}),i.jsx("div",{children:o.map((a,l)=>i.jsx("span",{children:a},`${e}-${l}-${a}`))})]})}function tX({sectionKey:e,section:t}){if(!t||typeof t!="object"||Array.isArray(t))return null;const r=(t.fields&&typeof t.fields=="object"&&!Array.isArray(t.fields)?Object.entries(t.fields):[]).filter(([,o])=>o&&typeof o=="object"&&_M(o.value).length);if(!r.length)return null;const s=e==="progress";return i.jsxs("section",{className:`af-prd-overall-platform${s?" af-prd-overall-platform--compact":""}`,children:[i.jsx("div",{className:"af-prd-overall-platform__head",children:i.jsx("strong",{children:String(t.title||e||"").trim()})}),i.jsx("div",{className:"af-prd-overall-platform__fields",children:r.map(([o,a])=>i.jsx(eX,{fieldKey:o,field:a},o))})]})}function nX({globalState:e,tapdId:t}){const n=e&&typeof e=="object"&&!Array.isArray(e)?e:{},r=n.workflow&&typeof n.workflow=="object"&&!Array.isArray(n.workflow)?n.workflow:{},s=n.sections&&typeof n.sections=="object"&&!Array.isArray(n.sections)?n.sections:{},o=String(n.title||"").trim(),a=String(n.url||"").trim(),l=CM(n.status),c=String(r.id||t||"").trim(),u=Object.entries(s).filter(([f,p])=>f&&p&&typeof p=="object"&&!Array.isArray(p)),d=!!(o||a||l||u.length);return!c&&!d?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:"需求概览"}),l?i.jsx("span",{className:"af-prd-overall__status",children:l}):null]}),o||a||c?i.jsx("div",{className:"af-prd-overall__requirement",children:a?i.jsxs("a",{href:a,target:"_blank",rel:"noreferrer",children:[i.jsx("strong",{children:o||`${r.namespace||"Workflow"} ${c}`}),i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"})]}):i.jsx("strong",{children:o||`${r.namespace==="tapd"?"TAPD":"Workflow"} ${c}`})}):null,d?i.jsx("div",{className:"af-prd-overall__platforms",children:u.map(([f,p])=>i.jsx(tX,{sectionKey:f,section:p},f))}):i.jsx("p",{className:"af-prd-workflow-muted",children:"暂无全局状态。各阶段可通过 Workflow 上报逐步补充负责人、配置、规则和其它上下文。"})]})}function rX({flowParams:e={},tapdId:t,setTapdId:n,snapshot:r,loading:s,error:o,actionRunning:a,actionOutput:l,pendingConfirm:c,conflict:u,reviewPublishing:d,onRefresh:f,onRunDryRun:p,onConfirmAction:h,onRetryConflict:y,onPublishReview:v}){const[w,g]=m.useState("all"),[k,b]=m.useState("all"),[j,N]=m.useState(!1),[C,I]=m.useState(!1),[R,H]=m.useState(!1),[A,L]=m.useState(""),[D,O]=m.useState(!1),[M,K]=m.useState(""),[z,F]=m.useState(null),$=String((r==null?void 0:r.phase)||(t?"unavailable":"unselected")),W=Array.isArray(r==null?void 0:r.issues)?r.issues:[],E=CG(r),Q=E.reduce((be,He)=>be+pb(He.issues),0),V=Array.isArray(r==null?void 0:r.artifacts)?r.artifacts:[];Array.isArray(r==null?void 0:r.optionalGaps)&&r.optionalGaps;const B=r!=null&&r.nextAction&&typeof r.nextAction=="object"?r.nextAction:null,re=PG(r,B),ue=bG(r,re),G=V.filter(be=>!MT({...be,href:vc(be)})),ee=m.useMemo(()=>yG(re),[re]);m.useEffect(()=>{k!=="all"&&(ee.some(be=>be.key===k)||b("all"))},[k,ee]);const te=re.filter(be=>wG(be,k)),ne=mG(te),Z=IG(r),ce=Z.filter(be=>RG(be,w)),de=te.filter(be=>bv(be)).length,me=r!=null&&r.collaboration&&typeof r.collaboration=="object"?r.collaboration:{},$e=me.activeAction&&typeof me.activeAction=="object"?me.activeAction:null;Array.isArray(r==null?void 0:r.clientObservations)&&r.clientObservations;const Ce=String((r==null?void 0:r.rawOutput)||""),_e=r!=null&&r.globalState&&typeof r.globalState=="object"?r.globalState:null,Be=aG($),at=m.useCallback(async()=>{const be=String(t||"").trim();if(!be){F(null);return}I(!0),L(""),K("");try{const He=new URLSearchParams({tapdId:be});e.workflowShare&&He.set("workflowShare",e.workflowShare);const ie=await fetch(`/api/prd-workflow/share?${He.toString()}`),ke=await ie.json().catch(()=>({}));if(!ie.ok)throw new Error(ke.error||"读取 Workflow 分享状态失败");let Fe=ke.share||null;const Ze=ke.canCreate===!0&&!e.workflowShare;if(O(Ze),!Fe&&Ze){const Ne=await fetch("/api/prd-workflow/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,tapdId:be})}),St=await Ne.json().catch(()=>({}));if(!Ne.ok)throw new Error(St.error||"生成 Workflow 分享链接失败");Fe=St.share||null}F(Fe)}catch(He){L(String(He.message||He))}finally{I(!1)}},[e,t]),yt=()=>{N(!0),at()},Te=async()=>{if(!(!t||R||e.workflowShare)){H(!0),L(""),K("");try{const be=await fetch("/api/prd-workflow/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,tapdId:t})}),He=await be.json().catch(()=>({}));if(!be.ok)throw new Error(He.error||"生成 Workflow 分享链接失败");F(He.share||null),O(!0)}catch(be){L(String(be.message||be))}finally{H(!1)}}},it=async()=>{const be=await vb((z==null?void 0:z.shortUrl)||(z==null?void 0:z.url)||"");K(be?"已复制":"复制失败")},gt=async()=>{if(!(!t||R||!(z!=null&&z.canManage))){H(!0),L(""),K("");try{const be=await fetch("/api/prd-workflow/share",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({tapdId:t})}),He=await be.json().catch(()=>({}));if(!be.ok)throw new Error(He.error||"取消 Workflow 分享链接失败");F(null),O(!0)}catch(be){L(String(be.message||be))}finally{H(!1)}}},$t=(z==null?void 0:z.shortUrl)||(z==null?void 0:z.url)||"";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--${$.toLowerCase().replace(/[^a-z0-9_-]+/gi,"_")}`,children:TC($)}),i.jsx("h1",{children:(r==null?void 0:r.pointer)||(t?"等待 prd-flow 返回状态":"选择 TAPD 需求后读取状态")}),i.jsx("p",{className:"af-prd-workflow__status-subtitle",children:t?i.jsxs(i.Fragment,{children:["TAPD ",i.jsx("strong",{children:t})," · 独立需求 Workflow"]}):i.jsx(i.Fragment,{children:"尚未选择 TAPD 需求"})}),o?i.jsx("p",{className:"af-prd-workflow-error",children:o}):null,$e||me.subscribers?i.jsxs("div",{className:"af-prd-workflow-collab",children:[$e?i.jsxs("span",{children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"lock"}),$e.title||$e.action||"Workflow action"," 执行中",$e.userId?i.jsx("small",{children:$e.userId}):null]}):null,me.subscribers?i.jsxs("span",{children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"group"}),me.subscribers," 个连接"]}):null]}):null]}),i.jsxs("form",{className:"af-prd-workflow__lookup",onSubmit:be=>{be.preventDefault(),f==null||f()},children:[i.jsx("div",{className:"af-prd-workflow-flow","aria-label":"需求流程阶段",children:Be.map(be=>i.jsxs("div",{className:`af-prd-workflow-flow__step af-prd-workflow-flow__step--${be.status}`,children:[i.jsx("span",{"aria-hidden":"true"}),i.jsx("small",{children:be.label})]},be.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:t,onChange:be=>n(be.target.value),placeholder:"输入需求 ID",autoComplete:"off",spellCheck:!1})]}),i.jsxs("button",{type:"submit",disabled:s,children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:s?"hourglass_empty":"sync"}),s?"读取中":t?"刷新":"读取"]}),i.jsxs("button",{type:"button",disabled:!t,onClick:yt,children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"share"}),"分享"]})]})]})]}),u?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:u.message||"当前 workflow 状态和执行前不一致。"})]})]}),i.jsxs("dl",{children:[i.jsxs("div",{children:[i.jsx("dt",{children:"执行时 revision"}),i.jsx("dd",{children:u.expectedRevision||"空"})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"当前 revision"}),i.jsx("dd",{children:u.currentRevision||"未知"})]}),i.jsxs("div",{children:[i.jsx("dt",{children:"当前状态"}),i.jsx("dd",{children:[TC(u.currentPhase),u.currentPointer].filter(Boolean).join(" · ")||"未知"})]})]}),i.jsx("div",{className:"af-prd-workflow-conflict__actions",children:i.jsx("button",{type:"button",onClick:()=>f==null?void 0:f(),disabled:s||a,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:re.length?`${de}/${te.length} 已完成${k!=="all"?` · 共 ${re.length}`:""}`:"等待 prd-flow 返回 action 列表"})]}),B&&ym(B)?i.jsxs("div",{className:"af-prd-workflow-local-command",children:[i.jsx("span",{children:"本地 agent 执行"}),i.jsx("code",{children:B.command||so(B,0)})]}):null]}),ee.length?i.jsxs("div",{className:"af-prd-workflow-action-filters","aria-label":"Action tag filters",children:[i.jsxs("button",{type:"button",className:k==="all"?"is-active":"","aria-pressed":k==="all",onClick:()=>b("all"),children:["全部 ",i.jsx("span",{children:re.length})]}),ee.map(be=>i.jsxs("button",{type:"button",className:k===be.key?"is-active":"","aria-pressed":k===be.key,onClick:()=>b(be.key),children:[be.label," ",i.jsx("span",{children:be.count})]},be.key))]}):null,i.jsx("div",{className:"af-prd-workflow-action-list",children:te.length?ne.map(be=>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:be.day}),i.jsx("small",{children:"北京时间"})]}),i.jsx("div",{className:"af-prd-workflow-action-day__items",children:be.items.map(({item:He,index:ie})=>{const ke=ha(He.status),Fe=sa(He)==="observation"&&ke==="done"?"observed":ke,Ze=vv(He),Ne=hG(He),St=xG(He),Jt=cG(He,ie),Vt=uG(He);return i.jsxs("div",{className:`af-prd-workflow-action af-prd-workflow-action--${Fe}`,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:[Ne?i.jsx("time",{dateTime:gm(He),children:Ne}):null,i.jsx("strong",{children:Jt})]}),Vt?i.jsx("p",{children:Vt}):null,St.length?i.jsx("div",{className:"af-prd-workflow-action__meta",children:St.map(ot=>i.jsxs("span",{children:[i.jsx("b",{children:ot.label}),ot.value]},`${ot.label}-${ot.value}`))}):null]}),i.jsx("span",{className:"af-prd-workflow-action__status",children:gG(He)})]}),Ze.length?i.jsx("div",{className:"af-prd-workflow-action__links",children:Ze.map(ot=>i.jsxs("a",{href:ot.href,target:"_blank",rel:"noreferrer",children:[i.jsx("span",{children:ot.label}),i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"})]},`${ot.label}-${ot.href}`))}):null]})]},He.id||He.actionId||`${so(He,ie)}-${ie}`)})})]},be.day)):i.jsxs("div",{className:"af-prd-workflow-action-empty",children:[i.jsx("strong",{children:t?re.length?"当前 tag 下暂无 action":"暂无 prd-flow 上报 action":"先选择 TAPD 需求"}),i.jsx("p",{children:t?re.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(nX,{globalState:_e,tapdId:t}),G.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:G.length})]}),i.jsx("div",{className:"af-prd-workflow-list",children:G.map((be,He)=>{const ie=vc(be),ke=String(be.label||be.title||be.kind||ie||`Artifact ${He+1}`);return ie?i.jsxs("a",{href:ie,target:"_blank",rel:"noreferrer",children:[i.jsx("span",{children:ke}),i.jsx("small",{children:be.kind||ie})]},`${ie}-${He}`):i.jsxs("div",{children:[i.jsx("span",{children:ke}),i.jsx("small",{children:be.kind||""})]},`${ke}-${He}`)})})]}):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:ue.length})]}),i.jsx("div",{className:"af-prd-workflow-list",children:ue.length?ue.map(be=>{const He=String(be.title||be.label||"ai-doc").trim(),ie=[be.label&&be.label!==He?be.label:"",be.platform,be.issueKey].filter(Boolean);return i.jsxs("a",{className:"af-prd-ai-doc",href:be.href,target:"_blank",rel:"noreferrer",title:He,children:[i.jsx("span",{className:"af-prd-ai-doc__title",children:He}),i.jsx("small",{className:"af-prd-ai-doc__meta",children:ie.join(" · ")||be.kind||"ai-doc"})]},be.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:Q||W.length})]}),i.jsx("div",{className:"af-prd-workflow-issues",children:E.length?E.map(be=>i.jsxs("div",{className:"af-prd-workflow-epic",children:[i.jsxs("div",{className:"af-prd-workflow-epic__head",children:[i.jsx("strong",{children:be.title||be.key}),i.jsx("small",{children:pb(be.issues)})]}),be.issues.map((He,ie)=>i.jsx(NM,{row:He,index:ie},Ii((He==null?void 0:He.issue)||{},ie)))]},be.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:[ce.length,"/",Z.length]})]}),i.jsx("div",{className:"af-prd-workflow-audit-filter",role:"tablist","aria-label":"运行审计筛选",children:[["all","全部"],["errors","异常"],["review","Review"],["external","外部"]].map(([be,He])=>i.jsx("button",{type:"button",className:w===be?"is-active":"",onClick:()=>g(be),children:He},be))}),i.jsx("div",{className:"af-prd-workflow-audit",children:ce.length?ce.map((be,He)=>i.jsxs("div",{children:[i.jsx("strong",{children:so(be,He)}),i.jsx("small",{children:[be.status,be.type,gm(be)].filter(Boolean).join(" · ")})]},be.id||`${be.type}-${He}`)):i.jsx("p",{className:"af-prd-workflow-muted",children:"暂无运行事件。"})})]}),Ce||l?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:l||Ce})]}):null]})]}),j?ur.createPortal(i.jsx("div",{className:"af-flow-snippet-modal-overlay",children:i.jsxs("div",{className:"af-flow-snippet-modal af-display-share-modal af-display-link-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:"share"}),"分享需求 Workflow"]}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>N(!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 ",t," 的需求流程;不会分享当前 Project、画布或项目文件。"]}),C?i.jsx("div",{className:"af-display-link-modal__empty",children:"正在生成分享链接..."}):null,!C&&$t?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"af-display-link-modal__url",children:[i.jsx("input",{type:"text",value:$t,readOnly:!0,onFocus:be=>be.currentTarget.select(),"aria-label":"Workflow 分享链接"}),i.jsxs("button",{type:"button",disabled:R,onClick:()=>void it(),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"content_copy"}),M||"复制链接"]}),z.canManage?i.jsx("button",{type:"button",disabled:R,onClick:()=>void gt(),children:R?"处理中...":"取消分享"}):null]}),i.jsx("div",{className:"af-prd-workflow-share-note",children:"获得链接的人无需登录即可只读查看同一份 Workflow;链接不会授予需求推进或项目编辑权限。"})]}):null,!C&&!$t&&D?i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",disabled:R,onClick:()=>void Te(),children:R?"生成中...":"生成分享链接"}):null,A?i.jsx("div",{className:"af-flow-snippet-error",children:A}):null]}),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:()=>N(!1),children:"完成"})})]})}),document.body):null]})}function i_(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 zu(e){if(!(e!=null&&e.hasIncoming))return"null";try{return JSON.stringify(e.incoming,null,2)}catch{return JSON.stringify(String(e.incoming))}}function sX(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 iX(){var E0,A0,P0;const{t:e,i18n:t}=$r(),{navigate:n}=gs(),r=Uc(),s=hn(),o=Y5(),a=m.useMemo(YY,[]),l=!!a.workflowShare,c=m.useRef(new URLSearchParams(window.location.search).get("focusNodeId")||""),u=m.useMemo(()=>a.workspaceId?`agentflow.workspace.viewport:shared:${a.workspaceId}`:`agentflow.workspace.viewport:${a.flowSource||"user"}:${a.adminOwnerId||"self"}:${a.flowId||""}`,[a]),[d,f]=m.useState(()=>(()=>{if(a.workflowShare)return"workflow";const x=new URLSearchParams(window.location.search).get("view");return x==="display"||x==="workflow"?x:"workspace"})()),[p,h]=m.useState(!1),[y,v]=m.useState(!1),[w,g]=G5([]),[k,b]=J5([]),j=m.useRef([]),N=m.useRef([]),C=m.useRef(null),[I,R]=m.useState(()=>kh(null,[])),H=m.useRef(I),[A,L]=m.useState(null),D=m.useRef(null),O=m.useRef(!1),[M,K]=m.useState([]),z=m.useRef(new Map),F=m.useRef(new Map),$=m.useRef(new Set),W=m.useRef(new Set),E=m.useRef(null),Q=m.useRef(null),V=m.useRef([]),B=m.useRef(null),re=m.useRef(null),ue=m.useRef(null),[G,ee]=m.useState(null),[te,ne]=m.useState({}),Z=m.useRef({}),ce=m.useRef(!1),de=m.useRef(null),me=m.useRef(""),$e=m.useRef(null),Ce=m.useRef(Promise.resolve()),_e=m.useRef({running:!1,pending:null}),Be=m.useRef(0),at=m.useRef(!1),yt=m.useRef(0),Te=m.useRef(null),it=m.useRef(!1),gt=m.useRef(!1),$t=m.useRef(""),be=m.useRef(!1),He=m.useRef(null),ie=m.useRef(!1),ke=m.useRef(new Set),Fe=m.useRef(!1),Ze=m.useRef(!1),Ne=m.useCallback(()=>AY({nodeInteraction:ie.current,pointerCount:ke.current.size,viewportInteraction:Fe.current}),[]),St=m.useRef(typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`client-${Date.now()}-${Math.random().toString(36).slice(2)}`),Jt=m.useRef(!1),Vt=m.useRef(null),[ot,On]=m.useState([]),se=m.useRef([]),[Ie,et]=m.useState(""),[qe,Et]=m.useState("nodes"),[vt,Jn]=m.useState([]),[mn,Lr]=m.useState(!1),[Vn,ir]=m.useState(""),[Xn,Qn]=m.useState(!1),[Zn,Cr]=m.useState({name:"",id:"",description:""}),[ys,Ts]=m.useState(!1),[Sn,Dn]=m.useState(""),[Zr,Tn]=m.useState(""),Fn=m.useRef(null),[es,Or]=m.useState(!1),[er,Xt]=m.useState(!1),[jn,le]=m.useState(""),[he,nt]=m.useState(null),[ct,Ft]=m.useState(()=>yw()),[on,Dr]=m.useState(""),[wt,Yt]=m.useState(!1),[zt,tr]=m.useState(""),[tt,Mn]=m.useState(!1),[Ms,ci]=m.useState([]),[ui,xo]=m.useState(!1),[$s,oe]=m.useState(""),[ve,Re]=m.useState(""),[kt,Tt]=m.useState(""),[Qt,gn]=m.useState(!1),[zn,q]=m.useState(""),[ge,Oe]=m.useState(""),[Ae,Ye]=m.useState(!1),[Zt,At]=m.useState("nodes"),[en,ts]=m.useState(""),[di,Ls]=m.useState(0),[bo,Fr]=m.useState(""),Bv=m.useRef(""),[mt,ws]=m.useState(null),Hv=m.useRef(null),[k$,fl]=m.useState(""),[pl,Wv]=m.useState([]),[Vv,v$]=m.useState(""),[Se,S$]=m.useState(!a.adminOwnerId),[Af,j$]=m.useState(()=>a.adminOwnerId?{readonly:!0,ownerUserId:a.adminOwnerId,ownerUsername:a.adminOwnerId}:null),[an,Sg]=m.useState(null),[N$,jg]=m.useState(!1),[Ng,Kv]=m.useState(!1),[qv,nu]=m.useState(""),[ru,Uv]=m.useState(""),[Yv,Gv]=m.useState(""),[Nn,hl]=m.useState(null),[C$,ma]=m.useState(!1),[Cg,ml]=m.useState({}),[Pf,Jv]=m.useState(!1),[Xv,su]=m.useState(""),[_g,_$]=m.useState(""),[E$,gl]=m.useState(()=>new Set),[Eg,Ag]=m.useState(""),[iu,Pg]=m.useState({nodeId:"",query:""}),[Qv,Zv]=m.useState(!1),Ig=m.useRef(null),eS=m.useRef(null),tS=m.useRef(""),[Rg,nS]=m.useState(()=>{try{const x=Number(window.localStorage.getItem("agentflow.workspace.filesPaneHeight")||0);if(Number.isFinite(x)&&x>=160)return x}catch{}return 360}),[A$,rS]=m.useState(!1),[ga,P$]=m.useState({cursor:[],opencode:[],claudeCode:[],codex:[]}),[Fi,I$]=m.useState(""),[Os,R$]=m.useState([]),[sS,iS]=m.useState(!1),[Ds,ou]=m.useState([]),[yl,T$]=m.useState([]),[oS,M$]=m.useState(!1),[aS,lS]=m.useState([]),[cS,uS]=m.useState([]),[or,$$]=m.useState(()=>{try{const x=String(new URLSearchParams(window.location.search).get("tapdId")||"").trim();return x||String(window.localStorage.getItem(`agentflow.workflow.tapdId:${a.flowSource||"user"}:${a.flowId||""}`)||"").trim()}catch{return""}}),[ln,If]=m.useState(null),[L$,dS]=m.useState(!1),[O$,wl]=m.useState(""),[Tg,fS]=m.useState(!1),[Mg,Rf]=m.useState(""),[xs,Tf]=m.useState(null),[$g,pS]=m.useState(!1),[au,lu]=m.useState(null),hS=m.useCallback(x=>{Fn.current&&window.clearTimeout(Fn.current),Tn(x),Fn.current=window.setTimeout(()=>{Tn(""),Fn.current=null},3800)},[]),zr=m.useCallback(x=>{const S=Array.isArray(x)||x instanceof Set?x:[x];for(const _ of S){const P=String(_||"").trim();P&&($.current.add(P),W.current.add(P))}$.current.size!==0&&(E.current==null&&(E.current=window.requestAnimationFrame(()=>{E.current=null;const _=Array.from($.current);$.current.clear(),_.forEach(P=>o(P))})),Q.current!=null&&window.clearTimeout(Q.current),Q.current=window.setTimeout(()=>{Q.current=null;const _=Array.from(W.current);W.current.clear(),_.forEach(P=>o(P))},80))},[o]);m.useEffect(()=>()=>{E.current!=null&&window.cancelAnimationFrame(E.current),Q.current!=null&&window.clearTimeout(Q.current),$.current.clear(),W.current.clear()},[]);const mS=m.useCallback((x,S)=>{const _=String(x||"").trim(),P=vm(S);!_||!P||(g(T=>T.map(U=>{var ae;if(U.id!==_)return U;const X=vm((ae=U.data)==null?void 0:ae.displaySize),J=X&&X.width===P.width&&X.height===P.height,Y=Math.round(Number(U.width||0))===P.width&&Math.round(Number(U.height||0))===P.height;return J&&Y?U:{...U,width:P.width,height:P.height,data:{...U.data,nodeSize:P,displaySize:P}}})),zr(_))},[zr,g]);m.useEffect(()=>{try{window.localStorage.setItem("agentflow.workspace.filesPaneHeight",String(Math.round(Rg)))}catch{}},[Rg]);const Lg=m.useCallback(x=>{const S=Ig.current;if(!S)return null;const _=S.getBoundingClientRect(),P=16,T=150,U=230,X=_.top+P,J=_.bottom-P,Y=Math.max(T,J-X-U);return Math.min(Math.max(x-X,T),Y)},[]),D$=m.useCallback(x=>{x.preventDefault(),x.stopPropagation();const S=Ig.current;if(!S)return;let _=Lg(x.clientY);if(!Number.isFinite(_))return;rS(!0),nS(_);const P=U=>{U.preventDefault();const X=Lg(U.clientY);Number.isFinite(X)&&(_=X,S.style.setProperty("--af-work-files-pane-height",`${Math.round(X)}px`))},T=()=>{nS(_),rS(!1),window.removeEventListener("pointermove",P,!0),window.removeEventListener("pointerup",T,!0),window.removeEventListener("pointercancel",T,!0)};window.addEventListener("pointermove",P,!0),window.addEventListener("pointerup",T,!0),window.addEventListener("pointercancel",T,!0)},[Lg]);m.useEffect(()=>()=>{Fn.current&&window.clearTimeout(Fn.current),Vt.current&&window.clearTimeout(Vt.current)},[]);const[F$,gS]=m.useState(()=>new Set),[Mf,Og]=m.useState(!1),Dg=m.useRef(null),yS=m.useRef(null),wS=m.useRef(null),[z$,B$]=m.useState({}),[ya,Fg]=m.useState(""),[ns,xS]=m.useState(!1),[wa,xl]=m.useState([]),[Fs,Kn]=m.useState([]),[Br,bs]=m.useState("workspace"),[cu,bl]=m.useState(!1),bS=m.useRef(null),zg=m.useRef(null),[uu,kl]=m.useState(null),[H$,Bg]=m.useState(!0),[kS,vS]=m.useState(""),[xa,ko]=m.useState({}),[_r,Hg]=m.useState(null),[SS,Wg]=m.useState(!1),vl=m.useMemo(()=>SS?ZY(_r):"",[SS,_r]),[du,$f]=m.useState(!0);m.useEffect(()=>{vl&&$f(eG(vl))},[vl]),m.useEffect(()=>{if(vl)try{window.localStorage.setItem(vl,du?"true":"false")}catch{}},[du,vl]);const[Vg,Lf]=m.useState(!1),[Kg,jS]=m.useState(!1),[qg,NS]=m.useState("pan"),[CS,W$]=m.useState({}),fu=m.useRef({}),[_S,ba]=m.useState({}),pu=m.useRef(new Map),hu=m.useRef(new Set),[ES,Sl]=m.useState(()=>new Set),[Ug,jl]=m.useState({}),[AS,PS]=m.useState(""),[Qce,ye]=m.useState(""),[IS,zs]=m.useState("loading"),[RS,Bs]=m.useState("正在载入 Project"),zi=m.useMemo(()=>QY(a),[a]),[TS,MS]=m.useState(""),mu=a.flowSource||"user",$S=m.useMemo(()=>new Set(Object.values(CS||{}).map(x=>String((x==null?void 0:x.runNodeId)||"").trim()).filter(Boolean)),[CS]),Bi=m.useCallback(x=>{const S=fu.current||{},_=typeof x=="function"?x(S):x,P=_&&typeof _=="object"&&!Array.isArray(_)?_:{};return fu.current=P,W$(P),P},[]),LS=!!(a.flowId&&!a.adminOwnerId&&!a.archived&&(an!=null&&an.role?an.role==="owner":mu==="user"||mu==="workspace")),gu=!!(!a.adminOwnerId&&mu==="workspace"&&(an!=null&&an.role)&&an.role!=="owner"),OS={loading:"载入中",dirty:"有未同步修改",saving:"同步中",synced:"已同步",conflict:"同步冲突",error:"同步失败",readonly:"只读"}[IS]||"同步状态",fi=m.useCallback(()=>{!ce.current||!Se||(be.current=!1,Be.current+=1,at.current=!0,zs("dirty"),Bs("本地修改等待同步"))},[Se]);m.useEffect(()=>{a.flowId&&RF(a.flowId,a.flowSource||"user","workspace",!!a.archived)},[a]),m.useEffect(()=>{const x=()=>{f(new URLSearchParams(window.location.search).get("view")==="display"?"display":"workspace")};return window.addEventListener("popstate",x),()=>window.removeEventListener("popstate",x)},[]),m.useEffect(()=>{xl([]),Kn([]),bs("workspace"),Bg(!0)},[a]);const Cn=m.useCallback(async()=>{const x=Pr(a),S=await fetch(`/api/workspace/files?${x.toString()}`),_=await S.json();if(!S.ok)throw new Error(_.error||"读取 workspace 失败");const P=_.files||[];Wv(P),gl(new Set(mM(P))),v$(_.root||"")},[a]),Of=m.useCallback(async()=>{Lr(!0),ir("");try{const x=await fetch("/api/marketplace/flow-snippets"),S=await x.json().catch(()=>({}));if(!x.ok)throw new Error(S.error||"读取流程片段失败");Jn(Array.isArray(S.snippets)?S.snippets:[])}catch(x){ir(String(x.message||x)),Jn([])}finally{Lr(!1)}},[]),DS=m.useCallback(async(x,S,_)=>{var Y,ae,pe;if(!ce.current)return;if(!Se)throw ye("Readonly workspace"),zs("readonly"),Bs("只读 Project"),new Error("Readonly workspace");zs("saving"),Bs("正在同步修改");const P=Bl(x,S,Z.current);P.ui={...P.ui||{},displayPage:WC(H.current,x)};const T=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,graph:P,baseRevision:me.current,baseGraph:$e.current,clientId:St.current})}),U=await T.json().catch(()=>({}));if(!T.ok){if(T.status===409||T.status===428){const je=Array.isArray(U.conflictItems)?U.conflictItems:[];hl({currentRevision:String(U.currentRevision||""),message:U.error||"Workspace 已被其他成员更新",conflictPaths:Array.isArray(U.conflictPaths)?U.conflictPaths:[],conflictItems:je,mergeGraph:U.mergeGraph||null,currentGraph:U.currentGraph||null}),ml(Object.fromEntries(je.map((We,Me)=>[String(Me),{mode:"local",manual:zu(We)}]))),su(""),ma(je.length>0),zs("conflict"),Bs(U.error||"存在需要处理的字段冲突");const Ve=Array.isArray(U.conflictPaths)?U.conflictPaths:[],ze=Ve.length?`${U.error||"Workspace 已被其他成员更新"}:${Ve.join("、")}`:U.error||"Workspace 已被其他成员更新",Ke=new Error(ze);throw Ke.code="WORKSPACE_REVISION_CONFLICT",Ke.currentRevision=U.currentRevision||"",Ke}const fe=new Error(U.error||"保存 workspace graph 失败");throw zs("error"),Bs(fe.message),fe}const X=Be.current!==_,J=EY({savedGraph:U.graph,sentGraph:P,savedRevision:U.revision,currentRevision:me.current});if(me.current=J.revision,$e.current=J.graph,!X){if(Z.current=((Y=U.graph)==null?void 0:Y.instances)||P.instances,ne(Z.current),U.merged&&U.graph){const fe=Fu(U.graph,ot),je=kh((pe=(ae=U.graph)==null?void 0:ae.ui)==null?void 0:pe.displayPage,fe.nodes);Z.current=fe.instances,ne(fe.instances),g(fe.nodes),b(fe.edges),H.current=je,R(je)}at.current=!1}return ba(Wp(U.workspaceSchedules||[])),hl(null),ma(!1),zs(X?"dirty":"synced"),Bs(X?"本地仍有修改等待同步":"所有修改已同步"),ye(X?"已保存上一版,本地新修改正在排队":U.merged?"Workspace graph merged and saved":"Workspace graph saved"),U},[a,ot,b,g,Se]),tn=m.useCallback((x=w,S=k)=>{const _=_e.current,P={nextNodes:x,nextEdges:S,saveEditVersion:Be.current,waiters:[]},T=new Promise((J,Y)=>{P.waiters.push({resolve:J,reject:Y})});if(_.running)return _.pending=AC(_.pending,P),T;_.running=!0;const U=async()=>{let J=P;for(;J;){_.pending&&(J=AC(J,_.pending),_.pending=null);try{const Y=await DS(J.nextNodes,J.nextEdges,J.saveEditVersion);J.waiters.forEach(({resolve:ae})=>ae(Y))}catch(Y){(Y==null?void 0:Y.code)!=="WORKSPACE_REVISION_CONFLICT"&&(zs("error"),Bs(String(Y.message||Y))),J.waiters.forEach(({reject:ae})=>ae(Y)),(Y==null?void 0:Y.code)==="WORKSPACE_REVISION_CONFLICT"&&_.pending&&(_.pending.waiters.forEach(({reject:ae})=>ae(Y)),_.pending=null)}J=_.pending,_.pending=null}_.running=!1},X=Ce.current.catch(()=>{}).then(U);return Ce.current=X,T},[k,w,DS]),V$=m.useCallback(x=>{var _;const S=(_=x==null?void 0:x.extra)!=null&&_.instances&&typeof x.extra.instances=="object"?x.extra.instances:{};Z.current=S,ne(S),g(Array.isArray(x==null?void 0:x.nodes)?x.nodes:[]),b(Array.isArray(x==null?void 0:x.edges)?x.edges:[]),Fr(""),ee(null)},[b,g]),K$=m.useMemo(()=>({instances:te}),[te]),q$=rY({nodes:w,edges:k,extra:K$,enabled:ce.current,onRestore:V$}),{resetHistory:yu,undo:FS,redo:zS}=q$,ks=m.useCallback(async(x={})=>{var Le,Lt;const S=(x==null?void 0:x.background)===!0,_=yt.current+1;yt.current=_;const P=Be.current,T=me.current;S||(ce.current=!1);const U=$Y({background:S}),X=Pr(a);let J=null,Y;if(!U.nodes&&!U.files)Y=await fetch(`/api/workspace/graph?${X.toString()}`);else{const De=Pr(a);De.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const[dt,Pt]=await Promise.all([fetch(`/api/nodes?${De.toString()}`),fetch(`/api/workspace/graph?${X.toString()}`),Cn()]);if(J=await dt.json(),!dt.ok)throw new Error(J.error||"读取节点定义失败");Y=Pt}const ae=await Y.json();if(!Y.ok)throw new Error(ae.error||"读取 workspace graph 失败");const pe=_Y({background:S,requestId:_,currentRequestId:yt.current,dirty:at.current,startedEditVersion:P,currentEditVersion:Be.current,startedRevision:T,currentRevision:me.current});if(pe==="superseded")return{skipped:!0,reason:pe};if(pe==="local-edits")return ye("检测到远端更新;本地修改将在保存时自动合并"),{skipped:!0,reason:pe};const fe=S?se.current:[...(Array.isArray(J)?J:J.nodes||[]).filter(De=>!DY.has(De.id)),VY,WY,BY,HY,FY,zY];S||(se.current=fe,On(fe));const je=ae.graph||JSON.parse(localStorage.getItem(OY)||"null")||{},Ve=Fu(je,fe),ze=kh((Le=je==null?void 0:je.ui)==null?void 0:Le.displayPage,Ve.nodes),Ke=!O.current;let We=D.current;if(Ke){let De=null;try{De=JSON.parse(window.localStorage.getItem(u)||"null")}catch{De=null}We=kb(De)||kb((Lt=je==null?void 0:je.ui)==null?void 0:Lt.viewport)}const Me=S?SY($e.current,je):null;if(S&&(Me!=null&&Me.safe)){const De=Me.nodesChanged?jY(j.current,Ve.nodes,Me.changedNodeIds):j.current,dt=Me.edgesChanged?NY(N.current,Ve.edges):N.current,Pt=Me.displayPageChanged||!ro(H.current,ze),Ml=Me.nodesChanged||Me.edgesChanged||Pt;if(Ml&&(be.current=!0),Me.nodesChanged){const pi=CY(Z.current,Ve.instances,Me.changedNodeIds);Z.current=pi,j.current=De,ne(pi),g(De)}if(Me.edgesChanged&&(N.current=dt,b(dt)),Pt&&(H.current=ze,R(ze)),Ml&&yu(De,dt,{instances:Me.nodesChanged?Z.current:Ve.instances}),Me.nodesChanged||Pt){const pi=new Set(ze.nodeIds);K(Sa=>{const ja=Sa.filter(ep=>pi.has(ep));return ja.length===Sa.length?Sa:ja})}}else Z.current=Ve.instances,j.current=Ve.nodes,N.current=Ve.edges,H.current=ze,be.current=!0,ne(Ve.instances),g(Ve.nodes),b(Ve.edges),R(ze),K([]),yu(Ve.nodes,Ve.edges,{instances:Ve.instances});const Bt=Wp(ae.workspaceSchedules||[]);ba(De=>ro(De,Bt)?De:Bt),me.current=String(ae.revision||""),$e.current=je,at.current=!1;const st=ae.collaboration||null;Sg(De=>ro(De,st)?De:st),j$(ae.adminReview||null),hl(null),Ke&&(L(We),D.current=We,O.current=!0);const Ge=ae.writable!==!1;return S$(Ge),ye(Ge?"Workspace ready":"Readonly workspace"),zs(Ge?"synced":"readonly"),Bs(Ge?"所有修改已同步":ae.adminReview?`管理员只读查看:${ae.adminReview.ownerUsername||ae.adminReview.ownerUserId||"其他用户"}`:"只读 Project"),ce.current=!0,{skipped:!1}},[a,t.language,Cn,yu,b,g,u]),Nl=m.useCallback((x={})=>{if(!ce.current)return;const S=String(x.revision||""),_=x.type==="graph.committed",P=!!(Te.current||it.current||gt.current);if(LY({eventType:x.type,revision:S,currentRevision:me.current,targetRevision:$t.current,refreshPending:P}))return;if(_&&S&&($t.current=S),at.current){gt.current=!1,ye("检测到其他成员的更新;保存时将自动合并");return}if(gt.current=!0,Te.current||it.current)return;const T=async()=>{if(Te.current=null,Ne()){gt.current=!0;return}if(at.current){gt.current=!1,ye("检测到其他成员的更新;保存时将自动合并");return}gt.current=!1,it.current=!0;try{await ks({background:!0}),$t.current=me.current}catch(U){$t.current="",ye(String(U.message||U))}finally{it.current=!1,gt.current&&!at.current&&(Te.current=window.setTimeout(T,40))}};Te.current=window.setTimeout(T,40)},[ks,Ne]),wu=m.useCallback(async(x=or)=>{const S=String(x||"").trim();dS(!0),wl("");try{const _=Pr(a);_.set("tapdId",S),_.set("runtimeOnly","1");const P=await fetch(`/api/prd-workflow/snapshot?${_.toString()}`),T=await P.json().catch(()=>({}));if(!P.ok)throw new Error(T.error||"读取 PRD Workflow 失败");If(T.snapshot||null),Rf(""),Tf(null),lu(null);try{const U=`agentflow.workflow.tapdId:${a.flowSource||"user"}:${a.flowId||""}`;S?window.localStorage.setItem(U,S):window.localStorage.removeItem(U)}catch{}}catch(_){wl(String(_.message||_))}finally{dS(!1)}},[a,or]),Cl=m.useCallback(async(x=null,S={})=>{const _=x&&typeof x=="object"?x:ln==null?void 0:ln.nextAction,P=ym(_);if(!P||Tg)return;const T=(S==null?void 0:S.confirm)===!0,U=String((S==null?void 0:S.expectedRevision)||(ln==null?void 0:ln.revision)||"");fS(!0),wl(""),T||(Rf(""),Tf(null),lu(null));try{const X=await fetch("/api/prd-workflow/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,tapdId:or,action:P,stage:il(_),title:so(_,0),...kG(_),dryRun:!T,confirm:T,issueKey:_.issueKey||_.issue_key||"",expectedRevision:U,idempotencyKey:`workflow-${Date.now()}-${Math.random().toString(36).slice(2)}`})}),J=await X.json().catch(()=>({}));if(!X.ok||J.ok===!1)throw J.snapshot&&If(J.snapshot),J.conflict&&lu({...J.conflict,action:_}),new Error(J.error||"执行 PRD Workflow action 失败");Rf(J.rawOutput||(J.output?JSON.stringify(J.output,null,2):"")),If(J.snapshot||ln),lu(null),Tf(T?null:{action:_,output:J.output||null,expectedRevision:U,at:new Date().toISOString()})}catch(X){wl(String(X.message||X))}finally{fS(!1)}},[a,Tg,ln,or]),U$=m.useCallback((x=null)=>Cl(x,{confirm:!1}),[Cl]),Y$=m.useCallback(()=>{const x=(xs==null?void 0:xs.action)||(ln==null?void 0:ln.nextAction);return Cl(x,{confirm:!0,expectedRevision:(xs==null?void 0:xs.expectedRevision)||""})},[Cl,xs,ln]),G$=m.useCallback(()=>{const x=(au==null?void 0:au.action)||(ln==null?void 0:ln.nextAction);return lu(null),Cl(x,{confirm:!1})},[Cl,au,ln]),J$=m.useCallback(async()=>{var U,X;const x=String(Mg||(ln==null?void 0:ln.rawOutput)||"").trim();if(!x||$g)return;const S=(xs==null?void 0:xs.action)||(ln==null?void 0:ln.nextAction)||{},_=`Review: ${so(S,0)||(ln==null?void 0:ln.pointer)||or||"PRD Workflow"}`,P=/^[\[{]/.test(x),T=x.startsWith("#")?x:`# ${_}
|
|
247
|
-
|
|
248
|
-
${P?`\`\`\`json
|
|
249
|
-
${x}
|
|
250
|
-
\`\`\``:x}`;pS(!0),wl("");try{const J=await fetch("/api/prd-workflow/review-link",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,tapdId:or,title:_,markdown:T,action:ym(S),stage:il(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 链接失败");If(Y.snapshot||ln);const ae=((U=Y.review)==null?void 0:U.shortUrl)||((X=Y.review)==null?void 0:X.url)||"";ae&&Rf(pe=>`${pe||x}
|
|
251
|
-
|
|
252
|
-
Review link: ${ae}`)}catch(J){wl(String(J.message||J))}finally{pS(!1)}},[a,Mg,xs,$g,ln,or]),X$=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:a.flowId,flowSource:a.flowSource||"user",archived:!!a.archived},P=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_)}),T=await P.json().catch(()=>({}));if(!P.ok||(T==null?void 0:T.ok)===!1)throw new Error((T==null?void 0:T.error)||"Publish failed");return await ks(),ye(`Published node ${T.definitionId||T.id||_.packageId}`),T},[a,ks]),ka=m.useCallback((x=Fs)=>{const S=Array.isArray(x)?x:[],P=[...S].reverse().find(T=>(T==null?void 0:T.status)==="running"||(T==null?void 0:T.status)==="stopping")||[...S].reverse().find(T=>T==null?void 0:T.id);return String((P==null?void 0:P.id)||"workspace")},[Fs]),Q$=m.useCallback(x=>{const S=String(x||"").trim();!S||S==="workspace"||Kn(_=>{const P=(Array.isArray(_)?_:[]).filter(T=>T.id!==S);return bs(T=>T===S?ka(P):T),P})},[ka]);m.useCallback((x="")=>{bl(!0),kl(null),ws(null),bs(x||ka())},[ka]);const BS=m.useCallback((x={})=>{kl({scheduleNodeId:String(x.scheduleNodeId||""),runNodeId:String(x.runNodeId||x.nodeId||""),lastRunId:String(x.lastRunId||""),label:String(x.label||"")}),bl(!1),ws(null),Fr("")},[]),Yg=m.useCallback(async(x="")=>{const S=String(x||"").trim();if(!(!S||!Se)){PS(S),ye(`Optimizing run: ${S}`);try{await tn(j.current,N.current);const _=Bl(j.current,N.current,Z.current),P=n_(j.current,Z.current,S,Fi),T=await fetch("/api/workspace/run/optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,runNodeId:S,graph:_,model:P})}),U=await T.json().catch(()=>({}));if(!T.ok||U.ok===!1)throw new Error(U.error||"优化失败");const X=U.graph||_,J=Fu(X,ot);Z.current=J.instances,ne(J.instances),g(J.nodes),b(J.edges),ba(Wp(U.workspaceSchedules||[])),yu(J.nodes,J.edges,{instances:J.instances});const Y=Array.isArray(U.optimized)?U.optimized.length:0;ye(Y>0?`已生成 ${Y} 个 implementation`:"没有需要优化的节点")}catch(_){ye(String(_.message||_))}finally{PS("")}}},[Fi,N,a,j,ot,yu,tn,b,g,Se]),HS=m.useCallback(async(x="")=>{const S=String(x||"").trim(),_=fu.current||{},P=Object.entries(_).find(([Y,ae])=>Y===S||String((ae==null?void 0:ae.runNodeId)||"")===S)||Object.entries(_)[0]||null,T=(P==null?void 0:P[0])||"",U=(P==null?void 0:P[1])||null,X=String((U==null?void 0:U.runNodeId)||S||"").trim();if((U==null?void 0:U.status)==="stopping")return;const J=new Set([X,...Array.isArray(U==null?void 0:U.plannedNodeIds)?U.plannedNodeIds:[]].map(Y=>String(Y||"").trim()).filter(Boolean));T&&Bi(Y=>{const ae={...Y};return ae[T]&&(ae[T]={...ae[T],status:"stopping"}),ae}),ye(X?`Stopping Workspace run: ${X}...`:"Stopping Workspace run..."),Kn(Y=>Y.map(ae=>(T?ae.id===T:!X||ae.runNodeId===X)&&ae.status==="running"?{...ae,status:"stopping"}:ae));try{const Y=await fetch("/api/workspace/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,runId:T,runNodeId:X})}),ae=await Y.json().catch(()=>({}));if(!Y.ok||(ae==null?void 0:ae.stopped)!==!0)throw new Error(ae.error||"Workspace run stop failed");const pe=T?pu.current.get(T):null;pe&&(pe.abort(),pu.current.delete(T)),T&&Bi(fe=>{const je={...fe};return delete je[T],je}),Sl(fe=>{const je=new Set(fe);for(const Ve of J)je.delete(Ve);return je}),jl(fe=>{var Ve;const je={...fe};for(const ze of J)ze&&(!je[ze]||((Ve=je[ze])==null?void 0:Ve.status)==="running")&&(je[ze]={status:"stopped"});return je}),ye(X?`Workspace run stopped: ${X}`:"Workspace run stopped"),Kn(fe=>fe.map(je=>(T?je.id===T:!X||je.runNodeId===X)?{...je,status:"stopped",endedAt:Date.now(),messages:[...Array.isArray(je.messages)?je.messages:[],{role:"assistant",kind:"status",text:"Workspace run stopped.",at:Date.now()}].slice(-160)}:je))}catch(Y){T&&Bi(pe=>{const fe={...pe};return fe[T]&&(fe[T]={...fe[T],status:"running"}),fe});const ae=String((Y==null?void 0:Y.message)||Y||"Workspace run stop failed");ye(`停止失败:${ae}`),Kn(pe=>pe.map(fe=>(T?fe.id===T:!X||fe.runNodeId===X)?{...fe,status:"running",messages:[...Array.isArray(fe.messages)?fe.messages:[],{role:"assistant",kind:"error",error:!0,text:`停止失败:${ae}`,at:Date.now()}].slice(-160)}:fe))}},[a,Bi]),Df=m.useCallback(async()=>{if(a.flowId)try{const x=Pr(a),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:[]}],T={},U=[];for(const X of P){const J=String((X==null?void 0:X.runNodeId)||"").trim(),Y=String((X==null?void 0:X.runId)||`run-restored-${(X==null?void 0:X.startedAt)||Date.now()}-${J}`).trim();if(!Y)continue;const ae=String((X==null?void 0:X.label)||"").trim()||pw(j.current,Z.current,J,"Workspace Run");T[Y]={id:Y,runNodeId:J,label:ae,status:(X==null?void 0:X.state)==="stopping"?"stopping":"running",plannedNodeIds:Array.isArray(X==null?void 0:X.plannedNodeIds)?X.plannedNodeIds:[],startedAt:(X==null?void 0:X.startedAt)||Date.now()},J&&U.push(J)}if(!Object.keys(T).length)return;Bi(X=>({...X,...T})),Sl(X=>{const J=new Set(X);for(const Y of U)J.add(Y);return J}),jl(X=>{const J={...X};for(const Y of U)J[Y]={status:"running"};return J}),ye(U.length?`Workspace run still running: ${U.join(", ")}`:"Workspace run still running"),Kn(X=>{const J=[...X];for(const[Y,ae]of Object.entries(T)){if(J.some(je=>je.id===Y||["running","stopping"].includes(je.status)&&je.runNodeId===ae.runNodeId))continue;const pe=String(ae.runNodeId||""),fe=String(ae.label||"").trim()||pw(j.current,Z.current,pe,"Workspace Run");J.push({id:Y,label:hw(fe,pe,"Workspace Run"),alias:fe,runNodeId:pe,status:ae.status,startedAt:ae.startedAt||Date.now(),steps:pe?[{id:pe,label:hw(fe,pe,"Workspace Run"),status:"running"}]:[],messages:[{role:"assistant",kind:"run-summary",text:ae.status==="stopping"?"Workspace run is stopping in the background.":"Workspace run is still running in the background.",at:Date.now()}]})}return[...J.slice(-8)]})}catch{}},[a,j,Bi]),WS=m.useCallback(async x=>{if(!Se){ye("Readonly workspace");return}if(!x)return;if(Object.values(fu.current||{}).find(st=>String((st==null?void 0:st.runNodeId)||"")===String(x||""))){ye(`Workspace run already running: ${x}`);return}let _=j.current,P=N.current,T=Z.current;const U=Hv.current;if(U!=null&&U.id){const st=_.find(Le=>Le.id===U.id),Ge=s_({nodes:_,edges:P,instances:T,selectedNode:st,draft:U,allowRename:!1});if(Ge!=null&&Ge.error){fl(Ge.error),ye(Ge.error);return}Ge!=null&&Ge.ok&&Ge.changed&&(_=Ge.nodes,P=Ge.edges,T=Ge.instances,Z.current=T,j.current=_,N.current=P,ne(T),g(_),b(P),zr(Ge.nextId||U.id))}const X=Bl(_,P,T),J=`run-${Date.now()}-${String(x).replace(/[^a-z0-9_-]+/gi,"_")}`,Y=pw(_,T,x,"Workspace Run"),ae=hw(Y,x,"Workspace Run");let pe=[x];try{const st=await fetch("/api/workspace/run/plan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,graph:X,runNodeId:x})}),Ge=await st.json().catch(()=>({}));if(!st.ok||(Ge==null?void 0:Ge.ok)===!1)throw new Error(Ge.error||"Workspace run plan failed");pe=Array.isArray(Ge.plannedNodeIds)&&Ge.plannedNodeIds.length?Ge.plannedNodeIds.map(Lt=>String(Lt||"").trim()).filter(Boolean):[x],pe=Array.from(new Set([x,...pe].filter(Boolean)));const Le=Ge.conflict||null;if(Le!=null&&Le.runNodeId||Le!=null&&Le.runId){const Lt=Array.isArray(Le.conflictNodeIds)&&Le.conflictNodeIds.length?`: ${Le.conflictNodeIds.join(", ")}`:"";ye(`Run ${x} conflicts with running ${Le.runNodeId||Le.runId}${Lt}`);return}}catch(st){ye(String(st.message||st));return}const fe=new Set(pe),je=Object.values(fu.current||{}).find(st=>(Array.isArray(st==null?void 0:st.plannedNodeIds)?st.plannedNodeIds:[]).some(Ge=>fe.has(String(Ge||"").trim())));if(je){const st=(Array.isArray(je.plannedNodeIds)?je.plannedNodeIds:[]).map(Ge=>String(Ge||"").trim()).filter(Ge=>Ge&&fe.has(Ge));ye(`Run ${x} conflicts with running ${je.runNodeId||"workspace run"}${st.length?`: ${st.join(", ")}`:""}`);return}const Ve=new AbortController;pu.current.set(J,Ve),hu.current.delete(J),Bi(st=>({...st,[J]:{id:J,runNodeId:x,label:Y,plannedNodeIds:pe,startedAt:Date.now()}})),Sl(st=>new Set([...st,x])),jl(st=>({...st,[x]:{status:"running"}})),ye(`Running ${ae}...`),bs(J),Kn(st=>[...st.slice(-7),{id:J,label:ae,alias:Y,runNodeId:x,status:"running",startedAt:Date.now(),steps:[],messages:[{role:"assistant",kind:"run-summary",text:"准备运行...",at:Date.now()}]}]);let ze=x;const Ke=new Map,We=()=>hu.current.has(J),Me=st=>{const Ge=new Set((st||[]).map(Le=>String(Le||"").trim()).filter(Boolean));Ge.size||Ge.add(String(x||"")),Sl(Le=>{const Lt=new Set(Le);for(const De of Ge)Lt.delete(De);return Lt})},Bt=(st,Ge)=>{const Le=new Set((st||[]).map(Lt=>String(Lt||"").trim()).filter(Boolean));Le.size||Le.add(String(x||"")),jl(Lt=>{var dt;const De={...Lt};for(const Pt of Le)Pt&&(!De[Pt]||((dt=De[Pt])==null?void 0:dt.status)==="running")&&(De[Pt]={status:Ge});return De})};try{await tn(_,P);const st=n_(_,T,x,Fi),Ge=await fetch("/api/workspace/run",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},signal:Ve.signal,body:JSON.stringify({...a,graph:X,runNodeId:x,runAlias:Y,runSessionId:J,expectedRevision:me.current,clientId:St.current,model:st,selectedSkills:Ds,stream:!0})});if(!Ge.ok){const we=await Ge.json().catch(()=>({}));throw new Error(we.error||"Workspace run failed")}if(!Ge.body)throw new Error("Workspace run stream unavailable");const Le=Ge.body.getReader(),Lt=new TextDecoder;let De="",dt=[],Pt=[];const Ml=(we,rt)=>{var lt,_t;const Je=w.find(Dt=>Dt.id===we),pt=String(((lt=Je==null?void 0:Je.data)==null?void 0:lt.label)||we||"").trim(),xe=String(rt||((_t=Je==null?void 0:Je.data)==null?void 0:_t.definitionId)||"").trim();return xe&&xe!==pt?`${pt} (${xe})`:pt},pi=(we,rt,Je)=>{const pt=String(we||"").trim();pt&&Kn(xe=>xe.map(lt=>{if(lt.id!==J)return lt;const Dt=[...Array.isArray(lt.steps)?lt.steps:[]],ht=Dt.findIndex(un=>un.id===pt),jt={id:pt,label:Ml(pt,rt),status:Je};ht>=0?Dt[ht]={...Dt[ht],...jt}:Dt.push(jt);const cn=Dt.map((un,No)=>{const Vi=un.status==="done"?"[done]":un.status==="failed"?"[failed]":"[running]";return`${No+1}. ${Vi} ${un.label}`}).join(`
|
|
253
|
-
`),Ut=Array.isArray(lt.messages)?lt.messages:[],rn=Ut.findIndex(un=>un.kind==="run-summary"),yn={role:"assistant",kind:"run-summary",text:cn||"准备运行...",at:Date.now()},Ht=[...Ut];return rn>=0?Ht[rn]=yn:Ht.unshift(yn),{...lt,steps:Dt,messages:Ht.slice(-160)}}))},Sa=(we,rt)=>{var $0,L0,O0,D0,F0,z0,B0,H0,W0,V0;const Je=String(we||"").trim(),pt=String(rt||"").trim();if(!Je||!pt)return;const xe=($0=Z.current)==null?void 0:$0[Je];if(!ri(xe==null?void 0:xe.definitionId))return;const lt=oa(xe==null?void 0:xe.input,"displayType","markdown"),_t=bM(lt),Dt=kM(Je),ht=ot.find(Er=>Er.id===_t),jt=QC(ht==null?void 0:ht.inputs,_t,pt),cn=QC(ht==null?void 0:ht.outputs,_t,pt),Ut=String((xe==null?void 0:xe.label)||Je||"一键任务").trim(),rn={...Z.current||{},[Je]:{...xe||{},output:e_(xe==null?void 0:xe.output)},[Dt]:{...((L0=Z.current)==null?void 0:L0[Dt])||{},definitionId:_t,label:Ut,role:"normal",body:pt,input:jt,output:cn,sourceContextRunNodeId:Je,displayReloadKey:String(Date.now())}};Z.current=rn,ne(rn);const yn=j.current||[],Ht=yn.find(Er=>Er.id===Je),un=yn.find(Er=>Er.id===Dt),No=Number(((O0=Ht==null?void 0:Ht.measured)==null?void 0:O0.width)||(Ht==null?void 0:Ht.width)||((F0=(D0=Ht==null?void 0:Ht.data)==null?void 0:D0.nodeSize)==null?void 0:F0.width)||520),Vi=(un==null?void 0:un.position)||{x:Number(((z0=Ht==null?void 0:Ht.position)==null?void 0:z0.x)||0)+No+120,y:Number(((B0=Ht==null?void 0:Ht.position)==null?void 0:B0.y)||0)},lr=((H0=un==null?void 0:un.data)==null?void 0:H0.displaySize)||((W0=un==null?void 0:un.data)==null?void 0:W0.nodeSize)||{width:mb,height:gb},hi=fb({id:Dt,type:kc,position:Vi,width:Number(lr.width)||mb,height:Number(lr.height)||gb,data:{label:Ut,definitionId:_t,role:"normal",body:pt,inputs:jt,outputs:cn,sourceContextRunNodeId:Je,displayReloadKey:rn[Dt].displayReloadKey,nodeSize:lr,displaySize:lr}},rn,ot),Co=yn.map(Er=>{if(Er.id===Je){const{width:Zce,height:eue,measured:tue,...ZL}=Er,{nodeSize:nue,displaySize:rue,...ip}=Er.data||{};return{...ZL,data:{...ip,outputs:e_(ip==null?void 0:ip.outputs),contextRunResultNonce:Date.now()}}}return Er.id===Dt?{...hi,selected:Er.selected}:Er});un||Co.push(hi),j.current=Co,g(Co);const _o=N.current||[],sp=vM(_t),ly=ZC((xe==null?void 0:xe.output)||((V0=Ht==null?void 0:Ht.data)==null?void 0:V0.outputs),"output",["content","result"],["text"]),XL=ZC(jt,"input",[sp,"content"],["text"]),QL={id:`we-${Je}-${Dt}`,source:Je,target:Dt,sourceHandle:ly,targetHandle:XL,markerEnd:{type:ji.ArrowClosed}},M0=[..._o.filter(Er=>!(Er.source===Je&&Er.target===Dt)),QL];N.current=M0,b(M0),window.requestAnimationFrame(()=>{o(Je),o(Dt)})},ja=(we,rt=null)=>{const Je=we!=null&&we.instances&&typeof we.instances=="object"?we.instances:{},pt=rt instanceof Set?rt:null;for(const[xe,lt]of Object.entries(Je)){if(pt&&!pt.has(xe)||!ri(lt==null?void 0:lt.definitionId))continue;const _t=mg({outputs:lt.output});_t&&Sa(xe,_t)}},ep=we=>{const rt=String(we||"").trim();if(!rt)return;const Je=ze;ze=rt,Sl(pt=>{const xe=new Set(pt);return Je&&Je!==rt&&Je!==x&&xe.delete(Je),x&&xe.add(x),xe.add(rt),xe}),jl(pt=>{var xe;return{...pt,...Je&&Je!==rt&&Je!==x&&((xe=pt[Je])==null?void 0:xe.status)==="running"?{[Je]:{status:"success"}}:{},...x?{[x]:{status:"running"}}:{},[rt]:{status:"running"}}})},I0=we=>{const rt=String(we||"").trim();rt&&(Sl(Je=>{const pt=new Set(Je);return pt.delete(rt),pt}),jl(Je=>({...Je,[rt]:{status:"success"}})))},R0=(we,rt)=>{const Je=String(rt||"");if(!Je.trim())return;const pt=["assistant","thinking","result","error","prompt"].includes(we)?we:"assistant";Kn(xe=>xe.map(lt=>{if(lt.id!==J)return lt;let _t=Array.isArray(lt.messages)?lt.messages:[];if(pt==="result"){const jt=[..._t].reverse().find(cn=>cn.kind==="assistant");if(String((jt==null?void 0:jt.text)||"").trim()===Je.trim())return lt}if(pt==="assistant"){const jt=_t.findIndex(cn=>cn.kind==="result"&&String(cn.text||"").trim()===Je.trim());jt>=0&&(_t=_t.filter((cn,Ut)=>Ut!==jt))}const Dt=[..._t],ht=Dt[Dt.length-1];return ht&&ht.kind===pt&&!ht.error?Dt[Dt.length-1]={...ht,text:`${ht.text||""}${ht.text?`
|
|
254
|
-
`:""}${Je}`}:Dt.push({role:"assistant",kind:pt,text:Je,...pt==="error"?{error:!0}:{},at:Date.now()}),{...lt,messages:Dt.slice(-160)}}))},tp=we=>{const rt=String(we||"");rt.trim()&&Kn(Je=>Je.map(pt=>{var Dt;if(pt.id!==J)return pt;const xe=Array.isArray(pt.messages)?pt.messages:[],lt=xe.findIndex(ht=>ht.kind==="thinking"),_t=[...xe];if(lt>=0){const ht=String(((Dt=_t[lt])==null?void 0:Dt.text)||"");_t[lt]={..._t[lt],text:`${ht}${ht&&!ht.endsWith(`
|
|
255
|
-
`),""}${rt}`,at:Date.now()}}else{const ht=_t.findIndex(jt=>jt.kind==="activity");_t.splice(ht>=0?ht+1:_t.length,0,{role:"assistant",kind:"thinking",text:rt,at:Date.now()})}return{...pt,messages:_t.slice(-160)}}))},jo=(we,rt=null)=>{const Je=rG(we);Je&&Kn(pt=>pt.map(xe=>{if(xe.id!==J)return xe;const lt=Number(rt==null?void 0:rt.ts)||Date.now(),_t=Number(xe.startedAt)||lt,Dt=Number(xe.lastActivityAt)||_t,ht=Math.max(0,lt-Dt),jt=Number.isFinite(Number(rt==null?void 0:rt.runElapsedMs))?Math.max(0,Number(rt.runElapsedMs)):Math.max(0,lt-_t),cn=Array.isArray(xe.activities)?xe.activities:[],Ut=cn[cn.length-1],yn=(typeof Ut=="string"?Ut:String((Ut==null?void 0:Ut.text)||""))===Je?cn:[...cn,{text:Je,kind:iG(Je),stepMs:ht,totalMs:jt,at:lt}].slice(-30),Ht=Array.isArray(xe.timingEntries)?xe.timingEntries:[],un=Array.isArray(xe.messages)?xe.messages:[],No=un.findIndex(hi=>hi.kind==="activity"),Vi={role:"assistant",kind:"activity",text:$C(yn,Ht,_t,lt),at:Date.now()},lr=[...un];if(No>=0)lr[No]=Vi;else{const hi=lr.findIndex(Co=>Co.kind==="run-summary");lr.splice(hi>=0?hi+1:0,0,Vi)}return{...xe,activities:yn,lastActivityAt:lt,messages:lr.slice(-160)}}))},T0=we=>{const rt=String((we==null?void 0:we.source)||"runner"),Je=String((we==null?void 0:we.stream)||""),pt=String((we==null?void 0:we.eventType)||"event"),xe=String((we==null?void 0:we.text)||"").trim();if(!xe)return;const lt=`[${rt}${Je?`:${Je}`:""}] ${pt}
|
|
256
|
-
${xe}`,_t=OG(we);Kn(Dt=>Dt.map(ht=>{if(ht.id!==J)return ht;const cn=[...Array.isArray(ht.rawTrace)?ht.rawTrace:[],lt].slice(-80),Ut=Array.isArray(ht.timingEntries)?ht.timingEntries:[],rn=_t?[...Ut,_t].slice(-80):Ut,yn=Array.isArray(ht.activities)?ht.activities:[],Ht=Number(ht.startedAt)||Number(we==null?void 0:we.ts)||Date.now(),un=Number(_t==null?void 0:_t.at)||Number(we==null?void 0:we.ts)||Date.now(),No=Array.isArray(ht.messages)?ht.messages:[],Vi={role:"assistant",kind:"raw",text:cn.join(`
|
|
257
|
-
|
|
258
|
-
---
|
|
259
|
-
|
|
260
|
-
`),at:Date.now()},lr=[...No],hi=lr.findIndex(_o=>_o.kind==="activity");if(_t){const _o={role:"assistant",kind:"activity",text:$C(yn,rn,Ht,un),at:Date.now()};if(hi>=0)lr[hi]=_o;else{const sp=lr.findIndex(ly=>ly.kind==="run-summary");lr.splice(sp>=0?sp+1:0,0,_o)}}const Co=lr.findIndex(_o=>_o.kind==="raw");return Co>=0?lr[Co]=Vi:lr.push(Vi),{...ht,rawTrace:cn,timingEntries:rn,messages:lr.slice(-160)}}))},JL=we=>{Kn(rt=>rt.map(Je=>Je.id===J?{...Je,status:we,endedAt:Date.now()}:Je))},np=we=>{const rt=new Set,Je=String((we==null?void 0:we.nodeId)||"").trim();Je&&rt.add(Je);for(const pt of Array.isArray(we==null?void 0:we.displayNodeIds)?we.displayNodeIds:[]){const xe=String(pt||"").trim();xe&&rt.add(xe)}for(const pt of Array.isArray(we==null?void 0:we.touchedNodeIds)?we.touchedNodeIds:[]){const xe=String(pt||"").trim();xe&&rt.add(xe)}if(rt.size===0)for(const pt of Array.isArray(we==null?void 0:we.order)?we.order:[]){const xe=String(pt||"").trim();xe&&rt.add(xe)}return rt},rp=(we,rt=null)=>{const Je=Fu(we||X,ot),pt=new Map(Je.nodes.map(ht=>[ht.id,ht])),xe=Je.instances||{},lt=rt instanceof Set?rt:null,_t=(ht,jt)=>{const cn={...ht||jt};Array.isArray(jt==null?void 0:jt.output)&&(cn.output=jt.output);for(const Ut of["scriptRef","implementationRef","implementationMode"])(jt==null?void 0:jt[Ut])!=null&&String(jt[Ut]).trim()!==""&&(cn[Ut]=jt[Ut]);return cn},Dt=(ht,jt)=>{const cn={...ht||{}};Array.isArray(jt==null?void 0:jt.outputs)&&(cn.outputs=jt.outputs);for(const Ut of["scriptRef","implementationRef","implementationMode"])(jt==null?void 0:jt[Ut])!=null&&String(jt[Ut]).trim()!==""&&(cn[Ut]=jt[Ut]);return cn};g(ht=>{const jt=new Set(ht.map(rn=>rn.id)),Ut={...Bl(ht,N.current,Z.current).instances||{}};for(const[rn,yn]of Object.entries(xe)){if(lt&&!lt.has(rn)||!jt.has(rn))continue;const Ht=Ut[rn];ol((yn==null?void 0:yn.definitionId)||(Ht==null?void 0:Ht.definitionId))?Ut[rn]=yn:Array.isArray(yn==null?void 0:yn.output)&&(Ut[rn]=_t(Ht,yn))}return Z.current=Ut,ne(Ut),ht.map(rn=>{var Ht,un;if(lt&&!lt.has(rn.id))return rn;const yn=pt.get(rn.id);return yn?ol(((Ht=yn.data)==null?void 0:Ht.definitionId)||((un=rn.data)==null?void 0:un.definitionId))?{...rn,data:{...rn.data,...yn.data}}:{...rn,data:Dt(rn.data,yn.data)}:rn})})};for(;;){const{value:we,done:rt}=await Le.read();if(rt)break;De+=Lt.decode(we,{stream:!0});const Je=De.split(`
|
|
261
|
-
`);De=Je.pop()||"";for(const pt of Je){if(!pt.trim())continue;const xe=JSON.parse(pt);if(xe.type==="error")throw new Error(xe.error||"Workspace run failed");if(xe.type==="stopped"){hu.current.add(J),dt=Array.isArray(xe.order)?xe.order:dt,jo("运行停止",xe);continue}if(xe.type==="node-start"&&(ye(`Running ${xe.nodeId}...`),ep(xe.nodeId),pi(xe.nodeId,xe.definitionId,"running")),xe.type==="node-done"){const lt=Ke.get(String(xe.nodeId||"").trim());lt&&Sa(xe.nodeId,lt),I0(xe.nodeId),pi(xe.nodeId,xe.definitionId,"done")}if(xe.type==="status"&&jo(xe.line||xe.message||"",xe),xe.type==="paused"&&(Pt=Array.isArray(xe.nodeIds)?xe.nodeIds:[],jo("运行暂停",xe)),xe.type==="natural"&&((xe.kind==="result"||/---agentflow\b|resultFile\s*:|\"resultFile\"\s*:|\"result\"\s*:/i.test(String(xe.text||"")))&&xe.nodeId&&Ke.set(String(xe.nodeId||"").trim(),String(xe.text||"")),xe.kind==="thinking"?tp(xe.text||""):R0(xe.kind,xe.text||"")),xe.type==="raw"){const lt=LC(xe);lt&&tp(lt),T0(xe)}if(xe.type==="graph"&&xe.graph){const lt=np(xe);rp(xe.graph,lt),ja(xe.graph,lt)}if(xe.type==="done"){if(xe.revision&&(me.current=String(xe.revision)),xe.graph){$e.current=xe.graph;const lt=np(xe);rp(xe.graph,lt),ja(xe.graph,lt)}dt=Array.isArray(xe.order)?xe.order:[],Pt=Array.isArray(xe.pauseNodeIds)?xe.pauseNodeIds:Pt,jo(Pt.length?"运行暂停":"运行完成",xe)}}}if(De.trim()){const we=JSON.parse(De);if(we.type==="error")throw new Error(we.error||"Workspace run failed");if(we.type==="stopped"&&(hu.current.add(J),jo("运行停止",we)),we.type==="node-start"&&(ye(`Running ${we.nodeId}...`),ep(we.nodeId),pi(we.nodeId,we.definitionId,"running")),we.type==="node-done"){const rt=Ke.get(String(we.nodeId||"").trim());rt&&Sa(we.nodeId,rt),I0(we.nodeId),pi(we.nodeId,we.definitionId,"done")}if(we.type==="status"&&jo(we.line||we.message||"",we),we.type==="paused"&&(Pt=Array.isArray(we.nodeIds)?we.nodeIds:[],jo("运行暂停",we)),we.type==="natural"&&((we.kind==="result"||/---agentflow\b|resultFile\s*:|\"resultFile\"\s*:|\"result\"\s*:/i.test(String(we.text||"")))&&we.nodeId&&Ke.set(String(we.nodeId||"").trim(),String(we.text||"")),we.kind==="thinking"?tp(we.text||""):R0(we.kind,we.text||"")),we.type==="raw"){const rt=LC(we);rt&&tp(rt),T0(we)}if(we.type==="graph"&&we.graph){const rt=np(we);rp(we.graph,rt),ja(we.graph,rt)}if(we.type==="done"){if(we.revision&&(me.current=String(we.revision)),we.graph){$e.current=we.graph;const rt=np(we);rp(we.graph,rt),ja(we.graph,rt)}dt=Array.isArray(we.order)?we.order:[],Pt=Array.isArray(we.pauseNodeIds)?we.pauseNodeIds:Pt,jo(Pt.length?"运行暂停":"运行完成",we)}}We()&&(Me(pe),Bt(pe,"stopped"));const ay=We()?`Workspace run stopped: ${x}`:Pt.length?`Workspace run paused at ${Pt.join(", ")}`:`Workspace run done: ${dt.length?dt.join(" -> "):x}`;if(ye(ay),We()||Bt(pe,Pt.length?"paused":"success"),JL(We()?"stopped":Pt.length?"paused":"done"),!We()){try{await tn(j.current,N.current),ye(ay)}catch(we){ye(`${ay},但保存结果失败:${String(we.message||we)}`)}await Cn()}}catch(st){if(We()||(st==null?void 0:st.name)==="AbortError"){Me(pe),Bt(pe,"stopped"),ye(`Workspace run stopped: ${x}`),Kn(Ge=>Ge.map(Le=>Le.id===J?{...Le,status:"stopped",endedAt:Date.now()}:Le));return}Me(pe),Bt([x,ze].filter(Boolean),"failed"),ye(String(st.message||st)),Kn(Ge=>Ge.map(Le=>Le.id===J?{...Le,status:"failed",endedAt:Date.now(),messages:[...Array.isArray(Le.messages)?Le.messages:[],{role:"assistant",error:!0,text:String(st.message||st),at:Date.now()}].slice(-160)}:Le))}finally{pu.current.get(J)===Ve&&pu.current.delete(J),Bi(st=>{const Ge={...st};return delete Ge[J],Ge}),hu.current.delete(J),Me(pe)}},[Fi,k,a,Cn,w,ot,zr,tn,Ds,b,g,Bi,o,Se]),Ff=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):""})):[];R$(_),iS(!0)}catch{iS(!0)}},[]),zf=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):[];lS(_)}catch{lS([])}},[]),Bf=m.useCallback(async()=>{try{const x=Pr(a),_=await(await fetch(`/api/workspaces?${x.toString()}`)).json().catch(()=>({})),P=Array.isArray(_.workspaces)?_.workspaces.map(T=>({id:String((T==null?void 0:T.id)||""),label:String((T==null?void 0:T.label)||(T==null?void 0:T.name)||"知识库"),path:String((T==null?void 0:T.path)||""),kind:(T==null?void 0:T.kind)==="git"?"git":"local",repoUrl:String((T==null?void 0:T.repoUrl)||""),branch:String((T==null?void 0:T.branch)||""),mountPath:String((T==null?void 0:T.mountPath)||""),type:String((T==null?void 0:T.type)||""),builtin:(T==null?void 0:T.builtin)===!0,exists:(T==null?void 0:T.exists)!==!1})).filter(T=>T.path):[];uS(P)}catch{uS([])}},[a]),VS=m.useCallback(async()=>{Jt.current=!1;try{const x=Pr(a),S=await fetch(`/api/workspace/conversations?${x.toString()}`),_=await S.json().catch(()=>({}));if(!S.ok)throw new Error(_.error||`HTTP ${S.status}`);const P=IC(_.conversations||{});xl(P.composer.messages),Kn(P.composer.runSessions),bs(P.composer.activeSessionId||"workspace"),ko(P.nodeChats)}catch{xl([]),Kn([]),bs("workspace"),ko({})}finally{Jt.current=!0}},[a]),KS=m.useCallback(async()=>{if(!Se||a.archived)return;const x=IC({composer:{activeSessionId:Br,messages:wa,runSessions:Fs},nodeChats:xa});await fetch("/api/workspace/conversations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,conversations:x})}).then(async S=>{if(!S.ok){const _=await S.json().catch(()=>({}));throw new Error(_.error||`HTTP ${S.status}`)}})},[Br,wa,Fs,a,xa,Se]);m.useEffect(()=>{let x=!1;return l?(Hg(null),Wg(!0),()=>{x=!0}):((async()=>{const _=new URL(window.location.href),P=String(_.searchParams.get("invite")||"").trim();if(P){ye("正在加入共享 Workspace...");const T=await fetch("/api/workspace/collaboration/accept",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:P})}),U=await T.json().catch(()=>({}));if(!T.ok)throw new Error(U.error||"加入共享 Workspace 失败");_.searchParams.delete("invite"),window.history.replaceState({},"",`${_.pathname}${_.search}${_.hash}`)}x||(await ks(),x||await VS())})().catch(_=>{const P=String(_.message||_);ye(P),zs("error"),Bs(P)}),Of(),fetch("/api/model-lists").then(_=>_.json()).then(_=>P$({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(()=>{}),Ff(),zf(),Bf(),Df(),fetch("/api/skill-collections").then(_=>_.json()).then(_=>{T$(Ha(_)),M$(!0)}).catch(()=>{}),fetch("/api/auth/me").then(_=>_.json()).then(_=>{Hg(_.user||null),Wg(!0)}).catch(()=>{Hg(null),Wg(!0)}),()=>{x=!0})},[l,ks,VS,Of,zf,Ff,Df,Bf,zi]),m.useEffect(()=>{if(MS(""),!(!sS||!oS)){if(!zi){ou([]);return}ou(VF(zi,"workspace",Os,yl)),MS(zi)}},[yl,oS,Os,sS,zi]),m.useEffect(()=>{if(!(TS!==zi||!zi))try{localStorage.setItem(zi,JSON.stringify(Ds))}catch{}},[Ds,zi,TS]),m.useEffect(()=>{Z.current=te},[te]),m.useEffect(()=>{j.current=w},[w]),m.useEffect(()=>{if(ie.current)return;const x=z.current,S=new Map,_=[];for(const P of w){const T=nM(P);S.set(P.id,T),x.get(P.id)!==T&&_.push(P.id)}z.current=S,_.length!==0&&zr(_)},[w,zr]),m.useEffect(()=>{N.current=k},[k]),m.useEffect(()=>{H.current=I},[I]),m.useEffect(()=>{D.current=A},[A]),m.useEffect(()=>{Hv.current=mt},[mt]),m.useEffect(()=>{Bv.current=bo},[bo]),m.useEffect(()=>{ue.current=G},[G]),m.useEffect(()=>{if(!G)return;const x=_=>{_.key==="Escape"&&ee(null)},S=_=>{var P,T;(T=(P=_.target)==null?void 0:P.closest)!=null&&T.call(P,".af-connect-node-menu")||ee(null)};return document.addEventListener("keydown",x),document.addEventListener("pointerdown",S),()=>{document.removeEventListener("keydown",x),document.removeEventListener("pointerdown",S)}},[G]),m.useEffect(()=>{if(!ce.current||!Se)return;if(ie.current){de.current&&window.clearTimeout(de.current);return}const x=He.current;if(He.current=null,(x==null?void 0:x.nodes)===w&&x.edges===k&&x.displayPage===I)return;if(be.current){be.current=!1;return}fi(),de.current&&window.clearTimeout(de.current);const S=Ze.current?0:650;return Ze.current=!1,de.current=window.setTimeout(()=>{tn().catch(_=>ye(String(_.message||_)))},S),()=>{de.current&&window.clearTimeout(de.current)}},[w,k,I,fi,tn,Se]),m.useEffect(()=>{if(Jt.current&&!(!Se||a.archived))return Vt.current&&window.clearTimeout(Vt.current),Vt.current=window.setTimeout(()=>{KS().catch(x=>ye(String(x.message||x)))},900),()=>{Vt.current&&window.clearTimeout(Vt.current)}},[Br,wa,Fs,a.archived,xa,KS,Se]);const xu=m.useMemo(()=>w.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:Nv(((S=x.data)==null?void 0:S.body)||"")}}),[w]),Z$=m.useMemo(()=>xu.map(x=>`${x.id}:${x.config.enabled?"1":"0"}:${x.config.cron}:${x.config.timezone}`).join("|"),[xu]);m.useEffect(()=>{if(!ce.current||d!=="workspace"||!a.flowId){ba({});return}if(!xu.length){ba({});return}let x=!1;const S=async()=>{try{const P=Pr(a),T=await fetch(`/api/workspace/schedules?${P.toString()}`),U=await T.json().catch(()=>({}));if(!T.ok)throw new Error(U.error||"读取 Workspace 定时状态失败");x||ba(Wp(U.schedules||[]))}catch{x||ba(P=>{var U;const T={};for(const X of xu)T[X.id]={...P[X.id]||{},lastStatus:((U=P[X.id])==null?void 0:U.lastStatus)||"unknown"};return T})}};S();const _=window.setInterval(S,5e3);return()=>{x=!0,window.clearInterval(_)}},[a,xu,Z$,d]);const qS=m.useCallback((x,S)=>{if(!Se){ye("Readonly workspace");return}const _=XC(S),P=Y=>Array.isArray(Y)?Y.map(ae=>(ae==null?void 0:ae.name)!=="skillKeys"&&(ae==null?void 0:ae.name)!=="skillsContext"&&(ae==null?void 0:ae.type)!=="text"?ae:{...ae,default:_,value:_}):[],T=w.map(Y=>{var ae;return Y.id!==x?Y:{...Y,data:{...Y.data,body:_,inputs:P((ae=Y.data)==null?void 0:ae.inputs)}}}),U=Z.current||{},X=U[x]&&typeof U[x]=="object"?U[x]:{},J={...U,[x]:{...X,body:_,input:P(X.input)}};Z.current=J,g(T),ne(J),ws(Y=>!Y||Y.id!==x?Y:{...Y,body:_,inputs:P(Y.inputs)}),tn(T,k).catch(Y=>ye(String(Y.message||Y)))},[k,w,tn,g,Se]),US=m.useCallback((x,S)=>{if(!Se){ye("Readonly workspace");return}const _=qJ(S),P=Y=>Array.isArray(Y)?Y.map(ae=>(ae==null?void 0:ae.name)!=="serverNames"&&(ae==null?void 0:ae.name)!=="mcpContext"&&(ae==null?void 0:ae.type)!=="text"?ae:{...ae,default:_,value:_}):[],T=w.map(Y=>{var ae;return Y.id!==x?Y:{...Y,data:{...Y.data,body:_,inputs:P((ae=Y.data)==null?void 0:ae.inputs)}}}),U=Z.current||{},X=U[x]&&typeof U[x]=="object"?U[x]:{},J={...U,[x]:{...X,body:_,input:P(X.input)}};Z.current=J,g(T),ne(J),ws(Y=>!Y||Y.id!==x?Y:{...Y,body:_,inputs:P(Y.inputs)}),tn(T,k).catch(Y=>ye(String(Y.message||Y)))},[k,w,tn,g,Se]),YS=m.useCallback((x,S)=>{if(!Se){ye("Readonly workspace");return}const _=(Array.isArray(S)?S:S?[S]:[]).filter(ze=>String((ze==null?void 0:ze.path)||"").trim()),P=_[0]||null,T=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} 个知识库`:"",X=_.length?JSON.stringify(gg(_)):"",J=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:T,workspaceRoot:T,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)||""}):"",Y=ze=>Array.isArray(ze)?ze.map(Ke=>(Ke==null?void 0:Ke.name)==="path"?{...Ke,default:T,value:T}:(Ke==null?void 0:Ke.name)==="label"?{...Ke,default:U,value:U}:(Ke==null?void 0:Ke.name)==="knowledgeContext"?{...Ke,default:X,value:X}:(Ke==null?void 0:Ke.name)==="workspaceContext"?{...Ke,default:J,value:J}:(Ke==null?void 0:Ke.name)==="mode"?{...Ke,default:"set",value:"set"}:Ke):[],ae=ze=>Array.isArray(ze)?ze.map(Ke=>(Ke==null?void 0:Ke.name)==="knowledgeContext"?{...Ke,default:X,value:X}:(Ke==null?void 0:Ke.name)==="workspaceContext"?{...Ke,default:J,value:J,showOnNode:!1}:(Ke==null?void 0:Ke.name)==="cwd"?{...Ke,default:T,value:T,showOnNode:!1}:Ke):[],pe=w.map(ze=>{var Ke,We,Me;return ze.id===x?{...ze,data:{...ze.data,label:((Ke=ze.data)==null?void 0:Ke.label)||"加载知识库",inputs:Y((We=ze.data)==null?void 0:We.inputs),outputs:ae((Me=ze.data)==null?void 0:Me.outputs)}}:ze}),fe=Z.current||{},je=fe[x]&&typeof fe[x]=="object"?fe[x]:{},Ve={...fe,[x]:{...je,label:je.label||"加载知识库",input:Y(je.input),output:ae(je.output)}};Z.current=Ve,g(pe),ne(Ve),ws(ze=>(ze==null?void 0:ze.id)===x?{...ze,inputs:Y(ze.inputs),outputs:ae(ze.outputs)}:ze),tn(pe,k).catch(ze=>ye(String(ze.message||ze)))},[k,w,tn,g,Se]),GS=m.useCallback((x,S)=>{if(!Se){ye("Readonly workspace");return}const _=String(x||"");if(!_)return;const P=XC((S==null?void 0:S.skillKeys)||[]),T=Sf((S==null?void 0:S.displayType)||"markdown"),U=String((S==null?void 0:S.model)||"").trim(),X=(S==null?void 0:S.includeWorkspaceContext)===!1?"false":"true",J=S!=null&&S.workspaceContext&&typeof S.workspaceContext=="object"?JSON.stringify(S.workspaceContext):"",Y=S!=null&&S.knowledgeContext&&typeof S.knowledgeContext=="object"?JSON.stringify(S.knowledgeContext):"",ae=We=>Array.isArray(We)?We.map(Me=>(Me==null?void 0:Me.name)==="skillKeys"?{...Me,default:P,value:P}:(Me==null?void 0:Me.name)==="displayType"?{...Me,default:T,value:T}:(Me==null?void 0:Me.name)==="includeWorkspaceContext"?{...Me,default:X,value:X}:(Me==null?void 0:Me.name)==="knowledgeContext"?{...Me,default:Y,value:Y}:(Me==null?void 0:Me.name)==="workspaceContext"?{...Me,default:J,value:J}:Me):[],pe=We=>Array.isArray(We)?We.map(Me=>(Me==null?void 0:Me.name)==="displayType"?{...Me,default:T,value:T}:Me):[],fe=String((S==null?void 0:S.task)??""),je=w.map(We=>{var Me,Bt;return We.id===_?{...We,data:{...We.data,body:fe,model:U,inputs:ae((Me=We.data)==null?void 0:Me.inputs),outputs:pe((Bt=We.data)==null?void 0:Bt.outputs)}}:We}),Ve=Z.current||{},ze=Ve[_]&&typeof Ve[_]=="object"?Ve[_]:{},Ke={...Ve,[_]:{...ze,body:fe,model:U,input:ae(ze.input),output:pe(ze.output)}};Z.current=Ke,g(je),ne(Ke),ws(We=>(We==null?void 0:We.id)===_?{...We,body:fe,model:U,inputs:ae(We.inputs),outputs:pe(We.outputs)}:We),tn(je,k).catch(We=>ye(String(We.message||We)))},[k,w,tn,g,Se]),JS=m.useCallback((x,S)=>{if(!Se){ye("Readonly workspace");return}const _=UG(S),P=w.map(J=>J.id===x?{...J,data:{...J.data,body:_}}:J),T=Z.current||{},U=T[x]&&typeof T[x]=="object"?T[x]:{},X={...T,[x]:{...U,body:_}};Z.current=X,be.current=!0,g(P),ne(X),ws(J=>(J==null?void 0:J.id)===x?{...J,body:_}:J),tn(P,k).catch(J=>ye(String(J.message||J)))},[k,w,tn,g,Se]),XS=m.useCallback(x=>{const S=String(x||"").trim();S&&(vS(_=>_===S?"":S),ko(_=>({..._,[S]:_[S]||{sessionId:`nodechat_${Date.now()}_${S.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[],draft:"",candidateContent:"",running:!1,error:""}})))},[]),QS=m.useCallback(()=>vS(""),[]),ZS=m.useCallback((x,S)=>{const _=String(x||"").trim();_&&ko(P=>({...P,[_]:{...P[_]||{sessionId:`nodechat_${Date.now()}_${_.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[]},draft:String(S||""),error:""}}))},[]),Hs=m.useCallback((x,S,_="replace",P={})=>{var st,Ge;if(!Se){ye("Readonly workspace");return}const T=String(x||"").trim();if(!T)return;const U=j.current.find(Le=>Le.id===T),X=En(U==null?void 0:U.data),J=ri((st=U==null?void 0:U.data)==null?void 0:st.definitionId),Y=Ri(S),ae=X==="html"?Jc(Y):X==="react"?hg(Y):String(Y||""),pe=U?io(U.data):"",fe=_==="append"&&String(pe||"").trim()?`${String(pe).replace(/\s+$/g,"")}
|
|
262
|
-
|
|
263
|
-
${ae.trim()}`:ae,je=X==="image"?"src":"content",Ve=P!=null&&P.reloadDisplay?Date.now():(Ge=U==null?void 0:U.data)==null?void 0:Ge.displayReloadKey,ze=Le=>{let Lt=!1;return(Array.isArray(Le)?Le:[]).map(dt=>{const Pt=String((dt==null?void 0:dt.name)||""),Ml=String((dt==null?void 0:dt.type)||"");return(J?Pt===je||Pt==="result"||Pt==="filePath":Pt===je||Pt==="filePath"||Ml==="text")?Lt?{...dt,default:"",value:""}:(Lt=!0,{...dt,default:fe,value:fe}):dt})},Ke=j.current.map(Le=>{var Lt,De;return Le.id!==T?Le:{...Le,data:{...Le.data,body:J?Le.data.body:fe,...Ve?{displayReloadKey:Ve}:{},inputs:ze((Lt=Le.data)==null?void 0:Lt.inputs),outputs:ze((De=Le.data)==null?void 0:De.outputs)}}}),We=Z.current||{},Me=We[T]&&typeof We[T]=="object"?We[T]:{},Bt={...We,[T]:{...Me,body:J?Me.body:fe,input:ze(Me.input),output:ze(Me.output)}};Z.current=Bt,g(Ke),ne(Bt),ws(Le=>(Le==null?void 0:Le.id)===T?{...Le,...J?{}:{body:fe}}:Le),(P==null?void 0:P.logChat)!==!1&&ko(Le=>{var Lt;return{...Le,[T]:{...Le[T]||{},candidateContent:"",messages:[...(Lt=Le[T])!=null&&Lt.messages&&Array.isArray(Le[T].messages)?Le[T].messages:[],{role:"assistant",text:_==="append"?"已追加到当前节点内容。":"已替换当前节点内容。",at:Date.now()}]}}}),tn(Ke,N.current).catch(Le=>ye(String(Le.message||Le))),ye(String((P==null?void 0:P.statusMessage)||"")||(_==="append"?"已追加节点内容":"已替换节点内容"))},[tn,g,Se]),Hf=m.useCallback(async(x,S="")=>{if(!Se)return ye("Readonly workspace"),"";if(!x)return"";try{const _=new FormData;_.set("file",x),_.set("dir",String(S||"")),a.flowId&&_.set("flowId",a.flowId),a.flowSource&&_.set("flowSource",a.flowSource),a.adminOwnerId&&_.set("adminOwnerId",a.adminOwnerId),a.archived&&_.set("archived","1");const P=await fetch("/api/workspace/upload",{method:"POST",body:_}),T=await P.json().catch(()=>({}));if(!P.ok)throw new Error(T.error||"上传文件失败");const U=String(T.path||"").trim();if(!U)throw new Error("上传文件失败:未返回路径");return await Cn(),gl(X=>{const J=new Set(X);for(const Y of Kp(U))J.delete(Y);return J}),ye(`已上传 ${U}`),U}catch(_){return ye(String(_.message||_)),""}},[a,Cn,Se]),Wf=m.useCallback(async x=>mm(x)?Hf(x,"img"):(ye("请选择图片文件"),""),[Hf]),e0=m.useCallback((x="")=>{var S;if(!Se){ye("Readonly workspace");return}tS.current=String(x||""),(S=eS.current)==null||S.click()},[Se]),eL=m.useCallback(async x=>{const S=Array.from(x.target.files||[]);if(x.target.value="",!S.length)return;const _=tS.current||"";Zv(!0);try{let P="";for(const T of S){const U=await Hf(T,_);U&&(P=U)}S.length>1&&ye(`已上传 ${S.length} 个文件${P?`,最后一个:${P}`:""}`)}catch(P){ye(String(P.message||P))}finally{Zv(!1)}},[Hf]),t0=m.useCallback(async(x,S)=>{const _=String(x||"").trim();if(!_)return;const P=await Wf(S);P&&Hs(_,P,"replace",{logChat:!1,statusMessage:`已上传图片 ${P}`})},[Hs,Wf]),n0=m.useCallback(async(x,S=void 0)=>{var ze,Ke;if(!Se){ye("Readonly workspace");return}const _=String(x||"").trim();if(!_)return;const P=xa[_]||{},T=String(S!==void 0?S:P.draft||"").trim();if(!T||P.running)return;const U=j.current.find(We=>We.id===_);if(!U)return;const X=En(U.data)||"markdown",J=io(U.data);let Y=ia(J,X),ae=Ri(J);if(Y)try{ae=await al(a,Y)}catch(We){ye(String(We.message||We))}else if(X!=="image"&&String(ae||"").trim()){const We=Fa(X,ae);if(We){ye(`${We} 未进入微调。`);return}try{const Me=await Sb(a,GC(_,U.data),ae);await Cn(),Hs(_,Me,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已将展示保存为 ${Me}`}),Y=Me,ae=""}catch(Me){ye(String(Me.message||Me));return}}const pe=uJ(_,j.current,N.current),fe={role:"user",text:T,at:Date.now()},je=Array.isArray(P.messages)?P.messages:[],Ve=P.sessionId||`nodechat_${Date.now()}_${_.replace(/[^a-z0-9_-]+/gi,"_")}`;ko(We=>({...We,[_]:{...P,sessionId:Ve,messages:[...je,fe],draft:"",running:!0,error:""}}));try{const We=await fetch("/api/workspace/node-chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,sessionId:Ve,node:{id:_,label:((ze=U.data)==null?void 0:ze.label)||_,definitionId:((Ke=U.data)==null?void 0:Ke.definitionId)||""},nodeKind:X,currentContent:Y?"":ae,sourceContext:pe,targetFilePath:Y,messages:je,message:T,model:Fi})}),Me=await We.json().catch(()=>({}));if(!We.ok)throw new Error(Me.error||"节点微调失败");const Bt=String(Me.candidateContent||Me.reply||"").trim(),st=!!Me.directFileEdit,Ge=String(Me.artifactPath||Y||"").trim();if(st&&Ge){const Le=Fa(X,Bt);if(Le)throw new Error(`${Le} 文件已由 agent 修改,请检查 ${Ge}。`);await Cn(),Hs(_,Ge,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已按微调描述更新 ${Ge}`})}else if(Bt){const Le=Fa(X,Bt);if(Le)throw new Error(`${Le} 已取消写入,避免覆盖当前展示文件。`);if(Y){const Lt=await Sb(a,Y,Bt);await Cn(),Hs(_,Lt,"replace",{logChat:!1,statusMessage:`已按微调描述更新 ${Lt}`})}else Hs(_,Bt,"replace",{logChat:!1,statusMessage:"已按微调描述更新展示内容"})}ko(Le=>{var Lt;return{...Le,[_]:{...Le[_]||{},sessionId:String(Me.sessionId||Ve),running:!1,candidateContent:"",messages:[...(Lt=Le[_])!=null&&Lt.messages&&Array.isArray(Le[_].messages)?Le[_].messages:[...je,fe],{role:"assistant",text:Bt||st?Ge?`已更新文件 ${Ge}。`:"已按你的描述更新当前展示。":"没有生成可更新的内容。",at:Date.now()}]}}})}catch(We){const Me=String(We.message||We);ko(Bt=>({...Bt,[_]:{...Bt[_]||{},running:!1,error:Me}})),ye(Me)}},[Fi,a,Cn,xa,Hs,Se]),r0=m.useCallback(async(x,S)=>{if(!Se){ye("Readonly workspace");return}const _=En(S)||"markdown",P=io(S),T=ia(P,_);let U=Ri(P);if(T)try{U=await al(a,T)}catch(ae){ye(String(ae.message||ae));return}if(!String(U||"").trim()){ye("展示节点没有可保存内容");return}const X=Fa(_,U);if(X){ye(`${X} 未保存文件。`);return}const J=GC(x,S),Y=window.prompt("保存到 workspace 相对路径",J);if(Y)try{const ae=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,path:Y,content:U})}),pe=await ae.json().catch(()=>({}));if(!ae.ok)throw new Error(pe.error||"保存文件失败");const fe=pe.path||Y,je=Pr(a);je.set("path",fe);const Ve=await fetch(`/api/workspace/file?${je.toString()}`);if(!Ve.ok){const ze=await Ve.json().catch(()=>({}));throw new Error(ze.error||`保存后读取失败:${fe}`)}await Cn(),Wv(ze=>OJ(ze,fe,String(U||"").length)),gl(ze=>{const Ke=new Set(ze);for(const We of Kp(fe))Ke.delete(We);return Ke}),Hs(x,fe,"replace",{logChat:!1,statusMessage:`已保存并引用 ${fe}`}),ye(`已保存 ${fe}`)}catch(ae){ye(String(ae.message||ae))}},[a,Cn,Hs,Se]),s0=m.useCallback(x=>{var T,U;const S=String(x||"").trim();if(!S||on)return;const _=j.current.find(X=>X.id===S);if(!_||!En(_==null?void 0:_.data)){ye("展示节点不可用");return}const P=String(((T=_.data)==null?void 0:T.label)||((U=_.data)==null?void 0:U.displayName)||S).trim()||"AgentFlow Display";Ft(yw({title:P,layout:"single",nodeIds:[S],mode:"single-node",sourceNodeId:S})),le(""),nt(null),Or(!0)},[on]),Vf=m.useCallback((x,S)=>{const _=String(x||"");_&&ws(P=>{if(!P||P.id!==_)return P;const T=typeof S=="function"?S(P):S;return!T||typeof T!="object"?P:{...P,...T}})},[]),i0=m.useCallback((x,S)=>{const _=String(x||"");!_||!Se||(g(P=>P.map(T=>{var X;if(T.id!==_)return T;const U=Array.isArray((X=T.data)==null?void 0:X.outputs)&&T.data.outputs.length?T.data.outputs.map((J,Y)=>Y===0?{...J,default:S,value:S}:J):[{type:"file",name:"value",default:S,value:S}];return{...T,data:{...T.data,body:"",outputs:U}}})),Vf(_,P=>({body:"",outputs:Array.isArray(P==null?void 0:P.outputs)&&P.outputs.length?P.outputs.map((U,X)=>X===0?{...U,default:S,value:S}:U):[{type:"file",name:"value",default:S,value:S}]})),ye(`已选择文件 ${S}`))},[g,Vf,Se]),o0=m.useCallback(x=>{Pg({nodeId:String(x||""),query:""})},[]),Gg=m.useCallback(()=>{Pg({nodeId:"",query:""})},[]),tL=m.useCallback(x=>{const S=String((x==null?void 0:x.path)||"").trim();!S||!iu.nodeId||(i0(iu.nodeId,S),Gg())},[Gg,iu.nodeId,i0]),a0=m.useCallback(async(x,S)=>{if(!Se)return;const _=CJ(x,S);if(_.length===0)return;const P=[];try{for(const T of _){const U=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,path:T})});if(U.status===404)continue;const X=await U.json().catch(()=>({}));if(!U.ok)throw new Error(X.error||"清理节点输出失败");P.push(X.path||T)}if(P.length===0)return;ye(`已清理 ${P.join(", ")}`),await Cn(),Ag(T=>_.some(U=>T===U||T.startsWith(`${U}/`))?"":T)}catch(T){ye(String(T.message||T))}},[a,Cn,Se]),bu=m.useMemo(()=>({modelLists:ga,showBodyPreview:!0,flowParams:a,readOnly:!Se,onRunWorkspaceNode:WS,onStopWorkspaceNode:HS,onOpenWorkspaceRunLogs:BS,onOptimizeWorkspaceRun:Yg,onOptimizeWorkspaceSchedule:Yg,runningRunNodeIds:$S,onChangeScheduledRunConfig:JS,onChangeContextRunConfig:GS,skills:Os,skillCollections:yl,onChangeLoadSkillKeys:qS,onRefreshSkills:Ff,mcpServers:aS,onChangeLoadMcpNames:US,onRefreshMcps:zf,workspaceTargets:cS,onChangeLoadWorkspace:YS,onRefreshWorkspaces:Bf,onSaveDisplayNodeToFile:r0,onShareDisplayNode:s0,onOpenDisplayPreview:Oe,onRefreshNodeInternals:zr,onEnsureWorkspaceNodeDisplaySize:mS,sharingDisplayNodeId:on,onUploadWorkspaceImage:Wf,onUploadImageToDisplayNode:t0,onOpenProvideFilePicker:o0,onStatus:ye,onSetDisplayNodeContent:Hs,onToggleNodeChat:XS,onCloseNodeChat:QS,onUpdateNodeChatDraft:ZS,onSendNodeChat:n0,onSyncNodePropDraft:Vf,onCleanupWorkspaceNodeOutputs:a0}),[GS,US,qS,YS,JS,a0,QS,mS,a,aS,ga,o0,BS,Yg,zf,zr,Ff,Bf,WS,$S,r0,n0,Hs,s0,on,yl,Os,HS,Vf,XS,ZS,t0,Wf,cS,Se]),nL=m.useRef(new Map),rs=m.useMemo(()=>{const x=nL.current,S=new Set,_=w.map(P=>{var Y,ae,pe;const T={selected:P.selected===!0,isExecuting:ES.has(P.id),nodeStatus:((Y=Ug[P.id])==null?void 0:Y.status)??null,nodeElapsed:((ae=Ug[P.id])==null?void 0:ae.elapsed)??null,optimizingRun:AS===P.id,scheduledRunState:_S[P.id]||null,nodeChatActive:kS===P.id,nodeChat:xa[P.id]||null},U=x.get(P.id);if(U&&U.source===P&&U.commonData===bu&&BC(U.runtime,T))return S.add(P.id),U.node;const X=!!(U&&((pe=U.source)==null?void 0:pe.data)===P.data&&U.commonData===bu&&BC(U.runtime,T)),J={...P,data:X?U.node.data:{...P.data,...bu,...T}};return x.set(P.id,{source:P,commonData:bu,runtime:T,node:J}),S.add(P.id),J});for(const P of x.keys())S.has(P)||x.delete(P);return _},[kS,bu,xa,w,AS,_S,ES,Ug]),ut=d==="display",_n=d==="workflow",l0=m.useMemo(()=>ut?new Map(rs.map(x=>[x.id,x])):ZG,[rs,ut]),c0=m.useMemo(()=>ge&&rs.find(x=>x.id===ge)||null,[ge,rs]),u0=m.useRef(new Map),ku=m.useMemo(()=>{if(!ut)return u0.current.clear(),eJ;const x=new Set(M),S=u0.current,_=new Set,P=I.nodeIds.map((T,U)=>{var Ve,ze,Ke,We;const X=l0.get(T);if(!X||!En(X.data))return null;const J=ql(X)||{width:520,height:320},Y=Ka(I.nodeSizes[T]||J,{display:!0})||J,ae=I.nodePositions[T]||{x:180+U*36,y:120+U*28},pe=x.has(T),fe=S.get(T);if(fe&&fe.source===X&&((Ve=fe.position)==null?void 0:Ve.x)===ae.x&&((ze=fe.position)==null?void 0:ze.y)===ae.y&&((Ke=fe.size)==null?void 0:Ke.width)===Y.width&&((We=fe.size)==null?void 0:We.height)===Y.height&&fe.selected===pe)return _.add(T),fe.node;const je={...X,id:HC(T),position:ae,selected:pe,width:Y.width,height:Y.height,data:{...X.data,sourceNodeId:T,displayPageMode:!0,readOnly:!0,selected:pe,displaySize:Y,nodeSize:Y}};return S.set(T,{source:X,position:ae,size:Y,selected:pe,node:je}),_.add(T),je}).filter(Boolean);for(const T of S.keys())_.has(T)||S.delete(T);return P},[I,l0,ut,M]),_l=m.useMemo(()=>rs.filter(x=>En(x==null?void 0:x.data)),[rs]);m.useEffect(()=>{if(!ut||!I.viewport)return;const x=I.viewport,S=()=>{try{r.setViewport(x,{duration:0})}catch{}},_=window.requestAnimationFrame(()=>window.requestAnimationFrame(S));return()=>window.cancelAnimationFrame(_)},[I.viewport,ut,r]),m.useEffect(()=>{if(ut||_n||!A)return;const x=A,S=()=>{try{r.setViewport(x,{duration:0})}catch{}},_=window.requestAnimationFrame(()=>window.requestAnimationFrame(S));return()=>window.cancelAnimationFrame(_)},[ut,_n,r,A]),m.useEffect(()=>{_n&&wu(or)},[_n]),m.useEffect(()=>{if(!_n||!or)return;const x=Pr(a);x.set("tapdId",or);let S=null,_=null,P=!1;const T=()=>{_&&(window.clearTimeout(_),_=null),S&&(S.onmessage=null,S.onerror=null,S.close(),S=null)},U=()=>{P||document.hidden||S||(S=new EventSource(`/api/prd-workflow/events?${x.toString()}`),S.onmessage=()=>{wu(or)},S.onerror=()=>{T(),!P&&!document.hidden&&(_=window.setTimeout(U,5e3))})},X=()=>{if(document.hidden){T();return}wu(or),U()};return U(),document.addEventListener("visibilitychange",X),()=>{P=!0,document.removeEventListener("visibilitychange",X),T()}},[a,_n,wu,or]),m.useEffect(()=>{if(!a.flowId||_n)return;const x=Pr(a);x.set("clientId",St.current);let S=null,_=null,P=!1;const T=()=>{_&&(window.clearTimeout(_),_=null),S&&(S.onmessage=null,S.onerror=null,S.close(),S=null)},U=()=>{P||document.hidden||S||(S=new EventSource(`/api/workspace/events?${x.toString()}`),S.onmessage=J=>{let Y=null;try{Y=JSON.parse(J.data||"{}")}catch{Y=null}if(!(!Y||Y.clientId===St.current)){if(Y.type==="graph.committed"){Nl(Y);return}if(Y.type==="runtime.committed"){Nl(Y);return}if(String(Y.type||"").startsWith("file.")){Cn();return}String(Y.type||"").startsWith("run.")&&Df()}},S.onerror=()=>{T(),!P&&!document.hidden&&(_=window.setTimeout(U,5e3))})},X=()=>{if(document.hidden){T();return}Nl({type:"visibility.resume"}),U()};return U(),document.addEventListener("visibilitychange",X),()=>{P=!0,document.removeEventListener("visibilitychange",X),T(),Te.current&&(window.clearTimeout(Te.current),Te.current=null),gt.current=!1}},[a,_n,Cn,Df,Nl]),m.useEffect(()=>{if(ie.current)return;const x=F.current,S=new Map,_=[];for(const P of[...rs,...ku]){const T=QG(P);S.set(P.id,T),x.get(P.id)!==T&&_.push(P.id)}F.current=S,_.length!==0&&zr(_)},[ku,rs,zr]);const Kt=m.useMemo(()=>w.find(x=>x.id===bo)||null,[w,bo]),Jg=m.useRef({id:"",draft:null}),rL=m.useMemo(()=>{const x=t_(Kt);return x?JSON.stringify(x):""},[Kt==null?void 0:Kt.data,Kt==null?void 0:Kt.id]);m.useEffect(()=>{if(!Kt){Jg.current={id:"",draft:null},ws(null),fl("");return}const x=t_(Kt),S=Jg.current;Jg.current={id:Kt.id,draft:x},ws(_=>!_||_.id!==Kt.id||S.id!==Kt.id||!S.draft?x:JJ(_,S.draft,x)),fl("")},[Kt==null?void 0:Kt.id,rL]);const Xg=m.useCallback((x=!1)=>{if(!mt||!Kt)return!1;if(!Se)return fl("Readonly workspace"),ye("Readonly workspace"),!1;fl("");const S=s_({nodes:w,edges:k,instances:Z.current,selectedNode:Kt,draft:mt,allowRename:x});return S!=null&&S.error?(fl(S.error),!1):(!(S!=null&&S.ok)||!S.changed||(Z.current=S.instances,ne(S.instances),g(S.nodes),b(S.edges),S.nextId!==Kt.id&&Fr(S.nextId),zr(S.nextId)),!0)},[k,mt,w,Kt,b,g,zr,Se]);m.useEffect(()=>{if(!Se||!mt||!Kt)return;const x=window.setTimeout(()=>{Xg(!1)},350);return()=>window.clearTimeout(x)},[mt==null?void 0:mt.label,mt==null?void 0:mt.role,mt==null?void 0:mt.model,mt==null?void 0:mt.body,JSON.stringify((mt==null?void 0:mt.images)||[]),mt==null?void 0:mt.script,mt==null?void 0:mt.scriptRef,mt==null?void 0:mt.implementationRef,mt==null?void 0:mt.implementationMode,JSON.stringify((mt==null?void 0:mt.inputs)||[]),JSON.stringify((mt==null?void 0:mt.outputs)||[]),Xg,Kt==null?void 0:Kt.id,Se]);const d0=m.useRef({refs:new Map,nodeDataById:new Map}),Qg=m.useMemo(()=>{const x=d0.current;let S=x.refs.size!==w.length;const _=new Map;for(const T of w)_.set(T.id,T.data),(!x.refs.has(T.id)||x.refs.get(T.id)!==T.data)&&(S=!0);if(!S)return x.nodeDataById;const P=new Map(w.map(T=>[T.id,T.data]));return d0.current={refs:_,nodeDataById:P},P},[w]),sL=m.useMemo(()=>k.map(x=>{var Y,ae;const S=Qg.get(x.source),_=Qg.get(x.target),P=/^output-(\d+)$/.exec(x.sourceHandle||""),T=/^input-(\d+)$/.exec(x.targetHandle||""),U=S&&P?(Y=S.outputs)==null?void 0:Y[parseInt(P[1],10)]:null,X=_&&T?(ae=_.inputs)==null?void 0:ae[parseInt(T[1],10)]:null,J=U!=null&&U.type?Pn(U.type):X!=null&&X.type?Pn(X.type):"";return J?{...x,style:{...x.style||{},stroke:J,strokeWidth:2},markerEnd:{type:ji.ArrowClosed,color:J}}:x}),[Qg,k]),Kf=ut?ku:rs,iL=ut?[]:sL,f0=m.useRef(Kf),El=m.useRef([]);ie.current||(f0.current=Kf);const oL=m.useMemo(()=>ut?ku.map(x=>({...x,id:Vp(x.id)})):rs,[ku,rs,ut]),Zg=m.useCallback(x=>{const S=String(x||"").trim();if(!S)return;const _=ut?HC(S):S;ut?K([S]):(g(T=>T.map(U=>({...U,selected:U.id===_}))),b(T=>T.map(U=>({...U,selected:!1}))),Fr(_));const P=()=>{var ae,pe,fe;const T=r.getNode(_);if(!T)return;const U=(ae=r.getInternalNode)==null?void 0:ae.call(r,_),X=((pe=U==null?void 0:U.measured)==null?void 0:pe.width)??(U==null?void 0:U.width)??T.width??260,J=((fe=U==null?void 0:U.measured)==null?void 0:fe.height)??(U==null?void 0:U.height)??T.height??120,{zoom:Y}=r.getViewport();r.setCenter(T.position.x+X/2,T.position.y+J/2,{zoom:oJ(Y),duration:240})};window.requestAnimationFrame(()=>window.requestAnimationFrame(P))},[ut,r,b,g]);m.useEffect(()=>{const x=String(c.current||"").trim();!x||!ce.current||d!=="workspace"||rs.some(S=>S.id===x)&&(c.current="",be.current=!0,Zg(x))},[rs,Zg,d]);const p0=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(ut){const _={...H.current,viewport:S};H.current=_,R(_),ye("已固定 Display 进入视角")}else{D.current=S,L(S);try{window.localStorage.setItem(u,JSON.stringify(S))}catch{}ye("已固定 Workspace 进入视角");return}tn(j.current,N.current).catch(_=>ye(String(_.message||_)))},[ut,r,tn,u]),ey=m.useMemo(()=>{const x=Ie.trim().toLowerCase(),S={DISPLAY:[],CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const _ of ot)x&&![_.id,_.label,_.displayName,_.description].some(P=>String(P||"").toLowerCase().includes(x))||S[Xu(_)].push(_);for(const _ of Vl)S[_].sort((P,T)=>P.id.localeCompare(T.id));return S},[ot,Ie]),vu=m.useMemo(()=>{const x=en.trim().toLowerCase();return ot.filter(S=>!x||[S.id,S.label,S.displayName,S.description].some(_=>String(_||"").toLowerCase().includes(x))).sort((S,_)=>{const P=Vl.indexOf(Xu(S)),T=Vl.indexOf(Xu(_));return P!==T?P-T:Qu(S).localeCompare(Qu(_))}).slice(0,30)},[ot,en]),Su=m.useMemo(()=>{const x=en.trim().toLowerCase();return vt.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)},[vt,en]);m.useEffect(()=>{Ls(0)},[en,Ae,Zt]),m.useEffect(()=>{if(!Ae)return;const x=window.setTimeout(()=>{var S;return(S=wS.current)==null?void 0:S.focus()},0);return()=>window.clearTimeout(x)},[Ae]);const aL=m.useMemo(()=>{const x=_g.trim().toLowerCase();return x?Cv(pl).filter(S=>S.path.toLowerCase().includes(x)):pl},[_g,pl]),va=m.useMemo(()=>hM(pl,Eg),[pl,Eg]),Hi=(va==null?void 0:va.type)==="directory"?va.path:TJ((va==null?void 0:va.path)||""),lL=m.useCallback(x=>{var S,_;(_=(S=x.target)==null?void 0:S.closest)!=null&&_.call(S,".af-work-file")||Ag("")},[]),cL=[...(ga.cursor||[]).map(x=>({label:`Cursor · ${x.split(" - ")[0]}`,value:`cursor:${x.split(" - ")[0]}`})),...(ga.opencode||[]).map(x=>({label:`OpenCode · ${x.split(" - ")[0]}`,value:`opencode:${x.split(" - ")[0]}`})),...(ga.claudeCode||[]).map(x=>({label:`Claude · ${x.split(" - ")[0]}`,value:`claude-code:${x.split(" - ")[0]}`})),...(ga.codex||[]).map(x=>({label:`Codex · ${x.split(" - ")[0]}`,value:`codex:${x.split(" - ")[0]}`}))],ty=m.useMemo(()=>new Set(Ds),[Ds]),Al=m.useMemo(()=>{const x=new Map(Os.map(U=>[U.key,U])),S=new Set,_=new Set,P=yl.map(U=>{const X=ra(U,Os).map(J=>x.get(J)).filter(Boolean);for(const J of X)S.add(J.key),_.add(String(J.name||J.id||J.key||"").trim());return{...U,skills:X}}).filter(U=>U.skills.length>0),T=Os.filter(U=>{const X=String(U.name||U.id||U.key||"").trim();return!S.has(U.key)&&!_.has(X)});return{groups:P,ungrouped:T}},[yl,Os]);m.useEffect(()=>{gS(x=>{let S=!1;const _=new Set(x);for(const P of Al.groups)_.has(P.id)||(_.add(P.id),S=!0);return S?_:x})},[Al.groups]);const nr=m.useMemo(()=>{const x=w.filter(S=>S.selected);return x.length>0?x:bo?w.filter(S=>S.id===bo):[]},[w,bo]),qf=m.useMemo(()=>nr.map(x=>x.id),[nr]),h0=m.useCallback(()=>{if(ut)return;if(!Se){ye("Readonly workspace");return}const x=(j.current||[]).filter(J=>(J==null?void 0:J.selected)&&!bm(J));if(x.length<2){ye("选择至少两个节点后按 G 创建 Group");return}const S=x.reduce((J,Y)=>{var Ve,ze,Ke,We,Me,Bt,st,Ge,Le,Lt,De,dt;const ae=Number(((Ve=Y.position)==null?void 0:Ve.x)||0),pe=Number(((ze=Y.position)==null?void 0:ze.y)||0),fe=Number(((Ke=Y.measured)==null?void 0:Ke.width)||Y.width||((Me=(We=Y.data)==null?void 0:We.nodeSize)==null?void 0:Me.width)||((st=(Bt=Y.data)==null?void 0:Bt.displaySize)==null?void 0:st.width)||HT),je=Number(((Ge=Y.measured)==null?void 0:Ge.height)||Y.height||((Lt=(Le=Y.data)==null?void 0:Le.nodeSize)==null?void 0:Lt.height)||((dt=(De=Y.data)==null?void 0:De.displaySize)==null?void 0:dt.height)||hm);return{minX:Math.min(J.minX,ae),minY:Math.min(J.minY,pe),maxX:Math.max(J.maxX,ae+fe),maxY:Math.max(J.maxY,pe+je)}},{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((j.current||[]).map(J=>J.id));let P=1,T=`group_${P}`;for(;_.has(T);)P+=1,T=`group_${P}`;const U=bb({width:S.maxX-S.minX+Bp*2,height:S.maxY-S.minY+Bp*2})||{width:rl,height:sl},X={id:T,type:kc,position:{x:S.minX-Bp,y:S.minY-Bp},width:U.width,height:U.height,selected:!0,draggable:!0,selectable:!0,zIndex:0,data:{isWorkspaceGroup:!0,label:km(P-1),title:km(P-1),color:"purple",nodeSize:U}};g(J=>[X,...J.map(Y=>({...Y,selected:!1}))]),b(J=>J.map(Y=>({...Y,selected:!1}))),Fr(""),ye(`Created group for ${x.length} nodes`)},[ut,b,g,Se]),ju=m.useMemo(()=>w.filter(x=>En(x==null?void 0:x.data)),[w]),ny=m.useMemo(()=>nr.filter(x=>En(x==null?void 0:x.data)).map(x=>x.id),[nr]),uL=m.useMemo(()=>{const x=String((_r==null?void 0:_r.username)||(_r==null?void 0:_r.userId)||"").trim();return x?x.slice(0,1).toUpperCase():"?"},[_r]),ry=m.useMemo(()=>new Set(qf),[qf]),Uf=m.useMemo(()=>k.filter(x=>ry.has(x.source)&&ry.has(x.target)),[k,ry]),sy=m.useCallback(x=>{const S=x==="display"?"display":x==="workflow"?"workflow":"workspace";f(S),Fr(""),K([]),ee(null),Ye(!1),gn(!1);const _=Pr(a);S==="display"&&_.set("view","display"),S==="workflow"&&(_.set("view","workflow"),or.trim()&&_.set("tapdId",or.trim()));const P=`/workspace${_.toString()?`?${_.toString()}`:""}`;window.history.pushState({},"",P)},[a,or]),m0=m.useCallback(x=>{const S=String(x||"").trim();if(!S)return;const _=j.current.find(P=>P.id===S);if(!_||!En(_.data)){ye("展示节点不可用");return}R(P=>{if(P.nodeIds.includes(S))return P;const T=P.nodeIds.length,U=ql(_);return{nodeIds:[...P.nodeIds,S],nodePositions:{...P.nodePositions,[S]:{x:180+T*36,y:120+T*28}},nodeSizes:{...P.nodeSizes,...U?{[S]:U}:{}}}}),K([S])},[]),g0=m.useCallback(x=>{const S=String(x||"").trim();S&&(R(_=>{const P=_.nodeIds.filter(X=>X!==S),T={..._.nodePositions},U={..._.nodeSizes};return delete T[S],delete U[S],{nodeIds:P,nodePositions:T,nodeSizes:U}}),K(_=>_.filter(P=>P!==S)))},[]),y0=m.useCallback(x=>{const S=String(x||"").trim();S&&(H.current.nodeIds.includes(S)?g0(S):m0(S))},[m0,g0]),Yf=m.useMemo(()=>{const x=zn.trim().toLowerCase();return x?_l.filter(S=>{var _,P;return[S.id,(_=S.data)==null?void 0:_.label,(P=S.data)==null?void 0:P.definitionId].filter(Boolean).some(T=>String(T).toLowerCase().includes(x))}):_l},[_l,zn]),w0=m.useMemo(()=>{const x=Yf.length,S=x<=1?1:x<=4?2:3,_=Array.from({length:S},()=>({height:0,nodes:[]}));for(const P of Yf){const T=ql(P)||{width:420,height:260},U=Math.max(1,Number(T.width)||420),X=Math.max(1,Number(T.height)||260),J=Math.min(26,Math.max(5.5,X/U*16))+3.2;let Y=_[0];for(const ae of _)ae.height<Y.height&&(Y=ae);Y.nodes.push(P),Y.height+=J}return _.map(P=>P.nodes)},[Yf]),dL=m.useCallback(x=>{var U;const S=I.nodeIds.includes(x.id),_=ql(x)||{width:420,height:260},P=Math.max(1,Math.round(Number(_.width)||420)),T=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} / ${T}`},onClick:()=>y0(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(kJ,{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:[En(x.data)," · ",x.id]})]})]},x.id)},[I.nodeIds,y0]),x0=m.useMemo(()=>{const x=Ie.trim().toLowerCase();return x?vt.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))):vt},[vt,Ie]),b0=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)}`,T=2;for(;S.has(P);)P=`${_}_${Date.now().toString(36)}_${T}`,T+=1;return S.add(P),P},[]),Nu=m.useCallback((x,S)=>{var Le,Lt;if(!Se){ye("Readonly workspace");return}const _=x!=null&&x.snippet&&typeof x.snippet=="object"?x.snippet:{},P=_.instances&&typeof _.instances=="object"?_.instances:{},T=Object.keys(P);if(T.length===0)return;const U=new Set(j.current.map(De=>De.id)),X={};for(const De of T)X[De]=b0(De,U);const J=(Le=_.ui)!=null&&Le.nodePositions&&typeof _.ui.nodePositions=="object"?_.ui.nodePositions:{},Y=(Lt=_.ui)!=null&&Lt.nodeSizes&&typeof _.ui.nodeSizes=="object"?_.ui.nodeSizes:{},ae=T.map(De=>{const dt=J[De];return{id:De,x:typeof(dt==null?void 0:dt.x)=="number"?dt.x:0,y:typeof(dt==null?void 0:dt.y)=="number"?dt.y:0}}),pe=Math.min(...ae.map(De=>De.x)),fe=Math.min(...ae.map(De=>De.y));let je=S||{x:360+j.current.length*24,y:180+j.current.length*18};if(!S){const De=document.querySelector(".af-workspace-canvas .react-flow");if(De){const dt=De.getBoundingClientRect();je=r.screenToFlowPosition({x:dt.left+dt.width*.48,y:dt.top+dt.height*.32})}}const Ve={},ze={},Ke={};for(const De of ae){const dt=X[De.id];Ve[dt]={...P[De.id]||{}},ze[dt]={x:je.x+(De.x-pe),y:je.y+(De.y-fe)};const Pt=Y[De.id];typeof(Pt==null?void 0:Pt.width)=="number"&&typeof(Pt==null?void 0:Pt.height)=="number"&&(Ke[dt]={width:Pt.width,height:Pt.height})}const We=new Set(T),Me=(Array.isArray(_.edges)?_.edges:[]).filter(De=>We.has(De==null?void 0:De.source)&&We.has(De==null?void 0:De.target)).map(De=>({source:X[De.source],target:X[De.target],sourceHandle:De.sourceHandle??null,targetHandle:De.targetHandle??null})),Bt=Fu({instances:Ve,edges:Me,ui:{nodePositions:ze,nodeSizes:Ke}},ot),st=Bt.nodes.map(De=>De.id),Ge=Bt.nodes.map(De=>({...De,selected:!0}));Z.current={...Z.current,...Bt.instances},ne(Z.current),g(De=>[...De.map(dt=>({...dt,selected:!1})),...Ge]),b(De=>[...De.map(dt=>({...dt,selected:!1})),...Bt.edges.map(dt=>({...dt,selected:!1}))]),Fr(""),K([]),ye(`已添加流程片段:${x.displayName||x.id}(已选中 ${st.length} 个节点)`)},[b0,ot,r,b,g,Se]),fL=m.useCallback(()=>{var _,P;if(nr.length<2){ir("请先在 workspace 画布上选择至少两个节点。"),Et("flows");return}const x=nr[0],S=nr.length===2?`${((_=x.data)==null?void 0:_.label)||x.id} 片段`:`${((P=x.data)==null?void 0:P.label)||x.id} 等 ${nr.length} 个节点`;Cr({name:S,id:S.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),Dn(""),Qn(!0),Et("flows")},[nr]),pL=m.useCallback(async()=>{var T,U;if(nr.length<2)return;const x=Zn.name.trim();if(!x){Dn("请填写片段名称。");return}const S={},_={};for(const X of nr){S[X.id]={x:((T=X.position)==null?void 0:T.x)||0,y:((U=X.position)==null?void 0:U.y)||0};const J=ql(X);J&&(_[X.id]=J)}const P=Uf.map(X=>({source:X.source,target:X.target,sourceHandle:X.sourceHandle??null,targetHandle:X.targetHandle??null}));Ts(!0),Dn("");try{const X=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:Zn.id,name:x,displayName:x,version:"1.0.0",description:Zn.description,snippet:{instances:gv(nr,Z.current),edges:P,ui:{nodePositions:S,nodeSizes:_}}})}),J=await X.json().catch(()=>({}));if(!X.ok||J.ok===!1)throw new Error(J.error||"发布流程片段失败");Qn(!1),ye(`流程片段已发布:${J.id||x}`),hS(`流程片段已发布:${J.id||x}`),await Of(),Et("flows")}catch(X){Dn(String(X.message||X))}finally{Ts(!1)}},[Of,Zn,Uf,nr,hS]),k0=m.useCallback(async()=>{var S;const x=ru.trim();if(x){Kv(!0),nu("");try{const _=await fetch("/api/workspace/collaboration/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,username:x,role:"editor"})}),P=await _.json().catch(()=>({}));if(!_.ok)throw new Error(P.error||"添加协作成员失败");Sg(P.workspace||null),Uv(""),ye(`已将 Workspace 分享给 ${((S=P.member)==null?void 0:S.username)||x}`)}catch(_){nu(String(_.message||_))}finally{Kv(!1)}}},[a,ru]),hL=m.useCallback(()=>{nu(""),jg(!0)},[]),mL=m.useCallback(async x=>{const S=String((x==null?void 0:x.userId)||"").trim();if(!(!S||S===(an==null?void 0:an.ownerId))){Gv(S),nu("");try{const _=await fetch("/api/workspace/collaboration/share",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,memberUserId:S})}),P=await _.json().catch(()=>({}));if(!_.ok)throw new Error(P.error||"取消成员分享失败");Sg(P.workspace||null),ye(`已取消对 ${(x==null?void 0:x.username)||S} 的分享`)}catch(_){nu(String(_.message||_))}finally{Gv("")}}},[a,an==null?void 0:an.ownerId]),v0=m.useCallback(async()=>{const x=Bl(j.current,N.current,Z.current);x.ui={...x.ui||{},...D.current?{viewport:D.current}:{},displayPage:WC(H.current,j.current)};const S=new Blob([`${JSON.stringify(x,null,2)}
|
|
264
|
-
`],{type:"application/json"}),_=URL.createObjectURL(S),P=document.createElement("a");P.href=_,P.download=`${a.flowId||"workspace"}-conflict-draft-${Date.now()}.json`,document.body.appendChild(P),P.click(),P.remove(),URL.revokeObjectURL(_),await ks(),hl(null),ma(!1),ye("已备份本地草稿并载入远端最新版本")},[N,a.flowId,ks,j]),gL=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)){su("当前冲突缺少字段合并数据,请改用“备份并载入远端”。");return}let S=Nn.mergeGraph;try{x.forEach((P,T)=>{const U=Cg[String(T)]||{mode:"local"};let X,J=!0;U.mode==="remote"?(X=P.current,J=P.hasCurrent!==!1):U.mode==="manual"?X=JSON.parse(String(U.manual||"")):(X=P.incoming,J=P.hasIncoming!==!1),S=sX(S,P.pathParts,X,J)})}catch(P){su(`手动值不是有效 JSON:${String(P.message||P)}`);return}Jv(!0),su(""),zs("saving"),Bs("正在提交冲突解决结果");const _=Ce.current.catch(()=>{}).then(async()=>{const P=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,graph:S,baseRevision:Nn.currentRevision,baseGraph:Nn.currentGraph,clientId:St.current})}),T=await P.json().catch(()=>({}));if(!P.ok){if(P.status===409&&Array.isArray(T.conflictItems)){const U=T.conflictItems;hl({currentRevision:String(T.currentRevision||""),message:T.error||"Workspace 再次出现冲突",conflictPaths:Array.isArray(T.conflictPaths)?T.conflictPaths:[],conflictItems:U,mergeGraph:T.mergeGraph||null,currentGraph:T.currentGraph||null}),ml(Object.fromEntries(U.map((X,J)=>[String(J),{mode:"local",manual:zu(X)}])))}throw new Error(T.error||"提交冲突解决结果失败")}await ks(),hl(null),ma(!1),ye("冲突已解决并保存")});Ce.current=_;try{await _}catch(P){su(String(P.message||P)),zs("error"),Bs(String(P.message||P))}finally{Jv(!1)}},[a,ks,Nn,Cg]);m.useCallback(()=>{if(ju.length===0){ye("当前 workspace 没有 display 节点");return}const x=ny.length>0?ny:ju.map(_=>_.id),S=a.flowId?`${a.flowId} 展示页`:"AgentFlow Display";Ft(yw({title:S,layout:"gallery",nodeIds:x,mode:"multi-node"})),le(""),nt(null),Or(!0)},[a.flowId,ny,ju]);const yL=m.useCallback(x=>{Ft(S=>{const _=Array.isArray(S.nodeIds)?S.nodeIds:[];return _.includes(x)?{...S,nodeIds:_.filter(P=>P!==x)}:{...S,nodeIds:[..._,x]}})},[]),Ws=m.useCallback(async()=>{xo(!0),oe("");try{const x=await fetch("/api/display/shares"),S=await x.json().catch(()=>({}));if(!x.ok)throw new Error(S.error||"读取分享列表失败");ci(Array.isArray(S.shares)?S.shares:[])}catch(x){oe(String(x.message||x)),ci([])}finally{xo(!1)}},[]),wL=m.useCallback(()=>{Mn(!0),Tt(""),Ws()},[Ws]),xL=m.useCallback(async()=>{var _,P;const x=ct.title.trim(),S=Array.isArray(ct.nodeIds)?ct.nodeIds:[];if(S.length===0){le("请选择至少一个 display 节点。");return}Xt(!0),le(""),nt(null);try{await tn(w,k);const T=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,title:x,layout:ct.layout,nodeIds:S,...KC(ct)})}),U=await T.json().catch(()=>({}));if(!T.ok||U.ok===!1)throw new Error(U.error||"发布展示页失败");const X=new URL(U.url||`/display/${((_=U.share)==null?void 0:_.id)||""}`,window.location.origin).href;nt({...U,absoluteUrl:X}),ye((P=U.share)!=null&&P.expiresAt?"展示页已生成":"展示页已生成:永久有效"),tt&&Ws()}catch(T){le(String(T.message||T))}finally{Xt(!1)}},[ct,tt,k,a,Ws,w,tn]),bL=m.useCallback(async()=>{var S,_;const x=Array.isArray(I.nodeIds)?I.nodeIds:[];if(x.length===0){le("请先添加至少一个展示节点。"),ye("请先添加至少一个展示节点"),gn(!0);return}Xt(!0),le("");try{await tn(w,k);const P=a.flowId?`${a.flowId} 展示页`:"AgentFlow Display",T=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,title:P,layout:"canvas",nodeIds:x,...KC(ct)})}),U=await T.json().catch(()=>({}));if(!T.ok||U.ok===!1)throw new Error(U.error||"生成展示链接失败");const X=new URL(U.url||`/display/${((S=U.share)==null?void 0:S.id)||""}`,window.location.origin).href;nt({...U,absoluteUrl:X}),Yt(!0),ye((_=U.share)!=null&&_.expiresAt?"展示链接已生成":"展示链接已生成:永久有效"),tt&&Ws()}catch(P){const T=String(P.message||P);le(T),ye(T)}finally{Xt(!1)}},[I.nodeIds,ct,tt,k,a,Ws,w,tn]),S0=m.useCallback(async()=>{const x=he==null?void 0:he.absoluteUrl;if(!x)return;const S=await vb(x);tr(S?"copied":"failed"),window.setTimeout(()=>tr(""),1600)},[he==null?void 0:he.absoluteUrl]),kL=m.useCallback(async x=>{const S=qC(x),_=await vb(S);Tt(_?String((x==null?void 0:x.id)||""):"failed"),window.setTimeout(()=>Tt(""),1600)},[]),vL=m.useCallback(async(x,S)=>{const _=String((x==null?void 0:x.id)||"");if(_){Re(_),oe("");try{const P=S==="permanent"?{id:_,expiresMode:"permanent",permanent:!0}:{id:_,expiresMode:"days",expiresInDays:Number(S||30)},T=await fetch("/api/display/share",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(P)}),U=await T.json().catch(()=>({}));if(!T.ok||U.ok===!1)throw new Error(U.error||"更新分享有效期失败");await Ws(),ye("分享有效期已更新")}catch(P){oe(String(P.message||P))}finally{Re("")}}},[Ws]),SL=m.useCallback(async x=>{const S=String((x==null?void 0:x.id)||"");if(S){Re(S),oe("");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 Ws(),ye("分享已撤销")}catch(_){oe(String(_.message||_))}finally{Re("")}}},[Ws]),jL=m.useCallback(x=>{g(S=>S.map(_=>_.id===x?{..._,selected:!1}:_)),Fr(S=>S===x?"":S)},[g]),Pl=m.useCallback(()=>{const x=Dg.current;if(!x)return;const S=x.getBoundingClientRect(),_=Math.min(420,Math.max(320,S.width+160)),P=12,T=Math.max(180,S.top-P*2),U=Math.min(560,T);B$({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;Pl();const x=_=>{var T,U;const P=_.target;(T=Dg.current)!=null&&T.contains(P)||(U=yS.current)!=null&&U.contains(P)||Og(!1)},S=_=>{_.key==="Escape"&&Og(!1)};return window.addEventListener("pointerdown",x),window.addEventListener("keydown",S),window.addEventListener("resize",Pl),window.addEventListener("scroll",Pl,!0),()=>{window.removeEventListener("pointerdown",x),window.removeEventListener("keydown",S),window.removeEventListener("resize",Pl),window.removeEventListener("scroll",Pl,!0)}},[Mf,Pl]);const Gf=m.useCallback(x=>{const S=BT(x);if(S.active&&(ie.current=!0),S.finished&&(ie.current=!1,Ze.current=!0),PY(x)&&fi(),d==="display"){R(T=>{var Y,ae;let U=T.nodePositions,X=T.nodeSizes;for(const pe of x||[]){const fe=Vp(pe==null?void 0:pe.id);if(!(!fe||!T.nodeIds.includes(fe))&&pe.type!=="select"){if(pe.type==="position"&&pe.position){const je=U[fe];if((je==null?void 0:je.x)===pe.position.x&&(je==null?void 0:je.y)===pe.position.y)continue;U===T.nodePositions&&(U={...T.nodePositions}),U[fe]={x:pe.position.x,y:pe.position.y};continue}if(pe.type==="dimensions"&&((Y=pe.dimensions)!=null&&Y.width)&&((ae=pe.dimensions)!=null&&ae.height)){const je=Ka({width:Math.round(Number(pe.dimensions.width)),height:Math.round(Number(pe.dimensions.height))},{display:!0});if(je){const Ve=X[fe];if((Ve==null?void 0:Ve.width)===je.width&&(Ve==null?void 0:Ve.height)===je.height)continue;X===T.nodeSizes&&(X={...T.nodeSizes}),X[fe]=je}}}}if(U===T.nodePositions&&X===T.nodeSizes)return T;const J={...T,nodePositions:U,nodeSizes:X};return H.current=J,J});const P=(x||[]).filter(T=>(T==null?void 0:T.type)==="select");P.length>0&&K(T=>{const U=new Set(T);for(const J of P){const Y=Vp(J==null?void 0:J.id);Y&&(J.selected?U.add(Y):U.delete(Y))}const X=Array.from(U);return X.length===T.length&&X.every((J,Y)=>J===T[Y])?T:X});return}if(!Se){const P=(x||[]).filter(T=>(T==null?void 0:T.type)==="select");P.length>0&&g(T=>md(P,T));return}const _=(x||[]).filter(P=>{var T,U;return(P==null?void 0:P.type)==="dimensions"&&((T=P.dimensions)==null?void 0:T.width)&&((U=P.dimensions)==null?void 0:U.height)});g(P=>{const T=new Map;if(_.length>0){const J=new Map(P.map(Y=>[Y.id,Y]));for(const Y of _){const ae=J.get(Y.id),pe={width:Math.round(Number(Y.dimensions.width)),height:Math.round(Number(Y.dimensions.height))},fe=bm(ae)?bb(pe):Ka(pe,{display:!!En(ae==null?void 0:ae.data)});fe&&T.set(Y.id,fe)}}const U=md(x,P),X=T.size===0?U:U.map(J=>{const Y=T.get(J.id);if(!Y)return J;const ae={...J.data,nodeSize:Y};return En(J.data)&&(ae.displaySize=Y),{...J,width:Y.width,height:Y.height,data:ae}});return S.mutated||(He.current={nodes:X,edges:N.current,displayPage:H.current}),j.current=X,X}),_.length>0&&zr(_.map(P=>P.id))},[fi,zr,g,d,Se]),Jf=m.useCallback((x=[],{finish:S=!1}={})=>{const _=S?MY([...V.current,...x]):hb(x);S&&(V.current=[]),_.length>0&&Gf(_)},[Gf]),NL=m.useCallback(x=>{const{transient:S,committed:_,finishesInteraction:P}=TY(x);if(S.length>0){de.current&&(window.clearTimeout(de.current),de.current=null),ie.current||(ie.current=!0,El.current=f0.current),V.current=hb([...V.current,...S]);const T=md(S,El.current);El.current=T,s.getState().setNodes(T)}if(P){El.current=[],Jf(_,{finish:!0});return}_.length>0&&Gf(_)},[Gf,Jf,s]),Il=m.useCallback(()=>{ke.current.size>0||Fe.current||((ie.current||V.current.length>0)&&(Jf([],{finish:!0}),El.current=[]),gt.current&&Nl({type:"interaction.finished"}))},[Jf,Nl]),CL=m.useCallback(x=>{(x==null?void 0:x.pointerId)!=null&&ke.current.add(x.pointerId)},[]),vo=m.useCallback(x=>{(x==null?void 0:x.pointerId)!=null&&ke.current.delete(x.pointerId),window.queueMicrotask(Il)},[Il]),_L=m.useCallback(()=>{Fe.current=!0},[]),EL=m.useCallback(()=>{Fe.current=!1,window.queueMicrotask(Il)},[Il]);m.useEffect(()=>{const x=()=>{ke.current.clear(),Fe.current=!1,Il()},S=()=>{document.visibilityState==="hidden"&&x()};return window.addEventListener("pointerup",vo,!0),window.addEventListener("pointercancel",vo,!0),window.addEventListener("lostpointercapture",vo,!0),window.addEventListener("blur",x),document.addEventListener("visibilitychange",S),()=>{window.removeEventListener("pointerup",vo,!0),window.removeEventListener("pointercancel",vo,!0),window.removeEventListener("lostpointercapture",vo,!0),window.removeEventListener("blur",x),document.removeEventListener("visibilitychange",S),ke.current.clear(),Fe.current=!1,V.current=[],El.current=[]}},[vo,Il]);const AL=m.useCallback(x=>{if(d!=="display"){if(!Se){const S=(x||[]).filter(_=>(_==null?void 0:_.type)==="select");S.length>0&&b(_=>{const P=im(S,_);return N.current=P,P});return}(x||[]).some(S=>(S==null?void 0:S.type)!=="select")&&fi(),b(S=>{const _=im(x,S);return N.current=_,_})}},[fi,b,d,Se]),Rl=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+w.length*36,y:180+w.length*28}},[w.length,r]),Xf=m.useCallback(()=>{var x,S,_;if(Kt){const P=Number(((x=Kt.measured)==null?void 0:x.width)||Kt.width||260);return{x:Number(((S=Kt.position)==null?void 0:S.x)||0)+P+140,y:Number(((_=Kt.position)==null?void 0:_.y)||0)}}return Rl()},[Rl,Kt]),Wi=m.useCallback((x,S={})=>{if(!Se)return ye("Readonly workspace"),null;if(!x)return null;const _=Sv(x)||x.id,P=ZT(x),T=tM(x),U=S.id||WG(_,w),X=ed(x.inputs),J=ed(x.outputs),Y={definitionId:_,...P?{marketplaceRef:P}:{},...x.packageId?{marketplacePackageId:x.packageId}:{},...x.version?{marketplaceVersion:x.version}:{},label:S.label||xm(x),role:"normal",body:S.body||"",...S.script||T?{script:S.script||T}:{},...S.scriptRef?{scriptRef:S.scriptRef}:{},...S.implementationRef?{implementationRef:S.implementationRef}:{},...S.implementationMode?{implementationMode:S.implementationMode}:{},input:S.inputs||X,output:S.outputs||J},ae={id:U,type:kc,position:S.position||Rl(),data:{label:Y.label,definitionId:_,...P?{marketplaceRef:P}:{},...x.packageId?{marketplacePackageId:x.packageId}:{},...x.version?{marketplaceVersion:x.version}:{},schemaType:QT(_,x),role:"normal",body:Y.body,...Y.script?{script:Y.script}:{},...Y.scriptRef?{scriptRef:Y.scriptRef}:{},...Y.implementationRef?{implementationRef:Y.implementationRef}:{},...Y.implementationMode?{implementationMode:Y.implementationMode}:{},inputs:Y.input,outputs:Y.output}},pe={...fb(ae,{...Z.current,[U]:Y},ot),selected:!0};return fi(),g(fe=>[...fe.map(je=>({...je,selected:!1})),pe]),S.openProperties&&Fr(U),U},[Rl,fi,w,ot,g,Se]),PL=m.useCallback(x=>mw(x,j.current),[]),IL=m.useCallback(x=>{if(!Se){ye("Readonly workspace");return}if(!mw(x,j.current)){ye("端口类型不匹配,已取消连线");return}ee(null),fi(),g(S=>cw(S,x)),b(S=>{const _=S.filter(T=>!(T.target===x.target&&T.targetHandle===x.targetHandle)),P=yh({...x,markerEnd:{type:ji.ArrowClosed}},_);return N.current=P,P})},[fi,b,g,Se]),RL=m.useCallback((x,S)=>{if(!Se)return;const _=zG(S,j.current);re.current=_?{..._,preferExisting:!!(x!=null&&x.shiftKey)}:null,ee(null)},[Se]),TL=m.useCallback((x,S)=>{var We,Me,Bt,st;if(!Se)return;const _=re.current;if(re.current=null,!_||S!=null&&S.toNode)return;const P=BG(ot,_),T=HG(j.current,N.current,_);if(P.length===0&&T.length===0){ye(`没有匹配 ${_.slotType} 端口的节点`);return}const X=!!(x!=null&&x.shiftKey||_.preferExisting)?T.length>0?"existing":"create":P.length>0?"create":"existing",J=((Me=(We=x==null?void 0:x.changedTouches)==null?void 0:We[0])==null?void 0:Me.clientX)??(x==null?void 0:x.clientX),Y=((st=(Bt=x==null?void 0:x.changedTouches)==null?void 0:Bt[0])==null?void 0:st.clientY)??(x==null?void 0:x.clientY);if(!Number.isFinite(J)||!Number.isFinite(Y))return;const ae=document.querySelector(".af-workspace-canvas .react-flow");if(!ae)return;const pe=ae.getBoundingClientRect(),fe=320,je=Math.max(P.length,T.length),Ve=Math.min(480,150+je*58),ze=Math.max(12,Math.min(J-pe.left,pe.width-fe-12)),Ke=Math.max(12,Math.min(Y-pe.top,pe.height-Ve-12));ee({left:ze,top:Ke,flowPosition:r.screenToFlowPosition({x:J,y:Y}),draft:_,candidates:P,existingCandidates:T,mode:X,query:""})},[ot,r,Se]),ML=m.useCallback(x=>{if(!Se){ye("Readonly workspace"),ee(null);return}const S=ue.current;if(!S||!(x!=null&&x.def))return;const _=Wi(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};g(T=>cw(T,P)),b(T=>{const U=T.filter(J=>!(J.target===P.target&&J.targetHandle===P.targetHandle)),X=yh({...P,markerEnd:{type:ji.ArrowClosed}},U);return N.current=X,X}),ee(null)},[Wi,b,Se]),$L=m.useCallback(x=>{if(!Se){ye("Readonly workspace"),ee(null);return}const S=x==null?void 0:x.connection;if(!S||!mw(S,j.current)){ye("端口类型不匹配,已取消连线"),ee(null);return}g(_=>cw(_,S)),b(_=>{const P=_.filter(U=>!(U.target===S.target&&U.targetHandle===S.targetHandle)),T=yh({...S,markerEnd:{type:ji.ArrowClosed}},P);return N.current=T,T}),ee(null)},[b,g,Se]),j0=m.useCallback(x=>{x&&(Wi(x,{position:Xf()}),Ye(!1),ts(""))},[Wi,Xf]),N0=m.useCallback(x=>{x&&(Nu(x,Xf()),Ye(!1),ts(""))},[Nu,Xf]),LL=m.useCallback(x=>{var _,P,T;if(ut||_n)return;const S=x==null?void 0:x.target;RC(S)||(_=S==null?void 0:S.closest)!=null&&_.call(S,"button, a, [role='button'], .react-flow__handle")||(T=(P=C.current)==null?void 0:P.focus)==null||T.call(P,{preventScroll:!0})},[ut,_n]);m.useEffect(()=>{const x=S=>{var ae;if(S.defaultPrevented)return;const _=AU(S.target)||RC(S.target);if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="s"){S.preventDefault(),tn().catch(pe=>ye(String(pe.message||pe)));return}if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="k"){S.preventDefault(),S.stopPropagation(),jS(pe=>!pe);return}if(Kg)return;if(Vg){(S.key==="Escape"||fC(S))&&(S.preventDefault(),Lf(!1));return}const P=S.key.toLowerCase(),T=(S.metaKey||S.ctrlKey)&&P==="c",U=(S.metaKey||S.ctrlKey)&&P==="v",X=_&&T&&nG(S.target);if(_&&!X)return;const J=(S.metaKey||S.ctrlKey)&&!S.shiftKey&&P==="z",Y=(S.metaKey||S.ctrlKey)&&(S.shiftKey&&P==="z"||P==="y");if(J||Y){if(ut){S.preventDefault(),S.stopPropagation(),ye("展示页布局会自动保存");return}if(!Se){S.preventDefault(),ye("Readonly workspace");return}S.preventDefault(),S.stopPropagation();const pe=J?FS():zS();ye(pe?J?"Undo canvas change":"Redo canvas change":J?"Nothing to undo":"Nothing to redo");return}if(T){if(ut)return;const pe=Bv.current,fe=(j.current||[]).some(Ve=>Ve==null?void 0:Ve.selected)?j.current:(j.current||[]).map(Ve=>pe&&Ve.id===pe?{...Ve,selected:!0}:Ve),je=Qq(fe,N.current,Z.current);je&&(S.preventDefault(),S.stopPropagation(),B.current=je,sJ(je),X&&typeof((ae=S.target)==null?void 0:ae.blur)=="function"&&S.target.blur(),ye(`Copied ${je.nodes.length} node${je.nodes.length>1?"s":""}`));return}if(U){if(ut){S.preventDefault(),S.stopPropagation();return}if(!Se){S.preventDefault(),ye("Readonly workspace");return}const pe=B.current||iJ();pe&&!B.current&&(B.current=pe);const fe=Zq(pe,j.current,N.current,Z.current);fe&&(S.preventDefault(),S.stopPropagation(),Z.current=fe.instances,ne(fe.instances),g(fe.nodes),b(fe.edges),ye(`Pasted ${fe.pastedNodeIds.length} node${fe.pastedNodeIds.length>1?"s":""}`));return}if(fC(S)&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),Lf(!0);return}if(P==="g"&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),h0();return}if(S.key==="a"||S.key==="A"){if(S.metaKey||S.ctrlKey){S.preventDefault(),ut?K(H.current.nodeIds):(g(pe=>pe.map(fe=>({...fe,selected:!0}))),b(pe=>pe.map(fe=>({...fe,selected:!1}))));return}if(S.altKey)return;if(ut){S.preventDefault(),gn(!0);return}if(!Se){S.preventDefault(),ye("Readonly workspace");return}S.preventDefault(),Ye(!0);return}if((S.key==="v"||S.key==="V")&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),NS("select");return}if((S.key==="h"||S.key==="H")&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),NS("pan");return}(S.key==="f"||S.key==="F")&&!S.metaKey&&!S.ctrlKey&&!S.altKey&&(S.preventDefault(),p0())};return window.addEventListener("keydown",x,!0),()=>window.removeEventListener("keydown",x,!0)},[h0,ut,Kg,p0,zS,tn,Vg,b,g,FS,Se]);const OL=m.useCallback(x=>{gl(S=>{const _=new Set(S);return _.has(x)?_.delete(x):_.add(x),_})},[]),DL=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)},[]),FL=m.useCallback((x,S)=>{x.dataTransfer.effectAllowed="move",x.dataTransfer.setData("application/agentflow-node",S.id),x.dataTransfer.setData("text/plain",S.id)},[]),Qf=m.useCallback(async(x,S)=>{const _=String((x==null?void 0:x.name)||(x==null?void 0:x.path)||"").toLowerCase(),P=_.split(".").pop(),T=["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=ot.find(fe=>fe.id===T);if(!U){ye("展示节点不可用");return}const X=T==="display_image";let J=String(x.path||"");if(!X){const fe=Pr(a);fe.set("path",x.path);const je=await fetch(`/api/workspace/file?${fe.toString()}`),Ve=await je.json();if(!je.ok)throw new Error(Ve.error||"读取文件失败");J=String(Ve.content||"")}const Y=T==="display_image"?"src":"content",ae=ed(U.inputs).map(fe=>fe.name===Y?{...fe,default:J,value:J}:fe),pe=ed(U.outputs).map(fe=>fe.name===Y?{...fe,default:J,value:J}:fe);Wi(U,{label:x.name||"Display",body:J,inputs:ae,outputs:pe,position:S}),ye(`已创建展示:${x.path}`)},[Wi,a,ot]),zL=m.useCallback(x=>{if(!Se){ye("Readonly workspace");return}Qf(x,Rl()).catch(S=>ye(String(S.message||S)))},[Qf,Rl,Se]),BL=m.useCallback(x=>{if(!Se){x.preventDefault(),ye("Readonly workspace");return}const S=x.dataTransfer.getData("application/x-agentflow-workspace-file");if(S){x.preventDefault();let X;try{X=JSON.parse(S)}catch{return}if(!(X!=null&&X.path))return;const J=r.screenToFlowPosition({x:x.clientX,y:x.clientY});Qf(X,J).catch(Y=>ye(String(Y.message||Y)));return}const _=x.dataTransfer.getData("application/agentflow-snippet");if(_){const X=vt.find(Y=>`${Y.id}@${Y.version}`===_);if(!X)return;x.preventDefault();const J=r.screenToFlowPosition({x:x.clientX,y:x.clientY});Nu(X,J);return}const P=x.dataTransfer.getData("application/agentflow-node");if(!P)return;const T=ot.find(X=>X.id===P);if(!T)return;x.preventDefault();const U=r.screenToFlowPosition({x:x.clientX,y:x.clientY});Wi(T,{position:U})},[Qf,Wi,vt,Nu,ot,r,Se]),HL=m.useCallback(x=>{if(!Se)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")},[Se]),WL=m.useCallback(async(x="")=>{if(!Se){ye("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({...a,path:_,content:""})}),T=await P.json();if(!P.ok)throw new Error(T.error||"创建文件失败");await Cn(),gl(U=>{const X=new Set(U);for(const J of Kp(T.path||_))X.delete(J);return X}),ye(`已创建 ${T.path}`)}catch(P){ye(String(P.message||P))}},[a,Cn,Se]),VL=m.useCallback(async(x="")=>{if(!Se){ye("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({...a,path:_})}),T=await P.json();if(!P.ok)throw new Error(T.error||"创建文件夹失败");await Cn(),gl(U=>{const X=new Set(U);for(const J of Kp(T.path||_))X.delete(J);return T.path&&X.delete(T.path),X}),ye(`已创建 ${T.path}`)}catch(P){ye(String(P.message||P))}},[a,Cn,Se]),KL=m.useCallback(async x=>{if(!Se){ye("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({...a,path:x.path})}),_=await S.json();if(!S.ok)throw new Error(_.error||"删除失败");ye(`已删除 ${_.path}`),await Cn()}catch(S){ye(String(S.message||S))}},[a,Cn,Se]),qL=m.useCallback(x=>{if(!(x!=null&&x.path)||x.type==="directory")return;const S=tf(x.path,a,{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()},[a]),Zf=m.useCallback(async()=>{if(!Se){ye("Readonly workspace");return}const x=ya.trim(),S=Br,_=Fs.find(X=>X.id===S)||null;if(!x||ns||(_==null?void 0:_.status)==="running"||(_==null?void 0:_.status)==="stopping")return;const P=_?Array.isArray(_.messages)?_.messages:[]:wa,T=Bl(w,k,Z.current);Fg(""),xS(!0),bl(!0),kl(null);const U={role:"user",text:x,at:Date.now()};_?Kn(X=>X.map(J=>J.id===S?{...J,status:"running",messages:[...Array.isArray(J.messages)?J.messages:[],U].slice(-180)}:J)):(bs("workspace"),xl(X=>[...X,U]));try{await tn(w,k);const X=await fetch("/api/workspace/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...a,prompt:x,outputKind:"markdown",workspaceGraph:T,allowFlowYaml:!1,model:Fi,selectedSkills:Ds,selectedNodeIds:qf,messages:P})}),J=await X.json();if(!X.ok)throw new Error(J.error||"生成失败");const ae={role:"assistant",kind:"assistant",text:String(J.content||"").trim(),at:Date.now()};_?Kn(pe=>pe.map(fe=>fe.id===S?{...fe,status:"done",messages:[...Array.isArray(fe.messages)?fe.messages:[],ae].slice(-180)}:fe)):xl(pe=>[...pe,ae]),await ks(),ye("AI 生成完成")}catch(X){const J=String(X.message||X),Y={role:"assistant",text:J,error:!0,at:Date.now()};_?Kn(ae=>ae.map(pe=>pe.id===S?{...pe,status:"failed",messages:[...Array.isArray(pe.messages)?pe.messages:[],Y].slice(-180)}:pe)):xl(ae=>[...ae,Y]),ye(J)}finally{xS(!1)}},[Br,wa,Fi,Fs,ns,ya,k,a,ks,w,tn,qf,Ds,Se]),ar=Fs.find(x=>x.id===Br)||null,iy=ar?Array.isArray(ar.messages)?ar.messages:[]:wa,Tl=ar&&(ar.status==="running"||ar.status==="stopping")||ns,UL=zJ(iy,Tl),oy=BJ(iy),C0=ar?ar.status==="stopping"?`${ar.label} stopping`:ar.status==="running"?`${ar.label} running`:ar.status==="paused"?`${ar.label} paused`:ar.status==="failed"?`${ar.label} failed`:`${ar.label} done`:ns?"Workspace agent running":wa.length>0?"Workspace conversation":"Ready";m.useEffect(()=>{Br!=="workspace"&&(Fs.some(x=>x.id===Br)||bs(ka()))},[Br,Fs,ka]),m.useEffect(()=>{if(!cu)return;const x=window.requestAnimationFrame(()=>{var _,P;const S=bS.current;S&&(S.scrollTop=S.scrollHeight),(P=(_=zg.current)==null?void 0:_.scrollIntoView)==null||P.call(_,{block:"nearest",inline:"nearest"})});return()=>window.cancelAnimationFrame(x)},[iy.length,Br,C0,oy.length,cu]);const YL=String(a.flowId||"").trim()||"Workspace",So=(ct==null?void 0:ct.mode)==="single-node",_0=So&&ju.find(x=>{var S;return x.id===ct.sourceNodeId||((S=ct.nodeIds)==null?void 0:S.includes(x.id))})||null,GL=So&&_0?[_0]:ju;return i.jsxs("div",{className:"af-workspace-page",children:[l?null: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(a.adminOwnerId?"/admin/usage":"/projects"),"aria-label":"返回",children:i.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),i.jsxs("div",{className:"af-pipeline-brand",title:a.flowId?`${a.flowId} · ${Vv}`:Vv||"PROJECT",children:[i.jsx("span",{className:"af-pipeline-brand-name",children:YL}),i.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",UY,"-STABLE"]})]}),Af?i.jsxs("span",{className:"af-workspace-admin-review-badge",title:"管理员审阅模式不会修改、运行或加入该 Workspace",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"visibility"}),"只读查看 · ",Af.ownerUsername||Af.ownerUserId]}):null,i.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[i.jsx("button",{type:"button",className:d==="workspace"?"af-view-switch__active":"",onClick:()=>sy("workspace"),children:"Workspace"}),i.jsx("button",{type:"button",className:d==="display"?"af-view-switch__active":"",onClick:()=>sy("display"),children:"Display"}),i.jsx("button",{type:"button",className:d==="workflow"?"af-view-switch__active":"",onClick:()=>sy("workflow"),children:"Workflow"})]})]}),i.jsxs("div",{className:"af-pipeline-top-right af-workspace-actions",children:[i.jsx("span",{className:`af-workspace-sync-light is-${IS}`,title:`${OS} · ${RS}`,role:"status","aria-label":`${OS}:${RS}`,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?ma(!0):v0()},title:["先下载当前本地草稿,再载入远端最新版本",...Nn.conflictPaths||[]].join(`
|
|
265
|
-
`),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"difference"}),"处理冲突"]}):null,ut?i.jsxs(i.Fragment,{children:[i.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:!Se||er||!(he!=null&&he.absoluteUrl)&&I.nodeIds.length===0,onClick:()=>{tr(""),Yt(!0)},title:he!=null&&he.absoluteUrl?"查看展示链接":I.nodeIds.length===0?"先添加展示节点":"生成展示链接",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:er?"hourglass_empty":"ios_share"}),er?"生成中":he!=null&&he.absoluteUrl?"展示链接":"生成链接"]}),i.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:!Se||_l.length===0,onClick:()=>gn(!0),title:_l.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:!Se||!!(an!=null&&an.role&&an.role!=="owner"),onClick:hL,title:an!=null&&an.role&&an.role!=="owner"?"仅 Workspace 所有者可以创建邀请":"邀请其他成员协作编辑",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"group_add"}),"协作分享"]}),Af?null:i.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",onClick:wL,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:!LS,onClick:()=>h(!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:!LS&&!gu,onClick:()=>v(!0),"aria-label":gu?"退出共享 Workspace":e("flow:topbar.deletePipeline"),title:gu?"退出共享 Workspace":e("flow:topbar.deletePipeline"),children:i.jsx("span",{className:"material-symbols-outlined",children:gu?"logout":"delete_forever"})}),i.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Lf(!0),"aria-label":"快捷键",title:"快捷键 (?)",children:i.jsx("span",{className:"material-symbols-outlined",children:"help"})}),i.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(cu?" af-composer-topbar-btn--active":"")+(ns?" af-composer-topbar-btn--running":""),disabled:!Se||ut||_n,onClick:()=>{kl(null),bl(x=>(x||bs(ka()),!x))},children:"AI"}),i.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!Se,onClick:()=>tn().catch(x=>ye(String(x.message||x))),children:"Save"})]})]}),Zr?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:Zr}),i.jsx("button",{type:"button",onClick:()=>Tn(""),"aria-label":"关闭发布提示",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,i.jsxs("div",{className:"af-workspace-body"+(!ut&&!_n&&(cu||mt)?" af-workspace-body--drawer":"")+(!ut&&!_n&&du?" af-workspace-body--sidebar-collapsed":"")+(ut?" af-workspace-body--display-mode":"")+(_n?" af-workspace-body--workflow-mode":""),children:[!ut&&!_n&&du?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:()=>Ye(!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:()=>$f(!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:()=>$f(!1),"aria-label":"展开侧边栏",title:(_r==null?void 0:_r.username)||(_r==null?void 0:_r.userId)||"展开侧边栏",children:uL})]})}):null,!ut&&!_n?i.jsxs("aside",{ref:Ig,className:"af-workspace-sidebar"+(A$?" af-workspace-sidebar--resizing":""),"aria-hidden":du,style:{"--af-work-files-pane-height":`${Math.round(Rg)}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:()=>$f(!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:!Se,onClick:()=>WL(Hi),"aria-label":"新增文件",title:Hi?`在 ${Hi} 新增文件`:"新增文件",children:i.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),i.jsx("button",{type:"button",className:"af-icon-btn",disabled:!Se,onClick:()=>VL(Hi),"aria-label":"新增文件夹",title:Hi?`在 ${Hi} 新增文件夹`:"新增文件夹",children:i.jsx("span",{className:"material-symbols-outlined",children:"create_new_folder"})}),i.jsx("button",{type:"button",className:"af-icon-btn",disabled:!Se||Qv,onClick:()=>e0(Hi),"aria-label":"上传文件",title:Hi?`上传到 ${Hi}`:"上传文件",children:i.jsx("span",{className:"material-symbols-outlined",children:Qv?"hourglass_top":"upload_file"})}),i.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>void Cn(),"aria-label":"刷新文件",title:"刷新文件",children:i.jsx("span",{className:"material-symbols-outlined",children:"refresh"})}),i.jsx("input",{ref:eS,type:"file",multiple:!0,className:"af-visually-hidden",onChange:eL})]})]}),i.jsx("input",{className:"af-workspace-search",value:_g,onChange:x=>_$(x.target.value),placeholder:"搜索文件..."}),i.jsx("div",{className:"af-workspace-files-scroll",onClick:lL,children:i.jsx(yM,{items:aL,onOpen:zL,selectedPath:Eg,collapsedDirs:E$,onToggleDir:OL,onSelect:x=>Ag(x.path||""),onFileDragStart:DL,onDelete:KL,onDownload:qL})})]}),i.jsx("button",{type:"button",className:"af-workspace-sidebar-resizer",onPointerDown:D$,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:qe==="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:Ie,onChange:x=>et(x.target.value),placeholder:qe==="flows"?"搜索流程片段...":"搜索节点...","aria-label":qe==="flows"?"搜索流程片段":"搜索节点"})]}),i.jsxs("div",{className:"af-palette-tabs",role:"tablist","aria-label":"Palette 类型",children:[i.jsxs("button",{type:"button",role:"tab","aria-selected":qe==="nodes",className:"af-palette-tab"+(qe==="nodes"?" af-palette-tab--active":""),onClick:()=>Et("nodes"),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),i.jsxs("button",{type:"button",role:"tab","aria-selected":qe==="flows",className:"af-palette-tab"+(qe==="flows"?" af-palette-tab--active":""),onClick:()=>Et("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:qe==="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:fL,disabled:nr.length<2,title:nr.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:["已选 ",nr.length," 节点 / ",Uf.length," 连线"]})]})}),Vn?i.jsx("p",{className:"af-err af-palette-list-err",children:Vn}):null,mn?i.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段..."}):x0.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:x0.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:T=>{T.dataTransfer.effectAllowed="move",T.dataTransfer.setData("application/agentflow-snippet",S),T.dataTransfer.setData("text/plain",S)},onClick:()=>Nu(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:Ie.trim()?"没有匹配的流程片段":"暂无流程片段。选择多个节点后发布。"})]}):i.jsxs(i.Fragment,{children:[Vl.map(x=>{var S;return(S=ey[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:ey[x].map(_=>{const P=FC(_.inputs,"input"),T=FC(_.outputs,"output"),U=xb(_),X=Qu(_);return i.jsxs("button",{type:"button",className:"af-palette-card",draggable:!0,onDragStart:J=>FL(J,_),onClick:()=>Wi(_),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:OC(x)})}),i.jsxs("span",{className:"af-palette-card-main",children:[i.jsx("span",{className:"af-palette-card-label",children:X}),X!==_.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((J,Y)=>i.jsxs("span",{className:"af-palette-card-port",title:DC("input",J,Y),children:[i.jsx("span",{className:"af-palette-card-port-dot",style:{background:Pn(J==null?void 0:J.type)}}),i.jsx("span",{className:"af-palette-card-port-name",children:Hp(J,Y)})]},`in-${Y}`)),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:[T.list.length," OUT"]}),i.jsxs("span",{className:"af-palette-card-port-list",children:[T.shown.map((J,Y)=>i.jsxs("span",{className:"af-palette-card-port",title:DC("output",J,Y),children:[i.jsx("span",{className:"af-palette-card-port-name",children:Hp(J,Y)}),i.jsx("span",{className:"af-palette-card-port-dot",style:{background:Pn(J==null?void 0:J.type)}})]},`out-${Y}`)),T.hidden>0?i.jsxs("span",{className:"af-palette-card-port-more",children:["+",T.hidden]}):null]})]})]})]},_.id)})})]},x):null}),ot.length>0&&Ie.trim()&&Vl.every(x=>{var S;return!((S=ey[x])!=null&&S.length)})?i.jsx("p",{className:"af-palette-empty",children:"没有匹配的节点"}):null]})})]})]}):null,_n?i.jsx(rX,{flowParams:a,tapdId:or,setTapdId:$$,snapshot:ln,loading:L$,error:O$,actionRunning:Tg,actionOutput:Mg,pendingConfirm:xs,conflict:au,reviewPublishing:$g,onRefresh:()=>wu(or),onRunDryRun:U$,onConfirmAction:Y$,onRetryConflict:G$,onPublishReview:J$}):i.jsxs("main",{ref:C,className:"af-workspace-canvas",tabIndex:-1,onPointerDownCapture:x=>{LL(x),CL(x)},onLostPointerCaptureCapture:vo,children:[i.jsx(CR,{className:"af-flow-canvas af-workspace-flow"+(qg==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select")+(ut?" af-workspace-flow--display-mode":""),nodes:Kf,edges:iL,nodeTypes:RJ,onNodesChange:NL,onEdgesChange:AL,onMoveStart:_L,onMoveEnd:EL,onConnect:ut?void 0:IL,onConnectStart:ut?void 0:RL,onConnectEnd:ut?void 0:TL,isValidConnection:ut?void 0:PL,onNodeClick:(x,S)=>{var _;if(ut){K([Vp(S.id)]);return}if((_=S==null?void 0:S.data)!=null&&_.isWorkspaceGroup){Fr("");return}if(x.detail>=3){bl(!1),g(P=>P.map(T=>({...T,selected:T.id===S.id}))),b(P=>P.map(T=>({...T,selected:!1}))),Fr(S.id);return}bo&&Fr(S.id)},onNodeDoubleClick:x=>{x.preventDefault()},onPaneClick:()=>{ut?K([]):Fr("")},onDrop:ut?void 0:BL,onDragOver:ut?void 0:HL,nodesDraggable:Se,nodesConnectable:ut?!1:Se,edgesReconnectable:ut?!1:Se,onlyRenderVisibleElements:Kf.length>=80,deleteKeyCode:ut?null:Se?["Backspace","Delete"]:null,selectionOnDrag:qg==="select",panOnDrag:qg==="pan"?!0:[1,2],panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,children:i.jsx(ER,{color:"rgba(255,255,255,0.12)",gap:22,size:1})}),!ut&&G?(()=>{var J;const x=String(G.query||"").trim().toLowerCase(),S=G.mode==="create"?"create":"existing",_=Array.isArray(G.candidates)?G.candidates:[],P=Array.isArray(G.existingCandidates)?G.existingCandidates:[],T=x?_.filter(Y=>{var ae,pe,fe;return[(ae=Y.def)==null?void 0:ae.id,Y.displayLabel,Y.description,(pe=Y.slot)==null?void 0:pe.name,(fe=Y.slot)==null?void 0:fe.type].filter(Boolean).some(je=>String(je).toLowerCase().includes(x))}):_,U=x?P.filter(Y=>{var ae,pe;return[Y.nodeId,Y.nodeLabel,Y.definitionId,(ae=Y.slot)==null?void 0:ae.name,(pe=Y.slot)==null?void 0:pe.type].filter(Boolean).some(fe=>String(fe).toLowerCase().includes(x))}):P,X=G.draft.handleType==="source"?"IN":"OUT";return i.jsxs("div",{className:"af-connect-node-menu",style:{left:G.left,top:G.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:Pn((J=G.draft.slot)==null?void 0:J.type)},"aria-hidden":!0}),i.jsxs("span",{children:["匹配 ",G.draft.slotType," 节点"]})]}),i.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>ee(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:()=>ee(Y=>Y&&{...Y,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:()=>ee(Y=>Y&&{...Y,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:G.query,onChange:Y=>ee(ae=>ae&&{...ae,query:Y.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),i.jsxs("div",{className:"af-connect-node-menu__list",children:[S==="create"?T.map(Y=>{var fe,je;const ae=Y.displayLabel||((fe=Y.def)==null?void 0:fe.id),pe=Hp(Y.slot,Y.slotIndex);return i.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>ML(Y),title:Y.description||Y.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:ae}),ae!==Y.def.id?i.jsx("span",{className:"af-connect-node-menu__item-id",children:Y.def.id}):null]}),i.jsxs("span",{className:"af-connect-node-menu__port",children:[i.jsx("span",{children:X}),i.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:Pn((je=Y.slot)==null?void 0:je.type)},"aria-hidden":!0}),i.jsx("span",{className:"af-connect-node-menu__port-name",children:pe})]})]},`${Y.def.id}-${Y.slotIndex}`)}):U.map(Y=>{var fe;const ae=Y.nodeLabel||Y.nodeId,pe=Hp(Y.slot,Y.slotIndex);return i.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>$L(Y),title:`${Y.definitionId||Y.nodeId} · ${pe}`,children:[i.jsxs("span",{className:"af-connect-node-menu__item-main",children:[i.jsx("span",{className:"af-connect-node-menu__item-label",children:ae}),i.jsxs("span",{className:"af-connect-node-menu__item-id",children:[Y.definitionId?`${Y.definitionId} · `:"",Y.nodeId]})]}),i.jsxs("span",{className:"af-connect-node-menu__port",children:[i.jsx("span",{children:X}),i.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:Pn((fe=Y.slot)==null?void 0:fe.type)},"aria-hidden":!0}),i.jsx("span",{className:"af-connect-node-menu__port-name",children:pe}),Y.occupied?i.jsx("span",{className:"af-connect-node-menu__port-badge",children:"替换"}):null]})]},`${Y.nodeId}-${Y.handleId}`)}),(S==="create"?T.length:U.length)===0?i.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null,!ut&&!_n&&!H$?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:()=>Bg(!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:nr.length===0?i.jsx("span",{className:"af-composer-selected-empty",children:"选择画布节点后,可作为本次 Workspace AI 的上下文。"}):nr.map(x=>{var T,U;const S=String(((T=x.data)==null?void 0:T.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:()=>jL(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:ya,rows:2,onChange:x=>Fg(x.target.value),onKeyDown:x=>{(x.metaKey||x.ctrlKey)&&x.key==="Enter"&&(x.preventDefault(),Zf())},placeholder:"描述你想在 workspace 中生成、分析或展示的内容",autoComplete:"off",spellCheck:!1,disabled:!Se})}),i.jsxs("div",{className:"af-composer-toolbar",children:[i.jsxs("div",{className:"af-composer-skills-field",children:[i.jsxs("button",{ref:Dg,type:"button",className:"af-composer-skills-button"+(Ds.length>0?" af-composer-skills-button--active":""),disabled:ns||!Se,"aria-haspopup":"listbox","aria-expanded":Mf,onClick:()=>Og(x=>!x),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),i.jsx("span",{children:Ds.length>0?`Skills ${Ds.length}`:"Skills"})]}),Mf&&!ns?ur.createPortal(i.jsx("div",{ref:yS,className:"af-composer-skills-menu",role:"listbox","aria-label":"Skills",style:z$,children:Os.length===0?i.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):i.jsxs(i.Fragment,{children:[Al.groups.map(x=>{const S=ra(x,Os),_=HF(x,ty,Os),P=F$.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:T=>{const U=T.target.checked;ou(X=>U?zF(X,S):BF(X,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:()=>{gS(T=>{const U=new Set(T);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(T=>i.jsxs("label",{className:"af-composer-skill-option",children:[i.jsx("input",{type:"checkbox",checked:ty.has(T.key),onChange:U=>{const X=U.target.checked;ou(J=>X?J.includes(T.key)?J:[...J,T.key]:J.filter(Y=>Y!==T.key))}}),i.jsxs("span",{className:"af-composer-skill-option-main",children:[i.jsx("span",{className:"af-composer-skill-option-title",children:T.name}),T.description?i.jsx("span",{className:"af-composer-skill-option-desc",children:T.description}):null]})]},`${x.id}:${T.key}`))})]},x.id)}),Al.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:Al.ungrouped.length})]}),Al.ungrouped.map(x=>i.jsxs("label",{className:"af-composer-skill-option",children:[i.jsx("input",{type:"checkbox",checked:ty.has(x.key),onChange:S=>{const _=S.target.checked;ou(P=>_?P.includes(x.key)?P:[...P,x.key]:P.filter(T=>T!==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:Fi,onChange:x=>I$(x.target.value),"aria-label":"模型",children:[i.jsx("option",{value:"",children:"默认模型"}),cL.map(x=>i.jsx("option",{value:x.value,children:x.label},x.value))]})}),i.jsx("button",{type:"button",className:"af-composer-send"+(ya.trim()&&!ns?" af-composer-send--active":"")+(ns?" af-composer-send--stop":""),disabled:ns||!ya.trim()||!Se,"aria-label":ns?"Running":"Send",onClick:()=>void Zf(),children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:ns?"sync":"arrow_upward"})})]})]})]})}):!ut&&!_n?i.jsx("button",{type:"button",className:"af-workspace-composer-fab",onClick:()=>Bg(!1),"aria-label":"展开 AI 输入框",title:"展开 AI 输入框",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"auto_awesome"})}):null]}),!ut&&!_n&&cu?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:()=>bl(!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"+(Br==="workspace"?" af-composer-session-tab--active":""),ref:Br==="workspace"?zg:null,onClick:()=>bs("workspace"),children:i.jsx("span",{className:"af-composer-session-label",children:"Workspace"})}),Fs.map(x=>i.jsxs("div",{role:"tab",tabIndex:0,ref:Br===x.id?zg:null,className:"af-composer-session-tab"+(Br===x.id?" af-composer-session-tab--active":"")+(x.status==="running"||x.status==="stopping"?" af-composer-session-tab--running":""),onClick:()=>bs(x.id),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),bs(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(),Q$(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"+(Tl?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:C0}),i.jsxs("div",{className:"af-composer-sidebar-thread",ref:bS,children:[i.jsx(JC,{messages:UL,running:Tl,showRunningIndicator:!ar}),oy.length>0?i.jsxs("details",{className:"af-composer-sidebar-log-details",...Tl?{open:!0}:{},children:[i.jsx("summary",{children:"执行日志"}),i.jsx(JC,{messages:oy,running:!1,showRunningIndicator:!1})]}):null]}),i.jsxs("div",{className:"af-composer-sidebar-input",children:[i.jsx("textarea",{className:"af-composer-sidebar-textarea",value:ya,rows:3,onChange:x=>Fg(x.target.value),onKeyDown:x=>{(x.metaKey||x.ctrlKey)&&x.key==="Enter"&&(x.preventDefault(),Zf())},placeholder:ar?"继续追问、总结或要求调整这次结果":"继续描述你想让 AI 在 workspace 中做什么",disabled:!Se||Tl}),i.jsx("button",{type:"button",className:"af-composer-sidebar-send",disabled:!Se||Tl||!ya.trim(),onClick:()=>void Zf(),"aria-label":"发送 AI 对话",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_upward"})})]})]})}):!ut&&!_n&&mt&&Kt?i.jsx("aside",{className:"af-pipeline-drawer af-workspace-node-drawer","aria-label":"Workspace Node Properties",children:i.jsx(XU,{draft:mt,setDraft:ws,definitionId:String(((E0=Kt.data)==null?void 0:E0.definitionId)||Kt.id),systemPromptReadonly:String(((A0=Kt.data)==null?void 0:A0.description)||""),modelLists:ga,disabled:!Se,onIdBlur:()=>Xg(!0),onClose:()=>Fr(""),onPublishToMarketplace:X$,error:k$,ioSlots:{inputs:Array.isArray(mt==null?void 0:mt.inputs)?mt.inputs:[],outputs:Array.isArray(mt==null?void 0:mt.outputs)?mt.outputs:[]}})}):null,!ut&&!_n&&uu?ur.createPortal(i.jsx("div",{className:"af-workspace-run-logs-overlay",role:"presentation",onMouseDown:()=>kl(null),children:i.jsx("aside",{className:"af-workspace-run-logs-drawer","aria-label":"Workspace Run Logs",onMouseDown:x=>x.stopPropagation(),children:i.jsx(LU,{flowParams:a,scheduleNodeId:uu.scheduleNodeId,runNodeId:uu.runNodeId,lastRunId:uu.lastRunId,label:uu.label,onClose:()=>kl(null)})})}),document.body):null,i.jsx(RU,{open:Vg,onClose:()=>Lf(!1)}),i.jsx(MU,{open:Kg,onClose:()=>jS(!1),onJump:Zg,nodes:oL}),i.jsx(QU,{open:p,onClose:()=>h(!1),flowId:a.flowId||"",flowSource:mu,onArchived:()=>{h(!1),n("/projects?tab=archived")}}),i.jsx(ZU,{open:y&&!!a.flowId,onClose:()=>v(!1),flowId:a.flowId||"",flowSource:mu,flowArchived:!!a.archived,workspaceId:a.workspaceId||"",leaveShared:gu,onDeleted:async()=>{v(!1),n("/projects")}}),C$&&Nn?ur.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"}),"解决 ",((P0=Nn.conflictItems)==null?void 0:P0.length)||0," 处字段冲突"]}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>ma(!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:()=>ml(Object.fromEntries((Nn.conflictItems||[]).map((x,S)=>[String(S),{mode:"local",manual:zu(x)}]))),children:"全部保留我的"}),i.jsx("button",{type:"button",onClick:()=>ml(Object.fromEntries((Nn.conflictItems||[]).map((x,S)=>[String(S),{mode:"remote",manual:zu(x)}]))),children:"全部使用远端"})]})]}),(Nn.conflictItems||[]).map((x,S)=>{const _=Cg[String(S)]||{mode:"local",manual:zu(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,T])=>i.jsx("button",{type:"button",className:_.mode===P?"is-active":"",onClick:()=>ml(U=>({...U,[String(S)]:{..._,mode:P}})),children:T},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:i_(x,"incoming")})]}),i.jsxs("div",{className:_.mode==="remote"?"is-selected":"",children:[i.jsx("span",{children:"远端修改"}),i.jsx("pre",{children:i_(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=>ml(T=>({...T,[String(S)]:{..._,manual:P.target.value}})),rows:5})]}):null]},`${x.path||"conflict"}-${S}`)}),Xv?i.jsx("div",{className:"af-flow-snippet-error",children:Xv}):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:Pf,onClick:()=>void v0(),children:"备份并载入远端"}),i.jsx("span",{className:"af-workspace-conflict-foot__spacer"}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",disabled:Pf,onClick:()=>ma(!1),children:"稍后处理"}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:Pf||!(Nn.conflictItems||[]).length,onClick:()=>void gL(),children:Pf?"保存中...":"应用选择并保存"})]})]})}),document.body):null,Xn?ur.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:()=>Qn(!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:Zn.name,onChange:x=>{const S=x.target.value;Cr(_=>({..._,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:Zn.id,onChange:x=>Cr(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:Zn.description,onChange:x=>Cr(S=>({...S,description:x.target.value})),placeholder:"这段流程适合什么 workspace 场景、需要接哪些上下游。",rows:4})]}),i.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",nr.length," 个节点和 ",Uf.length," 条内部连线。"]}),Sn?i.jsx("div",{className:"af-flow-snippet-error",children:Sn}):null]}),i.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>Qn(!1),children:"取消"}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:ys||!Zn.name.trim(),onClick:()=>void pL(),children:ys?"发布中...":"发布"})]})]})}),document.body):null,c0?i.jsx(bJ,{node:c0,onClose:()=>Oe("")}):null,es?ur.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":So?"新建分享":"发布展示页",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"}),So?"新建分享":"发布展示页"]}),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-flow-snippet-field",children:[i.jsx("span",{children:"标题"}),i.jsx("input",{type:"text",value:ct.title,onChange:x=>Ft(S=>({...S,title:x.target.value})),placeholder:"展示页标题",autoFocus:!0})]}),So?null:i.jsxs("label",{className:"af-flow-snippet-field",children:[i.jsx("span",{children:"布局"}),i.jsxs("select",{className:"af-display-share-select",value:ct.layout,onChange:x=>Ft(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:VC(ct),onChange:x=>{const S=x.target.value;Ft(_=>({..._,permanent:S==="permanent",expiresInDays:S==="permanent"?_.expiresInDays||30:Number(S)}))},children:gw.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":So?"分享内容":"选择展示节点",children:[So?i.jsx("span",{className:"af-display-share-node-list__label",children:"分享内容"}):null,GL.map(x=>{var _;const S=Array.isArray(ct.nodeIds)&&ct.nodeIds.includes(x.id);return i.jsxs("label",{className:"af-display-share-node-row",children:[i.jsx("input",{type:"checkbox",checked:S,disabled:So,onChange:()=>yL(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:[En(x.data)," · ",x.id]})]})]},x.id)})]}),he!=null&&he.absoluteUrl?i.jsxs("div",{className:"af-display-share-result",children:[i.jsx("input",{type:"text",readOnly:!0,value:he.absoluteUrl,onFocus:x=>x.target.select()}),i.jsx("button",{type:"button",onClick:()=>window.open(he.absoluteUrl,"_blank","noopener,noreferrer"),children:"打开"}),i.jsx("button",{type:"button",onClick:()=>void S0(),children:zt==="copied"?"已复制":zt==="failed"?"复制失败":"复制"})]}):null,jn?i.jsx("div",{className:"af-flow-snippet-error",children:jn}):null]}),i.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>Or(!1),children:"取消"}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:er||!Array.isArray(ct.nodeIds)||ct.nodeIds.length===0,onClick:()=>void xL(),children:er?"生成中...":"生成链接"})]})]})}),document.body):null,wt?ur.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:()=>{tr(""),Yt(!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:[he!=null&&he.absoluteUrl?i.jsxs("div",{className:"af-display-link-modal__url",children:[i.jsx("input",{type:"text",readOnly:!0,value:he.absoluteUrl,onFocus:x=>x.target.select(),autoFocus:!0}),i.jsxs("button",{type:"button",onClick:()=>window.open(he.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 S0(),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:zt==="copied"?"check":"content_copy"}),zt==="copied"?"已复制":zt==="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:VC(ct),onChange:x=>{const S=x.target.value;Ft(_=>({..._,permanent:S==="permanent",expiresInDays:S==="permanent"?_.expiresInDays||30:Number(S)}))},children:gw.map(x=>i.jsx("option",{value:x.value,children:x.label},x.value))})]}),jn?i.jsx("div",{className:"af-flow-snippet-error",children:jn}):null]}),i.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>{tr(""),Yt(!1)},children:"关闭"}),i.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:er||I.nodeIds.length===0,onClick:()=>void bL(),children:er?"生成中...":he!=null&&he.absoluteUrl?"更新链接":"生成链接"})]})]})}),document.body):null,N$?ur.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:()=>jg(!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:ru,onChange:x=>Uv(x.target.value),onKeyDown:x=>{x.key==="Enter"&&ru.trim()&&!Ng&&(x.preventDefault(),k0())},placeholder:"输入用户名",autoFocus:!0}),i.jsx("button",{type:"button",disabled:Ng||!ru.trim(),onClick:()=>void k0(),children:Ng?"添加中...":"添加成员"})]}),qv?i.jsx("div",{className:"af-flow-snippet-error",children:qv}):null,i.jsx("div",{className:"af-workspace-member-list",children:((an==null?void 0:an.members)||[]).map(x=>{const S=x.userId===(an==null?void 0:an.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:Yv===x.userId,onClick:()=>void mL(x),children:Yv===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:()=>jg(!1),children:"完成"})})]})}),document.body):null,tt?ur.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:()=>Mn(!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:Ms.length?`${Ms.length} 个分享`:"暂无分享"}),i.jsxs("button",{type:"button",onClick:()=>void Ws(),disabled:ui,children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),"刷新"]})]}),$s?i.jsx("div",{className:"af-flow-snippet-error",children:$s}):null,ui?i.jsx("div",{className:"af-display-link-modal__empty",children:"Loading..."}):null,!ui&&Ms.length===0?i.jsx("div",{className:"af-display-link-modal__empty",children:"还没有创建过展示分享"}):null,i.jsx("div",{className:"af-display-shares-list",children:Ms.map(x=>{const S=qC(x),_=ve===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:tJ(x)})]}),i.jsx("input",{className:"af-display-share-item__url",type:"text",readOnly:!0,value:S,onFocus:T=>T.target.select()}),i.jsx("select",{className:"af-display-share-select",value:P,disabled:_,onChange:T=>void vL(x,T.target.value),"aria-label":"修改分享有效期",children:gw.map(T=>i.jsx("option",{value:T.value,children:T.label},T.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 kL(x),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:kt===x.id?"check":"content_copy"}),kt===x.id?"已复制":"复制"]}),i.jsxs("button",{type:"button",className:"af-display-share-item__danger",disabled:_,onClick:()=>void SL(x),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:_?"hourglass_empty":"link_off"}),"撤销"]})]})]},x.id)})})]})]})}),document.body):null,Qt?ur.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:()=>gn(!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:zn,onChange:x=>q(x.target.value),placeholder:"搜索展示节点...",autoFocus:!0})]}),i.jsx("div",{className:"af-display-picker-grid",role:"group","aria-label":"选择展示节点",style:{"--af-display-picker-columns":w0.length||1},children:Yf.length>0?w0.map((x,S)=>i.jsx("div",{className:"af-display-picker-column",children:x.map(dL)},`display-picker-column-${S}`)):i.jsx("div",{className:"af-display-picker-empty",children:_l.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:()=>gn(!1),children:"完成"})})]})}),document.body):null,iu.nodeId?ur.createPortal(i.jsx(FJ,{files:pl,query:iu.query,onQueryChange:x=>Pg(S=>({...S,query:x})),onSelect:tL,onUpload:e0,onClose:Gg}),document.body):null,!ut&&!_n&&Ae?ur.createPortal(i.jsx("div",{className:"af-workspace-quick-add-backdrop",onMouseDown:()=>Ye(!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":Zt==="nodes",className:"af-workspace-quick-add__tab"+(Zt==="nodes"?" af-workspace-quick-add__tab--active":""),onClick:()=>At("nodes"),children:"节点"}),i.jsx("button",{type:"button",role:"tab","aria-selected":Zt==="flows",className:"af-workspace-quick-add__tab"+(Zt==="flows"?" af-workspace-quick-add__tab--active":""),onClick:()=>At("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:wS,value:en,onChange:x=>ts(x.target.value),onKeyDown:x=>{if(x.key==="Escape")x.preventDefault(),Ye(!1);else if(x.key==="ArrowDown"){x.preventDefault();const S=Zt==="flows"?Su.length:vu.length;Ls(_=>Math.min(Math.max(0,S-1),_+1))}else x.key==="ArrowUp"?(x.preventDefault(),Ls(S=>Math.max(0,S-1))):x.key==="Tab"?(x.preventDefault(),At(S=>S==="nodes"?"flows":"nodes")):x.key==="Enter"&&(x.preventDefault(),Zt==="flows"?N0(Su[di]||Su[0]):j0(vu[di]||vu[0]))},placeholder:Zt==="flows"?"搜索流程片段...":"搜索节点...","aria-label":Zt==="flows"?"搜索流程片段":"搜索节点"})]}),i.jsx("div",{className:"af-workspace-quick-add__list",children:Zt==="flows"?Su.length===0?i.jsx("div",{className:"af-workspace-quick-add__empty",children:mn?"正在加载流程片段...":Vn||"没有匹配的流程片段"}):Su.map((x,S)=>{const _=x.displayName||x.name||x.id,P=x.snippet&&typeof x.snippet=="object"?x.snippet.instances:null,T=x.snippet&&typeof x.snippet=="object"?x.snippet.edges:null,U=Number.isFinite(Number(x.nodeCount))?Number(x.nodeCount):Object.keys(P||{}).length,X=Number.isFinite(Number(x.edgeCount))?Number(x.edgeCount):Array.isArray(T)?T.length:0;return i.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(S===di?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>Ls(S),onClick:()=>N0(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} 节点 / ${X} 连线`})]}),i.jsx("span",{className:"af-workspace-quick-add__cat",children:"FLOW"})]},`${x.id}@${x.version}`)}):vu.length===0?i.jsx("div",{className:"af-workspace-quick-add__empty",children:"没有匹配的节点"}):vu.map((x,S)=>{const _=Xu(x),P=Qu(x),T=xb(x);return i.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(S===di?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>Ls(S),onClick:()=>j0(x),children:[i.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:OC(_)}),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}),T?i.jsx("span",{className:"af-workspace-quick-add__desc",children:T}):null]}),i.jsx("span",{className:"af-workspace-quick-add__cat",children:_})]},x.id)})})]})}),document.body):null]})]})}function EM(){return i.jsx(Yk,{children:i.jsx(iX,{})})}function oX(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 aX(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 lX(e){let t=String(e||"").replace(/\r\n/g,`
|
|
266
|
-
`).trim();return t.includes(`
|
|
267
|
-
`)||(t=t.replace(/\s+(resultFile|result|outParams|outParams\.[A-Za-z_][A-Za-z0-9_-]*)\s*:/g,`
|
|
268
|
-
$1:`).replace(/(^|\n)outParams:\s+([A-Za-z_][A-Za-z0-9_-]*\s*:)/g,`$1outParams:
|
|
269
|
-
$2`)),t}function AM(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=lX(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(`
|
|
270
|
-
`).filter(p=>/^\s+/.test(p)||!p.trim()).map(p=>p.replace(/^\s{2}/,"")).join(`
|
|
271
|
-
`).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 _v(e){let t=AM(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 cX(e){const t=_v(e);return t.trim()?/<[^>]*$/g.test(t)?"HTML 内容末尾存在未闭合标签,可能是生成或保存时被截断。":/^(?:<!doctype\b|<html\b)/i.test(t)&&!/<\/html\s*>/i.test(t)?"完整 HTML 文档缺少 </html> 结束标签,可能是生成或保存时被截断。":"":""}function uX(e){const t=_v(e);if(!t.trim())return"";const n=`<base target="_blank"><script data-agentflow-display-link-guard="1">
|
|
272
|
-
(() => {
|
|
273
|
-
document.addEventListener("click", (event) => {
|
|
274
|
-
const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
|
|
275
|
-
if (!link) return;
|
|
276
|
-
const rawHref = String(link.getAttribute("href") || "").trim();
|
|
277
|
-
if (!rawHref || rawHref.startsWith("#")) return;
|
|
278
|
-
if (/^javascript:/i.test(rawHref)) {
|
|
279
|
-
event.preventDefault();
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
event.preventDefault();
|
|
283
|
-
window.open(link.href, "_blank", "noopener,noreferrer");
|
|
284
|
-
}, true);
|
|
285
|
-
})();
|
|
286
|
-
<\/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 PM(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 dX(e,t,n={}){const r=String(e||"").trim();return r?PM(r,t,n):""}function fX({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 f=Math.max(1,d.scrollHeight),p=Math.max(1,d.clientHeight),h=f>p+1,y=h?Math.max(12,p/f*100):100,v=Math.max(0,100-y),w=h?Math.min(v,d.scrollTop/Math.max(1,f-p)*v):0;o({visible:h,top:w,height:y})},[]);m.useEffect(()=>{const d=requestAnimationFrame(a),f=n.current;if(!f||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(d);const p=new ResizeObserver(a);p.observe(f);for(const h of Array.from(f.children))p.observe(h);return()=>{cancelAnimationFrame(d),p.disconnect()}},[t,a]);const l=m.useCallback(d=>{const f=n.current;if(!f)return;const p=Math.max(0,f.scrollHeight-f.clientHeight);f.scrollTop=Math.min(1,Math.max(0,d))*p,a()},[a]),c=m.useCallback((d,f=0)=>{const p=r.current;if(!p)return 0;const h=p.getBoundingClientRect(),y=s.height/100*h.height,v=Math.max(1,h.height-y);return(d-h.top-f)/v},[s.height]),u=m.useCallback(d=>{if(!s.visible)return;d.preventDefault(),d.stopPropagation();const f=r.current;if(!f)return;const p=f.getBoundingClientRect(),h=s.top/100*p.height,y=s.height/100*p.height,w=d.clientY>=p.top+h&&d.clientY<=p.top+h+y?d.clientY-p.top-h:y/2;l(c(d.clientY,w));const g=b=>{b.preventDefault(),l(c(b.clientY,w))},k=()=>{window.removeEventListener("pointermove",g),window.removeEventListener("pointerup",k),window.removeEventListener("pointercancel",k)};window.addEventListener("pointermove",g),window.addEventListener("pointerup",k),window.addEventListener("pointercancel",k)},[c,l,s.height,s.top,s.visible]);return 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 Nb({node:e,shareId:t,style:n,bare:r=!1}){const s=oX(e),o=e.kind==="html"?_v(s):e.kind==="react"?hg(s):AM(s),a=e.kind==="html"?cX(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:aX(e.kind)}),i.jsx("strong",{children:e.label||e.id}),i.jsx("em",{children:e.definitionId||e.kind||"display"})]})}),i.jsx(fX,{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:uX(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:yv(o)}):null,e.kind==="image"?i.jsx("img",{src:PM(o,t),alt:e.label||e.id,loading:"lazy"}):null,e.kind==="markdown"?i.jsx("div",{className:"af-public-display-markdown",children:i.jsx(dv,{content:o,resolveSrc:(c,u)=>dX(c,t,u)})}):null,e.kind==="chart"?i.jsx(pv,{content:o}):null,e.kind==="table"?i.jsx(fv,{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 pX({data:e}){return i.jsx(Nb,{node:e==null?void 0:e.node,shareId:e==null?void 0:e.shareId})}const hX={publicDisplay:pX};function mX(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 IM(){var l,c,u,d;const{path:e}=gs(),t=m.useMemo(()=>mX(e),[e]),[n,r]=m.useState({loading:!0,error:"",share:null,nodes:[]});m.useEffect(()=>{let f=!1;async function p(){if(!t){r({loading:!1,error:"Missing display share id",share:null,nodes:[]});return}r(h=>({...h,loading:!0,error:""}));try{const h=await fetch(`/api/display/share?id=${encodeURIComponent(t)}`),y=await h.json().catch(()=>({}));if(!h.ok)throw new Error(y.error||"展示页不存在");f||r({loading:!1,error:"",share:y.share||null,nodes:Array.isArray(y.nodes)?y.nodes:[]})}catch(h){f||r({loading:!1,error:String((h==null?void 0:h.message)||h),share:null,nodes:[]})}}return p(),()=>{f=!0}},[t]);const s=m.useMemo(()=>(Array.isArray(n.nodes)?n.nodes:[]).map((p,h)=>{const y=p.position&&typeof p.position.x=="number"&&typeof p.position.y=="number"?p.position:{x:120+h*40,y:100+h*32},v=p.size&&typeof p.size.width=="number"&&typeof p.size.height=="number"?p.size:{width:520,height:320};return{id:p.id,type:"publicDisplay",position:y,data:{node:p,shareId:t},selectable:!1,draggable:!1,style:{width:Math.max(1,Number(v.width)||520),height:Math.max(1,Number(v.height)||320)}}}),[t,n.nodes]),o=m.useMemo(()=>{var v;const f=(v=n.share)==null?void 0:v.viewport;if(!f||typeof f!="object")return null;const p=Number(f.x),h=Number(f.y),y=Number(f.zoom);return!Number.isFinite(p)||!Number.isFinite(h)||!Number.isFinite(y)?null:{x:p,y:h,zoom:Math.min(Math.max(y,.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(p=>i.jsx(Nb,{node:p,shareId:t,bare:!0},p.id))})});const f=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 ${f}`,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(p=>i.jsx(Nb,{node:p,shareId:t},p.id))})]})}return i.jsx("main",{className:"af-public-display-page af-public-display-page--canvas",children:i.jsx(Yk,{children:i.jsx(CR,{className:"af-public-display-flow",nodes:s,edges:[],nodeTypes:hX,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(ER,{color:"rgba(255,255,255,0.12)",gap:22,size:1})})})})}const bt=e=>typeof e=="string",Bu=()=>{let e,t;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n},o_=e=>e==null?"":""+e,gX=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},yX=/###/g,a_=e=>e&&e.indexOf("###")>-1?e.replace(yX,"."):e,l_=e=>!e||bt(e),kd=(e,t,n)=>{const r=bt(t)?t.split("."):t;let s=0;for(;s<r.length-1;){if(l_(e))return{};const o=a_(r[s]);!e[o]&&n&&(e[o]=new n),Object.prototype.hasOwnProperty.call(e,o)?e=e[o]:e={},++s}return l_(e)?{}:{obj:e,k:a_(r[s])}},c_=(e,t,n)=>{const{obj:r,k:s}=kd(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=kd(e,a,Object);for(;l.obj===void 0&&a.length;)o=`${a[a.length-1]}.${o}`,a=a.slice(0,a.length-1),l=kd(e,a,Object),l&&l.obj&&typeof l.obj[`${l.k}.${o}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${o}`]=n},wX=(e,t,n,r)=>{const{obj:s,k:o}=kd(e,t,Object);s[o]=s[o]||[],s[o].push(n)},jm=(e,t)=>{const{obj:n,k:r}=kd(e,t);if(n)return n[r]},xX=(e,t,n)=>{const r=jm(e,n);return r!==void 0?r:jm(t,n)},RM=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?bt(e[r])||e[r]instanceof String||bt(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):RM(e[r],t[r],n):e[r]=t[r]);return e},Hl=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var bX={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const kX=e=>bt(e)?e.replace(/[&<>"'\/]/g,t=>bX[t]):e;class vX{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 SX=[" ",",","?","!",";"],jX=new vX(20),NX=(e,t,n)=>{t=t||"",n=n||"";const r=SX.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const s=jX.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},Cb=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},Nm=e=>e&&e.replace("_","-"),CX={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 Cm{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||CX,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:(bt(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Cm(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Cm(this.logger,t)}}var _i=new Cm;class yg{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 u_ extends yg{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):bt(r)&&o?l.push(...r.split(o)):l.push(r)));const c=jm(this.data,l);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=l[0],n=l[1],r=l.slice(2).join(".")),c||!a||!bt(r)?c:Cb(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),c_(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)(bt(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=jm(this.data,l)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?RM(c,r,o):c={...c,...r},c_(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 TM={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 d_={};class _m extends yg{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),gX(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=_i.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&&!NX(t,r,s);if(a&&!l){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:bt(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:bt(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 j=n.nsSeparator||this.options.nsSeparator;return s?{res:`${c}${j}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${j}${a}`}return s?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:a}const f=this.resolve(t,n);let p=f&&f.res;const h=f&&f.usedKey||a,y=f&&f.exactUsedKey||a,v=Object.prototype.toString.apply(p),w=["[object Number]","[object Function]","[object RegExp]"],g=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,k=!this.i18nFormat||this.i18nFormat.handleAsObject,b=!bt(p)&&typeof p!="boolean"&&typeof p!="number";if(k&&p&&b&&w.indexOf(v)<0&&!(bt(g)&&Array.isArray(p))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const j=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,p,{...n,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return s?(f.res=j,f.usedParams=this.getUsedParamsDetails(n),f):j}if(o){const j=Array.isArray(p),N=j?[]:{},C=j?y:h;for(const I in p)if(Object.prototype.hasOwnProperty.call(p,I)){const R=`${C}${o}${I}`;N[I]=this.translate(R,{...n,joinArrays:!1,ns:l}),N[I]===R&&(N[I]=p[I])}p=N}}else if(k&&bt(g)&&Array.isArray(p))p=p.join(g),p&&(p=this.extendTranslation(p,t,n,r));else{let j=!1,N=!1;const C=n.count!==void 0&&!bt(n.count),I=_m.hasDefaultValue(n),R=C?this.pluralResolver.getSuffix(u,n.count,n):"",H=n.ordinal&&C?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",A=C&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),L=A&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${R}`]||n[`defaultValue${H}`]||n.defaultValue;!this.isValidLookup(p)&&I&&(j=!0,p=L),this.isValidLookup(p)||(N=!0,p=a);const O=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&N?void 0:p,M=I&&L!==p&&this.options.updateMissing;if(N||j||M){if(this.logger.log(M?"updateKey":"missingKey",u,c,a,M?L:p),o){const $=this.resolve(a,{...n,keySeparator:!1});$&&$.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let K=[];const z=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&z&&z[0])for(let $=0;$<z.length;$++)K.push(z[$]);else this.options.saveMissingTo==="all"?K=this.languageUtils.toResolveHierarchy(n.lng||this.language):K.push(n.lng||this.language);const F=($,W,E)=>{const Q=I&&E!==p?E:O;this.options.missingKeyHandler?this.options.missingKeyHandler($,c,W,Q,M,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing($,c,W,Q,M,n),this.emit("missingKey",$,c,W,p)};this.options.saveMissing&&(this.options.saveMissingPlurals&&C?K.forEach($=>{const W=this.pluralResolver.getSuffixes($,n);A&&n[`defaultValue${this.options.pluralSeparator}zero`]&&W.indexOf(`${this.options.pluralSeparator}zero`)<0&&W.push(`${this.options.pluralSeparator}zero`),W.forEach(E=>{F([$],a+E,n[`defaultValue${E}`]||L)})}):F(K,a,L))}p=this.extendTranslation(p,t,n,f,r),N&&p===a&&this.options.appendNamespaceToMissingKey&&(p=`${c}:${a}`),(N||j)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?p=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}:${a}`:a,j?p:void 0):p=this.options.parseMissingKeyHandler(p))}return s?(f.res=p,f.usedParams=this.getUsedParamsDetails(n),f):p}extendTranslation(t,n,r,s,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=bt(t)&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let d;if(u){const p=t.match(this.interpolator.nestingRegexp);d=p&&p.length}let f=r.replace&&!bt(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(f={...this.options.interpolation.defaultVariables,...f}),t=this.interpolator.interpolate(t,f,r.lng||this.language||s.usedLng,r),u){const p=t.match(this.interpolator.nestingRegexp),h=p&&p.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 p=arguments.length,h=new Array(p),y=0;y<p;y++)h[y]=arguments[y];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=bt(l)?[l]:l;return t!=null&&c&&c.length&&r.applyPostProcessor!==!1&&(t=TM.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 bt(t)&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(c,n),d=u.key;s=d;let f=u.namespaces;this.options.fallbackNS&&(f=f.concat(this.options.fallbackNS));const p=n.count!==void 0&&!bt(n.count),h=p&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),y=n.context!==void 0&&(bt(n.context)||typeof n.context=="number")&&n.context!=="",v=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);f.forEach(w=>{this.isValidLookup(r)||(l=w,!d_[`${v[0]}-${w}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&(d_[`${v[0]}-${w}`]=!0,this.logger.warn(`key "${s}" for languages "${v.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),v.forEach(g=>{if(this.isValidLookup(r))return;a=g;const k=[d];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(k,d,g,w,n);else{let j;p&&(j=this.pluralResolver.getSuffix(g,n.count,n));const N=`${this.options.pluralSeparator}zero`,C=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(p&&(k.push(d+j),n.ordinal&&j.indexOf(C)===0&&k.push(d+j.replace(C,this.options.pluralSeparator)),h&&k.push(d+N)),y){const I=`${d}${this.options.contextSeparator}${n.context}`;k.push(I),p&&(k.push(I+j),n.ordinal&&j.indexOf(C)===0&&k.push(I+j.replace(C,this.options.pluralSeparator)),h&&k.push(I+N))}}let b;for(;b=k.pop();)this.isValidLookup(r)||(o=b,r=this.getResource(g,w,b,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&&!bt(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 xw=e=>e.charAt(0).toUpperCase()+e.slice(1);class f_{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=_i.create("languageUtils")}getScriptPartFromCode(t){if(t=Nm(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Nm(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(bt(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]=xw(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]=xw(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=xw(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)),bt(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 bt(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))):bt(t)&&o(this.formatLanguageCode(t)),r.forEach(a=>{s.indexOf(a)<0&&o(this.formatLanguageCode(a))}),s}}let _X=[{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}],EX={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 AX=["v1","v2","v3"],PX=["v4"],p_={zero:0,one:1,two:2,few:3,many:4,other:5},IX=()=>{const e={};return _X.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:EX[t.fc]}})}),e};class RX{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=_i.create("pluralResolver"),(!this.options.compatibilityJSON||PX.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=IX(),this.pluralRulesCache={}}addRule(t,n){this.rules[t]=n}clearCache(){this.pluralRulesCache={}}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi()){const r=Nm(t==="dev"?"en":t),s=n.ordinal?"ordinal":"cardinal",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)=>p_[s]-p_[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!AX.includes(this.options.compatibilityJSON)}}const h_=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=xX(e,t,n);return!o&&s&&bt(n)&&(o=Cb(e,n,r),o===void 0&&(o=Cb(t,n,r))),o},bw=e=>e.replace(/\$/g,"$$$$");class TX{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=_i.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:f,nestingPrefix:p,nestingPrefixEscaped:h,nestingSuffix:y,nestingSuffixEscaped:v,nestingOptionsSeparator:w,maxReplaces:g,alwaysFormat:k}=t.interpolation;this.escape=n!==void 0?n:kX,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=o?Hl(o):a||"{{",this.suffix=l?Hl(l):c||"}}",this.formatSeparator=u||",",this.unescapePrefix=d?"":f||"-",this.unescapeSuffix=this.unescapePrefix?"":d||"",this.nestingPrefix=p?Hl(p):h||Hl("$t("),this.nestingSuffix=y?Hl(y):v||Hl(")"),this.nestingOptionsSeparator=w||",",this.maxReplaces=g||1e3,this.alwaysFormat=k!==void 0?k:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,s){let o,a,l;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=h=>{if(h.indexOf(this.formatSeparator)<0){const g=h_(n,c,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(g,void 0,r,{...s,...n,interpolationkey:h}):g}const y=h.split(this.formatSeparator),v=y.shift().trim(),w=y.join(this.formatSeparator).trim();return this.format(h_(n,c,v,this.options.keySeparator,this.options.ignoreJSONStructure),w,r,{...s,...n,interpolationkey:v})};this.resetRegExp();const d=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,f=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>bw(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?bw(this.escape(h)):bw(h)}].forEach(h=>{for(l=0;o=h.regex.exec(t);){const y=o[1].trim();if(a=u(y),a===void 0)if(typeof d=="function"){const w=d(t,o,s);a=bt(w)?w:""}else if(s&&Object.prototype.hasOwnProperty.call(s,y))a="";else if(f){a=o[0];continue}else this.logger.warn(`missed to pass in variable ${y} for interpolating ${t}`),a="";else!bt(a)&&!this.useRawValueToEscape&&(a=o_(a));const v=h.safeValue(a);if(t=t.replace(o[0],v),f?(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 f=c.split(new RegExp(`${d}[ ]*{`));let p=`{${f[1]}`;c=f[0],p=this.interpolate(p,a);const h=p.match(/'/g),y=p.match(/"/g);(h&&h.length%2===0&&!y||y.length%2!==0)&&(p=p.replace(/'/g,'"'));try{a=JSON.parse(p),u&&(a={...u,...a})}catch(v){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,v),`${c}${d}${p}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,c};for(;s=this.nestingRegexp.exec(t);){let c=[];a={...r},a=a.replace&&!bt(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(f=>f.trim());s[1]=d.shift(),c=d,u=!0}if(o=n(l.call(this,s[1].trim(),a),a),o&&s[0]===t&&!bt(o))return o;bt(o)||(o=o_(o)),o||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),o=""),u&&(o=c.reduce((d,f)=>this.format(d,f,r.lng,{...r,interpolationkey:s[1].trim()}),o.trim())),t=t.replace(s[0],o),this.regexp.lastIndex=0}return t}}const MX=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}},Wl=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(Nm(r),s),t[a]=l),l(n)}};class $X{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=_i.create("formatter"),this.options=t,this.formats={number:Wl((n,r)=>{const s=new Intl.NumberFormat(n,{...r});return o=>s.format(o)}),currency:Wl((n,r)=>{const s=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>s.format(o)}),datetime:Wl((n,r)=>{const s=new Intl.DateTimeFormat(n,{...r});return o=>s.format(o)}),relativetime:Wl((n,r)=>{const s=new Intl.RelativeTimeFormat(n,{...r});return o=>s.format(o,r.range||"day")}),list:Wl((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()]=Wl(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}=MX(c);if(this.formats[u]){let f=l;try{const p=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},h=p.locale||p.lng||s.locale||s.lng||r;f=this.formats[u](l,h,{...d,...s,...p})}catch(p){this.logger.warn(p)}return f}else this.logger.warn(`there was no format function for ${u}`);return l},t)}}const LX=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class OX extends yg{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=_i.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(f=>{const p=`${u}|${f}`;!r.reload&&this.store.hasResourceBundle(u,f)?this.state[p]=2:this.state[p]<0||(this.state[p]===1?a[p]===void 0&&(a[p]=!0):(this.state[p]=1,d=!1,a[p]===void 0&&(a[p]=!0),o[p]===void 0&&(o[p]=!0),c[f]===void 0&&(c[f]=!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=>{wX(c.loaded,[o],a),LX(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(f=>{l[u][f]===void 0&&(l[u][f]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,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 f=this.waitingReads.shift();this.read(f.lng,f.ns,f.fcName,f.tried,f.wait,f.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();bt(t)&&(t=this.languageUtils.toResolveHierarchy(t)),bt(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(f=>l(null,f)).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 m_=()=>({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]),bt(e[1])&&(t.defaultValue=e[1]),bt(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}}),g_=e=>(bt(e.ns)&&(e.ns=[e.ns]),bt(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),bt(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),qp=()=>{},DX=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class rf extends yg{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=g_(t),this.services={},this.logger=_i,this.modules={external:[]},DX(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&&(bt(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const s=m_();this.options={...s,...this.options,...g_(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?_i.init(o(this.modules.logger),this.options):_i.init(null,this.options);let d;this.modules.formatter?d=this.modules.formatter:typeof Intl<"u"&&(d=$X);const f=new f_(this.options);this.store=new u_(this.options.resources,this.options);const p=this.services;p.logger=_i,p.resourceStore=this.store,p.languageUtils=f,p.pluralResolver=new RX(f,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),d&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(p.formatter=o(d),p.formatter.init(p,this.options),this.options.interpolation.format=p.formatter.format.bind(p.formatter)),p.interpolator=new TX(this.options),p.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},p.backendConnector=new OX(o(this.modules.backend),p.resourceStore,p,this.options),p.backendConnector.on("*",function(h){for(var y=arguments.length,v=new Array(y>1?y-1:0),w=1;w<y;w++)v[w-1]=arguments[w];t.emit(h,...v)}),this.modules.languageDetector&&(p.languageDetector=o(this.modules.languageDetector),p.languageDetector.init&&p.languageDetector.init(p,this.options.detection,this.options)),this.modules.i18nFormat&&(p.i18nFormat=o(this.modules.i18nFormat),p.i18nFormat.init&&p.i18nFormat.init(this)),this.translator=new _m(this.services,this.options),this.translator.on("*",function(h){for(var y=arguments.length,v=new Array(y>1?y-1:0),w=1;w<y;w++)v[w-1]=arguments[w];t.emit(h,...v)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=qp),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=Bu(),u=()=>{const d=(f,p)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(p),r(f,p)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return 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]:qp;const s=bt(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=Bu();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=qp),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"&&TM.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=Bu();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=bt(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),f=2;f<u;f++)d[f-2]=arguments[f];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 p=s.options.keySeparator||".";let h;return c.keyPrefix&&Array.isArray(a)?h=a.map(y=>`${c.keyPrefix}${p}${y}`):h=c.keyPrefix?`${c.keyPrefix}${p}${a}`:a,s.t(h,c)};return bt(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=Bu();return this.options.ns?(bt(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=Bu();bt(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 f_(m_());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 rf(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:qp;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},o=new rf(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 u_(this.store.data,s),o.services.resourceStore=o.store),o.translator=new _m(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 wr=rf.createInstance();wr.createInstance=rf.createInstance;wr.createInstance;wr.dir;wr.init;wr.loadResources;wr.reloadResources;wr.use;wr.changeLanguage;wr.getFixedT;wr.t;wr.exists;wr.setDefaultNamespace;wr.hasLoadedNamespace;wr.loadNamespaces;wr.loadLanguages;function FX(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function sf(e){"@babel/helpers - typeof";return sf=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},sf(e)}function zX(e,t){if(sf(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(sf(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function BX(e){var t=zX(e,"string");return sf(t)=="symbol"?t:t+""}function HX(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,BX(r.key),r)}}function WX(e,t,n){return t&&HX(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var MM=[],VX=MM.forEach,KX=MM.slice;function qX(e){return VX.call(KX.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var y_=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,UX=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(!y_.test(s.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(s.domain)}if(s.path){if(!y_.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},w_={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=UX(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)}},YX={name:"cookie",lookup:function(t){var n;if(t.lookupCookie&&typeof document<"u"){var r=w_.read(t.lookupCookie);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupCookie&&typeof document<"u"&&w_.create(n.lookupCookie,t,n.cookieMinutes,n.cookieDomain,n.cookieOptions)}},GX={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}},Hu=null,x_=function(){if(Hu!==null)return Hu;try{Hu=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Hu=!1}return Hu},JX={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&x_()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&x_()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},Wu=null,b_=function(){if(Wu!==null)return Wu;try{Wu=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Wu=!1}return Wu},XX={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&b_()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&b_()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},QX={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}},ZX={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}},eQ={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}},tQ={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]}},$M=!1;try{document.cookie,$M=!0}catch{}var LM=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];$M||LM.splice(1,1);function nQ(){return{order:LM,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var OM=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};FX(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return WX(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=qX(r,this.options||{},nQ()),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(YX),this.addDetector(GX),this.addDetector(JX),this.addDetector(XX),this.addDetector(QX),this.addDetector(ZX),this.addDetector(eQ),this.addDetector(tQ)}},{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)}))}}])}();OM.type="languageDetector";const rQ={name:"AgentFlow",tagline:"AI Workflow Orchestration"},sQ={projects:"Projects",nodes:"Nodes",myNodes:"My Nodes",myFlows:"My Flows",skills:"Skills",mcps:"MCP",feedback:"Feedback",flowEditor:"Flow Editor",settings:"Settings",back:"Back"},iQ={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"},oQ={success:"Success",failed:"Failed",pending:"Pending",running:"Running",skipped:"Skipped"},aQ={agent:"Agent",control:"Control",tool:"Tool",start:"Start",end:"End"},lQ={online:"Engine Online",offline:"Engine Offline",connecting:"Connecting…"},cQ={hub:"AgentFlow Hub",docs:"Documentation",github:"GitHub Repository"},uQ={app:rQ,nav:sQ,common:iQ,status:oQ,nodeTypes:aQ,engine:lQ,links:cQ},dQ="Flow Editor",fQ="Nodes",pQ="Edges",hQ="Properties",mQ={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"},gQ={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}}"},yQ={run:"Run Flow",stop:"Stop",resume:"Resume",validate:"Validate",export:"Export",import:"Import"},wQ={nodeList:"Node List",runHistory:"Run History",validation:"Validation Results"},xQ={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"},bQ={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)"},kQ={saving:"Saving...",saved:"Saved",saveFailed:"Save failed",runInTerminal:"Please use terminal to run"},vQ={requirement:"Requirement Analysis",planning:"Technical Planning",code:"Code Execution",test:"Test Regression",normal:"Normal"},SQ={phase:"Phase",allPhasesComplete:"All phases completed",currentPhaseComplete:"Current phase completed, waiting for confirmation..."},jQ={node:"Node",text:"Text",file:"File",bool:"Boolean"},NQ={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"},CQ={title:"Keyboard Shortcuts",general:"General",saveDesc:"Save; when node properties sidebar is open, submit node first then save flow",shortcutsLabel:"Keyboard Shortcuts",jumpToNode:"Jump to node by ID",openNodePalette:"Open node palette",canvas:"Canvas",selectTool:"Select Tool",panTool:"Pan Tool",holdSpacePan:"Hold Space to temporarily pan",saveViewport:"Save current entry view",selectAll:"Select all nodes",undo:"Undo canvas change",redo:"Redo canvas change"},_Q={title:"Jump to node",placeholder:"Type node ID or label…",empty:"No matching nodes",hintNavigate:"navigate",hintJump:"jump",hintClose:"close"},EQ={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."},AQ={mainNav:"Main Navigation"},PQ={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'},IQ={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):
|
|
287
|
-
{{summary}}`,step:"Step {{current}}/{{total}}: {{description}}",phaseGeneration:`Phased generation ({{count}} phases): {{labels}}
|
|
288
|
-
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}}"},RQ={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"},TQ={nodePalette:"Node Palette",noPipelineSelected:"No pipeline selected",moreRuns:"+{{count}} more",moreFlows:"+{{count}} more flows",runId:"Run ID: {{id}}"},MQ={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}}"},$Q={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"},LQ={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"},OQ={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"},DQ={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"},FQ={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"},zQ={invalidPlaceholder:"Invalid placeholder: {{hint}}",empty:"(empty)",inputSubtitle:"Input · {{type}}",inputSubtitleNoType:"Input",outputSubtitle:"Output · {{type}}",outputSubtitleNoType:"Output",runtimeConst:"Runtime constant"},BQ={justNow:"Just now",minutesAgo:"{{n}} min ago",hoursAgo:"{{n}} hr ago",yesterday:"Yesterday",daysAgo:"{{n}} days ago",milliseconds:"{{n}} ms",seconds:"{{n}} s"},HQ={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"},WQ={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."},VQ={title:"Print Output: {{instanceId}}",expand:"Expand",restore:"Restore"},KQ={save:"Save",cancel:"Cancel"},qQ={title:"Run with Params",noParams:"No input params in this flow",run:"Run",cancel:"Cancel"},UQ={title:"Run with Preset",noPresets:"No presets available",default:"Default run",run:"Run",cancel:"Cancel"},YQ={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"},GQ={title:dQ,nodes:fQ,edges:pQ,properties:hQ,node:mQ,nodeProps:gQ,actions:yQ,panel:wQ,palette:xQ,pipeline:bQ,status:kQ,roles:vQ,phases:SQ,types:jQ,runContext:NQ,shortcuts:CQ,jumpPalette:_Q,emptyCanvas:EQ,sidebar:AQ,validation:PQ,composer:IQ,topbar:RQ,palette2:TQ,run:MQ,fileEdit:$Q,settings:LQ,schedule:OQ,history:DQ,nodePropsError:FQ,placeholder:zQ,time:BQ,userCheck:HQ,userAsk:WQ,toolPrint:VQ,provideEdit:KQ,runParams:qQ,runPreset:UQ,runConfig:YQ},JQ="Settings",XQ={engine:"Engine Settings",preferences:"Global Preferences"},QQ={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)."},ZQ={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..."}},eZ={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."},tZ={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."},nZ={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."},rZ={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)"},sZ={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"},iZ={title:"System Status",normal:"Service normal",abnormal:"Some interfaces abnormal",cursorModels:"Cursor Models",opencodeModels:"OpenCode Models",claudeCodeModels:"Claude Code Models",codexModels:"Codex Models"},oZ={title:"Shortcuts",projects:"Projects & Pipelines",flowEditor:"Node Canvas"},aZ={title:"Language",description:"Select your preferred language for the interface",options:{zh:"中文",en:"English",ja:"日本語"}},lZ={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."},cZ={title:JQ,crumb:XQ,workspace:QQ,cursor:ZQ,opencode:eZ,claudeCode:tZ,codex:nZ,env:rZ,allowlist:sZ,system:iZ,shortcuts:oZ,language:aZ,onboarding:lZ},uZ={thinking:"Thinking",result:"Result",reply:"Reply",error:"Error"},dZ={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)"},fZ={send:"Send",stop:"Stop",expand:"Expand",collapse:"Collapse",clear:"Clear"},pZ={conversation:"Chat",conversationWithNumber:"Chat {{num}}",default:"Default"},hZ={endSession:"End chat (will stop generation)",closeSession:"Close chat",newSession:"New chat",expandComposer:"Expand chat and output"},mZ={hint:"Use the bottom input box for AI chat, with @node mentions, model selection, and more"},gZ={aiLabels:uZ,placeholders:dZ,actions:fZ,labels:pZ,tooltips:hZ,rightPanel:mZ},yZ="Projects",wZ="All",xZ="Archived",bZ="Nodes",kZ="My Nodes",vZ="My Flows",SZ="Skills",jZ="Active Projects",NZ="Archived Pipelines",CZ="Global Nodes",_Z="All Nodes",EZ="My Nodes",AZ="Manage node versions published to the current workspace marketplace, {{count}} total.",PZ="Manage flow snippets published to the current workspace marketplace, {{count}} total.",IZ="Global Skills",RZ="Create New Project",TZ="New Pipeline",MZ="SEARCH PIPELINES...",$Z="SEARCH NODES...",LZ="SEARCH FLOW SNIPPETS...",OZ="SEARCH SKILLS...",DZ="Refresh Resources",FZ="Loading pipelines...",zZ="Loading global resources...",BZ="Filter result: {{count}} items (matching title, description, path and tags)",HZ="Archived pipelines can still be opened and edited; files are located in the _archived subdirectory of each pipelines directory.",WZ="Manage your distributed node architectures and monitoring pipelines. Drag flow.yaml or .zip into this page to import shared flows.",VZ="Review all globally available node definitions, {{count}} total, including built-in, workspace, and marketplace nodes.",KZ="Review Composer-selectable skills, {{count}} total, including AgentFlow built-ins and workspace skills.",qZ="Executable building blocks for pipeline runtime",UZ="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.",YZ="Published local node packages",GZ="Only node versions published to this workspace marketplace appear here. Inspect details and delete versions that no flow uses.",JZ="Published flow snippets",XZ="Flow snippets published from Pipeline or Workspace canvases appear here. Search and inspect them, then load them from the canvas flow palette.",QZ="Operating guides for Composer and agents",ZZ="Skills tell AI which rules to follow for a task, how to change flows, and how to reuse project conventions.",eee="No archived projects.",tee="No active pipelines; archived items are in the Archived tab.",nee="No global nodes available.",ree="No marketplace nodes have been published.",see="No flow snippets have been published. Select multiple canvas nodes and publish them first.",iee="No skills available.",oee="No description.",aee='No node matches "{{query}}".',lee='No flow snippet matches "{{query}}".',cee='No skill matches "{{query}}".',uee="{{inputs}} in / {{outputs}} out",dee="Flow Snippet",fee="{{nodes}} nodes / {{edges}} edges",pee="Skill",hee="Node detail",mee="Flow snippet detail",gee="Skill detail",yee="Type",wee="Source",xee="Package",bee="Version",kee="Path",vee="Editable",See="Read only",jee="Editable",Nee="Schema",Cee="Inputs",_ee="Outputs",Eee="Runtime",Aee="Node Body",Pee="Files",Iee="Usage",Ree="No runtime manifest.",Tee="No node body or README.",Mee="No previewable files.",$ee="Select a file to preview.",Lee="Binary file preview is not supported.",Oee="Large file; showing the first 256KB only.",Dee="No pipelines using this node were found.",Fee="Node Management",zee="Delete Node Version",Bee="Deleting...",Hee="AgentFlow checks all flow references before deleting; installed or used versions are kept.",Wee="Delete {{id}}@{{version}}? This cannot be undone.",Vee="Deleted {{id}}@{{version}}.",Kee="{{count}} flow(s) still use it.",qee="Flow Snippet Management",Uee="Delete Flow Snippet",Yee="Deleting...",Gee="Deleting it only removes this reusable marketplace snippet. Nodes already loaded onto canvases are not changed.",Jee="Delete {{id}}@{{version}}? This cannot be undone.",Xee="Deleted {{id}}@{{version}}.",Qee="No slots",Zee="Purpose",ete="This node is an execution unit in a pipeline. Its schema affects canvas wiring, parameter input, and runtime scheduling.",tte="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.",nte="Scale",rte="Flow Preview",ste="Edges",ite="Snippet JSON",ote="{{count}} more edge(s)",ate="No previewable nodes.",lte="This skill is injected into Composer as context for AI, constraining its decisions, edit strategy, and output format.",cte="SKILL.md Preview",ute="No preview content available.",dte="Select a resource to inspect details.",fte="Failed to load pipeline list.",pte="No pipelines in current workspace.",hte="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.",mte='No pipelines found matching "{{query}}". Try different keywords or clear the search.',gte="Recent Activity",yte="No recent activity",wte="No recent activity matching the keyword",xte="Recent Run",bte="Recent Open",kte={builtin:"Built-in",workspace:"Workspace",user:"User"},vte={flow:"Flow",global:"Global",marketplace:"Marketplace"},Ste={all:"All",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},jte={overview:"Overview",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},Nte="Open to edit this pipeline in the node canvas.",Cte={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>"},_te={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"},Ete={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"},Ate={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"},Pte={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"},Ite={title:yZ,all:wZ,archived:xZ,nodes:bZ,myNodes:kZ,myFlows:vZ,skills:SZ,activeProjects:jZ,archivedPipelines:NZ,globalNodes:CZ,nodeScopeAll:_Z,nodeScopeMine:EZ,myNodesHint:AZ,myFlowsHint:PZ,globalSkills:IZ,createNew:RZ,newPipeline:TZ,searchPipelines:MZ,searchNodes:$Z,searchFlows:LZ,searchSkills:OZ,refreshResources:DZ,loadingPipelines:FZ,loadingResources:zZ,filterResult:BZ,archivedHint:HZ,activeHint:WZ,nodesHint:VZ,skillsHint:KZ,nodesPurposeTitle:qZ,nodesPurposeDesc:UZ,myNodesPurposeTitle:YZ,myNodesPurposeDesc:GZ,myFlowsPurposeTitle:JZ,myFlowsPurposeDesc:XZ,skillsPurposeTitle:QZ,skillsPurposeDesc:ZZ,noArchived:eee,noActive:tee,noNodes:nee,noMyNodes:ree,noMyFlows:see,noSkills:iee,noDescription:oee,noNodeMatch:aee,noFlowSnippetMatch:lee,noSkillMatch:cee,nodeSlots:uee,flowSnippet:dee,flowSnippetNodes:fee,skill:pee,nodeDetail:hee,flowDetail:mee,skillDetail:gee,detailType:yee,detailSource:wee,detailPackage:xee,detailVersion:bee,detailPath:kee,detailEditable:vee,readOnly:See,editable:jee,nodeSchema:Nee,nodeInputs:Cee,nodeOutputs:_ee,nodeRuntime:Eee,nodeBody:Aee,nodeFiles:Pee,nodeUsage:Iee,noRuntimeManifest:Ree,noNodeBody:Tee,noNodeFiles:Mee,selectNodeFile:$ee,binaryFile:Lee,fileTruncated:Oee,noNodeUsage:Dee,myNodeManagement:Fee,deleteMyNode:zee,deletingMyNode:Bee,deleteMyNodeHint:Hee,deleteMyNodeConfirm:Wee,deleteMyNodeSuccess:Vee,deleteMyNodeUsedBy:Kee,myFlowManagement:qee,deleteMyFlow:Uee,deletingMyFlow:Yee,deleteMyFlowHint:Gee,deleteMyFlowConfirm:Jee,deleteMyFlowSuccess:Xee,noSlots:Qee,resourceMeaning:Zee,nodesMeaning:ete,myFlowsMeaning:tte,flowSnippetScale:nte,flowSnippetPreview:rte,flowSnippetEdges:ste,flowSnippetJson:ite,flowSnippetMoreEdges:ote,noFlowSnippetPreview:ate,skillsMeaning:lte,skillPreview:cte,skillPreviewEmpty:ute,selectResource:dte,loadFailed:fte,noPipelines:pte,emptyHint:hte,noMatch:mte,recentActivity:gte,noRecentActivity:yte,noMatchRecent:wte,recentRun:xte,recentOpen:bte,sourceBadge:kte,resourceSource:vte,resourceFilter:Ste,nodeDetailTabs:jte,defaultCardDesc:Nte,hubCard:Cte,newPipelineModal:_te,importModal:Ete,deleteModal:Ate,archiveModal:Pte},Rte="Back",Tte="Next",Mte="Skip",$te="Done",Lte="Start Creating",Ote={intro:`Welcome to AgentFlow! This is a visual workflow orchestration tool.
|
|
289
|
-
|
|
290
|
-
Click the button below to create your first pipeline.`,hubIntro:`Don't want to start from scratch?
|
|
291
|
-
|
|
292
|
-
Browse ready-made pipelines on AgentFlow Hub — community-shared flows you can install and run in one click.`},Dte={intro:`Now you're in the flow editor.
|
|
293
|
-
|
|
294
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
295
|
-
|
|
296
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`,introEmpty:`The canvas is empty. Start creating your flow!
|
|
297
|
-
|
|
298
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
299
|
-
|
|
300
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`},Fte={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"},zte={back:Rte,next:Tte,skip:Mte,done:$te,startCreate:Lte,projects:Ote,flow:Dte,newPipeline:Fte},Bte={name:"AgentFlow",tagline:"AI 工作流编排"},Hte={projects:"项目",nodes:"Nodes",myNodes:"我的 Nodes",myFlows:"我的流程",skills:"Skills",mcps:"MCP",feedback:"意见反馈",flowEditor:"流程编辑器",settings:"设置",back:"返回"},Wte={loading:"加载中…",saving:"保存中…",save:"保存",cancel:"取消",delete:"删除",edit:"编辑",create:"创建",close:"关闭",confirm:"确认",copy:"复制",copied:"已复制!",refresh:"刷新",search:"搜索",filter:"筛选",success:"成功",error:"错误",warning:"警告",info:"信息",done:"完成",pending:"待处理",running:"运行中",notFound:"未找到",required:"必填",optional:"可选"},Vte={success:"成功",failed:"失败",pending:"等待",running:"运行中",skipped:"跳过"},Kte={agent:"Agent 节点",control:"控制节点",tool:"工具节点",start:"开始",end:"结束"},qte={online:"引擎在线",offline:"引擎离线",connecting:"连接中…"},Ute={hub:"AgentFlow Hub",docs:"文档",github:"GitHub 仓库"},Yte={app:Bte,nav:Hte,common:Wte,status:Vte,nodeTypes:Kte,engine:qte,links:Ute},Gte="流程编辑器",Jte="节点",Xte="连线",Qte="属性",Zte={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:"编辑内容"},ene={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}}"},tne={run:"运行流程",stop:"停止",resume:"继续",validate:"校验",export:"导出",import:"导入"},nne={nodeList:"节点列表",runHistory:"运行历史",validation:"校验结果"},rne={workspace:"工作区",loading:"加载中…",archived:"已归档",noPipelines:"暂无流水线",more:"更多",moreFlows:"更多流程",noRuns:"暂无运行记录",searchNodes:"搜索节点",noComponents:"暂无可用组件(检查节点库目录)",noMatch:"无匹配节点,请调整搜索词",selectPipeline:"从上方选择一条流水线以加载组件与画布",validationWarnings:"校验警告(与 agentflow validate 槽位检查一致)",output:"输出",model:"模型",userDir:"用户目录",toggleRecentActivity:"展开或收起最近打开或最近运行"},sne={selectPipeline:"请从顶部下拉选择一条流水线",loadingProps:"加载节点属性…",pipelineId:"流水线 ID",diskPath:"磁盘路径",storageLocation:"存储位置",introduction:"介绍",introductionPlaceholder:"简要描述这条流水线的用途(写入 flow.yaml 的 ui.description)",metadata:"元数据",nodeCount:"节点数",nodesUnit:"个节点",loading:"加载中…",noRuns:"暂无运行记录(终端执行后会在工作区生成运行目录)"},ine={saving:"保存中…",saved:"已保存",saveFailed:"保存失败",runInTerminal:"运行请使用终端"},one={requirement:"需求拆解",planning:"技术规划",code:"代码执行",test:"测试回归",normal:"普通"},ane={phase:"阶段",allPhasesComplete:"所有阶段完成",currentPhaseComplete:"当前阶段完成,等待确认继续…"},lne={node:"节点",text:"文本",file:"文件",bool:"布尔"},cne={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:"等待"},une={title:"快捷键",general:"常规",saveDesc:"保存;节点属性侧栏打开时先提交节点再保存 flow",shortcutsLabel:"快捷键",jumpToNode:"按 ID 跳转到节点",openNodePalette:"打开节点面板",canvas:"画布",selectTool:"选择工具",panTool:"平移工具",holdSpacePan:"按住空格临时平移",saveViewport:"保存当前进入视角",selectAll:"全选所有节点",undo:"撤销画布修改",redo:"重做画布修改"},dne={title:"跳转到节点",placeholder:"输入节点 ID 或名称…",empty:"未匹配到节点",hintNavigate:"切换",hintJump:"跳转",hintClose:"关闭"},fne={title:"开始构建你的流程",text:"在下方 AI 输入框中描述你的流程,或从左侧面板拖拽节点到画布",composerHint:"使用 AI Composer 构建 AgentFlow",composerSub:"从左侧拖入节点,或在<strong>下方输入框</strong>中用自然语言描述工作流。<br/>按 <kbd>?</kbd> 查看快捷键。"},pne={mainNav:"主导航"},hne={flowWarningAriaLabel:"流程校验警告",reloadFromServer:"从服务器重新加载流程并刷新校验",reloadFromServerShort:"从服务器重新加载",closeBanner:"关闭校验警告横幅",nodePrefix:"节点",focusNodeAriaLabel:"在画布中选中并定位节点 {{nodeId}}",slotWarningCount:"槽位校验 {{count}} 条(已隐藏)",show:"显示",shortcutHint:"按 ? 查看快捷键",shortcutHintLabel:"快捷键",inputSlotNoEdge:' 的 input 槽位 "{{slotName}}"({{handle}})无对应 edge 连接',outputSlotNoEdge:' 的 output 槽位 "{{slotName}}"({{handle}})无对应 edge 连接'},mne={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}} 步):
|
|
301
|
-
{{summary}}`,step:"步骤 {{current}}/{{total}}: {{description}}",phaseGeneration:`分阶段生成({{count}} 阶段):{{labels}}
|
|
302
|
-
当前:{{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}}"},gne={currentPipeline:"当前流水线",backToEdit:"返回编辑",backToProjects:"返回项目",executionLog:"执行日志",history:"历史",pipelineSettings:"流水线设置",shortcutsLabel:"快捷键",shortcutsTitle:"快捷键 (?)",deletePipeline:"删除流水线",resumeTitle:"在同一 run 目录继续执行(uuid={{uuid}})",resumeTitleNoUuid:"尚未收到 apply-start,将发起新的 run",rerunTitle:"从头开始新的运行",runOptions:"运行选项",runWithParams:"带参数运行",runWithPreset:"指定预设运行",editRun:"编辑运行参数",startRun:"开始执行",stopRun:"停止后台运行"},yne={nodePalette:"节点调色板",noPipelineSelected:"未选择流水线",moreRuns:"+{{count}} 更多",moreFlows:"+{{count}} 更多流程",runId:"运行 ID: {{id}}"},wne={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}} 的分支"},xne={close:"关闭",loading:"加载中…",placeholder:"文件内容",largeFileWarning:"文件较大,编辑器性能可能受影响",reset:"重置",aiEdit:"AI 修改",aiRunning:"AI 处理中…",save:"保存",saving:"保存中…",saved:"已保存"},bne={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:"已复制"},kne={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:"定时配置已保存"},vne={title:"执行历史",summary:"执行结果汇总",successCount:"{{count}} 成功",failedCount:"{{count}} 失败",stoppedCount:"{{count}} 已停止",interruptedCount:"{{count}} 已中断",runningCount:"{{count}} 进行中",success:"成功",failed:"失败",stopped:"已停止",interrupted:"已中断",running:"进行中",unknown:"未知",runLabel:"运行 #{{id}}",enterRunView:"进入该次运行的画布与日志态"},Sne={invalidInstanceId:"实例 ID 格式无效:仅允许英文字母、数字、下划线、短横线,且不能以数字开头。",duplicateInstanceId:"该实例 ID 已存在,请换一个。",loadFlowFailed:"读取 flow 失败",loadNodesFailed:"读取节点库失败"},jne={invalidPlaceholder:"无效占位符: {{hint}}",empty:"(空)",inputSubtitle:"输入 · {{type}}",inputSubtitleNoType:"输入",outputSubtitle:"输出 · {{type}}",outputSubtitleNoType:"输出",runtimeConst:"运行时常量"},Nne={justNow:"刚刚",minutesAgo:"{{n}} 分钟前",hoursAgo:"{{n}} 小时前",yesterday:"昨天",daysAgo:"{{n}} 天前",milliseconds:"{{n}} 毫秒",seconds:"{{n}} 秒"},Cne={title:"用户确认 ({{instanceId}})",edit:"编辑",save:"保存",cancel:"取消",aiEditPlaceholder:"输入 AI 修改指令,如:删除第二项、合并前两项…",aiEditBtn:"AI 修改",aiEditStarted:"AI 正在修改内容…",aiEditDone:"AI 修改完成",aiEditFailed:"AI 修改失败",contentSaved:"内容已保存",saveFailed:"保存失败",close:"关闭",continue:"继续执行",hint:"编辑或使用 AI 修改后点击保存,然后点击「继续执行」恢复流程"},_ne={title:"用户选择 ({{instanceId}})",hint:"请从下方选项中选择一项以继续流程",submitting:"提交中…",submitFailed:"提交失败",close:"关闭",noOptions:"该节点未配置选项,请先在编辑器中为 output 槽位添加条目。"},Ene={title:"Print 输出: {{instanceId}}",expand:"放大",restore:"还原"},Ane={save:"保存",cancel:"取消"},Pne={title:"带参数运行",noParams:"此流程无输入参数",run:"运行",cancel:"取消"},Ine={title:"指定预设运行",noPresets:"无可用预设",default:"默认运行",run:"运行",cancel:"取消"},Rne={preset:"预设",default:"默认",newPreset:"新建预设",deletePreset:"删除预设",presetNamePlaceholder:"预设名称",inputParams:"输入参数",noProvideNodes:"此流程无 provide 节点",filePathPlaceholder:"文件路径…",stringValuePlaceholder:"值…",presetSaved:"预设已保存",presetDeleted:"预设已删除",savePreset:"保存当前预设",expandInput:"编辑内容"},Tne={title:Gte,nodes:Jte,edges:Xte,properties:Qte,node:Zte,nodeProps:ene,actions:tne,panel:nne,palette:rne,pipeline:sne,status:ine,roles:one,phases:ane,types:lne,runContext:cne,shortcuts:une,jumpPalette:dne,emptyCanvas:fne,sidebar:pne,validation:hne,composer:mne,topbar:gne,palette2:yne,run:wne,fileEdit:xne,settings:bne,schedule:kne,history:vne,nodePropsError:Sne,placeholder:jne,time:Nne,userCheck:Cne,userAsk:_ne,toolPrint:Ene,provideEdit:Ane,runParams:Pne,runPreset:Ine,runConfig:Rne},Mne="设置",$ne={engine:"引擎设置",preferences:"全局首选项"},Lne={title:"工作区",currentPath:"当前工作区根目录",placeholder:"加载中…",copyPath:"复制路径",description:"流水线与节点清单将相对于此目录解析(由启动 UI 时传入)。"},One={title:"Cursor CLI",status:{cached:"已缓存",notCached:"未缓存"},modelPreviewLabel:"Cursor 模型名称列表",modelList:{cached:"模型清单已缓存",empty:"暂无模型列表",count:"{{count}} 条",fetchedAt:"更新 {{time}}",never:"尚未拉取",refresh:"刷新清单",fetching:"拉取中…"}},Dne={modelPreviewLabel:"OpenCode 模型名称列表",title:"OpenCode CLI",status:{ready:"就绪",notFound:"未找到"},provider:"方案 / Provider 标识",providerPlaceholder:"例如 bailian-coding-plan",saving:"正在保存并更新清单…",description:"对应 CLI opencode models <provider> 的参数;停止输入后会写入用户目录 config 并刷新 model-lists.json。"},Fne={title:"Claude Code CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Claude Code 模型名称列表",description:"内置模型列表(Claude Code CLI 无 models 子命令);刷新将探测 claude 二进制是否在 PATH 中。首次使用请先执行 claude /login。"},zne={title:"Codex CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Codex 模型名称列表",description:"模型列表来自 codex debug models --bundled;首次使用请先执行 codex login。"},Bne={title:"环境变量",note:"当前登录用户私有,运行时优先于服务全局环境变量",noteAdmin:"可配置个人或全局环境变量;个人同名变量优先于全局",saving:"正在保存...",key:"键",value:"值",scope:"范围",personal:"个人",global:"全局",add:"添加",delete:"删除 {{key}}",invalidKey:"环境变量名必须以字母或下划线开头,且只能包含字母、数字和下划线。",newKey:"新环境变量键",newValue:"值(密钥请谨慎)"},Hne={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:"添加"},Wne={title:"系统状态",normal:"服务正常",abnormal:"部分接口异常",cursorModels:"Cursor 模型",opencodeModels:"OpenCode 模型",claudeCodeModels:"Claude Code 模型",codexModels:"Codex 模型"},Vne={title:"快捷入口",projects:"项目与流水线",flowEditor:"节点画布"},Kne={title:"语言",description:"选择界面显示语言",options:{zh:"中文",en:"English",ja:"日本語"}},qne={title:"新手引导",description:"重新启动产品引导流程,了解 AgentFlow 的核心功能。",reset:"重置引导",resetSuccess:"已重置,下次访问将自动启动引导"},Une={title:Mne,crumb:$ne,workspace:Lne,cursor:One,opencode:Dne,claudeCode:Fne,codex:zne,env:Bne,allowlist:Hne,system:Wne,shortcuts:Vne,language:Kne,onboarding:qne},Yne={thinking:"思考",result:"结果",reply:"回复",error:"错误"},Gne={input:"让 AI 协助编辑此节点…",waiting:"等待响应…",selectedEmpty:"在画布上选择节点,或在输入框用 @ 选择实例(Instances)或节点类型(Node)",textarea:"描述你的流程或让 AI 协助编辑(⌘/Ctrl+Enter 发送)"},Jne={send:"发送",stop:"停止",expand:"展开",collapse:"收起",clear:"清空"},Xne={conversation:"对话",conversationWithNumber:"对话 {{num}}",default:"默认"},Qne={endSession:"结束对话(将停止生成)",closeSession:"关闭对话",newSession:"新建对话",expandComposer:"展开对话与输出"},Zne={hint:"使用底部输入框进行 AI 对话,支持 @节点、选择模型等功能"},ere={aiLabels:Yne,placeholders:Gne,actions:Jne,labels:Xne,tooltips:Qne,rightPanel:Zne},tre="项目",nre="全部",rre="已归档",sre="Nodes",ire="我的 Nodes",ore="我的流程",are="Skills",lre="活跃项目",cre="已归档流水线",ure="全局 Nodes",dre="全部 Nodes",fre="我的 Nodes",pre="管理当前工作区已发布到本地 Marketplace 的节点,共 {{count}} 个。",hre="管理当前工作区已发布到本地 Marketplace 的流程片段,共 {{count}} 个。",mre="全局 Skills",gre="创建新项目",yre="新建流水线",wre="搜索流水线…",xre="搜索 nodes…",bre="搜索流程片段…",kre="搜索 skills…",vre="刷新资源",Sre="加载流水线列表…",jre="加载全局资源…",Nre="筛选结果:{{count}} 条(匹配标题、描述、路径与标签)",Cre="已归档的流水线仍可打开与编辑;文件位于各 pipelines 目录下的 _archived。",_re="管理分布式节点架构与监控流水线。可将 flow.yaml 或 .zip 拖入本页导入分享流程。",Ere="查看当前可用的全局节点定义,共 {{count}} 个;包含内置、工作区与 marketplace 节点。",Are="查看当前 Composer 可选择的 skills,共 {{count}} 个;包含 AgentFlow 内置与工作区 skills。",Pre="流程运行时的可执行积木",Ire="Nodes 决定画布上能拖什么、节点有哪些输入输出,以及运行时走 agent、control、provide 或 marketplace 哪类逻辑。",Rre="已发布的本地节点包",Tre="这里仅显示你发布到当前 Workspace Marketplace 的节点版本;可查看详情并删除未被 Flow 使用的版本。",Mre="已发布的流程片段",$re="这里显示从 Pipeline 或 Workspace 画布发布的流程片段,可搜索、检查内容,并从画布的流程面板中加载复用。",Lre="Composer/Agent 的操作指南",Ore="Skills 告诉 AI 在特定任务里应遵守什么规则、如何修改 flow、如何复用项目约定。",Dre="暂无归档项目。",Fre="暂无未归档流水线;已归档项在 Archived 标签中查看。",zre="暂无可用全局 nodes。",Bre="暂无已发布的 marketplace nodes。",Hre="暂无已发布的流程片段。可在画布中选中多个节点后发布。",Wre="暂无可用 skills。",Vre="暂无描述。",Kre="未找到与「{{query}}」匹配的 node。",qre="未找到与「{{query}}」匹配的流程片段。",Ure="未找到与「{{query}}」匹配的 skill。",Yre="{{inputs}} in / {{outputs}} out",Gre="流程片段",Jre="{{nodes}} 节点 / {{edges}} 连线",Xre="Skill",Qre="Node 详情",Zre="流程片段详情",ese="Skill 详情",tse="类型",nse="来源",rse="包",sse="版本",ise="路径",ose="可编辑",ase="只读",lse="可编辑",cse="Schema",use="输入",dse="输出",fse="Runtime",pse="节点内容",hse="Files",mse="Usage",gse="暂无 runtime manifest。",yse="暂无节点正文或 README。",wse="暂无可预览文件。",xse="请选择文件查看内容。",bse="二进制文件暂不支持预览。",kse="文件较大,仅显示前 256KB。",vse="暂未发现使用此 node 的流水线。",Sse="节点管理",jse="删除节点版本",Nse="删除中…",Cse="删除前会检查所有 Flow 引用;仍被安装或使用的版本不会被删除。",_se="确定删除 {{id}}@{{version}}?此操作不可撤销。",Ese="已删除 {{id}}@{{version}}。",Ase="仍有 {{count}} 个 Flow 使用它。",Pse="流程片段管理",Ise="删除流程片段",Rse="删除中…",Tse="删除后不会影响已经加载到画布里的节点,只会移除 Marketplace 中这个可复用片段。",Mse="确定删除 {{id}}@{{version}}?此操作不可撤销。",$se="已删除 {{id}}@{{version}}。",Lse="无槽位",Ose="作用",Dse="这个 node 是 pipeline 的执行单元。它的 schema 会影响画布连线、参数输入和运行时调度。",Fse="流程片段是固定化流程的一部分。加载时会复制这组节点、连线和布局到当前画布,不覆盖已有内容。",zse="规模",Bse="流程预览",Hse="连线",Wse="片段 JSON",Vse="还有 {{count}} 条连线",Kse="暂无可预览节点。",qse="这个 skill 会作为 Composer 的上下文注入给 AI,用于约束 AI 的判断、修改方式和输出口径。",Use="SKILL.md 预览",Yse="暂无可预览内容。",Gse="请选择一个资源查看详情。",Jse="未能加载流水线列表。",Xse="当前工作区暂无流水线。",Qse="在仓库根目录执行 {{code1}} 并确认工作区包含 {{code2}} 或用户目录下的流水线;亦可点击 New Pipeline 新建。",Zse="未找到与「{{query}}」匹配的流水线。可尝试其他关键词,或点击清除搜索。",eie="最近打开或最近运行",tie="暂无打开或运行记录",nie="暂无与关键词匹配的最近记录",rie="最近运行",sie="最近打开",iie={builtin:"内置",workspace:"工作区",user:"用户"},oie={flow:"Flow",global:"Global",marketplace:"Marketplace"},aie={all:"全部",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},lie={overview:"概览",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},cie="打开以在节点画布中编辑此流水线。",uie={eyebrow:"AgentFlow Hub",title:"浏览社区流程",desc:"发现并一键安装社区分享的现成流水线。",cta:"前往 Hub",cliHint:"或通过 CLI 安装:agentflow download <slug>"},die={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:"关闭"},fie={title:"导入流水线",lead:"已选择文件「{{filename}}」。请确认流水线名称与保存位置;ZIP 将保留目录内脚本等文件。",nameLabel:"名称(必填)",namePlaceholder:"例如 my_shared_flow",nameHint:"须以英文字母开头,仅可使用字母、数字、下划线 _ 与连字符 -",locationLabel:"保存位置",userDir:"用户目录(~/agentflow/pipelines)",workspaceDir:"当前工作区(.workspace/agentflow/pipelines)",changeFile:"更换文件…",importFailed:"导入失败",importing:"导入中…",importAndOpen:"导入并打开",cancel:"取消",close:"关闭"},pie={title:"删除流水线",lead:"将永久删除磁盘上的流水线目录(含 flow.yaml、脚本等),无法撤销。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",deleteFailed:"删除失败",deleteTimeout:"删除请求超时,请重试(可先检查终端中的 UI 服务日志)",delete:"删除",deleting:"删除中…",confirmDelete:"确认删除",cancel:"取消",close:"关闭"},hie={title:"归档流水线",lead:"归档后流水线将移入「Archived」列表,仍可从该列表打开与编辑。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",archiveFailed:"归档失败",archive:"归档",archiving:"归档中…",confirmArchive:"确认归档",cancel:"取消",close:"关闭"},mie={title:tre,all:nre,archived:rre,nodes:sre,myNodes:ire,myFlows:ore,skills:are,activeProjects:lre,archivedPipelines:cre,globalNodes:ure,nodeScopeAll:dre,nodeScopeMine:fre,myNodesHint:pre,myFlowsHint:hre,globalSkills:mre,createNew:gre,newPipeline:yre,searchPipelines:wre,searchNodes:xre,searchFlows:bre,searchSkills:kre,refreshResources:vre,loadingPipelines:Sre,loadingResources:jre,filterResult:Nre,archivedHint:Cre,activeHint:_re,nodesHint:Ere,skillsHint:Are,nodesPurposeTitle:Pre,nodesPurposeDesc:Ire,myNodesPurposeTitle:Rre,myNodesPurposeDesc:Tre,myFlowsPurposeTitle:Mre,myFlowsPurposeDesc:$re,skillsPurposeTitle:Lre,skillsPurposeDesc:Ore,noArchived:Dre,noActive:Fre,noNodes:zre,noMyNodes:Bre,noMyFlows:Hre,noSkills:Wre,noDescription:Vre,noNodeMatch:Kre,noFlowSnippetMatch:qre,noSkillMatch:Ure,nodeSlots:Yre,flowSnippet:Gre,flowSnippetNodes:Jre,skill:Xre,nodeDetail:Qre,flowDetail:Zre,skillDetail:ese,detailType:tse,detailSource:nse,detailPackage:rse,detailVersion:sse,detailPath:ise,detailEditable:ose,readOnly:ase,editable:lse,nodeSchema:cse,nodeInputs:use,nodeOutputs:dse,nodeRuntime:fse,nodeBody:pse,nodeFiles:hse,nodeUsage:mse,noRuntimeManifest:gse,noNodeBody:yse,noNodeFiles:wse,selectNodeFile:xse,binaryFile:bse,fileTruncated:kse,noNodeUsage:vse,myNodeManagement:Sse,deleteMyNode:jse,deletingMyNode:Nse,deleteMyNodeHint:Cse,deleteMyNodeConfirm:_se,deleteMyNodeSuccess:Ese,deleteMyNodeUsedBy:Ase,myFlowManagement:Pse,deleteMyFlow:Ise,deletingMyFlow:Rse,deleteMyFlowHint:Tse,deleteMyFlowConfirm:Mse,deleteMyFlowSuccess:$se,noSlots:Lse,resourceMeaning:Ose,nodesMeaning:Dse,myFlowsMeaning:Fse,flowSnippetScale:zse,flowSnippetPreview:Bse,flowSnippetEdges:Hse,flowSnippetJson:Wse,flowSnippetMoreEdges:Vse,noFlowSnippetPreview:Kse,skillsMeaning:qse,skillPreview:Use,skillPreviewEmpty:Yse,selectResource:Gse,loadFailed:Jse,noPipelines:Xse,emptyHint:Qse,noMatch:Zse,recentActivity:eie,noRecentActivity:tie,noMatchRecent:nie,recentRun:rie,recentOpen:sie,sourceBadge:iie,resourceSource:oie,resourceFilter:aie,nodeDetailTabs:lie,defaultCardDesc:cie,hubCard:uie,newPipelineModal:die,importModal:fie,deleteModal:pie,archiveModal:hie},gie="返回",yie="下一步",wie="跳过",xie="完成",bie="开始创建",kie={intro:`欢迎使用 AgentFlow!这是一个可视化流程编排工具。
|
|
303
|
-
|
|
304
|
-
点击下方按钮开始创建你的第一个流水线。`,hubIntro:`不想从零开始?
|
|
305
|
-
|
|
306
|
-
在 AgentFlow Hub 浏览社区分享的现成流水线,一键安装即可运行。`},vie={intro:`现在进入流程编辑器。
|
|
307
|
-
|
|
308
|
-
在下方输入框用自然语言描述你的需求,AI 会自动生成流程图。
|
|
309
|
-
|
|
310
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`,introEmpty:`画布为空,开始创建你的流程吧!
|
|
311
|
-
|
|
312
|
-
在下方输入框用自然语言描述需求,AI 会自动生成流程图。
|
|
313
|
-
|
|
314
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`},Sie={guideTitle:"首次创建提示",guideDesc:"输入名称和描述后,AI 会自动生成流程图。你可以在编辑器中自由调整节点和连接。",nameHintGuide:"例如:MyFirstFlow(字母开头,支持数字和下划线)",descPlaceholderGuide:"例如:实现用户登录功能,包含注册、验证、授权",descHintGuide:"描述越详细,AI 生成的流程越准确",createGuide:"创建并开始编辑",typeNode:"节点引用类型",typeStr:"字符串类型",typeFile:"文件路径类型",typeBool:"布尔值类型"},jie={back:gie,next:yie,skip:wie,done:xie,startCreate:bie,projects:kie,flow:vie,newPipeline:Sie},Nie={en:{common:uQ,flow:GQ,settings:cZ,composer:gZ,project:Ite,onboarding:zte},zh:{common:Yte,flow:Tne,settings:Une,composer:ere,project:mie,onboarding:jie}};wr.use(OM).use(zD).init({resources:Nie,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 Cie=[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"en",name:"English",flag:"🇬🇧"}];function _ie(e){return wr.changeLanguage(e)}const _b="agentflow-settings-opencode-plan-v1",td="CURSOR_API_KEYS",nd="AGENTFLOW_CURSOR_API_KEY_COOLDOWN_MINUTES",kw=new Set([td,nd,"CURSOR_API_KEY_COOLDOWN_MINUTES"]),DM=["cursor","opencode","claudeCode","codex"];function FM(){return{cursor:[],opencode:[],claudeCode:[],codex:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null,codexFetchedAt:null}}function Eb(e){const t=String(e||"").trim(),n=t.indexOf(" - ");return n>=0?t.slice(0,n).trim():t}function Na(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n={};for(const r of DM)n[r]=Array.isArray(t[r])?[...new Set(t[r].map(Eb).filter(Boolean))]:[];return n}function qi(e){if(!e||typeof e!="object")return FM();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 Sc(){return`e_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function Eie(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function Pa(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()||Sc(),c=String(r.scope??t).trim()==="global"?"global":"user";!s&&!o||n.push({id:a,key:s,value:o,scope:c})}return n}function k_(e){return Pa(e).map(({key:t,value:n})=>({key:t,value:n}))}function v_(){try{return localStorage.getItem(_b)??""}catch{return""}}function zM(e){return e?e.length<=6?"•".repeat(e.length):`${"•".repeat(Math.min(20,e.length-4))}${e.slice(-4)}`:""}function Aie(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()||Sc(),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 S_(e){const t=Array.isArray(e)?e.map((n,r)=>({id:String((n==null?void 0:n.id)||"").trim()||Sc(),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 Pie(e){const t=String(e||"").trim();return t?t.length<=10?zM(t):`${t.slice(0,4)}${"•".repeat(Math.min(18,t.length-8))}${t.slice(-4)}`:""}function Iie(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 Rie({authUser:e}){const{t,i18n:n}=$r(["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,f]=m.useState(FM()),[p,h]=m.useState(()=>Na({})),[y,v]=m.useState(!1),[w,g]=m.useState(""),[k,b]=m.useState(""),[j,N]=m.useState(!1),[C,I]=m.useState(!1),[R,H]=m.useState(""),[A,L]=m.useState([]),[D,O]=m.useState(""),[M,K]=m.useState(!1),[z,F]=m.useState(""),[$,W]=m.useState(""),[E,Q]=m.useState(!1),[V,B]=m.useState(()=>new Set),[re,ue]=m.useState(""),[G,ee]=m.useState(""),[te,ne]=m.useState(!!(e!=null&&e.isAdmin)),[Z,ce]=m.useState(""),[de,me]=m.useState([]),[$e,Ce]=m.useState([]),[_e,Be]=m.useState(""),[at,yt]=m.useState(""),[Te,it]=m.useState(!1),[gt,$t]=m.useState(!1),[be,He]=m.useState(""),[ie,ke]=m.useState(""),[Fe,Ze]=m.useState(""),[Ne,St]=m.useState(null),[Jt,Vt]=m.useState(!1),[ot,On]=m.useState(!1),[se,Ie]=m.useState(""),et=m.useRef(null),qe=m.useRef(!1),Et=m.useRef(!1),vt=m.useRef(""),Jn=m.useCallback(async()=>{l("");try{const oe=await fetch("/api/ui-context");if(!oe.ok)throw new Error("HTTP "+oe.status);const ve=await oe.json();o(typeof ve.workspaceRoot=="string"?ve.workspaceRoot:"")}catch(oe){l(String(oe.message||oe)),o("")}},[]),mn=m.useCallback(async()=>{b(""),N(!0),g("");try{const oe=await fetch(e!=null&&e.isAdmin?"/api/model-visibility":"/api/model-lists");if(!oe.ok)throw new Error("HTTP "+oe.status);const ve=await oe.json();if(e!=null&&e.isAdmin)u(qi(ve.modelLists)),f(qi(ve.allModelLists)),h(Na(ve.hiddenModels));else{const Re=qi(ve);u(Re),f(Re),h(Na({}))}}catch(oe){b(String(oe.message||oe))}finally{N(!1)}},[e==null?void 0:e.isAdmin]),Lr=m.useCallback(async()=>{O("");try{const oe=await fetch("/api/user-env"),ve=await oe.json().catch(()=>({}));if(!oe.ok)throw new Error(typeof ve.error=="string"?ve.error:"HTTP "+oe.status);const Re=Pa(Array.isArray(ve.env)?ve.env:[],"user").map(Qt=>({...Qt,scope:"user"})),Tt=[...e!=null&&e.isAdmin?Pa(Array.isArray(ve.globalEnv)?ve.globalEnv:[],"global").map(Qt=>({...Qt,scope:"global"})):[],...Re];vt.current=JSON.stringify(Tt),L(Tt)}catch(oe){L([]),O(String(oe.message||oe))}finally{Et.current=!0}},[e==null?void 0:e.isAdmin]),Vn=m.useCallback(async()=>{if(e!=null&&e.isAdmin){it(!0),He("");try{const oe=await fetch("/api/admin/user-allowlist"),ve=await oe.json().catch(()=>({}));if(!oe.ok)throw new Error(typeof ve.error=="string"?ve.error:"HTTP "+oe.status);const Re=ve.allowlist&&typeof ve.allowlist=="object"?ve.allowlist:{};me(Array.isArray(Re.fileUsers)?Re.fileUsers.map(String):[]),Ce(Array.isArray(Re.envUsers)?Re.envUsers.map(String):[]),Be(typeof Re.path=="string"?Re.path:"")}catch(oe){He(String(oe.message||oe))}finally{it(!1)}}},[e==null?void 0:e.isAdmin]),ir=m.useCallback(async oe=>{if(e!=null&&e.isAdmin){$t(!0),He("");try{const ve=await fetch("/api/admin/user-allowlist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({users:oe})}),Re=await ve.json().catch(()=>({}));if(!ve.ok)throw new Error(typeof Re.error=="string"?Re.error:"HTTP "+ve.status);const kt=Re.allowlist&&typeof Re.allowlist=="object"?Re.allowlist:{};me(Array.isArray(kt.fileUsers)?kt.fileUsers.map(String):[]),Ce(Array.isArray(kt.envUsers)?kt.envUsers.map(String):[]),Be(typeof kt.path=="string"?kt.path:"")}catch(ve){He(String(ve.message||ve))}finally{$t(!1)}}},[e==null?void 0:e.isAdmin]),Xn=m.useCallback(async()=>{if(e!=null&&e.isAdmin){Vt(!0),Ie("");try{const oe=await fetch("/api/admin/storage-config"),ve=await oe.json().catch(()=>({}));if(!oe.ok)throw new Error(typeof ve.error=="string"?ve.error:"HTTP "+oe.status);const Re=ve.config&&typeof ve.config=="object"?ve.config:{};St(Re),ke(typeof Re.dataRoot=="string"?Re.dataRoot:""),Ze(typeof Re.skillsRoot=="string"?Re.skillsRoot:"")}catch(oe){Ie(String(oe.message||oe))}finally{Vt(!1)}}},[e==null?void 0:e.isAdmin]),Qn=m.useCallback(async()=>{if(e!=null&&e.isAdmin){On(!0),Ie("");try{const oe=await fetch("/api/admin/storage-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataRoot:ie.trim(),skillsRoot:Fe.trim(),migrateLegacySkills:!0})}),ve=await oe.json().catch(()=>({}));if(!oe.ok)throw new Error(typeof ve.error=="string"?ve.error:"HTTP "+oe.status);const Re=ve.config&&typeof ve.config=="object"?ve.config:{};St(Re),ke(typeof Re.dataRoot=="string"?Re.dataRoot:""),Ze(typeof Re.skillsRoot=="string"?Re.skillsRoot:"")}catch(oe){Ie(String(oe.message||oe))}finally{On(!1)}}},[e==null?void 0:e.isAdmin,ie,Fe]),Zn=m.useCallback(async oe=>{const ve=Pa(oe),Re=ve.filter(Tt=>Tt.scope!=="global"),kt=ve.filter(Tt=>Tt.scope==="global");K(!0),O("");try{const Tt=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:k_(Re),...e!=null&&e.isAdmin?{globalEnv:k_(kt)}:{}})}),Qt=await Tt.json().catch(()=>({}));if(!Tt.ok)throw new Error(typeof Qt.error=="string"?Qt.error:"HTTP "+Tt.status);const gn=Pa(Array.isArray(Qt.env)?Qt.env:[],"user").map(ge=>({...ge,scope:"user"})),q=[...e!=null&&e.isAdmin?Pa(Array.isArray(Qt.globalEnv)?Qt.globalEnv:[],"global").map(ge=>({...ge,scope:"global"})):[],...gn];vt.current=JSON.stringify(q),L(q)}catch(Tt){O(String(Tt.message||Tt))}finally{K(!1)}},[e==null?void 0:e.isAdmin]),Cr=m.useCallback(async()=>{b(""),N(!0);try{const oe=await fetch("/api/update-model-lists",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:Z.trim()})}),ve=await oe.json().catch(()=>({}));if(!oe.ok)throw new Error(typeof ve.error=="string"?ve.error:"HTTP "+oe.status);u(qi(ve.modelLists)),e!=null&&e.isAdmin?await mn():f(qi(ve.modelLists))}catch(oe){b(String(oe.message||oe))}finally{N(!1)}},[e==null?void 0:e.isAdmin,mn,Z]),ys=m.useCallback(async oe=>{if(!(e!=null&&e.isAdmin))return;const ve=Na(oe);h(ve),v(!0),g("");try{const Re=await fetch("/api/model-visibility",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hiddenModels:ve})}),kt=await Re.json().catch(()=>({}));if(!Re.ok)throw new Error(typeof kt.error=="string"?kt.error:"HTTP "+Re.status);u(qi(kt.modelLists)),f(qi(kt.allModelLists)),h(Na(kt.hiddenModels))}catch(Re){g(String(Re.message||Re)),mn()}finally{v(!1)}},[e==null?void 0:e.isAdmin,mn]),Ts=m.useCallback((oe,ve,Re)=>{const kt=DM.includes(oe)?oe:"cursor",Tt=Eb(ve);if(!Tt)return;const Qt=Na(p),gn=new Set(Qt[kt]);Re?gn.delete(Tt):gn.add(Tt),ys({...Qt,[kt]:Array.from(gn)})},[p,ys]);m.useEffect(()=>{Lr(),e!=null&&e.isAdmin?(Jn(),mn(),Vn(),Xn(),(async()=>{try{const oe=await fetch("/api/agentflow-config");if(oe.ok){const ve=await oe.json(),Re=typeof ve.opencodeProvider=="string"?ve.opencodeProvider:"";ce(Re),et.current=Re;try{localStorage.setItem(_b,Re)}catch{}}else{const ve=v_();ce(ve),et.current=ve}}catch{const oe=v_();ce(oe),et.current=oe}finally{qe.current=!0}})()):(o(""),qe.current=!1)},[e==null?void 0:e.isAdmin,Jn,mn,Xn,Vn,Lr]),m.useEffect(()=>{if(!Et.current||JSON.stringify(Pa(A))===vt.current)return;const ve=setTimeout(()=>{Zn(A)},350);return()=>clearTimeout(ve)},[A,Zn]),m.useEffect(()=>{if(!(e!=null&&e.isAdmin)||!qe.current)return;const oe=Z.trim();if(oe===et.current)return;const ve=setTimeout(()=>{(async()=>{I(!0),H("");try{const Re=await fetch("/api/agentflow-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:oe})}),kt=await Re.json().catch(()=>({}));if(!Re.ok)throw new Error(typeof kt.error=="string"?kt.error:"HTTP "+Re.status);et.current=oe;try{localStorage.setItem(_b,oe)}catch{}kt.modelLists&&(u(qi(kt.modelLists)),e!=null&&e.isAdmin?mn():f(qi(kt.modelLists)))}catch(Re){H(String(Re.message||Re))}finally{I(!1)}})()},450);return()=>clearTimeout(ve)},[e==null?void 0:e.isAdmin,mn,Z]);const Sn=e!=null&&e.isAdmin?d:c,Dn=Sn.cursor.length>0,Zr=Sn.opencode.length>0,Tn=Sn.claudeCode.length>0,Fn=Sn.codex.length>0,es=Na(p),Or={cursor:c.cursor.length,opencode:c.opencode.length,claudeCode:c.claudeCode.length,codex:c.codex.length},er=m.useCallback((oe,ve,Re)=>{const kt=Array.isArray(ve)?ve:[];if(!(e!=null&&e.isAdmin))return i.jsx("pre",{className:"af-set-model-preview","aria-label":Re,children:kt.join(`
|
|
315
|
-
`)});const Tt=new Set(es[oe]||[]);return i.jsxs("div",{className:"af-set-model-visibility","aria-label":Re,children:[i.jsxs("div",{className:"af-set-model-visibility-head",children:[i.jsxs("span",{children:["展示 ",Or[oe]||0," / ",kt.length]}),i.jsx("span",{children:y?"保存中":"取消勾选后从模型下拉隐藏"})]}),i.jsx("div",{className:"af-set-model-visibility-list",children:kt.map(Qt=>{const gn=Eb(Qt),zn=!Tt.has(gn);return i.jsxs("label",{className:"af-set-model-visibility-row",children:[i.jsx("input",{type:"checkbox",checked:zn,disabled:y,onChange:q=>Ts(oe,Qt,q.target.checked)}),i.jsx("span",{children:Qt})]},`${oe}-${Qt}`)})})]})},[e==null?void 0:e.isAdmin,es,y,Or,Ts]),Xt=de.length>0||$e.length>0,jn=e!=null&&e.isAdmin?A:A.filter(oe=>!kw.has(String((oe==null?void 0:oe.key)||"").trim())),le=e!=null&&e.isAdmin&&te?"global":"user",he=m.useMemo(()=>A.find(oe=>oe.key===td&&(oe.scope||"user")===le)||null,[le,A]),nt=m.useMemo(()=>Aie((he==null?void 0:he.value)||""),[he==null?void 0:he.value]),ct=m.useMemo(()=>A.find(oe=>oe.key===nd&&(oe.scope||"user")===le)||null,[le,A]),Ft=ct!=null&&ct.value?String(ct.value):"30",on=m.useCallback((oe,ve,Re)=>{const kt=String(oe||"").trim();if(!kt)return;const Tt=String(ve??"");L(Qt=>{const gn=Qt.find(zn=>zn.key===kt&&(zn.scope||"user")===Re);return Tt?gn?Qt.map(zn=>zn.id===gn.id?{...zn,value:Tt,scope:Re}:zn):[{id:Sc(),key:kt,value:Tt,scope:Re},...Qt]:Qt.filter(zn=>!(zn.key===kt&&(zn.scope||"user")===Re))})},[]),Dr=m.useCallback(()=>{const oe=G.trim();if(!oe)return;const ve=[...nt,{id:Sc(),name:re.trim()||`Key ${nt.length+1}`,key:oe,createdAt:new Date().toISOString()}];on(td,S_(ve),le),ue(""),ee("")},[re,nt,le,G,on]),wt=m.useCallback(oe=>{const ve=nt.filter(Re=>Re.id!==oe);on(td,ve.length?S_(ve):"",le)},[nt,le,on]),Yt=m.useCallback(oe=>{const ve=String(oe||"").replace(/[^\d]/g,"");if(!ve){on(nd,"",le);return}const Re=Math.min(1440,Math.max(1,Number(ve)||30));on(nd,String(Re),le)},[le,on]),zt=m.useCallback(()=>{var oe;s&&((oe=navigator.clipboard)==null||oe.writeText(s))},[s]),tr=m.useCallback(()=>{const oe=z.trim(),ve=$;if(oe){if(!Eie(oe)){O(t("settings:env.invalidKey"));return}if(!(e!=null&&e.isAdmin)&&kw.has(oe)){O("该运行基础设施变量仅管理员可配置。");return}L(Re=>[{id:Sc(),key:oe,value:ve,scope:e!=null&&e.isAdmin&&E?"global":"user"},...Re]),F(""),W("")}},[e==null?void 0:e.isAdmin,E,z,$,t]),tt=m.useCallback(oe=>{L(ve=>ve.filter(Re=>Re.id!==oe))},[]),Mn=m.useCallback((oe,ve)=>{const Re=String((ve==null?void 0:ve.key)||"").trim();if(!(e!=null&&e.isAdmin)&&Re&&kw.has(Re)){O("该运行基础设施变量仅管理员可配置。");return}L(kt=>kt.map(Tt=>Tt.id===oe?{...Tt,...ve}:Tt))},[e==null?void 0:e.isAdmin]),Ms=m.useCallback(oe=>{B(ve=>{const Re=new Set(ve);return Re.has(oe)?Re.delete(oe):Re.add(oe),Re})},[]),ci=m.useCallback(()=>{const oe=at.trim();if(!oe)return;if(!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(oe)){He("用户名须以字母开头,仅可使用字母、数字、下划线与连字符,最多 64 字符");return}if(new Set(de.map(Re=>String(Re||"").trim().toLowerCase())).has(oe.toLowerCase())){yt("");return}yt(""),ir([...de,oe])},[at,de,ir]),ui=m.useCallback(oe=>{const ve=String(oe||"").trim().toLowerCase();ve&&ir(de.filter(Re=>String(Re||"").trim().toLowerCase()!==ve))},[de,ir]),xo=m.useCallback(oe=>{const ve=oe.target.value;_ie(ve)},[]),$s=oe=>{const ve=Iie(oe,r);return ve?t("settings:cursor.modelList.fetchedAt",{time:ve}):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:e!=null&&e.isAdmin?t("settings:workspace.description"):t("settings:env.note")}),e!=null&&e.isAdmin&&a?i.jsx("p",{className:"af-err af-settings-api-hint",children:a}):null,e!=null&&e.isAdmin&&k?i.jsx("p",{className:"af-err af-settings-api-hint",children:k}):null,D?i.jsx("p",{className:"af-err af-settings-api-hint",children:D}):null,se?i.jsx("p",{className:"af-err af-settings-api-hint",children:se}):null]}),i.jsx("div",{className:"af-settings-layout",children:i.jsxs("div",{className:"af-settings-bento",children:[e!=null&&e.isAdmin?i.jsxs(i.Fragment,{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:zt,"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"+(Dn?" af-set-badge--ok":" af-set-badge--muted"),children:t(Dn?"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:Dn?"check_circle":"hourglass_empty"})}),i.jsxs("div",{children:[i.jsx("p",{className:"af-set-cli-title",children:t(Dn?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),i.jsx("p",{className:"af-set-cli-mono",children:Dn?t("settings:cursor.modelList.count",{count:c.cursor.length})+(e!=null&&e.isAdmin?` / ${Sn.cursor.length}`:"")+" · "+$s(c.cursorFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),Dn?er("cursor",Sn.cursor,t("settings:cursor.modelPreviewLabel")):null,w?i.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",role:"alert",children:w}):null,i.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Cr(),disabled:j,children:t(j?"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"+(nt.length?" af-set-badge--ok":" af-set-badge--muted"),children:[nt.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:te?"":"is-active",onClick:()=>ne(!1),children:"个人"}),i.jsx("button",{type:"button",className:te?"is-active":"",onClick:()=>ne(!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:Ft,onChange:oe=>Yt(oe.target.value)}),i.jsx("span",{children:"分钟"})]}),i.jsx("span",{className:"af-set-env-note",children:M?"保存中":le==="global"?"全局配置":"个人配置"})]}),i.jsx("div",{className:"af-set-cursor-key-list",children:nt.length?nt.map(oe=>i.jsxs("div",{className:"af-set-cursor-key-row",children:[i.jsxs("div",{className:"af-set-cursor-key-main",children:[i.jsx("strong",{children:oe.name}),i.jsx("code",{children:Pie(oe.key)})]}),i.jsx("span",{className:"af-set-cursor-key-meta",children:oe.createdAt?new Date(oe.createdAt).toLocaleString():"历史 Key"}),i.jsx("button",{type:"button",className:"af-set-env-del af-set-cursor-key-delete","aria-label":`删除 ${oe.name}`,onClick:()=>wt(oe.id),children:i.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})]},oe.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:re,onChange:oe=>ue(oe.target.value),placeholder:"名称,例如 Team Key 1"}),i.jsx("input",{className:"af-set-input af-set-input--mono",type:"password",value:G,onChange:oe=>ee(oe.target.value),placeholder:"Cursor API Key"}),i.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:Dr,disabled:!G.trim(),children:[i.jsx("span",{className:"material-symbols-outlined",children:"add"}),"添加 Key"]})]}),i.jsxs("p",{className:"af-set-hint",children:["保存到 ",td,";冷却时间保存到 ",nd,"。个人配置会覆盖全局配置。"]})]}),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"+(Zr?" af-set-badge--ok":" af-set-badge--err"),children:t(Zr?"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:Z,onChange:oe=>ce(oe.target.value),placeholder:t("settings:opencode.providerPlaceholder"),autoComplete:"off"}),C?i.jsx("p",{className:"af-set-hint af-set-hint--inline","aria-live":"polite",children:t("settings:opencode.saving")}):null,R?i.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",role:"alert",children:R}):null]}),Zr?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?` / ${Sn.opencode.length}`:"")+" · "+$s(c.opencodeFetchedAt)}),er("opencode",Sn.opencode,t("settings:opencode.modelPreviewLabel"))]}):null,i.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Cr(),disabled:j,children:t(j?"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"+(Tn?" af-set-badge--ok":" af-set-badge--err"),children:t(Tn?"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:Tn?"check_circle":"hourglass_empty"})}),i.jsxs("div",{children:[i.jsx("p",{className:"af-set-cli-title",children:t(Tn?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),i.jsx("p",{className:"af-set-cli-mono",children:Tn?t("settings:cursor.modelList.count",{count:c.claudeCode.length})+(e!=null&&e.isAdmin?` / ${Sn.claudeCode.length}`:"")+" · "+$s(c.claudeCodeFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),i.jsx("p",{className:"af-set-p",children:t("settings:claudeCode.description")}),Tn?er("claudeCode",Sn.claudeCode,t("settings:claudeCode.modelPreviewLabel")):null,i.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Cr(),disabled:j,children:t(j?"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"+(Fn?" af-set-badge--ok":" af-set-badge--err"),children:t(Fn?"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: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.codex.length})+(e!=null&&e.isAdmin?` / ${Sn.codex.length}`:"")+" · "+$s(c.codexFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),i.jsx("p",{className:"af-set-p",children:t("settings:codex.description")}),Fn?er("codex",Sn.codex,t("settings:codex.modelPreviewLabel")):null,i.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Cr(),disabled:j,children:t(j?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]})]}):null,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:z,onChange:oe=>F(oe.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:$,onChange:oe=>W(oe.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:tr,disabled:!z.trim(),children:[i.jsx("span",{className:"material-symbols-outlined",children:"add"}),t("settings:env.add")]})})]}),jn.map(oe=>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:oe.key,onChange:ve=>Mn(oe.id,{key:ve.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:oe.scope!=="global"?"is-active":"",onClick:()=>Mn(oe.id,{scope:"user"}),children:t("settings:env.personal")}),i.jsx("button",{type:"button",className:oe.scope==="global"?"is-active":"",onClick:()=>Mn(oe.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(oe.id)?"text":"password",value:oe.value,onChange:ve=>Mn(oe.id,{value:ve.target.value}),placeholder:zM(oe.value)||t("settings:env.newValue"),"aria-label":t("settings:env.value")}),i.jsx("button",{type:"button",className:"af-set-env-value-toggle",onClick:()=>Ms(oe.id),"aria-label":V.has(oe.id)?"Hide value":"Show value",children:i.jsx("span",{className:"material-symbols-outlined",children:V.has(oe.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:oe.key}),onClick:()=>tt(oe.id),children:i.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})})]},oe.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"+(Ne!=null&&Ne.envLocked?" af-set-badge--err":" af-set-badge--ok"),children:Ne!=null&&Ne.envLocked?"Env locked":"Configurable"}),i.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void Xn(),disabled:Jt||ot,children:Jt?"刷新中...":"刷新"})]}),se?i.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:se}):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:ie,onChange:oe=>ke(oe.target.value),placeholder:"/data1/services/mengmai/agentflow",autoComplete:"off",disabled:!!(Ne!=null&&Ne.envLocked)||ot}),i.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:()=>void Qn(),"aria-label":"保存 AgentFlow Data Root",disabled:ot||!!(Ne!=null&&Ne.envLocked),children:i.jsx("span",{className:"material-symbols-outlined",children:ot?"hourglass_empty":"save"})})]}),i.jsxs("p",{className:"af-set-hint",children:["当前目录:",i.jsx("code",{children:(Ne==null?void 0:Ne.dataRoot)||ie||"-"}),Ne!=null&&Ne.configPath?i.jsxs(i.Fragment,{children:[";配置文件:",i.jsx("code",{children:Ne.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 配置。 保存到新绝对路径时会复制旧目录内容;旧目录不会自动删除。",Ne!=null&&Ne.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:Fe,onChange:oe=>Ze(oe.target.value),placeholder:"/data1/services/mengmai/agentflow/skills",autoComplete:"off",disabled:!!(Ne!=null&&Ne.skillsEnvLocked)||ot}),i.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:()=>void Qn(),"aria-label":"保存 AgentFlow Skills Root",disabled:ot||!!(Ne!=null&&Ne.skillsEnvLocked),children:i.jsx("span",{className:"material-symbols-outlined",children:ot?"hourglass_empty":"save"})})]}),i.jsxs("p",{className:"af-set-hint",children:["当前 Skills:",i.jsx("code",{children:(Ne==null?void 0:Ne.skillsRoot)||Fe||"-"}),Ne!=null&&Ne.legacySkillsRootExists?i.jsxs(i.Fragment,{children:[";保存时会补迁移旧目录 ",i.jsx("code",{children:Ne.legacySkillsRoot})," 中缺失的 skills。"]}):null]}),i.jsxs("p",{className:"af-set-hint",children:["SkillHub 新安装、更新和卸载都作用于 Skills Root;普通用户只通过 Workspace 的 Load Skills 使用。",Ne!=null&&Ne.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"+(Xt?" af-set-badge--ok":" af-set-badge--muted"),children:t(Xt?"settings:allowlist.enabled":"settings:allowlist.open")}),i.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void Vn(),disabled:Te,children:t(Te?"settings:allowlist.refreshing":"common:common.refresh")})]}),be?i.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:be}):null,_e?i.jsxs("p",{className:"af-set-hint af-set-hint--inline",children:[t("settings:allowlist.file"),":",i.jsx("code",{children:_e})]}):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:gt?t("settings:allowlist.saving"):t("settings:allowlist.userCount",{count:de.length})})]}),i.jsx("div",{className:"af-allowlist-list",children:de.length>0?de.map(oe=>i.jsxs("div",{className:"af-allowlist-row",children:[i.jsx("span",{className:"af-allowlist-name",children:oe}),i.jsx("button",{type:"button",className:"af-set-env-del",onClick:()=>ui(oe),"aria-label":t("settings:allowlist.remove",{username:oe}),disabled:gt,children:i.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})]},oe)):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:at,onChange:oe=>yt(oe.target.value),onKeyDown:oe=>{oe.key==="Enter"&&ci()},placeholder:"username",autoComplete:"off"}),i.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:ci,disabled:gt||!at.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:$e.length>0?$e.map(oe=>i.jsx("code",{children:oe},oe)):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:[e!=null&&e.isAdmin?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&&!k?"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"})})]}):null,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:xo,"aria-label":t("settings:language.description"),children:Cie.map(oe=>i.jsxs("option",{value:oe.code,children:[oe.flag," ",oe.name]},oe.code))}),i.jsx("p",{className:"af-set-hint",children:t("settings:language.description")})]})]})]})]})})]})})]})}function Tie(e){const t=Number(e||0);return!Number.isFinite(t)||t<=0?"-":new Intl.DateTimeFormat(void 0,{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(new Date(t))}function Mie(e){return e==="thinking"?"Thinking":e==="tool"?"工具":e==="error"?"错误":e==="result"?"结果":"过程"}function $ie(e){const t=String(e||"unknown");return t==="success"?"成功":t==="failed"?"失败":t==="running"?"运行中":t==="stopped"?"已停止":t==="interrupted"?"中断":t}function Lie({run:e,onClose:t}){const[n,r]=m.useState(null),[s,o]=m.useState(!1),[a,l]=m.useState(""),[c,u]=m.useState("timeline"),d=m.useCallback(async({quiet:v=!1}={})=>{if(e!=null&&e.runId){v||o(!0),l("");try{const w=new URLSearchParams({runType:e.runType||"pipeline",userId:e.userId||"",flowId:e.flowId||"",flowSource:e.flowSource||"user",runId:e.runId}),g=await fetch(`/api/admin/run-detail?${w.toString()}`),k=await g.json().catch(()=>({}));if(!g.ok)throw new Error(k.error||`HTTP ${g.status}`);r(k)}catch(w){l(String((w==null?void 0:w.message)||w))}finally{v||o(!1)}}},[e==null?void 0:e.flowId,e==null?void 0:e.flowSource,e==null?void 0:e.runId,e==null?void 0:e.runType,e==null?void 0:e.userId]);m.useEffect(()=>{r(null),u("timeline"),d()},[d]),m.useEffect(()=>{if((e==null?void 0:e.status)!=="running")return;const v=window.setInterval(()=>{document.hidden||d({quiet:!0})},5e3);return()=>window.clearInterval(v)},[d,e==null?void 0:e.status]);const f=Array.isArray(n==null?void 0:n.events)?n.events:[],p=m.useMemo(()=>f.filter(v=>(v==null?void 0:v.kind)==="thinking"),[f]),h=Array.isArray(n==null?void 0:n.rawLines)?n.rawLines:[],y=c==="thinking"?p:f;return i.jsx("div",{className:"af-admin-run-detail-overlay",role:"presentation",onMouseDown:t,children:i.jsxs("aside",{className:"af-admin-run-detail",role:"dialog","aria-modal":"true","aria-label":"Run 详情",onMouseDown:v=>v.stopPropagation(),children:[i.jsxs("header",{className:"af-admin-run-detail__head",children:[i.jsxs("div",{children:[i.jsxs("span",{className:"af-admin-run-detail__eyebrow",children:[e.runType==="workspace"?"Workspace Run":"Pipeline Run"," · ",$ie(e.status)]}),i.jsx("h2",{children:e.flowId||"Run 详情"}),i.jsxs("p",{children:[e.username||e.userId," · ",i.jsx("code",{children:e.runId})]})]}),i.jsxs("div",{className:"af-admin-run-detail__actions",children:[i.jsx("button",{type:"button",onClick:()=>void d(),disabled:s,title:"刷新详情",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"})}),i.jsx("button",{type:"button",onClick:t,title:"关闭",children:i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]})]}),i.jsxs("div",{className:"af-admin-run-detail__tabs",role:"tablist","aria-label":"Run 详情分类",children:[i.jsxs("button",{type:"button",className:c==="timeline"?"is-active":"",onClick:()=>u("timeline"),children:["过程 ",i.jsx("span",{children:f.length})]}),i.jsxs("button",{type:"button",className:c==="thinking"?"is-active":"",onClick:()=>u("thinking"),children:["Thinking ",i.jsx("span",{children:p.length})]}),i.jsxs("button",{type:"button",className:c==="raw"?"is-active":"",onClick:()=>u("raw"),children:["原始日志 ",i.jsx("span",{children:h.length})]})]}),n!=null&&n.truncated?i.jsx("div",{className:"af-admin-run-detail__notice",children:"日志较大,当前展示最新的 512 KB / 2000 条记录。"}):null,a?i.jsx("div",{className:"af-admin-run-detail__error",children:a}):null,s&&!n?i.jsx("div",{className:"af-admin-run-detail__empty",children:"正在读取 Run 详情..."}):null,i.jsx("div",{className:"af-admin-run-detail__body",children:c==="raw"?h.length>0?i.jsx("pre",{className:"af-admin-run-detail__raw",children:h.join(`
|
|
316
|
-
`)}):i.jsx("div",{className:"af-admin-run-detail__empty",children:"这个 Run 没有原始日志。"}):y.length>0?i.jsx("div",{className:"af-admin-run-detail__timeline",children:y.map((v,w)=>i.jsxs("article",{className:`af-admin-run-detail__event is-${v.kind||"process"}`,children:[i.jsxs("div",{className:"af-admin-run-detail__event-meta",children:[i.jsx("time",{children:Tie(v.ts)}),i.jsx("span",{className:`af-admin-run-detail__kind is-${v.kind||"process"}`,children:Mie(v.kind)}),i.jsx("span",{children:v.type||"event"}),v.nodeId?i.jsx("code",{children:v.nodeId}):null]}),i.jsx("pre",{children:v.text||"-"})]},v.id||`${v.ts||0}-${w}`))}):i.jsx("div",{className:"af-admin-run-detail__empty",children:c==="thinking"?"该模型或 CLI 没有为这个 Run 输出可记录的 Thinking。":"这个 Run 暂无过程事件。"})})]})})}function Ar(e){return new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(Math.max(0,Number(e||0)))}function Up(e){return`${Math.round(Math.max(0,Math.min(1,Number(e||0)))*100)}%`}function vw(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 Oie(e){const t=String(e||"");return t.includes("-")?t.slice(5):t}function Sw(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 Die(e){const t=String(e||"").trim();return t?t.length>18?t.slice(0,8)+"..."+t.slice(-6):t:"-"}function Fie(e){const t=String(e||"unknown");return t==="success"?"成功":t==="failed"?"失败":t==="running"?"运行中":t==="stopped"?"已停止":t==="interrupted"?"中断":"未知"}function zie({authUser:e}){const{navigate:t}=gs(),[n,r]=m.useState(null),[s,o]=m.useState(!1),[a,l]=m.useState(""),[c,u]=m.useState(null),[d,f]=m.useState(null),[p,h]=m.useState([]),[y,v]=m.useState(!1),[w,g]=m.useState(""),k=m.useCallback(async()=>{if(e!=null&&e.isAdmin){o(!0),l("");try{const A=await fetch("/api/admin/usage-dashboard"),L=await A.json().catch(()=>({}));if(!A.ok)throw new Error(typeof L.error=="string"?L.error:"HTTP "+A.status);r(L)}catch(A){r(null),l(String((A==null?void 0:A.message)||A))}finally{o(!1)}}},[e==null?void 0:e.isAdmin]),b=m.useCallback(async A=>{const L=String((A==null?void 0:A.userId)||"").trim();if(!(!(e!=null&&e.isAdmin)||!L)){f({userId:L,username:String((A==null?void 0:A.username)||L)}),h([]),g(""),v(!0);try{const D=new URLSearchParams({userId:L}),O=await fetch(`/api/admin/user-workspaces?${D.toString()}`),M=await O.json().catch(()=>({}));if(!O.ok)throw new Error(M.error||"读取用户 Workspace 失败");f(M.owner||{userId:L,username:String((A==null?void 0:A.username)||L)}),h(Array.isArray(M.workspaces)?M.workspaces:[])}catch(D){g(String(D.message||D))}finally{v(!1)}}},[e==null?void 0:e.isAdmin]),j=m.useCallback(A=>{const L=String((A==null?void 0:A.ownerUserId)||(d==null?void 0:d.userId)||"").trim(),D=String((A==null?void 0:A.id)||"").trim();if(!L||!D)return;const O=new URLSearchParams({flowId:D,flowSource:"user",adminOwnerId:L});A!=null&&A.archived&&O.set("archived","1"),t(`/workspace?${O.toString()}`)},[t,d==null?void 0:d.userId]);m.useEffect(()=>{k()},[k]);const N=Array.isArray(n==null?void 0:n.dailyTrend)?n.dailyTrend:[],C=m.useMemo(()=>{const D={top:20,right:24,bottom:42,left:42},O=980-D.left-D.right,M=250-D.top-D.bottom,K=N.length>0?N:[],z=Math.max(1,...K.map(V=>Number(V.runs||0))),F=Math.max(1,...K.flatMap(V=>[Number(V.users||0),Number(V.pipelines||0)])),$=V=>D.left+(K.length<=1?O/2:V*O/(K.length-1)),W=V=>D.top+M-Math.max(0,Number(V||0))/z*M,E=V=>D.top+M-Math.max(0,Number(V||0))/F*M,Q=V=>K.map((B,re)=>`${re===0?"M":"L"} ${$(re)} ${E(B[V])}`).join(" ");return{width:980,height:250,margin:D,innerHeight:M,rows:K,x:$,yRuns:W,yLine:E,lineUsers:Q("users"),linePipelines:Q("pipelines"),barWidth:Math.min(34,Math.max(12,O/Math.max(1,K.length)*.44))}},[N]),I=(n==null?void 0:n.usage)||{},R=(n==null?void 0:n.totals)||{},H=Array.isArray(n==null?void 0:n.recentRuns)?n.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 k(),disabled:s,children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),s?"刷新中":"刷新"]})]}),a?i.jsx("div",{className:"af-project-admin-usage__error",children:a}):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:Up(I.activeUserRate)}),i.jsxs("em",{children:[Ar(I.activeUsers)," / ",Ar(R.users)," users"]})]}),i.jsxs("div",{children:[i.jsx("span",{children:"7日流水线使用率"}),i.jsx("strong",{children:Up(I.activePipelineRate)}),i.jsxs("em",{children:[Ar(I.activePipelines)," / ",Ar(R.activePipelines)," active"]})]}),i.jsxs("div",{children:[i.jsx("span",{children:"7日 Run"}),i.jsx("strong",{children:Ar(I.runs)}),i.jsxs("em",{children:[Ar(I.avgRunsPerDay)," / day"]})]}),i.jsxs("div",{children:[i.jsx("span",{children:"7日成功率"}),i.jsx("strong",{children:Up(I.successRate)}),i.jsxs("em",{children:["失败率 ",Up(I.failureRate)," · avg ",vw(I.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 ${C.width} ${C.height}`,preserveAspectRatio:"xMidYMid meet",children:[i.jsx("line",{className:"af-admin-usage-chart__axis",x1:C.margin.left,y1:C.margin.top+C.innerHeight,x2:C.width-C.margin.right,y2:C.margin.top+C.innerHeight}),[.25,.5,.75,1].map(A=>i.jsx("line",{className:"af-admin-usage-chart__grid",x1:C.margin.left,y1:C.margin.top+C.innerHeight-C.innerHeight*A,x2:C.width-C.margin.right,y2:C.margin.top+C.innerHeight-C.innerHeight*A},A)),C.rows.map((A,L)=>{const D=C.x(L),O=C.yRuns(A.runs),M=C.margin.top+C.innerHeight,K=Math.max(2,M-O);return i.jsxs("g",{children:[i.jsx("rect",{className:"af-admin-usage-chart__run-bar",x:D-C.barWidth/2,y:M-K,width:C.barWidth,height:K,rx:"5",children:i.jsx("title",{children:`${A.date}: ${A.runs} runs`})}),i.jsx("text",{className:"af-admin-usage-chart__value",x:D,y:M+22,children:Ar(A.runs)}),i.jsx("text",{className:"af-admin-usage-chart__date",x:D,y:M+42,children:Oie(A.date)})]},A.date)}),C.rows.length>0?i.jsxs(i.Fragment,{children:[i.jsx("path",{className:"af-admin-usage-chart__line af-admin-usage-chart__line--users",d:C.lineUsers}),i.jsx("path",{className:"af-admin-usage-chart__line af-admin-usage-chart__line--pipelines",d:C.linePipelines}),C.rows.map((A,L)=>{const D=C.x(L);return i.jsxs("g",{children:[i.jsx("circle",{className:"af-admin-usage-chart__point af-admin-usage-chart__point--users",cx:D,cy:C.yLine(A.users),r:"3.5"}),i.jsx("circle",{className:"af-admin-usage-chart__point af-admin-usage-chart__point--pipelines",cx:D,cy:C.yLine(A.pipelines),r:"3.5"})]},`${A.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:H.length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:6,children:"暂无运行明细"})}):H.map(A=>i.jsxs("tr",{className:"af-admin-usage-run-row",role:"button",tabIndex:0,title:"查看 Run 过程与 Thinking",onClick:()=>u(A),onKeyDown:L=>{(L.key==="Enter"||L.key===" ")&&(L.preventDefault(),u(A))},children:[i.jsxs("td",{children:[i.jsx("strong",{children:A.username||A.userId||"-"}),i.jsx("span",{children:A.userId||"-"})]}),i.jsxs("td",{children:[i.jsx("strong",{children:A.flowId||"-"}),i.jsxs("span",{children:[A.runType==="workspace"?"Workspace Run":"Pipeline"," · ",A.flowSource||"user"]})]}),i.jsxs("td",{children:[i.jsx("strong",{children:Sw(A.at)}),A.endedAt?i.jsxs("span",{children:["结束 ",Sw(A.endedAt)]}):i.jsx("span",{children:"未结束"})]}),i.jsx("td",{children:i.jsx("span",{className:"af-project-admin-usage__chips",children:i.jsx("em",{children:Fie(A.status)})})}),i.jsx("td",{children:vw(A.durationMs)}),i.jsx("td",{children:i.jsxs("span",{className:"af-admin-usage-run-link",children:[i.jsx("code",{className:"af-admin-usage-run-id",title:A.runId,children:Die(A.runId)}),i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"})]})})]},`${A.userId}:${A.flowSource}:${A.flowId}:${A.runId}:${A.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("th",{children:"Workspace"})]})}),i.jsx("tbody",{children:s&&!n?i.jsx("tr",{children:i.jsx("td",{colSpan:6,children:"正在加载..."})}):((n==null?void 0:n.users)||[]).length===0?i.jsx("tr",{children:i.jsx("td",{colSpan:6,children:"暂无用户数据"})}):((n==null?void 0:n.users)||[]).map(A=>{var L,D,O,M,K,z,F,$,W,E,Q,V,B;return i.jsxs("tr",{children:[i.jsxs("td",{children:[i.jsx("strong",{children:A.username||A.userId}),i.jsxs("span",{children:[A.userId,A.isAdmin?" · admin":""]})]}),i.jsxs("td",{children:[i.jsx("strong",{children:Ar((L=A.pipelines)==null?void 0:L.total)}),i.jsxs("span",{children:[Ar((D=A.pipelines)==null?void 0:D.active)," active / ",Ar((O=A.pipelines)==null?void 0:O.archived)," archived"]})]}),i.jsxs("td",{children:[i.jsx("strong",{children:Ar((M=A.runs)==null?void 0:M.total)}),i.jsxs("span",{children:["avg ",vw((K=A.runs)==null?void 0:K.avgDurationMs)]})]}),i.jsx("td",{children:i.jsxs("span",{className:"af-project-admin-usage__chips",children:[i.jsxs("em",{children:["成功 ",Ar((z=A.runs)==null?void 0:z.success)]}),i.jsxs("em",{children:["失败 ",Ar((F=A.runs)==null?void 0:F.failed)]}),i.jsxs("em",{children:["运行中 ",Ar(($=A.runs)==null?void 0:$.running)]})]})}),i.jsx("td",{children:(W=A.runs)!=null&&W.lastRunAt?i.jsxs(i.Fragment,{children:[i.jsx("strong",{children:((E=A.runs)==null?void 0:E.lastRunFlowId)||"-"}),i.jsxs("span",{children:[((Q=A.runs)==null?void 0:Q.lastRunStatus)||"unknown"," · ",Sw(A.runs.lastRunAt)]})]}):i.jsx("span",{children:"无运行记录"})}),i.jsx("td",{children:i.jsxs("button",{type:"button",className:"af-admin-workspace-review-button",disabled:!((V=A.pipelines)!=null&&V.total)||y&&(d==null?void 0:d.userId)===A.userId,onClick:()=>void b(A),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"visibility"}),y&&(d==null?void 0:d.userId)===A.userId?"读取中":`查看 ${Ar((B=A.pipelines)==null?void 0:B.total)}`]})})]},A.userId)})})]})})]}),d?i.jsxs("section",{className:"af-project-admin-usage af-admin-user-workspaces",children:[i.jsxs("div",{className:"af-project-admin-usage__head",children:[i.jsxs("div",{children:[i.jsxs("strong",{children:[d.username||d.userId," 的 Workspace"]}),i.jsx("span",{children:"管理员审阅模式:只读查看,不会加入协作成员,也不能保存或运行。"})]}),i.jsx("button",{type:"button",onClick:()=>{f(null),h([]),g("")},children:"关闭"})]}),w?i.jsx("div",{className:"af-project-admin-usage__error",children:w}):null,i.jsx("div",{className:"af-admin-user-workspaces__grid",children:y?i.jsx("p",{children:"正在读取 Workspace..."}):p.length===0?i.jsx("p",{children:"该用户暂无 Workspace。"}):p.map(A=>i.jsxs("button",{type:"button",className:"af-admin-user-workspace-card",onClick:()=>j(A),children:[i.jsx("span",{className:"af-admin-user-workspace-card__icon material-symbols-outlined","aria-hidden":!0,children:A.archived?"inventory_2":"account_tree"}),i.jsxs("span",{className:"af-admin-user-workspace-card__content",children:[i.jsx("strong",{children:A.id}),i.jsx("small",{children:A.description||(A.archived?"已归档 Workspace":"用户 Workspace")})]}),i.jsx("span",{className:"af-admin-user-workspace-card__status",children:A.archived?"已归档":"只读打开"})]},`${A.id}:${A.archived?"archived":"active"}`))})]}):null,c?i.jsx(Lie,{run:c,onClose:()=>u(null)}):null]}):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 Bie(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 Hie({authUser:e}){const{navigate:t}=gs(),[n,r]=m.useState(""),[s,o]=m.useState(""),[a,l]=m.useState(!1),[c,u]=m.useState(""),[d,f]=m.useState(!1),[p,h]=m.useState([]),[y,v]=m.useState(!1),[w,g]=m.useState(""),k=!!(e!=null&&e.isAdmin),b=m.useCallback(async()=>{if(k){v(!0),g("");try{const N=await fetch("/api/feedback"),C=await N.json().catch(()=>({}));if(!N.ok)throw new Error(C.error||"加载失败");h(Array.isArray(C.feedback)?C.feedback:[])}catch(N){g(String(N.message||N)),h([])}finally{v(!1)}}},[k]);m.useEffect(()=>{b()},[b]);const j=async N=>{if(N.preventDefault(),!a){l(!0),u("");try{const C=await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:n,content:s,pageUrl:window.location.href})}),I=await C.json().catch(()=>({}));if(!C.ok)throw new Error(I.error||"提交失败");f(!0),r(""),o("")}catch(C){u(String(C.message||C))}finally{l(!1)}}};return k?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 b(),disabled:y,children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:y?"hourglass_empty":"refresh"}),y?"刷新中...":"刷新"]}),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"}),"返回"]})]})]}),w?i.jsx("p",{className:"af-err af-feedback-error",children:w}):null,i.jsx("div",{className:"af-feedback-list af-feedback-list--page",children:p.length>0?p.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:Bie(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:y?"正在加载反馈...":"暂无反馈"})})]})}):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:j,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 BM(){return`m_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function j_(e,t=[]){const n=new Set((Array.isArray(t)?t:[]).map(String));return Object.entries(e&&typeof e=="object"?e:{}).map(([r,s])=>({id:BM(),key:r,value:String(s??""),private:n.has(r)}))}function N_(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 vh(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(`
|
|
317
|
-
`),description:String((e==null?void 0:e.description)||t.description||""),envRows:j_(t.env||(e==null?void 0:e.env),e==null?void 0:e.privateEnvKeys),headerRows:j_(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 jw(){return vh({name:"",raw:{command:""}})}function Wie(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=N_(e.envRows),s=N_(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 C_(e){return e?e.ok?`${e.toolCount||0} tools enabled`:`Error - ${e.error||"Show Output"}`:"未检测"}function __(e){return e?e.ok?"ok":"error":"unknown"}function Ab(e){return e==="ok"?"ok":e==="partial"?"partial":e==="unsupported"?"error":"unknown"}function Vie(e,t){return e&&e.label||t}async function Nw(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 Ev(e){return String(e||"").trim()||"<AGENTFLOW_TOKEN>"}function HM({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:Ev(t)}}}},null,2)}function WM({baseUrl:e="",token:t=""}){const n=JSON.stringify(String(e||"http://127.0.0.1:8875")),r=JSON.stringify(Ev(t));return["[mcp_servers.agentflow]",'command = "agentflow"','args = ["mcp"]',"","[mcp_servers.agentflow.env]",`AGENTFLOW_BASE_URL = ${n}`,`AGENTFLOW_TOKEN = ${r}`].join(`
|
|
318
|
-
`)}function Kie({baseUrl:e="",token:t=""}){const n=String(e||"http://127.0.0.1:8875"),r=HM({baseUrl:n,token:t}),s=WM({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: ${Ev(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(`
|
|
319
|
-
`)}function qie({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--${Ab(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:Vie(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 E_({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:BM(),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 Uie(){var ue;const[e,t]=m.useState(""),[n,r]=m.useState([]),[s,o]=m.useState(jw),[a,l]=m.useState(""),[c,u]=m.useState(!1),[d,f]=m.useState(!1),[p,h]=m.useState(!1),[y,v]=m.useState({}),[w,g]=m.useState(""),[k,b]=m.useState(""),[j,N]=m.useState(()=>{var G;return typeof window<"u"&&((G=window.location)!=null&&G.origin)?window.location.origin:"http://127.0.0.1:8875"}),[C,I]=m.useState(""),[R,H]=m.useState(""),A=m.useMemo(()=>n.find(G=>G.name===a)||null,[a,n]),L=A&&y[A.name]||null,D=m.useMemo(()=>HM({baseUrl:j,token:C}),[j,C]),O=m.useMemo(()=>WM({baseUrl:j,token:C}),[j,C]),M=m.useMemo(()=>Kie({baseUrl:j,token:C}),[j,C]),K=m.useCallback(async()=>{u(!0),g("");try{const G=await fetch("/api/mcps"),ee=await G.json().catch(()=>({}));if(!G.ok)throw new Error(ee.error||"MCP HTTP "+G.status);const te=Array.isArray(ee.servers)?ee.servers:[];t(String(ee.path||"")),r(te),a&&te.some(ne=>ne.name===a)&&o(vh(te.find(ne=>ne.name===a)))}catch(G){g(String(G.message||G))}finally{u(!1)}},[a]);m.useEffect(()=>{K()},[K]);const z=()=>{l(""),o(jw()),b(""),g("")},F=G=>{l(G.name),o(vh(G)),b(""),g("")},$=m.useCallback(async()=>{if(!M)return;const G=await Nw(M);H(G?"prompt":"copy-failed"),window.setTimeout(()=>H(""),1200)},[M]),W=m.useCallback(async()=>{const G=await Nw(D);H(G?"cursor":"copy-failed"),window.setTimeout(()=>H(""),1200)},[D]),E=m.useCallback(async()=>{const G=await Nw(O);H(G?"codex":"copy-failed"),window.setTimeout(()=>H(""),1200)},[O]),Q=m.useCallback(async()=>{try{const G=await fetch("/api/auth/session-token"),ee=await G.json().catch(()=>({}));if(!G.ok)throw new Error(typeof ee.error=="string"?ee.error:"HTTP "+G.status);I(String(ee.token||"")),H("token"),window.setTimeout(()=>H(""),1200)}catch(G){H(""),g(String(G.message||G))}},[]),V=async(G="")=>{h(!0),g(""),b("");try{const ee=await fetch("/api/mcps/check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(G?{name:G}:{})}),te=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(te.error||"检测 MCP 失败");const ne=Array.isArray(te.results)?te.results:[];v(Z=>{const ce={...Z};for(const de of ne)de!=null&&de.name&&(ce[de.name]=de);return ce}),b(G?`已检测 ${G}。`:"已检测所有 MCP。")}catch(ee){g(String(ee.message||ee))}finally{h(!1)}},B=async()=>{f(!0),g(""),b("");try{const G=Wie(s);if(!G.nextName)throw new Error("请填写 MCP 名称");const ee=await fetch("/api/mcps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(G)}),te=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(te.error||"保存 MCP 失败");const ne=Array.isArray(te.servers)?te.servers:[];r(ne),t(String(te.path||e)),l(G.nextName),o(vh(ne.find(Z=>Z.name===G.nextName)||null)),v(Z=>{const ce={...Z};return s.originalName&&s.originalName!==G.nextName&&delete ce[s.originalName],delete ce[G.nextName],ce}),b("已保存。Cursor CLI 下次启动时会读取新配置。")}catch(G){g(String(G.message||G))}finally{f(!1)}},re=async G=>{if(G!=null&&G.name&&window.confirm(`删除 MCP "${G.name}"?`)){f(!0),g(""),b("");try{const ee=await fetch("/api/mcps/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:G.name})}),te=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(te.error||"删除 MCP 失败");r(Array.isArray(te.servers)?te.servers:[]),l(""),o(jw()),v(ne=>{const Z={...ne};return delete Z[G.name],Z}),b("已删除。")}catch(ee){g(String(ee.message||ee))}finally{f(!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:K,disabled:c||d,children:"刷新"}),i.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>V(),disabled:p||c||d||n.length===0,children:p?"检测中...":"检测状态"}),i.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:z,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:j,onChange:G=>N(G.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:C,onChange:G=>I(G.target.value),placeholder:"<AGENTFLOW_TOKEN>"}),i.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:Q,children:R==="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:W,children:R==="cursor"?"已复制":R==="copy-failed"?"复制失败":"复制"})]}),i.jsx("pre",{className:"af-set-mcp-code",children:D})]}),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:R==="codex"?"已复制":R==="copy-failed"?"复制失败":"复制"})]}),i.jsx("pre",{className:"af-set-mcp-code",children:O})]})]}),i.jsx("div",{className:"af-set-mcp-copy-row",children:i.jsxs("button",{type:"button",className:"af-set-footer-primary",onClick:$,children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"content_copy"}),R==="prompt"?"已复制 Prompt":R==="copy-failed"?"复制失败":"复制 AI 配置 Prompt"]})}),R==="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:z,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:z,disabled:d,children:"新增 MCP Server"})]}):null,i.jsx("div",{className:"af-mcp-server-list",children:n.map(G=>{var ee,te,ne,Z;return i.jsxs("button",{type:"button",className:"af-mcp-server-item"+(a===G.name?" af-mcp-server-item--active":""),onClick:()=>F(G),children:[i.jsx("span",{className:"material-symbols-outlined",children:G.type==="url"?"cloud":"terminal"}),i.jsxs("span",{children:[i.jsxs("span",{className:"af-mcp-server-title",children:[i.jsx("strong",{children:G.name}),i.jsx("small",{className:`af-mcp-server-health af-mcp-server-health--${__(y[G.name])}`,children:C_(y[G.name])})]}),i.jsxs("span",{className:"af-mcp-server-backends",children:[i.jsx("small",{className:`af-mcp-backend-pill af-mcp-backend-pill--${Ab((te=(ee=G.backends)==null?void 0:ee.cursor)==null?void 0:te.status)}`,children:"Cursor"}),i.jsx("small",{className:`af-mcp-backend-pill af-mcp-backend-pill--${Ab((Z=(ne=G.backends)==null?void 0:ne.codex)==null?void 0:Z.status)}`,children:"Codex"})]}),i.jsx("em",{children:G.url||[G.command,...G.args||[]].filter(Boolean).join(" ")})]})]},G.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:A?"编辑 MCP":"新增 MCP"}),i.jsx("p",{className:"af-set-p af-set-p--tight",children:"保存后会写入 Cursor MCP 配置。已运行的 agent 进程不会热更新,下一次启动会读取新配置。"})]}),A?i.jsxs("div",{className:"af-mcp-editor-actions",children:[i.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>V(A.name),disabled:p||d,children:p?"检测中...":"检测"}),i.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>re(A),disabled:d,children:"删除"})]}):null]}),w?i.jsx("p",{className:"af-mcp-error",children:w}):null,k?i.jsx("p",{className:"af-mcp-status",children:k}):null,A?i.jsx(qie,{server:A}):null,L?i.jsxs("div",{className:`af-mcp-check af-mcp-check--${__(L)}`,children:[i.jsxs("div",{className:"af-mcp-check-head",children:[i.jsx("strong",{children:C_(L)}),i.jsxs("span",{children:[L.elapsedMs||0,"ms"]})]}),L.error?i.jsx("p",{children:L.error}):null,(ue=L.tools)!=null&&ue.length?i.jsx("div",{className:"af-mcp-tools-list",children:L.tools.map(G=>i.jsxs("div",{className:"af-mcp-tool-row",children:[i.jsx("strong",{children:G.name}),G.description?i.jsx("span",{children:G.description}):null]},G.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:G=>o(ee=>({...ee,name:G.target.value})),placeholder:"github"})]}),i.jsxs("label",{className:"af-set-label",children:["类型",i.jsxs("select",{className:"af-set-input",value:s.type,onChange:G=>o(ee=>({...ee,type:G.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:G=>o(ee=>({...ee,url:G.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:G=>o(ee=>({...ee,command:G.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:G=>o(ee=>({...ee,argsText:G.target.value})),placeholder:`mcp-server-example
|
|
320
|
-
--flag`})]})]}),i.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["描述",i.jsx("input",{className:"af-set-input",value:s.description,onChange:G=>o(ee=>({...ee,description:G.target.value})),placeholder:"这个 MCP 提供什么能力"})]}),i.jsx(E_,{title:"Headers",rows:s.headerRows,onChange:G=>o(ee=>({...ee,headerRows:G})),placeholderKey:"Authorization",placeholderValue:"Bearer ..."}),i.jsx(E_,{title:"Env",rows:s.envRows,onChange:G=>o(ee=>({...ee,envRows:G})),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:G=>o(ee=>({...ee,extraJson:G.target.value}))})]})]}),i.jsxs("div",{className:"af-mcp-actions",children:[i.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:z,disabled:d,children:"清空"}),i.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:B,disabled:d,children:d?"保存中...":"保存 MCP"})]})]})]})]})})]})}function Yie(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 A_(e={}){return(e==null?void 0:e.kind)==="workspace"&&String((e==null?void 0:e.scheduleNodeId)||"").trim()?"打开节点":"打开项目"}function P_(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 Gie(e){return(e==null?void 0:e.kind)==="workspace"?"Workspace":"Pipeline"}function Jie(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 Xie(){const{navigate:e}=gs(),[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 p=await fetch("/api/schedules"),h=await p.json().catch(()=>({}));if(!p.ok)throw new Error(h.error||"读取定时任务失败");n(Array.isArray(h.schedules)?h.schedules:[])}catch(p){a(String(p.message||p)),n([])}finally{s(!1)}},[]);m.useEffect(()=>{u()},[u]);const d=m.useCallback(async p=>{const h=`${p.kind}:${p.flowSource||"user"}:${p.flowId||""}:${p.scheduleNodeId||""}`;c(h),a("");try{const y=await fetch("/api/schedule/toggle",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:p.kind,flowId:p.flowId,flowSource:p.flowSource||"user",scheduleNodeId:p.scheduleNodeId||"",enabled:!p.enabled})}),v=await y.json().catch(()=>({}));if(!y.ok||v.success===!1)throw new Error(v.error||"更新定时任务失败");await u()}catch(y){a(String(y.message||y))}finally{c("")}},[u]),f=m.useMemo(()=>{const p=t.filter(y=>y.enabled).length,h=t.filter(y=>y.kind==="workspace").length;return{total:t.length,enabled:p,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:f.total})]}),i.jsxs("div",{children:[i.jsx("span",{children:"启用中"}),i.jsx("strong",{children:f.enabled})]}),i.jsxs("div",{children:[i.jsx("span",{children:"Workspace"}),i.jsx("strong",{children:f.workspace})]}),i.jsxs("div",{children:[i.jsx("span",{children:"Pipeline"}),i.jsx("strong",{children:f.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(p=>{const h=`${p.kind}:${p.flowSource||"user"}:${p.flowId||""}:${p.scheduleNodeId||""}`,y=l===h,v=Yie(p);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:p.label||p.flowId||"-"}),i.jsx("span",{className:`af-schedule-badge af-schedule-badge--${p.kind||"pipeline"}`,children:Gie(p)}),i.jsx("span",{className:`af-schedule-state ${p.enabled?"af-schedule-state--on":"af-schedule-state--off"}`,children:Jie(p)})]}),i.jsxs("div",{className:"af-schedule-card__meta",children:[i.jsx("span",{children:p.flowId||"-"}),i.jsx("span",{children:p.flowSource||"user"}),p.scheduleNodeId?i.jsx("span",{children:p.scheduleNodeId}):null]}),i.jsxs("div",{className:"af-schedule-card__grid",children:[i.jsxs("div",{children:[i.jsx("span",{children:"Cron"}),i.jsx("strong",{children:p.cron||"-"})]}),i.jsxs("div",{children:[i.jsx("span",{children:"时区"}),i.jsx("strong",{children:p.timezone||"Asia/Shanghai"})]}),i.jsxs("div",{children:[i.jsx("span",{children:"下次执行"}),i.jsx("strong",{children:P_(p.nextRunAt)})]}),i.jsxs("div",{children:[i.jsx("span",{children:"最近执行"}),i.jsx("strong",{children:P_(p.lastTriggeredAt)})]})]}),p.lastError?i.jsx("p",{className:"af-schedule-card__error",children:p.lastError}):null]}),i.jsxs("div",{className:"af-schedule-card__actions",children:[v?i.jsxs("button",{type:"button",className:"af-schedule-open",title:A_(p),onClick:()=>e(v),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"}),A_(p)]}):null,i.jsxs("button",{type:"button",className:p.enabled?"af-schedule-toggle af-schedule-toggle--on":"af-schedule-toggle af-schedule-toggle--off",disabled:y,"aria-pressed":p.enabled,title:p.enabled?"点击停用":"点击启用",onClick:()=>void d(p),children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:y?"hourglass_empty":p.enabled?"toggle_on":"toggle_off"}),p.enabled?"已启用":"已停用"]})]})]},h)})})]})})]})}const I_={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 R_(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 Qie(e){var c,u,d,f,p,h,y,v,w,g,k,b;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=(f=e==null?void 0:e.test)!=null&&f.inputs&&typeof e.test.inputs=="object"?e.test.inputs:{};return[{id:"contract",label:"Contract",icon:"account_tree",rows:[...r.map(j=>[`input.${j.name||"-"}`,`${j.type||"text"}${j.required?" · required":""}${j.default?` · default: ${j.default}`:""}`]),...s.map(j=>[`output.${j.name||"-"}`,j.type||"text"]),...o.map(j=>[`config.${j.key||"-"}`,j.type||"text"])]},{id:"runtime",label:"Runtime",icon:"terminal",rows:[["runtime.type",((p=t.runtime)==null?void 0:p.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",((v=(y=t.ui)==null?void 0:y.card)==null?void 0:v.variant)||"default"],["card.icon",((g=(w=t.ui)==null?void 0:w.card)==null?void 0:g.icon)||"extension"],...a.map(j=>[`action.${j.id||j.label||"-"}`,j.variant||j.label||"secondary"])]},{id:"tests",label:"Tests",icon:"science",rows:[...Object.entries(l).map(([j,N])=>[`sample.${j}`,String(N)]),["last run",`${((k=e==null?void 0:e.test)==null?void 0:k.status)||"not run"}${(b=e==null?void 0:e.test)!=null&&b.durationMs?` · ${e.test.durationMs}ms`:""}`]]}]}function Zie(){var O,M,K,z,F,$,W;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,f]=m.useState(!1),[p,h]=m.useState(""),y=e||I_,v=m.useMemo(()=>Qie(y),[y]),w=m.useMemo(()=>v.find(E=>E.id===n)||v[1],[n,v]),g=(y==null?void 0:y.manifest)||{},k=(y==null?void 0:y.config)||{},b=((O=y==null?void 0:y.test)==null?void 0:O.inputs)||{},j=Array.isArray((M=y==null?void 0:y.test)==null?void 0:M.log)?y.test.log:[],N=((z=(K=g.ui)==null?void 0:K.card)==null?void 0:z.icon)||"event_repeat",C=(($=(F=g.ui)==null?void 0:F.card)==null?void 0:$.variant)||"default",I=k.enabled===!0,R=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 B=Array.isArray(V.drafts)?V.drafts[0]:null;if(!(B!=null&&B.id)){t(null),h("");return}const re=await fetch(`/api/node-studio/draft?id=${encodeURIComponent(B.id)}`),ue=await re.json().catch(()=>({}));if(!re.ok)throw new Error(ue.error||"读取节点草稿失败");t(ue.draft||null),h(String(((E=ue.draft)==null?void 0:E.promptDraft)||""))}catch(Q){u(String(Q.message||Q))}finally{l(!1)}},[]);m.useEffect(()=>{R()},[R]);const H=m.useCallback(async(E={})=>{var Q;f(!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})}),B=await V.json().catch(()=>({}));if(!V.ok||B.ok===!1)throw new Error(B.error||"保存节点草稿失败");t(B.draft||e),h(String(((Q=B.draft||e)==null?void 0:Q.promptDraft)||""))}catch(V){u(String(V.message||V))}finally{f(!1)}},[e]),A=()=>{o(!0),window.setTimeout(()=>o(!1),900)},L=E=>{const Q={...k,enabled:E};t(V=>({...V||I_,config:Q})),H({config:{enabled:E}})},D=()=>{H({promptDraft:p,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 R(),disabled:a,children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"visibility"}),a?"Loading":"Preview"]}),i.jsxs("button",{type:"button",onClick:A,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(y==null?void 0:y.agentMessages)?y.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:p,onChange:E=>h(E.target.value)})]}),i.jsxs("button",{type:"button",className:"af-node-studio-send",onClick:D,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?C==="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:y.title||g.name||"Untitled Node"}),i.jsx("code",{children:R_(y)})]}),i.jsxs("label",{className:"af-node-preview-toggle",children:[i.jsx("input",{type:"checkbox",checked:I,onChange:E=>L(E.target.checked)}),i.jsx("span",{children:I?"定时开启":"定时关闭"})]}),i.jsxs("div",{className:"af-node-preview-fields",children:[i.jsxs("label",{children:[i.jsx("span",{children:"频率"}),i.jsxs("select",{value:k.scheduleType||"daily",onChange:E=>H({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:k.hour||"09",onChange:E=>H({config:{hour:E.target.value}}),children:[i.jsx("option",{children:"09"}),i.jsx("option",{children:"10"})]}),i.jsxs("select",{value:k.minute||"00",onChange:E=>H({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:[k.scheduleType==="weekly"?"每周":"每天"," ",k.hour||"09",":",k.minute||"00"]}),i.jsx("span",{children:"Next -"}),i.jsx("span",{children:I?"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:y.title||g.name||"Untitled Node"}),i.jsx("code",{children:R_(y)})]}),i.jsxs("div",{className:"af-node-preview-default-body",children:[i.jsx("p",{children:g.description||"这个节点还没有描述。AI 生成 runtime、prompt 或 script 后,内部信息会显示在右侧。"}),i.jsxs("div",{children:[i.jsxs("span",{children:[Array.isArray(g.inputs)?g.inputs.length:0," inputs"]}),i.jsxs("span",{children:[Array.isArray(g.outputs)?g.outputs.length:0," outputs"]}),i.jsx("span",{children:((W=g.runtime)==null?void 0:W.type)||g.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:A,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:b.project||"",readOnly:!0,placeholder:"-"})]}),i.jsxs("label",{children:[i.jsx("span",{children:"date"}),i.jsx("input",{value:b.date||"",readOnly:!0,placeholder:"-"})]})]}),i.jsx("div",{className:"af-node-studio-log",children:(s?["running..."]:j.length?j:["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:v.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:w.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:w.id==="ui"?JSON.stringify(g.ui||{},null,2):w.id==="contract"?JSON.stringify({inputs:g.inputs||[],outputs:g.outputs||[],configSchema:g.configSchema||{}},null,2):w.id==="tests"?JSON.stringify((y==null?void 0:y.test)||{},null,2):JSON.stringify({runtime:g.runtime||{},files:(y==null?void 0:y.files)||{}},null,2)})]})]})]})}function eoe(){return`ws_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function toe(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 noe(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 Cw(){return{id:"",label:"",kind:"git",path:"",repoUrl:"",branch:"master",mountPath:"",credentialRef:"",type:"code",description:"",enabled:!0}}function Yp(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 roe(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 Ui(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 soe({ok:e}){return i.jsx("span",{className:"af-workspaces-dot"+(e?" af-workspaces-dot--ok":""),"aria-hidden":!0})}function T_({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(soe,{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 ioe(){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,f]=m.useState(""),[p,h]=m.useState([]),[y,v]=m.useState([]),[w,g]=m.useState(Cw),[k,b]=m.useState(""),[j,N]=m.useState([]),[C,I]=m.useState(""),R=m.useMemo(()=>y.findIndex((V,B)=>Ui(V,B)===C),[y,C]),A=!!m.useMemo(()=>p.find((V,B)=>Ui(V,B)===C)||null,[p,C]),L=m.useMemo(()=>{const V=String(w.credentialRef||"").trim();return V?j.some(B=>String((B==null?void 0:B.key)||"").trim()===V&&String((B==null?void 0:B.value)??"")!==""):!1},[w.credentialRef,j]),D=m.useCallback(async()=>{t(!0),l("");try{const[V,B]=await Promise.all([fetch("/api/workspaces"),fetch("/api/user-env")]),re=await V.json().catch(()=>({})),ue=await B.json().catch(()=>({}));if(!B.ok)throw new Error(typeof ue.error=="string"?ue.error:"ENV HTTP "+B.status);if(!V.ok)throw new Error(typeof re.error=="string"?re.error:"HTTP "+V.status);const G=Array.isArray(re.workspaces)?re.workspaces:[],ee=Array.isArray(re.customWorkspaces)?re.customWorkspaces:[];f(String(re.path||"")),h(G.filter(te=>te==null?void 0:te.builtin)),v(ee),N(Array.isArray(ue.env)?ue.env.map(te=>({key:String((te==null?void 0:te.key)||""),value:String((te==null?void 0:te.value)??"")})):[])}catch(V){l(String(V.message||V))}finally{t(!1)}},[]);m.useEffect(()=>{D()},[D]);const O=m.useCallback(async(V,B="")=>{r(!0),l(""),u("");try{const re=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaces:V})}),ue=await re.json().catch(()=>({}));if(!re.ok)throw new Error(typeof ue.error=="string"?ue.error:"HTTP "+re.status);const G=Array.isArray(ue.customWorkspaces)?ue.customWorkspaces:V;v(G),h((Array.isArray(ue.workspaces)?ue.workspaces:[]).filter(ee=>ee==null?void 0:ee.builtin)),f(String(ue.path||d)),B&&I(B),u("已保存")}catch(re){l(String(re.message||re))}finally{r(!1)}},[d]),M=m.useCallback(()=>{I(""),g(Cw()),b(""),u(""),l("")},[]),K=m.useCallback((V,B)=>{I(Ui(V,B)),g(Yp(V)),b(""),u("")},[]),z=m.useCallback((V,B)=>{I(Ui(V,B)),g(Yp(V)),b(""),u("")},[]),F=m.useCallback(async(V,B)=>{const re=String(V||"").trim(),ue=String(B??"");if(!re||!ue)return;const G=j.filter(ne=>String((ne==null?void 0:ne.key)||"").trim()!==re);G.push({key:re,value:ue});const ee=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:G})}),te=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(typeof te.error=="string"?te.error:"ENV HTTP "+ee.status);N(Array.isArray(te.env)?te.env.map(ne=>({key:String((ne==null?void 0:ne.key)||""),value:String((ne==null?void 0:ne.value)??"")})):G)},[j]),$=m.useCallback(()=>{const V=roe({...w,id:w.id||eoe()}),B=k.trim();if(V.kind==="git"&&B&&!V.credentialRef&&(V.credentialRef=noe(w,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&&!toe(V.credentialRef)){l("凭证环境变量只能使用字母、数字和下划线,且不能以数字开头");return}const re=R>=0?y.map((ue,G)=>G===R?V:ue):[V,...y];g(Yp(V)),(async()=>{r(!0);try{B&&await F(V.credentialRef,B),b(""),await O(re,Ui(V))}catch(ue){l(String(ue.message||ue)),r(!1)}})()},[y,w,O,F,R,k]),W=m.useCallback(()=>{if(R<0)return;const V=y.filter((B,re)=>re!==R);g(Cw()),I(""),O(V)},[y,O,R]),E=m.useCallback(async()=>{if(!A){if(R<0||!w.id){l("请先保存知识库配置,再拉取更新");return}if(w.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:w.id})}),B=await V.json().catch(()=>({}));if(!V.ok)throw new Error(typeof B.error=="string"?B.error:"HTTP "+V.status);const re=Array.isArray(B.customWorkspaces)?B.customWorkspaces:y;v(re),h((Array.isArray(B.workspaces)?B.workspaces:[]).filter(ee=>ee==null?void 0:ee.builtin));const ue=re.find(ee=>String((ee==null?void 0:ee.id)||"")===String(w.id||""));ue&&g(Yp(ue));const G=String(B.commit||"").trim();u(B.changed?`已拉取更新${G?`:${G.slice(0,8)}`:""}`:`已是最新${G?`:${G.slice(0,8)}`:""}`)}catch(V){l(String(V.message||V))}finally{o(!1)}}},[y,w,A,R]),Q=m.useCallback(V=>{g(B=>({...B,...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:D,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:p.length})]}),i.jsxs("div",{children:[i.jsx("span",{children:"自定义"}),i.jsx("strong",{children:y.length})]}),i.jsxs("div",{children:[i.jsx("span",{children:"Git"}),i.jsx("strong",{children:y.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"}),"新增"]})]}),y.length?y.map((V,B)=>i.jsx(T_,{item:V,selected:Ui(V,B)===C,onClick:()=>K(V,B)},Ui(V,B))):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:"内置知识库"})}),p.map((V,B)=>i.jsx(T_,{item:V,selected:Ui(V,B)===C,onClick:()=>z(V,B),readOnly:!0},Ui(V,B)))]}),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:A?"查看内置知识库":R>=0?"编辑知识库":"新增知识库"}),i.jsx("p",{children:A?"内置项由当前运行环境提供,不能在这里修改。":"本地路径用于读取上下文,Git 字段用于后续同步和上下文挂载。"})]}),i.jsxs("label",{className:"af-workspaces-switch",children:[i.jsx("input",{type:"checkbox",checked:w.enabled!==!1,disabled:A,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:w.kind==="git"?"active":"",disabled:A,onClick:()=>Q({kind:"git",type:w.type==="local"?"code":w.type}),children:[i.jsx("span",{className:"material-symbols-outlined",children:"account_tree"}),"Git"]}),i.jsxs("button",{type:"button",className:w.kind==="local"?"active":"",disabled:A,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:w.label,disabled:A,onChange:V=>Q({label:V.target.value}),placeholder:"Likee Android"})]}),i.jsxs("label",{children:[i.jsx("span",{children:"类型"}),i.jsxs("select",{value:w.type,disabled:A,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:w.path,disabled:A,onChange:V=>Q({path:V.target.value}),placeholder:w.kind==="git"?"可空,默认保存到全局资源目录/repos/<仓库名>":"/Users/.../project"})]}),w.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:w.repoUrl,disabled:A,onChange:V=>{const B=V.target.value,re=Sh(w.repoUrl),ue=String(w.mountPath||"").trim();Q({repoUrl:B,...!ue||ue===re?{mountPath:Sh(B)}:{}})},placeholder:"https://git.example.com/group/repo.git"})]}),i.jsxs("label",{children:[i.jsx("span",{children:"分支"}),i.jsx("input",{value:w.branch,disabled:A,onChange:V=>Q({branch:V.target.value}),placeholder:"master"})]}),i.jsxs("label",{children:[i.jsx("span",{children:"挂载目录"}),i.jsx("input",{value:w.mountPath,disabled:A,onChange:V=>Q({mountPath:V.target.value}),placeholder:Sh(w.repoUrl)||"repo_name"})]}),i.jsxs("label",{className:"af-workspaces-form__wide",children:[i.jsx("span",{children:"凭证环境变量"}),i.jsx("input",{value:w.credentialRef,disabled:A,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:k,disabled:A,onChange:V=>b(V.target.value),placeholder:L?"已在个人环境变量中配置;留空则不修改":"保存到个人环境变量,不写入 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:w.description,disabled:A,onChange:V=>Q({description:V.target.value}),placeholder:"这个知识库包含哪些代码、文档或需求上下文"})]})]}),i.jsxs("div",{className:"af-workspaces-actions",children:[!A&&R>=0?i.jsxs("button",{type:"button",className:"af-workspaces-danger",onClick:W,disabled:n||s,children:[i.jsx("span",{className:"material-symbols-outlined",children:"delete"}),"删除"]}):i.jsx("span",{}),i.jsxs("div",{children:[w.kind==="git"&&R>=0?i.jsxs("button",{type:"button",onClick:E,disabled:A||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:$,disabled:A||n||s,children:[i.jsx("span",{className:"material-symbols-outlined",children:"save"}),n?"保存中":"保存"]})]})]})]})]})]})})]})}function ooe(e){const t=Date.parse(String(e||""));return Number.isFinite(t)?new Date(t).toLocaleString([],{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"-"}function aoe(e){return e==="owner"?"我创建的":e==="editor"?"协作编辑":e==="viewer"?"只读协作":"可访问"}function loe(e){return e==="completed"?"已完成":e==="blocked"?"需关注":"进行中"}function coe(e){const t=String(e||"").toLowerCase();return t==="android"?"Android":t==="ios"?"iOS":["all","both","cross-platform","cross_platform"].includes(t)?"双端":e||""}function uoe(e){return`/workspace?${new URLSearchParams({view:"workflow",tapdId:String((e==null?void 0:e.tapdId)||"")}).toString()}`}function doe(){const{navigate:e}=gs(),[t,n]=m.useState([]),[r,s]=m.useState(!1),[o,a]=m.useState(""),[l,c]=m.useState(""),[u,d]=m.useState("all"),[f,p]=m.useState("all"),h=m.useCallback(async()=>{s(!0),a("");try{const w=await fetch("/api/prd-workflows"),g=await w.json().catch(()=>({}));if(!w.ok)throw new Error(g.error||"读取迭代列表失败");n(Array.isArray(g.workflows)?g.workflows:[])}catch(w){a(String(w.message||w)),n([])}finally{s(!1)}},[]);m.useEffect(()=>{h()},[h]);const y=m.useMemo(()=>({total:t.length,owned:t.filter(w=>w.role==="owner").length,collaborating:t.filter(w=>w.role!=="owner").length,attention:t.filter(w=>w.state==="blocked").length}),[t]),v=m.useMemo(()=>{const w=l.trim().toLowerCase();return t.filter(g=>{var k;return u==="owned"&&g.role!=="owner"||u==="collaborating"&&g.role==="owner"||f!=="all"&&g.state!==f?!1:w?[g.tapdId,g.title,g.pointer,g.phase,g.ownerUsername,(k=g.latestAction)==null?void 0:k.title].some(b=>String(b||"").toLowerCase().includes(w)):!0})},[l,u,f,t]);return i.jsxs("div",{className:"af-settings-page af-workflows-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 h(),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 af-workflows-inner",children:[i.jsx("section",{className:"af-settings-hero af-workflows-hero",children:i.jsxs("div",{children:[i.jsx("span",{className:"af-workflows-eyebrow",children:"Workflow Dashboard"}),i.jsx("h1",{className:"af-settings-h1",children:"迭代"}),i.jsx("p",{className:"af-settings-lead",children:"集中查看我创建和参与的需求 Workflow,追踪阶段、Action 进度与最新动态。"})]})}),i.jsxs("div",{className:"af-workflows-summary","aria-label":"迭代汇总",children:[i.jsxs("div",{children:[i.jsx("span",{children:"全部迭代"}),i.jsx("strong",{children:y.total})]}),i.jsxs("div",{children:[i.jsx("span",{children:"我创建的"}),i.jsx("strong",{children:y.owned})]}),i.jsxs("div",{children:[i.jsx("span",{children:"参与协作"}),i.jsx("strong",{children:y.collaborating})]}),i.jsxs("div",{className:y.attention?"is-attention":"",children:[i.jsx("span",{children:"需关注"}),i.jsx("strong",{children:y.attention})]})]}),i.jsxs("section",{className:"af-workflows-toolbar","aria-label":"迭代筛选",children:[i.jsxs("label",{className:"af-workflows-search",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),i.jsx("input",{value:l,onChange:w=>c(w.target.value),placeholder:"搜索 TAPD、需求、阶段或成员","aria-label":"搜索迭代"})]}),i.jsx("div",{className:"af-workflows-segments","aria-label":"协作范围",children:[["all","全部"],["owned","我创建的"],["collaborating","与我协作"]].map(([w,g])=>i.jsx("button",{type:"button",className:u===w?"is-active":"","aria-pressed":u===w,onClick:()=>d(w),children:g},w))}),i.jsxs("select",{value:f,onChange:w=>p(w.target.value),"aria-label":"迭代状态",children:[i.jsx("option",{value:"all",children:"全部状态"}),i.jsx("option",{value:"active",children:"进行中"}),i.jsx("option",{value:"completed",children:"已完成"}),i.jsx("option",{value:"blocked",children:"需关注"})]})]}),o?i.jsx("div",{className:"af-workflows-message af-workflows-message--error",children:o}):null,r?i.jsx("div",{className:"af-workflows-message",children:"正在读取迭代..."}):null,!r&&!o&&t.length===0?i.jsxs("div",{className:"af-workflows-empty",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"timeline"}),i.jsx("strong",{children:"暂无迭代"}),i.jsx("p",{children:"当 prd-flow 上报 Workflow 后,它会出现在这里。"})]}):null,!r&&t.length>0&&v.length===0?i.jsx("div",{className:"af-workflows-message",children:"没有符合当前筛选条件的迭代。"}):null,i.jsx("div",{className:"af-workflows-list",children:v.map(w=>{var k,b;const g=w.actionCount>0?Math.round(w.completedActionCount/w.actionCount*100):0;return i.jsxs("article",{className:"af-workflow-card",children:[i.jsxs("div",{className:"af-workflow-card__identity",children:[i.jsxs("div",{className:"af-workflow-card__title-row",children:[i.jsxs("span",{className:"af-workflow-tapd",children:["TAPD ",w.tapdId]}),i.jsx("span",{className:`af-workflow-state af-workflow-state--${w.state||"active"}`,children:loe(w.state)}),i.jsx("span",{className:"af-workflow-role",children:aoe(w.role)}),w.shareActive?i.jsxs("span",{className:"af-workflow-shared",children:[i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"link"}),"已分享"]}):null]}),i.jsx("h2",{children:w.title||w.pointer||`需求 ${w.tapdId}`}),i.jsx("p",{children:w.pointer||"等待 Workflow 上报当前状态"}),i.jsxs("div",{className:"af-workflow-card__meta",children:[i.jsx("span",{children:w.phase||"未识别阶段"}),i.jsxs("span",{children:[w.issueCount||0," Issues"]}),(w.platforms||[]).map(j=>i.jsx("span",{children:coe(j)},j)),i.jsxs("span",{children:["Owner · ",w.ownerUsername||w.ownerId||"-"]})]})]}),i.jsxs("div",{className:"af-workflow-card__progress",children:[i.jsxs("div",{children:[i.jsx("span",{children:"Action 进度"}),i.jsxs("strong",{children:[w.completedActionCount||0,"/",w.actionCount||0]})]}),i.jsx("div",{className:"af-workflow-progress","aria-label":`Action 完成度 ${g}%`,children:i.jsx("span",{style:{width:`${g}%`}})}),i.jsxs("small",{children:[g,"%"]})]}),i.jsxs("div",{className:"af-workflow-card__latest",children:[i.jsx("span",{children:"最新动态"}),i.jsx("strong",{children:((k=w.latestAction)==null?void 0:k.title)||"暂无 Action 记录"}),i.jsx("small",{children:ooe(((b=w.latestAction)==null?void 0:b.at)||w.updatedAt)})]}),i.jsxs("button",{type:"button",className:"af-workflow-open",onClick:()=>e(uoe(w)),children:["打开 Workflow",i.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_forward"})]})]},w.id||w.tapdId)})})]})})]})}const foe=[{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"}],poe=[{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 长文档","客户端原型预览","图表与表格","统一展示链接"]}],hoe=[{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"}],moe=[["知识库","查客户端、后台、前端逻辑","广告、Feed、会员、增长、配置、接口调用链"],["数据","查 CK / Hive 并输出 SQL","PV、UV、转化、分页面、分国家、分实验组"],["产物","生成原型、PRD、Display 面板","Markdown、HTML 原型、图表、表格、交互预览"],["协作","同步 TAPD 与 Git 仓库","需求正文、变更记录、MR 链接、评审材料"]];function Gp({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 goe(){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(Gp,{icon:"travel_explore",title:"全局上下文",label:"Likee 业务、代码、数据",tone:"pink"})}),i.jsx("div",{className:"likee-node-pos likee-node-b",children:i.jsx(Gp,{icon:"database",title:"CK / Hive",label:"自动 SQL 与指标口径",tone:"cyan"})}),i.jsx("div",{className:"likee-node-pos likee-node-c",children:i.jsx(Gp,{icon:"article",title:"需求文档",label:"PRD、变更说明、评审稿",tone:"amber"})}),i.jsx("div",{className:"likee-node-pos likee-node-d",children:i.jsx(Gp,{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 jh({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 yoe(){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(jh,{kicker:"SKILLS",title:"用 Skills 把 Likee 上下文变成可复用能力",children:"Skills 是工作区里可加载的能力包。手动搭建工作区时,只需要按场景加载对应 Skill。"}),i.jsx("div",{className:"likee-skill-grid",children:hoe.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 VM(){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(goe,{}),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(jh,{kicker:"SCENARIO TRIGGERS",title:"打造 Likee 团队全景上下文",children:"不要求先会写 Prompt,也不要求知道该找哪个系统。选择一个业务场景,工作台会把需要的 Likee 上下文、数据查询和最终产物组织起来。"}),i.jsx("div",{className:"likee-scenario-grid",children:foe.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(jh,{kicker:"USE CASES",title:"沉淀 Likee 业务流水线",children:"这里展示的是平台里实际可跑的工作流:加载流程片段,在子 Agent 或 Run 节点输入业务问题,执行当前 line,最终在 Display、TAPD 和 Git 中拿到结果。"}),i.jsx("div",{className:"likee-usecase-stack",children:poe.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(yoe,{}),i.jsx("section",{className:"likee-section",children:i.jsxs("div",{className:"likee-section-inner likee-two-column likee-capability-layout",children:[i.jsx(jh,{kicker:"CAPABILITY MAP",title:"每个场景背后,都连接同一套 Likee 上下文能力",children:"工作台把知识库、CK / Hive、原型、PRD、TAPD 和 Git 放到同一条链路里。用户看到的是业务场景,系统处理的是上下文、产物和同步。"}),i.jsx("div",{className:"likee-capability-table",children:moe.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 KM(e){return t=>typeof t===e}var woe=KM("function"),xoe=e=>e===null,M_=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",$_=e=>!boe(e)&&!xoe(e)&&(woe(e)||typeof e=="object"),boe=KM("undefined");function koe(e,t,n){return Eoe(n,e,t)?!0:(Aoe(n,e,t),e.constructor!==t.constructor?!1:Array.isArray(e)&&Array.isArray(t)?voe(e,t,n):e instanceof Map&&t instanceof Map?Noe(e,t,n):e instanceof Set&&t instanceof Set?_oe(e,t):e instanceof WeakMap||e instanceof WeakSet?!1:ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)?Soe(e,t):M_(e)&&M_(t)?e.source===t.source&&e.flags===t.flags:e instanceof Error&&t instanceof Error?joe(e,t,n):e.valueOf!==Object.prototype.valueOf?e.valueOf()===t.valueOf():e.toString!==Object.prototype.toString?e.toString()===t.toString():Coe(e,t,n))}function jf(e,t,n){return e===t||Number.isNaN(e)&&Number.isNaN(t)?!0:!e||!$_(e)||!t||!$_(t)?!1:koe(e,t,n)}function voe(e,t,n){const{length:r}=e;if(r!==t.length)return!1;for(let s=r;s--!==0;)if(!jf(e[s],t[s],n))return!1;return!0}function Soe(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 joe(e,t,n){return e.message===t.message&&e.name===t.name&&jf(e.cause,t.cause,n)}function Noe(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(!jf(r[1],t.get(r[0]),n))return!1;return!0}function Coe(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)&&!jf(e[o],t[o],n))return!1}return!0}function _oe(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 Eoe(e,t,n){var r;return((r=e.get(t))==null?void 0:r.has(n))??!1}function Aoe(e,t,n){let r=e.get(t);r||(r=new WeakSet,e.set(t,r)),r.add(n)}function Av(e,t){return jf(e,t,new WeakMap)}function _w(){var e;return!!(typeof window<"u"&&((e=window==null?void 0:window.document)!=null&&e.createElement))}function Poe(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}function Ioe(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function Roe(){const e=m.useRef(!0);return e.current?(e.current=!1,!0):e.current}function Toe(e,t){const n=Roe();m.useEffect(()=>{if(!n)return e()},t)}function qM(e){const t=m.useRef(void 0);return m.useEffect(()=>{t.current=e}),t.current}function Moe(e,t){const n=m.useRef(t);return Av(t,n.current)||(n.current=t),m.useMemo(e,n.current)}function $oe(e){m.useEffect(()=>{e()},[])}function Loe(e=0){const[t,n]=m.useState({height:_w()?window.innerHeight:0,width:_w()?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(!_w())return()=>{};const o=s.current;return n({height:window.innerHeight,width:window.innerWidth}),Ioe(window,"resize",o),()=>{Poe(window,"resize",o)}},[]),t}var Ooe=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","URL","WeakMap","WeakSet"],Doe=["bigint","boolean","null","number","string","symbol","undefined"];function Nf(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(Foe(t))return t}function li(e){return t=>Nf(t)===e}function Foe(e){return Ooe.includes(e)}function Xc(e){return t=>typeof t===e}function zoe(e){return Doe.includes(e)}var Boe=["innerHTML","ownerDocument","style","attributes","nodeValue"],Cf=e=>Array.isArray(e),Hoe=e=>Nf(e)==="AsyncGeneratorFunction",Woe=li("AsyncFunction"),Voe=Xc("bigint"),Koe=e=>e===!0||e===!1,qoe=li("Date"),Uoe=li("Error"),aa=Xc("function"),Yoe=li("GeneratorFunction"),Goe=e=>typeof e=="number"&&Number.isInteger(e),Pb=li("Map"),UM=e=>Number.isNaN(e),Pv=e=>e===null,YM=li("Function"),Joe=li("Promise"),Xoe=li("RegExp"),Ib=li("Set"),_f=Xc("string"),Qoe=Xc("symbol"),Iv=Xc("undefined"),Zoe=li("WeakMap"),eae=li("WeakSet"),Rv=e=>Pv(e)||Iv(e),GM=e=>!Iv(e),tae=e=>Xc("number")(e)&&!UM(e),nae=e=>_f(e)&&e.trim().length>0,rae=e=>{if(!_f(e)||e.length===0)return!1;const t=e.trim();return t.length>0&&Number.isFinite(Number(t))},wg=e=>!Rv(e)&&(aa(e)||typeof e=="object"),JM=e=>{if(Nf(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})},sae=e=>Pv(e)||zoe(typeof e),iae=e=>Nf(e)==="URL",XM=e=>!Rv(e)&&aa(e[Symbol.iterator]),oae=e=>XM(e)&&aa(e.next)&&aa(e.throw),aae=e=>aa(e)&&/^class\s/.test(e.toString()),lae=(e,t)=>!Cf(e)||!aa(t)?!1:e.every(n=>t(n)),cae=e=>wg(e)&&!JM(e)&&e.nodeType===1&&_f(e.nodeName)&&Boe.every(t=>t in e),uae=e=>_f(e)&&e.length===0||Cf(e)&&e.length===0||wg(e)&&!Pb(e)&&!Ib(e)&&Object.keys(e).length===0||Ib(e)&&e.size===0||Pb(e)&&e.size===0,dae=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype,fae=(e,t)=>Cf(e)?e.indexOf(t)>-1:!1,pae=(e,t,n)=>{if(!wg(e)||!t)return!1;const r=e[t];return aa(n)?n(r):GM(r)};function Ct(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(Cf(e))return"Array";if(YM(e))return"Function";const t=Nf(e);return t||"Object"}Ct.array=Cf;Ct.arrayOf=lae;Ct.asyncGeneratorFunction=Hoe;Ct.asyncFunction=Woe;Ct.bigint=Voe;Ct.boolean=Koe;Ct.class=aae;Ct.date=qoe;Ct.defined=GM;Ct.domElement=cae;Ct.empty=uae;Ct.error=Uoe;Ct.function=aa;Ct.generator=oae;Ct.generatorFunction=Yoe;Ct.instanceOf=dae;Ct.integer=Goe;Ct.iterable=XM;Ct.map=Pb;Ct.nan=UM;Ct.null=Pv;Ct.nullOrUndefined=Rv;Ct.nonEmptyString=nae;Ct.number=tae;Ct.numericString=rae;Ct.object=wg;Ct.oneOf=fae;Ct.plainFunction=YM;Ct.plainObject=JM;Ct.primitive=sae;Ct.promise=Joe;Ct.propertyOf=pae;Ct.regexp=Xoe;Ct.set=Ib;Ct.string=_f;Ct.symbol=Qoe;Ct.undefined=Iv;Ct.url=iae;Ct.weakMap=Zoe;Ct.weakSet=eae;var Sr=Ct;/* v8 ignore next -- @preserve */var hae=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},mae=function(e,t){return e+of(t)},of=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(mae,""):hae(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?of(e.props.children):""};of.default=of;var gae=of;const Ew=ca(gae);var QM={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 C=0;const I=N.length,R=new Array(I);for(C;C<I;++C)R[C]=g(N[C]);return R}function l(N){const C={};if(p&&Object.getPrototypeOf(N)!==t)return p(N);const I=f(N);let R,H,A;for(R=0,H=I.length;R<H;++R)o(A=I[R])&&(C[A]=g(N[A]));return C}function c(N,C){const I=N.length,R=C.length;let H=0;const A=new Array(I+R);for(H;H<I;++H)A[H]=g(N[H]);for(H=0;H<R;++H)A[H+I]=g(C[H]);return A}const u=Object.prototype.propertyIsEnumerable;function d(N){const C=Object.keys(N),I=Object.getOwnPropertySymbols(N);for(let R=0,H=I.length;R<H;++R)u.call(N,I[R])&&C.push(I[R]);return C}const f=s!=null&&s.symbols?d:Object.keys,p=typeof(s==null?void 0:s.cloneProtoObject)=="function"?s.cloneProtoObject:void 0,h=typeof(s==null?void 0:s.isMergeableObject)=="function"?s.isMergeableObject:n(),y=(s==null?void 0:s.onlyDefinedProperties)===!0;function v(N){return typeof N!="object"||N===null}const w=s&&typeof s.mergeArray=="function"?s.mergeArray({clone:g,deepmerge:b,getKeys:f,isMergeableObject:h}):c;function g(N){return h(N)?Array.isArray(N)?a(N):l(N):N}function k(N,C){const I={},R=f(N),H=f(C);let A,L,D;for(A=0,L=R.length;A<L;++A)o(D=R[A])&&H.indexOf(D)===-1&&(I[D]=g(N[D]));for(A=0,L=H.length;A<L;++A)if(o(D=H[A]))if(D in N)R.indexOf(D)!==-1&&(p&&h(C[D])&&Object.getPrototypeOf(C[D])!==t?I[D]=p(C[D]):I[D]=b(N[D],C[D]));else{if(y&&typeof C[D]>"u")continue;I[D]=g(C[D])}return I}function b(N,C){if(y&&typeof C>"u")return g(N);const I=Array.isArray(C),R=Array.isArray(N);return v(C)?C:h(N)?I&&R?w(N,C):I!==R?g(C):k(N,C):g(C)}function j(){switch(arguments.length){case 0:return{};case 1:return g(arguments[0]);case 2:return b(arguments[0],arguments[1])}let N;for(let C=0,I=arguments.length;C<I;++C)N=b(N,arguments[C]);return N}return s!=null&&s.all?j:b}e.exports=r,e.exports.default=r,e.exports.deepmerge=r,Object.defineProperty(e.exports,"isMergeableObject",{get:n})})(QM);var yae=QM.exports;const wae=ca(yae);var xae=new Error("Element already at target scroll position"),bae=new Error("Scroll cancelled"),kae=Math.min,L_=Date.now,vae={left:O_("scrollLeft"),top:O_("scrollTop")};function O_(e){return function(n,r,s,o){s=s||{},typeof s=="function"&&(o=s,s={}),typeof o!="function"&&(o=jae);var a=L_(),l=n[e],c=s.ease||Sae,u=isNaN(s.duration)?350:+s.duration,d=!1;return l===r?o(xae,n[e]):requestAnimationFrame(p),f;function f(){d=!0}function p(h){if(d)return o(bae,n[e]);var y=L_(),v=kae(1,(y-a)/u),w=c(v);n[e]=w*(r-l)+l,v<1?requestAnimationFrame(p):requestAnimationFrame(function(){o(null,n[e])})}}}function Sae(e){return .5*(1-Math.cos(Math.PI*e))}function jae(){}const Nae=ca(vae);var ZM={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(vd,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})})(ZM);var Cae=ZM.exports;const e$=ca(Cae),_ae=["top","right","bottom","left"],D_=["start","end"],F_=_ae.reduce((e,t)=>e.concat(t,t+"-"+D_[0],t+"-"+D_[1]),[]),Bc=Math.min,qa=Math.max,Em=Math.round,Jp=Math.floor,Ti=e=>({x:e,y:e}),Eae={left:"right",right:"left",bottom:"top",top:"bottom"};function Rb(e,t,n){return qa(e,Bc(t,n))}function Qc(e,t){return typeof e=="function"?e(t):e}function ho(e){return e.split("-")[0]}function Mi(e){return e.split("-")[1]}function t$(e){return e==="x"?"y":"x"}function Tv(e){return e==="y"?"height":"width"}function Vo(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Mv(e){return t$(Vo(e))}function n$(e,t,n){n===void 0&&(n=!1);const r=Mi(e),s=Mv(e),o=Tv(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=Pm(a)),[a,Pm(a)]}function Aae(e){const t=Pm(e);return[Am(e),t,Am(t)]}function Am(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const z_=["left","right"],B_=["right","left"],Pae=["top","bottom"],Iae=["bottom","top"];function Rae(e,t,n){switch(e){case"top":case"bottom":return n?t?B_:z_:t?z_:B_;case"left":case"right":return t?Pae:Iae;default:return[]}}function Tae(e,t,n,r){const s=Mi(e);let o=Rae(ho(e),n==="start",r);return s&&(o=o.map(a=>a+"-"+s),t&&(o=o.concat(o.map(Am)))),o}function Pm(e){const t=ho(e);return Eae[t]+e.slice(t.length)}function Mae(e){return{top:0,right:0,bottom:0,left:0,...e}}function r$(e){return typeof e!="number"?Mae(e):{top:e,right:e,bottom:e,left:e}}function Im(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 H_(e,t,n){let{reference:r,floating:s}=e;const o=Vo(t),a=Mv(t),l=Tv(a),c=ho(t),u=o==="y",d=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,p=r[l]/2-s[l]/2;let h;switch(c){case"top":h={x: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:f};break;case"left":h={x:r.x-s.width,y:f};break;default:h={x:r.x,y:r.y}}switch(Mi(t)){case"start":h[a]-=p*(n&&u?-1:1);break;case"end":h[a]+=p*(n&&u?-1:1);break}return h}async function $ae(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:f="floating",altBoundary:p=!1,padding:h=0}=Qc(t,e),y=r$(h),w=l[p?f==="floating"?"reference":"floating":f],g=Im(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(w)))==null||n?w:w.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),k=f==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,b=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),j=await(o.isElement==null?void 0:o.isElement(b))?await(o.getScale==null?void 0:o.getScale(b))||{x:1,y:1}:{x:1,y:1},N=Im(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:k,offsetParent:b,strategy:c}):k);return{top:(g.top-N.top+y.top)/j.y,bottom:(N.bottom-g.bottom+y.bottom)/j.y,left:(g.left-N.left+y.left)/j.x,right:(N.right-g.right+y.right)/j.x}}const Lae=50,Oae=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:$ae},c=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:d,y:f}=H_(u,r,c),p=r,h=0;const y={};for(let v=0;v<o.length;v++){const w=o[v];if(!w)continue;const{name:g,fn:k}=w,{x:b,y:j,data:N,reset:C}=await k({x:d,y:f,initialPlacement:r,placement:p,strategy:s,middlewareData:y,rects:u,platform:l,elements:{reference:e,floating:t}});d=b??d,f=j??f,y[g]={...y[g],...N},C&&h<Lae&&(h++,typeof C=="object"&&(C.placement&&(p=C.placement),C.rects&&(u=C.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):C.rects),{x:d,y:f}=H_(u,p,c)),v=-1)}return{x:d,y:f,placement:p,strategy:s,middlewareData:y}},Dae=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}=Qc(e,t)||{};if(u==null)return{};const f=r$(d),p={x:n,y:r},h=Mv(s),y=Tv(h),v=await a.getDimensions(u),w=h==="y",g=w?"top":"left",k=w?"bottom":"right",b=w?"clientHeight":"clientWidth",j=o.reference[y]+o.reference[h]-p[h]-o.floating[y],N=p[h]-o.reference[h],C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let I=C?C[b]:0;(!I||!await(a.isElement==null?void 0:a.isElement(C)))&&(I=l.floating[b]||o.floating[y]);const R=j/2-N/2,H=I/2-v[y]/2-1,A=Bc(f[g],H),L=Bc(f[k],H),D=A,O=I-v[y]-L,M=I/2-v[y]/2+R,K=Rb(D,M,O),z=!c.arrow&&Mi(s)!=null&&M!==K&&o.reference[y]/2-(M<D?A:L)-v[y]/2<0,F=z?M<D?M-D:M-O:0;return{[h]:p[h]+F,data:{[h]:K,centerOffset:M-K-F,...z&&{alignmentOffset:F}},reset:z}}});function Fae(e,t,n){return(e?[...n.filter(s=>Mi(s)===e),...n.filter(s=>Mi(s)!==e)]:n.filter(s=>ho(s)===s)).filter(s=>e?Mi(s)===e||(t?Am(s)!==s:!1):!0)}const zae=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:f,allowedPlacements:p=F_,autoAlignment:h=!0,...y}=Qc(e,t),v=f!==void 0||p===F_?Fae(f||null,h,p):p,w=await c.detectOverflow(t,y),g=((n=a.autoPlacement)==null?void 0:n.index)||0,k=v[g];if(k==null)return{};const b=n$(k,o,await(c.isRTL==null?void 0:c.isRTL(u.floating)));if(l!==k)return{reset:{placement:v[0]}};const j=[w[ho(k)],w[b[0]],w[b[1]]],N=[...((r=a.autoPlacement)==null?void 0:r.overflows)||[],{placement:k,overflows:j}],C=v[g+1];if(C)return{data:{index:g+1,overflows:N},reset:{placement:C}};const I=N.map(A=>{const L=Mi(A.placement);return[A.placement,L&&d?A.overflows.slice(0,2).reduce((D,O)=>D+O,0):A.overflows[0],A.overflows]}).sort((A,L)=>A[1]-L[1]),H=((s=I.filter(A=>A[2].slice(0,Mi(A[0])?2:3).every(L=>L<=0))[0])==null?void 0:s[0])||I[0][0];return H!==l?{data:{index:g+1,overflows:N},reset:{placement:H}}:{}}}},Bae=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:f=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:v=!0,...w}=Qc(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const g=ho(s),k=Vo(l),b=ho(l)===l,j=await(c.isRTL==null?void 0:c.isRTL(u.floating)),N=p||(b||!v?[Pm(l)]:Aae(l)),C=y!=="none";!p&&C&&N.push(...Tae(l,v,y,j));const I=[l,...N],R=await c.detectOverflow(t,w),H=[];let A=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&H.push(R[g]),f){const M=n$(s,a,j);H.push(R[M[0]],R[M[1]])}if(A=[...A,{placement:s,overflows:H}],!H.every(M=>M<=0)){var L,D;const M=(((L=o.flip)==null?void 0:L.index)||0)+1,K=I[M];if(K&&(!(f==="alignment"?k!==Vo(K):!1)||A.every($=>Vo($.placement)===k?$.overflows[0]>0:!0)))return{data:{index:M,overflows:A},reset:{placement:K}};let z=(D=A.filter(F=>F.overflows[0]<=0).sort((F,$)=>F.overflows[1]-$.overflows[1])[0])==null?void 0:D.placement;if(!z)switch(h){case"bestFit":{var O;const F=(O=A.filter($=>{if(C){const W=Vo($.placement);return W===k||W==="y"}return!0}).map($=>[$.placement,$.overflows.filter(W=>W>0).reduce((W,E)=>W+E,0)]).sort(($,W)=>$[1]-W[1])[0])==null?void 0:O[0];F&&(z=F);break}case"initialPlacement":z=l;break}if(s!==z)return{reset:{placement:z}}}return{}}}},Hae=new Set(["left","top"]);async function Wae(e,t){const{placement:n,platform:r,elements:s}=e,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=ho(n),l=Mi(n),c=Vo(n)==="y",u=Hae.has(a)?-1:1,d=o&&c?-1:1,f=Qc(t,e);let{mainAxis:p,crossAxis:h,alignmentAxis:y}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof y=="number"&&(h=l==="end"?y*-1:y),c?{x:h*d,y:p*u}:{x:p*u,y:h*d}}const Vae=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 Wae(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}}}}},Kae=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:g=>{let{x:k,y:b}=g;return{x:k,y:b}}},...u}=Qc(e,t),d={x:n,y:r},f=await o.detectOverflow(t,u),p=Vo(ho(s)),h=t$(p);let y=d[h],v=d[p];if(a){const g=h==="y"?"top":"left",k=h==="y"?"bottom":"right",b=y+f[g],j=y-f[k];y=Rb(b,y,j)}if(l){const g=p==="y"?"top":"left",k=p==="y"?"bottom":"right",b=v+f[g],j=v-f[k];v=Rb(b,v,j)}const w=c.fn({...t,[h]:y,[p]:v});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[h]:a,[p]:l}}}}}};function xg(){return typeof window<"u"}function Zc(e){return s$(e)?(e.nodeName||"").toLowerCase():"#document"}function ds(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Di(e){var t;return(t=(s$(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function s$(e){return xg()?e instanceof Node||e instanceof ds(e).Node:!1}function ii(e){return xg()?e instanceof Element||e instanceof ds(e).Element:!1}function wo(e){return xg()?e instanceof HTMLElement||e instanceof ds(e).HTMLElement:!1}function W_(e){return!xg()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ds(e).ShadowRoot}function Ef(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=oi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function qae(e){return/^(table|td|th)$/.test(Zc(e))}function bg(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Uae=/transform|translate|scale|rotate|perspective|filter/,Yae=/paint|layout|strict|content/,Ca=e=>!!e&&e!=="none";let Aw;function $v(e){const t=ii(e)?oi(e):e;return Ca(t.transform)||Ca(t.translate)||Ca(t.scale)||Ca(t.rotate)||Ca(t.perspective)||!Lv()&&(Ca(t.backdropFilter)||Ca(t.filter))||Uae.test(t.willChange||"")||Yae.test(t.contain||"")}function Gae(e){let t=la(e);for(;wo(t)&&!Hc(t);){if($v(t))return t;if(bg(t))return null;t=la(t)}return null}function Lv(){return Aw==null&&(Aw=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Aw}function Hc(e){return/^(html|body|#document)$/.test(Zc(e))}function oi(e){return ds(e).getComputedStyle(e)}function kg(e){return ii(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function la(e){if(Zc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||W_(e)&&e.host||Di(e);return W_(t)?t.host:t}function i$(e){const t=la(e);return Hc(t)?e.ownerDocument?e.ownerDocument.body:e.body:wo(t)&&Ef(t)?t:i$(t)}function af(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=i$(e),o=s===((r=e.ownerDocument)==null?void 0:r.body),a=ds(s);if(o){const l=Tb(a);return t.concat(a,a.visualViewport||[],Ef(s)?s:[],l&&n?af(l):[])}else return t.concat(s,af(s,[],n))}function Tb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function o$(e){const t=oi(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=wo(e),o=s?e.offsetWidth:n,a=s?e.offsetHeight:r,l=Em(n)!==o||Em(r)!==a;return l&&(n=o,r=a),{width:n,height:r,$:l}}function Ov(e){return ii(e)?e:e.contextElement}function jc(e){const t=Ov(e);if(!wo(t))return Ti(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:o}=o$(t);let a=(o?Em(n.width):n.width)/r,l=(o?Em(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const Jae=Ti(0);function a$(e){const t=ds(e);return!Lv()||!t.visualViewport?Jae:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Xae(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ds(e)?!1:t}function ll(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),o=Ov(e);let a=Ti(1);t&&(r?ii(r)&&(a=jc(r)):a=jc(e));const l=Xae(o,n,r)?a$(o):Ti(0);let c=(s.left+l.x)/a.x,u=(s.top+l.y)/a.y,d=s.width/a.x,f=s.height/a.y;if(o){const p=ds(o),h=r&&ii(r)?ds(r):r;let y=p,v=Tb(y);for(;v&&r&&h!==y;){const w=jc(v),g=v.getBoundingClientRect(),k=oi(v),b=g.left+(v.clientLeft+parseFloat(k.paddingLeft))*w.x,j=g.top+(v.clientTop+parseFloat(k.paddingTop))*w.y;c*=w.x,u*=w.y,d*=w.x,f*=w.y,c+=b,u+=j,y=ds(v),v=Tb(y)}}return Im({width:d,height:f,x:c,y:u})}function vg(e,t){const n=kg(e).scrollLeft;return t?t.left+n:ll(Di(e)).left+n}function l$(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-vg(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function Qae(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const o=s==="fixed",a=Di(r),l=t?bg(t.floating):!1;if(r===a||l&&o)return n;let c={scrollLeft:0,scrollTop:0},u=Ti(1);const d=Ti(0),f=wo(r);if((f||!f&&!o)&&((Zc(r)!=="body"||Ef(a))&&(c=kg(r)),f)){const h=ll(r);u=jc(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}const p=a&&!f&&!o?l$(a,c):Ti(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x+p.x,y:n.y*u.y-c.scrollTop*u.y+d.y+p.y}}function Zae(e){return Array.from(e.getClientRects())}function ele(e){const t=Di(e),n=kg(e),r=e.ownerDocument.body,s=qa(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=qa(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+vg(e);const l=-n.scrollTop;return oi(r).direction==="rtl"&&(a+=qa(t.clientWidth,r.clientWidth)-s),{width:s,height:o,x:a,y:l}}const V_=25;function tle(e,t){const n=ds(e),r=Di(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=Lv();(!d||d&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const u=vg(r);if(u<=0){const d=r.ownerDocument,f=d.body,p=getComputedStyle(f),h=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,y=Math.abs(r.clientWidth-f.clientWidth-h);y<=V_&&(o-=y)}else u<=V_&&(o+=u);return{width:o,height:a,x:l,y:c}}function nle(e,t){const n=ll(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,o=wo(e)?jc(e):Ti(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 K_(e,t,n){let r;if(t==="viewport")r=tle(e,n);else if(t==="document")r=ele(Di(e));else if(ii(t))r=nle(t,n);else{const s=a$(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Im(r)}function c$(e,t){const n=la(e);return n===t||!ii(n)||Hc(n)?!1:oi(n).position==="fixed"||c$(n,t)}function rle(e,t){const n=t.get(e);if(n)return n;let r=af(e,[],!1).filter(l=>ii(l)&&Zc(l)!=="body"),s=null;const o=oi(e).position==="fixed";let a=o?la(e):e;for(;ii(a)&&!Hc(a);){const l=oi(a),c=$v(a);!c&&l.position==="fixed"&&(s=null),(o?!c&&!s:!c&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Ef(a)&&!c&&c$(e,a))?r=r.filter(d=>d!==a):s=l,a=la(a)}return t.set(e,r),r}function sle(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?bg(t)?[]:rle(t,this._c):[].concat(n),r],l=K_(t,a[0],s);let c=l.top,u=l.right,d=l.bottom,f=l.left;for(let p=1;p<a.length;p++){const h=K_(t,a[p],s);c=qa(h.top,c),u=Bc(h.right,u),d=Bc(h.bottom,d),f=qa(h.left,f)}return{width:u-f,height:d-c,x:f,y:c}}function ile(e){const{width:t,height:n}=o$(e);return{width:t,height:n}}function ole(e,t,n){const r=wo(t),s=Di(t),o=n==="fixed",a=ll(e,!0,o,t);let l={scrollLeft:0,scrollTop:0};const c=Ti(0);function u(){c.x=vg(s)}if(r||!r&&!o)if((Zc(t)!=="body"||Ef(s))&&(l=kg(t)),r){const h=ll(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?l$(s,l):Ti(0),f=a.left+l.scrollLeft-c.x-d.x,p=a.top+l.scrollTop-c.y-d.y;return{x:f,y:p,width:a.width,height:a.height}}function Pw(e){return oi(e).position==="static"}function q_(e,t){if(!wo(e)||oi(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Di(e)===n&&(n=n.ownerDocument.body),n}function u$(e,t){const n=ds(e);if(bg(e))return n;if(!wo(e)){let s=la(e);for(;s&&!Hc(s);){if(ii(s)&&!Pw(s))return s;s=la(s)}return n}let r=q_(e,t);for(;r&&qae(r)&&Pw(r);)r=q_(r,t);return r&&Hc(r)&&Pw(r)&&!$v(r)?n:r||Gae(e)||n}const ale=async function(e){const t=this.getOffsetParent||u$,n=this.getDimensions,r=await n(e.floating);return{reference:ole(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function lle(e){return oi(e).direction==="rtl"}const cle={convertOffsetParentRelativeRectToViewportRelativeRect:Qae,getDocumentElement:Di,getClippingRect:sle,getOffsetParent:u$,getElementRects:ale,getClientRects:Zae,getDimensions:ile,getScale:jc,isElement:ii,isRTL:lle};function d$(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ule(e,t){let n=null,r;const s=Di(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:f,width:p,height:h}=u;if(l||t(),!p||!h)return;const y=Jp(f),v=Jp(s.clientWidth-(d+p)),w=Jp(s.clientHeight-(f+h)),g=Jp(d),b={rootMargin:-y+"px "+-v+"px "+-w+"px "+-g+"px",threshold:qa(0,Bc(1,c))||1};let j=!0;function N(C){const I=C[0].intersectionRatio;if(I!==c){if(!j)return a();I?a(!1,I):r=setTimeout(()=>{a(!1,1e-7)},1e3)}I===1&&!d$(u,e.getBoundingClientRect())&&a(),j=!1}try{n=new IntersectionObserver(N,{...b,root:s.ownerDocument})}catch{n=new IntersectionObserver(N,b)}n.observe(e)}return a(!0),o}function U_(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=Ov(e),d=s||o?[...u?af(u):[],...t?af(t):[]]:[];d.forEach(g=>{s&&g.addEventListener("scroll",n,{passive:!0}),o&&g.addEventListener("resize",n)});const f=u&&l?ule(u,n):null;let p=-1,h=null;a&&(h=new ResizeObserver(g=>{let[k]=g;k&&k.target===u&&h&&t&&(h.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var b;(b=h)==null||b.observe(t)})),n()}),u&&!c&&h.observe(u),t&&h.observe(t));let y,v=c?ll(e):null;c&&w();function w(){const g=ll(e);v&&!d$(v,g)&&n(),v=g,y=requestAnimationFrame(w)}return n(),()=>{var g;d.forEach(k=>{s&&k.removeEventListener("scroll",n),o&&k.removeEventListener("resize",n)}),f==null||f(),(g=h)==null||g.disconnect(),h=null,c&&cancelAnimationFrame(y)}}const dle=Vae,fle=zae,ple=Kae,hle=Bae,Y_=Dae,mle=(e,t,n)=>{const r=new Map,s={platform:cle,...n},o={...s.platform,_c:r};return Oae(e,t,{...s,platform:o})};var gle=typeof document<"u",yle=function(){},Nh=gle?m.useLayoutEffect:yle;function Rm(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(!Rm(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)&&!Rm(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function f$(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function G_(e,t){const n=f$(e);return Math.round(t*n)/n}function Iw(e){const t=m.useRef(e);return Nh(()=>{t.current=e}),t}function J_(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,f]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,h]=m.useState(r);Rm(p,r)||h(r);const[y,v]=m.useState(null),[w,g]=m.useState(null),k=m.useCallback($=>{$!==C.current&&(C.current=$,v($))},[]),b=m.useCallback($=>{$!==I.current&&(I.current=$,g($))},[]),j=o||y,N=a||w,C=m.useRef(null),I=m.useRef(null),R=m.useRef(d),H=c!=null,A=Iw(c),L=Iw(s),D=Iw(u),O=m.useCallback(()=>{if(!C.current||!I.current)return;const $={placement:t,strategy:n,middleware:p};L.current&&($.platform=L.current),mle(C.current,I.current,$).then(W=>{const E={...W,isPositioned:D.current!==!1};M.current&&!Rm(R.current,E)&&(R.current=E,ur.flushSync(()=>{f(E)}))})},[p,t,n,L,D]);Nh(()=>{u===!1&&R.current.isPositioned&&(R.current.isPositioned=!1,f($=>({...$,isPositioned:!1})))},[u]);const M=m.useRef(!1);Nh(()=>(M.current=!0,()=>{M.current=!1}),[]),Nh(()=>{if(j&&(C.current=j),N&&(I.current=N),j&&N){if(A.current)return A.current(j,N,O);O()}},[j,N,O,A,H]);const K=m.useMemo(()=>({reference:C,floating:I,setReference:k,setFloating:b}),[k,b]),z=m.useMemo(()=>({reference:j,floating:N}),[j,N]),F=m.useMemo(()=>{const $={position:n,left:0,top:0};if(!z.floating)return $;const W=G_(z.floating,d.x),E=G_(z.floating,d.y);return l?{...$,transform:"translate("+W+"px, "+E+"px)",...f$(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:W,top:E}},[n,l,z.floating,d.x,d.y]);return m.useMemo(()=>({...d,update:O,refs:K,elements:z,floatingStyles:F}),[d,O,K,z,F])}const wle=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?Y_({element:r.current,padding:s}).fn(n):{}:r?Y_({element:r,padding:s}).fn(n):{}}}},X_=(e,t)=>{const n=dle(e);return{name:n.name,fn:n.fn,options:[e,t]}},xle=(e,t)=>{const n=ple(e);return{name:n.name,fn:n.fn,options:[e,t]}},ble=(e,t)=>{const n=hle(e);return{name:n.name,fn:n.fn,options:[e,t]}},kle=(e,t)=>{const n=fle(e);return{name:n.name,fn:n.fn,options:[e,t]}},vle=(e,t)=>{const n=wle(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sle={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},jle={beaconOptions:{offset:-18}},p$={back:"Back",close:"Close",last:"Last",next:"Next",nextWithProgress:"Next ({current} of {total})",open:"Open the dialog",skip:"Skip"},Nle={isFixed:!1,locale:p$,placement:"bottom"},Cle={continuous:!1,debug:!1,run:!1,scrollToFirstStep:!1,steps:[]},Ot={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update",COMPLETE:"complete"},cr={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"},ki={BUTTON_BACK:"button_back",BUTTON_CLOSE:"button_close",BUTTON_PRIMARY:"button_primary",BUTTON_SKIP:"button_skip",KEYBOARD:"keyboard",OVERLAY:"overlay"},It={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"},_le="react-joyride-portal";function Ele(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function uc(...e){return wae({all:!0,isMergeableObject:t=>!(!Sr.plainObject(t)||m.isValidElement(t))})(...e)}function h$(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function Ji(e,t={}){const{defaultValue:n,step:r,steps:s}=t;let o=Ew(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&&h$(e.type)==="function")try{o=Ji(e.type({}),t)}catch{o=Ew(n)}else o=Ew(n);return o}function pr(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 Ale(e,t){const n=Ele(t);return{...e,...n}}function lf(){}function Ple(e){return Object.keys(e)}function Tm(e,...t){if(!Sr.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 Q_(e,...t){if(!Sr.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 Mb(e,t,n){const r=o=>o.replace("{current}",String(t)).replace("{total}",String(n));if(h$(e)==="string")return r(e);if(!m.isValidElement(e))return e;const{children:s}=e.props;if(Sr.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):Mb(o,t,n))});if(Sr.function(e.type)&&!Object.values(e.props).length)try{return Mb(e.type({}),t,n)}catch{return e}return e}function Z_(e){return Ple(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})}function Dv(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function eE(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 Fv(e){return e?e.getBoundingClientRect():null}function Ile(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 Es(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 Rle(e,t,n){const r=Fv(e),s=eu(e),o=s?!s.isSameNode(Ur()):!1,a=n??tu(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(Ur())||(c+=Ur().scrollTop)),Math.floor(c-t)}function eu(e,t){if(!e)return Ur();const n=e$(e);if(n){if(n.isSameNode(Ur()))return t?document:Ur();if(!(n.scrollHeight>n.offsetHeight))return Ur()}return n}function Tle(e){const t=e.getBoundingClientRect(),n=Ur(),r=t.top+t.height/2,s=window.innerHeight/2;return Math.max(0,n.scrollTop+r-s)}function Mle(e,t){if(!e)return 0;const n=e$(e)??Ur(),r=parseFloat(getComputedStyle(e).scrollMarginTop)||0,s=Fv(n),o=n.scrollTop??0,{offsetTop:a=0,scrollTop:l=0}=n;let c=e.getBoundingClientRect().top+l;if(a&&(m$(e)||$le(e))){const d=e.getBoundingClientRect(),f=d.top-((s==null?void 0:s.top)??0),p=f+d.height,h=n.clientHeight,y=h*.2;f>=y&&p<=h-y?c=o:c=f+o}const u=Math.floor(c-t-r);return u<0?0:u}function $le(e){return e.offsetParent!==document.body}function m$(e){if(!e)return!1;const t=eu(e);return t?!t.isSameNode(Ur()):!1}function tu(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?tu(e.parentNode,t):!1}function Xp(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 tE(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?eu(s):Ur(),l=a?!a.isSameNode(Ur()):!1;return(r.isFixed||tu(s))&&!l?!1:a.scrollHeight>a.clientHeight}function Ur(){return document.scrollingElement??document.documentElement}function nE(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=Nae.top(r,e,{duration:c<100?50:n},()=>{a()})});return{cancel:s,promise:o}}function Lle(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 g$={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555555",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,WebkitAppearance:"none"},Qp={...g$,borderRadius:4,padding:8};function Ole(e,t){const{styles:n}=e,r=uc(n??{},t.styles??{});let{width:s}=t;Dv()&&(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 uc({arrow:{alignItems:"center",color:t.arrowColor,display:"inline-flex",justifyContent:"center",position:"absolute"},beaconWrapper:{...g$,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(${Lle(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:{...Qp,color:t.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{...Qp,color:t.textColor,height:12,padding:8,position:"absolute",right:0,top:0,width:12},buttonPrimary:{...Qp,backgroundColor:t.primaryColor,color:t.backgroundColor},buttonSkip:{...Qp,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 Dle=["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 zv(e,t){if(!t)return null;const n=uc(Nle,Q_(e,"arrowComponent","beaconComponent","floatingOptions","loaderComponent","locale","styles","tooltipComponent"),t),r=uc(Sle,e.options??{},Q_(t,...Dle)),s=Ole(e,{...n,...r}),o=uc(jle,e.floatingOptions??{},n.floatingOptions??{});return{...n,...r,locale:uc(p$,e.locale??{},n.locale||{}),floatingOptions:o,spotlightPadding:Fle(r.spotlightPadding),styles:s}}function Fle(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 zle(e,t,n){const{action:r}=t,s=n&&[Ot.PREV,Ot.NEXT].includes(r);return e.skipBeacon||e.placement==="center"||s}function y$(e,t=!1){return Sr.plainObject(e)?e.target?!0:(pr(t,"tour","target is missing from the step"),!1):(pr(t,"tour","step must be an object"),!1)}function w$(e,t=!1){return Sr.array(e)?e.every(n=>y$(n,t)):(pr(t,"tour","steps must be an array"),!1)}var Ble=class{constructor(e){$n(this,"beaconPosition",null);$n(this,"debug");$n(this,"eventListeners",new Map);$n(this,"listeners",new Set);$n(this,"props");$n(this,"snapshot");$n(this,"state");$n(this,"steps");$n(this,"tooltipPosition",null);$n(this,"cleanupPositionData",()=>{this.beaconPosition=null,this.tooltipPosition=null});$n(this,"getPositionData",e=>e==="beacon"?this.beaconPosition:this.tooltipPosition);$n(this,"getServerSnapshot",()=>this.snapshot);$n(this,"getSnapshot",()=>this.snapshot);$n(this,"getEventState",()=>Tm(this.snapshot,"positioned"));$n(this,"getState",()=>Tm(this.snapshot,"positioned"));$n(this,"setPositionData",(e,t)=>{var r,s,o;((r=e==="beacon"?this.beaconPosition:this.tooltipPosition)==null?void 0:r.placement)!==t.placement&&pr(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)});$n(this,"setSteps",e=>{this.steps=e,this.updateState({size:e.length})});$n(this,"dispatch",(e,t)=>{const n=this.eventListeners.get(e.type);if(n)for(const r of n)try{r(e,t)}catch{}});$n(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)}});$n(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));$n(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,!Av(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=Sr.number(n);let o=0;this.debug=(e==null?void 0:e.debug)??!1,s?(o=n,Sr.number(t)&&pr(this.debug,"tour","initialStepIndex is ignored in controlled mode")):Sr.number(t)&&(t>=0&&t<r.length?o=t:r.length>0&&pr(this.debug,"tour","initialStepIndex is out of bounds")),this.props=e??{steps:[]},this.steps=r,this.state={action:Ot.INIT,controlled:s,index:o,lifecycle:Xe.INIT,origin:null,positioned:!1,scrolling:!1,size:r.length,status:r.length?It.READY:It.IDLE,waiting:!1},this.snapshot=Object.freeze({...this.state})}applyTransitions(e){return e.status===It.WAITING&&e.size>0?{...e,status:It.RUNNING}:e}getStep(e){return zv(this.props,this.steps[e??this.state.index])}};function Hle(e){return new Ble(e)}function rE(e,t){return Math.min(Math.max(e,0),t)}function Wle(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:(w=null)=>{const{index:g,status:k}=o();k===It.RUNNING&&e.current.updateState({action:Ot.CLOSE,index:g+1,origin:w,lifecycle:Xe.COMPLETE,positioned:!1,scrolling:!1,waiting:!1})},go:w=>{const{controlled:g,size:k,status:b}=o();if(g){pr(r.current,"tour","go() is not supported in controlled mode");return}b===It.RUNNING&&e.current.updateState({action:Ot.GO,index:w,lifecycle:Xe.COMPLETE,positioned:!1,scrolling:!1,status:w<k?b:It.FINISHED,waiting:!1})},info:()=>Tm(e.current.getSnapshot(),"positioned"),next:w=>{const{index:g,size:k,status:b}=o();b===It.RUNNING&&e.current.updateState({action:Ot.NEXT,index:rE(g+1,k),lifecycle:Xe.COMPLETE,origin:w,positioned:!1,scrolling:!1,waiting:!1})},open:()=>{const{status:w}=o();w===It.RUNNING&&e.current.updateState({action:Ot.UPDATE,lifecycle:Xe.TOOLTIP_BEFORE,positioned:!1,scrolling:!1,waiting:!1})},prev:w=>{const{index:g,size:k,status:b}=o();b===It.RUNNING&&e.current.updateState({action:Ot.PREV,index:rE(g-1,k),lifecycle:Xe.COMPLETE,origin:w,positioned:!1,scrolling:!1,waiting:!1})},reset:(w=!1)=>{const{controlled:g}=o();if(g){pr(r.current,"tour","reset() is not supported in controlled mode");return}s.current(),e.current.updateState({action:Ot.RESET,index:0,lifecycle:Xe.INIT,positioned:!1,scrolling:!1,status:w?It.RUNNING:It.READY,waiting:!1})},skip:w=>{const{status:g}=o();g===It.RUNNING&&e.current.updateState({action:Ot.SKIP,lifecycle:Xe.COMPLETE,origin:w,positioned:!1,scrolling:!1,status:It.SKIPPED,waiting:!1})},start:w=>{const{index:g,size:k}=o();s.current(),e.current.updateState({action:Ot.START,index:Sr.number(w)?w:g,lifecycle:Xe.INIT,positioned:!1,scrolling:!1,status:k?It.RUNNING:It.WAITING,waiting:!1},!0)},stop:(w=!1)=>{const{index:g,status:k}=o();[It.FINISHED,It.SKIPPED].includes(k)||e.current.updateState({action:Ot.STOP,index:g+(w?1:0),lifecycle:Xe.COMPLETE,positioned:!1,scrolling:!1,status:It.PAUSED,waiting:!1})}}},[e])}const Vle=new Set(["origin","positioned"]);function Kle(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!t)return;const r=e.current.getSnapshot();return pr(!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]&&!Vle.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||pr(!0,l?"tour":`step:${s.index}`,"state",a))})},[t,e])}function qle(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 Lo(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 Ule(e){const{addFailure:t,controls:n,emitEvent:r,previousState:s,props:o,state:a,step:l,store:c}=e,{action:u,index:d,lifecycle:f,positioned:p,scrolling:h,size:y,status:v}=a,w=qM(l)??null,g=m.useRef(null),k=m.useRef(o),b=m.useRef(a),j=m.useRef(s),N=m.useRef(l),C=m.useRef(w),I=m.useRef(n),R=m.useRef(null),H=m.useRef(null),A=m.useRef(null);k.current=o,b.current=a,j.current=s,N.current=l,C.current=w,I.current=n;const L=()=>{R.current&&(clearInterval(R.current),R.current=null),H.current=null,A.current&&(A.current.cancel(),A.current=null)};m.useEffect(()=>{if(!j.current)return;const{hasChangedTo:D}=Lo(b.current,j.current);(D("action",[Ot.NEXT,Ot.PREV,Ot.SKIP,Ot.CLOSE])||g.current===Ot.CLOSE&&u===Ot.START)&&(g.current=u)},[u]),m.useEffect(()=>{if(!j.current)return()=>{L()};const{hasChanged:D}=Lo(b.current,j.current),O=N.current;if(D("index")&&L(),v!==It.RUNNING||!O||f!==Xe.INIT)return()=>{L()};const{hasChangedTo:M}=Lo(b.current,j.current);M("status",It.RUNNING)&&[It.IDLE,It.READY,It.PAUSED].includes(j.current.status)&&r(cr.TOUR_START,O),c.current.cleanupPositionData();const{debug:K}=k.current;if(O.before&&!A.current){pr(K,`step:${d}`,"before()",O),A.current={cancel:()=>{}},c.current.updateState({waiting:!0}),r(cr.STEP_BEFORE_HOOK,O,{action:g.current??b.current.action});const z=()=>{A.current=null,c.current.updateState({action:g.current??b.current.action,waiting:!1,lifecycle:Xe.READY})},F=new AbortController,$=O.beforeTimeout;A.current={cancel:()=>F.abort()};const W=$?setTimeout(()=>{F.signal.aborted||(pr(K,`step:${d}`,"before()","timed out",`${$}ms`),F.abort(),t(O,"before_hook"),r(cr.ERROR,O,{error:new Error("Step before hook timed out")}),z())},$):null;O.before({...c.current.getState(),action:g.current??c.current.getState().action,step:O}).then(()=>{F.signal.aborted||(W&&clearTimeout(W),z())}).catch(E=>{F.signal.aborted||(W&&clearTimeout(W),t(O,"before_hook"),r(cr.ERROR,O,{error:E instanceof Error?E:new Error(String(E))}),z())})}else if(!A.current){R.current&&H.current!==O.target&&L();const z=Es(O.target);if(z&&Xp(z))L(),c.current.updateState({action:g.current??Ot.UPDATE,lifecycle:Xe.READY,waiting:!1});else if(O.targetWaitTimeout===0)c.current.updateState({action:g.current??Ot.UPDATE,lifecycle:Xe.READY,waiting:!1});else if(!R.current){const{targetWaitTimeout:F}=O,$=Date.now();H.current=O.target,pr(K,`step:${d}`,"polling","started",`${F}ms`),c.current.updateState({waiting:!0}),R.current=setInterval(()=>{const W=Es(O.target),E=Date.now()-$,Q=E>=F;(W&&Xp(W)||Q)&&(pr(K,`step:${d}`,"polling",W&&Xp(W)?"found":"timed out",`${E}ms`),L(),c.current.updateState({action:g.current??Ot.UPDATE,lifecycle:Xe.READY,waiting:!1}))},100)}}return()=>{L()}},[t,r,d,f,v,c]),m.useEffect(()=>{if(!j.current)return;const{hasChanged:D,hasChangedTo:O,previous:M}=Lo(b.current,j.current),K=N.current;if(!K)return;const z=Es(K.target),F=!!z;if(F&&Xp(z)){if(O("lifecycle",Xe.READY)&&M.lifecycle===Xe.INIT&&r(cr.STEP_BEFORE,K,{action:g.current??b.current.action}),O("lifecycle",Xe.READY)){const $=b.current,W=zle(K,$,k.current.continuous)?Xe.TOOLTIP:Xe.BEACON,E=Es(K.scrollTarget??K.spotlightTarget??K.target),Q=tE({isFirstStep:$.index===0,scrollToFirstStep:k.current.scrollToFirstStep,step:K,target:E,targetLifecycle:W}),V=W===Xe.TOOLTIP?Xe.TOOLTIP_BEFORE:Xe.BEACON_BEFORE;pr(k.current.debug,`step:${d}`,"scroll",Q?"needed":"skipped"),c.current.updateState({action:Ot.UPDATE,lifecycle:V,scrolling:Q})}}else if(b.current.status===It.RUNNING&&f!==Xe.INIT&&f!==Xe.COMPLETE&&D("lifecycle")){pr(k.current.debug,`step:${d}`,F?"Target not visible":"Target not mounted",K),t(K,"target_not_found"),r(cr.TARGET_NOT_FOUND,K);const $=b.current;$.controlled||c.current.updateState({action:Ot.UPDATE,index:$.index+($.action===Ot.PREV?-1:1),lifecycle:Xe.INIT})}},[t,r,d,f,c]),m.useEffect(()=>{if(!j.current)return;const{hasChangedTo:D,previous:O}=Lo(b.current,j.current),M=N.current,K=C.current;if(M&&D("lifecycle",Xe.TOOLTIP_BEFORE)&&O.lifecycle===Xe.BEACON){const $=Es(M.scrollTarget??M.spotlightTarget??M.target);if(tE({isFirstStep:b.current.index===0,scrollToFirstStep:k.current.scrollToFirstStep,step:M,target:$,targetLifecycle:Xe.TOOLTIP})){c.current.updateState({scrolling:!0,positioned:!1});return}}const z=f===Xe.BEACON_BEFORE||f===Xe.TOOLTIP_BEFORE;if(M&&z&&!h){const $=f===Xe.TOOLTIP_BEFORE?Xe.TOOLTIP:Xe.BEACON;c.current.updateState({action:Ot.UPDATE,lifecycle:$})}M&&D("lifecycle",Xe.BEACON)&&r(cr.BEACON,M),M&&D("lifecycle",Xe.TOOLTIP)&&r(cr.TOOLTIP,M);const F=b.current;if((F.status===It.RUNNING||F.controlled&&F.status===It.PAUSED&&M)&&K&&D("lifecycle",Xe.COMPLETE)&&O.lifecycle===Xe.TOOLTIP&&(r(cr.STEP_AFTER,K,{action:g.current??Ot.UPDATE,index:O.index??F.index,lifecycle:F.lifecycle}),K.after)){r(cr.STEP_AFTER_HOOK,K,{action:g.current??Ot.UPDATE,index:O.index??F.index,lifecycle:F.lifecycle});try{K.after({...c.current.getState(),action:g.current??Ot.UPDATE,index:O.index??F.index,lifecycle:F.lifecycle,step:K})}catch{}}},[r,f,p,h,c]),m.useEffect(()=>{if(!j.current)return;const{hasChangedTo:D,previous:O}=Lo(b.current,j.current),M=N.current,K=C.current;y&&!M&&f===Xe.INIT&&c.current.updateState({action:Ot.UPDATE,lifecycle:Xe.COMPLETE,status:It.FINISHED}),!b.current.controlled&&v===It.RUNNING&&D("lifecycle",Xe.COMPLETE)&&d<y&&c.current.updateState({action:Ot.UPDATE,lifecycle:Xe.INIT}),D("lifecycle",Xe.COMPLETE)&&d>=y&&c.current.updateState({action:Ot.UPDATE,lifecycle:Xe.COMPLETE,status:It.FINISHED});const z=M??K??zv(k.current,k.current.steps[d-1]);if(z&&D("status",[It.FINISHED,It.SKIPPED])){let F;M?F=d:K?F=O.index??d:F=d-1,r(cr.TOUR_END,z,{index:F}),b.current.controlled||I.current.reset(),g.current=null}M&&D("action",Ot.STOP)&&(g.current=null,r(cr.TOUR_STATUS,M)),M&&D("action",Ot.RESET)&&(r(cr.TOUR_STATUS,M),g.current=null)},[u,r,d,f,y,v,c])}function Yle({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),f=m.useRef(r),p=m.useRef(e);f.current=r,p.current=e,m.useEffect(()=>{const h=d.current;if(d.current=n,!h||n===h)return;const{hasChanged:y}=Lo(n,h);if(Av(h.steps,u)||(w$(u,o)?s.current.setSteps(u):(pr(o,"tour","Steps are not valid",u),t(cr.ERROR,u[0]??{target:"",content:""},{error:new Error("Steps are not valid")}))),y("run"))l?s.current.getState().size&&p.current.start(c??a):p.current.stop();else if(Sr.number(c)&&y("stepIndex")){const v=Sr.number(h.stepIndex)&&h.stepIndex<c?Ot.NEXT:Ot.PREV;[It.FINISHED,It.SKIPPED].includes(f.current.status)||s.current.updateState({action:v,index:c,lifecycle:Xe.INIT,positioned:!1},!0)}},[o,t,a,n,l,c,u,s])}function Gle(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 f=Jle(n);["bottom"].includes(n.placement)||(a+=Math.floor(f-s))}else if(r===Xe.TOOLTIP_BEFORE){const{placement:f}=o;if(f==="top"){const p=((l=document.querySelector(".react-joyride__floater"))==null?void 0:l.getBoundingClientRect().height)??0,h=(c=o.floatingOptions)!=null&&c.hideArrow?0:o.arrowSize,y=o.offset+o.spotlightPadding.top+h;a-=p+y}else if(f==="left"||f==="right"){const p=((u=document.querySelector(".react-joyride__floater"))==null?void 0:u.getBoundingClientRect().height)??0,h=((d=Es(o.target))==null?void 0:d.getBoundingClientRect().height)??0,y=s+o.spotlightPadding.top+h/2-p/2;y<s&&(a-=s-y)}}return Math.max(0,a)}function Jle(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 Xle({emitEvent:e,previousState:t,props:n,state:r,step:s,store:o}){const{index:a,lifecycle:l,positioned:c,scrolling:u,status:d}=r,f=m.useRef(null),p=m.useRef(r),h=m.useRef(t),y=m.useRef(n),v=m.useRef(s);p.current=r,h.current=t,y.current=n,v.current=s,m.useEffect(()=>()=>{var w;(w=f.current)==null||w.call(f)},[]),m.useEffect(()=>{var N;if(!h.current||!v.current)return;const{hasChangedTo:w}=Lo(p.current,h.current),g=v.current,{debug:k}=y.current,{scrollDuration:b}=g,j=l===Xe.BEACON_BEFORE||l===Xe.TOOLTIP_BEFORE;if(d===It.RUNNING&&j&&u&&w("positioned",!0)){const C=Es(g.scrollTarget??g.spotlightTarget??g.target),I=o.current.getPositionData("beacon"),R=eu(C),H=R?!R.isSameNode(Ur()):!1;(N=f.current)==null||N.call(f),(async()=>{if(H&&!tu(R)){const F=Ur(),$=Tle(R),W={initial:F.scrollTop,target:$,element:F,duration:b};e(cr.SCROLL_START,g,{scroll:W});const{cancel:E,promise:Q}=nE($,{element:F,duration:b});f.current=E,await Q,e(cr.SCROLL_END,g,{scroll:W})}const L=Math.floor(Mle(C,g.scrollOffset))||0,D=H?L:Gle(L,{beaconPosition:I,lifecycle:l,scrollOffset:g.scrollOffset,step:g});pr(k,`step:${a}`,"scroll",H?"custom":"document",`${L} → ${D}`);const O=R,M={initial:O.scrollTop,target:D,element:O,duration:b};e(cr.SCROLL_START,g,{scroll:M});const{cancel:K,promise:z}=nE(D,{element:O,duration:b});f.current=K,await z,e(cr.SCROLL_END,g,{scroll:M}),o.current.updateState({scrolling:!1})})().catch(()=>{o.current.updateState({scrolling:!1})})}},[e,a,l,c,u,d,o])}function Qle(e){const t=Moe(()=>Ale(Cle,e),[e]),{debug:n,initialStepIndex:r,onEvent:s,run:o,stepIndex:a,steps:l}=t,c=m.useRef(Hle(t)),u=GI.useSyncExternalStore(c.current.subscribe,c.current.getSnapshot,c.current.getServerSnapshot),[d,f]=m.useState([]),p=m.useCallback((N,C)=>{f(I=>[...I,{reason:C,step:N}])},[]),h=m.useCallback(()=>{f([])},[]);Kle(c,n);const y=Wle(c,n,h),v=qle(s,y,c),{index:w,size:g,status:k}=u,b=qM(u),j=m.useMemo(()=>zv(t,l[w]),[w,t,l]);return $oe(()=>{o&&g&&w$(l,n)&&y.start(a??r)}),Toe(()=>{o&&g&&k===It.IDLE&&c.current.updateState({status:It.READY})},[o,g,k]),Yle({controls:y,emitEvent:v,props:t,state:u,store:c}),Ule({addFailure:p,controls:y,emitEvent:v,previousState:b,props:t,state:u,step:j,store:c}),Xle({emitEvent:v,previousState:b,props:t,state:u,step:j,store:c}),{controls:y,failures:d,mergedProps:t,state:u,step:j,store:c}}function Zle(e){const[t,n]=m.useState(null);return m.useEffect(()=>{let r=null,s=!1;if(e)if(Sr.domElement(e))r=e,s=!0;else{const o=document.querySelector(e);o&&(r=o)}else{const o=document.createElement("div");o.id=_le,document.body.appendChild(o),r=o}return n(r),()=>{!r||s||r.parentNode===document.body&&document.body.removeChild(r)}},[e]),t}const ece={animation:"joyride-loader-spin 1s linear infinite",border:"5px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",borderTopColor:"#555"};function tce({nonce:e,step:t}){const{loaderComponent:n}=t,r=!!n;if(m.useEffect(()=>{if(r||document.getElementById("joyride-loader-animation"))return lf;const c=document.createElement("style");return c.id="joyride-loader-animation",e&&c.setAttribute("nonce",e),c.appendChild(document.createTextNode(`
|
|
321
|
-
@keyframes joyride-loader-spin {
|
|
322
|
-
to { transform: rotate(360deg); }
|
|
323
|
-
}
|
|
324
|
-
`)),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=ft.createElement(c,{step:t})}else l=ft.createElement("div",{style:{...ece,height:s,width:o,borderTopColor:t.primaryColor}});return ft.createElement("div",{className:"react-joyride__loader","data-testid":"loader",style:a},l)}const nce={height:0,isFixed:!1,left:0,top:0,width:0};function Vu(e,t){const n=Es(e);if(!n)return nce;const r=Fv(n),s=tu(n),o=Rle(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 rce(e,t,n){const[r,s]=m.useState(()=>Vu(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(f=>{const p=Vu(e,t);return f.top===p.top&&f.left===p.left&&f.width===p.width&&f.height===p.height&&f.isFixed===p.isFixed?f:p})},100)},[e,t]);m.useEffect(()=>{let f=null;const p=y=>{a.current=eu(y,!0),a.current&&a.current.addEventListener("scroll",u,{passive:!0}),window.addEventListener("scroll",u,{passive:!0}),window.addEventListener("resize",u),typeof ResizeObserver<"u"&&(c.current=new ResizeObserver(u),c.current.observe(y)),s(Vu(e,t))},h=Es(e);return h?p(h):(f=new MutationObserver(()=>{const y=Es(e);y&&(f==null||f.disconnect(),f=null,p(y))}),f.observe(document.body,{childList:!0,subtree:!0})),()=>{var y;f==null||f.disconnect(),a.current&&a.current.removeEventListener("scroll",u),window.removeEventListener("scroll",u),window.removeEventListener("resize",u),(y=c.current)==null||y.disconnect(),clearTimeout(o.current)}},[e,t,u]),m.useEffect(()=>{l.current&&!n&&s(Vu(e,t)),l.current=n},[n,e,t]);let d=r;return l.current&&!n&&(d=Vu(e,t)),d}function sce(e,t,n){let r=`M0 0H${e}V${t}H0Z`;return n&&(r+=` ${n}`),r}function sE(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 ice=[Xe.BEACON_BEFORE,Xe.BEACON];function oce(e){var z,F;const{blockTargetInteraction:t,continuous:n,hideOverlay:r,lifecycle:s,onClickOverlay:o,overlayClickAction:a,placement:l,portalElement:c,scrolling:u,spotlightPadding:d,spotlightRadius:f,spotlightTarget:p,styles:h,target:y,waiting:v}=e,w=Loe(),g=rce(p??y,d,u||v),k=m.useRef(null),b=(s===Xe.TOOLTIP||s===Xe.TOOLTIP_BEFORE)&&l!=="center",[j,N]=m.useState(!1),C=c?(z=k.current)==null?void 0:z.offsetParent:null,I=(C==null?void 0:C.clientWidth)??w.width,R=(C==null?void 0:C.clientHeight)??Ile()??w.height,H=((F=h.overlay)==null?void 0:F.backgroundColor)??"rgba(0, 0, 0, 0.5)",A=m.useMemo(()=>{const{backgroundColor:$,mixBlendMode:W,...E}=h.overlay;return{height:R,pointerEvents:"none",...E}},[R,h.overlay]),L=b&&!u&&!v;m.useEffect(()=>{L?requestAnimationFrame(()=>N(!0)):N(!1)},[L]);const D=n&&ice.includes(s),O=!n&&s!==Xe.TOOLTIP;if(r||!v&&(D||O))return null;let M="";if(L)if(c&&C){const $=Es(p??y);if($){const W=eE($),E=eE(C);M=sE(W.left-E.left-d.left,W.top-E.top-d.top,$.offsetWidth+d.left+d.right,$.offsetHeight+d.top+d.bottom,f)}}else M=sE(g.left,g.top,g.width,g.height,f);const K=sce(I,R,M);return ft.createElement("div",{ref:k,"aria-hidden":"true",className:"react-joyride__overlay","data-testid":"overlay",style:A},ft.createElement("svg",{className:"react-joyride__spotlight","data-testid":"spotlight",style:{height:R,left:0,position:g.isFixed?"fixed":"absolute",top:0,width:I}},ft.createElement("path",{d:K,fill:H,fillRule:"evenodd",onClick:o,style:{cursor:a?"pointer":"default",pointerEvents:"auto"}}),M&&ft.createElement("path",{d:M,fill:H,style:{opacity:j?0:1,pointerEvents:t?"auto":"none",transition:"opacity 0.2s"}}),M&&Object.keys(h.spotlight).length>0&&ft.createElement("path",{d:M,fill:"none",style:{pointerEvents:"none"},...h.spotlight})))}function x$(e){const{children:t,element:n}=e;return n?ur.createPortal(t,n):null}const ace='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), area[href], [tabindex]:not([tabindex="-1"]), [contenteditable]';function lce(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!e)return lf;n.current=document.activeElement;const r=o=>{if(o.key!=="Tab")return;const a=[...e.querySelectorAll(ace)],{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 to(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 cce(e,t,n){const[r]=e.split("-");switch(r){case"top":return{points:`0,0 ${t/2},${n} ${t},0`,...to(e,t,n)};case"bottom":return{points:`${t},${n} ${t/2},0 0,${n}`,...to(e,t,n)};case"left":return{points:`0,0 ${n},${t/2} 0,${t}`,...to(e,t,n)};case"right":return{points:`${n},${t} ${n},0 0,${t/2}`,...to(e,t,n)};default:return null}}function uce(e,t,n,r){if(!t)return{};const[s]=e.split("-");switch(s){case"top":return{bottom:-n,left:t.x??0,...to(e,r,n)};case"bottom":return{top:-n,left:t.x??0,...to(e,r,n)};case"left":return{right:-n,top:t.y??0,...to(e,r,n)};case"right":return{left:-n,top:t.y??0,...to(e,r,n)};default:return{}}}function dce({arrowComponent:e,arrowRef:t,base:n,placement:r,position:s,size:o,styles:a}){const l=e;let c=null;if(l){if(!to(r,n,o))return null;c=ft.createElement("span",{style:{flexShrink:0}},ft.createElement(l,{base:n,placement:r,size:o}))}else{const u=cce(r,n,o);if(!u)return null;c=ft.createElement("svg",{height:u.height,width:u.width,xmlns:"http://www.w3.org/2000/svg"},ft.createElement("polygon",{fill:"currentColor",points:u.points}))}return ft.createElement("span",{ref:t,className:"react-joyride__arrow","data-testid":"arrow",style:{...a,...uce(r,s,o,n),...s?{}:{visibility:"hidden"}}},c)}function fce(e){const{beaconComponent:t,continuous:n,index:r,isLastStep:s,locale:o,nonce:a,onInteract:l,shouldFocus:c,size:u,step:d,styles:f}=e,p=m.useRef(null),h=!!t;m.useEffect(()=>{if(h||document.getElementById("joyride-beacon-animation"))return lf;const w=document.createElement("style");w.id="joyride-beacon-animation",a&&w.setAttribute("nonce",a),w.appendChild(document.createTextNode(`
|
|
325
|
-
@keyframes joyride-beacon-inner {
|
|
326
|
-
20% {
|
|
327
|
-
opacity: 0.9;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
90% {
|
|
331
|
-
opacity: 0.7;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
@keyframes joyride-beacon-outer {
|
|
336
|
-
0% {
|
|
337
|
-
transform: scale(1);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
45% {
|
|
341
|
-
opacity: 0.7;
|
|
342
|
-
transform: scale(0.75);
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
100% {
|
|
346
|
-
opacity: 0.9;
|
|
347
|
-
transform: scale(1);
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
`)),document.head.appendChild(w);const g=setTimeout(()=>{Sr.domElement(p.current)&&c&&p.current.focus()},0);return()=>{clearTimeout(g);const k=document.getElementById("joyride-beacon-animation");k!=null&&k.parentNode&&k.parentNode.removeChild(k)}},[h,a,c]);const y=Ji(o.open);let v;if(t){const w=t;v=ft.createElement(w,{continuous:n,index:r,isLastStep:s,size:u,step:d})}else v=ft.createElement("span",{style:f.beacon},ft.createElement("span",{style:f.beaconOuter}),ft.createElement("span",{style:f.beaconInner}));return ft.createElement("button",{ref:p,"aria-label":y,className:"react-joyride__beacon","data-testid":"button-beacon",onClick:l,onMouseEnter:l,style:f.beaconWrapper,title:y,type:"button"},v)}function pce({styles:e,...t}){const{color:n,height:r,width:s,...o}=e;return ft.createElement("button",{style:o,type:"button",...t},ft.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"},ft.createElement("g",null,ft.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 hce(e){const{backProps:t,closeProps:n,index:r,isLastStep:s,primaryProps:o,skipProps:a,step:l,tooltipProps:c}=e,{buttons:u,content:d,styles:f,title:p}=l,h={};u.includes("primary")&&(h.primary=ft.createElement("button",{"data-testid":"button-primary",style:f.buttonPrimary,type:"button",...o})),u.includes("skip")&&!s&&(h.skip=ft.createElement("button",{"aria-live":"off","data-testid":"button-skip",style:f.buttonSkip,type:"button",...a})),u.includes("back")&&r>0&&(h.back=ft.createElement("button",{"data-testid":"button-back",style:f.buttonBack,type:"button",...t})),h.close=u.includes("close")&&ft.createElement(pce,{"data-testid":"button-close",styles:f.buttonClose,...n});const y=p?{"aria-labelledby":"joyride-tooltip-title","aria-describedby":"joyride-tooltip-content"}:{"aria-label":Ji(d),"aria-describedby":"joyride-tooltip-content"};return ft.createElement("div",{key:"JoyrideTooltip",className:"react-joyride__tooltip","data-joyride-step":r,...l.id&&{"data-joyride-id":l.id},style:f.tooltip,...c,...y},ft.createElement("div",{style:f.tooltipContainer},p&&ft.createElement("h4",{id:"joyride-tooltip-title",style:f.tooltipTitle},p),ft.createElement("div",{id:"joyride-tooltip-content",style:f.tooltipContent},d)),u.some(v=>v==="back"||v==="primary"||v==="skip")&&ft.createElement("div",{style:f.tooltipFooter},ft.createElement("div",{style:f.tooltipFooterSpacer},h.skip),h.back,h.primary),h.close)}function mce(e){const{continuous:t,controls:n,index:r,isLastStep:s,size:o,step:a}=e,l=g=>{g.preventDefault(),n.prev(ki.BUTTON_BACK)},c=g=>{g.preventDefault(),a.closeButtonAction==="skip"?n.skip(ki.BUTTON_CLOSE):n.close(ki.BUTTON_CLOSE)},u=g=>{if(g.preventDefault(),!t){n.close(ki.BUTTON_PRIMARY);return}n.next(ki.BUTTON_PRIMARY)},d=g=>{g.preventDefault(),n.skip(ki.BUTTON_SKIP)},f=()=>{const{back:g,close:k,last:b,next:j,nextWithProgress:N,skip:C}=a.locale,I=Ji(g),R=Ji(k),H=Ji(b),A=Ji(j),L=Ji(C);let D=k,O=R;if(t){if(D=j,O=A,a.showProgress&&!s){const M=Ji(N,{step:r+1,steps:o});D=Mb(N,r+1,o),O=M}s&&(D=b,O=H)}return{backProps:{"aria-label":I,children:g,"data-action":"back",onClick:l,role:"button",title:I},closeProps:{"aria-label":R,children:k,"data-action":"close",onClick:c,role:"button",title:R},primaryProps:{"aria-label":O,children:D,"data-action":"primary",onClick:u,role:"button",title:O},skipProps:{"aria-label":L,children:C,"data-action":"skip",onClick:d,role:"button",title:L},tooltipProps:{"aria-modal":!0,role:"alertdialog"}}},{arrowComponent:p,beaconComponent:h,tooltipComponent:y,...v}=a;let w;if(y){const g=y;w=ft.createElement(g,{...f(),continuous:t,controls:n,index:r,isLastStep:s,size:o,step:v})}else w=ft.createElement(hce,{...f(),continuous:t,controls:n,index:r,isLastStep:s,size:o,step:v});return w}function gce(e){if(e.startsWith("left"))return["top","bottom"];if(e.startsWith("right"))return["bottom","top"]}function yce(e,t,n){var r,s;return e?[kle()]:((r=t.floatingOptions)==null?void 0:r.flipOptions)===!1?[]:[ble({crossAxis:!1,fallbackPlacements:gce(n),padding:20,...(s=t.floatingOptions)==null?void 0:s.flipOptions})]}function wce(e){var W,E,Q,V,B;const{continuous:t,controls:n,index:r,lifecycle:s,nonce:o,open:a,portalElement:l,setPositionData:c,setTooltipRef:u,shouldScroll:d,size:f,step:p,target:h,updateState:y}=e,v=m.useRef(null),w=m.useRef({}),g=m.useRef({}),k=p.placement==="center",b=p.placement==="auto",j=m.useMemo(()=>({getBoundingClientRect:()=>({x:window.innerWidth/2,y:window.innerHeight/2,top:window.innerHeight/2,left:window.innerWidth/2,bottom:window.innerHeight/2,right:window.innerWidth/2,width:0,height:0})}),[]),N=m.useMemo(()=>m$(h)?eu(h):void 0,[h]),C=m.useMemo(()=>tu(h),[h]),I=m.useMemo(()=>N?{boundary:N,rootBoundary:"viewport"}:{},[N]),R=k||b?"bottom":p.placement,H=k?"fixed":((W=p.floatingOptions)==null?void 0:W.strategy)??(p.isFixed||C?"fixed":"absolute"),A=m.useMemo(()=>{var re,ue,G,ee;return k?[{name:"center",fn:({rects:te})=>({x:(window.innerWidth-te.floating.width)/2,y:(window.innerHeight-te.floating.height)/2})}]:[X_(({placement:te})=>{var ce;let ne="right";te.startsWith("top")?ne="top":te.startsWith("bottom")?ne="bottom":te.startsWith("left")&&(ne="left");const Z=p.spotlightTarget?0:p.spotlightPadding[ne];return p.offset+Z+((ce=p.floatingOptions)!=null&&ce.hideArrow?0:p.arrowSize)},[p.offset,p.spotlightPadding,p.spotlightTarget,p.arrowSize,(re=p.floatingOptions)==null?void 0:re.hideArrow]),...yce(b,p,R),xle({padding:10,...I,...(ue=p.floatingOptions)==null?void 0:ue.shiftOptions}),...(G=p.floatingOptions)!=null&&G.hideArrow?[]:[vle({element:v,padding:p.arrowSpacing},[p.arrowSpacing,p.arrowBase])],...((ee=p.floatingOptions)==null?void 0:ee.middleware)??[]]},[k,p,b,R,I]),L=J_({...k?{elements:{reference:j}}:{},placement:R,strategy:H,middleware:A}),D=J_({strategy:H,placement:p.beaconPlacement??(b||k?"bottom":p.placement),middleware:m.useMemo(()=>{var re,ue;return[X_(((ue=(re=p.floatingOptions)==null?void 0:re.beaconOptions)==null?void 0:ue.offset)??-18)]},[(Q=(E=p.floatingOptions)==null?void 0:E.beaconOptions)==null?void 0:Q.offset]),whileElementsMounted:U_});g.current=L.middlewareData,w.current=D.middlewareData,m.useEffect(()=>{var G;const{floating:re,reference:ue}=L.elements;if(!(!ue||!re||s!==Xe.TOOLTIP))return U_(ue,re,L.update,(G=p.floatingOptions)==null?void 0:G.autoUpdate)},[s,L.update,(V=p.floatingOptions)==null?void 0:V.autoUpdate,p.target,L.elements]),m.useEffect(()=>{!k&&h&&L.refs.setReference(h),h&&D.refs.setReference(h)},[D.refs,k,h,L.refs]),m.useEffect(()=>{L.isPositioned&&c("tooltip",{placement:L.placement,x:L.x??0,y:L.y??0,middlewareData:g.current})},[c,L.isPositioned,L.placement,L.x,L.y]),m.useEffect(()=>{D.isPositioned&&c("beacon",{placement:D.placement,x:D.x??0,y:D.y??0,middlewareData:w.current})},[c,D.isPositioned,D.placement,D.x,D.y]);const O=p.zIndex+100,M=m.useCallback(re=>{re.type==="mouseenter"&&p.beaconTrigger!=="hover"||y({lifecycle:Xe.TOOLTIP_BEFORE,positioned:!1})},[p.beaconTrigger,y]),K=m.useCallback(re=>{re&&(L.refs.setFloating(re),u(re))},[L.refs,u]),{arrow:z,floater:F}=p.styles;let $=null;if(s===Xe.TOOLTIP||s===Xe.TOOLTIP_BEFORE){const re=Z_({...F,...L.floatingStyles,zIndex:O,opacity:a&&L.isPositioned?1:0,...!a&&{transition:"none"}});$=ft.createElement("div",{ref:K,className:"react-joyride__floater","data-testid":"floater",id:`react-joyride-step-${r}`,style:re},ft.createElement(mce,{continuous:t,controls:n,index:r,isLastStep:r+1===f,size:f,step:p}),!k&&!((B=p.floatingOptions)!=null&&B.hideArrow)&&ft.createElement(dce,{arrowComponent:p.arrowComponent,arrowRef:v,base:p.arrowBase,placement:L.placement,position:L.middlewareData.arrow,size:p.arrowSize,styles:z}))}else(s===Xe.BEACON||s===Xe.BEACON_BEFORE)&&($=ft.createElement("div",{ref:D.refs.setFloating,className:"react-joyride__floater","data-testid":"floater-beacon",id:`react-joyride-step-${r}-beacon`,style:Z_({...D.floatingStyles,zIndex:O})},ft.createElement(fce,{beaconComponent:p.beaconComponent,continuous:t,index:r,isLastStep:r+1===f,locale:p.locale,nonce:o,onInteract:M,shouldFocus:d,size:f,step:p,styles:p.styles})));return ft.createElement(x$,{element:l},$)}function xce(e){const{continuous:t,controls:n,index:r,lifecycle:s,nonce:o,portalElement:a,setPositionData:l,shouldScroll:c,size:u,step:d,updateState:f}=e,[p,h]=m.useState(null);lce(d.disableFocusTrap?null:p,"[data-action=primary]");const y=Es(d.target),v=s===Xe.TOOLTIP;return!y$(d)||!Sr.domElement(y)?null:ft.createElement(wce,{key:`JoyrideStep-${r}`,continuous:t,controls:n,index:r,lifecycle:s,nonce:o,open:v,portalElement:a,setPositionData:l,setTooltipRef:h,shouldScroll:c,size:u,step:d,target:y,updateState:f})}function bce({controls:e,mergedProps:t,state:n,step:r,store:s}){const{continuous:o,debug:a,nonce:l,portalElement:c,scrollToFirstStep:u}=t,d=Zle(c),{index:f,lifecycle:p,status:h}=n,y=h===It.RUNNING,[v,w]=m.useState(!1),g=m.useRef(null),k=(r==null?void 0:r.loaderDelay)??0;m.useEffect(()=>(n.waiting?k===0?w(!0):g.current=setTimeout(()=>{w(!0)},k):w(!1),()=>{g.current&&(clearTimeout(g.current),g.current=null)}),[k,n.waiting]),m.useEffect(()=>{if(!y)return;const N=C=>{!r||p!==Xe.TOOLTIP||C.key==="Escape"&&r.dismissKeyAction&&(r.dismissKeyAction==="next"?e.next(ki.KEYBOARD):e.close(ki.KEYBOARD))};return document.body.addEventListener("keydown",N,{passive:!0}),()=>{document.body.removeEventListener("keydown",N)}},[e,y,p,r]);const b=m.useCallback(()=>{(r==null?void 0:r.overlayClickAction)==="close"?e.close(ki.OVERLAY):(r==null?void 0:r.overlayClickAction)==="next"&&e.next(ki.OVERLAY)},[e,r==null?void 0:r.overlayClickAction]);if(!r||!y)return null;const j=n.action===Ot.START&&!r.skipBeacon&&r.placement!=="center";return ft.createElement(ft.Fragment,null,p!==Xe.INIT&&ft.createElement(xce,{...n,continuous:o,controls:e,debug:a,nonce:l,portalElement:d,setPositionData:s.current.setPositionData,shouldScroll:!r.skipScroll&&(f!==0||u),step:r,updateState:s.current.updateState}),ft.createElement(x$,{element:d},ft.createElement(ft.Fragment,null,v&&ft.createElement(tce,{nonce:l,step:r}),!j&&ft.createElement(oce,{...r,continuous:o,lifecycle:p,onClickOverlay:b,portalElement:c?d:null,scrolling:n.scrolling,waiting:n.waiting}))))}function kce(e){const{controls:t,failures:n,mergedProps:r,state:s,step:o,store:a}=Qle(e);return{controls:t,failures:n,on:m.useCallback((l,c)=>a.current.on(l,c),[a]),state:m.useMemo(()=>Tm(s,"positioned"),[s]),step:o,Tour:Dv()?ft.createElement(bce,{controls:t,mergedProps:r,state:s,step:o,store:a}):null}}function vce(e){const{Tour:t}=kce(e);return t}function Sce(e){return Dv()?ft.createElement(vce,e):null}function jce(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 Nce(e){return[{target:"body",content:e("onboarding:flow.intro"),disableBeacon:!0,placement:"center"}]}function Cce(e){return[{target:"body",content:e("onboarding:flow.introEmpty"),disableBeacon:!0,placement:"center"}]}const Zp="af:onboarding";function _ce({page:e,hasNodes:t=!1}){const{t:n}=$r(),[r,s]=m.useState(!1),[o,a]=m.useState([]),l=m.useRef(null),c=m.useMemo(()=>e==="projects"?jce(n):t?Nce(n):Cce(n),[e,t,n]);return m.useEffect(()=>{const u=localStorage.getItem(Zp),d=u?JSON.parse(u):{};if(d.completed||d[e]){s(!1),a([]);return}localStorage.setItem(Zp,JSON.stringify({...d,[e]:!0})),a(c),s(!0)},[e,t,c]),m.useEffect(()=>{if(!r)return;const u=d=>{var y;const f=d.target.closest("button");if(!f||!f.closest(".react-joyride__tooltip"))return;const h=(y=f.textContent)==null?void 0:y.trim();if(h===n("onboarding:done")||h===n("onboarding:startCreate")||h===n("onboarding:skip")){const v=localStorage.getItem(Zp)||"{}",w=JSON.parse(v);h===n("onboarding:skip")?(w.projects=!0,w.flow=!0,w.completed=!0):w[e]=!0,localStorage.setItem(Zp,JSON.stringify(w)),a([]),s(!1),e==="projects"&&(h===n("onboarding:done")||h===n("onboarding:startCreate"))&&(localStorage.setItem("af:newPipelineGuide","true"),setTimeout(()=>{const g=document.querySelector(".af-create-btn");g&&g.click()},500))}};return document.addEventListener("click",u,!0),()=>document.removeEventListener("click",u,!0)},[r,e,n]),!r||o.length===0?null:i.jsx(Sce,{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})}const Ece="agentflow:recent-runs:v1",Ace="agentflow:recent-runs:poller",Pce=3e3,Ice=8e3,Rce=2e3,iE=5e3,Tce=16e3,oE=[1e4,3e4,6e4];function Mce(e){return oE[Math.min(Math.max(e-1,0),oE.length-1)]}function $ce(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function Lce(e){if(!e)return"暂无成功记录";try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return"暂无成功记录"}}function Oce(){const{navigate:e,path:t}=gs(),[n,r]=m.useState([]),[s,o]=m.useState(!1),[a,l]=m.useState(1),[c,u]=m.useState({status:"idle",failureCount:0,lastSuccessAt:0,message:""}),d=m.useRef(()=>{});m.useEffect(()=>{let j=!1,N=!1,C=!1,I=null,R=0,H=0,A=0,L=0,D=null,O=0,M=0;const K=$ce(),z=new Map,F=typeof BroadcastChannel=="function"?new BroadcastChannel(Ece):null,$=Ce=>{try{F==null||F.postMessage({...Ce,tabId:K,sentAt:Date.now()})}catch{}},W=()=>{const Ce=Date.now()-Tce;for(const[_e,Be]of z)Be<Ce&&z.delete(_e);l(1+z.size)},E=(Ce="presence")=>{$({type:Ce,visible:!document.hidden})},Q=Ce=>{if(!j&&(Array.isArray(Ce.runs)&&r(Ce.runs),Ce.syncHealth&&typeof Ce.syncHealth=="object")){const _e=Ce.syncHealth;O=Number(_e.failureCount)||0,M=Number(_e.lastSuccessAt)||0,u(_e)}},V=Ce=>{Q(Ce),$({type:"state",...Ce})},B=()=>{R&&(window.clearTimeout(R),R=0)},re=Ce=>{B(),!(j||!N||document.hidden)&&(R=window.setTimeout(()=>{R=0,ue()},Math.max(0,Ce)))},ue=async()=>{if(j||!N||document.hidden||D)return;const Ce=new AbortController;D=Ce;let _e=!1;const Be=window.setTimeout(()=>{_e=!0,Ce.abort()},Ice);try{const at=await fetch("/api/pipeline-recent-runs",{signal:Ce.signal});if(!at.ok)throw new Error(`HTTP ${at.status}`);const yt=await at.json();if(j||!N||document.hidden)return;O=0,M=Date.now();const Te=Array.isArray(yt.runs)?yt.runs:[];V({runs:Te.filter(it=>it&&it.status==="running"),syncHealth:{status:"ok",failureCount:0,lastSuccessAt:M,message:""}}),re(Pce)}catch(at){const yt=Ce.signal.aborted&&!_e;if(j||!N||document.hidden||yt)return;O+=1,V({syncHealth:{status:"delayed",failureCount:O,lastSuccessAt:M,message:_e?"运行状态同步超过 8 秒未响应":`运行状态同步失败:${String((at==null?void 0:at.message)||at)}`}}),re(Mce(O))}finally{window.clearTimeout(Be),D===Ce&&(D=null)}},G=()=>{B(),D&&(D.abort(),D=null)},ee=()=>{if(G(),I){const Ce=I;I=null,Ce()}N=!1},te=(Ce=Rce)=>{H&&window.clearTimeout(H),!(j||document.hidden||N||C)&&(H=window.setTimeout(()=>{H=0,Z()},Ce))},ne=()=>{j||document.hidden||N||(N=!0,re(0))},Z=async()=>{var Ce;if(!(j||document.hidden||N||C)){if(!((Ce=navigator.locks)!=null&&Ce.request)){ne();return}C=!0;try{await navigator.locks.request(Ace,{mode:"exclusive",ifAvailable:!0},async _e=>{if(C=!1,!_e||j||document.hidden){te();return}N=!0,re(0),await new Promise(Be=>{I=Be}),I=null,N=!1})}catch{C=!1}finally{te()}}},ce=()=>{if(!j){if(N){O=0,re(0);return}$({type:"retry"}),te(0)}};d.current=ce,F&&(F.onmessage=Ce=>{const _e=Ce.data;if(!(!_e||_e.tabId===K)){if(_e.type==="hello"||_e.type==="presence"){z.set(_e.tabId,Date.now()),W(),_e.type==="hello"&&E();return}if(_e.type==="bye"){z.delete(_e.tabId),W(),te(0);return}if(_e.type==="state"){z.set(_e.tabId,Date.now()),W(),Q(_e);return}_e.type==="retry"&&N&&(O=0,re(0))}});const de=()=>{E(),document.hidden?ee():te(0)},me=()=>{E("bye"),ee()},$e=()=>{E("hello"),te(0)};return document.addEventListener("visibilitychange",de),window.addEventListener("pagehide",me),window.addEventListener("pageshow",$e),E("hello"),A=window.setInterval(E,iE),L=window.setInterval(W,iE),te(0),()=>{j=!0,d.current=()=>{},E("bye"),ee(),H&&window.clearTimeout(H),A&&window.clearInterval(A),L&&window.clearInterval(L),document.removeEventListener("visibilitychange",de),window.removeEventListener("pagehide",me),window.removeEventListener("pageshow",$e),F==null||F.close()}},[]);const f=j=>{const N=new URLSearchParams({flowId:j.flowId,flowSource:j.flowSource||"workspace"});e(`/flow?${N.toString()}`),o(!1)},p=t==="/flow"?new URLSearchParams(window.location.search):null,h=(p==null?void 0:p.get("flowId"))||"",y=c.status==="delayed",v=a>1,w=n.length===1;if(n.length===0&&!y)return null;const g=y?"状态同步延迟":n.length>0?w?n[0].flowId:`${n.length} running`:"",k=y?`${c.message}${v?`;检测到 ${a} 个 AgentFlow 标签页`:""}`:v?`已合并 ${a} 个 AgentFlow 标签页的运行状态同步`:w?`${n[0].flowId} 运行中,点击跳转`:`${n.length} 个 pipeline 运行中`,b=()=>{if(!y&&!v&&w){f(n[0]);return}o(j=>!j)};return i.jsxs("div",{className:"af-run-indicator"+(y?" af-run-indicator--delayed":"")+(v?" af-run-indicator--coordinated":""),role:"status","aria-live":"polite",children:[s&&i.jsxs("div",{className:"af-run-indicator__menu",onMouseLeave:()=>o(!1),children:[(y||v)&&i.jsxs("div",{className:"af-run-indicator__sync",children:[i.jsx("div",{className:"af-run-indicator__sync-title",children:y?"运行状态同步延迟":"多标签页同步已合并"}),i.jsx("div",{className:"af-run-indicator__sync-copy",children:v?`检测到 ${a} 个 AgentFlow 标签页。当前只由一个可见标签页请求运行状态,后台页面不会重复建立连接。`:"运行状态接口暂未及时返回,已停止重复请求并自动降低刷新频率。"}),y&&i.jsxs("div",{className:"af-run-indicator__sync-meta",children:["最近成功:",Lce(c.lastSuccessAt)]}),y&&i.jsx("button",{type:"button",className:"af-run-indicator__retry",onClick:j=>{j.stopPropagation(),d.current()},children:"立即重试"})]}),n.map(j=>i.jsxs("button",{type:"button",className:"af-run-indicator__item"+(j.flowId===h?" af-run-indicator__item--current":""),onClick:()=>f(j),title:`${j.flowId} · ${j.runId}`,children:[i.jsx("span",{className:"af-run-indicator__dot"}),i.jsx("span",{className:"af-run-indicator__flow",children:j.flowId}),i.jsx("span",{className:"af-run-indicator__run",children:j.runId.slice(0,12)})]},`${j.flowId}:${j.runId}`))]}),i.jsxs("button",{type:"button",className:"af-run-indicator__btn",onClick:b,title:k,children:[i.jsx("span",{className:"af-run-indicator__pulse"}),i.jsx("span",{className:"af-run-indicator__label",children:g})]})]})}const Rw="0.1.133",Dce=6e4,Fce=30*6e4;function Wc(e){return String(e||"").trim().replace(/^v/i,"")}function zce(e,t){const n=Wc(e),r=Wc(t);return!!(n&&r&&n!==r)}function Bce(e,t){return`agentflow.app-version.snooze:${Wc(e)}:${Wc(t)}`}function Hce(e){if(!e)return 0;try{const t=Number(window.sessionStorage.getItem(e));return Number.isFinite(t)?t:0}catch{return 0}}function Wce(){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=Wc(u.version);if(!zce(Rw,d)){t(null);return}const f=Bce(Rw,d);if(Hce(f)>Date.now())return;t({clientVersion:Wc(Rw),serverVersion:d,startedAt:String(u.startedAt||""),snoozeKey:f})}catch{}finally{s=!1}}},a=()=>{document.visibilityState==="visible"&&o()},l=window.setInterval(()=>void o(),Dce);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()+Fce))}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 b$(e){return e==="/likee-context"||e==="/likee_context"}function Vce(e){if(e!=="/workspace")return!1;const t=new URLSearchParams(window.location.search);return!!String(t.get("workflowShare")||"").trim()}function Kce(){const{navigate:e}=gs();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 qce 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 Uce({authUser:e}){const{path:t}=gs();return t==="/projects"||t==="/"?i.jsx(Ol,{authUser:e}):t==="/nodes"?i.jsx(Ol,{authUser:e,resourceKind:"nodes"}):t==="/my-nodes"?i.jsx(Ol,{authUser:e,resourceKind:"my-nodes"}):t==="/my-flows"?i.jsx(Ol,{authUser:e,resourceKind:"my-flows"}):t==="/skills"?i.jsx(Ol,{authUser:e,resourceKind:"skills"}):t==="/workspaces"?i.jsx(ioe,{authUser:e}):t==="/workflows"?i.jsx(doe,{}):t==="/mcps"?i.jsx(Uie,{}):t==="/schedules"?i.jsx(Xie,{}):t==="/node-studio"?i.jsx(Zie,{}):t==="/flow"?i.jsx(Kce,{}):t==="/workspace"?i.jsx(EM,{}):t.startsWith("/display")?i.jsx(IM,{}):t==="/settings"?i.jsx(Rie,{authUser:e}):t==="/admin/usage"?i.jsx(zie,{authUser:e}):t==="/feedback"?i.jsx(Hie,{authUser:e}):b$(t)?i.jsx(VM,{}):i.jsx(Ol,{})}function Yce({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(""),f=async()=>{try{const y=await(await fetch("/api/auth/me")).json().catch(()=>({}));n({loading:!1,authenticated:!!y.authenticated,user:y.user||null,setupRequired:!!y.setupRequired}),d(y.error?String(y.error):"")}catch(h){n({loading:!1,authenticated:!1,user:null,setupRequired:!1}),d(String(h.message||h))}};m.useEffect(()=>{f()},[]);const p=async h=>{h.preventDefault(),c(!0),d("");try{const y=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,password:o})}),v=await y.json().catch(()=>({}));if(!y.ok)throw new Error(v.error||"登录失败");s(""),a(""),window.location.replace(window.location.href);return}catch(y){d(String(y.message||y))}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:p,autoComplete:"on",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",{id:"agentflow-auth-username",name:"username",type:"text",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",{id:"agentflow-auth-password",name:"password",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 Gce({authUser:e,onLogout:t}){const{path:n}=gs(),r=n==="/flow"||n==="/workspace";return i.jsxs("div",{className:"af-app",children:[n!=="/settings"?i.jsx(_ce,{page:r?"flow":"projects"}):null,r?null:i.jsx(UD,{authUser:e,onLogout:t}),i.jsx("div",{className:r?"af-main af-main--pipeline":"af-main",children:i.jsx(Uce,{authUser:e})}),i.jsx(Oce,{})]})}function Jce(){return i.jsx(qce,{children:i.jsxs(ED,{children:[i.jsx(Xce,{}),i.jsx(Wce,{})]})})}function Xce(){const{path:e}=gs();return e.startsWith("/display")?i.jsx(IM,{}):b$(e)?i.jsx(VM,{}):Vce(e)?i.jsx(EM,{}):i.jsx(Yce,{children:({user:t,onLogout:n})=>i.jsx(Gce,{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 aE=document.querySelector('link[rel="icon"]');aE&&(aE.href=SP);Tw.createRoot(document.getElementById("root")).render(i.jsx(ft.StrictMode,{children:i.jsx(Jce,{})}));
|