@fieldwangai/agentflow 0.1.101 → 0.1.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/lib/ui-server.mjs +917 -46
- package/bin/lib/workspace-collaboration.mjs +336 -0
- package/bin/lib/workspace-graph-merge.mjs +208 -0
- package/builtin/web-ui/dist/assets/index-CjR04ruh.js +348 -0
- package/builtin/web-ui/dist/assets/index-DhNqbtUT.css +1 -0
- package/builtin/web-ui/dist/index.html +2 -2
- package/package.json +1 -1
- package/builtin/web-ui/dist/assets/index-DBiy5eMk.js +0 -346
- package/builtin/web-ui/dist/assets/index-DKaacU6h.css +0 -1
|
@@ -1,346 +0,0 @@
|
|
|
1
|
-
var TM=Object.defineProperty;var RM=(e,t,n)=>t in e?TM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var _n=(e,t,n)=>RM(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Eu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function zo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var dC={exports:{}},Lh={},fC={exports:{}},Et={};/**
|
|
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 hd=Symbol.for("react.element"),MM=Symbol.for("react.portal"),$M=Symbol.for("react.fragment"),LM=Symbol.for("react.strict_mode"),OM=Symbol.for("react.profiler"),DM=Symbol.for("react.provider"),FM=Symbol.for("react.context"),zM=Symbol.for("react.forward_ref"),BM=Symbol.for("react.suspense"),HM=Symbol.for("react.memo"),WM=Symbol.for("react.lazy"),l0=Symbol.iterator;function VM(e){return e===null||typeof e!="object"?null:(e=l0&&e[l0]||e["@@iterator"],typeof e=="function"?e:null)}var pC={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},hC=Object.assign,mC={};function oc(e,t,n){this.props=e,this.context=t,this.refs=mC,this.updater=n||pC}oc.prototype.isReactComponent={};oc.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")};oc.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function gC(){}gC.prototype=oc.prototype;function kw(e,t,n){this.props=e,this.context=t,this.refs=mC,this.updater=n||pC}var vw=kw.prototype=new gC;vw.constructor=kw;hC(vw,oc.prototype);vw.isPureReactComponent=!0;var c0=Array.isArray,yC=Object.prototype.hasOwnProperty,Sw={current:null},xC={key:!0,ref:!0,__self:!0,__source:!0};function wC(e,t,n){var r,s={},i=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(i=""+t.key),t)yC.call(t,r)&&!xC.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:hd,type:e,key:i,ref:a,props:s,_owner:Sw.current}}function KM(e,t){return{$$typeof:hd,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function Nw(e){return typeof e=="object"&&e!==null&&e.$$typeof===hd}function qM(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var u0=/\/+/g;function tg(e,t){return typeof e=="object"&&e!==null&&e.key!=null?qM(""+e.key):t.toString(36)}function ip(e,t,n,r,s){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case hd:case MM:a=!0}}if(a)return a=e,s=s(a),e=r===""?"."+tg(a,0):r,c0(s)?(n="",e!=null&&(n=e.replace(u0,"$&/")+"/"),ip(s,t,n,"",function(u){return u})):s!=null&&(Nw(s)&&(s=KM(s,n+(!s.key||a&&a.key===s.key?"":(""+s.key).replace(u0,"$&/")+"/")+e)),t.push(s)),1;if(a=0,r=r===""?".":r+":",c0(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+tg(i,l);a+=ip(i,t,n,c,s)}else if(c=VM(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+tg(i,l++),a+=ip(i,t,n,c,s);else if(i==="object")throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.");return a}function uf(e,t,n){if(e==null)return e;var r=[],s=0;return ip(e,r,"","",function(i){return t.call(n,i,s++)}),r}function UM(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 Er={current:null},op={transition:null},YM={ReactCurrentDispatcher:Er,ReactCurrentBatchConfig:op,ReactCurrentOwner:Sw};function bC(){throw Error("act(...) is not supported in production builds of React.")}Et.Children={map:uf,forEach:function(e,t,n){uf(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return uf(e,function(){t++}),t},toArray:function(e){return uf(e,function(t){return t})||[]},only:function(e){if(!Nw(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Et.Component=oc;Et.Fragment=$M;Et.Profiler=OM;Et.PureComponent=kw;Et.StrictMode=LM;Et.Suspense=BM;Et.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=YM;Et.act=bC;Et.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=hC({},e.props),s=e.key,i=e.ref,a=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,a=Sw.current),t.key!==void 0&&(s=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)yC.call(t,c)&&!xC.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:hd,type:e.type,key:s,ref:i,props:r,_owner:a}};Et.createContext=function(e){return e={$$typeof:FM,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:DM,_context:e},e.Consumer=e};Et.createElement=wC;Et.createFactory=function(e){var t=wC.bind(null,e);return t.type=e,t};Et.createRef=function(){return{current:null}};Et.forwardRef=function(e){return{$$typeof:zM,render:e}};Et.isValidElement=Nw;Et.lazy=function(e){return{$$typeof:WM,_payload:{_status:-1,_result:e},_init:UM}};Et.memo=function(e,t){return{$$typeof:HM,type:e,compare:t===void 0?null:t}};Et.startTransition=function(e){var t=op.transition;op.transition={};try{e()}finally{op.transition=t}};Et.unstable_act=bC;Et.useCallback=function(e,t){return Er.current.useCallback(e,t)};Et.useContext=function(e){return Er.current.useContext(e)};Et.useDebugValue=function(){};Et.useDeferredValue=function(e){return Er.current.useDeferredValue(e)};Et.useEffect=function(e,t){return Er.current.useEffect(e,t)};Et.useId=function(){return Er.current.useId()};Et.useImperativeHandle=function(e,t,n){return Er.current.useImperativeHandle(e,t,n)};Et.useInsertionEffect=function(e,t){return Er.current.useInsertionEffect(e,t)};Et.useLayoutEffect=function(e,t){return Er.current.useLayoutEffect(e,t)};Et.useMemo=function(e,t){return Er.current.useMemo(e,t)};Et.useReducer=function(e,t,n){return Er.current.useReducer(e,t,n)};Et.useRef=function(e){return Er.current.useRef(e)};Et.useState=function(e){return Er.current.useState(e)};Et.useSyncExternalStore=function(e,t,n){return Er.current.useSyncExternalStore(e,t,n)};Et.useTransition=function(){return Er.current.useTransition()};Et.version="18.3.1";fC.exports=Et;var m=fC.exports;const it=zo(m);/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.production.min.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var GM=m,JM=Symbol.for("react.element"),XM=Symbol.for("react.fragment"),QM=Object.prototype.hasOwnProperty,ZM=GM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,e$={key:!0,ref:!0,__self:!0,__source:!0};function kC(e,t,n){var r,s={},i=null,a=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(a=t.ref);for(r in t)QM.call(t,r)&&!e$.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:JM,type:e,key:i,ref:a,props:s,_owner:ZM.current}}Lh.Fragment=XM;Lh.jsx=kC;Lh.jsxs=kC;dC.exports=Lh;var o=dC.exports,Sy={},vC={exports:{}},os={},SC={exports:{}},NC={};/**
|
|
18
|
-
* @license React
|
|
19
|
-
* scheduler.production.min.js
|
|
20
|
-
*
|
|
21
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
22
|
-
*
|
|
23
|
-
* This source code is licensed under the MIT license found in the
|
|
24
|
-
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/(function(e){function t(I,F){var _=I.length;I.push(F);e:for(;0<_;){var X=_-1>>>1,V=I[X];if(0<s(V,F))I[X]=F,I[_]=V,_=X;else break e}}function n(I){return I.length===0?null:I[0]}function r(I){if(I.length===0)return null;var F=I[0],_=I.pop();if(_!==F){I[0]=_;e:for(var X=0,V=I.length,T=V>>>1;X<T;){var ee=2*(X+1)-1,ie=I[ee],G=ee+1,se=I[G];if(0>s(ie,_))G<V&&0>s(se,ie)?(I[X]=se,I[G]=_,X=G):(I[X]=ie,I[ee]=_,X=ee);else if(G<V&&0>s(se,_))I[X]=se,I[G]=_,X=G;else break e}}return F}function s(I,F){var _=I.sortIndex-F.sortIndex;return _!==0?_:I.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var a=Date,l=a.now();e.unstable_now=function(){return a.now()-l}}var c=[],u=[],p=1,d=null,f=3,h=!1,g=!1,k=!1,w=typeof setTimeout=="function"?setTimeout:null,y=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function x(I){for(var F=n(u);F!==null;){if(F.callback===null)r(u);else if(F.startTime<=I)r(u),F.sortIndex=F.expirationTime,t(c,F);else break;F=n(u)}}function C(I){if(k=!1,x(I),!g)if(n(c)!==null)g=!0,D(N);else{var F=n(u);F!==null&&$(C,F.startTime-I)}}function N(I,F){g=!1,k&&(k=!1,y(P),P=-1),h=!0;var _=f;try{for(x(F),d=n(c);d!==null&&(!(d.expirationTime>F)||I&&!W());){var X=d.callback;if(typeof X=="function"){d.callback=null,f=d.priorityLevel;var V=X(d.expirationTime<=F);F=e.unstable_now(),typeof V=="function"?d.callback=V:d===n(c)&&r(c),x(F)}else r(c);d=n(c)}if(d!==null)var T=!0;else{var ee=n(u);ee!==null&&$(C,ee.startTime-F),T=!1}return T}finally{d=null,f=_,h=!1}}var j=!1,E=null,P=-1,O=5,B=-1;function W(){return!(e.unstable_now()-B<O)}function z(){if(E!==null){var I=e.unstable_now();B=I;var F=!0;try{F=E(!0,I)}finally{F?L():(j=!1,E=null)}}else j=!1}var L;if(typeof v=="function")L=function(){v(z)};else if(typeof MessageChannel<"u"){var R=new MessageChannel,K=R.port2;R.port1.onmessage=z,L=function(){K.postMessage(null)}}else L=function(){w(z,0)};function D(I){E=I,j||(j=!0,L())}function $(I,F){P=w(function(){I(e.unstable_now())},F)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(I){I.callback=null},e.unstable_continueExecution=function(){g||h||(g=!0,D(N))},e.unstable_forceFrameRate=function(I){0>I||125<I?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<I?Math.floor(1e3/I):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(I){switch(f){case 1:case 2:case 3:var F=3;break;default:F=f}var _=f;f=F;try{return I()}finally{f=_}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(I,F){switch(I){case 1:case 2:case 3:case 4:case 5:break;default:I=3}var _=f;f=I;try{return F()}finally{f=_}},e.unstable_scheduleCallback=function(I,F,_){var X=e.unstable_now();switch(typeof _=="object"&&_!==null?(_=_.delay,_=typeof _=="number"&&0<_?X+_:X):_=X,I){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=_+V,I={id:p++,callback:F,priorityLevel:I,startTime:_,expirationTime:V,sortIndex:-1},_>X?(I.sortIndex=_,t(u,I),n(c)===null&&I===n(u)&&(k?(y(P),P=-1):k=!0,$(C,_-X))):(I.sortIndex=V,t(c,I),g||h||(g=!0,D(N))),I},e.unstable_shouldYield=W,e.unstable_wrapCallback=function(I){var F=f;return function(){var _=f;f=F;try{return I.apply(this,arguments)}finally{f=_}}}})(NC);SC.exports=NC;var t$=SC.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 n$=m,ss=t$;function Ne(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 jC=new Set,Au={};function Fa(e,t){Wl(e,t),Wl(e+"Capture",t)}function Wl(e,t){for(Au[e]=t,e=0;e<t.length;e++)jC.add(t[e])}var Wi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ny=Object.prototype.hasOwnProperty,r$=/^[: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]*$/,d0={},f0={};function s$(e){return Ny.call(f0,e)?!0:Ny.call(d0,e)?!1:r$.test(e)?f0[e]=!0:(d0[e]=!0,!1)}function i$(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 o$(e,t,n,r){if(t===null||typeof t>"u"||i$(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 Ar(e,t,n,r,s,i,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=a}var lr={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){lr[e]=new Ar(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];lr[t]=new Ar(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){lr[e]=new Ar(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){lr[e]=new Ar(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){lr[e]=new Ar(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){lr[e]=new Ar(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){lr[e]=new Ar(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){lr[e]=new Ar(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){lr[e]=new Ar(e,5,!1,e.toLowerCase(),null,!1,!1)});var jw=/[\-:]([a-z])/g;function Cw(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(jw,Cw);lr[t]=new Ar(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(jw,Cw);lr[t]=new Ar(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(jw,Cw);lr[t]=new Ar(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){lr[e]=new Ar(e,1,!1,e.toLowerCase(),null,!1,!1)});lr.xlinkHref=new Ar("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){lr[e]=new Ar(e,1,!1,e.toLowerCase(),null,!0,!0)});function _w(e,t,n,r){var s=lr.hasOwnProperty(t)?lr[t]:null;(s!==null?s.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(o$(t,n,s,r)&&(n=null),r||s===null?s$(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 Gi=n$.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,df=Symbol.for("react.element"),pl=Symbol.for("react.portal"),hl=Symbol.for("react.fragment"),Ew=Symbol.for("react.strict_mode"),jy=Symbol.for("react.profiler"),CC=Symbol.for("react.provider"),_C=Symbol.for("react.context"),Aw=Symbol.for("react.forward_ref"),Cy=Symbol.for("react.suspense"),_y=Symbol.for("react.suspense_list"),Pw=Symbol.for("react.memo"),po=Symbol.for("react.lazy"),EC=Symbol.for("react.offscreen"),p0=Symbol.iterator;function Mc(e){return e===null||typeof e!="object"?null:(e=p0&&e[p0]||e["@@iterator"],typeof e=="function"?e:null)}var jn=Object.assign,ng;function Zc(e){if(ng===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);ng=t&&t[1]||""}return`
|
|
34
|
-
`+ng+e}var rg=!1;function sg(e,t){if(!e||rg)return"";rg=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(u){var r=u}Reflect.construct(e,[],t)}else{try{t.call()}catch(u){r=u}e.call(t.prototype)}else{try{throw Error()}catch(u){r=u}e()}}catch(u){if(u&&r&&typeof u.stack=="string"){for(var s=u.stack.split(`
|
|
35
|
-
`),i=r.stack.split(`
|
|
36
|
-
`),a=s.length-1,l=i.length-1;1<=a&&0<=l&&s[a]!==i[l];)l--;for(;1<=a&&0<=l;a--,l--)if(s[a]!==i[l]){if(a!==1||l!==1)do if(a--,l--,0>l||s[a]!==i[l]){var c=`
|
|
37
|
-
`+s[a].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=a&&0<=l);break}}}finally{rg=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Zc(e):""}function a$(e){switch(e.tag){case 5:return Zc(e.type);case 16:return Zc("Lazy");case 13:return Zc("Suspense");case 19:return Zc("SuspenseList");case 0:case 2:case 15:return e=sg(e.type,!1),e;case 11:return e=sg(e.type.render,!1),e;case 1:return e=sg(e.type,!0),e;default:return""}}function Ey(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 hl:return"Fragment";case pl:return"Portal";case jy:return"Profiler";case Ew:return"StrictMode";case Cy:return"Suspense";case _y:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case _C:return(e.displayName||"Context")+".Consumer";case CC:return(e._context.displayName||"Context")+".Provider";case Aw:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Pw:return t=e.displayName||null,t!==null?t:Ey(e.type)||"Memo";case po:t=e._payload,e=e._init;try{return Ey(e(t))}catch{}}return null}function l$(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 Ey(t);case 8:return t===Ew?"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 Ro(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function AC(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function c$(e){var t=AC(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return s.call(this)},set:function(a){r=""+a,i.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ff(e){e._valueTracker||(e._valueTracker=c$(e))}function PC(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=AC(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Pp(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 Ay(e,t){var n=t.checked;return jn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function h0(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Ro(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 IC(e,t){t=t.checked,t!=null&&_w(e,"checked",t,!1)}function Py(e,t){IC(e,t);var n=Ro(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")?Iy(e,t.type,n):t.hasOwnProperty("defaultValue")&&Iy(e,t.type,Ro(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function m0(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 Iy(e,t,n){(t!=="number"||Pp(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var eu=Array.isArray;function Pl(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=""+Ro(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 Ty(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(Ne(91));return jn({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function g0(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(Ne(92));if(eu(n)){if(1<n.length)throw Error(Ne(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Ro(n)}}function TC(e,t){var n=Ro(t.value),r=Ro(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 y0(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function RC(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 Ry(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?RC(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var pf,MC=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(pf=pf||document.createElement("div"),pf.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=pf.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Pu(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var cu={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},u$=["Webkit","ms","Moz","O"];Object.keys(cu).forEach(function(e){u$.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),cu[t]=cu[e]})});function $C(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||cu.hasOwnProperty(e)&&cu[e]?(""+t).trim():t+"px"}function LC(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=$C(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,s):e[n]=s}}var d$=jn({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 My(e,t){if(t){if(d$[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(Ne(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(Ne(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(Ne(61))}if(t.style!=null&&typeof t.style!="object")throw Error(Ne(62))}}function $y(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 Ly=null;function Iw(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Oy=null,Il=null,Tl=null;function x0(e){if(e=yd(e)){if(typeof Oy!="function")throw Error(Ne(280));var t=e.stateNode;t&&(t=Bh(t),Oy(e.stateNode,e.type,t))}}function OC(e){Il?Tl?Tl.push(e):Tl=[e]:Il=e}function DC(){if(Il){var e=Il,t=Tl;if(Tl=Il=null,x0(e),t)for(e=0;e<t.length;e++)x0(t[e])}}function FC(e,t){return e(t)}function zC(){}var ig=!1;function BC(e,t,n){if(ig)return e(t,n);ig=!0;try{return FC(e,t,n)}finally{ig=!1,(Il!==null||Tl!==null)&&(zC(),DC())}}function Iu(e,t){var n=e.stateNode;if(n===null)return null;var r=Bh(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(Ne(231,t,typeof n));return n}var Dy=!1;if(Wi)try{var $c={};Object.defineProperty($c,"passive",{get:function(){Dy=!0}}),window.addEventListener("test",$c,$c),window.removeEventListener("test",$c,$c)}catch{Dy=!1}function f$(e,t,n,r,s,i,a,l,c){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(p){this.onError(p)}}var uu=!1,Ip=null,Tp=!1,Fy=null,p$={onError:function(e){uu=!0,Ip=e}};function h$(e,t,n,r,s,i,a,l,c){uu=!1,Ip=null,f$.apply(p$,arguments)}function m$(e,t,n,r,s,i,a,l,c){if(h$.apply(this,arguments),uu){if(uu){var u=Ip;uu=!1,Ip=null}else throw Error(Ne(198));Tp||(Tp=!0,Fy=u)}}function za(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 HC(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 w0(e){if(za(e)!==e)throw Error(Ne(188))}function g$(e){var t=e.alternate;if(!t){if(t=za(e),t===null)throw Error(Ne(188));return t!==e?null:e}for(var n=e,r=t;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return w0(s),e;if(i===r)return w0(s),t;i=i.sibling}throw Error(Ne(188))}if(n.return!==r.return)n=s,r=i;else{for(var a=!1,l=s.child;l;){if(l===n){a=!0,n=s,r=i;break}if(l===r){a=!0,r=s,n=i;break}l=l.sibling}if(!a){for(l=i.child;l;){if(l===n){a=!0,n=i,r=s;break}if(l===r){a=!0,r=i,n=s;break}l=l.sibling}if(!a)throw Error(Ne(189))}}if(n.alternate!==r)throw Error(Ne(190))}if(n.tag!==3)throw Error(Ne(188));return n.stateNode.current===n?e:t}function WC(e){return e=g$(e),e!==null?VC(e):null}function VC(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=VC(e);if(t!==null)return t;e=e.sibling}return null}var KC=ss.unstable_scheduleCallback,b0=ss.unstable_cancelCallback,y$=ss.unstable_shouldYield,x$=ss.unstable_requestPaint,Mn=ss.unstable_now,w$=ss.unstable_getCurrentPriorityLevel,Tw=ss.unstable_ImmediatePriority,qC=ss.unstable_UserBlockingPriority,Rp=ss.unstable_NormalPriority,b$=ss.unstable_LowPriority,UC=ss.unstable_IdlePriority,Oh=null,ui=null;function k$(e){if(ui&&typeof ui.onCommitFiberRoot=="function")try{ui.onCommitFiberRoot(Oh,e,void 0,(e.current.flags&128)===128)}catch{}}var Bs=Math.clz32?Math.clz32:N$,v$=Math.log,S$=Math.LN2;function N$(e){return e>>>=0,e===0?32:31-(v$(e)/S$|0)|0}var hf=64,mf=4194304;function tu(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 Mp(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,s=e.suspendedLanes,i=e.pingedLanes,a=n&268435455;if(a!==0){var l=a&~s;l!==0?r=tu(l):(i&=a,i!==0&&(r=tu(i)))}else a=n&~s,a!==0?r=tu(a):i!==0&&(r=tu(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&s)&&(s=r&-r,i=t&-t,s>=i||s===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Bs(t),s=1<<n,r|=e[n],t&=~s;return r}function j$(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 C$(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,s=e.expirationTimes,i=e.pendingLanes;0<i;){var a=31-Bs(i),l=1<<a,c=s[a];c===-1?(!(l&n)||l&r)&&(s[a]=j$(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function zy(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function YC(){var e=hf;return hf<<=1,!(hf&4194240)&&(hf=64),e}function og(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function md(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Bs(t),e[t]=n}function _$(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-Bs(n),i=1<<s;t[s]=0,r[s]=-1,e[s]=-1,n&=~i}}function Rw(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Bs(n),s=1<<r;s&t|e[r]&t&&(e[r]|=t),n&=~s}}var Jt=0;function GC(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var JC,Mw,XC,QC,ZC,By=!1,gf=[],So=null,No=null,jo=null,Tu=new Map,Ru=new Map,go=[],E$="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 k0(e,t){switch(e){case"focusin":case"focusout":So=null;break;case"dragenter":case"dragleave":No=null;break;case"mouseover":case"mouseout":jo=null;break;case"pointerover":case"pointerout":Tu.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ru.delete(t.pointerId)}}function Lc(e,t,n,r,s,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},t!==null&&(t=yd(t),t!==null&&Mw(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,s!==null&&t.indexOf(s)===-1&&t.push(s),e)}function A$(e,t,n,r,s){switch(t){case"focusin":return So=Lc(So,e,t,n,r,s),!0;case"dragenter":return No=Lc(No,e,t,n,r,s),!0;case"mouseover":return jo=Lc(jo,e,t,n,r,s),!0;case"pointerover":var i=s.pointerId;return Tu.set(i,Lc(Tu.get(i)||null,e,t,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,Ru.set(i,Lc(Ru.get(i)||null,e,t,n,r,s)),!0}return!1}function e_(e){var t=ua(e.target);if(t!==null){var n=za(t);if(n!==null){if(t=n.tag,t===13){if(t=HC(n),t!==null){e.blockedOn=t,ZC(e.priority,function(){XC(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 ap(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Hy(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Ly=r,n.target.dispatchEvent(r),Ly=null}else return t=yd(n),t!==null&&Mw(t),e.blockedOn=n,!1;t.shift()}return!0}function v0(e,t,n){ap(e)&&n.delete(t)}function P$(){By=!1,So!==null&&ap(So)&&(So=null),No!==null&&ap(No)&&(No=null),jo!==null&&ap(jo)&&(jo=null),Tu.forEach(v0),Ru.forEach(v0)}function Oc(e,t){e.blockedOn===t&&(e.blockedOn=null,By||(By=!0,ss.unstable_scheduleCallback(ss.unstable_NormalPriority,P$)))}function Mu(e){function t(s){return Oc(s,e)}if(0<gf.length){Oc(gf[0],e);for(var n=1;n<gf.length;n++){var r=gf[n];r.blockedOn===e&&(r.blockedOn=null)}}for(So!==null&&Oc(So,e),No!==null&&Oc(No,e),jo!==null&&Oc(jo,e),Tu.forEach(t),Ru.forEach(t),n=0;n<go.length;n++)r=go[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<go.length&&(n=go[0],n.blockedOn===null);)e_(n),n.blockedOn===null&&go.shift()}var Rl=Gi.ReactCurrentBatchConfig,$p=!0;function I$(e,t,n,r){var s=Jt,i=Rl.transition;Rl.transition=null;try{Jt=1,$w(e,t,n,r)}finally{Jt=s,Rl.transition=i}}function T$(e,t,n,r){var s=Jt,i=Rl.transition;Rl.transition=null;try{Jt=4,$w(e,t,n,r)}finally{Jt=s,Rl.transition=i}}function $w(e,t,n,r){if($p){var s=Hy(e,t,n,r);if(s===null)gg(e,t,r,Lp,n),k0(e,r);else if(A$(s,e,t,n,r))r.stopPropagation();else if(k0(e,r),t&4&&-1<E$.indexOf(e)){for(;s!==null;){var i=yd(s);if(i!==null&&JC(i),i=Hy(e,t,n,r),i===null&&gg(e,t,r,Lp,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else gg(e,t,r,null,n)}}var Lp=null;function Hy(e,t,n,r){if(Lp=null,e=Iw(r),e=ua(e),e!==null)if(t=za(e),t===null)e=null;else if(n=t.tag,n===13){if(e=HC(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 Lp=e,null}function t_(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(w$()){case Tw:return 1;case qC:return 4;case Rp:case b$:return 16;case UC:return 536870912;default:return 16}default:return 16}}var wo=null,Lw=null,lp=null;function n_(){if(lp)return lp;var e,t=Lw,n=t.length,r,s="value"in wo?wo.value:wo.textContent,i=s.length;for(e=0;e<n&&t[e]===s[e];e++);var a=n-e;for(r=1;r<=a&&t[n-r]===s[i-r];r++);return lp=s.slice(e,1<r?1-r:void 0)}function cp(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 yf(){return!0}function S0(){return!1}function as(e){function t(n,r,s,i,a){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=a,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?yf:S0,this.isPropagationStopped=S0,this}return jn(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=yf)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=yf)},persist:function(){},isPersistent:yf}),t}var ac={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ow=as(ac),gd=jn({},ac,{view:0,detail:0}),R$=as(gd),ag,lg,Dc,Dh=jn({},gd,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Dw,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!==Dc&&(Dc&&e.type==="mousemove"?(ag=e.screenX-Dc.screenX,lg=e.screenY-Dc.screenY):lg=ag=0,Dc=e),ag)},movementY:function(e){return"movementY"in e?e.movementY:lg}}),N0=as(Dh),M$=jn({},Dh,{dataTransfer:0}),$$=as(M$),L$=jn({},gd,{relatedTarget:0}),cg=as(L$),O$=jn({},ac,{animationName:0,elapsedTime:0,pseudoElement:0}),D$=as(O$),F$=jn({},ac,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),z$=as(F$),B$=jn({},ac,{data:0}),j0=as(B$),H$={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},W$={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"},V$={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function K$(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=V$[e])?!!t[e]:!1}function Dw(){return K$}var q$=jn({},gd,{key:function(e){if(e.key){var t=H$[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=cp(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?W$[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Dw,charCode:function(e){return e.type==="keypress"?cp(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?cp(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),U$=as(q$),Y$=jn({},Dh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),C0=as(Y$),G$=jn({},gd,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Dw}),J$=as(G$),X$=jn({},ac,{propertyName:0,elapsedTime:0,pseudoElement:0}),Q$=as(X$),Z$=jn({},Dh,{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}),e2=as(Z$),t2=[9,13,27,32],Fw=Wi&&"CompositionEvent"in window,du=null;Wi&&"documentMode"in document&&(du=document.documentMode);var n2=Wi&&"TextEvent"in window&&!du,r_=Wi&&(!Fw||du&&8<du&&11>=du),_0=" ",E0=!1;function s_(e,t){switch(e){case"keyup":return t2.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function i_(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ml=!1;function r2(e,t){switch(e){case"compositionend":return i_(t);case"keypress":return t.which!==32?null:(E0=!0,_0);case"textInput":return e=t.data,e===_0&&E0?null:e;default:return null}}function s2(e,t){if(ml)return e==="compositionend"||!Fw&&s_(e,t)?(e=n_(),lp=Lw=wo=null,ml=!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 r_&&t.locale!=="ko"?null:t.data;default:return null}}var i2={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 A0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!i2[e.type]:t==="textarea"}function o_(e,t,n,r){OC(r),t=Op(t,"onChange"),0<t.length&&(n=new Ow("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var fu=null,$u=null;function o2(e){y_(e,0)}function Fh(e){var t=xl(e);if(PC(t))return e}function a2(e,t){if(e==="change")return t}var a_=!1;if(Wi){var ug;if(Wi){var dg="oninput"in document;if(!dg){var P0=document.createElement("div");P0.setAttribute("oninput","return;"),dg=typeof P0.oninput=="function"}ug=dg}else ug=!1;a_=ug&&(!document.documentMode||9<document.documentMode)}function I0(){fu&&(fu.detachEvent("onpropertychange",l_),$u=fu=null)}function l_(e){if(e.propertyName==="value"&&Fh($u)){var t=[];o_(t,$u,e,Iw(e)),BC(o2,t)}}function l2(e,t,n){e==="focusin"?(I0(),fu=t,$u=n,fu.attachEvent("onpropertychange",l_)):e==="focusout"&&I0()}function c2(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Fh($u)}function u2(e,t){if(e==="click")return Fh(t)}function d2(e,t){if(e==="input"||e==="change")return Fh(t)}function f2(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Vs=typeof Object.is=="function"?Object.is:f2;function Lu(e,t){if(Vs(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(!Ny.call(t,s)||!Vs(e[s],t[s]))return!1}return!0}function T0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function R0(e,t){var n=T0(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=T0(n)}}function c_(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?c_(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function u_(){for(var e=window,t=Pp();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Pp(e.document)}return t}function zw(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 p2(e){var t=u_(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&c_(n.ownerDocument.documentElement,n)){if(r!==null&&zw(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!e.extend&&i>r&&(s=r,r=i,i=s),s=R0(n,i);var a=R0(n,r);s&&a&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(s.node,s.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var h2=Wi&&"documentMode"in document&&11>=document.documentMode,gl=null,Wy=null,pu=null,Vy=!1;function M0(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Vy||gl==null||gl!==Pp(r)||(r=gl,"selectionStart"in r&&zw(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}),pu&&Lu(pu,r)||(pu=r,r=Op(Wy,"onSelect"),0<r.length&&(t=new Ow("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=gl)))}function xf(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var yl={animationend:xf("Animation","AnimationEnd"),animationiteration:xf("Animation","AnimationIteration"),animationstart:xf("Animation","AnimationStart"),transitionend:xf("Transition","TransitionEnd")},fg={},d_={};Wi&&(d_=document.createElement("div").style,"AnimationEvent"in window||(delete yl.animationend.animation,delete yl.animationiteration.animation,delete yl.animationstart.animation),"TransitionEvent"in window||delete yl.transitionend.transition);function zh(e){if(fg[e])return fg[e];if(!yl[e])return e;var t=yl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in d_)return fg[e]=t[n];return e}var f_=zh("animationend"),p_=zh("animationiteration"),h_=zh("animationstart"),m_=zh("transitionend"),g_=new Map,$0="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 Bo(e,t){g_.set(e,t),Fa(t,[e])}for(var pg=0;pg<$0.length;pg++){var hg=$0[pg],m2=hg.toLowerCase(),g2=hg[0].toUpperCase()+hg.slice(1);Bo(m2,"on"+g2)}Bo(f_,"onAnimationEnd");Bo(p_,"onAnimationIteration");Bo(h_,"onAnimationStart");Bo("dblclick","onDoubleClick");Bo("focusin","onFocus");Bo("focusout","onBlur");Bo(m_,"onTransitionEnd");Wl("onMouseEnter",["mouseout","mouseover"]);Wl("onMouseLeave",["mouseout","mouseover"]);Wl("onPointerEnter",["pointerout","pointerover"]);Wl("onPointerLeave",["pointerout","pointerover"]);Fa("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Fa("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Fa("onBeforeInput",["compositionend","keypress","textInput","paste"]);Fa("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Fa("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Fa("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var nu="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(" "),y2=new Set("cancel close invalid load scroll toggle".split(" ").concat(nu));function L0(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,m$(r,t,void 0,e),e.currentTarget=null}function y_(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],s=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var a=r.length-1;0<=a;a--){var l=r[a],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;L0(s,l,u),i=c}else for(a=0;a<r.length;a++){if(l=r[a],c=l.instance,u=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;L0(s,l,u),i=c}}}if(Tp)throw e=Fy,Tp=!1,Fy=null,e}function mn(e,t){var n=t[Gy];n===void 0&&(n=t[Gy]=new Set);var r=e+"__bubble";n.has(r)||(x_(t,e,2,!1),n.add(r))}function mg(e,t,n){var r=0;t&&(r|=4),x_(n,e,r,t)}var wf="_reactListening"+Math.random().toString(36).slice(2);function Ou(e){if(!e[wf]){e[wf]=!0,jC.forEach(function(n){n!=="selectionchange"&&(y2.has(n)||mg(n,!1,e),mg(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[wf]||(t[wf]=!0,mg("selectionchange",!1,t))}}function x_(e,t,n,r){switch(t_(t)){case 1:var s=I$;break;case 4:s=T$;break;default:s=$w}n=s.bind(null,t,n,e),s=void 0,!Dy||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 gg(e,t,n,r,s){var i=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var a=r.tag;if(a===3||a===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(a===4)for(a=r.return;a!==null;){var c=a.tag;if((c===3||c===4)&&(c=a.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;a=a.return}for(;l!==null;){if(a=ua(l),a===null)return;if(c=a.tag,c===5||c===6){r=i=a;continue e}l=l.parentNode}}r=r.return}BC(function(){var u=i,p=Iw(n),d=[];e:{var f=g_.get(e);if(f!==void 0){var h=Ow,g=e;switch(e){case"keypress":if(cp(n)===0)break e;case"keydown":case"keyup":h=U$;break;case"focusin":g="focus",h=cg;break;case"focusout":g="blur",h=cg;break;case"beforeblur":case"afterblur":h=cg;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=N0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=$$;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=J$;break;case f_:case p_:case h_:h=D$;break;case m_:h=Q$;break;case"scroll":h=R$;break;case"wheel":h=e2;break;case"copy":case"cut":case"paste":h=z$;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=C0}var k=(t&4)!==0,w=!k&&e==="scroll",y=k?f!==null?f+"Capture":null:f;k=[];for(var v=u,x;v!==null;){x=v;var C=x.stateNode;if(x.tag===5&&C!==null&&(x=C,y!==null&&(C=Iu(v,y),C!=null&&k.push(Du(v,C,x)))),w)break;v=v.return}0<k.length&&(f=new h(f,g,null,n,p),d.push({event:f,listeners:k}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",f&&n!==Ly&&(g=n.relatedTarget||n.fromElement)&&(ua(g)||g[Vi]))break e;if((h||f)&&(f=p.window===p?p:(f=p.ownerDocument)?f.defaultView||f.parentWindow:window,h?(g=n.relatedTarget||n.toElement,h=u,g=g?ua(g):null,g!==null&&(w=za(g),g!==w||g.tag!==5&&g.tag!==6)&&(g=null)):(h=null,g=u),h!==g)){if(k=N0,C="onMouseLeave",y="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(k=C0,C="onPointerLeave",y="onPointerEnter",v="pointer"),w=h==null?f:xl(h),x=g==null?f:xl(g),f=new k(C,v+"leave",h,n,p),f.target=w,f.relatedTarget=x,C=null,ua(p)===u&&(k=new k(y,v+"enter",g,n,p),k.target=x,k.relatedTarget=w,C=k),w=C,h&&g)t:{for(k=h,y=g,v=0,x=k;x;x=rl(x))v++;for(x=0,C=y;C;C=rl(C))x++;for(;0<v-x;)k=rl(k),v--;for(;0<x-v;)y=rl(y),x--;for(;v--;){if(k===y||y!==null&&k===y.alternate)break t;k=rl(k),y=rl(y)}k=null}else k=null;h!==null&&O0(d,f,h,k,!1),g!==null&&w!==null&&O0(d,w,g,k,!0)}}e:{if(f=u?xl(u):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var N=a2;else if(A0(f))if(a_)N=d2;else{N=c2;var j=l2}else(h=f.nodeName)&&h.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(N=u2);if(N&&(N=N(e,u))){o_(d,N,n,p);break e}j&&j(e,f,u),e==="focusout"&&(j=f._wrapperState)&&j.controlled&&f.type==="number"&&Iy(f,"number",f.value)}switch(j=u?xl(u):window,e){case"focusin":(A0(j)||j.contentEditable==="true")&&(gl=j,Wy=u,pu=null);break;case"focusout":pu=Wy=gl=null;break;case"mousedown":Vy=!0;break;case"contextmenu":case"mouseup":case"dragend":Vy=!1,M0(d,n,p);break;case"selectionchange":if(h2)break;case"keydown":case"keyup":M0(d,n,p)}var E;if(Fw)e:{switch(e){case"compositionstart":var P="onCompositionStart";break e;case"compositionend":P="onCompositionEnd";break e;case"compositionupdate":P="onCompositionUpdate";break e}P=void 0}else ml?s_(e,n)&&(P="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(P="onCompositionStart");P&&(r_&&n.locale!=="ko"&&(ml||P!=="onCompositionStart"?P==="onCompositionEnd"&&ml&&(E=n_()):(wo=p,Lw="value"in wo?wo.value:wo.textContent,ml=!0)),j=Op(u,P),0<j.length&&(P=new j0(P,e,null,n,p),d.push({event:P,listeners:j}),E?P.data=E:(E=i_(n),E!==null&&(P.data=E)))),(E=n2?r2(e,n):s2(e,n))&&(u=Op(u,"onBeforeInput"),0<u.length&&(p=new j0("onBeforeInput","beforeinput",null,n,p),d.push({event:p,listeners:u}),p.data=E))}y_(d,t)})}function Du(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Op(e,t){for(var n=t+"Capture",r=[];e!==null;){var s=e,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Iu(e,n),i!=null&&r.unshift(Du(e,i,s)),i=Iu(e,t),i!=null&&r.push(Du(e,i,s))),e=e.return}return r}function rl(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function O0(e,t,n,r,s){for(var i=t._reactName,a=[];n!==null&&n!==r;){var l=n,c=l.alternate,u=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&u!==null&&(l=u,s?(c=Iu(n,i),c!=null&&a.unshift(Du(n,c,l))):s||(c=Iu(n,i),c!=null&&a.push(Du(n,c,l)))),n=n.return}a.length!==0&&e.push({event:t,listeners:a})}var x2=/\r\n?/g,w2=/\u0000|\uFFFD/g;function D0(e){return(typeof e=="string"?e:""+e).replace(x2,`
|
|
38
|
-
`).replace(w2,"")}function bf(e,t,n){if(t=D0(t),D0(e)!==t&&n)throw Error(Ne(425))}function Dp(){}var Ky=null,qy=null;function Uy(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 Yy=typeof setTimeout=="function"?setTimeout:void 0,b2=typeof clearTimeout=="function"?clearTimeout:void 0,F0=typeof Promise=="function"?Promise:void 0,k2=typeof queueMicrotask=="function"?queueMicrotask:typeof F0<"u"?function(e){return F0.resolve(null).then(e).catch(v2)}:Yy;function v2(e){setTimeout(function(){throw e})}function yg(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),Mu(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);Mu(t)}function Co(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 z0(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 lc=Math.random().toString(36).slice(2),si="__reactFiber$"+lc,Fu="__reactProps$"+lc,Vi="__reactContainer$"+lc,Gy="__reactEvents$"+lc,S2="__reactListeners$"+lc,N2="__reactHandles$"+lc;function ua(e){var t=e[si];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Vi]||n[si]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=z0(e);e!==null;){if(n=e[si])return n;e=z0(e)}return t}e=n,n=e.parentNode}return null}function yd(e){return e=e[si]||e[Vi],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function xl(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(Ne(33))}function Bh(e){return e[Fu]||null}var Jy=[],wl=-1;function Ho(e){return{current:e}}function yn(e){0>wl||(e.current=Jy[wl],Jy[wl]=null,wl--)}function cn(e,t){wl++,Jy[wl]=e.current,e.current=t}var Mo={},yr=Ho(Mo),zr=Ho(!1),va=Mo;function Vl(e,t){var n=e.type.contextTypes;if(!n)return Mo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=s),s}function Br(e){return e=e.childContextTypes,e!=null}function Fp(){yn(zr),yn(yr)}function B0(e,t,n){if(yr.current!==Mo)throw Error(Ne(168));cn(yr,t),cn(zr,n)}function w_(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(Ne(108,l$(e)||"Unknown",s));return jn({},n,r)}function zp(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Mo,va=yr.current,cn(yr,e),cn(zr,zr.current),!0}function H0(e,t,n){var r=e.stateNode;if(!r)throw Error(Ne(169));n?(e=w_(e,t,va),r.__reactInternalMemoizedMergedChildContext=e,yn(zr),yn(yr),cn(yr,e)):yn(zr),cn(zr,n)}var Ti=null,Hh=!1,xg=!1;function b_(e){Ti===null?Ti=[e]:Ti.push(e)}function j2(e){Hh=!0,b_(e)}function Wo(){if(!xg&&Ti!==null){xg=!0;var e=0,t=Jt;try{var n=Ti;for(Jt=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Ti=null,Hh=!1}catch(s){throw Ti!==null&&(Ti=Ti.slice(e+1)),KC(Tw,Wo),s}finally{Jt=t,xg=!1}}return null}var bl=[],kl=0,Bp=null,Hp=0,ms=[],gs=0,Sa=null,Mi=1,$i="";function ra(e,t){bl[kl++]=Hp,bl[kl++]=Bp,Bp=e,Hp=t}function k_(e,t,n){ms[gs++]=Mi,ms[gs++]=$i,ms[gs++]=Sa,Sa=e;var r=Mi;e=$i;var s=32-Bs(r)-1;r&=~(1<<s),n+=1;var i=32-Bs(t)+s;if(30<i){var a=s-s%5;i=(r&(1<<a)-1).toString(32),r>>=a,s-=a,Mi=1<<32-Bs(t)+s|n<<s|r,$i=i+e}else Mi=1<<i|n<<s|r,$i=e}function Bw(e){e.return!==null&&(ra(e,1),k_(e,1,0))}function Hw(e){for(;e===Bp;)Bp=bl[--kl],bl[kl]=null,Hp=bl[--kl],bl[kl]=null;for(;e===Sa;)Sa=ms[--gs],ms[gs]=null,$i=ms[--gs],ms[gs]=null,Mi=ms[--gs],ms[gs]=null}var ns=null,es=null,wn=!1,Ls=null;function v_(e,t){var n=ws(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 W0(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,ns=e,es=Co(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,ns=e,es=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Sa!==null?{id:Mi,overflow:$i}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=ws(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,ns=e,es=null,!0):!1;default:return!1}}function Xy(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Qy(e){if(wn){var t=es;if(t){var n=t;if(!W0(e,t)){if(Xy(e))throw Error(Ne(418));t=Co(n.nextSibling);var r=ns;t&&W0(e,t)?v_(r,n):(e.flags=e.flags&-4097|2,wn=!1,ns=e)}}else{if(Xy(e))throw Error(Ne(418));e.flags=e.flags&-4097|2,wn=!1,ns=e}}}function V0(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ns=e}function kf(e){if(e!==ns)return!1;if(!wn)return V0(e),wn=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Uy(e.type,e.memoizedProps)),t&&(t=es)){if(Xy(e))throw S_(),Error(Ne(418));for(;t;)v_(e,t),t=Co(t.nextSibling)}if(V0(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(Ne(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){es=Co(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}es=null}}else es=ns?Co(e.stateNode.nextSibling):null;return!0}function S_(){for(var e=es;e;)e=Co(e.nextSibling)}function Kl(){es=ns=null,wn=!1}function Ww(e){Ls===null?Ls=[e]:Ls.push(e)}var C2=Gi.ReactCurrentBatchConfig;function Fc(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(Ne(309));var r=n.stateNode}if(!r)throw Error(Ne(147,e));var s=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(a){var l=s.refs;a===null?delete l[i]:l[i]=a},t._stringRef=i,t)}if(typeof e!="string")throw Error(Ne(284));if(!n._owner)throw Error(Ne(290,e))}return e}function vf(e,t){throw e=Object.prototype.toString.call(t),Error(Ne(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function K0(e){var t=e._init;return t(e._payload)}function N_(e){function t(y,v){if(e){var x=y.deletions;x===null?(y.deletions=[v],y.flags|=16):x.push(v)}}function n(y,v){if(!e)return null;for(;v!==null;)t(y,v),v=v.sibling;return null}function r(y,v){for(y=new Map;v!==null;)v.key!==null?y.set(v.key,v):y.set(v.index,v),v=v.sibling;return y}function s(y,v){return y=Po(y,v),y.index=0,y.sibling=null,y}function i(y,v,x){return y.index=x,e?(x=y.alternate,x!==null?(x=x.index,x<v?(y.flags|=2,v):x):(y.flags|=2,v)):(y.flags|=1048576,v)}function a(y){return e&&y.alternate===null&&(y.flags|=2),y}function l(y,v,x,C){return v===null||v.tag!==6?(v=jg(x,y.mode,C),v.return=y,v):(v=s(v,x),v.return=y,v)}function c(y,v,x,C){var N=x.type;return N===hl?p(y,v,x.props.children,C,x.key):v!==null&&(v.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===po&&K0(N)===v.type)?(C=s(v,x.props),C.ref=Fc(y,v,x),C.return=y,C):(C=gp(x.type,x.key,x.props,null,y.mode,C),C.ref=Fc(y,v,x),C.return=y,C)}function u(y,v,x,C){return v===null||v.tag!==4||v.stateNode.containerInfo!==x.containerInfo||v.stateNode.implementation!==x.implementation?(v=Cg(x,y.mode,C),v.return=y,v):(v=s(v,x.children||[]),v.return=y,v)}function p(y,v,x,C,N){return v===null||v.tag!==7?(v=ga(x,y.mode,C,N),v.return=y,v):(v=s(v,x),v.return=y,v)}function d(y,v,x){if(typeof v=="string"&&v!==""||typeof v=="number")return v=jg(""+v,y.mode,x),v.return=y,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case df:return x=gp(v.type,v.key,v.props,null,y.mode,x),x.ref=Fc(y,null,v),x.return=y,x;case pl:return v=Cg(v,y.mode,x),v.return=y,v;case po:var C=v._init;return d(y,C(v._payload),x)}if(eu(v)||Mc(v))return v=ga(v,y.mode,x,null),v.return=y,v;vf(y,v)}return null}function f(y,v,x,C){var N=v!==null?v.key:null;if(typeof x=="string"&&x!==""||typeof x=="number")return N!==null?null:l(y,v,""+x,C);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case df:return x.key===N?c(y,v,x,C):null;case pl:return x.key===N?u(y,v,x,C):null;case po:return N=x._init,f(y,v,N(x._payload),C)}if(eu(x)||Mc(x))return N!==null?null:p(y,v,x,C,null);vf(y,x)}return null}function h(y,v,x,C,N){if(typeof C=="string"&&C!==""||typeof C=="number")return y=y.get(x)||null,l(v,y,""+C,N);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case df:return y=y.get(C.key===null?x:C.key)||null,c(v,y,C,N);case pl:return y=y.get(C.key===null?x:C.key)||null,u(v,y,C,N);case po:var j=C._init;return h(y,v,x,j(C._payload),N)}if(eu(C)||Mc(C))return y=y.get(x)||null,p(v,y,C,N,null);vf(v,C)}return null}function g(y,v,x,C){for(var N=null,j=null,E=v,P=v=0,O=null;E!==null&&P<x.length;P++){E.index>P?(O=E,E=null):O=E.sibling;var B=f(y,E,x[P],C);if(B===null){E===null&&(E=O);break}e&&E&&B.alternate===null&&t(y,E),v=i(B,v,P),j===null?N=B:j.sibling=B,j=B,E=O}if(P===x.length)return n(y,E),wn&&ra(y,P),N;if(E===null){for(;P<x.length;P++)E=d(y,x[P],C),E!==null&&(v=i(E,v,P),j===null?N=E:j.sibling=E,j=E);return wn&&ra(y,P),N}for(E=r(y,E);P<x.length;P++)O=h(E,y,P,x[P],C),O!==null&&(e&&O.alternate!==null&&E.delete(O.key===null?P:O.key),v=i(O,v,P),j===null?N=O:j.sibling=O,j=O);return e&&E.forEach(function(W){return t(y,W)}),wn&&ra(y,P),N}function k(y,v,x,C){var N=Mc(x);if(typeof N!="function")throw Error(Ne(150));if(x=N.call(x),x==null)throw Error(Ne(151));for(var j=N=null,E=v,P=v=0,O=null,B=x.next();E!==null&&!B.done;P++,B=x.next()){E.index>P?(O=E,E=null):O=E.sibling;var W=f(y,E,B.value,C);if(W===null){E===null&&(E=O);break}e&&E&&W.alternate===null&&t(y,E),v=i(W,v,P),j===null?N=W:j.sibling=W,j=W,E=O}if(B.done)return n(y,E),wn&&ra(y,P),N;if(E===null){for(;!B.done;P++,B=x.next())B=d(y,B.value,C),B!==null&&(v=i(B,v,P),j===null?N=B:j.sibling=B,j=B);return wn&&ra(y,P),N}for(E=r(y,E);!B.done;P++,B=x.next())B=h(E,y,P,B.value,C),B!==null&&(e&&B.alternate!==null&&E.delete(B.key===null?P:B.key),v=i(B,v,P),j===null?N=B:j.sibling=B,j=B);return e&&E.forEach(function(z){return t(y,z)}),wn&&ra(y,P),N}function w(y,v,x,C){if(typeof x=="object"&&x!==null&&x.type===hl&&x.key===null&&(x=x.props.children),typeof x=="object"&&x!==null){switch(x.$$typeof){case df:e:{for(var N=x.key,j=v;j!==null;){if(j.key===N){if(N=x.type,N===hl){if(j.tag===7){n(y,j.sibling),v=s(j,x.props.children),v.return=y,y=v;break e}}else if(j.elementType===N||typeof N=="object"&&N!==null&&N.$$typeof===po&&K0(N)===j.type){n(y,j.sibling),v=s(j,x.props),v.ref=Fc(y,j,x),v.return=y,y=v;break e}n(y,j);break}else t(y,j);j=j.sibling}x.type===hl?(v=ga(x.props.children,y.mode,C,x.key),v.return=y,y=v):(C=gp(x.type,x.key,x.props,null,y.mode,C),C.ref=Fc(y,v,x),C.return=y,y=C)}return a(y);case pl:e:{for(j=x.key;v!==null;){if(v.key===j)if(v.tag===4&&v.stateNode.containerInfo===x.containerInfo&&v.stateNode.implementation===x.implementation){n(y,v.sibling),v=s(v,x.children||[]),v.return=y,y=v;break e}else{n(y,v);break}else t(y,v);v=v.sibling}v=Cg(x,y.mode,C),v.return=y,y=v}return a(y);case po:return j=x._init,w(y,v,j(x._payload),C)}if(eu(x))return g(y,v,x,C);if(Mc(x))return k(y,v,x,C);vf(y,x)}return typeof x=="string"&&x!==""||typeof x=="number"?(x=""+x,v!==null&&v.tag===6?(n(y,v.sibling),v=s(v,x),v.return=y,y=v):(n(y,v),v=jg(x,y.mode,C),v.return=y,y=v),a(y)):n(y,v)}return w}var ql=N_(!0),j_=N_(!1),Wp=Ho(null),Vp=null,vl=null,Vw=null;function Kw(){Vw=vl=Vp=null}function qw(e){var t=Wp.current;yn(Wp),e._currentValue=t}function Zy(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 Ml(e,t){Vp=e,Vw=vl=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Or=!0),e.firstContext=null)}function ks(e){var t=e._currentValue;if(Vw!==e)if(e={context:e,memoizedValue:t,next:null},vl===null){if(Vp===null)throw Error(Ne(308));vl=e,Vp.dependencies={lanes:0,firstContext:e}}else vl=vl.next=e;return t}var da=null;function Uw(e){da===null?da=[e]:da.push(e)}function C_(e,t,n,r){var s=t.interleaved;return s===null?(n.next=n,Uw(t)):(n.next=s.next,s.next=n),t.interleaved=n,Ki(e,r)}function Ki(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 ho=!1;function Yw(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function __(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 zi(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function _o(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Ot&2){var s=r.pending;return s===null?t.next=t:(t.next=s.next,s.next=t),r.pending=t,Ki(e,n)}return s=r.interleaved,s===null?(t.next=t,Uw(r)):(t.next=s.next,s.next=t),r.interleaved=t,Ki(e,n)}function up(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,Rw(e,n)}}function q0(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var a={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=a:i=i.next=a,n=n.next}while(n!==null);i===null?s=i=t:i=i.next=t}else s=i=t;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function Kp(e,t,n,r){var s=e.updateQueue;ho=!1;var i=s.firstBaseUpdate,a=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,u=c.next;c.next=null,a===null?i=u:a.next=u,a=c;var p=e.alternate;p!==null&&(p=p.updateQueue,l=p.lastBaseUpdate,l!==a&&(l===null?p.firstBaseUpdate=u:l.next=u,p.lastBaseUpdate=c))}if(i!==null){var d=s.baseState;a=0,p=u=c=null,l=i;do{var f=l.lane,h=l.eventTime;if((r&f)===f){p!==null&&(p=p.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var g=e,k=l;switch(f=t,h=n,k.tag){case 1:if(g=k.payload,typeof g=="function"){d=g.call(h,d,f);break e}d=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=k.payload,f=typeof g=="function"?g.call(h,d,f):g,f==null)break e;d=jn({},d,f);break e;case 2:ho=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=s.effects,f===null?s.effects=[l]:f.push(l))}else h={eventTime:h,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},p===null?(u=p=h,c=d):p=p.next=h,a|=f;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;f=l,l=f.next,f.next=null,s.lastBaseUpdate=f,s.shared.pending=null}}while(!0);if(p===null&&(c=d),s.baseState=c,s.firstBaseUpdate=u,s.lastBaseUpdate=p,t=s.shared.interleaved,t!==null){s=t;do a|=s.lane,s=s.next;while(s!==t)}else i===null&&(s.shared.lanes=0);ja|=a,e.lanes=a,e.memoizedState=d}}function U0(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(Ne(191,s));s.call(r)}}}var xd={},di=Ho(xd),zu=Ho(xd),Bu=Ho(xd);function fa(e){if(e===xd)throw Error(Ne(174));return e}function Gw(e,t){switch(cn(Bu,t),cn(zu,e),cn(di,xd),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ry(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ry(t,e)}yn(di),cn(di,t)}function Ul(){yn(di),yn(zu),yn(Bu)}function E_(e){fa(Bu.current);var t=fa(di.current),n=Ry(t,e.type);t!==n&&(cn(zu,e),cn(di,n))}function Jw(e){zu.current===e&&(yn(di),yn(zu))}var vn=Ho(0);function qp(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 wg=[];function Xw(){for(var e=0;e<wg.length;e++)wg[e]._workInProgressVersionPrimary=null;wg.length=0}var dp=Gi.ReactCurrentDispatcher,bg=Gi.ReactCurrentBatchConfig,Na=0,Nn=null,qn=null,er=null,Up=!1,hu=!1,Hu=0,_2=0;function fr(){throw Error(Ne(321))}function Qw(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Vs(e[n],t[n]))return!1;return!0}function Zw(e,t,n,r,s,i){if(Na=i,Nn=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,dp.current=e===null||e.memoizedState===null?I2:T2,e=n(r,s),hu){i=0;do{if(hu=!1,Hu=0,25<=i)throw Error(Ne(301));i+=1,er=qn=null,t.updateQueue=null,dp.current=R2,e=n(r,s)}while(hu)}if(dp.current=Yp,t=qn!==null&&qn.next!==null,Na=0,er=qn=Nn=null,Up=!1,t)throw Error(Ne(300));return e}function eb(){var e=Hu!==0;return Hu=0,e}function ei(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return er===null?Nn.memoizedState=er=e:er=er.next=e,er}function vs(){if(qn===null){var e=Nn.alternate;e=e!==null?e.memoizedState:null}else e=qn.next;var t=er===null?Nn.memoizedState:er.next;if(t!==null)er=t,qn=e;else{if(e===null)throw Error(Ne(310));qn=e,e={memoizedState:qn.memoizedState,baseState:qn.baseState,baseQueue:qn.baseQueue,queue:qn.queue,next:null},er===null?Nn.memoizedState=er=e:er=er.next=e}return er}function Wu(e,t){return typeof t=="function"?t(e):t}function kg(e){var t=vs(),n=t.queue;if(n===null)throw Error(Ne(311));n.lastRenderedReducer=e;var r=qn,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var a=s.next;s.next=i.next,i.next=a}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var l=a=null,c=null,u=i;do{var p=u.lane;if((Na&p)===p)c!==null&&(c=c.next={lane:0,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),r=u.hasEagerState?u.eagerState:e(r,u.action);else{var d={lane:p,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null};c===null?(l=c=d,a=r):c=c.next=d,Nn.lanes|=p,ja|=p}u=u.next}while(u!==null&&u!==i);c===null?a=r:c.next=l,Vs(r,t.memoizedState)||(Or=!0),t.memoizedState=r,t.baseState=a,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){s=e;do i=s.lane,Nn.lanes|=i,ja|=i,s=s.next;while(s!==e)}else s===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function vg(e){var t=vs(),n=t.queue;if(n===null)throw Error(Ne(311));n.lastRenderedReducer=e;var r=n.dispatch,s=n.pending,i=t.memoizedState;if(s!==null){n.pending=null;var a=s=s.next;do i=e(i,a.action),a=a.next;while(a!==s);Vs(i,t.memoizedState)||(Or=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function A_(){}function P_(e,t){var n=Nn,r=vs(),s=t(),i=!Vs(r.memoizedState,s);if(i&&(r.memoizedState=s,Or=!0),r=r.queue,tb(R_.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||er!==null&&er.memoizedState.tag&1){if(n.flags|=2048,Vu(9,T_.bind(null,n,r,s,t),void 0,null),nr===null)throw Error(Ne(349));Na&30||I_(n,t,s)}return s}function I_(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Nn.updateQueue,t===null?(t={lastEffect:null,stores:null},Nn.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function T_(e,t,n,r){t.value=n,t.getSnapshot=r,M_(t)&&$_(e)}function R_(e,t,n){return n(function(){M_(t)&&$_(e)})}function M_(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Vs(e,n)}catch{return!0}}function $_(e){var t=Ki(e,1);t!==null&&Hs(t,e,1,-1)}function Y0(e){var t=ei();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Wu,lastRenderedState:e},t.queue=e,e=e.dispatch=P2.bind(null,Nn,e),[t.memoizedState,e]}function Vu(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=Nn.updateQueue,t===null?(t={lastEffect:null,stores:null},Nn.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 L_(){return vs().memoizedState}function fp(e,t,n,r){var s=ei();Nn.flags|=e,s.memoizedState=Vu(1|t,n,void 0,r===void 0?null:r)}function Wh(e,t,n,r){var s=vs();r=r===void 0?null:r;var i=void 0;if(qn!==null){var a=qn.memoizedState;if(i=a.destroy,r!==null&&Qw(r,a.deps)){s.memoizedState=Vu(t,n,i,r);return}}Nn.flags|=e,s.memoizedState=Vu(1|t,n,i,r)}function G0(e,t){return fp(8390656,8,e,t)}function tb(e,t){return Wh(2048,8,e,t)}function O_(e,t){return Wh(4,2,e,t)}function D_(e,t){return Wh(4,4,e,t)}function F_(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 z_(e,t,n){return n=n!=null?n.concat([e]):null,Wh(4,4,F_.bind(null,t,e),n)}function nb(){}function B_(e,t){var n=vs();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Qw(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function H_(e,t){var n=vs();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Qw(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function W_(e,t,n){return Na&21?(Vs(n,t)||(n=YC(),Nn.lanes|=n,ja|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Or=!0),e.memoizedState=n)}function E2(e,t){var n=Jt;Jt=n!==0&&4>n?n:4,e(!0);var r=bg.transition;bg.transition={};try{e(!1),t()}finally{Jt=n,bg.transition=r}}function V_(){return vs().memoizedState}function A2(e,t,n){var r=Ao(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},K_(e))q_(t,n);else if(n=C_(e,t,n,r),n!==null){var s=_r();Hs(n,e,r,s),U_(n,t,r)}}function P2(e,t,n){var r=Ao(e),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(K_(e))q_(t,s);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var a=t.lastRenderedState,l=i(a,n);if(s.hasEagerState=!0,s.eagerState=l,Vs(l,a)){var c=t.interleaved;c===null?(s.next=s,Uw(t)):(s.next=c.next,c.next=s),t.interleaved=s;return}}catch{}finally{}n=C_(e,t,s,r),n!==null&&(s=_r(),Hs(n,e,r,s),U_(n,t,r))}}function K_(e){var t=e.alternate;return e===Nn||t!==null&&t===Nn}function q_(e,t){hu=Up=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function U_(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Rw(e,n)}}var Yp={readContext:ks,useCallback:fr,useContext:fr,useEffect:fr,useImperativeHandle:fr,useInsertionEffect:fr,useLayoutEffect:fr,useMemo:fr,useReducer:fr,useRef:fr,useState:fr,useDebugValue:fr,useDeferredValue:fr,useTransition:fr,useMutableSource:fr,useSyncExternalStore:fr,useId:fr,unstable_isNewReconciler:!1},I2={readContext:ks,useCallback:function(e,t){return ei().memoizedState=[e,t===void 0?null:t],e},useContext:ks,useEffect:G0,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,fp(4194308,4,F_.bind(null,t,e),n)},useLayoutEffect:function(e,t){return fp(4194308,4,e,t)},useInsertionEffect:function(e,t){return fp(4,2,e,t)},useMemo:function(e,t){var n=ei();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ei();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=A2.bind(null,Nn,e),[r.memoizedState,e]},useRef:function(e){var t=ei();return e={current:e},t.memoizedState=e},useState:Y0,useDebugValue:nb,useDeferredValue:function(e){return ei().memoizedState=e},useTransition:function(){var e=Y0(!1),t=e[0];return e=E2.bind(null,e[1]),ei().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Nn,s=ei();if(wn){if(n===void 0)throw Error(Ne(407));n=n()}else{if(n=t(),nr===null)throw Error(Ne(349));Na&30||I_(r,t,n)}s.memoizedState=n;var i={value:n,getSnapshot:t};return s.queue=i,G0(R_.bind(null,r,i,e),[e]),r.flags|=2048,Vu(9,T_.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=ei(),t=nr.identifierPrefix;if(wn){var n=$i,r=Mi;n=(r&~(1<<32-Bs(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Hu++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=_2++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},T2={readContext:ks,useCallback:B_,useContext:ks,useEffect:tb,useImperativeHandle:z_,useInsertionEffect:O_,useLayoutEffect:D_,useMemo:H_,useReducer:kg,useRef:L_,useState:function(){return kg(Wu)},useDebugValue:nb,useDeferredValue:function(e){var t=vs();return W_(t,qn.memoizedState,e)},useTransition:function(){var e=kg(Wu)[0],t=vs().memoizedState;return[e,t]},useMutableSource:A_,useSyncExternalStore:P_,useId:V_,unstable_isNewReconciler:!1},R2={readContext:ks,useCallback:B_,useContext:ks,useEffect:tb,useImperativeHandle:z_,useInsertionEffect:O_,useLayoutEffect:D_,useMemo:H_,useReducer:vg,useRef:L_,useState:function(){return vg(Wu)},useDebugValue:nb,useDeferredValue:function(e){var t=vs();return qn===null?t.memoizedState=e:W_(t,qn.memoizedState,e)},useTransition:function(){var e=vg(Wu)[0],t=vs().memoizedState;return[e,t]},useMutableSource:A_,useSyncExternalStore:P_,useId:V_,unstable_isNewReconciler:!1};function Rs(e,t){if(e&&e.defaultProps){t=jn({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function ex(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:jn({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Vh={isMounted:function(e){return(e=e._reactInternals)?za(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=_r(),s=Ao(e),i=zi(r,s);i.payload=t,n!=null&&(i.callback=n),t=_o(e,i,s),t!==null&&(Hs(t,e,s,r),up(t,e,s))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=_r(),s=Ao(e),i=zi(r,s);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=_o(e,i,s),t!==null&&(Hs(t,e,s,r),up(t,e,s))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=_r(),r=Ao(e),s=zi(n,r);s.tag=2,t!=null&&(s.callback=t),t=_o(e,s,r),t!==null&&(Hs(t,e,r,n),up(t,e,r))}};function J0(e,t,n,r,s,i,a){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,i,a):t.prototype&&t.prototype.isPureReactComponent?!Lu(n,r)||!Lu(s,i):!0}function Y_(e,t,n){var r=!1,s=Mo,i=t.contextType;return typeof i=="object"&&i!==null?i=ks(i):(s=Br(t)?va:yr.current,r=t.contextTypes,i=(r=r!=null)?Vl(e,s):Mo),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Vh,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=s,e.__reactInternalMemoizedMaskedChildContext=i),t}function X0(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&&Vh.enqueueReplaceState(t,t.state,null)}function tx(e,t,n,r){var s=e.stateNode;s.props=n,s.state=e.memoizedState,s.refs={},Yw(e);var i=t.contextType;typeof i=="object"&&i!==null?s.context=ks(i):(i=Br(t)?va:yr.current,s.context=Vl(e,i)),s.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(ex(e,t,i,n),s.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(t=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),t!==s.state&&Vh.enqueueReplaceState(s,s.state,null),Kp(e,n,s,r),s.state=e.memoizedState),typeof s.componentDidMount=="function"&&(e.flags|=4194308)}function Yl(e,t){try{var n="",r=t;do n+=a$(r),r=r.return;while(r);var s=n}catch(i){s=`
|
|
39
|
-
Error generating stack: `+i.message+`
|
|
40
|
-
`+i.stack}return{value:e,source:t,stack:s,digest:null}}function Sg(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function nx(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var M2=typeof WeakMap=="function"?WeakMap:Map;function G_(e,t,n){n=zi(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Jp||(Jp=!0,fx=r),nx(e,t)},n}function J_(e,t,n){n=zi(-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(){nx(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){nx(e,t),typeof r!="function"&&(Eo===null?Eo=new Set([this]):Eo.add(this));var a=t.stack;this.componentDidCatch(t.value,{componentStack:a!==null?a:""})}),n}function Q0(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new M2;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=Y2.bind(null,e,t,n),t.then(e,e))}function Z0(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 eS(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=zi(-1,1),t.tag=2,_o(n,t,1))),n.lanes|=1),e)}var $2=Gi.ReactCurrentOwner,Or=!1;function jr(e,t,n,r){t.child=e===null?j_(t,null,n,r):ql(t,e.child,n,r)}function tS(e,t,n,r,s){n=n.render;var i=t.ref;return Ml(t,s),r=Zw(e,t,n,r,i,s),n=eb(),e!==null&&!Or?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,qi(e,t,s)):(wn&&n&&Bw(t),t.flags|=1,jr(e,t,r,s),t.child)}function nS(e,t,n,r,s){if(e===null){var i=n.type;return typeof i=="function"&&!ub(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,X_(e,t,i,r,s)):(e=gp(n.type,null,r,t,t.mode,s),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&s)){var a=i.memoizedProps;if(n=n.compare,n=n!==null?n:Lu,n(a,r)&&e.ref===t.ref)return qi(e,t,s)}return t.flags|=1,e=Po(i,r),e.ref=t.ref,e.return=t,t.child=e}function X_(e,t,n,r,s){if(e!==null){var i=e.memoizedProps;if(Lu(i,r)&&e.ref===t.ref)if(Or=!1,t.pendingProps=r=i,(e.lanes&s)!==0)e.flags&131072&&(Or=!0);else return t.lanes=e.lanes,qi(e,t,s)}return rx(e,t,n,r,s)}function Q_(e,t,n){var r=t.pendingProps,s=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},cn(Nl,Xr),Xr|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,cn(Nl,Xr),Xr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,cn(Nl,Xr),Xr|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,cn(Nl,Xr),Xr|=r;return jr(e,t,s,n),t.child}function Z_(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function rx(e,t,n,r,s){var i=Br(n)?va:yr.current;return i=Vl(t,i),Ml(t,s),n=Zw(e,t,n,r,i,s),r=eb(),e!==null&&!Or?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~s,qi(e,t,s)):(wn&&r&&Bw(t),t.flags|=1,jr(e,t,n,s),t.child)}function rS(e,t,n,r,s){if(Br(n)){var i=!0;zp(t)}else i=!1;if(Ml(t,s),t.stateNode===null)pp(e,t),Y_(t,n,r),tx(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=ks(u):(u=Br(n)?va:yr.current,u=Vl(t,u));var p=n.getDerivedStateFromProps,d=typeof p=="function"||typeof a.getSnapshotBeforeUpdate=="function";d||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==r||c!==u)&&X0(t,a,r,u),ho=!1;var f=t.memoizedState;a.state=f,Kp(t,r,a,s),c=t.memoizedState,l!==r||f!==c||zr.current||ho?(typeof p=="function"&&(ex(t,n,p,r),c=t.memoizedState),(l=ho||J0(t,n,l,r,f,c,u))?(d||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,__(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Rs(t.type,l),a.props=u,d=t.pendingProps,f=a.context,c=n.contextType,typeof c=="object"&&c!==null?c=ks(c):(c=Br(n)?va:yr.current,c=Vl(t,c));var h=n.getDerivedStateFromProps;(p=typeof h=="function"||typeof a.getSnapshotBeforeUpdate=="function")||typeof a.UNSAFE_componentWillReceiveProps!="function"&&typeof a.componentWillReceiveProps!="function"||(l!==d||f!==c)&&X0(t,a,r,c),ho=!1,f=t.memoizedState,a.state=f,Kp(t,r,a,s);var g=t.memoizedState;l!==d||f!==g||zr.current||ho?(typeof h=="function"&&(ex(t,n,h,r),g=t.memoizedState),(u=ho||J0(t,n,u,r,f,g,c)||!1)?(p||typeof a.UNSAFE_componentWillUpdate!="function"&&typeof a.componentWillUpdate!="function"||(typeof a.componentWillUpdate=="function"&&a.componentWillUpdate(r,g,c),typeof a.UNSAFE_componentWillUpdate=="function"&&a.UNSAFE_componentWillUpdate(r,g,c)),typeof a.componentDidUpdate=="function"&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),a.props=r,a.state=g,a.context=c,r=u):(typeof a.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return sx(e,t,n,r,i,s)}function sx(e,t,n,r,s,i){Z_(e,t);var a=(t.flags&128)!==0;if(!r&&!a)return s&&H0(t,n,!1),qi(e,t,i);r=t.stateNode,$2.current=t;var l=a&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&a?(t.child=ql(t,e.child,null,i),t.child=ql(t,null,l,i)):jr(e,t,l,i),t.memoizedState=r.state,s&&H0(t,n,!0),t.child}function eE(e){var t=e.stateNode;t.pendingContext?B0(e,t.pendingContext,t.pendingContext!==t.context):t.context&&B0(e,t.context,!1),Gw(e,t.containerInfo)}function sS(e,t,n,r,s){return Kl(),Ww(s),t.flags|=256,jr(e,t,n,r),t.child}var ix={dehydrated:null,treeContext:null,retryLane:0};function ox(e){return{baseLanes:e,cachePool:null,transitions:null}}function tE(e,t,n){var r=t.pendingProps,s=vn.current,i=!1,a=(t.flags&128)!==0,l;if((l=a)||(l=e!==null&&e.memoizedState===null?!1:(s&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(s|=1),cn(vn,s&1),e===null)return Qy(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(a=r.children,e=r.fallback,i?(r=t.mode,i=t.child,a={mode:"hidden",children:a},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=a):i=Uh(a,r,0,null),e=ga(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=ox(n),t.memoizedState=ix,e):rb(t,a));if(s=e.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return L2(e,t,a,r,l,s,n);if(i){i=r.fallback,a=t.mode,s=e.child,l=s.sibling;var c={mode:"hidden",children:r.children};return!(a&1)&&t.child!==s?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Po(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=Po(l,i):(i=ga(i,a,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,a=e.child.memoizedState,a=a===null?ox(n):{baseLanes:a.baseLanes|n,cachePool:null,transitions:a.transitions},i.memoizedState=a,i.childLanes=e.childLanes&~n,t.memoizedState=ix,r}return i=e.child,e=i.sibling,r=Po(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function rb(e,t){return t=Uh({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Sf(e,t,n,r){return r!==null&&Ww(r),ql(t,e.child,null,n),e=rb(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function L2(e,t,n,r,s,i,a){if(n)return t.flags&256?(t.flags&=-257,r=Sg(Error(Ne(422))),Sf(e,t,a,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,s=t.mode,r=Uh({mode:"visible",children:r.children},s,0,null),i=ga(i,s,a,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&ql(t,e.child,null,a),t.child.memoizedState=ox(a),t.memoizedState=ix,i);if(!(t.mode&1))return Sf(e,t,a,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(Ne(419)),r=Sg(i,r,void 0),Sf(e,t,a,r)}if(l=(a&e.childLanes)!==0,Or||l){if(r=nr,r!==null){switch(a&-a){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|a)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,Ki(e,s),Hs(r,e,s,-1))}return cb(),r=Sg(Error(Ne(421))),Sf(e,t,a,r)}return s.data==="$?"?(t.flags|=128,t.child=e.child,t=G2.bind(null,e),s._reactRetry=t,null):(e=i.treeContext,es=Co(s.nextSibling),ns=t,wn=!0,Ls=null,e!==null&&(ms[gs++]=Mi,ms[gs++]=$i,ms[gs++]=Sa,Mi=e.id,$i=e.overflow,Sa=t),t=rb(t,r.children),t.flags|=4096,t)}function iS(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Zy(e.return,t,n)}function Ng(e,t,n,r,s){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function nE(e,t,n){var r=t.pendingProps,s=r.revealOrder,i=r.tail;if(jr(e,t,r.children,n),r=vn.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&&iS(e,n,t);else if(e.tag===19)iS(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(cn(vn,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&&qp(e)===null&&(s=n),n=n.sibling;n=s,n===null?(s=t.child,t.child=null):(s=n.sibling,n.sibling=null),Ng(t,!1,s,n,i);break;case"backwards":for(n=null,s=t.child,t.child=null;s!==null;){if(e=s.alternate,e!==null&&qp(e)===null){t.child=s;break}e=s.sibling,s.sibling=n,n=s,s=e}Ng(t,!0,n,null,i);break;case"together":Ng(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function pp(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function qi(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(Ne(153));if(t.child!==null){for(e=t.child,n=Po(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Po(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function O2(e,t,n){switch(t.tag){case 3:eE(t),Kl();break;case 5:E_(t);break;case 1:Br(t.type)&&zp(t);break;case 4:Gw(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,s=t.memoizedProps.value;cn(Wp,r._currentValue),r._currentValue=s;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(cn(vn,vn.current&1),t.flags|=128,null):n&t.child.childLanes?tE(e,t,n):(cn(vn,vn.current&1),e=qi(e,t,n),e!==null?e.sibling:null);cn(vn,vn.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return nE(e,t,n);t.flags|=128}if(s=t.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),cn(vn,vn.current),r)break;return null;case 22:case 23:return t.lanes=0,Q_(e,t,n)}return qi(e,t,n)}var rE,ax,sE,iE;rE=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}};ax=function(){};sE=function(e,t,n,r){var s=e.memoizedProps;if(s!==r){e=t.stateNode,fa(di.current);var i=null;switch(n){case"input":s=Ay(e,s),r=Ay(e,r),i=[];break;case"select":s=jn({},s,{value:void 0}),r=jn({},r,{value:void 0}),i=[];break;case"textarea":s=Ty(e,s),r=Ty(e,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=Dp)}My(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"&&(Au.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var c=r[u];if(l=s!=null?s[u]:void 0,r.hasOwnProperty(u)&&c!==l&&(c!=null||l!=null))if(u==="style")if(l){for(a in l)!l.hasOwnProperty(a)||c&&c.hasOwnProperty(a)||(n||(n={}),n[a]="");for(a in c)c.hasOwnProperty(a)&&l[a]!==c[a]&&(n||(n={}),n[a]=c[a])}else n||(i||(i=[]),i.push(u,n)),n=c;else u==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(u,c)):u==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(u,""+c):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Au.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&mn("scroll",e),i||l===c||(i=[])):(i=i||[]).push(u,c))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};iE=function(e,t,n,r){n!==r&&(t.flags|=4)};function zc(e,t){if(!wn)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function pr(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 D2(e,t,n){var r=t.pendingProps;switch(Hw(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pr(t),null;case 1:return Br(t.type)&&Fp(),pr(t),null;case 3:return r=t.stateNode,Ul(),yn(zr),yn(yr),Xw(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(kf(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ls!==null&&(mx(Ls),Ls=null))),ax(e,t),pr(t),null;case 5:Jw(t);var s=fa(Bu.current);if(n=t.type,e!==null&&t.stateNode!=null)sE(e,t,n,r,s),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(Ne(166));return pr(t),null}if(e=fa(di.current),kf(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[si]=t,r[Fu]=i,e=(t.mode&1)!==0,n){case"dialog":mn("cancel",r),mn("close",r);break;case"iframe":case"object":case"embed":mn("load",r);break;case"video":case"audio":for(s=0;s<nu.length;s++)mn(nu[s],r);break;case"source":mn("error",r);break;case"img":case"image":case"link":mn("error",r),mn("load",r);break;case"details":mn("toggle",r);break;case"input":h0(r,i),mn("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},mn("invalid",r);break;case"textarea":g0(r,i),mn("invalid",r)}My(n,i),s=null;for(var a in i)if(i.hasOwnProperty(a)){var l=i[a];a==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&bf(r.textContent,l,e),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&bf(r.textContent,l,e),s=["children",""+l]):Au.hasOwnProperty(a)&&l!=null&&a==="onScroll"&&mn("scroll",r)}switch(n){case"input":ff(r),m0(r,i,!0);break;case"textarea":ff(r),y0(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Dp)}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=RC(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[si]=t,e[Fu]=r,rE(e,t,!1,!1),t.stateNode=e;e:{switch(a=$y(n,r),n){case"dialog":mn("cancel",e),mn("close",e),s=r;break;case"iframe":case"object":case"embed":mn("load",e),s=r;break;case"video":case"audio":for(s=0;s<nu.length;s++)mn(nu[s],e);s=r;break;case"source":mn("error",e),s=r;break;case"img":case"image":case"link":mn("error",e),mn("load",e),s=r;break;case"details":mn("toggle",e),s=r;break;case"input":h0(e,r),s=Ay(e,r),mn("invalid",e);break;case"option":s=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},s=jn({},r,{value:void 0}),mn("invalid",e);break;case"textarea":g0(e,r),s=Ty(e,r),mn("invalid",e);break;default:s=r}My(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?LC(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&MC(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Pu(e,c):typeof c=="number"&&Pu(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Au.hasOwnProperty(i)?c!=null&&i==="onScroll"&&mn("scroll",e):c!=null&&_w(e,i,c,a))}switch(n){case"input":ff(e),m0(e,r,!1);break;case"textarea":ff(e),y0(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Ro(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?Pl(e,!!r.multiple,i,!1):r.defaultValue!=null&&Pl(e,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(e.onclick=Dp)}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 pr(t),null;case 6:if(e&&t.stateNode!=null)iE(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(Ne(166));if(n=fa(Bu.current),fa(di.current),kf(t)){if(r=t.stateNode,n=t.memoizedProps,r[si]=t,(i=r.nodeValue!==n)&&(e=ns,e!==null))switch(e.tag){case 3:bf(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&bf(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[si]=t,t.stateNode=r}return pr(t),null;case 13:if(yn(vn),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(wn&&es!==null&&t.mode&1&&!(t.flags&128))S_(),Kl(),t.flags|=98560,i=!1;else if(i=kf(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(Ne(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(Ne(317));i[si]=t}else Kl(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;pr(t),i=!1}else Ls!==null&&(mx(Ls),Ls=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||vn.current&1?Un===0&&(Un=3):cb())),t.updateQueue!==null&&(t.flags|=4),pr(t),null);case 4:return Ul(),ax(e,t),e===null&&Ou(t.stateNode.containerInfo),pr(t),null;case 10:return qw(t.type._context),pr(t),null;case 17:return Br(t.type)&&Fp(),pr(t),null;case 19:if(yn(vn),i=t.memoizedState,i===null)return pr(t),null;if(r=(t.flags&128)!==0,a=i.rendering,a===null)if(r)zc(i,!1);else{if(Un!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=qp(e),a!==null){for(t.flags|=128,zc(i,!1),r=a.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)i=n,e=r,i.flags&=14680066,a=i.alternate,a===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,e=a.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return cn(vn,vn.current&1|2),t.child}e=e.sibling}i.tail!==null&&Mn()>Gl&&(t.flags|=128,r=!0,zc(i,!1),t.lanes=4194304)}else{if(!r)if(e=qp(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),zc(i,!0),i.tail===null&&i.tailMode==="hidden"&&!a.alternate&&!wn)return pr(t),null}else 2*Mn()-i.renderingStartTime>Gl&&n!==1073741824&&(t.flags|=128,r=!0,zc(i,!1),t.lanes=4194304);i.isBackwards?(a.sibling=t.child,t.child=a):(n=i.last,n!==null?n.sibling=a:t.child=a,i.last=a)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Mn(),t.sibling=null,n=vn.current,cn(vn,r?n&1|2:n&1),t):(pr(t),null);case 22:case 23:return lb(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Xr&1073741824&&(pr(t),t.subtreeFlags&6&&(t.flags|=8192)):pr(t),null;case 24:return null;case 25:return null}throw Error(Ne(156,t.tag))}function F2(e,t){switch(Hw(t),t.tag){case 1:return Br(t.type)&&Fp(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ul(),yn(zr),yn(yr),Xw(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Jw(t),null;case 13:if(yn(vn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(Ne(340));Kl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return yn(vn),null;case 4:return Ul(),null;case 10:return qw(t.type._context),null;case 22:case 23:return lb(),null;case 24:return null;default:return null}}var Nf=!1,hr=!1,z2=typeof WeakSet=="function"?WeakSet:Set,Be=null;function Sl(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){En(e,t,r)}else n.current=null}function lx(e,t,n){try{n()}catch(r){En(e,t,r)}}var oS=!1;function B2(e,t){if(Ky=$p,e=u_(),zw(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var a=0,l=-1,c=-1,u=0,p=0,d=e,f=null;t:for(;;){for(var h;d!==n||s!==0&&d.nodeType!==3||(l=a+s),d!==i||r!==0&&d.nodeType!==3||(c=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++u===s&&(l=a),f===i&&++p===r&&(c=a),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(qy={focusedElem:e,selectionRange:n},$p=!1,Be=t;Be!==null;)if(t=Be,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Be=e;else for(;Be!==null;){t=Be;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var k=g.memoizedProps,w=g.memoizedState,y=t.stateNode,v=y.getSnapshotBeforeUpdate(t.elementType===t.type?k:Rs(t.type,k),w);y.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var x=t.stateNode.containerInfo;x.nodeType===1?x.textContent="":x.nodeType===9&&x.documentElement&&x.removeChild(x.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Ne(163))}}catch(C){En(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,Be=e;break}Be=t.return}return g=oS,oS=!1,g}function mu(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&e)===e){var i=s.destroy;s.destroy=void 0,i!==void 0&&lx(t,n,i)}s=s.next}while(s!==r)}}function Kh(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 cx(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 oE(e){var t=e.alternate;t!==null&&(e.alternate=null,oE(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[si],delete t[Fu],delete t[Gy],delete t[S2],delete t[N2])),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 aE(e){return e.tag===5||e.tag===3||e.tag===4}function aS(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||aE(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 ux(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=Dp));else if(r!==4&&(e=e.child,e!==null))for(ux(e,t,n),e=e.sibling;e!==null;)ux(e,t,n),e=e.sibling}function dx(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(dx(e,t,n),e=e.sibling;e!==null;)dx(e,t,n),e=e.sibling}var or=null,Ms=!1;function oo(e,t,n){for(n=n.child;n!==null;)lE(e,t,n),n=n.sibling}function lE(e,t,n){if(ui&&typeof ui.onCommitFiberUnmount=="function")try{ui.onCommitFiberUnmount(Oh,n)}catch{}switch(n.tag){case 5:hr||Sl(n,t);case 6:var r=or,s=Ms;or=null,oo(e,t,n),or=r,Ms=s,or!==null&&(Ms?(e=or,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):or.removeChild(n.stateNode));break;case 18:or!==null&&(Ms?(e=or,n=n.stateNode,e.nodeType===8?yg(e.parentNode,n):e.nodeType===1&&yg(e,n),Mu(e)):yg(or,n.stateNode));break;case 4:r=or,s=Ms,or=n.stateNode.containerInfo,Ms=!0,oo(e,t,n),or=r,Ms=s;break;case 0:case 11:case 14:case 15:if(!hr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,a=i.destroy;i=i.tag,a!==void 0&&(i&2||i&4)&&lx(n,t,a),s=s.next}while(s!==r)}oo(e,t,n);break;case 1:if(!hr&&(Sl(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){En(n,t,l)}oo(e,t,n);break;case 21:oo(e,t,n);break;case 22:n.mode&1?(hr=(r=hr)||n.memoizedState!==null,oo(e,t,n),hr=r):oo(e,t,n);break;default:oo(e,t,n)}}function lS(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new z2),t.forEach(function(r){var s=J2.bind(null,e,r);n.has(r)||(n.add(r),r.then(s,s))})}}function Ps(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=e,a=t,l=a;e:for(;l!==null;){switch(l.tag){case 5:or=l.stateNode,Ms=!1;break e;case 3:or=l.stateNode.containerInfo,Ms=!0;break e;case 4:or=l.stateNode.containerInfo,Ms=!0;break e}l=l.return}if(or===null)throw Error(Ne(160));lE(i,a,s),or=null,Ms=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(u){En(s,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)cE(t,e),t=t.sibling}function cE(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ps(t,e),Xs(e),r&4){try{mu(3,e,e.return),Kh(3,e)}catch(k){En(e,e.return,k)}try{mu(5,e,e.return)}catch(k){En(e,e.return,k)}}break;case 1:Ps(t,e),Xs(e),r&512&&n!==null&&Sl(n,n.return);break;case 5:if(Ps(t,e),Xs(e),r&512&&n!==null&&Sl(n,n.return),e.flags&32){var s=e.stateNode;try{Pu(s,"")}catch(k){En(e,e.return,k)}}if(r&4&&(s=e.stateNode,s!=null)){var i=e.memoizedProps,a=n!==null?n.memoizedProps:i,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&IC(s,i),$y(l,a);var u=$y(l,i);for(a=0;a<c.length;a+=2){var p=c[a],d=c[a+1];p==="style"?LC(s,d):p==="dangerouslySetInnerHTML"?MC(s,d):p==="children"?Pu(s,d):_w(s,p,d,u)}switch(l){case"input":Py(s,i);break;case"textarea":TC(s,i);break;case"select":var f=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var h=i.value;h!=null?Pl(s,!!i.multiple,h,!1):f!==!!i.multiple&&(i.defaultValue!=null?Pl(s,!!i.multiple,i.defaultValue,!0):Pl(s,!!i.multiple,i.multiple?[]:"",!1))}s[Fu]=i}catch(k){En(e,e.return,k)}}break;case 6:if(Ps(t,e),Xs(e),r&4){if(e.stateNode===null)throw Error(Ne(162));s=e.stateNode,i=e.memoizedProps;try{s.nodeValue=i}catch(k){En(e,e.return,k)}}break;case 3:if(Ps(t,e),Xs(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Mu(t.containerInfo)}catch(k){En(e,e.return,k)}break;case 4:Ps(t,e),Xs(e);break;case 13:Ps(t,e),Xs(e),s=e.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(ob=Mn())),r&4&&lS(e);break;case 22:if(p=n!==null&&n.memoizedState!==null,e.mode&1?(hr=(u=hr)||p,Ps(t,e),hr=u):Ps(t,e),Xs(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!p&&e.mode&1)for(Be=e,p=e.child;p!==null;){for(d=Be=p;Be!==null;){switch(f=Be,h=f.child,f.tag){case 0:case 11:case 14:case 15:mu(4,f,f.return);break;case 1:Sl(f,f.return);var g=f.stateNode;if(typeof g.componentWillUnmount=="function"){r=f,n=f.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(k){En(r,n,k)}}break;case 5:Sl(f,f.return);break;case 22:if(f.memoizedState!==null){uS(d);continue}}h!==null?(h.return=f,Be=h):uS(d)}p=p.sibling}e:for(p=null,d=e;;){if(d.tag===5){if(p===null){p=d;try{s=d.stateNode,u?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=d.stateNode,c=d.memoizedProps.style,a=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=$C("display",a))}catch(k){En(e,e.return,k)}}}else if(d.tag===6){if(p===null)try{d.stateNode.nodeValue=u?"":d.memoizedProps}catch(k){En(e,e.return,k)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;p===d&&(p=null),d=d.return}p===d&&(p=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:Ps(t,e),Xs(e),r&4&&lS(e);break;case 21:break;default:Ps(t,e),Xs(e)}}function Xs(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(aE(n)){var r=n;break e}n=n.return}throw Error(Ne(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Pu(s,""),r.flags&=-33);var i=aS(e);dx(e,i,s);break;case 3:case 4:var a=r.stateNode.containerInfo,l=aS(e);ux(e,l,a);break;default:throw Error(Ne(161))}}catch(c){En(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function H2(e,t,n){Be=e,uE(e)}function uE(e,t,n){for(var r=(e.mode&1)!==0;Be!==null;){var s=Be,i=s.child;if(s.tag===22&&r){var a=s.memoizedState!==null||Nf;if(!a){var l=s.alternate,c=l!==null&&l.memoizedState!==null||hr;l=Nf;var u=hr;if(Nf=a,(hr=c)&&!u)for(Be=s;Be!==null;)a=Be,c=a.child,a.tag===22&&a.memoizedState!==null?dS(s):c!==null?(c.return=a,Be=c):dS(s);for(;i!==null;)Be=i,uE(i),i=i.sibling;Be=s,Nf=l,hr=u}cS(e)}else s.subtreeFlags&8772&&i!==null?(i.return=s,Be=i):cS(e)}}function cS(e){for(;Be!==null;){var t=Be;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:hr||Kh(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!hr)if(n===null)r.componentDidMount();else{var s=t.elementType===t.type?n.memoizedProps:Rs(t.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&U0(t,i,r);break;case 3:var a=t.updateQueue;if(a!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}U0(t,a,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var u=t.alternate;if(u!==null){var p=u.memoizedState;if(p!==null){var d=p.dehydrated;d!==null&&Mu(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(Ne(163))}hr||t.flags&512&&cx(t)}catch(f){En(t,t.return,f)}}if(t===e){Be=null;break}if(n=t.sibling,n!==null){n.return=t.return,Be=n;break}Be=t.return}}function uS(e){for(;Be!==null;){var t=Be;if(t===e){Be=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Be=n;break}Be=t.return}}function dS(e){for(;Be!==null;){var t=Be;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Kh(4,t)}catch(c){En(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var s=t.return;try{r.componentDidMount()}catch(c){En(t,s,c)}}var i=t.return;try{cx(t)}catch(c){En(t,i,c)}break;case 5:var a=t.return;try{cx(t)}catch(c){En(t,a,c)}}}catch(c){En(t,t.return,c)}if(t===e){Be=null;break}var l=t.sibling;if(l!==null){l.return=t.return,Be=l;break}Be=t.return}}var W2=Math.ceil,Gp=Gi.ReactCurrentDispatcher,sb=Gi.ReactCurrentOwner,bs=Gi.ReactCurrentBatchConfig,Ot=0,nr=null,Fn=null,ar=0,Xr=0,Nl=Ho(0),Un=0,Ku=null,ja=0,qh=0,ib=0,gu=null,Lr=null,ob=0,Gl=1/0,Ii=null,Jp=!1,fx=null,Eo=null,jf=!1,bo=null,Xp=0,yu=0,px=null,hp=-1,mp=0;function _r(){return Ot&6?Mn():hp!==-1?hp:hp=Mn()}function Ao(e){return e.mode&1?Ot&2&&ar!==0?ar&-ar:C2.transition!==null?(mp===0&&(mp=YC()),mp):(e=Jt,e!==0||(e=window.event,e=e===void 0?16:t_(e.type)),e):1}function Hs(e,t,n,r){if(50<yu)throw yu=0,px=null,Error(Ne(185));md(e,n,r),(!(Ot&2)||e!==nr)&&(e===nr&&(!(Ot&2)&&(qh|=n),Un===4&&yo(e,ar)),Hr(e,r),n===1&&Ot===0&&!(t.mode&1)&&(Gl=Mn()+500,Hh&&Wo()))}function Hr(e,t){var n=e.callbackNode;C$(e,t);var r=Mp(e,e===nr?ar:0);if(r===0)n!==null&&b0(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&b0(n),t===1)e.tag===0?j2(fS.bind(null,e)):b_(fS.bind(null,e)),k2(function(){!(Ot&6)&&Wo()}),n=null;else{switch(GC(r)){case 1:n=Tw;break;case 4:n=qC;break;case 16:n=Rp;break;case 536870912:n=UC;break;default:n=Rp}n=xE(n,dE.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function dE(e,t){if(hp=-1,mp=0,Ot&6)throw Error(Ne(327));var n=e.callbackNode;if($l()&&e.callbackNode!==n)return null;var r=Mp(e,e===nr?ar:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Qp(e,r);else{t=r;var s=Ot;Ot|=2;var i=pE();(nr!==e||ar!==t)&&(Ii=null,Gl=Mn()+500,ma(e,t));do try{q2();break}catch(l){fE(e,l)}while(!0);Kw(),Gp.current=i,Ot=s,Fn!==null?t=0:(nr=null,ar=0,t=Un)}if(t!==0){if(t===2&&(s=zy(e),s!==0&&(r=s,t=hx(e,s))),t===1)throw n=Ku,ma(e,0),yo(e,r),Hr(e,Mn()),n;if(t===6)yo(e,r);else{if(s=e.current.alternate,!(r&30)&&!V2(s)&&(t=Qp(e,r),t===2&&(i=zy(e),i!==0&&(r=i,t=hx(e,i))),t===1))throw n=Ku,ma(e,0),yo(e,r),Hr(e,Mn()),n;switch(e.finishedWork=s,e.finishedLanes=r,t){case 0:case 1:throw Error(Ne(345));case 2:sa(e,Lr,Ii);break;case 3:if(yo(e,r),(r&130023424)===r&&(t=ob+500-Mn(),10<t)){if(Mp(e,0)!==0)break;if(s=e.suspendedLanes,(s&r)!==r){_r(),e.pingedLanes|=e.suspendedLanes&s;break}e.timeoutHandle=Yy(sa.bind(null,e,Lr,Ii),t);break}sa(e,Lr,Ii);break;case 4:if(yo(e,r),(r&4194240)===r)break;for(t=e.eventTimes,s=-1;0<r;){var a=31-Bs(r);i=1<<a,a=t[a],a>s&&(s=a),r&=~i}if(r=s,r=Mn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*W2(r/1960))-r,10<r){e.timeoutHandle=Yy(sa.bind(null,e,Lr,Ii),r);break}sa(e,Lr,Ii);break;case 5:sa(e,Lr,Ii);break;default:throw Error(Ne(329))}}}return Hr(e,Mn()),e.callbackNode===n?dE.bind(null,e):null}function hx(e,t){var n=gu;return e.current.memoizedState.isDehydrated&&(ma(e,t).flags|=256),e=Qp(e,t),e!==2&&(t=Lr,Lr=n,t!==null&&mx(t)),e}function mx(e){Lr===null?Lr=e:Lr.push.apply(Lr,e)}function V2(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!Vs(i(),s))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function yo(e,t){for(t&=~ib,t&=~qh,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Bs(t),r=1<<n;e[n]=-1,t&=~r}}function fS(e){if(Ot&6)throw Error(Ne(327));$l();var t=Mp(e,0);if(!(t&1))return Hr(e,Mn()),null;var n=Qp(e,t);if(e.tag!==0&&n===2){var r=zy(e);r!==0&&(t=r,n=hx(e,r))}if(n===1)throw n=Ku,ma(e,0),yo(e,t),Hr(e,Mn()),n;if(n===6)throw Error(Ne(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,sa(e,Lr,Ii),Hr(e,Mn()),null}function ab(e,t){var n=Ot;Ot|=1;try{return e(t)}finally{Ot=n,Ot===0&&(Gl=Mn()+500,Hh&&Wo())}}function Ca(e){bo!==null&&bo.tag===0&&!(Ot&6)&&$l();var t=Ot;Ot|=1;var n=bs.transition,r=Jt;try{if(bs.transition=null,Jt=1,e)return e()}finally{Jt=r,bs.transition=n,Ot=t,!(Ot&6)&&Wo()}}function lb(){Xr=Nl.current,yn(Nl)}function ma(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,b2(n)),Fn!==null)for(n=Fn.return;n!==null;){var r=n;switch(Hw(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Fp();break;case 3:Ul(),yn(zr),yn(yr),Xw();break;case 5:Jw(r);break;case 4:Ul();break;case 13:yn(vn);break;case 19:yn(vn);break;case 10:qw(r.type._context);break;case 22:case 23:lb()}n=n.return}if(nr=e,Fn=e=Po(e.current,null),ar=Xr=t,Un=0,Ku=null,ib=qh=ja=0,Lr=gu=null,da!==null){for(t=0;t<da.length;t++)if(n=da[t],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var a=i.next;i.next=s,r.next=a}n.pending=r}da=null}return e}function fE(e,t){do{var n=Fn;try{if(Kw(),dp.current=Yp,Up){for(var r=Nn.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Up=!1}if(Na=0,er=qn=Nn=null,hu=!1,Hu=0,sb.current=null,n===null||n.return===null){Un=1,Ku=t,Fn=null;break}e:{var i=e,a=n.return,l=n,c=t;if(t=ar,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var u=c,p=l,d=p.tag;if(!(p.mode&1)&&(d===0||d===11||d===15)){var f=p.alternate;f?(p.updateQueue=f.updateQueue,p.memoizedState=f.memoizedState,p.lanes=f.lanes):(p.updateQueue=null,p.memoizedState=null)}var h=Z0(a);if(h!==null){h.flags&=-257,eS(h,a,l,i,t),h.mode&1&&Q0(i,u,t),t=h,c=u;var g=t.updateQueue;if(g===null){var k=new Set;k.add(c),t.updateQueue=k}else g.add(c);break e}else{if(!(t&1)){Q0(i,u,t),cb();break e}c=Error(Ne(426))}}else if(wn&&l.mode&1){var w=Z0(a);if(w!==null){!(w.flags&65536)&&(w.flags|=256),eS(w,a,l,i,t),Ww(Yl(c,l));break e}}i=c=Yl(c,l),Un!==4&&(Un=2),gu===null?gu=[i]:gu.push(i),i=a;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var y=G_(i,c,t);q0(i,y);break e;case 1:l=c;var v=i.type,x=i.stateNode;if(!(i.flags&128)&&(typeof v.getDerivedStateFromError=="function"||x!==null&&typeof x.componentDidCatch=="function"&&(Eo===null||!Eo.has(x)))){i.flags|=65536,t&=-t,i.lanes|=t;var C=J_(i,l,t);q0(i,C);break e}}i=i.return}while(i!==null)}mE(n)}catch(N){t=N,Fn===n&&n!==null&&(Fn=n=n.return);continue}break}while(!0)}function pE(){var e=Gp.current;return Gp.current=Yp,e===null?Yp:e}function cb(){(Un===0||Un===3||Un===2)&&(Un=4),nr===null||!(ja&268435455)&&!(qh&268435455)||yo(nr,ar)}function Qp(e,t){var n=Ot;Ot|=2;var r=pE();(nr!==e||ar!==t)&&(Ii=null,ma(e,t));do try{K2();break}catch(s){fE(e,s)}while(!0);if(Kw(),Ot=n,Gp.current=r,Fn!==null)throw Error(Ne(261));return nr=null,ar=0,Un}function K2(){for(;Fn!==null;)hE(Fn)}function q2(){for(;Fn!==null&&!y$();)hE(Fn)}function hE(e){var t=yE(e.alternate,e,Xr);e.memoizedProps=e.pendingProps,t===null?mE(e):Fn=t,sb.current=null}function mE(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=F2(n,t),n!==null){n.flags&=32767,Fn=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Un=6,Fn=null;return}}else if(n=D2(n,t,Xr),n!==null){Fn=n;return}if(t=t.sibling,t!==null){Fn=t;return}Fn=t=e}while(t!==null);Un===0&&(Un=5)}function sa(e,t,n){var r=Jt,s=bs.transition;try{bs.transition=null,Jt=1,U2(e,t,n,r)}finally{bs.transition=s,Jt=r}return null}function U2(e,t,n,r){do $l();while(bo!==null);if(Ot&6)throw Error(Ne(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(Ne(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(_$(e,i),e===nr&&(Fn=nr=null,ar=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||jf||(jf=!0,xE(Rp,function(){return $l(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=bs.transition,bs.transition=null;var a=Jt;Jt=1;var l=Ot;Ot|=4,sb.current=null,B2(e,n),cE(n,e),p2(qy),$p=!!Ky,qy=Ky=null,e.current=n,H2(n),x$(),Ot=l,Jt=a,bs.transition=i}else e.current=n;if(jf&&(jf=!1,bo=e,Xp=s),i=e.pendingLanes,i===0&&(Eo=null),k$(n.stateNode),Hr(e,Mn()),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(Jp)throw Jp=!1,e=fx,fx=null,e;return Xp&1&&e.tag!==0&&$l(),i=e.pendingLanes,i&1?e===px?yu++:(yu=0,px=e):yu=0,Wo(),null}function $l(){if(bo!==null){var e=GC(Xp),t=bs.transition,n=Jt;try{if(bs.transition=null,Jt=16>e?16:e,bo===null)var r=!1;else{if(e=bo,bo=null,Xp=0,Ot&6)throw Error(Ne(331));var s=Ot;for(Ot|=4,Be=e.current;Be!==null;){var i=Be,a=i.child;if(Be.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(Be=u;Be!==null;){var p=Be;switch(p.tag){case 0:case 11:case 15:mu(8,p,i)}var d=p.child;if(d!==null)d.return=p,Be=d;else for(;Be!==null;){p=Be;var f=p.sibling,h=p.return;if(oE(p),p===u){Be=null;break}if(f!==null){f.return=h,Be=f;break}Be=h}}}var g=i.alternate;if(g!==null){var k=g.child;if(k!==null){g.child=null;do{var w=k.sibling;k.sibling=null,k=w}while(k!==null)}}Be=i}}if(i.subtreeFlags&2064&&a!==null)a.return=i,Be=a;else e:for(;Be!==null;){if(i=Be,i.flags&2048)switch(i.tag){case 0:case 11:case 15:mu(9,i,i.return)}var y=i.sibling;if(y!==null){y.return=i.return,Be=y;break e}Be=i.return}}var v=e.current;for(Be=v;Be!==null;){a=Be;var x=a.child;if(a.subtreeFlags&2064&&x!==null)x.return=a,Be=x;else e:for(a=v;Be!==null;){if(l=Be,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Kh(9,l)}}catch(N){En(l,l.return,N)}if(l===a){Be=null;break e}var C=l.sibling;if(C!==null){C.return=l.return,Be=C;break e}Be=l.return}}if(Ot=s,Wo(),ui&&typeof ui.onPostCommitFiberRoot=="function")try{ui.onPostCommitFiberRoot(Oh,e)}catch{}r=!0}return r}finally{Jt=n,bs.transition=t}}return!1}function pS(e,t,n){t=Yl(n,t),t=G_(e,t,1),e=_o(e,t,1),t=_r(),e!==null&&(md(e,1,t),Hr(e,t))}function En(e,t,n){if(e.tag===3)pS(e,e,n);else for(;t!==null;){if(t.tag===3){pS(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Eo===null||!Eo.has(r))){e=Yl(n,e),e=J_(t,e,1),t=_o(t,e,1),e=_r(),t!==null&&(md(t,1,e),Hr(t,e));break}}t=t.return}}function Y2(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=_r(),e.pingedLanes|=e.suspendedLanes&n,nr===e&&(ar&n)===n&&(Un===4||Un===3&&(ar&130023424)===ar&&500>Mn()-ob?ma(e,0):ib|=n),Hr(e,t)}function gE(e,t){t===0&&(e.mode&1?(t=mf,mf<<=1,!(mf&130023424)&&(mf=4194304)):t=1);var n=_r();e=Ki(e,t),e!==null&&(md(e,t,n),Hr(e,n))}function G2(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),gE(e,n)}function J2(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(Ne(314))}r!==null&&r.delete(t),gE(e,n)}var yE;yE=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||zr.current)Or=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Or=!1,O2(e,t,n);Or=!!(e.flags&131072)}else Or=!1,wn&&t.flags&1048576&&k_(t,Hp,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;pp(e,t),e=t.pendingProps;var s=Vl(t,yr.current);Ml(t,n),s=Zw(null,t,r,e,s,n);var i=eb();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,Br(r)?(i=!0,zp(t)):i=!1,t.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Yw(t),s.updater=Vh,t.stateNode=s,s._reactInternals=t,tx(t,r,e,n),t=sx(null,t,r,!0,i,n)):(t.tag=0,wn&&i&&Bw(t),jr(null,t,s,n),t=t.child),t;case 16:r=t.elementType;e:{switch(pp(e,t),e=t.pendingProps,s=r._init,r=s(r._payload),t.type=r,s=t.tag=Q2(r),e=Rs(r,e),s){case 0:t=rx(null,t,r,e,n);break e;case 1:t=rS(null,t,r,e,n);break e;case 11:t=tS(null,t,r,e,n);break e;case 14:t=nS(null,t,r,Rs(r.type,e),n);break e}throw Error(Ne(306,r,""))}return t;case 0:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Rs(r,s),rx(e,t,r,s,n);case 1:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Rs(r,s),rS(e,t,r,s,n);case 3:e:{if(eE(t),e===null)throw Error(Ne(387));r=t.pendingProps,i=t.memoizedState,s=i.element,__(e,t),Kp(t,r,null,n);var a=t.memoizedState;if(r=a.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){s=Yl(Error(Ne(423)),t),t=sS(e,t,r,n,s);break e}else if(r!==s){s=Yl(Error(Ne(424)),t),t=sS(e,t,r,n,s);break e}else for(es=Co(t.stateNode.containerInfo.firstChild),ns=t,wn=!0,Ls=null,n=j_(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Kl(),r===s){t=qi(e,t,n);break e}jr(e,t,r,n)}t=t.child}return t;case 5:return E_(t),e===null&&Qy(t),r=t.type,s=t.pendingProps,i=e!==null?e.memoizedProps:null,a=s.children,Uy(r,s)?a=null:i!==null&&Uy(r,i)&&(t.flags|=32),Z_(e,t),jr(e,t,a,n),t.child;case 6:return e===null&&Qy(t),null;case 13:return tE(e,t,n);case 4:return Gw(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ql(t,null,r,n):jr(e,t,r,n),t.child;case 11:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Rs(r,s),tS(e,t,r,s,n);case 7:return jr(e,t,t.pendingProps,n),t.child;case 8:return jr(e,t,t.pendingProps.children,n),t.child;case 12:return jr(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,s=t.pendingProps,i=t.memoizedProps,a=s.value,cn(Wp,r._currentValue),r._currentValue=a,i!==null)if(Vs(i.value,a)){if(i.children===s.children&&!zr.current){t=qi(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var l=i.dependencies;if(l!==null){a=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=zi(-1,n&-n),c.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var p=u.pending;p===null?c.next=c:(c.next=p.next,p.next=c),u.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Zy(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)a=i.type===t.type?null:i.child;else if(i.tag===18){if(a=i.return,a===null)throw Error(Ne(341));a.lanes|=n,l=a.alternate,l!==null&&(l.lanes|=n),Zy(a,n,t),a=i.sibling}else a=i.child;if(a!==null)a.return=i;else for(a=i;a!==null;){if(a===t){a=null;break}if(i=a.sibling,i!==null){i.return=a.return,a=i;break}a=a.return}i=a}jr(e,t,s.children,n),t=t.child}return t;case 9:return s=t.type,r=t.pendingProps.children,Ml(t,n),s=ks(s),r=r(s),t.flags|=1,jr(e,t,r,n),t.child;case 14:return r=t.type,s=Rs(r,t.pendingProps),s=Rs(r.type,s),nS(e,t,r,s,n);case 15:return X_(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,s=t.pendingProps,s=t.elementType===r?s:Rs(r,s),pp(e,t),t.tag=1,Br(r)?(e=!0,zp(t)):e=!1,Ml(t,n),Y_(t,r,s),tx(t,r,s,n),sx(null,t,r,!0,e,n);case 19:return nE(e,t,n);case 22:return Q_(e,t,n)}throw Error(Ne(156,t.tag))};function xE(e,t){return KC(e,t)}function X2(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 ws(e,t,n,r){return new X2(e,t,n,r)}function ub(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Q2(e){if(typeof e=="function")return ub(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Aw)return 11;if(e===Pw)return 14}return 2}function Po(e,t){var n=e.alternate;return n===null?(n=ws(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 gp(e,t,n,r,s,i){var a=2;if(r=e,typeof e=="function")ub(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case hl:return ga(n.children,s,i,t);case Ew:a=8,s|=8;break;case jy:return e=ws(12,n,t,s|2),e.elementType=jy,e.lanes=i,e;case Cy:return e=ws(13,n,t,s),e.elementType=Cy,e.lanes=i,e;case _y:return e=ws(19,n,t,s),e.elementType=_y,e.lanes=i,e;case EC:return Uh(n,s,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case CC:a=10;break e;case _C:a=9;break e;case Aw:a=11;break e;case Pw:a=14;break e;case po:a=16,r=null;break e}throw Error(Ne(130,e==null?e:typeof e,""))}return t=ws(a,n,t,s),t.elementType=e,t.type=r,t.lanes=i,t}function ga(e,t,n,r){return e=ws(7,e,r,t),e.lanes=n,e}function Uh(e,t,n,r){return e=ws(22,e,r,t),e.elementType=EC,e.lanes=n,e.stateNode={isHidden:!1},e}function jg(e,t,n){return e=ws(6,e,null,t),e.lanes=n,e}function Cg(e,t,n){return t=ws(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Z2(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=og(0),this.expirationTimes=og(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=og(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function db(e,t,n,r,s,i,a,l,c){return e=new Z2(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=ws(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Yw(i),e}function eL(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:pl,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function wE(e){if(!e)return Mo;e=e._reactInternals;e:{if(za(e)!==e||e.tag!==1)throw Error(Ne(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Br(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(Ne(171))}if(e.tag===1){var n=e.type;if(Br(n))return w_(e,n,t)}return t}function bE(e,t,n,r,s,i,a,l,c){return e=db(n,r,!0,e,s,i,a,l,c),e.context=wE(null),n=e.current,r=_r(),s=Ao(n),i=zi(r,s),i.callback=t??null,_o(n,i,s),e.current.lanes=s,md(e,s,r),Hr(e,r),e}function Yh(e,t,n,r){var s=t.current,i=_r(),a=Ao(s);return n=wE(n),t.context===null?t.context=n:t.pendingContext=n,t=zi(i,a),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=_o(s,t,a),e!==null&&(Hs(e,s,a,i),up(e,s,a)),a}function Zp(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 hS(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function fb(e,t){hS(e,t),(e=e.alternate)&&hS(e,t)}function tL(){return null}var kE=typeof reportError=="function"?reportError:function(e){console.error(e)};function pb(e){this._internalRoot=e}Gh.prototype.render=pb.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(Ne(409));Yh(e,t,null,null)};Gh.prototype.unmount=pb.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ca(function(){Yh(null,e,null,null)}),t[Vi]=null}};function Gh(e){this._internalRoot=e}Gh.prototype.unstable_scheduleHydration=function(e){if(e){var t=QC();e={blockedOn:null,target:e,priority:t};for(var n=0;n<go.length&&t!==0&&t<go[n].priority;n++);go.splice(n,0,e),n===0&&e_(e)}};function hb(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Jh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function mS(){}function nL(e,t,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var u=Zp(a);i.call(u)}}var a=bE(t,r,e,0,null,!1,!1,"",mS);return e._reactRootContainer=a,e[Vi]=a.current,Ou(e.nodeType===8?e.parentNode:e),Ca(),a}for(;s=e.lastChild;)e.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var u=Zp(c);l.call(u)}}var c=db(e,0,!1,null,null,!1,!1,"",mS);return e._reactRootContainer=c,e[Vi]=c.current,Ou(e.nodeType===8?e.parentNode:e),Ca(function(){Yh(t,c,n,r)}),c}function Xh(e,t,n,r,s){var i=n._reactRootContainer;if(i){var a=i;if(typeof s=="function"){var l=s;s=function(){var c=Zp(a);l.call(c)}}Yh(t,a,e,s)}else a=nL(n,t,e,s,r);return Zp(a)}JC=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=tu(t.pendingLanes);n!==0&&(Rw(t,n|1),Hr(t,Mn()),!(Ot&6)&&(Gl=Mn()+500,Wo()))}break;case 13:Ca(function(){var r=Ki(e,1);if(r!==null){var s=_r();Hs(r,e,1,s)}}),fb(e,1)}};Mw=function(e){if(e.tag===13){var t=Ki(e,134217728);if(t!==null){var n=_r();Hs(t,e,134217728,n)}fb(e,134217728)}};XC=function(e){if(e.tag===13){var t=Ao(e),n=Ki(e,t);if(n!==null){var r=_r();Hs(n,e,t,r)}fb(e,t)}};QC=function(){return Jt};ZC=function(e,t){var n=Jt;try{return Jt=e,t()}finally{Jt=n}};Oy=function(e,t,n){switch(t){case"input":if(Py(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=Bh(r);if(!s)throw Error(Ne(90));PC(r),Py(r,s)}}}break;case"textarea":TC(e,n);break;case"select":t=n.value,t!=null&&Pl(e,!!n.multiple,t,!1)}};FC=ab;zC=Ca;var rL={usingClientEntryPoint:!1,Events:[yd,xl,Bh,OC,DC,ab]},Bc={findFiberByHostInstance:ua,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},sL={bundleType:Bc.bundleType,version:Bc.version,rendererPackageName:Bc.rendererPackageName,rendererConfig:Bc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Gi.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=WC(e),e===null?null:e.stateNode},findFiberByHostInstance:Bc.findFiberByHostInstance||tL,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 Cf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Cf.isDisabled&&Cf.supportsFiber)try{Oh=Cf.inject(sL),ui=Cf}catch{}}os.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=rL;os.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!hb(t))throw Error(Ne(200));return eL(e,t,null,n)};os.createRoot=function(e,t){if(!hb(e))throw Error(Ne(299));var n=!1,r="",s=kE;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(s=t.onRecoverableError)),t=db(e,1,!1,null,null,n,!1,r,s),e[Vi]=t.current,Ou(e.nodeType===8?e.parentNode:e),new pb(t)};os.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(Ne(188)):(e=Object.keys(e).join(","),Error(Ne(268,e)));return e=WC(t),e=e===null?null:e.stateNode,e};os.flushSync=function(e){return Ca(e)};os.hydrate=function(e,t,n){if(!Jh(t))throw Error(Ne(200));return Xh(null,e,t,!0,n)};os.hydrateRoot=function(e,t,n){if(!hb(e))throw Error(Ne(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",a=kE;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(a=n.onRecoverableError)),t=bE(t,null,e,1,n??null,s,!1,i,a),e[Vi]=t.current,Ou(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 Gh(t)};os.render=function(e,t,n){if(!Jh(t))throw Error(Ne(200));return Xh(null,e,t,!1,n)};os.unmountComponentAtNode=function(e){if(!Jh(e))throw Error(Ne(40));return e._reactRootContainer?(Ca(function(){Xh(null,null,e,!1,function(){e._reactRootContainer=null,e[Vi]=null})}),!0):!1};os.unstable_batchedUpdates=ab;os.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Jh(n))throw Error(Ne(200));if(e==null||e._reactInternals===void 0)throw Error(Ne(38));return Xh(e,t,n,!1,r)};os.version="18.3.1-next-f1338f8080-20240426";function vE(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(vE)}catch(e){console.error(e)}}vE(),vC.exports=os;var Cr=vC.exports,gS=Cr;Sy.createRoot=gS.createRoot,Sy.hydrateRoot=gS.hydrateRoot;const SE=m.createContext(null);function gx(e){let t=e||"/";return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t||"/"}function iL(){const e=gx(window.location.pathname);return e==="/"?(window.history.replaceState({},"","/projects"),"/projects"):e}function oL({children:e}){const[t,n]=m.useState(iL);m.useEffect(()=>{const i=()=>n(gx(window.location.pathname));return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[]);const r=m.useCallback(i=>{const a=i.startsWith("/")?i:`/${i}`;let l;try{l=new URL(a,window.location.origin)}catch{l=new URL("/",window.location.origin)}const c=gx(l.pathname),u=l.search||"";window.history.pushState({},"",c+u),n(c)},[]),s=m.useMemo(()=>({path:t,navigate:r}),[t,r]);return o.jsx(SE.Provider,{value:s,children:e})}function xi(){const e=m.useContext(SE);if(!e)throw new Error("useRoute must be used within RouteProvider");return e}function aL(){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 yS={};function yx(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&yS[t[0]]||(typeof t[0]=="string"&&(yS[t[0]]=new Date),aL(...t))}const NE=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function xS(e,t,n){e.loadNamespaces(t,NE(e,n))}function wS(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,NE(e,r))}function lL(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],s=t.options?t.options.fallbackLng:!1,i=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(l,c)=>{const u=t.services.backendConnector.state[`${l}|${c}`];return u===-1||u===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!a(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||a(r,e)&&(!s||a(i,e)))}function cL(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(yx("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(s,i)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&s.services.backendConnector.backend&&s.isLanguageChangingTo&&!i(s.isLanguageChangingTo,e))return!1}}):lL(e,t,n)}const uL=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,dL={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},fL=e=>dL[e],pL=e=>e.replace(uL,fL);let xx={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:pL};function hL(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};xx={...xx,...e}}function mL(){return xx}let jE;function gL(e){jE=e}function yL(){return jE}const xL={type:"3rdParty",init(e){hL(e.options.react),gL(e)}},wL=m.createContext();class bL{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const kL=(e,t)=>{const n=m.useRef();return m.useEffect(()=>{n.current=e},[e,t]),n.current};function Pr(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:s}=m.useContext(wL)||{},i=n||r||yL();if(i&&!i.reportNamespaces&&(i.reportNamespaces=new bL),!i){yx("You will need to pass in an i18next instance by using initReactI18next");const x=(N,j)=>typeof j=="string"?j:j&&typeof j=="object"&&typeof j.defaultValue=="string"?j.defaultValue:Array.isArray(N)?N[N.length-1]:N,C=[x,{},!1];return C.t=x,C.i18n={},C.ready=!1,C}i.options.react&&i.options.react.wait!==void 0&&yx("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...mL(),...i.options.react,...t},{useSuspense:l,keyPrefix:c}=a;let u=e||s||i.options&&i.options.defaultNS;u=typeof u=="string"?[u]:u||["translation"],i.reportNamespaces.addUsedNamespaces&&i.reportNamespaces.addUsedNamespaces(u);const p=(i.isInitialized||i.initializedStoreOnce)&&u.every(x=>cL(x,i,a));function d(){return i.getFixedT(t.lng||null,a.nsMode==="fallback"?u:u[0],c)}const[f,h]=m.useState(d);let g=u.join();t.lng&&(g=`${t.lng}${g}`);const k=kL(g),w=m.useRef(!0);m.useEffect(()=>{const{bindI18n:x,bindI18nStore:C}=a;w.current=!0,!p&&!l&&(t.lng?wS(i,t.lng,u,()=>{w.current&&h(d)}):xS(i,u,()=>{w.current&&h(d)})),p&&k&&k!==g&&w.current&&h(d);function N(){w.current&&h(d)}return x&&i&&i.on(x,N),C&&i&&i.store.on(C,N),()=>{w.current=!1,x&&i&&x.split(" ").forEach(j=>i.off(j,N)),C&&i&&C.split(" ").forEach(j=>i.store.off(j,N))}},[i,g]);const y=m.useRef(!0);m.useEffect(()=>{w.current&&!y.current&&h(d),y.current=!1},[i,c]);const v=[f,i,p];if(v.t=f,v.i18n=i,v.ready=p,p||!p&&!l)return v;throw new Promise(x=>{t.lng?wS(i,t.lng,u,()=>x()):xS(i,u,()=>x())})}const CE="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",vL=[{to:"/projects",labelKey:"common:nav.projects",icon:"folder_open"},{to:"/workspaces",label:"知识库",icon:"folder_managed"},{to:"/nodes",labelKey:"common:nav.nodes",icon:"account_tree"},{to:"/my-flows",labelKey:"common:nav.myFlows",icon:"schema"},{to:"/skills",labelKey:"common:nav.skills",icon:"extension"},{to:"/mcps",labelKey:"common:nav.mcps",icon:"hub"},{to:"/node-studio",label:"节点编辑器",icon:"draw"},{to:"/schedules",label:"定时任务",icon:"event_busy"},{to:"/admin/usage",label:"管理看板",icon:"query_stats",adminOnly:!0},{to:"/feedback",labelKey:"common:nav.feedback",icon:"rate_review"},{to:"/settings",labelKey:"common:nav.settings",icon:"settings"}],SL=[{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 NL(e,t){return t==="/projects"?e==="/projects"||e==="/":t==="/nodes"?e==="/nodes"||e==="/my-nodes":e===t||e.startsWith(t+"/")}function jL({authUser:e,onLogout:t}){const{path:n,navigate:r}=xi(),{t:s}=Pr(),[i,a]=m.useState(!1);return m.useEffect(()=>{let l=!1;return fetch("/api/ui-context").then(c=>c.json()).then(c=>{l||a(!!c.hideCommunityLinks)}).catch(()=>{}),()=>{l=!0}},[]),o.jsxs("aside",{className:"af-sidebar","aria-label":s("flow:sidebar.mainNav"),children:[o.jsxs("div",{className:"af-brand",children:[o.jsx("div",{className:"af-brand-mark","aria-hidden":!0,children:o.jsx("img",{src:CE,alt:"",width:"36",height:"36",decoding:"async"})}),o.jsxs("div",{children:[o.jsx("h1",{className:"af-brand-title",children:"Agentflow"}),o.jsx("p",{className:"af-brand-tag",children:"Orchestration Engine"})]})]}),o.jsx("nav",{className:"af-nav",children:vL.filter(l=>!l.adminOnly||(e==null?void 0:e.isAdmin)).map(l=>o.jsxs("button",{type:"button",className:"af-nav-link"+(NL(n,l.to)?" af-nav-link--active":""),onClick:()=>r(l.to),children:[o.jsx("span",{className:"material-symbols-outlined",children:l.icon}),o.jsx("span",{children:l.label||s(l.labelKey)})]},l.to))}),o.jsxs("div",{className:"af-sidebar-footer",children:[o.jsxs("div",{className:"af-sidebar-user",title:(e==null?void 0:e.username)||(e==null?void 0:e.userId)||"",children:[o.jsx("span",{className:"material-symbols-outlined",children:"person"}),o.jsx("span",{children:(e==null?void 0:e.username)||(e==null?void 0:e.userId)||""}),e!=null&&e.isAdmin?o.jsx("span",{className:"af-sidebar-admin-badge",children:"Admin"}):null,o.jsx("button",{type:"button",className:"af-sidebar-logout",onClick:t,"aria-label":"Logout",title:"Logout",children:o.jsx("span",{className:"material-symbols-outlined",children:"logout"})})]}),!i&&SL.map(l=>{const c=s(l.labelKey);return o.jsx("a",{className:"af-sidebar-ext",href:l.href,target:"_blank",rel:"noopener noreferrer","aria-label":c,title:c,children:o.jsx("span",{className:"material-symbols-outlined",children:l.icon})},l.href)})]})]})}const CL="agentflow.pipelineRecent",_L=15;function EL(e){try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function AL(){if(typeof localStorage>"u")return[];const e=localStorage.getItem(CL);return e?EL(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 PL(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 bS(e,t){const n=Date.now(),r=Math.max(0,n-e),s=Math.floor(r/1e3);if(s<60)return t("flow:time.justNow");const i=Math.floor(s/60);if(i<60)return t("flow:time.minutesAgo",{n:i});const a=Math.floor(i/60);if(a<24)return t("flow:time.hoursAgo",{n:a});const l=new Date(e),c=new Date,u=new Date(c);if(u.setDate(u.getDate()-1),l.toDateString()===u.toDateString())return t("flow:time.yesterday");const p=Math.floor(a/24);return p<7?t("flow:time.daysAgo",{n:p}):`${l.getMonth()+1}/${l.getDate()}`}function IL(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:PL(n,s.flowId),kind:"executed",at:s.at});for(const s of t)r.push({flowId:s.flowId,flowSource:s.flowSource,kind:"opened",at:s.at});return r.sort((s,i)=>i.at-s.at),r.slice(0,_L)}var Qr=Uint8Array,jl=Uint16Array,TL=Int32Array,_E=new Qr([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]),EE=new Qr([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]),RL=new Qr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),AE=function(e,t){for(var n=new jl(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var s=new TL(n[30]),r=1;r<30;++r)for(var i=n[r];i<n[r+1];++i)s[i]=i-n[r]<<5|r;return{b:n,r:s}},PE=AE(_E,2),IE=PE.b,ML=PE.r;IE[28]=258,ML[258]=28;var $L=AE(EE,0),LL=$L.b,wx=new jl(32768);for(var gn=0;gn<32768;++gn){var ao=(gn&43690)>>1|(gn&21845)<<1;ao=(ao&52428)>>2|(ao&13107)<<2,ao=(ao&61680)>>4|(ao&3855)<<4,wx[gn]=((ao&65280)>>8|(ao&255)<<8)>>1}var xu=function(e,t,n){for(var r=e.length,s=0,i=new jl(t);s<r;++s)e[s]&&++i[e[s]-1];var a=new jl(t);for(s=1;s<t;++s)a[s]=a[s-1]+i[s-1]<<1;var l;if(n){l=new jl(1<<t);var c=15-t;for(s=0;s<r;++s)if(e[s])for(var u=s<<4|e[s],p=t-e[s],d=a[e[s]-1]++<<p,f=d|(1<<p)-1;d<=f;++d)l[wx[d]>>c]=u}else for(l=new jl(r),s=0;s<r;++s)e[s]&&(l[s]=wx[a[e[s]-1]++]>>15-e[s]);return l},wd=new Qr(288);for(var gn=0;gn<144;++gn)wd[gn]=8;for(var gn=144;gn<256;++gn)wd[gn]=9;for(var gn=256;gn<280;++gn)wd[gn]=7;for(var gn=280;gn<288;++gn)wd[gn]=8;var TE=new Qr(32);for(var gn=0;gn<32;++gn)TE[gn]=5;var OL=xu(wd,9,1),DL=xu(TE,5,1),_g=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Is=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},Eg=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},FL=function(e){return(e+7)/8|0},mb=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Qr(e.subarray(t,n))},zL=["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"],hs=function(e,t,n){var r=new Error(t||zL[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,hs),!n)throw r;return r},BL=function(e,t,n,r){var s=e.length,i=r?r.length:0;if(!s||t.f&&!t.l)return n||new Qr(0);var a=!n,l=a||t.i!=2,c=t.i;a&&(n=new Qr(s*3));var u=function(ce){var de=n.length;if(ce>de){var me=new Qr(Math.max(de*2,ce));me.set(n),n=me}},p=t.f||0,d=t.p||0,f=t.b||0,h=t.l,g=t.d,k=t.m,w=t.n,y=s*8;do{if(!h){p=Is(e,d,1);var v=Is(e,d+1,3);if(d+=3,v)if(v==1)h=OL,g=DL,k=9,w=5;else if(v==2){var j=Is(e,d,31)+257,E=Is(e,d+10,15)+4,P=j+Is(e,d+5,31)+1;d+=14;for(var O=new Qr(P),B=new Qr(19),W=0;W<E;++W)B[RL[W]]=Is(e,d+W*3,7);d+=E*3;for(var z=_g(B),L=(1<<z)-1,R=xu(B,z,1),W=0;W<P;){var K=R[Is(e,d,L)];d+=K&15;var x=K>>4;if(x<16)O[W++]=x;else{var D=0,$=0;for(x==16?($=3+Is(e,d,3),d+=2,D=O[W-1]):x==17?($=3+Is(e,d,7),d+=3):x==18&&($=11+Is(e,d,127),d+=7);$--;)O[W++]=D}}var I=O.subarray(0,j),F=O.subarray(j);k=_g(I),w=_g(F),h=xu(I,k,1),g=xu(F,w,1)}else hs(1);else{var x=FL(d)+4,C=e[x-4]|e[x-3]<<8,N=x+C;if(N>s){c&&hs(0);break}l&&u(f+C),n.set(e.subarray(x,N),f),t.b=f+=C,t.p=d=N*8,t.f=p;continue}if(d>y){c&&hs(0);break}}l&&u(f+131072);for(var _=(1<<k)-1,X=(1<<w)-1,V=d;;V=d){var D=h[Eg(e,d)&_],T=D>>4;if(d+=D&15,d>y){c&&hs(0);break}if(D||hs(2),T<256)n[f++]=T;else if(T==256){V=d,h=null;break}else{var ee=T-254;if(T>264){var W=T-257,ie=_E[W];ee=Is(e,d,(1<<ie)-1)+IE[W],d+=ie}var G=g[Eg(e,d)&X],se=G>>4;G||hs(3),d+=G&15;var F=LL[se];if(se>3){var ie=EE[se];F+=Eg(e,d)&(1<<ie)-1,d+=ie}if(d>y){c&&hs(0);break}l&&u(f+131072);var te=f+ee;if(f<F){var re=i-F,ne=Math.min(F,te);for(re+f<0&&hs(3);f<ne;++f)n[f]=r[re+f]}for(;f<te;++f)n[f]=n[f-F]}}t.l=h,t.p=V,t.b=f,t.f=p,h&&(p=1,t.m=k,t.d=g,t.n=w)}while(!p);return f!=n.length&&a?mb(n,0,f):n.subarray(0,f)},HL=new Qr(0),ii=function(e,t){return e[t]|e[t+1]<<8},Os=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},Ag=function(e,t){return Os(e,t)+Os(e,t+4)*4294967296};function WL(e,t){return BL(e,{i:2},t&&t.out,t&&t.dictionary)}var bx=typeof TextDecoder<"u"&&new TextDecoder,VL=0;try{bx.decode(HL,{stream:!0}),VL=1}catch{}var KL=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:mb(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 qL(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(bx)return bx.decode(e);var s=KL(e),i=s.s,n=s.r;return n.length&&hs(8),i}}var UL=function(e,t){return t+30+ii(e,t+26)+ii(e,t+28)},YL=function(e,t,n){var r=ii(e,t+28),s=qL(e.subarray(t+46,t+46+r),!(ii(e,t+8)&2048)),i=t+46+r,a=Os(e,t+20),l=n&&a==4294967295?GL(e,i):[a,Os(e,t+24),Os(e,t+42)],c=l[0],u=l[1],p=l[2];return[ii(e,t+10),c,u,s,i+ii(e,t+30)+ii(e,t+32),p]},GL=function(e,t){for(;ii(e,t)!=1;t+=4+ii(e,t+2));return[Ag(e,t+12),Ag(e,t+4),Ag(e,t+20)]};function JL(e,t){for(var n={},r=e.length-22;Os(e,r)!=101010256;--r)(!r||e.length-r>65558)&&hs(13);var s=ii(e,r+8);if(!s)return{};var i=Os(e,r+16),a=i==4294967295||s==65535;if(a){var l=Os(e,r-12);a=Os(e,l)==101075792,a&&(s=Os(e,l+32),i=Os(e,l+48))}for(var c=0;c<s;++c){var u=YL(e,i,a),p=u[0],d=u[1],f=u[2],h=u[3],g=u[4],k=u[5],w=UL(e,k);i=g,p?p==8?n[h]=WL(e.subarray(w,w+d),{out:new Qr(f)}):hs(14,"unknown compression type "+p):n[h]=mb(e,w,w+d)}return n}const XL=8*1024*1024,QL=500;function ZL(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 eO(e){return e?e.split("/").some(n=>n==="__MACOSX"||n.startsWith("._")):!0}function tO(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 nO=/^[a-zA-Z][a-zA-Z0-9_-]*$/;async function rO(e){try{const t=new Uint8Array(await e.arrayBuffer()),n=JL(t),r=new Map;let s=0,i=0;for(const[c,u]of Object.entries(n)){if(c.endsWith("/"))continue;const p=ZL(c);if(!p||eO(p))continue;const d=(u==null?void 0:u.length)??0;if(s+=d,s>XL||(i+=1,i>QL))return null;r.set(p,d)}if(r.size===0)return null;const a=new Set;for(const c of r.keys()){const u=tO(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 nO.test(l)?l:null}catch{return null}}const Pg=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function sO({file:e,onClose:t,onImported:n}){const{t:r}=Pr(),s=m.useId(),i=m.useRef(null),a=m.useRef(null),[l,c]=m.useState(""),[u,p]=m.useState("user"),[d,f]=m.useState(!1),[h,g]=m.useState(""),[k,w]=m.useState(null),y=k??e;m.useEffect(()=>{const N=requestAnimationFrame(()=>{var j;return(j=i.current)==null?void 0:j.focus()});return()=>cancelAnimationFrame(N)},[]),m.useEffect(()=>{let N=!1;return(async()=>{const j=y.name||"",E=j.toLowerCase();let P="";if(E.endsWith(".zip")){if(P=await rO(y)||"",!P){const O=j.replace(/\.zip$/i,"");Pg.test(O)&&(P=O)}}else if(E.endsWith(".yaml")||E.endsWith(".yml")){const O=j.replace(/\.ya?ml$/i,"");Pg.test(O)&&(P=O)}N||c(P)})(),()=>{N=!0}},[y]);const v=l.trim(),x=v.length>0&&Pg.test(v);async function C(N){if(N.preventDefault(),!(!x||d)){f(!0),g("");try{const j=new FormData;j.set("flowId",v),j.set("targetSpace",u),j.set("file",y,y.name);const E=await fetch("/api/flows/import",{method:"POST",body:j}),P=await E.json().catch(()=>({}));if(!E.ok){g(typeof P.error=="string"?P.error:r("project:importModal.importFailed"));return}n({id:P.flowId,source:P.flowSource??"user"})}catch(j){g(String((j==null?void 0:j.message)||j))}finally{f(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:N=>{N.target===N.currentTarget&&t()},children:o.jsxs("div",{ref:i,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":s,tabIndex:-1,onMouseDown:N=>N.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:s,className:"af-shortcuts-panel__title",children:r("project:importModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":r("project:importModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:C,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:r("project:importModal.lead",{filename:y.name})}),o.jsx("input",{ref:a,type:"file",className:"af-import-file-input",accept:".yaml,.yml,.zip,application/zip","aria-hidden":!0,tabIndex:-1,onChange:N=>{var E;const j=(E=N.target.files)==null?void 0:E[0];j&&w(j),N.target.value=""}}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:importModal.nameLabel")}),o.jsx("input",{className:"af-new-pipeline-input",type:"text",name:"importFlowId",autoComplete:"off",spellCheck:!1,placeholder:r("project:importModal.namePlaceholder"),value:l,onChange:N=>c(N.target.value),"aria-invalid":v.length>0&&!x}),o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r("project:importModal.nameHint")})]}),o.jsx("div",{className:"af-import-repick",children:o.jsx("button",{type:"button",className:"af-btn-secondary af-import-repick-btn",onClick:()=>{var N;return(N=a.current)==null?void 0:N.click()},children:r("project:importModal.changeFile")})}),h?o.jsx("p",{className:"af-err af-new-pipeline-err",children:h}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:d,children:r("project:importModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!x||d,children:r(d?"project:importModal.importing":"project:importModal.importAndOpen")})]})]})]})})}const iO=/^[a-zA-Z][a-zA-Z0-9_-]*$/,kS="af:newPipelineGuide";function oO({open:e,onClose:t,onCreated:n}){const{t:r}=Pr(),s=m.useId(),i=m.useRef(null),[a,l]=m.useState(""),[c,u]=m.useState(""),[p,d]=m.useState("user"),[f,h]=m.useState(!1),[g,k]=m.useState(""),[w,y]=m.useState(!1);m.useEffect(()=>{if(!e)return;l(""),u(""),d("user"),k(""),h(!1),localStorage.getItem(kS)==="true"&&y(!0);const E=requestAnimationFrame(()=>{var P;return(P=i.current)==null?void 0:P.focus()});return()=>cancelAnimationFrame(E)},[e]);const v=()=>{localStorage.removeItem(kS),y(!1)};if(!e)return null;const x=a.trim(),C=x.length>0&&iO.test(x);async function N(j){if(j.preventDefault(),!(!C||f)){h(!0),k(""),v();try{const E=await fetch("/api/flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:x,description:c.trim(),targetSpace:p})}),P=await E.json().catch(()=>({}));if(!E.ok){k(typeof P.error=="string"?P.error:r("project:newPipelineModal.createFailed"));return}n({id:P.flowId,source:P.flowSource??"user"})}catch(E){k(String((E==null?void 0:E.message)||E))}finally{h(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:j=>{j.target===j.currentTarget&&(v(),t())},children:o.jsxs("div",{ref:i,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":s,tabIndex:-1,onMouseDown:j=>j.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:s,className:"af-shortcuts-panel__title",children:r("project:newPipelineModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:()=>{v(),t()},"aria-label":r("project:newPipelineModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),w?o.jsx("div",{className:"af-new-pipeline-guide",children:o.jsxs("div",{className:"af-new-pipeline-guide-content",children:[o.jsx("span",{className:"material-symbols-outlined af-new-pipeline-guide-icon",children:"lightbulb"}),o.jsxs("div",{className:"af-new-pipeline-guide-text",children:[o.jsx("p",{children:o.jsx("strong",{children:r("onboarding:newPipeline.guideTitle")})}),o.jsx("p",{children:r("onboarding:newPipeline.guideDesc")})]}),o.jsx("button",{type:"button",className:"af-new-pipeline-guide-close",onClick:v,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})}):null,o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:N,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:r("project:newPipelineModal.lead")}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:newPipelineModal.nameLabel")}),o.jsx("input",{className:"af-new-pipeline-input",type:"text",name:"pipelineName",autoComplete:"off",spellCheck:!1,placeholder:r("project:newPipelineModal.namePlaceholder"),value:a,onChange:j=>l(j.target.value),"aria-invalid":x.length>0&&!C}),o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r(w?"onboarding:newPipeline.nameHintGuide":"project:newPipelineModal.nameHint")})]}),o.jsxs("label",{className:"af-pipeline-drawer-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:newPipelineModal.descLabel")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea af-new-pipeline-textarea",name:"pipelineDescription",rows:3,placeholder:r(w?"onboarding:newPipeline.descPlaceholderGuide":"project:newPipelineModal.descPlaceholder"),value:c,onChange:j=>u(j.target.value)}),w?o.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-guide-hint",children:r("onboarding:newPipeline.descHintGuide")}):null]}),g?o.jsx("p",{className:"af-err af-new-pipeline-err",children:g}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:()=>{v(),t()},disabled:f,children:r("project:newPipelineModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!C||f,children:r(f?"project:newPipelineModal.creating":w?"onboarding:newPipeline.createGuide":"project:newPipelineModal.createAndOpen")})]})]})]})})}const RE="agentflow.pipelineViewPreference";function ME(e,t="user",n=!1){return`${String(t||"user")}:${String(e||"")}:${n?"archived":"active"}`}function $E(){if(typeof localStorage>"u")return{};try{const e=JSON.parse(localStorage.getItem(RE)||"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function aO(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(RE,JSON.stringify(e))}catch{}}function gb(e){return e==="display"?"display":"workspace"}function lO(e){const t=String(e||"").toLowerCase();return t==="builtin"||t==="admin"}function LE(e,t){const n=gb(t);return n==="pipeline"&&lO(e==null?void 0:e.source)?"workspace":n}function cO(e){return(e==null?void 0:e.hasPipeline)!==!1&&(e==null?void 0:e.hasFlow)!==!1&&(e==null?void 0:e.flowYaml)!==!1}function uO(e,t,n,r=!1){if(!e)return;const s=$E();s[ME(e,t,r)]={view:gb(n),at:Date.now()},aO(s)}function dO(e,t="workspace"){if(!(e!=null&&e.id))return gb(t);const r=$E()[ME(e.id,e.source??"user",!!e.archived)],s=LE(e,(r==null?void 0:r.view)||t);return s==="pipeline"&&!cO(e)?"workspace":s}function fO(e,t="workspace"){const n=LE(e,t);if(!(e!=null&&e.id))return n==="display"?"/workspace?view=display":"/workspace";const r=new URLSearchParams({flowId:e.id,flowSource:e.source??"user"});return e.archived&&r.set("archived","1"),n==="display"&&r.set("view","display"),`/workspace?${r.toString()}`}function _f(e,t="workspace"){return fO(e,dO(e,t))}function pO(e,t){const n=String(e||"").split(/[.-]/).map(i=>Number.parseInt(i,10)),r=String(t||"").split(/[.-]/).map(i=>Number.parseInt(i,10)),s=Math.max(n.length,r.length);for(let i=0;i<s;i+=1){const a=Number.isFinite(n[i])?n[i]:0,l=Number.isFinite(r[i])?r[i]:0;if(a!==l)return a>l?1:-1}return 0}function kx(e){return String((e==null?void 0:e.version)||"").trim()}function hO(e){const t=kx(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 mO({onChanged:e,canManage:t=!1}){const[n,r]=m.useState({available:!1,version:"",loggedIn:!1,user:"",error:""}),[s,i]=m.useState([]),[a,l]=m.useState(""),[c,u]=m.useState(""),[p,d]=m.useState("keyword"),[f,h]=m.useState([]),[g,k]=m.useState({}),[w,y]=m.useState(""),[v,x]=m.useState(""),[C,N]=m.useState(""),j=m.useCallback(async()=>{x("");try{const[z,L]=await Promise.all([fetch("/api/skillhub/status"),fetch("/api/skillhub/list?target=agentflow&agent=codex")]),R=await z.json().catch(()=>({}));z.ok&&r({available:!!R.available,version:typeof R.version=="string"?R.version:"",loggedIn:!!R.loggedIn,user:typeof R.user=="string"?R.user:"",error:typeof R.error=="string"?R.error:""});const K=await L.json().catch(()=>({}));if(!L.ok)throw new Error(typeof K.error=="string"?K.error:"HTTP "+L.status);i(Array.isArray(K.skills)?K.skills:[]),l(typeof K.skillsRoot=="string"?K.skillsRoot:""),k({})}catch(z){x(String(z.message||z))}},[]);m.useEffect(()=>{j()},[j]);const E=m.useCallback(async()=>{const z=c.trim();if(z){y("search"),x(""),N("");try{const L=await fetch(`/api/skillhub/search?q=${encodeURIComponent(z)}&mode=${encodeURIComponent(p)}`),R=await L.json().catch(()=>({}));if(!L.ok)throw new Error(typeof R.error=="string"?R.error:"HTTP "+L.status);h(Array.isArray(R.items)?R.items:[])}catch(L){x(String(L.message||L))}finally{y("")}}},[c,p]),P=m.useCallback(async(z,L=!1)=>{if(!t)return;const R=z&&typeof z=="object"?z:null,K=String(R?R.slug||R.name||R.collection||R.skillId||R.id:z||"").trim();if(K){y(`install:${K}`),x(""),N("");try{const D=R?{slug:R.slug||"",skillId:R.skillId||"",collection:R.collection||"",collectionName:R.collection&&R.name||"",target:"agentflow",agent:"codex",force:L}:{slug:K,target:"agentflow",agent:"codex",force:L},$=await fetch("/api/skillhub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(D)}),I=await $.json().catch(()=>({}));if(!$.ok)throw new Error(typeof I.error=="string"?I.error:"HTTP "+$.status);N(L?`已更新 ${K}`:`已安装 ${K}`),await j(),typeof e=="function"&&await e()}catch(D){x(String(D.message||D))}finally{y("")}}},[t,j,e]),O=m.useCallback(async()=>{if(t&&s.length!==0){y("check-updates"),x(""),N("");try{const z=await Promise.all(s.map(async K=>{const D=String(K.name||"").trim();if(!D)return null;try{const $=await fetch(`/api/skillhub/search?q=${encodeURIComponent(D)}&mode=keyword`),I=await $.json().catch(()=>({}));if(!$.ok)throw new Error(typeof I.error=="string"?I.error:"HTTP "+$.status);const F=Array.isArray(I.items)?I.items:[],_=F.find(ee=>ee.slug===D||ee.name===D||ee.id===D)||F[0],X=kx(K),V=String((_==null?void 0:_.version)||"").trim();let T="unknown";return _?X&&V?T=pO(X,V)<0?"update":"current":V&&(T="remote-only"):T="missing",[D,{state:T,latestVersion:V,installedVersion:X,summary:(_==null?void 0:_.summary)||""}]}catch($){return[D,{state:"error",error:String($.message||$),installedVersion:kx(K)}]}})),L={};for(const K of z)K&&(L[K[0]]=K[1]);k(L);const R=Object.values(L).filter(K=>K.state==="update").length;N(R>0?`发现 ${R} 个可更新 skill`:"已检查,暂无明确可更新项")}finally{y("")}}},[t,s]),B=m.useCallback(async z=>{if(!t)return;const L=String(z||"").trim();if(L){y(`uninstall:${L}`),x(""),N("");try{const R=await fetch("/api/skillhub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:L,target:"agentflow",agent:"codex"})}),K=await R.json().catch(()=>({}));if(!R.ok)throw new Error(typeof K.error=="string"?K.error:"HTTP "+R.status);N(`已卸载 ${L}`),await j(),typeof e=="function"&&await e()}catch(R){x(String(R.message||R))}finally{y("")}}},[t,j,e]),W=m.useCallback(async()=>{if(t){y("update-cli"),x(""),N("");try{const z=await fetch("/api/skillhub/update",{method:"POST"}),L=await z.json().catch(()=>({}));if(!z.ok)throw new Error(typeof L.error=="string"?L.error:"HTTP "+z.status);N("SkillHub CLI 已更新"),await j()}catch(z){x(String(z.message||z))}finally{y("")}}},[t,j]);return o.jsxs("section",{className:"af-set-card af-set-card--span-all af-set-skillhub",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:"SkillHub"}),o.jsx("p",{className:"af-set-p af-set-p--tight",children:t?"搜索、安装、更新和卸载 AgentFlow 共享 skills。":"查看 AgentFlow 共享 skills;使用时在 Workspace 中通过 Load Skills 加载。"}),a?o.jsxs("p",{className:"af-set-hint af-set-hint--inline",children:["Skills Root:",o.jsx("code",{children:a})]}):null]}),o.jsxs("div",{className:"af-set-skillhub-head-actions",children:[o.jsxs("div",{className:"af-set-skillhub-status",children:[o.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:"extension"}),o.jsx("span",{children:n.loggedIn?`已登录 ${n.user}`:"未登录 SkillHub"}),o.jsx("span",{className:"af-set-badge"+(n.available?" af-set-badge--ok":" af-set-badge--err"),children:n.available?`v${n.version}`:"not found"})]}),o.jsxs("div",{className:"af-set-skillhub-toolbar",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:j,disabled:!!w,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:O,disabled:!t||!!w||s.length===0,children:w==="check-updates"?"检查中…":"检查更新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:W,disabled:!t||!!w,children:w==="update-cli"?"更新中…":"更新 CLI"})]})]})]}),o.jsxs("div",{className:"af-set-skillhub-search",children:[o.jsxs("select",{className:"af-set-input af-set-input--sm af-set-skillhub-search-mode",value:p,onChange:z=>{d(z.target.value),h([])},children:[o.jsx("option",{value:"keyword",children:"关键词"}),o.jsx("option",{value:"skillId",children:"Skill ID"}),o.jsx("option",{value:"collectionId",children:"Collection ID"})]}),o.jsx("input",{className:"af-set-input af-set-input--sm",value:c,onChange:z=>u(z.target.value),onKeyDown:z=>{z.key==="Enter"&&E()},placeholder:p==="collectionId"?"输入 collection id,例如 1":p==="skillId"?"输入 skill id":"搜索 skill slug / 关键词,例如 android、issue-tracker"}),o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:()=>E(),disabled:!c.trim()||w==="search",children:[o.jsx("span",{className:"material-symbols-outlined",children:"search"}),w==="search"?"搜索中…":"搜索"]})]}),v?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:v}):null,C?o.jsx("p",{className:"af-set-hint af-set-hint--inline",children:C}):null,o.jsxs("div",{className:"af-set-skillhub-grid",children:[o.jsxs("div",{className:"af-set-skillhub-pane",children:[o.jsxs("div",{className:"af-set-skillhub-pane-head",children:[o.jsx("h3",{children:"已安装"}),o.jsx("span",{children:s.length})]}),o.jsx("div",{className:"af-set-skillhub-list",children:s.length===0?o.jsx("div",{className:"af-set-skillhub-empty",children:"暂无 AgentFlow 共享 skills"}):s.map(z=>{const L=g[z.name],R=!L||L.state==="update"||L.state==="remote-only"||L.state==="unknown"||L.state==="error",K=w===`install:${z.name}`?"更新中…":(L==null?void 0:L.state)==="current"?"已最新":(L==null?void 0:L.state)==="update"&&L.latestVersion?`更新到 v${L.latestVersion}`:(L==null?void 0:L.state)==="remote-only"&&L.latestVersion?`安装 v${L.latestVersion}`:"重装";return o.jsxs("div",{className:"af-set-skillhub-item",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-set-skillhub-title",children:z.displayName||z.name}),o.jsx("div",{className:"af-set-skillhub-meta",children:hO(z)}),o.jsx("div",{className:"af-set-skillhub-version-row",children:L?L.state==="update"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--warn",children:["可更新 ",L.installedVersion?`v${L.installedVersion} -> `:"","v",L.latestVersion]}):L.state==="current"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--ok",children:["已最新 v",L.latestVersion||L.installedVersion]}):L.state==="remote-only"?o.jsxs("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:["远端 v",L.latestVersion,",本地版本未知"]}):L.state==="missing"?o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"未找到远端匹配项"}):L.state==="error"?o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--err",children:"检查失败"}):o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"状态未知"}):o.jsx("span",{className:"af-set-skillhub-version af-set-skillhub-version--muted",children:"未检查远端版本"})})]}),o.jsxs("div",{className:"af-set-skillhub-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>P(z.name,!0),disabled:!t||!!w||!R,children:K}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>B(z.name),disabled:!t||!!w,children:"卸载"})]})]},`${z.agent}:${z.path}:${z.name}`)})})]}),o.jsxs("div",{className:"af-set-skillhub-pane",children:[o.jsxs("div",{className:"af-set-skillhub-pane-head",children:[o.jsx("h3",{children:"搜索结果"}),o.jsx("span",{children:f.length})]}),o.jsx("div",{className:"af-set-skillhub-list",children:f.length===0?o.jsx("div",{className:"af-set-skillhub-empty",children:"输入关键词后搜索 SkillHub"}):f.map(z=>{const L=z.slug||z.name,R=z.kind==="collection"||z.collection,K=!R&&s.some(D=>D.name===L||D.name===z.name);return o.jsxs("div",{className:"af-set-skillhub-item",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-set-skillhub-title",children:z.name||L}),o.jsxs("div",{className:"af-set-skillhub-meta",children:[R?`collection:${z.collection}`:L,z.skillId?` · id:${z.skillId}`:"",z.version?` · ${z.version}`:""]}),z.summary?o.jsx("p",{className:"af-set-skillhub-summary",children:z.summary}):null]}),o.jsx("button",{type:"button",className:K?"af-set-btn-mini":"af-set-btn-add af-set-btn-add--compact",onClick:()=>P(z,K),disabled:!t||!!w,children:K?"更新":R?"安装合集":"安装"})]},z.id||L)})})]})]})]})}function ya(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 gO(e){return{version:1,collections:ya({collections:e})}}function yO(e){const t=String(e||"").trim(),n=t.indexOf(":");return n>=0?t.slice(n+1).trim():t}function OE(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(yO(s)))||""}}function $o(e,t){const n=OE(t);return Array.from(new Set((Array.isArray(e==null?void 0:e.skillKeys)?e.skillKeys:[]).map(r=>n(r)).filter(Boolean)))}function xO(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 wO(e,t){const n=new Set(Array.isArray(t)?t:[]);return(Array.isArray(e)?e:[]).filter(r=>!n.has(r))}function bO(e,t,n){const r=$o(e,n);if(r.length===0)return"empty";const s=r.filter(i=>t.has(i)).length;return s===0?"none":s===r.length?"all":"partial"}function kO(e,t,n){const r=String(e).trim().toLowerCase(),s=ya({collections:n}).find(i=>i.id===r||i.name.toLowerCase()===r);return $o(s,t)}function vO(e,t,n,r){const s=(Array.isArray(n)?n:[]).map(u=>u.key).filter(Boolean),i=String(t).trim().toLowerCase(),a=ya({collections:r}),l=kO(t,n,r),c=l.length>0?l:s;if(!e)return c;try{const u=localStorage.getItem(e);if(u!==null){const p=JSON.parse(u);if(Array.isArray(p)){const d=OE(n),f=Array.from(new Set(p.map(d).filter(Boolean)));if(s.length>0&&f.length===s.length)return c;const h=new Set(f),g=new Set(l),k=l.length>0&&l.every(y=>h.has(y)),w=a.some(y=>{if(!y.builtin||y.id===i||y.name.toLowerCase()===i)return!1;const v=$o(y,n);return v.length>0&&v.every(x=>h.has(x))});return l.length>0&&w&&!k?c:f}}}catch{}return c}function Hc(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 SO(e){const t=e??"user";return t==="builtin"||t==="admin"?"af-project-card af-project-card--builtin":"af-project-card"}function NO(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 vx(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 DE(e){const t=e.source??"user";return t==="builtin"?`builtin/pipelines / ${e.id}`:t==="admin"?`admin builtin / ${e.ownerUserId||"-"} / ${e.id}`:t==="workspace"?e.archived?`.workspace/agentflow/pipelines/_archived / ${e.id}`:`.workspace/agentflow/pipelines / ${e.id}`:e.archived?`~/agentflow/pipelines/_archived / ${e.id}`:`~/agentflow/pipelines / ${e.id}`}const jO="project:defaultCardDesc";function FE(e,t){const n=e.description!=null?String(e.description).trim():"";return n!==""?n:t(jO)}function CO(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Tn({children:e,className:t="",query:n}){const r=n.trim(),s=String(e);if(!r)return o.jsx("span",{className:t,children:s});const i=new RegExp(`(${CO(r)})`,"gi"),a=s.split(i);return o.jsx("span",{className:t,children:a.map((l,c)=>c%2===1?o.jsx("mark",{className:"af-search-hit",children:l},c):o.jsx("span",{children:l},c))})}function _O(e,t,n){const r=[String(e.id),FE(e,n),DE(e),vx(e.source,n).label];return e.archived&&r.push(n("project:archived")),r.join(`
|
|
41
|
-
`).toLowerCase()}function EO(e,t,n){return t?_O(e,t,n).includes(t):!0}function AO(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 Ig(e,t){const n=e.trim().toLowerCase();return n?t.filter(Boolean).join(`
|
|
42
|
-
`).toLowerCase().includes(n):!0}function vS(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 SS(e){return e!=null&&e.packageDir?e.packageDir:`marketplace/flow-snippets / ${(e==null?void 0:e.id)||""}`}const PO=["all","agent","control","provide","marketplace"],IO=["all","agent","control","provide"],zE="agentflow.projects.activityPanelOpen",Sx="agentflow.projects.activitySelected";function TO(){if(typeof localStorage>"u")return!0;const e=localStorage.getItem(zE);return e!=="0"}function NS(e){return`${(e==null?void 0:e.flowSource)||"user"}:${(e==null?void 0:e.flowId)||""}`}function RO(){return typeof localStorage>"u"?"":localStorage.getItem(Sx)||""}function Ef(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,n])=>({key:t,...n&&typeof n=="object"?n:{}}))}function Rn(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 MO(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 lo(e){return`${(e==null?void 0:e.id)||""}:${(e==null?void 0:e.version)||""}:${(e==null?void 0:e.packageDir)||""}`}function BE(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 HE(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 Nx(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 jS(e,t){return String((e==null?void 0:e.label)||(e==null?void 0:e.displayName)||(e==null?void 0:e.name)||Nx(e,t))}function $O(e){return String((e==null?void 0:e.definitionId)||(e==null?void 0:e.type)||(e==null?void 0:e.runtimeType)||"").replace(/^marketplace:/,"")}function CS(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 LO(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 Tg(e,t=16){const n=String(e||"").trim();return n.length<=t?n:`${n.slice(0,t-1)}…`}function OO(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 DO(e,t){const n=e.map(p=>p.id),r=new Set(n),s=new Map(n.map(p=>[p,0])),i=new Map(n.map(p=>[p,[]]));t.forEach(p=>{var d;!r.has(p.sourceId)||!r.has(p.targetId)||(s.set(p.targetId,(s.get(p.targetId)||0)+1),(d=i.get(p.sourceId))==null||d.push(p.targetId))});const a=new Map,l=n.filter(p=>(s.get(p)||0)===0);l.length===0&&n[0]&&l.push(n[0]),l.forEach(p=>a.set(p,0));for(let p=0;p<l.length;p+=1){const d=l[p],f=(a.get(d)||0)+1;for(const h of i.get(d)||[])(!a.has(h)||f>a.get(h))&&(a.set(h,f),l.push(h))}n.forEach((p,d)=>{a.has(p)||a.set(p,d%3)});const c=new Map,u=new Map;return n.forEach(p=>{const d=a.get(p)||0,f=c.get(d)||0;c.set(d,f+1),u.set(p,{x:d*190,y:f*86})}),u}function FO(e){var k,w,y,v;const t=BE(e),n=HE(e),r=new Map(t.map((x,C)=>[Nx(x,C),jS(x,C)])),s=t.map((x,C)=>({id:Nx(x,C),title:jS(x,C),meta:$O(x)})),i=n.map((x,C)=>{const N=CS(x,"source"),j=CS(x,"target");return{key:(x==null?void 0:x.id)||`${N}-${j}-${C}`,sourceId:N,targetId:j,source:r.get(N)||N||"?",target:r.get(j)||j||"?",label:LO(x)}}),a=(w=(k=e==null?void 0:e.snippet)==null?void 0:k.ui)!=null&&w.nodePositions&&typeof e.snippet.ui.nodePositions=="object"?e.snippet.ui.nodePositions:{},l=(v=(y=e==null?void 0:e.snippet)==null?void 0:y.ui)!=null&&v.nodeSizes&&typeof e.snippet.ui.nodeSizes=="object"?e.snippet.ui.nodeSizes:{},c=DO(s,i),u=s.map(x=>{const C=OO(a[x.id])||c.get(x.id)||{x:0,y:0},N=l[x.id]&&typeof l[x.id]=="object"?l[x.id]:{},j=Number(N.width),E=Number(N.height),P=Math.max(132,Math.min(210,Number.isFinite(j)?j*.62:150)),O=Math.max(48,Math.min(76,Number.isFinite(E)?E*.46:54));return{...x,x:C.x,y:C.y,width:P,height:O}}),p=new Map(u.map(x=>[x.id,x])),d=i.map(x=>{const C=p.get(x.sourceId),N=p.get(x.targetId);if(!C||!N)return null;const j=C.x+C.width,E=C.y+C.height/2,P=N.x,O=N.y+N.height/2,B=Math.max(48,Math.abs(P-j)*.45);return{...x,path:`M ${j} ${E} C ${j+B} ${E}, ${P-B} ${O}, ${P} ${O}`,labelX:(j+P)/2,labelY:(E+O)/2}}).filter(Boolean),f=u.reduce((x,C)=>({minX:Math.min(x.minX,C.x),minY:Math.min(x.minY,C.y),maxX:Math.max(x.maxX,C.x+C.width),maxY:Math.max(x.maxY,C.y+C.height)}),{minX:0,minY:0,maxX:420,maxY:220}),h=36,g=`${f.minX-h} ${f.minY-h} ${Math.max(360,f.maxX-f.minX+h*2)} ${Math.max(180,f.maxY-f.minY+h*2)}`;return{nodes:s,edges:i,diagram:{nodes:u,edges:d,viewBox:g}}}function sl({resourceKind:e="",authUser:t=null}){var ht,$t,Kt,sr,nn,Ur;const{t:n}=Pr(),{navigate:r,path:s}=xi(),i=!!(t!=null&&t.isAdmin),[a,l]=m.useState(e||"all"),[c,u]=m.useState([]),[p,d]=m.useState([]),[f,h]=m.useState([]),[g,k]=m.useState([]),[w,y]=m.useState([]),[v,x]=m.useState(""),[C,N]=m.useState(!1),[j,E]=m.useState([]),[P,O]=m.useState(""),[B,W]=m.useState(""),[z,L]=m.useState(!1),[R,K]=m.useState(!1),[D,$]=m.useState(!1),[I,F]=m.useState(null),[_,X]=m.useState(!1),[V,T]=m.useState(""),[ee,ie]=m.useState(TO),[G,se]=m.useState(RO),[te,re]=m.useState("all"),[ne,ce]=m.useState(""),[de,me]=m.useState("overview"),[He,Je]=m.useState({}),[Te,ot]=m.useState(""),[gt,yt]=m.useState({}),[Ae,dt]=m.useState(""),[St,Wt]=m.useState(""),[Vt,et]=m.useState({}),[fe,ke]=m.useState(""),[Ve,Qe]=m.useState(""),[Se,_t]=m.useState(""),[dn,zt]=m.useState(""),[at,fn]=m.useState(""),[Z,Ce]=m.useState(!1),[Me,Ye]=m.useState(""),[Pt,Nt]=m.useState({hiddenBuiltins:[],promoted:[]}),$n=m.useRef(0),Xt=m.useRef(0),Hn=m.useRef(0),Yn=m.useCallback(async()=>{var pe,Pe;const q=++Xt.current;O("");try{const _e=await fetch("/api/flows");if(q!==Xt.current)return;if(!_e.ok)throw new Error("HTTP "+_e.status);const qe=await _e.json();if(q!==Xt.current)return;u(Array.isArray(qe)?qe:[])}catch(_e){if(q!==Xt.current)return;u([]),O(String(_e.message||_e))}try{const _e=await fetch("/api/pipeline-recent-runs");if(q!==Xt.current)return;if(_e.ok){const qe=await _e.json();if(q!==Xt.current)return;E(Array.isArray(qe.runs)?qe.runs:[])}else E([])}catch{if(q!==Xt.current)return;E([])}if(t!=null&&t.isAdmin)try{const _e=await fetch("/api/admin/builtin-flows");if(q!==Xt.current)return;const qe=await _e.json().catch(()=>({}));_e.ok&&Nt({hiddenBuiltins:Array.isArray((pe=qe==null?void 0:qe.config)==null?void 0:pe.hiddenBuiltins)?qe.config.hiddenBuiltins:[],promoted:Array.isArray((Pe=qe==null?void 0:qe.config)==null?void 0:Pe.promoted)?qe.config.promoted:[]})}catch{if(q!==Xt.current)return;Nt({hiddenBuiltins:[],promoted:[]})}else Nt({hiddenBuiltins:[],promoted:[]});L(!0)},[t==null?void 0:t.isAdmin]),Wn=m.useCallback(async(q,pe)=>{if(!(t!=null&&t.isAdmin)||!(q!=null&&q.id))return;const Pe=`${pe}:${q.source}:${q.id}`;Ye(Pe),O("");try{const _e=await fetch("/api/admin/builtin-flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:pe,flowId:q.id,ownerUserId:q.ownerUserId||t.userId})}),qe=await _e.json().catch(()=>({}));if(!_e.ok)throw new Error(qe.error||"更新内置配置失败");await Yn()}catch(_e){O(String(_e.message||_e))}finally{Ye("")}},[t==null?void 0:t.isAdmin,t==null?void 0:t.userId,Yn]),Ln=m.useCallback(async()=>{const q=++Hn.current;W(""),K(!1);const pe="/api/nodes",Pe=e==="my-flows"?"/api/marketplace/flow-snippets?scope=owned":"/api/marketplace/flow-snippets";d([]),k([]),ce("");try{const[_e,qe,rn,It]=await Promise.all([fetch(pe),fetch("/api/skills"),fetch("/api/skill-collections"),fetch(Pe)]),Jn=await _e.json().catch(()=>({})),Yr=await qe.json().catch(()=>({})),qo=await rn.json().catch(()=>({})),Uo=await It.json().catch(()=>({}));if(!_e.ok)throw new Error(Jn.error||"Nodes HTTP "+_e.status);if(!qe.ok)throw new Error(Yr.error||"Skills HTTP "+qe.status);if(!rn.ok)throw new Error(qo.error||"Collections HTTP "+rn.status);if(!It.ok)throw new Error(Uo.error||"Flow snippets HTTP "+It.status);if(q!==Hn.current)return;d(Array.isArray(Jn.nodes)?Jn.nodes:Array.isArray(Jn)?Jn:[]),h(Array.isArray(Yr.skills)?Yr.skills:[]),y(ya(qo)),k(Array.isArray(Uo.snippets)?Uo.snippets:[])}catch(_e){if(q!==Hn.current)return;d([]),h([]),k([]),y([]),W(String(_e.message||_e))}finally{if(q!==Hn.current)return;K(!0)}},[e]);m.useEffect(()=>{L(!1),Yn(),Ln()},[Yn,Ln]),m.useEffect(()=>{try{localStorage.setItem(zE,ee?"1":"0")}catch{}},[ee]),m.useEffect(()=>{try{G?localStorage.setItem(Sx,G):localStorage.removeItem(Sx)}catch{}},[G]),m.useEffect(()=>{let q=!1;return fetch("/api/ui-context").then(pe=>pe.json()).then(pe=>{q||Ce(!!pe.hideCommunityLinks)}).catch(()=>{}),()=>{q=!0}},[]);const Gn=m.useCallback(async q=>{if(!i)return;const pe=ya({collections:q});N(!0),W("");try{const Pe=await fetch("/api/skill-collections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(gO(pe))}),_e=await Pe.json().catch(()=>({}));if(!Pe.ok)throw new Error(_e.error||"Collections HTTP "+Pe.status);y(ya(_e))}catch(Pe){W(String(Pe.message||Pe))}finally{N(!1)}},[i]),ls=m.useCallback(()=>{if(!i)return;const q=v.trim();if(!q)return;const pe=q.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"collection",Pe=new Set(w.map(It=>It.id));let _e=pe,qe=2;for(;Pe.has(_e);)_e=`${pe}-${qe++}`;const rn=Date.now();Gn([...w,{id:_e,name:q,skillKeys:[],createdAt:rn,updatedAt:rn}]),x(""),re(`collection:${_e}`)},[i,v,Gn,w]),Ir=m.useCallback(q=>{if(!i)return;const pe=w.find(_e=>_e.id===q);if(pe!=null&&pe.builtin)return;const Pe=w.filter(_e=>_e.id!==q);te===`collection:${q}`&&re("all"),Gn(Pe)},[i,te,Gn,w]),wr=m.useCallback((q,pe,Pe)=>{if(!i)return;const _e=String(pe||"").trim();if(!_e)return;const qe=Date.now(),rn=w.map(It=>{if(It.id!==q)return It;const Jn=new Set(It.skillKeys||[]);return Pe?Jn.add(_e):Jn.delete(_e),{...It,skillKeys:Array.from(Jn),updatedAt:qe}});Gn(rn)},[i,Gn,w]),cs=m.useCallback(async q=>{const pe=q==null?void 0:q.packageId,Pe=q==null?void 0:q.version;if(!pe||!Pe||!window.confirm(n("project:deleteMyNodeConfirm",{id:pe,version:Pe})))return;const _e=Rn(q);Qe(_e),_t(""),W("");try{const qe=new URLSearchParams({id:pe,version:Pe}),rn=await fetch(`/api/marketplace/node?${qe.toString()}`,{method:"DELETE"}),It=await rn.json().catch(()=>({}));if(!rn.ok||(It==null?void 0:It.ok)===!1){const Jn=Array.isArray(It==null?void 0:It.usage)&&It.usage.length>0?` ${n("project:deleteMyNodeUsedBy",{count:It.usage.length})}`:"";throw new Error(((It==null?void 0:It.error)||"Delete failed")+Jn)}_t(n("project:deleteMyNodeSuccess",{id:pe,version:Pe})),yt(Jn=>{const Yr={...Jn};return delete Yr[_e],Yr}),et(Jn=>{const Yr={};for(const[qo,Uo]of Object.entries(Jn))qo.startsWith(`${_e}:`)||(Yr[qo]=Uo);return Yr}),ce(""),await Ln()}catch(qe){_t(String(qe.message||qe))}finally{Qe("")}},[Ln,n]),pn=m.useCallback(async q=>{const pe=q==null?void 0:q.id,Pe=(q==null?void 0:q.version)||"1.0.0";if(!pe||!Pe||!window.confirm(n("project:deleteMyFlowConfirm",{id:pe,version:Pe})))return;const _e=lo(q);zt(_e),fn(""),W("");try{const qe=new URLSearchParams({id:pe,version:Pe}),rn=await fetch(`/api/marketplace/flow-snippet?${qe.toString()}`,{method:"DELETE"}),It=await rn.json().catch(()=>({}));if(!rn.ok||(It==null?void 0:It.ok)===!1)throw new Error((It==null?void 0:It.error)||"Delete failed");fn(n("project:deleteMyFlowSuccess",{id:pe,version:Pe})),ce(""),await Ln()}catch(qe){fn(String(qe.message||qe))}finally{zt("")}},[Ln,n]);m.useEffect(()=>{if(e==="nodes"||e==="my-nodes"||e==="my-flows"||e==="skills"){l(e),re("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),pe=q.get("tab");let Pe=!1;if(pe==="nodes"){r("/nodes");return}if(pe==="my-nodes"){r("/my-nodes");return}if(pe==="my-flows"){r("/my-flows");return}if(pe==="skills"){r("/skills");return}if(pe==="archived"?(l("archived"),q.delete("tab"),Pe=!0):pe&&(l("all"),q.delete("tab"),Pe=!0),q.get("new")==="1"&&($(!0),q.delete("new"),Pe=!0),Pe){const _e=q.toString();window.history.replaceState({},"",_e?`/projects?${_e}`:"/projects")}},[s,r]);const rr=m.useMemo(()=>IL(j,AL(),c),[j,c,s]),br=m.useMemo(()=>rr.filter(q=>AO(V,q)),[rr,V]),Vn=V.trim().toLowerCase(),Cn=m.useMemo(()=>a==="archived"?c.filter(q=>q.archived):c.filter(q=>!q.archived),[c,a]),kr=m.useMemo(()=>Cn.filter(q=>EO(q,Vn,n)),[Cn,Vn,n]),Gs=m.useMemo(()=>new Set((Pt.promoted||[]).map(q=>String((q==null?void 0:q.id)||"").trim()).filter(Boolean)),[Pt.promoted]),vr=m.useMemo(()=>(Pt.hiddenBuiltins||[]).map(q=>String(q||"").trim()).filter(Boolean),[Pt.hiddenBuiltins]),Qt=a==="nodes"||a==="my-nodes",le=a==="my-nodes",we=a==="my-flows",De=m.useMemo(()=>p.filter(q=>le&&!MO(q,t)?!1:(te==="all"||(te==="marketplace"?q.source==="marketplace":q.type===te))&&Ig(V,[q.id,q.label,q.displayName,q.description,q.type,q.source,q.packageId,q.version])),[t,p,le,V,te]),wt=m.useMemo(()=>{const q=new Map;for(const pe of w)q.set(pe.id,new Set($o(pe,f)));return q},[f,w]),Zt=m.useMemo(()=>[{id:"all",label:"全部"},...w.map(q=>{var pe;return{id:`collection:${q.id}`,label:q.name,count:((pe=wt.get(q.id))==null?void 0:pe.size)||0,collection:q}}),{id:"ungrouped",label:"未分组"}],[wt,w]),on=m.useMemo(()=>f.filter(q=>{var _e;const pe=Rn(q);let Pe=te==="all";if(te.startsWith("collection:")){const qe=te.slice(11);Pe=!!((_e=wt.get(qe))!=null&&_e.has(pe))}else te==="ungrouped"&&(Pe=!Array.from(wt.values()).some(qe=>qe.has(pe)));return Pe&&Ig(V,[q.name,q.id,q.description,q.sourceLabel,q.source,q.path])}),[f,V,te,wt]),An=m.useMemo(()=>g.filter(q=>Ig(V,[q.id,q.name,q.displayName,q.description,q.version,q.packageDir,Array.isArray(q.tags)?q.tags.join(" "):""])),[g,V]),ur=Qt||we||a==="skills",nt=m.useMemo(()=>De.find(q=>Rn(q)===ne)||De[0]||null,[De,ne]),xt=m.useMemo(()=>on.find(q=>Rn(q)===ne)||on[0]||null,[on,ne]),Yt=m.useMemo(()=>An.find(q=>lo(q)===ne)||An[0]||null,[An,ne]),Ke=xt?He[Rn(xt)]:null,Re=nt?gt[Rn(nt)]:null,dr=nt&&St?Vt[`${Rn(nt)}:${St}`]:null,ki=n(Qt?"project:searchNodes":we?"project:searchFlows":a==="skills"?"project:searchSkills":"project:searchPipelines");m.useEffect(()=>{if(a!=="skills"||!xt)return;const q=Rn(xt);if(He[q])return;let pe=!1;return ot(q),fetch(`/api/skills/detail?key=${encodeURIComponent(q)}`).then(Pe=>Pe.json().then(_e=>({ok:Pe.ok,json:_e}))).then(({ok:Pe,json:_e})=>{pe||Pe&&_e.skill&&Je(qe=>({...qe,[q]:_e.skill}))}).catch(()=>{}).finally(()=>{pe||ot("")}),()=>{pe=!0}},[a,xt,He]),m.useEffect(()=>{if(!Qt||!nt)return;const q=Rn(nt);if(gt[q])return;let pe=!1;return dt(q),fetch(`/api/nodes/detail?id=${encodeURIComponent(nt.id)}`).then(Pe=>Pe.json().then(_e=>({ok:Pe.ok,json:_e}))).then(({ok:Pe,json:_e})=>{pe||Pe&&yt(qe=>({...qe,[q]:_e}))}).catch(()=>{}).finally(()=>{pe||dt("")}),()=>{pe=!0}},[Qt,nt,gt]),m.useEffect(()=>{if(!Qt)return;const q=Array.isArray(Re==null?void 0:Re.files)?Re.files:[];Wt(pe=>{var Pe;return pe&&q.some(_e=>_e.path===pe)?pe:((Pe=q[0])==null?void 0:Pe.path)||""})},[Qt,Re]),m.useEffect(()=>{if(!Qt||!nt||!St)return;const q=`${Rn(nt)}:${St}`;if(Vt[q])return;let pe=!1;return ke(q),fetch(`/api/nodes/file?id=${encodeURIComponent(nt.id)}&path=${encodeURIComponent(St)}`).then(Pe=>Pe.json().then(_e=>({ok:Pe.ok,json:_e}))).then(({ok:Pe,json:_e})=>{pe||Pe&&et(qe=>({...qe,[q]:_e}))}).catch(()=>{}).finally(()=>{pe||ke("")}),()=>{pe=!0}},[Qt,nt,St,Vt]),m.useEffect(()=>{_t("")},[ne,a]);const Kr=q=>{r(_f(q,"workspace"))},qr=q=>{se(NS(q)),r(_f({id:q.flowId,source:q.flowSource,archived:!!q.archived},"workspace"))},Ss=m.useCallback(q=>{var pe,Pe;q.preventDefault(),q.stopPropagation(),(Pe=(pe=q.dataTransfer)==null?void 0:pe.types)!=null&&Pe.includes("Files")&&($n.current+=1,X(!0))},[]),oe=m.useCallback(q=>{q.preventDefault(),q.stopPropagation(),$n.current-=1,$n.current<=0&&($n.current=0,X(!1))},[]),ve=m.useCallback(q=>{q.preventDefault(),q.stopPropagation()},[]),ae=m.useCallback(q=>{var _e,qe;q.preventDefault(),q.stopPropagation(),$n.current=0,X(!1);const pe=(qe=(_e=q.dataTransfer)==null?void 0:_e.files)==null?void 0:qe[0];if(!pe)return;const Pe=pe.name.toLowerCase();!Pe.endsWith(".yaml")&&!Pe.endsWith(".yml")&&!Pe.endsWith(".zip")||F(pe)},[]);return o.jsxs("div",{className:"af-projects"+(_?" af-projects--drop-target":""),onDragEnter:Ss,onDragLeave:oe,onDragOver:ve,onDrop:ae,children:[o.jsxs("header",{className:"af-projects-top",children:[e?o.jsx("div",{className:"af-projects-tabs af-projects-tabs--empty","aria-hidden":!0}):o.jsxs("div",{className:"af-projects-tabs",children:[o.jsx("button",{type:"button",className:a==="all"?"af-tab af-tab--active":"af-tab",onClick:()=>l("all"),children:n("project:all")}),o.jsx("button",{type:"button",className:a==="archived"?"af-tab af-tab--active":"af-tab",onClick:()=>l("archived"),children:n("project:archived")})]}),o.jsxs("div",{className:"af-projects-top-right",children:[o.jsxs("div",{className:"af-search-wrap",children:[o.jsx("span",{className:"material-symbols-outlined af-search-icon",children:"search"}),o.jsx("input",{className:"af-search"+(V.trim()?" af-search--has-clear":""),type:"search",placeholder:ki,"aria-label":ki,autoComplete:"off",value:V,onChange:q=>T(q.target.value),onKeyDown:q=>{q.key==="Escape"&&(T(""),q.currentTarget.blur())}}),V.trim()?o.jsx("button",{type:"button",className:"af-search-clear","aria-label":"Clear search",onClick:()=>T(""),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),ur?o.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>Ln(),children:n("project:refreshResources")}):o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-icon-btn"+(ee?" af-icon-btn--active":""),"aria-label":n("flow:palette.toggleRecentActivity"),"aria-expanded":ee,"aria-controls":"af-recent-activity-panel",onClick:()=>ie(q=>!q),children:o.jsx("span",{className:"material-symbols-outlined",children:"notifications"})}),o.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>$(!0),children:n("project:createNew")})]})]})]}),o.jsxs("div",{className:"af-projects-body",children:[o.jsxs("section",{className:"af-projects-main",children:[o.jsxs("header",{className:"af-projects-section-head",children:[o.jsx("h2",{className:"af-projects-h2",children:n(a==="my-nodes"?"project:myNodes":a==="my-flows"?"project:myFlows":a==="nodes"?"project:nodes":a==="skills"?"project:globalSkills":a==="archived"?"project:archivedPipelines":"project:activeProjects")}),o.jsx("p",{className:"af-projects-sub",children:Vn?n("project:filterResult",{count:a==="nodes"||a==="my-nodes"?De.length:a==="my-flows"?An.length:a==="skills"?on.length:kr.length}):a==="my-nodes"?n("project:myNodesHint",{count:De.length}):a==="my-flows"?n("project:myFlowsHint",{count:An.length}):a==="nodes"?n("project:nodesHint",{count:p.length}):a==="skills"?n("project:skillsHint",{count:f.length}):n(a==="archived"?"project:archivedHint":"project:activeHint")}),P?o.jsx("p",{className:"af-err af-projects-api-hint",children:P}):null,B&&ur?o.jsx("p",{className:"af-err af-projects-api-hint",children:B}):null]}),ur?o.jsxs("div",{className:"af-resource-toolbar",children:[a==="skills"?o.jsx(mO,{onChanged:Ln,canManage:!!(t!=null&&t.isAdmin)}):null,o.jsxs("div",{className:"af-resource-purpose",children:[o.jsx("span",{className:"material-symbols-outlined",children:we?"schema":Qt?le?"deployed_code":"account_tree":"extension"}),o.jsxs("div",{children:[o.jsx("h3",{children:n(we?"project:myFlowsPurposeTitle":le?"project:myNodesPurposeTitle":Qt?"project:nodesPurposeTitle":"project:skillsPurposeTitle")}),o.jsx("p",{children:n(we?"project:myFlowsPurposeDesc":le?"project:myNodesPurposeDesc":Qt?"project:nodesPurposeDesc":"project:skillsPurposeDesc")})]})]}),we?null:o.jsxs(o.Fragment,{children:[Qt?o.jsxs("div",{className:"af-resource-filter-row",children:[o.jsx("button",{type:"button",className:"af-resource-filter"+(le?"":" af-resource-filter--active"),onClick:()=>{l("nodes"),re("all"),ce("")},children:n("project:nodeScopeAll")}),o.jsx("button",{type:"button",className:"af-resource-filter"+(le?" af-resource-filter--active":""),onClick:()=>{l("my-nodes"),re("all"),ce("")},children:n("project:nodeScopeMine")})]}):null,o.jsx("div",{className:"af-resource-filter-row",children:(Qt?(le?IO:PO).map(q=>({id:q,label:n(`project:resourceFilter.${q}`)})):Zt).map(q=>q.collection?o.jsxs("span",{className:"af-resource-filter-chip"+(te===q.id?" af-resource-filter-chip--active":""),children:[o.jsxs("button",{type:"button",className:"af-resource-filter af-resource-filter--embedded",onClick:()=>{re(q.id),ce("")},children:[q.label,o.jsx("em",{children:q.count}),q.collection.builtin?o.jsx("strong",{children:"built-in"}):null]}),i&&!q.collection.builtin?o.jsx("button",{type:"button",className:"af-resource-filter-chip__delete",disabled:C,"aria-label":`删除 ${q.collection.name}`,onClick:()=>Ir(q.collection.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})}):null]},q.id):o.jsx("button",{type:"button",className:"af-resource-filter"+(te===q.id?" af-resource-filter--active":""),onClick:()=>{re(q.id),ce("")},children:q.label},q.id))})]}),a==="skills"&&i?o.jsx("div",{className:"af-skill-collections-manager",children:o.jsxs("div",{className:"af-skill-collections-create",children:[o.jsx("input",{className:"af-set-input af-set-input--sm",value:v,onChange:q=>x(q.target.value),onKeyDown:q=>{q.key==="Enter"&&ls()},placeholder:"新建 skill collection"}),o.jsxs("button",{type:"button",className:"af-set-btn-add af-set-btn-add--compact",disabled:!v.trim()||C,onClick:()=>ls(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新建"]})]})}):null]}):null,Qt?o.jsx("div",{className:"af-resource-grid",children:De.length>0?De.map(q=>o.jsxs("button",{type:"button",className:"af-resource-card"+(nt&&Rn(q)===Rn(nt)?" af-resource-card--active":""),onClick:()=>ce(Rn(q)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:Hc(q.type==="control"?"secondary":q.type==="provide"?"primary":"muted"),children:o.jsx(Tn,{query:V,children:q.type||"node"})}),o.jsx("span",{className:"af-resource-source",children:o.jsx(Tn,{query:V,children:vS(q.source,n)})})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(Tn,{query:V,children:q.label||q.displayName||q.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(Tn,{query:V,children:q.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:o.jsx(Tn,{query:V,children:q.id})}),o.jsx("span",{children:n("project:nodeSlots",{inputs:Object.keys(q.inputs||{}).length,outputs:Object.keys(q.outputs||{}).length})})]}),q.packageId?o.jsxs("div",{className:"af-project-path",children:[o.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"deployed_code"}),o.jsx("span",{className:"af-path-text",children:o.jsx(Tn,{query:V,children:`${q.packageId}${q.version?` / ${q.version}`:""}`})})]}):null]},`${q.id}:${q.source||""}:${q.packageId||""}`)):R?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:Vn?n("project:noNodeMatch",{query:V.trim()}):n(le?"project:noMyNodes":"project:noNodes")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):we?o.jsx("div",{className:"af-resource-grid",children:An.length>0?An.map(q=>{const pe=BE(q),Pe=HE(q),_e=Number.isFinite(Number(q.nodeCount))?Number(q.nodeCount):pe.length,qe=Number.isFinite(Number(q.edgeCount))?Number(q.edgeCount):Pe.length;return o.jsxs("button",{type:"button",className:"af-resource-card"+(Yt&&lo(q)===lo(Yt)?" af-resource-card--active":""),onClick:()=>ce(lo(q)),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:Hc("primary"),children:o.jsx(Tn,{query:V,children:q.version?`v${q.version}`:"flow"})}),o.jsx("span",{className:"af-resource-source",children:n("project:flowSnippet")})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(Tn,{query:V,children:q.displayName||q.name||q.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(Tn,{query:V,children:q.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-resource-meta-row",children:[o.jsx("span",{children:n("project:flowSnippetNodes",{nodes:_e,edges:qe})}),o.jsx("span",{children:o.jsx(Tn,{query:V,children:q.id})})]}),o.jsxs("div",{className:"af-project-path",children:[o.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"schema"}),o.jsx("span",{className:"af-path-text",children:o.jsx(Tn,{query:V,children:SS(q)})})]})]},lo(q))}):R?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:Vn?n("project:noFlowSnippetMatch",{query:V.trim()}):n("project:noMyFlows")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):a==="skills"?o.jsx("div",{className:"af-resource-grid",children:on.length>0?on.map(q=>{const pe=Rn(q),Pe=w.filter(_e=>{var qe;return(qe=wt.get(_e.id))==null?void 0:qe.has(pe)});return o.jsxs("button",{type:"button",className:"af-resource-card"+(xt&&pe===Rn(xt)?" af-resource-card--active":""),onClick:()=>ce(pe),children:[o.jsxs("div",{className:"af-resource-card-head",children:[o.jsx("span",{className:Hc(q.source==="builtin"?"muted":"primary"),children:o.jsx(Tn,{query:V,children:q.sourceLabel||q.source||"skill"})}),o.jsx("span",{className:"af-resource-source",children:n("project:skill")})]}),o.jsx("h3",{className:"af-project-title",children:o.jsx(Tn,{query:V,children:q.name||q.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(Tn,{query:V,children:q.description||n("project:noDescription")})}),o.jsxs("div",{className:"af-project-path",children:[o.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"extension"}),o.jsx("span",{className:"af-path-text",children:o.jsx(Tn,{query:V,children:q.path||q.key||""})})]}),o.jsxs("div",{className:"af-skill-card-collections",children:[Pe.slice(0,3).map(_e=>o.jsx("span",{children:_e.name},_e.id)),Pe.length===0?o.jsx("span",{className:"af-skill-card-collection-empty",children:"未分组"}):null]})]},q.key||`${q.source}:${q.name}`)}):R?o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:Vn?n("project:noSkillMatch",{query:V.trim()}):n("project:noSkills")})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingResources")})})}):o.jsxs(o.Fragment,{children:[t!=null&&t.isAdmin&&a==="all"&&vr.length>0?o.jsxs("div",{className:"af-project-admin-panel",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"已隐藏内置"}),o.jsx("span",{children:"这些包内置流水线不会出现在普通项目列表中。"})]}),o.jsx("div",{className:"af-project-admin-hidden-list",children:vr.map(q=>{const pe=Me===`show-builtin:builtin:${q}`;return o.jsxs("button",{type:"button",disabled:pe,onClick:()=>Wn({id:q,source:"builtin"},"show-builtin"),children:[o.jsx("span",{children:q}),o.jsx("em",{children:pe?"恢复中":"恢复"})]},q)})})]}):null,o.jsxs("div",{className:"af-project-grid",children:[kr.length>0?kr.map(q=>{const pe=(t==null?void 0:t.isAdmin)&&q.source==="user"&&!q.archived&&!Gs.has(q.id),Pe=(t==null?void 0:t.isAdmin)&&q.source==="admin",_e=(t==null?void 0:t.isAdmin)&&q.source==="builtin",qe=Me.endsWith(`:${q.source}:${q.id}`);return o.jsx("div",{className:SO(q.source),role:"button",tabIndex:0,onClick:()=>Kr(q),onKeyDown:rn=>{(rn.key==="Enter"||rn.key===" ")&&(rn.preventDefault(),Kr(q))},children:o.jsxs("div",{className:"af-project-card-body",children:[o.jsx("span",{className:Hc(vx(q.source,n).tone),children:o.jsx(Tn,{query:V,children:vx(q.source,n).label})}),q.archived?o.jsx("span",{className:Hc("muted"),children:o.jsx(Tn,{query:V,children:n("project:archived")})}):null,o.jsx("h3",{className:"af-project-title",children:o.jsx(Tn,{query:V,children:q.id})}),o.jsx("p",{className:"af-project-desc",children:o.jsx(Tn,{query:V,children:FE(q,n)})}),o.jsxs("div",{className:"af-project-path",children:[o.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"database"}),o.jsx("span",{className:"af-path-text",children:o.jsx(Tn,{query:V,children:DE(q)})})]}),t!=null&&t.isAdmin?o.jsxs("div",{className:"af-project-admin-actions",onClick:rn=>rn.stopPropagation(),onKeyDown:rn=>rn.stopPropagation(),children:[pe?o.jsx("button",{type:"button",disabled:qe,onClick:()=>Wn(q,"promote"),children:"设为内置"}):null,Pe?o.jsx("button",{type:"button",disabled:qe,onClick:()=>Wn(q,"unpromote"),children:"取消内置"}):null,_e?o.jsx("button",{type:"button",disabled:qe,onClick:()=>Wn(q,"hide-builtin"),children:"隐藏内置"}):null]}):null]})},`${q.id}:${q.source??"user"}:${q.archived?"a":""}`)}):z?Cn.length===0?o.jsxs("div",{className:"af-projects-empty-block",children:[o.jsx("p",{className:"af-projects-empty",children:a==="archived"?n("project:noArchived"):c.length>0?n("project:noActive"):n(P?"project:loadFailed":"project:noPipelines")}),!P&&c.length===0&&a==="all"?o.jsx("p",{className:"af-projects-empty-hint",children:n("project:emptyHint",{code1:"agentflow ui",code2:".agentflow/pipelines"})}):null]}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:noMatch",{query:V.trim()})})}):o.jsx("div",{className:"af-projects-empty-block",children:o.jsx("p",{className:"af-projects-empty",children:n("project:loadingPipelines")})}),o.jsxs("button",{type:"button",className:"af-project-add",onClick:()=>$(!0),children:[o.jsx("span",{className:"material-symbols-outlined af-project-add-icon",children:"add_circle"}),o.jsx("span",{className:"af-project-add-label",children:n("project:newPipeline")})]}),Z?null:o.jsxs("a",{className:"af-hub-card",href:"https://agentflow-hub.com",target:"_blank",rel:"noopener noreferrer",children:[o.jsx("div",{className:"af-hub-card__glow","aria-hidden":!0}),o.jsxs("span",{className:"af-hub-card__eyebrow",children:[o.jsx("span",{className:"material-symbols-outlined af-hub-card__eyebrow-icon",children:"hub"}),n("project:hubCard.eyebrow")]}),o.jsx("h3",{className:"af-hub-card__title",children:n("project:hubCard.title")}),o.jsx("p",{className:"af-hub-card__desc",children:n("project:hubCard.desc")}),o.jsxs("span",{className:"af-hub-card__cta",children:[n("project:hubCard.cta"),o.jsx("span",{className:"material-symbols-outlined af-hub-card__cta-icon",children:"arrow_outward"})]}),o.jsx("code",{className:"af-hub-card__cli",children:n("project:hubCard.cliHint")})]})]})]})]}),ur?o.jsx("aside",{className:"af-resource-detail","aria-label":n(Qt?"project:nodeDetail":we?"project:flowDetail":"project:skillDetail"),children:Qt&&nt?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-resource-detail-head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"account_tree"}),o.jsxs("div",{children:[o.jsx("h3",{children:nt.label||nt.displayName||nt.id}),o.jsx("p",{children:nt.id})]})]}),o.jsx("div",{className:"af-resource-detail-tabs",children:["overview","schema","runtime","files","usage"].map(q=>o.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))}),Ae===Rn(nt)?o.jsx("p",{className:"af-resource-detail-desc",children:n("project:loadingResources")}):de==="overview"?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"af-resource-detail-desc",children:nt.description||((ht=Re==null?void 0:Re.node)==null?void 0:ht.description)||n("project:noDescription")}),o.jsxs("dl",{className:"af-resource-detail-kv",children:[o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailType")}),o.jsx("dd",{children:nt.type||(($t=Re==null?void 0:Re.node)==null?void 0:$t.type)||"node"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailSource")}),o.jsx("dd",{children:vS(nt.source,n)})]}),nt.packageId?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPackage")}),o.jsx("dd",{children:nt.packageId})]}):null,nt.version?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailVersion")}),o.jsx("dd",{children:nt.version})]}):null,nt.packageDir||Re!=null&&Re.baseDir?o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:nt.packageDir||(Re==null?void 0:Re.baseDir)})]}):null,o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailEditable")}),o.jsx("dd",{children:(Re==null?void 0:Re.readOnly)===!1?n("project:editable"):n("project:readOnly")})]})]}),le&&nt.source==="marketplace"?o.jsxs("div",{className:"af-resource-detail-section af-resource-danger-zone",children:[o.jsx("h4",{children:n("project:myNodeManagement")}),o.jsx("p",{children:n("project:deleteMyNodeHint")}),o.jsxs("button",{type:"button",className:"af-btn-secondary af-btn-danger",disabled:Ve===Rn(nt),onClick:()=>cs(nt),children:[o.jsx("span",{className:"material-symbols-outlined",children:"delete"}),Ve===Rn(nt)?n("project:deletingMyNode"):n("project:deleteMyNode")]}),Se?o.jsx("p",{className:"af-resource-action-message",children:Se}):null]}):null,o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:resourceMeaning")}),o.jsx("p",{children:n("project:nodesMeaning")})]})]}):de==="schema"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeSchema")}),o.jsxs("div",{className:"af-resource-slot-group",children:[o.jsx("span",{children:n("project:nodeInputs")}),Ef(((Kt=Re==null?void 0:Re.node)==null?void 0:Kt.inputs)||nt.inputs).length>0?Ef(((sr=Re==null?void 0:Re.node)==null?void 0:sr.inputs)||nt.inputs).map(q=>o.jsxs("code",{children:[q.name||q.key,q.type?`: ${q.type}`:""]},q.key)):o.jsx("em",{children:n("project:noSlots")})]}),o.jsxs("div",{className:"af-resource-slot-group",children:[o.jsx("span",{children:n("project:nodeOutputs")}),Ef(((nn=Re==null?void 0:Re.node)==null?void 0:nn.outputs)||nt.outputs).length>0?Ef(((Ur=Re==null?void 0:Re.node)==null?void 0:Ur.outputs)||nt.outputs).map(q=>o.jsxs("code",{children:[q.name||q.key,q.type?`: ${q.type}`:""]},q.key)):o.jsx("em",{children:n("project:noSlots")})]})]}):de==="runtime"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeRuntime")}),Re!=null&&Re.runtime?o.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(Re.runtime,null,2)}):o.jsx("p",{children:n("project:noRuntimeManifest")}),Re!=null&&Re.body?o.jsxs(o.Fragment,{children:[o.jsx("h4",{className:"af-resource-detail-subtitle",children:n("project:nodeBody")}),o.jsx("pre",{className:"af-resource-skill-preview",children:Re.body})]}):o.jsx("p",{children:n("project:noNodeBody")})]}):de==="files"?o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeFiles")}),Array.isArray(Re==null?void 0:Re.files)&&Re.files.length>0?o.jsxs("div",{className:"af-node-file-browser",children:[o.jsx("div",{className:"af-node-file-list",children:Re.files.map(q=>o.jsxs("button",{type:"button",className:"af-node-file-item"+(St===q.path?" af-node-file-item--active":""),onClick:()=>Wt(q.path),children:[o.jsx("span",{className:"material-symbols-outlined",children:"description"}),o.jsx("span",{children:q.path})]},q.path))}),o.jsxs("pre",{className:"af-resource-skill-preview",children:[fe===`${Rn(nt)}:${St}`?n("project:loadingResources"):dr!=null&&dr.binary?n("project:binaryFile"):(dr==null?void 0:dr.content)||n("project:selectNodeFile"),dr!=null&&dr.truncated?`
|
|
43
|
-
|
|
44
|
-
${n("project:fileTruncated")}`:""]})]}):o.jsx("p",{children:n("project:noNodeFiles")})]}):o.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[o.jsx("h4",{children:n("project:nodeUsage")}),Array.isArray(Re==null?void 0:Re.usage)&&Re.usage.length>0?o.jsx("div",{className:"af-node-usage-list",children:Re.usage.map(q=>o.jsxs("div",{className:"af-node-usage-item",children:[o.jsx("strong",{children:q.flowId}),o.jsxs("span",{children:[q.flowSource,q.archived?` · ${n("project:archived")}`:""]}),o.jsx("em",{children:q.instances.map(pe=>pe.label||pe.instanceId).join(", ")})]},`${q.flowSource}:${q.flowId}:${q.archived?"a":""}`))}):o.jsx("p",{children:n("project:noNodeUsage")})]})]}):we&&Yt?(()=>{const q=FO(Yt);return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-resource-detail-head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"schema"}),o.jsxs("div",{children:[o.jsx("h3",{children:Yt.displayName||Yt.name||Yt.id}),o.jsx("p",{children:Yt.id})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:Yt.description||n("project:noDescription")}),o.jsxs("dl",{className:"af-resource-detail-kv",children:[o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailVersion")}),o.jsx("dd",{children:Yt.version||"1.0.0"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:SS(Yt)})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:flowSnippetScale")}),o.jsx("dd",{children:n("project:flowSnippetNodes",{nodes:Number.isFinite(Number(Yt.nodeCount))?Number(Yt.nodeCount):q.nodes.length,edges:Number.isFinite(Number(Yt.edgeCount))?Number(Yt.edgeCount):q.edges.length})})]})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:resourceMeaning")}),o.jsx("p",{children:n("project:myFlowsMeaning")})]}),o.jsxs("div",{className:"af-resource-detail-section af-resource-danger-zone",children:[o.jsx("h4",{children:n("project:myFlowManagement")}),o.jsx("p",{children:n("project:deleteMyFlowHint")}),o.jsxs("button",{type:"button",className:"af-btn-secondary af-btn-danger",disabled:dn===lo(Yt),onClick:()=>pn(Yt),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"}),dn===lo(Yt)?n("project:deletingMyFlow"):n("project:deleteMyFlow")]}),at?o.jsx("p",{className:"af-resource-action-message",children:at}):null]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:flowSnippetPreview")}),q.diagram.nodes.length>0?o.jsx("div",{className:"af-flow-snippet-map",children:o.jsxs("svg",{viewBox:q.diagram.viewBox,role:"img","aria-label":n("project:flowSnippetPreview"),children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-flow-snippet-arrow",markerWidth:"8",markerHeight:"8",refX:"7",refY:"4",orient:"auto",markerUnits:"strokeWidth",children:o.jsx("path",{d:"M 0 0 L 8 4 L 0 8 z"})})}),o.jsx("g",{className:"af-flow-snippet-map__edges",children:q.diagram.edges.map(pe=>o.jsxs("g",{children:[o.jsx("path",{d:pe.path}),pe.label?o.jsx("text",{x:pe.labelX,y:pe.labelY-5,textAnchor:"middle",children:Tg(pe.label,18)}):null]},pe.key))}),o.jsx("g",{className:"af-flow-snippet-map__nodes",children:q.diagram.nodes.map((pe,Pe)=>o.jsxs("g",{transform:`translate(${pe.x} ${pe.y})`,children:[o.jsx("rect",{width:pe.width,height:pe.height,rx:"10"}),o.jsx("circle",{cx:"19",cy:pe.height/2,r:"12"}),o.jsx("text",{className:"af-flow-snippet-map__node-index",x:"19",y:pe.height/2+4,textAnchor:"middle",children:Pe+1}),o.jsx("text",{className:"af-flow-snippet-map__node-title",x:"40",y:pe.height/2-3,children:Tg(pe.title)}),o.jsx("text",{className:"af-flow-snippet-map__node-meta",x:"40",y:pe.height/2+16,children:Tg(pe.meta||pe.id,20)})]},pe.id))})]})}):o.jsx("p",{className:"af-resource-detail-desc",children:n("project:noFlowSnippetPreview")}),o.jsxs("details",{className:"af-flow-snippet-json",children:[o.jsx("summary",{children:n("project:flowSnippetJson")}),o.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(Yt.snippet||{},null,2)})]})]})]})})():a==="skills"&&xt?o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-resource-detail-head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"extension"}),o.jsxs("div",{children:[o.jsx("h3",{children:xt.name||xt.id}),o.jsx("p",{children:xt.sourceLabel||xt.source})]})]}),o.jsx("p",{className:"af-resource-detail-desc",children:xt.description||n("project:noDescription")}),o.jsxs("dl",{className:"af-resource-detail-kv",children:[o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailSource")}),o.jsx("dd",{children:xt.sourceLabel||xt.source})]}),o.jsxs("div",{children:[o.jsx("dt",{children:n("project:detailPath")}),o.jsx("dd",{children:xt.path||xt.key})]})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:"Collections"}),w.length===0?o.jsx("p",{children:"暂无 collection。可在左侧新建后再添加。"}):o.jsx("div",{className:"af-skill-detail-collections",children:w.map(q=>{const pe=Rn(xt),Pe=wt.get(q.id)||new Set,_e=Pe.has(pe);return o.jsxs("label",{className:"af-composer-skill-option af-skill-detail-collection-option",children:[o.jsx("input",{type:"checkbox",checked:_e,disabled:C||!i,onChange:qe=>wr(q.id,pe,qe.target.checked)}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:q.name}),o.jsxs("span",{className:"af-composer-skill-option-desc",children:[Pe.size," skills"]})]})]},q.id)})})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:resourceMeaning")}),o.jsx("p",{children:n("project:skillsMeaning")})]}),o.jsxs("div",{className:"af-resource-detail-section",children:[o.jsx("h4",{children:n("project:skillPreview")}),o.jsx("pre",{className:"af-resource-skill-preview",children:Te===Rn(xt)?n("project:loadingResources"):(Ke==null?void 0:Ke.body)||(Ke==null?void 0:Ke.content)||n("project:skillPreviewEmpty")})]})]}):o.jsx("p",{className:"af-activity-empty",children:n("project:selectResource")})}):o.jsxs("aside",{id:"af-recent-activity-panel",className:"af-activity"+(ee?"":" af-activity--hidden"),"aria-hidden":!ee,"aria-label":n("project:recentActivity"),children:[o.jsxs("h2",{className:"af-activity-title",children:[o.jsx("span",{className:"af-activity-bullet"}),n("project:recentActivity")]}),o.jsx("div",{className:"af-activity-list",children:br.length===0?o.jsx("p",{className:"af-activity-empty",children:rr.length===0?n("project:noRecentActivity"):n("project:noMatchRecent")}):br.map(q=>{const pe=G===NS(q);return o.jsxs("button",{type:"button",className:"af-activity-row af-activity-row--action"+(pe?" af-activity-row--active":""),"aria-current":pe?"page":void 0,onClick:()=>qr(q),children:[o.jsxs("div",{className:"af-activity-row-top",children:[o.jsx("h4",{className:"af-activity-name",children:o.jsx(Tn,{query:V,children:q.flowId})}),o.jsx("span",{className:"af-activity-time",children:bS(q.at,n)})]}),o.jsxs("div",{className:"af-activity-meta",children:[o.jsx("span",{className:NO(q.kind),children:q.kind==="executed"?"play_arrow":"visibility"}),o.jsxs("p",{className:"af-activity-text",children:[q.kind==="executed"?n("project:recentRun"):n("project:recentOpen")," · ",bS(q.at,n)]})]})]},`${q.kind}-${q.flowId}-${q.flowSource}-${q.at}`)})})]})]}),o.jsx(oO,{open:D,onClose:()=>$(!1),onCreated:async q=>{$(!1),await Yn();const pe=q.source??"user";r(_f({id:q.id,source:pe},"workspace"))}}),I?o.jsx(sO,{file:I,onClose:()=>F(null),onImported:async q=>{F(null),await Yn();const pe=q.source??"user";r(_f({id:q.id,source:pe},"workspace"))}},`${I.name}-${I.size}-${I.lastModified}`):null]})}function Bn(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=Bn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var zO={value:()=>{}};function Qh(){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 yp(n)}function yp(e){this._=e}function BO(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}})}yp.prototype=Qh.prototype={constructor:yp,on:function(e,t){var n=this._,r=BO(e+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((s=(e=r[i]).type)&&(s=HO(n[s],e.name)))return s;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<a;)if(s=(e=r[i]).type)n[s]=_S(n[s],e.name,t);else if(t==null)for(s in n)n[s]=_S(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 yp(e)},call:function(e,t){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,i;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,s=i.length;r<s;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],s=0,i=r.length;s<i;++s)r[s].value.apply(t,n)}};function HO(e,t){for(var n=0,r=e.length,s;n<r;++n)if((s=e[n]).name===t)return s.value}function _S(e,t,n){for(var r=0,s=e.length;r<s;++r)if(e[r].name===t){e[r]=zO,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var jx="http://www.w3.org/1999/xhtml";const ES={svg:"http://www.w3.org/2000/svg",xhtml:jx,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Zh(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ES.hasOwnProperty(t)?{space:ES[t],local:e}:e}function WO(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===jx&&t.documentElement.namespaceURI===jx?t.createElement(e):t.createElementNS(n,e)}}function VO(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function WE(e){var t=Zh(e);return(t.local?VO:WO)(t)}function KO(){}function yb(e){return e==null?KO:function(){return this.querySelector(e)}}function qO(e){typeof e!="function"&&(e=yb(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],a=i.length,l=r[s]=new Array(a),c,u,p=0;p<a;++p)(c=i[p])&&(u=e.call(c,c.__data__,p,i))&&("__data__"in c&&(u.__data__=c.__data__),l[p]=u);return new is(r,this._parents)}function UO(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function YO(){return[]}function VE(e){return e==null?YO:function(){return this.querySelectorAll(e)}}function GO(e){return function(){return UO(e.apply(this,arguments))}}function JO(e){typeof e=="function"?e=GO(e):e=VE(e);for(var t=this._groups,n=t.length,r=[],s=[],i=0;i<n;++i)for(var a=t[i],l=a.length,c,u=0;u<l;++u)(c=a[u])&&(r.push(e.call(c,c.__data__,u,a)),s.push(c));return new is(r,s)}function KE(e){return function(){return this.matches(e)}}function qE(e){return function(t){return t.matches(e)}}var XO=Array.prototype.find;function QO(e){return function(){return XO.call(this.children,e)}}function ZO(){return this.firstElementChild}function eD(e){return this.select(e==null?ZO:QO(typeof e=="function"?e:qE(e)))}var tD=Array.prototype.filter;function nD(){return Array.from(this.children)}function rD(e){return function(){return tD.call(this.children,e)}}function sD(e){return this.selectAll(e==null?nD:rD(typeof e=="function"?e:qE(e)))}function iD(e){typeof e!="function"&&(e=KE(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],a=i.length,l=r[s]=[],c,u=0;u<a;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&l.push(c);return new is(r,this._parents)}function UE(e){return new Array(e.length)}function oD(){return new is(this._enter||this._groups.map(UE),this._parents)}function eh(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}eh.prototype={constructor:eh,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 aD(e){return function(){return e}}function lD(e,t,n,r,s,i){for(var a=0,l,c=t.length,u=i.length;a<u;++a)(l=t[a])?(l.__data__=i[a],r[a]=l):n[a]=new eh(e,i[a]);for(;a<c;++a)(l=t[a])&&(s[a]=l)}function cD(e,t,n,r,s,i,a){var l,c,u=new Map,p=t.length,d=i.length,f=new Array(p),h;for(l=0;l<p;++l)(c=t[l])&&(f[l]=h=a.call(c,c.__data__,l,t)+"",u.has(h)?s[l]=c:u.set(h,c));for(l=0;l<d;++l)h=a.call(e,i[l],l,i)+"",(c=u.get(h))?(r[l]=c,c.__data__=i[l],u.delete(h)):n[l]=new eh(e,i[l]);for(l=0;l<p;++l)(c=t[l])&&u.get(f[l])===c&&(s[l]=c)}function uD(e){return e.__data__}function dD(e,t){if(!arguments.length)return Array.from(this,uD);var n=t?cD:lD,r=this._parents,s=this._groups;typeof e!="function"&&(e=aD(e));for(var i=s.length,a=new Array(i),l=new Array(i),c=new Array(i),u=0;u<i;++u){var p=r[u],d=s[u],f=d.length,h=fD(e.call(p,p&&p.__data__,u,r)),g=h.length,k=l[u]=new Array(g),w=a[u]=new Array(g),y=c[u]=new Array(f);n(p,d,k,w,y,h,t);for(var v=0,x=0,C,N;v<g;++v)if(C=k[v]){for(v>=x&&(x=v+1);!(N=w[x])&&++x<g;);C._next=N||null}}return a=new is(a,r),a._enter=l,a._exit=c,a}function fD(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function pD(){return new is(this._exit||this._groups.map(UE),this._parents)}function hD(e,t,n){var r=this.enter(),s=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(s=t(s),s&&(s=s.selection())),n==null?i.remove():n(i),r&&s?r.merge(s).order():s}function mD(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,s=n.length,i=r.length,a=Math.min(s,i),l=new Array(s),c=0;c<a;++c)for(var u=n[c],p=r[c],d=u.length,f=l[c]=new Array(d),h,g=0;g<d;++g)(h=u[g]||p[g])&&(f[g]=h);for(;c<s;++c)l[c]=n[c];return new is(l,this._parents)}function gD(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],s=r.length-1,i=r[s],a;--s>=0;)(a=r[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function yD(e){e||(e=xD);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,s=new Array(r),i=0;i<r;++i){for(var a=n[i],l=a.length,c=s[i]=new Array(l),u,p=0;p<l;++p)(u=a[p])&&(c[p]=u);c.sort(t)}return new is(s,this._parents).order()}function xD(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function wD(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function bD(){return Array.from(this)}function kD(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length;s<i;++s){var a=r[s];if(a)return a}return null}function vD(){let e=0;for(const t of this)++e;return e}function SD(){return!this.node()}function ND(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var s=t[n],i=0,a=s.length,l;i<a;++i)(l=s[i])&&e.call(l,l.__data__,i,s);return this}function jD(e){return function(){this.removeAttribute(e)}}function CD(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _D(e,t){return function(){this.setAttribute(e,t)}}function ED(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function AD(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function PD(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 ID(e,t){var n=Zh(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?CD:jD:typeof t=="function"?n.local?PD:AD:n.local?ED:_D)(n,t))}function YE(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function TD(e){return function(){this.style.removeProperty(e)}}function RD(e,t,n){return function(){this.style.setProperty(e,t,n)}}function MD(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function $D(e,t,n){return arguments.length>1?this.each((t==null?TD:typeof t=="function"?MD:RD)(e,t,n??"")):Jl(this.node(),e)}function Jl(e,t){return e.style.getPropertyValue(t)||YE(e).getComputedStyle(e,null).getPropertyValue(t)}function LD(e){return function(){delete this[e]}}function OD(e,t){return function(){this[e]=t}}function DD(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function FD(e,t){return arguments.length>1?this.each((t==null?LD:typeof t=="function"?DD:OD)(e,t)):this.node()[e]}function GE(e){return e.trim().split(/^|\s+/)}function xb(e){return e.classList||new JE(e)}function JE(e){this._node=e,this._names=GE(e.getAttribute("class")||"")}JE.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 XE(e,t){for(var n=xb(e),r=-1,s=t.length;++r<s;)n.add(t[r])}function QE(e,t){for(var n=xb(e),r=-1,s=t.length;++r<s;)n.remove(t[r])}function zD(e){return function(){XE(this,e)}}function BD(e){return function(){QE(this,e)}}function HD(e,t){return function(){(t.apply(this,arguments)?XE:QE)(this,e)}}function WD(e,t){var n=GE(e+"");if(arguments.length<2){for(var r=xb(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof t=="function"?HD:t?zD:BD)(n,t))}function VD(){this.textContent=""}function KD(e){return function(){this.textContent=e}}function qD(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function UD(e){return arguments.length?this.each(e==null?VD:(typeof e=="function"?qD:KD)(e)):this.node().textContent}function YD(){this.innerHTML=""}function GD(e){return function(){this.innerHTML=e}}function JD(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function XD(e){return arguments.length?this.each(e==null?YD:(typeof e=="function"?JD:GD)(e)):this.node().innerHTML}function QD(){this.nextSibling&&this.parentNode.appendChild(this)}function ZD(){return this.each(QD)}function eF(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function tF(){return this.each(eF)}function nF(e){var t=typeof e=="function"?e:WE(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function rF(){return null}function sF(e,t){var n=typeof e=="function"?e:WE(e),r=t==null?rF:typeof t=="function"?t:yb(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function iF(){var e=this.parentNode;e&&e.removeChild(this)}function oF(){return this.each(iF)}function aF(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function lF(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function cF(e){return this.select(e?lF:aF)}function uF(e){return arguments.length?this.property("__data__",e):this.node().__data__}function dF(e){return function(t){e.call(this,t,this.__data__)}}function fF(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 pF(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,s=t.length,i;n<s;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function hF(e,t,n){return function(){var r=this.__on,s,i=dF(t);if(r){for(var a=0,l=r.length;a<l;++a)if((s=r[a]).type===e.type&&s.name===e.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=i,s.options=n),s.value=t;return}}this.addEventListener(e.type,i,n),s={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(s):this.__on=[s]}}function mF(e,t,n){var r=fF(e+""),s,i=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,u=l.length,p;c<u;++c)for(s=0,p=l[c];s<i;++s)if((a=r[s]).type===p.type&&a.name===p.name)return p.value}return}for(l=t?hF:pF,s=0;s<i;++s)this.each(l(r[s],t,n));return this}function ZE(e,t,n){var r=YE(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 gF(e,t){return function(){return ZE(this,e,t)}}function yF(e,t){return function(){return ZE(this,e,t.apply(this,arguments))}}function xF(e,t){return this.each((typeof t=="function"?yF:gF)(e,t))}function*wF(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],s=0,i=r.length,a;s<i;++s)(a=r[s])&&(yield a)}var eA=[null];function is(e,t){this._groups=e,this._parents=t}function bd(){return new is([[document.documentElement]],eA)}function bF(){return this}is.prototype=bd.prototype={constructor:is,select:qO,selectAll:JO,selectChild:eD,selectChildren:sD,filter:iD,data:dD,enter:oD,exit:pD,join:hD,merge:mD,selection:bF,order:gD,sort:yD,call:wD,nodes:bD,node:kD,size:vD,empty:SD,each:ND,attr:ID,style:$D,property:FD,classed:WD,text:UD,html:XD,raise:ZD,lower:tF,append:nF,insert:sF,remove:oF,clone:cF,datum:uF,on:mF,dispatch:xF,[Symbol.iterator]:wF};function Zr(e){return typeof e=="string"?new is([[document.querySelector(e)]],[document.documentElement]):new is([[e]],eA)}function kF(e){let t;for(;t=e.sourceEvent;)e=t;return e}function $s(e,t){if(e=kF(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 vF={passive:!1},qu={capture:!0,passive:!1};function Rg(e){e.stopImmediatePropagation()}function Ll(e){e.preventDefault(),e.stopImmediatePropagation()}function tA(e){var t=e.document.documentElement,n=Zr(e).on("dragstart.drag",Ll,qu);"onselectstart"in t?n.on("selectstart.drag",Ll,qu):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function nA(e,t){var n=e.document.documentElement,r=Zr(e).on("dragstart.drag",null);t&&(r.on("click.drag",Ll,qu),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 Af=e=>()=>e;function Cx(e,{sourceEvent:t,subject:n,target:r,identifier:s,active:i,x:a,y:l,dx:c,dy:u,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:p}})}Cx.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function SF(e){return!e.ctrlKey&&!e.button}function NF(){return this.parentNode}function jF(e,t){return t??{x:e.x,y:e.y}}function CF(){return navigator.maxTouchPoints||"ontouchstart"in this}function rA(){var e=SF,t=NF,n=jF,r=CF,s={},i=Qh("start","drag","end"),a=0,l,c,u,p,d=0;function f(C){C.on("mousedown.drag",h).filter(r).on("touchstart.drag",w).on("touchmove.drag",y,vF).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(C,N){if(!(p||!e.call(this,C,N))){var j=x(this,t.call(this,C,N),C,N,"mouse");j&&(Zr(C.view).on("mousemove.drag",g,qu).on("mouseup.drag",k,qu),tA(C.view),Rg(C),u=!1,l=C.clientX,c=C.clientY,j("start",C))}}function g(C){if(Ll(C),!u){var N=C.clientX-l,j=C.clientY-c;u=N*N+j*j>d}s.mouse("drag",C)}function k(C){Zr(C.view).on("mousemove.drag mouseup.drag",null),nA(C.view,u),Ll(C),s.mouse("end",C)}function w(C,N){if(e.call(this,C,N)){var j=C.changedTouches,E=t.call(this,C,N),P=j.length,O,B;for(O=0;O<P;++O)(B=x(this,E,C,N,j[O].identifier,j[O]))&&(Rg(C),B("start",C,j[O]))}}function y(C){var N=C.changedTouches,j=N.length,E,P;for(E=0;E<j;++E)(P=s[N[E].identifier])&&(Ll(C),P("drag",C,N[E]))}function v(C){var N=C.changedTouches,j=N.length,E,P;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),E=0;E<j;++E)(P=s[N[E].identifier])&&(Rg(C),P("end",C,N[E]))}function x(C,N,j,E,P,O){var B=i.copy(),W=$s(O||j,N),z,L,R;if((R=n.call(C,new Cx("beforestart",{sourceEvent:j,target:f,identifier:P,active:a,x:W[0],y:W[1],dx:0,dy:0,dispatch:B}),E))!=null)return z=R.x-W[0]||0,L=R.y-W[1]||0,function K(D,$,I){var F=W,_;switch(D){case"start":s[P]=K,_=a++;break;case"end":delete s[P],--a;case"drag":W=$s(I||$,N),_=a;break}B.call(D,C,new Cx(D,{sourceEvent:$,subject:R,target:f,identifier:P,active:_,x:W[0]+z,y:W[1]+L,dx:W[0]-F[0],dy:W[1]-F[1],dispatch:B}),E)}}return f.filter=function(C){return arguments.length?(e=typeof C=="function"?C:Af(!!C),f):e},f.container=function(C){return arguments.length?(t=typeof C=="function"?C:Af(C),f):t},f.subject=function(C){return arguments.length?(n=typeof C=="function"?C:Af(C),f):n},f.touchable=function(C){return arguments.length?(r=typeof C=="function"?C:Af(!!C),f):r},f.on=function(){var C=i.on.apply(i,arguments);return C===i?f:C},f.clickDistance=function(C){return arguments.length?(d=(C=+C)*C,f):Math.sqrt(d)},f}function wb(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function sA(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function kd(){}var Uu=.7,th=1/Uu,Ol="\\s*([+-]?\\d+)\\s*",Yu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",fi="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",_F=/^#([0-9a-f]{3,8})$/,EF=new RegExp(`^rgb\\(${Ol},${Ol},${Ol}\\)$`),AF=new RegExp(`^rgb\\(${fi},${fi},${fi}\\)$`),PF=new RegExp(`^rgba\\(${Ol},${Ol},${Ol},${Yu}\\)$`),IF=new RegExp(`^rgba\\(${fi},${fi},${fi},${Yu}\\)$`),TF=new RegExp(`^hsl\\(${Yu},${fi},${fi}\\)$`),RF=new RegExp(`^hsla\\(${Yu},${fi},${fi},${Yu}\\)$`),AS={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};wb(kd,_a,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:PS,formatHex:PS,formatHex8:MF,formatHsl:$F,formatRgb:IS,toString:IS});function PS(){return this.rgb().formatHex()}function MF(){return this.rgb().formatHex8()}function $F(){return iA(this).formatHsl()}function IS(){return this.rgb().formatRgb()}function _a(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=_F.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?TS(t):n===3?new Dr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Pf(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Pf(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=EF.exec(e))?new Dr(t[1],t[2],t[3],1):(t=AF.exec(e))?new Dr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=PF.exec(e))?Pf(t[1],t[2],t[3],t[4]):(t=IF.exec(e))?Pf(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=TF.exec(e))?$S(t[1],t[2]/100,t[3]/100,1):(t=RF.exec(e))?$S(t[1],t[2]/100,t[3]/100,t[4]):AS.hasOwnProperty(e)?TS(AS[e]):e==="transparent"?new Dr(NaN,NaN,NaN,0):null}function TS(e){return new Dr(e>>16&255,e>>8&255,e&255,1)}function Pf(e,t,n,r){return r<=0&&(e=t=n=NaN),new Dr(e,t,n,r)}function LF(e){return e instanceof kd||(e=_a(e)),e?(e=e.rgb(),new Dr(e.r,e.g,e.b,e.opacity)):new Dr}function _x(e,t,n,r){return arguments.length===1?LF(e):new Dr(e,t,n,r??1)}function Dr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}wb(Dr,_x,sA(kd,{brighter(e){return e=e==null?th:Math.pow(th,e),new Dr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Uu:Math.pow(Uu,e),new Dr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Dr(xa(this.r),xa(this.g),xa(this.b),nh(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:RS,formatHex:RS,formatHex8:OF,formatRgb:MS,toString:MS}));function RS(){return`#${pa(this.r)}${pa(this.g)}${pa(this.b)}`}function OF(){return`#${pa(this.r)}${pa(this.g)}${pa(this.b)}${pa((isNaN(this.opacity)?1:this.opacity)*255)}`}function MS(){const e=nh(this.opacity);return`${e===1?"rgb(":"rgba("}${xa(this.r)}, ${xa(this.g)}, ${xa(this.b)}${e===1?")":`, ${e})`}`}function nh(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function xa(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function pa(e){return e=xa(e),(e<16?"0":"")+e.toString(16)}function $S(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ds(e,t,n,r)}function iA(e){if(e instanceof Ds)return new Ds(e.h,e.s,e.l,e.opacity);if(e instanceof kd||(e=_a(e)),!e)return new Ds;if(e instanceof Ds)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,s=Math.min(t,n,r),i=Math.max(t,n,r),a=NaN,l=i-s,c=(i+s)/2;return l?(t===i?a=(n-r)/l+(n<r)*6:n===i?a=(r-t)/l+2:a=(t-n)/l+4,l/=c<.5?i+s:2-i-s,a*=60):l=c>0&&c<1?0:a,new Ds(a,l,c,e.opacity)}function DF(e,t,n,r){return arguments.length===1?iA(e):new Ds(e,t,n,r??1)}function Ds(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}wb(Ds,DF,sA(kd,{brighter(e){return e=e==null?th:Math.pow(th,e),new Ds(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Uu:Math.pow(Uu,e),new Ds(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 Dr(Mg(e>=240?e-240:e+120,s,r),Mg(e,s,r),Mg(e<120?e+240:e-120,s,r),this.opacity)},clamp(){return new Ds(LS(this.h),If(this.s),If(this.l),nh(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=nh(this.opacity);return`${e===1?"hsl(":"hsla("}${LS(this.h)}, ${If(this.s)*100}%, ${If(this.l)*100}%${e===1?")":`, ${e})`}`}}));function LS(e){return e=(e||0)%360,e<0?e+360:e}function If(e){return Math.max(0,Math.min(1,e||0))}function Mg(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 bb=e=>()=>e;function FF(e,t){return function(n){return e+n*t}}function zF(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 BF(e){return(e=+e)==1?oA:function(t,n){return n-t?zF(t,n,e):bb(isNaN(t)?n:t)}}function oA(e,t){var n=t-e;return n?FF(e,n):bb(isNaN(e)?t:e)}const rh=function e(t){var n=BF(t);function r(s,i){var a=n((s=_x(s)).r,(i=_x(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),u=oA(s.opacity,i.opacity);return function(p){return s.r=a(p),s.g=l(p),s.b=c(p),s.opacity=u(p),s+""}}return r.gamma=e,r}(1);function HF(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),s;return function(i){for(s=0;s<n;++s)r[s]=e[s]*(1-i)+t[s]*i;return r}}function WF(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function VF(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,s=new Array(r),i=new Array(n),a;for(a=0;a<r;++a)s[a]=wu(e[a],t[a]);for(;a<n;++a)i[a]=t[a];return function(l){for(a=0;a<r;++a)i[a]=s[a](l);return i}}function KF(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function ni(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function qF(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]=wu(e[s],t[s]):r[s]=t[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var Ex=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$g=new RegExp(Ex.source,"g");function UF(e){return function(){return e}}function YF(e){return function(t){return e(t)+""}}function aA(e,t){var n=Ex.lastIndex=$g.lastIndex=0,r,s,i,a=-1,l=[],c=[];for(e=e+"",t=t+"";(r=Ex.exec(e))&&(s=$g.exec(t));)(i=s.index)>n&&(i=t.slice(n,i),l[a]?l[a]+=i:l[++a]=i),(r=r[0])===(s=s[0])?l[a]?l[a]+=s:l[++a]=s:(l[++a]=null,c.push({i:a,x:ni(r,s)})),n=$g.lastIndex;return n<t.length&&(i=t.slice(n),l[a]?l[a]+=i:l[++a]=i),l.length<2?c[0]?YF(c[0].x):UF(t):(t=c.length,function(u){for(var p=0,d;p<t;++p)l[(d=c[p]).i]=d.x(u);return l.join("")})}function wu(e,t){var n=typeof t,r;return t==null||n==="boolean"?bb(t):(n==="number"?ni:n==="string"?(r=_a(t))?(t=r,rh):aA:t instanceof _a?rh:t instanceof Date?KF:WF(t)?HF:Array.isArray(t)?VF:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?qF:ni)(e,t)}var OS=180/Math.PI,Ax={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function lA(e,t,n,r,s,i){var a,l,c;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,c/=l),e*r<t*n&&(e=-e,t=-t,c=-c,a=-a),{translateX:s,translateY:i,rotate:Math.atan2(t,e)*OS,skewX:Math.atan(c)*OS,scaleX:a,scaleY:l}}var Tf;function GF(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ax:lA(t.a,t.b,t.c,t.d,t.e,t.f)}function JF(e){return e==null||(Tf||(Tf=document.createElementNS("http://www.w3.org/2000/svg","g")),Tf.setAttribute("transform",e),!(e=Tf.transform.baseVal.consolidate()))?Ax:(e=e.matrix,lA(e.a,e.b,e.c,e.d,e.e,e.f))}function cA(e,t,n,r){function s(u){return u.length?u.pop()+" ":""}function i(u,p,d,f,h,g){if(u!==d||p!==f){var k=h.push("translate(",null,t,null,n);g.push({i:k-4,x:ni(u,d)},{i:k-2,x:ni(p,f)})}else(d||f)&&h.push("translate("+d+t+f+n)}function a(u,p,d,f){u!==p?(u-p>180?p+=360:p-u>180&&(u+=360),f.push({i:d.push(s(d)+"rotate(",null,r)-2,x:ni(u,p)})):p&&d.push(s(d)+"rotate("+p+r)}function l(u,p,d,f){u!==p?f.push({i:d.push(s(d)+"skewX(",null,r)-2,x:ni(u,p)}):p&&d.push(s(d)+"skewX("+p+r)}function c(u,p,d,f,h,g){if(u!==d||p!==f){var k=h.push(s(h)+"scale(",null,",",null,")");g.push({i:k-4,x:ni(u,d)},{i:k-2,x:ni(p,f)})}else(d!==1||f!==1)&&h.push(s(h)+"scale("+d+","+f+")")}return function(u,p){var d=[],f=[];return u=e(u),p=e(p),i(u.translateX,u.translateY,p.translateX,p.translateY,d,f),a(u.rotate,p.rotate,d,f),l(u.skewX,p.skewX,d,f),c(u.scaleX,u.scaleY,p.scaleX,p.scaleY,d,f),u=p=null,function(h){for(var g=-1,k=f.length,w;++g<k;)d[(w=f[g]).i]=w.x(h);return d.join("")}}}var XF=cA(GF,"px, ","px)","deg)"),QF=cA(JF,", ",")",")"),ZF=1e-12;function DS(e){return((e=Math.exp(e))+1/e)/2}function ez(e){return((e=Math.exp(e))-1/e)/2}function tz(e){return((e=Math.exp(2*e))-1)/(e+1)}const xp=function e(t,n,r){function s(i,a){var l=i[0],c=i[1],u=i[2],p=a[0],d=a[1],f=a[2],h=p-l,g=d-c,k=h*h+g*g,w,y;if(k<ZF)y=Math.log(f/u)/t,w=function(E){return[l+E*h,c+E*g,u*Math.exp(t*E*y)]};else{var v=Math.sqrt(k),x=(f*f-u*u+r*k)/(2*u*n*v),C=(f*f-u*u-r*k)/(2*f*n*v),N=Math.log(Math.sqrt(x*x+1)-x),j=Math.log(Math.sqrt(C*C+1)-C);y=(j-N)/t,w=function(E){var P=E*y,O=DS(N),B=u/(n*v)*(O*tz(t*P+N)-ez(N));return[l+B*h,c+B*g,u*O/DS(t*P+N)]}}return w.duration=y*1e3*t/Math.SQRT2,w}return s.rho=function(i){var a=Math.max(.001,+i),l=a*a,c=l*l;return e(a,l,c)},s}(Math.SQRT2,2,4);var Xl=0,ru=0,Wc=0,uA=1e3,sh,su,ih=0,Ea=0,em=0,Gu=typeof performance=="object"&&performance.now?performance:Date,dA=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function kb(){return Ea||(dA(nz),Ea=Gu.now()+em)}function nz(){Ea=0}function oh(){this._call=this._time=this._next=null}oh.prototype=fA.prototype={constructor:oh,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?kb():+n)+(t==null?0:+t),!this._next&&su!==this&&(su?su._next=this:sh=this,su=this),this._call=e,this._time=n,Px()},stop:function(){this._call&&(this._call=null,this._time=1/0,Px())}};function fA(e,t,n){var r=new oh;return r.restart(e,t,n),r}function rz(){kb(),++Xl;for(var e=sh,t;e;)(t=Ea-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Xl}function FS(){Ea=(ih=Gu.now())+em,Xl=ru=0;try{rz()}finally{Xl=0,iz(),Ea=0}}function sz(){var e=Gu.now(),t=e-ih;t>uA&&(em-=t,ih=e)}function iz(){for(var e,t=sh,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:sh=n);su=e,Px(r)}function Px(e){if(!Xl){ru&&(ru=clearTimeout(ru));var t=e-Ea;t>24?(e<1/0&&(ru=setTimeout(FS,e-Gu.now()-em)),Wc&&(Wc=clearInterval(Wc))):(Wc||(ih=Gu.now(),Wc=setInterval(sz,uA)),Xl=1,dA(FS))}}function zS(e,t,n){var r=new oh;return t=t==null?0:+t,r.restart(s=>{r.stop(),e(s+t)},t,n),r}var oz=Qh("start","end","cancel","interrupt"),az=[],pA=0,BS=1,Ix=2,wp=3,HS=4,Tx=5,bp=6;function tm(e,t,n,r,s,i){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;lz(e,n,{name:t,index:r,group:s,on:oz,tween:az,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:pA})}function vb(e,t){var n=Us(e,t);if(n.state>pA)throw new Error("too late; already scheduled");return n}function wi(e,t){var n=Us(e,t);if(n.state>wp)throw new Error("too late; already running");return n}function Us(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function lz(e,t,n){var r=e.__transition,s;r[t]=n,n.timer=fA(i,0,n.time);function i(u){n.state=BS,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var p,d,f,h;if(n.state!==BS)return c();for(p in r)if(h=r[p],h.name===n.name){if(h.state===wp)return zS(a);h.state===HS?(h.state=bp,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[p]):+p<t&&(h.state=bp,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[p])}if(zS(function(){n.state===wp&&(n.state=HS,n.timer.restart(l,n.delay,n.time),l(u))}),n.state=Ix,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Ix){for(n.state=wp,s=new Array(f=n.tween.length),p=0,d=-1;p<f;++p)(h=n.tween[p].value.call(e,e.__data__,n.index,n.group))&&(s[++d]=h);s.length=d+1}}function l(u){for(var p=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=Tx,1),d=-1,f=s.length;++d<f;)s[d].call(e,p);n.state===Tx&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=bp,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function kp(e,t){var n=e.__transition,r,s,i=!0,a;if(n){t=t==null?null:t+"";for(a in n){if((r=n[a]).name!==t){i=!1;continue}s=r.state>Ix&&r.state<Tx,r.state=bp,r.timer.stop(),r.on.call(s?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[a]}i&&delete e.__transition}}function cz(e){return this.each(function(){kp(this,e)})}function uz(e,t){var n,r;return function(){var s=wi(this,e),i=s.tween;if(i!==n){r=n=i;for(var a=0,l=r.length;a<l;++a)if(r[a].name===t){r=r.slice(),r.splice(a,1);break}}s.tween=r}}function dz(e,t,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=wi(this,e),a=i.tween;if(a!==r){s=(r=a).slice();for(var l={name:t,value:n},c=0,u=s.length;c<u;++c)if(s[c].name===t){s[c]=l;break}c===u&&s.push(l)}i.tween=s}}function fz(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Us(this.node(),n).tween,s=0,i=r.length,a;s<i;++s)if((a=r[s]).name===e)return a.value;return null}return this.each((t==null?uz:dz)(n,e,t))}function Sb(e,t,n){var r=e._id;return e.each(function(){var s=wi(this,r);(s.value||(s.value={}))[t]=n.apply(this,arguments)}),function(s){return Us(s,r).value[t]}}function hA(e,t){var n;return(typeof t=="number"?ni:t instanceof _a?rh:(n=_a(t))?(t=n,rh):aA)(e,t)}function pz(e){return function(){this.removeAttribute(e)}}function hz(e){return function(){this.removeAttributeNS(e.space,e.local)}}function mz(e,t,n){var r,s=n+"",i;return function(){var a=this.getAttribute(e);return a===s?null:a===r?i:i=t(r=a,n)}}function gz(e,t,n){var r,s=n+"",i;return function(){var a=this.getAttributeNS(e.space,e.local);return a===s?null:a===r?i:i=t(r=a,n)}}function yz(e,t,n){var r,s,i;return function(){var a,l=n(this),c;return l==null?void this.removeAttribute(e):(a=this.getAttribute(e),c=l+"",a===c?null:a===r&&c===s?i:(s=c,i=t(r=a,l)))}}function xz(e,t,n){var r,s,i;return function(){var a,l=n(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(a=this.getAttributeNS(e.space,e.local),c=l+"",a===c?null:a===r&&c===s?i:(s=c,i=t(r=a,l)))}}function wz(e,t){var n=Zh(e),r=n==="transform"?QF:hA;return this.attrTween(e,typeof t=="function"?(n.local?xz:yz)(n,r,Sb(this,"attr."+e,t)):t==null?(n.local?hz:pz)(n):(n.local?gz:mz)(n,r,t))}function bz(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function kz(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function vz(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&kz(e,i)),n}return s._value=t,s}function Sz(e,t){var n,r;function s(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&bz(e,i)),n}return s._value=t,s}function Nz(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=Zh(e);return this.tween(n,(r.local?vz:Sz)(r,t))}function jz(e,t){return function(){vb(this,e).delay=+t.apply(this,arguments)}}function Cz(e,t){return t=+t,function(){vb(this,e).delay=t}}function _z(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?jz:Cz)(t,e)):Us(this.node(),t).delay}function Ez(e,t){return function(){wi(this,e).duration=+t.apply(this,arguments)}}function Az(e,t){return t=+t,function(){wi(this,e).duration=t}}function Pz(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ez:Az)(t,e)):Us(this.node(),t).duration}function Iz(e,t){if(typeof t!="function")throw new Error;return function(){wi(this,e).ease=t}}function Tz(e){var t=this._id;return arguments.length?this.each(Iz(t,e)):Us(this.node(),t).ease}function Rz(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;wi(this,e).ease=n}}function Mz(e){if(typeof e!="function")throw new Error;return this.each(Rz(this._id,e))}function $z(e){typeof e!="function"&&(e=KE(e));for(var t=this._groups,n=t.length,r=new Array(n),s=0;s<n;++s)for(var i=t[s],a=i.length,l=r[s]=[],c,u=0;u<a;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&l.push(c);return new Ui(r,this._parents,this._name,this._id)}function Lz(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,s=n.length,i=Math.min(r,s),a=new Array(r),l=0;l<i;++l)for(var c=t[l],u=n[l],p=c.length,d=a[l]=new Array(p),f,h=0;h<p;++h)(f=c[h]||u[h])&&(d[h]=f);for(;l<r;++l)a[l]=t[l];return new Ui(a,this._parents,this._name,this._id)}function Oz(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 Dz(e,t,n){var r,s,i=Oz(t)?vb:wi;return function(){var a=i(this,e),l=a.on;l!==r&&(s=(r=l).copy()).on(t,n),a.on=s}}function Fz(e,t){var n=this._id;return arguments.length<2?Us(this.node(),n).on.on(e):this.each(Dz(n,e,t))}function zz(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Bz(){return this.on("end.remove",zz(this._id))}function Hz(e){var t=this._name,n=this._id;typeof e!="function"&&(e=yb(e));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a<s;++a)for(var l=r[a],c=l.length,u=i[a]=new Array(c),p,d,f=0;f<c;++f)(p=l[f])&&(d=e.call(p,p.__data__,f,l))&&("__data__"in p&&(d.__data__=p.__data__),u[f]=d,tm(u[f],t,n,f,u,Us(p,n)));return new Ui(i,this._parents,t,n)}function Wz(e){var t=this._name,n=this._id;typeof e!="function"&&(e=VE(e));for(var r=this._groups,s=r.length,i=[],a=[],l=0;l<s;++l)for(var c=r[l],u=c.length,p,d=0;d<u;++d)if(p=c[d]){for(var f=e.call(p,p.__data__,d,c),h,g=Us(p,n),k=0,w=f.length;k<w;++k)(h=f[k])&&tm(h,t,n,k,f,g);i.push(f),a.push(p)}return new Ui(i,a,t,n)}var Vz=bd.prototype.constructor;function Kz(){return new Vz(this._groups,this._parents)}function qz(e,t){var n,r,s;return function(){var i=Jl(this,e),a=(this.style.removeProperty(e),Jl(this,e));return i===a?null:i===n&&a===r?s:s=t(n=i,r=a)}}function mA(e){return function(){this.style.removeProperty(e)}}function Uz(e,t,n){var r,s=n+"",i;return function(){var a=Jl(this,e);return a===s?null:a===r?i:i=t(r=a,n)}}function Yz(e,t,n){var r,s,i;return function(){var a=Jl(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),Jl(this,e))),a===c?null:a===r&&c===s?i:(s=c,i=t(r=a,l))}}function Gz(e,t){var n,r,s,i="style."+t,a="end."+i,l;return function(){var c=wi(this,e),u=c.on,p=c.value[i]==null?l||(l=mA(t)):void 0;(u!==n||s!==p)&&(r=(n=u).copy()).on(a,s=p),c.on=r}}function Jz(e,t,n){var r=(e+="")=="transform"?XF:hA;return t==null?this.styleTween(e,qz(e,r)).on("end.style."+e,mA(e)):typeof t=="function"?this.styleTween(e,Yz(e,r,Sb(this,"style."+e,t))).each(Gz(this._id,e)):this.styleTween(e,Uz(e,r,t),n).on("end.style."+e,null)}function Xz(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function Qz(e,t,n){var r,s;function i(){var a=t.apply(this,arguments);return a!==s&&(r=(s=a)&&Xz(e,a,n)),r}return i._value=t,i}function Zz(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,Qz(e,t,n??""))}function e3(e){return function(){this.textContent=e}}function t3(e){return function(){var t=e(this);this.textContent=t??""}}function n3(e){return this.tween("text",typeof e=="function"?t3(Sb(this,"text",e)):e3(e==null?"":e+""))}function r3(e){return function(t){this.textContent=e.call(this,t)}}function s3(e){var t,n;function r(){var s=e.apply(this,arguments);return s!==n&&(t=(n=s)&&r3(s)),t}return r._value=e,r}function i3(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,s3(e))}function o3(){for(var e=this._name,t=this._id,n=gA(),r=this._groups,s=r.length,i=0;i<s;++i)for(var a=r[i],l=a.length,c,u=0;u<l;++u)if(c=a[u]){var p=Us(c,t);tm(c,e,n,u,a,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new Ui(r,this._parents,e,n)}function a3(){var e,t,n=this,r=n._id,s=n.size();return new Promise(function(i,a){var l={value:a},c={value:function(){--s===0&&i()}};n.each(function(){var u=wi(this,r),p=u.on;p!==e&&(t=(e=p).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),u.on=t}),s===0&&i()})}var l3=0;function Ui(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function gA(){return++l3}var Ei=bd.prototype;Ui.prototype={constructor:Ui,select:Hz,selectAll:Wz,selectChild:Ei.selectChild,selectChildren:Ei.selectChildren,filter:$z,merge:Lz,selection:Kz,transition:o3,call:Ei.call,nodes:Ei.nodes,node:Ei.node,size:Ei.size,empty:Ei.empty,each:Ei.each,on:Fz,attr:wz,attrTween:Nz,style:Jz,styleTween:Zz,text:n3,textTween:i3,remove:Bz,tween:fz,delay:_z,duration:Pz,ease:Tz,easeVarying:Mz,end:a3,[Symbol.iterator]:Ei[Symbol.iterator]};function c3(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var u3={time:null,delay:0,duration:250,ease:c3};function d3(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 f3(e){var t,n;e instanceof Ui?(t=e._id,e=e._name):(t=gA(),(n=u3).time=kb(),e=e==null?null:e+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var a=r[i],l=a.length,c,u=0;u<l;++u)(c=a[u])&&tm(c,e,t,u,a,n||d3(c,t));return new Ui(r,this._parents,e,t)}bd.prototype.interrupt=cz;bd.prototype.transition=f3;const Rf=e=>()=>e;function p3(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 Li(e,t,n){this.k=e,this.x=t,this.y=n}Li.prototype={constructor:Li,scale:function(e){return e===1?this:new Li(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Li(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 nm=new Li(1,0,0);yA.prototype=Li.prototype;function yA(e){for(;!e.__zoom;)if(!(e=e.parentNode))return nm;return e.__zoom}function Lg(e){e.stopImmediatePropagation()}function Vc(e){e.preventDefault(),e.stopImmediatePropagation()}function h3(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function m3(){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 WS(){return this.__zoom||nm}function g3(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function y3(){return navigator.maxTouchPoints||"ontouchstart"in this}function x3(e,t,n){var r=e.invertX(t[0][0])-n[0][0],s=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function xA(){var e=h3,t=m3,n=x3,r=g3,s=y3,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=xp,u=Qh("start","zoom","end"),p,d,f,h=500,g=150,k=0,w=10;function y(R){R.property("__zoom",WS).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",O).on("dblclick.zoom",B).filter(s).on("touchstart.zoom",W).on("touchmove.zoom",z).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(R,K,D,$){var I=R.selection?R.selection():R;I.property("__zoom",WS),R!==I?N(R,K,D,$):I.interrupt().each(function(){j(this,arguments).event($).start().zoom(null,typeof K=="function"?K.apply(this,arguments):K).end()})},y.scaleBy=function(R,K,D,$){y.scaleTo(R,function(){var I=this.__zoom.k,F=typeof K=="function"?K.apply(this,arguments):K;return I*F},D,$)},y.scaleTo=function(R,K,D,$){y.transform(R,function(){var I=t.apply(this,arguments),F=this.__zoom,_=D==null?C(I):typeof D=="function"?D.apply(this,arguments):D,X=F.invert(_),V=typeof K=="function"?K.apply(this,arguments):K;return n(x(v(F,V),_,X),I,a)},D,$)},y.translateBy=function(R,K,D,$){y.transform(R,function(){return n(this.__zoom.translate(typeof K=="function"?K.apply(this,arguments):K,typeof D=="function"?D.apply(this,arguments):D),t.apply(this,arguments),a)},null,$)},y.translateTo=function(R,K,D,$,I){y.transform(R,function(){var F=t.apply(this,arguments),_=this.__zoom,X=$==null?C(F):typeof $=="function"?$.apply(this,arguments):$;return n(nm.translate(X[0],X[1]).scale(_.k).translate(typeof K=="function"?-K.apply(this,arguments):-K,typeof D=="function"?-D.apply(this,arguments):-D),F,a)},$,I)};function v(R,K){return K=Math.max(i[0],Math.min(i[1],K)),K===R.k?R:new Li(K,R.x,R.y)}function x(R,K,D){var $=K[0]-D[0]*R.k,I=K[1]-D[1]*R.k;return $===R.x&&I===R.y?R:new Li(R.k,$,I)}function C(R){return[(+R[0][0]+ +R[1][0])/2,(+R[0][1]+ +R[1][1])/2]}function N(R,K,D,$){R.on("start.zoom",function(){j(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){j(this,arguments).event($).end()}).tween("zoom",function(){var I=this,F=arguments,_=j(I,F).event($),X=t.apply(I,F),V=D==null?C(X):typeof D=="function"?D.apply(I,F):D,T=Math.max(X[1][0]-X[0][0],X[1][1]-X[0][1]),ee=I.__zoom,ie=typeof K=="function"?K.apply(I,F):K,G=c(ee.invert(V).concat(T/ee.k),ie.invert(V).concat(T/ie.k));return function(se){if(se===1)se=ie;else{var te=G(se),re=T/te[2];se=new Li(re,V[0]-te[0]*re,V[1]-te[1]*re)}_.zoom(null,se)}})}function j(R,K,D){return!D&&R.__zooming||new E(R,K)}function E(R,K){this.that=R,this.args=K,this.active=0,this.sourceEvent=null,this.extent=t.apply(R,K),this.taps=0}E.prototype={event:function(R){return R&&(this.sourceEvent=R),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(R,K){return this.mouse&&R!=="mouse"&&(this.mouse[1]=K.invert(this.mouse[0])),this.touch0&&R!=="touch"&&(this.touch0[1]=K.invert(this.touch0[0])),this.touch1&&R!=="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(R){var K=Zr(this.that).datum();u.call(R,this.that,new p3(R,{sourceEvent:this.sourceEvent,target:y,transform:this.that.__zoom,dispatch:u}),K)}};function P(R,...K){if(!e.apply(this,arguments))return;var D=j(this,K).event(R),$=this.__zoom,I=Math.max(i[0],Math.min(i[1],$.k*Math.pow(2,r.apply(this,arguments)))),F=$s(R);if(D.wheel)(D.mouse[0][0]!==F[0]||D.mouse[0][1]!==F[1])&&(D.mouse[1]=$.invert(D.mouse[0]=F)),clearTimeout(D.wheel);else{if($.k===I)return;D.mouse=[F,$.invert(F)],kp(this),D.start()}Vc(R),D.wheel=setTimeout(_,g),D.zoom("mouse",n(x(v($,I),D.mouse[0],D.mouse[1]),D.extent,a));function _(){D.wheel=null,D.end()}}function O(R,...K){if(f||!e.apply(this,arguments))return;var D=R.currentTarget,$=j(this,K,!0).event(R),I=Zr(R.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",T,!0),F=$s(R,D),_=R.clientX,X=R.clientY;tA(R.view),Lg(R),$.mouse=[F,this.__zoom.invert(F)],kp(this),$.start();function V(ee){if(Vc(ee),!$.moved){var ie=ee.clientX-_,G=ee.clientY-X;$.moved=ie*ie+G*G>k}$.event(ee).zoom("mouse",n(x($.that.__zoom,$.mouse[0]=$s(ee,D),$.mouse[1]),$.extent,a))}function T(ee){I.on("mousemove.zoom mouseup.zoom",null),nA(ee.view,$.moved),Vc(ee),$.event(ee).end()}}function B(R,...K){if(e.apply(this,arguments)){var D=this.__zoom,$=$s(R.changedTouches?R.changedTouches[0]:R,this),I=D.invert($),F=D.k*(R.shiftKey?.5:2),_=n(x(v(D,F),$,I),t.apply(this,K),a);Vc(R),l>0?Zr(this).transition().duration(l).call(N,_,$,R):Zr(this).call(y.transform,_,$,R)}}function W(R,...K){if(e.apply(this,arguments)){var D=R.touches,$=D.length,I=j(this,K,R.changedTouches.length===$).event(R),F,_,X,V;for(Lg(R),_=0;_<$;++_)X=D[_],V=$s(X,this),V=[V,this.__zoom.invert(V),X.identifier],I.touch0?!I.touch1&&I.touch0[2]!==V[2]&&(I.touch1=V,I.taps=0):(I.touch0=V,F=!0,I.taps=1+!!p);p&&(p=clearTimeout(p)),F&&(I.taps<2&&(d=V[0],p=setTimeout(function(){p=null},h)),kp(this),I.start())}}function z(R,...K){if(this.__zooming){var D=j(this,K).event(R),$=R.changedTouches,I=$.length,F,_,X,V;for(Vc(R),F=0;F<I;++F)_=$[F],X=$s(_,this),D.touch0&&D.touch0[2]===_.identifier?D.touch0[0]=X:D.touch1&&D.touch1[2]===_.identifier&&(D.touch1[0]=X);if(_=D.that.__zoom,D.touch1){var T=D.touch0[0],ee=D.touch0[1],ie=D.touch1[0],G=D.touch1[1],se=(se=ie[0]-T[0])*se+(se=ie[1]-T[1])*se,te=(te=G[0]-ee[0])*te+(te=G[1]-ee[1])*te;_=v(_,Math.sqrt(se/te)),X=[(T[0]+ie[0])/2,(T[1]+ie[1])/2],V=[(ee[0]+G[0])/2,(ee[1]+G[1])/2]}else if(D.touch0)X=D.touch0[0],V=D.touch0[1];else return;D.zoom("touch",n(x(_,X,V),D.extent,a))}}function L(R,...K){if(this.__zooming){var D=j(this,K).event(R),$=R.changedTouches,I=$.length,F,_;for(Lg(R),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),F=0;F<I;++F)_=$[F],D.touch0&&D.touch0[2]===_.identifier?delete D.touch0:D.touch1&&D.touch1[2]===_.identifier&&delete D.touch1;if(D.touch1&&!D.touch0&&(D.touch0=D.touch1,delete D.touch1),D.touch0)D.touch0[1]=this.__zoom.invert(D.touch0[0]);else if(D.end(),D.taps===2&&(_=$s(_,this),Math.hypot(d[0]-_[0],d[1]-_[1])<w)){var X=Zr(this).on("dblclick.zoom");X&&X.apply(this,arguments)}}}return y.wheelDelta=function(R){return arguments.length?(r=typeof R=="function"?R:Rf(+R),y):r},y.filter=function(R){return arguments.length?(e=typeof R=="function"?R:Rf(!!R),y):e},y.touchable=function(R){return arguments.length?(s=typeof R=="function"?R:Rf(!!R),y):s},y.extent=function(R){return arguments.length?(t=typeof R=="function"?R:Rf([[+R[0][0],+R[0][1]],[+R[1][0],+R[1][1]]]),y):t},y.scaleExtent=function(R){return arguments.length?(i[0]=+R[0],i[1]=+R[1],y):[i[0],i[1]]},y.translateExtent=function(R){return arguments.length?(a[0][0]=+R[0][0],a[1][0]=+R[1][0],a[0][1]=+R[0][1],a[1][1]=+R[1][1],y):[[a[0][0],a[0][1]],[a[1][0],a[1][1]]]},y.constrain=function(R){return arguments.length?(n=R,y):n},y.duration=function(R){return arguments.length?(l=+R,y):l},y.interpolate=function(R){return arguments.length?(c=R,y):c},y.on=function(){var R=u.on.apply(u,arguments);return R===u?y:R},y.clickDistance=function(R){return arguments.length?(k=(R=+R)*R,y):Math.sqrt(k)},y.tapDistance=function(R){return arguments.length?(w=+R,y):w},y}const gi={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."},Ju=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],wA=["Enter"," ","Escape"],bA={"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 Ql;(function(e){e.Strict="strict",e.Loose="loose"})(Ql||(Ql={}));var wa;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(wa||(wa={}));var Xu;(function(e){e.Partial="partial",e.Full="full"})(Xu||(Xu={}));const kA={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var xo;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(xo||(xo={}));var oi;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(oi||(oi={}));var $e;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})($e||($e={}));const VS={[$e.Left]:$e.Right,[$e.Right]:$e.Left,[$e.Top]:$e.Bottom,[$e.Bottom]:$e.Top};function vA(e){return e===null?null:e?"valid":"invalid"}const SA=e=>"id"in e&&"source"in e&&"target"in e,w3=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Nb=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),vd=(e,t=[0,0])=>{const{width:n,height:r}=Ji(e),s=e.origin??t,i=n*s[0],a=r*s[1];return{x:e.position.x-i,y:e.position.y-a}},b3=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,s)=>{const i=typeof s=="string";let a=!t.nodeLookup&&!i?s:void 0;t.nodeLookup&&(a=i?t.nodeLookup.get(s):Nb(s)?s:t.nodeLookup.get(s.id));const l=a?ah(a,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return rm(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return sm(n)},Sd=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(s=>{(t.filter===void 0||t.filter(s))&&(n=rm(n,ah(s)),r=!0)}),r?sm(n):{x:0,y:0,width:0,height:0}},jb=(e,t,[n,r,s]=[0,0,1],i=!1,a=!1)=>{const l={...jd(t,[n,r,s]),width:t.width/s,height:t.height/s},c=[];for(const u of e.values()){const{measured:p,selectable:d=!0,hidden:f=!1}=u;if(a&&!d||f)continue;const h=p.width??u.width??u.initialWidth??null,g=p.height??u.height??u.initialHeight??null,k=Qu(l,ec(u)),w=(h??0)*(g??0),y=i&&k>0;(!u.internals.handleBounds||y||k>=w||u.dragging)&&c.push(u)}return c},k3=(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 v3(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 S3({nodes:e,width:t,height:n,panZoom:r,minZoom:s,maxZoom:i},a){if(e.size===0)return Promise.resolve(!0);const l=v3(e,a),c=Sd(l),u=Cb(c,t,n,(a==null?void 0:a.minZoom)??s,(a==null?void 0:a.maxZoom)??i,(a==null?void 0:a.padding)??.1);return await r.setViewport(u,{duration:a==null?void 0:a.duration,ease:a==null?void 0:a.ease,interpolate:a==null?void 0:a.interpolate}),Promise.resolve(!0)}function NA({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const a=n.get(e),l=a.parentId?n.get(a.parentId):void 0,{x:c,y:u}=l?l.internals.positionAbsolute:{x:0,y:0},p=a.origin??r;let d=a.extent||s;if(a.extent==="parent"&&!a.expandParent)if(!l)i==null||i("005",gi.error005());else{const h=l.measured.width,g=l.measured.height;h&&g&&(d=[[c,u],[c+h,u+g]])}else l&&tc(a.extent)&&(d=[[a.extent[0][0]+c,a.extent[0][1]+u],[a.extent[1][0]+c,a.extent[1][1]+u]]);const f=tc(d)?Aa(t,d,a.measured):t;return(a.measured.width===void 0||a.measured.height===void 0)&&(i==null||i("015",gi.error015())),{position:{x:f.x-c+(a.measured.width??0)*p[0],y:f.y-u+(a.measured.height??0)*p[1]},positionAbsolute:f}}async function N3({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(e.map(f=>f.id)),a=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),g=!h&&f.parentId&&a.find(k=>k.id===f.parentId);(h||g)&&a.push(f)}const l=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),p=k3(a,c);for(const f of c)l.has(f.id)&&!p.find(g=>g.id===f.id)&&p.push(f);if(!s)return{edges:p,nodes:a};const d=await s({nodes:a,edges:p});return typeof d=="boolean"?d?{edges:p,nodes:a}:{edges:[],nodes:[]}:d}const Zl=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Aa=(e={x:0,y:0},t,n)=>({x:Zl(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Zl(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function jA(e,t,n){const{width:r,height:s}=Ji(n),{x:i,y:a}=n.internals.positionAbsolute;return Aa(e,[[i,a],[i+r,a+s]],t)}const KS=(e,t,n)=>e<t?Zl(Math.abs(e-t),1,t)/t:e>n?-Zl(Math.abs(e-n),1,t)/t:0,CA=(e,t,n=15,r=40)=>{const s=KS(e.x,r,t.width-r)*n,i=KS(e.y,r,t.height-r)*n;return[s,i]},rm=(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)}),Rx=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),sm=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),ec=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Nb(e)?e.internals.positionAbsolute:vd(e,t);return{x:n,y:r,width:((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},ah=(e,t=[0,0])=>{var s,i;const{x:n,y:r}=Nb(e)?e.internals.positionAbsolute:vd(e,t);return{x:n,y:r,x2:n+(((s=e.measured)==null?void 0:s.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},_A=(e,t)=>sm(rm(Rx(e),Rx(t))),Qu=(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)},qS=e=>Fs(e.width)&&Fs(e.height)&&Fs(e.x)&&Fs(e.y),Fs=e=>!isNaN(e)&&isFinite(e),j3=(e,t)=>{},Nd=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),jd=({x:e,y:t},[n,r,s],i=!1,a=[1,1])=>{const l={x:(e-n)/s,y:(t-r)/s};return i?Nd(l,a):l},lh=({x:e,y:t},[n,r,s])=>({x:e*s+n,y:t*s+r});function il(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 C3(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=il(e,n),s=il(e,t);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof e=="object"){const r=il(e.top??e.y??0,n),s=il(e.bottom??e.y??0,n),i=il(e.left??e.x??0,t),a=il(e.right??e.x??0,t);return{top:r,right:a,bottom:s,left:i,x:i+a,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function _3(e,t,n,r,s,i){const{x:a,y:l}=lh(e,[t,n,r]),{x:c,y:u}=lh({x:e.x+e.width,y:e.y+e.height},[t,n,r]),p=s-c,d=i-u;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(p),bottom:Math.floor(d)}}const Cb=(e,t,n,r,s,i)=>{const a=C3(i,t,n),l=(t-a.x)/e.width,c=(n-a.y)/e.height,u=Math.min(l,c),p=Zl(u,r,s),d=e.x+e.width/2,f=e.y+e.height/2,h=t/2-d*p,g=n/2-f*p,k=_3(e,h,g,p,t,n),w={left:Math.min(k.left-a.left,0),top:Math.min(k.top-a.top,0),right:Math.min(k.right-a.right,0),bottom:Math.min(k.bottom-a.bottom,0)};return{x:h-w.left+w.right,y:g-w.top+w.bottom,zoom:p}},Zu=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function tc(e){return e!=null&&e!=="parent"}function Ji(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 EA(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 AA(e,t={width:0,height:0},n,r,s){const i={...e},a=r.get(n);if(a){const l=a.origin||s;i.x+=a.internals.positionAbsolute.x-(t.width??0)*l[0],i.y+=a.internals.positionAbsolute.y-(t.height??0)*l[1]}return i}function US(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function E3(){let e,t;return{promise:new Promise((r,s)=>{e=r,t=s}),resolve:e,reject:t}}function A3(e){return{...bA,...e||{}}}function bu(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:a}=zs(e),l=jd({x:i-((s==null?void 0:s.left)??0),y:a-((s==null?void 0:s.top)??0)},r),{x:c,y:u}=n?Nd(l,t):l;return{xSnapped:c,ySnapped:u,...l}}const _b=e=>({width:e.offsetWidth,height:e.offsetHeight}),PA=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},P3=["INPUT","SELECT","TEXTAREA"];function IA(e){var r,s;const t=((s=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:s[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:P3.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const TA=e=>"clientX"in e,zs=(e,t)=>{var i,a;const n=TA(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,s=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:s-((t==null?void 0:t.top)??0)}},YS=(e,t,n,r,s)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(a=>{const l=a.getBoundingClientRect();return{id:a.getAttribute("data-handleid"),type:e,nodeId:s,position:a.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,..._b(a)}})};function RA({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:a,targetControlY:l}){const c=e*.125+s*.375+a*.375+n*.125,u=t*.125+i*.375+l*.375+r*.125,p=Math.abs(c-e),d=Math.abs(u-t);return[c,u,p,d]}function Mf(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function GS({pos:e,x1:t,y1:n,x2:r,y2:s,c:i}){switch(e){case $e.Left:return[t-Mf(t-r,i),n];case $e.Right:return[t+Mf(r-t,i),n];case $e.Top:return[t,n-Mf(n-s,i)];case $e.Bottom:return[t,n+Mf(s-n,i)]}}function MA({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:r,targetY:s,targetPosition:i=$e.Top,curvature:a=.25}){const[l,c]=GS({pos:n,x1:e,y1:t,x2:r,y2:s,c:a}),[u,p]=GS({pos:i,x1:r,y1:s,x2:e,y2:t,c:a}),[d,f,h,g]=RA({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:u,targetControlY:p});return[`M${e},${t} C${l},${c} ${u},${p} ${r},${s}`,d,f,h,g]}function $A({sourceX:e,sourceY:t,targetX:n,targetY:r}){const s=Math.abs(n-e)/2,i=n<e?n+s:n-s,a=Math.abs(r-t)/2,l=r<t?r+a:r-a;return[i,l,s,a]}function I3({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:s=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const a=s&&n?r+1e3:r,l=Math.max(e.parentId||s&&e.selected?e.internals.z:0,t.parentId||s&&t.selected?t.internals.z:0);return a+l}function T3({sourceNode:e,targetNode:t,width:n,height:r,transform:s}){const i=rm(ah(e),ah(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const a={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:r/s[2]};return Qu(a,sm(i))>0}const R3=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,M3=(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)),vp=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||R3;let s;return SA(e)?s={...e}:s={...e,id:r(e)},M3(s,t)?t:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,t.concat(s))};function LA({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[s,i,a,l]=$A({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,s,i,a,l]}const JS={[$e.Left]:{x:-1,y:0},[$e.Right]:{x:1,y:0},[$e.Top]:{x:0,y:-1},[$e.Bottom]:{x:0,y:1}},$3=({source:e,sourcePosition:t=$e.Bottom,target:n})=>t===$e.Left||t===$e.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},XS=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function L3({source:e,sourcePosition:t=$e.Bottom,target:n,targetPosition:r=$e.Top,center:s,offset:i,stepPosition:a}){const l=JS[t],c=JS[r],u={x:e.x+l.x*i,y:e.y+l.y*i},p={x:n.x+c.x*i,y:n.y+c.y*i},d=$3({source:u,sourcePosition:t,target:p}),f=d.x!==0?"x":"y",h=d[f];let g=[],k,w;const y={x:0,y:0},v={x:0,y:0},[,,x,C]=$A({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[f]*c[f]===-1){f==="x"?(k=s.x??u.x+(p.x-u.x)*a,w=s.y??(u.y+p.y)/2):(k=s.x??(u.x+p.x)/2,w=s.y??u.y+(p.y-u.y)*a);const P=[{x:k,y:u.y},{x:k,y:p.y}],O=[{x:u.x,y:w},{x:p.x,y:w}];l[f]===h?g=f==="x"?P:O:g=f==="x"?O:P}else{const P=[{x:u.x,y:p.y}],O=[{x:p.x,y:u.y}];if(f==="x"?g=l.x===h?O:P:g=l.y===h?P:O,t===r){const R=Math.abs(e[f]-n[f]);if(R<=i){const K=Math.min(i-1,i-R);l[f]===h?y[f]=(u[f]>e[f]?-1:1)*K:v[f]=(p[f]>n[f]?-1:1)*K}}if(t!==r){const R=f==="x"?"y":"x",K=l[f]===c[R],D=u[R]>p[R],$=u[R]<p[R];(l[f]===1&&(!K&&D||K&&$)||l[f]!==1&&(!K&&$||K&&D))&&(g=f==="x"?P:O)}const B={x:u.x+y.x,y:u.y+y.y},W={x:p.x+v.x,y:p.y+v.y},z=Math.max(Math.abs(B.x-g[0].x),Math.abs(W.x-g[0].x)),L=Math.max(Math.abs(B.y-g[0].y),Math.abs(W.y-g[0].y));z>=L?(k=(B.x+W.x)/2,w=g[0].y):(k=g[0].x,w=(B.y+W.y)/2)}const N={x:u.x+y.x,y:u.y+y.y},j={x:p.x+v.x,y:p.y+v.y};return[[e,...N.x!==g[0].x||N.y!==g[0].y?[N]:[],...g,...j.x!==g[g.length-1].x||j.y!==g[g.length-1].y?[j]:[],n],k,w,x,C]}function O3(e,t,n,r){const s=Math.min(XS(e,t)/2,XS(t,n)/2,r),{x:i,y:a}=t;if(e.x===i&&i===n.x||e.y===a&&a===n.y)return`L${i} ${a}`;if(e.y===a){const u=e.x<n.x?-1:1,p=e.y<n.y?1:-1;return`L ${i+s*u},${a}Q ${i},${a} ${i},${a+s*p}`}const l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${a+s*c}Q ${i},${a} ${i+s*l},${a}`}function Mx({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:r,targetY:s,targetPosition:i=$e.Top,borderRadius:a=5,centerX:l,centerY:c,offset:u=20,stepPosition:p=.5}){const[d,f,h,g,k]=L3({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:l,y:c},offset:u,stepPosition:p});let w=`M${d[0].x} ${d[0].y}`;for(let y=1;y<d.length-1;y++)w+=O3(d[y-1],d[y],d[y+1],a);return w+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[w,f,h,g,k]}function QS(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function D3(e){var d;const{sourceNode:t,targetNode:n}=e;if(!QS(t)||!QS(n))return null;const r=t.internals.handleBounds||ZS(t.handles),s=n.internals.handleBounds||ZS(n.handles),i=eN((r==null?void 0:r.source)??[],e.sourceHandle),a=eN(e.connectionMode===Ql.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),e.targetHandle);if(!i||!a)return(d=e.onError)==null||d.call(e,"008",gi.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(i==null?void 0:i.position)||$e.Bottom,c=(a==null?void 0:a.position)||$e.Top,u=Pa(t,i,l),p=Pa(n,a,c);return{sourceX:u.x,sourceY:u.y,targetX:p.x,targetY:p.y,sourcePosition:l,targetPosition:c}}function ZS(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 Pa(e,t,n=$e.Left,r=!1){const s=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:a,height:l}=t??Ji(e);if(r)return{x:s+a/2,y:i+l/2};switch((t==null?void 0:t.position)??n){case $e.Top:return{x:s+a/2,y:i};case $e.Right:return{x:s+a,y:i+l/2};case $e.Bottom:return{x:s+a/2,y:i+l};case $e.Left:return{x:s,y:i+l/2}}}function eN(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function $x(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function F3(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return e.reduce((a,l)=>([l.markerStart||r,l.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const u=$x(c,t);i.has(u)||(a.push({id:u,color:c.color||n,...c}),i.add(u))}}),a),[]).sort((a,l)=>a.id.localeCompare(l.id))}const OA=1e3,z3=10,Eb={nodeOrigin:[0,0],nodeExtent:Ju,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},B3={...Eb,checkEquality:!0};function Ab(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function H3(e,t,n){const r=Ab(Eb,n);for(const s of e.values())if(s.parentId)Ib(s,e,t,r);else{const i=vd(s,r.nodeOrigin),a=tc(s.extent)?s.extent:r.nodeExtent,l=Aa(i,a,Ji(s));s.internals.positionAbsolute=l}}function W3(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const s of e.handles){const i={id:s.id,width:s.width??1,height:s.height??1,nodeId:e.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(i):s.type==="target"&&r.push(i)}return{source:n,target:r}}function Pb(e){return e==="manual"}function Lx(e,t,n,r={}){var p,d;const s=Ab(B3,r),i={i:0},a=new Map(t),l=s!=null&&s.elevateNodesOnSelect&&!Pb(s.zIndexMode)?OA:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const f of e){let h=a.get(f.id);if(s.checkEquality&&f===(h==null?void 0:h.internals.userNode))t.set(f.id,h);else{const g=vd(f,s.nodeOrigin),k=tc(f.extent)?f.extent:s.nodeExtent,w=Aa(g,k,Ji(f));h={...s.defaults,...f,measured:{width:(p=f.measured)==null?void 0:p.width,height:(d=f.measured)==null?void 0:d.height},internals:{positionAbsolute:w,handleBounds:W3(f,h),z:DA(f,l,s.zIndexMode),userNode:f}},t.set(f.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),f.parentId&&Ib(h,t,n,r,i),u||(u=f.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function V3(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 Ib(e,t,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:a,nodeExtent:l,zIndexMode:c}=Ab(Eb,r),u=e.parentId,p=t.get(u);if(!p){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}V3(e,n),s&&!p.parentId&&p.internals.rootParentIndex===void 0&&c==="auto"&&(p.internals.rootParentIndex=++s.i,p.internals.z=p.internals.z+s.i*z3),s&&p.internals.rootParentIndex!==void 0&&(s.i=p.internals.rootParentIndex);const d=i&&!Pb(c)?OA:0,{x:f,y:h,z:g}=K3(e,p,a,l,d,c),{positionAbsolute:k}=e.internals,w=f!==k.x||h!==k.y;(w||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:f,y:h}:k,z:g}})}function DA(e,t,n){const r=Fs(e.zIndex)?e.zIndex:0;return Pb(n)?r:r+(e.selected?t:0)}function K3(e,t,n,r,s,i){const{x:a,y:l}=t.internals.positionAbsolute,c=Ji(e),u=vd(e,n),p=tc(e.extent)?Aa(u,e.extent,c):u;let d=Aa({x:a+p.x,y:l+p.y},r,c);e.extent==="parent"&&(d=jA(d,c,t));const f=DA(e,s,i),h=t.internals.z??0;return{x:d.x,y:d.y,z:h>=f?h+1:f}}function Tb(e,t,n,r=[0,0]){var a;const s=[],i=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const u=((a=i.get(l.parentId))==null?void 0:a.expandedRect)??ec(c),p=_A(u,l.rect);i.set(l.parentId,{expandedRect:p,parent:c})}return i.size>0&&i.forEach(({expandedRect:l,parent:c},u)=>{var x;const p=c.internals.positionAbsolute,d=Ji(c),f=c.origin??r,h=l.x<p.x?Math.round(Math.abs(p.x-l.x)):0,g=l.y<p.y?Math.round(Math.abs(p.y-l.y)):0,k=Math.max(d.width,Math.round(l.width)),w=Math.max(d.height,Math.round(l.height)),y=(k-d.width)*f[0],v=(w-d.height)*f[1];(h>0||g>0||y||v)&&(s.push({id:u,type:"position",position:{x:c.position.x-h+y,y:c.position.y-g+v}}),(x=n.get(u))==null||x.forEach(C=>{e.some(N=>N.id===C.id)||s.push({id:C.id,type:"position",position:{x:C.position.x+h,y:C.position.y+g}})})),(d.width<l.width||d.height<l.height||h||g)&&s.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:k+(h?f[0]*h-y:0),height:w+(g?f[1]*g-v:0)}})}),s}function q3(e,t,n,r,s,i,a){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const u=[],p=window.getComputedStyle(l),{m22:d}=new window.DOMMatrixReadOnly(p.transform),f=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const k=_b(h.nodeElement),w=g.measured.width!==k.width||g.measured.height!==k.height;if(!!(k.width&&k.height&&(w||!g.internals.handleBounds||h.force))){const v=h.nodeElement.getBoundingClientRect(),x=tc(g.extent)?g.extent:i;let{positionAbsolute:C}=g.internals;g.parentId&&g.extent==="parent"?C=jA(C,k,t.get(g.parentId)):x&&(C=Aa(C,x,k));const N={...g,measured:k,internals:{...g.internals,positionAbsolute:C,handleBounds:{source:YS("source",h.nodeElement,v,d,g.id),target:YS("target",h.nodeElement,v,d,g.id)}}};t.set(g.id,N),g.parentId&&Ib(N,t,n,{nodeOrigin:s,zIndexMode:a}),c=!0,w&&(u.push({id:g.id,type:"dimensions",dimensions:k}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:ec(N,s)}))}}if(f.length>0){const h=Tb(f,t,n,s);u.push(...h)}return{changes:u,updatedInternals:c}}async function U3({delta:e,panZoom:t,transform:n,translateExtent:r,width:s,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[s,i]],r),l=!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2]);return Promise.resolve(l)}function tN(e,t,n,r,s,i){let a=s;const l=r.get(a)||new Map;r.set(a,l.set(n,t)),a=`${s}-${e}`;const c=r.get(a)||new Map;if(r.set(a,c.set(n,t)),i){a=`${s}-${e}-${i}`;const u=r.get(a)||new Map;r.set(a,u.set(n,t))}}function FA(e,t,n){e.clear(),t.clear();for(const r of n){const{source:s,target:i,sourceHandle:a=null,targetHandle:l=null}=r,c={edgeId:r.id,source:s,target:i,sourceHandle:a,targetHandle:l},u=`${s}-${a}--${i}-${l}`,p=`${i}-${l}--${s}-${a}`;tN("source",c,p,e,s,a),tN("target",c,u,e,i,l),t.set(r.id,r)}}function zA(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:zA(n,t):!1}function nN(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 Y3(e,t,n,r){const s=new Map;for(const[i,a]of e)if((a.selected||a.id===r)&&(!a.parentId||!zA(a,e))&&(a.draggable||t&&typeof a.draggable>"u")){const l=e.get(i);l&&s.set(i,{id:i,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return s}function Og({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var a,l,c;const s=[];for(const[u,p]of t){const d=(a=n.get(u))==null?void 0:a.internals.userNode;d&&s.push({...d,position:p.position,dragging:r})}if(!e)return[s[0],s];const i=(l=n.get(e))==null?void 0:l.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:s[0],s]}function G3({dragItems:e,snapGrid:t,x:n,y:r}){const s=e.values().next().value;if(!s)return null;const i={x:n-s.distance.x,y:r-s.distance.y},a=Nd(i,t);return{x:a.x-i.x,y:a.y-i.y}}function J3({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},a=0,l=new Map,c=!1,u={x:0,y:0},p=null,d=!1,f=null,h=!1,g=!1,k=null;function w({noDragClassName:v,handleSelector:x,domNode:C,isSelectable:N,nodeId:j,nodeClickDistance:E=0}){f=Zr(C);function P({x:z,y:L}){const{nodeLookup:R,nodeExtent:K,snapGrid:D,snapToGrid:$,nodeOrigin:I,onNodeDrag:F,onSelectionDrag:_,onError:X,updateNodePositions:V}=t();i={x:z,y:L};let T=!1;const ee=l.size>1,ie=ee&&K?Rx(Sd(l)):null,G=ee&&$?G3({dragItems:l,snapGrid:D,x:z,y:L}):null;for(const[se,te]of l){if(!R.has(se))continue;let re={x:z-te.distance.x,y:L-te.distance.y};$&&(re=G?{x:Math.round(re.x+G.x),y:Math.round(re.y+G.y)}:Nd(re,D));let ne=null;if(ee&&K&&!te.extent&&ie){const{positionAbsolute:me}=te.internals,He=me.x-ie.x+K[0][0],Je=me.x+te.measured.width-ie.x2+K[1][0],Te=me.y-ie.y+K[0][1],ot=me.y+te.measured.height-ie.y2+K[1][1];ne=[[He,Te],[Je,ot]]}const{position:ce,positionAbsolute:de}=NA({nodeId:se,nextPosition:re,nodeLookup:R,nodeExtent:ne||K,nodeOrigin:I,onError:X});T=T||te.position.x!==ce.x||te.position.y!==ce.y,te.position=ce,te.internals.positionAbsolute=de}if(g=g||T,!!T&&(V(l,!0),k&&(r||F||!j&&_))){const[se,te]=Og({nodeId:j,dragItems:l,nodeLookup:R});r==null||r(k,l,se,te),F==null||F(k,se,te),j||_==null||_(k,te)}}async function O(){if(!p)return;const{transform:z,panBy:L,autoPanSpeed:R,autoPanOnNodeDrag:K}=t();if(!K){c=!1,cancelAnimationFrame(a);return}const[D,$]=CA(u,p,R);(D!==0||$!==0)&&(i.x=(i.x??0)-D/z[2],i.y=(i.y??0)-$/z[2],await L({x:D,y:$})&&P(i)),a=requestAnimationFrame(O)}function B(z){var ee;const{nodeLookup:L,multiSelectionActive:R,nodesDraggable:K,transform:D,snapGrid:$,snapToGrid:I,selectNodesOnDrag:F,onNodeDragStart:_,onSelectionDragStart:X,unselectNodesAndEdges:V}=t();d=!0,(!F||!N)&&!R&&j&&((ee=L.get(j))!=null&&ee.selected||V()),N&&F&&j&&(e==null||e(j));const T=bu(z.sourceEvent,{transform:D,snapGrid:$,snapToGrid:I,containerBounds:p});if(i=T,l=Y3(L,K,T,j),l.size>0&&(n||_||!j&&X)){const[ie,G]=Og({nodeId:j,dragItems:l,nodeLookup:L});n==null||n(z.sourceEvent,l,ie,G),_==null||_(z.sourceEvent,ie,G),j||X==null||X(z.sourceEvent,G)}}const W=rA().clickDistance(E).on("start",z=>{const{domNode:L,nodeDragThreshold:R,transform:K,snapGrid:D,snapToGrid:$}=t();p=(L==null?void 0:L.getBoundingClientRect())||null,h=!1,g=!1,k=z.sourceEvent,R===0&&B(z),i=bu(z.sourceEvent,{transform:K,snapGrid:D,snapToGrid:$,containerBounds:p}),u=zs(z.sourceEvent,p)}).on("drag",z=>{const{autoPanOnNodeDrag:L,transform:R,snapGrid:K,snapToGrid:D,nodeDragThreshold:$,nodeLookup:I}=t(),F=bu(z.sourceEvent,{transform:R,snapGrid:K,snapToGrid:D,containerBounds:p});if(k=z.sourceEvent,(z.sourceEvent.type==="touchmove"&&z.sourceEvent.touches.length>1||j&&!I.has(j))&&(h=!0),!h){if(!c&&L&&d&&(c=!0,O()),!d){const _=zs(z.sourceEvent,p),X=_.x-u.x,V=_.y-u.y;Math.sqrt(X*X+V*V)>$&&B(z)}(i.x!==F.xSnapped||i.y!==F.ySnapped)&&l&&d&&(u=zs(z.sourceEvent,p),P(F))}}).on("end",z=>{if(!(!d||h)&&(c=!1,d=!1,cancelAnimationFrame(a),l.size>0)){const{nodeLookup:L,updateNodePositions:R,onNodeDragStop:K,onSelectionDragStop:D}=t();if(g&&(R(l,!1),g=!1),s||K||!j&&D){const[$,I]=Og({nodeId:j,dragItems:l,nodeLookup:L,dragging:!1});s==null||s(z.sourceEvent,l,$,I),K==null||K(z.sourceEvent,$,I),j||D==null||D(z.sourceEvent,I)}}}).filter(z=>{const L=z.target;return!z.button&&(!v||!nN(L,`.${v}`,C))&&(!x||nN(L,x,C))});f.call(W)}function y(){f==null||f.on(".drag",null)}return{update:w,destroy:y}}function X3(e,t,n){const r=[],s={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())Qu(s,ec(i))>0&&r.push(i);return r}const Q3=250;function Z3(e,t,n,r){var l,c;let s=[],i=1/0;const a=X3(e,n,t+Q3);for(const u of a){const p=[...((l=u.internals.handleBounds)==null?void 0:l.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const d of p){if(r.nodeId===d.nodeId&&r.type===d.type&&r.id===d.id)continue;const{x:f,y:h}=Pa(u,d,d.position,!0),g=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));g>t||(g<i?(s=[{...d,x:f,y:h}],i=g):g===i&&s.push({...d,x:f,y:h}))}}if(!s.length)return null;if(s.length>1){const u=r.type==="source"?"target":"source";return s.find(p=>p.type===u)??s[0]}return s[0]}function BA(e,t,n,r,s,i=!1){var u,p,d;const a=r.get(e);if(!a)return null;const l=s==="strict"?(u=a.internals.handleBounds)==null?void 0:u[t]:[...((p=a.internals.handleBounds)==null?void 0:p.source)??[],...((d=a.internals.handleBounds)==null?void 0:d.target)??[]],c=(n?l==null?void 0:l.find(f=>f.id===n):l==null?void 0:l[0])??null;return c&&i?{...c,...Pa(a,c,c.position,!0)}:c}function HA(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function eB(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const WA=()=>!0;function tB(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:a,domNode:l,nodeLookup:c,lib:u,autoPanOnConnect:p,flowId:d,panBy:f,cancelConnection:h,onConnectStart:g,onConnect:k,onConnectEnd:w,isValidConnection:y=WA,onReconnectEnd:v,updateConnection:x,getTransform:C,getFromHandle:N,autoPanSpeed:j,dragThreshold:E=1,handleDomNode:P}){const O=PA(e.target);let B=0,W;const{x:z,y:L}=zs(e),R=HA(i,P),K=l==null?void 0:l.getBoundingClientRect();let D=!1;if(!K||!R)return;const $=BA(s,R,r,c,t);if(!$)return;let I=zs(e,K),F=!1,_=null,X=!1,V=null;function T(){if(!p||!K)return;const[ce,de]=CA(I,K,j);f({x:ce,y:de}),B=requestAnimationFrame(T)}const ee={...$,nodeId:s,type:R,position:$.position},ie=c.get(s);let se={inProgress:!0,isValid:null,from:Pa(ie,ee,$e.Left,!0),fromHandle:ee,fromPosition:ee.position,fromNode:ie,to:I,toHandle:null,toPosition:VS[ee.position],toNode:null,pointer:I};function te(){D=!0,x(se),g==null||g(e,{nodeId:s,handleId:r,handleType:R})}E===0&&te();function re(ce){if(!D){const{x:ot,y:gt}=zs(ce),yt=ot-z,Ae=gt-L;if(!(yt*yt+Ae*Ae>E*E))return;te()}if(!N()||!ee){ne(ce);return}const de=C();I=zs(ce,K),W=Z3(jd(I,de,!1,[1,1]),n,c,ee),F||(T(),F=!0);const me=VA(ce,{handle:W,connectionMode:t,fromNodeId:s,fromHandleId:r,fromType:a?"target":"source",isValidConnection:y,doc:O,lib:u,flowId:d,nodeLookup:c});V=me.handleDomNode,_=me.connection,X=eB(!!W,me.isValid);const He=c.get(s),Je=He?Pa(He,ee,$e.Left,!0):se.from,Te={...se,from:Je,isValid:X,to:me.toHandle&&X?lh({x:me.toHandle.x,y:me.toHandle.y},de):I,toHandle:me.toHandle,toPosition:X&&me.toHandle?me.toHandle.position:VS[ee.position],toNode:me.toHandle?c.get(me.toHandle.nodeId):null,pointer:I};x(Te),se=Te}function ne(ce){if(!("touches"in ce&&ce.touches.length>0)){if(D){(W||V)&&_&&X&&(k==null||k(_));const{inProgress:de,...me}=se,He={...me,toPosition:se.toHandle?se.toPosition:null};w==null||w(ce,He),i&&(v==null||v(ce,He))}h(),cancelAnimationFrame(B),F=!1,X=!1,_=null,V=null,O.removeEventListener("mousemove",re),O.removeEventListener("mouseup",ne),O.removeEventListener("touchmove",re),O.removeEventListener("touchend",ne)}}O.addEventListener("mousemove",re),O.addEventListener("mouseup",ne),O.addEventListener("touchmove",re),O.addEventListener("touchend",ne)}function VA(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:a,lib:l,flowId:c,isValidConnection:u=WA,nodeLookup:p}){const d=i==="target",f=t?a.querySelector(`.${l}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:g}=zs(e),k=a.elementFromPoint(h,g),w=k!=null&&k.classList.contains(`${l}-flow__handle`)?k:f,y={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const v=HA(void 0,w),x=w.getAttribute("data-nodeid"),C=w.getAttribute("data-handleid"),N=w.classList.contains("connectable"),j=w.classList.contains("connectableend");if(!x||!v)return y;const E={source:d?x:r,sourceHandle:d?C:s,target:d?r:x,targetHandle:d?s:C};y.connection=E;const O=N&&j&&(n===Ql.Strict?d&&v==="source"||!d&&v==="target":x!==r||C!==s);y.isValid=O&&u(E),y.toHandle=BA(x,v,C,p,n,!0)}return y}const Ox={onPointerDown:tB,isValid:VA};function nB({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const s=Zr(e);function i({translateExtent:l,width:c,height:u,zoomStep:p=1,pannable:d=!0,zoomable:f=!0,inversePan:h=!1}){const g=x=>{if(x.sourceEvent.type!=="wheel"||!t)return;const C=n(),N=x.sourceEvent.ctrlKey&&Zu()?10:1,j=-x.sourceEvent.deltaY*(x.sourceEvent.deltaMode===1?.05:x.sourceEvent.deltaMode?1:.002)*p,E=C[2]*Math.pow(2,j*N);t.scaleTo(E)};let k=[0,0];const w=x=>{(x.sourceEvent.type==="mousedown"||x.sourceEvent.type==="touchstart")&&(k=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY])},y=x=>{const C=n();if(x.sourceEvent.type!=="mousemove"&&x.sourceEvent.type!=="touchmove"||!t)return;const N=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY],j=[N[0]-k[0],N[1]-k[1]];k=N;const E=r()*Math.max(C[2],Math.log(C[2]))*(h?-1:1),P={x:C[0]-j[0]*E,y:C[1]-j[1]*E},O=[[0,0],[c,u]];t.setViewportConstrained({x:P.x,y:P.y,zoom:C[2]},O,l)},v=xA().on("start",w).on("zoom",d?y:null).on("zoom.wheel",f?g:null);s.call(v,{})}function a(){s.on("zoom",null)}return{update:i,destroy:a,pointer:$s}}const im=e=>({x:e.x,y:e.y,zoom:e.k}),Dg=({x:e,y:t,zoom:n})=>nm.translate(e,t).scale(n),Cl=(e,t)=>e.target.closest(`.${t}`),KA=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),rB=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Fg=(e,t=0,n=rB,r=()=>{})=>{const s=typeof t=="number"&&t>0;return s||r(),s?e.transition().duration(t).ease(n).on("end",r):e},qA=e=>{const t=e.ctrlKey&&Zu()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function sB({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:u}){return p=>{if(Cl(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(p.ctrlKey&&a){const w=$s(p),y=qA(p),v=d*Math.pow(2,y);r.scaleTo(n,v,w,p);return}const f=p.deltaMode===1?20:1;let h=s===wa.Vertical?0:p.deltaX*f,g=s===wa.Horizontal?0:p.deltaY*f;!Zu()&&p.shiftKey&&s!==wa.Vertical&&(h=p.deltaY*f,g=0),r.translateBy(n,-(h/d)*i,-(g/d)*i,{internal:!0});const k=im(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(p,k),e.panScrollTimeout=setTimeout(()=>{u==null||u(p,k),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(p,k))}}function iB({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",a=!t&&i&&!r.ctrlKey,l=Cl(r,e);if(r.ctrlKey&&i&&l&&r.preventDefault(),a||l)return null;r.preventDefault(),n.call(this,r,s)}}function oB({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,a,l;if((i=r.sourceEvent)!=null&&i.internal)return;const s=im(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 aB({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var a,l;e.usedRightMouseButton=!!(n&&KA(t,e.mouseButton??0)),(a=i.sourceEvent)!=null&&a.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!((l=i.sourceEvent)!=null&&l.internal)&&(s==null||s(i.sourceEvent,im(i.transform)))}}function lB({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return a=>{var l;if(!((l=a.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,i&&KA(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,r(!1),s)){const c=im(a.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{s==null||s(a.sourceEvent,c)},n?150:0)}}}function cB({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:u,connectionInProgress:p}){return d=>{var w;const f=e||t,h=n&&d.ctrlKey,g=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(Cl(d,`${u}-flow__node`)||Cl(d,`${u}-flow__edge`)))return!0;if(!r&&!f&&!s&&!i&&!n||a||p&&!g||Cl(d,l)&&g||Cl(d,c)&&(!g||s&&g&&!e)||!n&&d.ctrlKey&&g)return!1;if(!n&&d.type==="touchstart"&&((w=d.touches)==null?void 0:w.length)>1)return d.preventDefault(),!1;if(!f&&!s&&!h&&g||!r&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(r)&&!r.includes(d.button)&&d.type==="mousedown")return!1;const k=Array.isArray(r)&&r.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||g)&&k}}function uB({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:a,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),d=xA().scaleExtent([t,n]).translateExtent(r),f=Zr(e).call(d);v({x:s.x,y:s.y,zoom:Zl(s.zoom,t,n)},[[0,0],[p.width,p.height]],r);const h=f.on("wheel.zoom"),g=f.on("dblclick.zoom");d.wheelDelta(qA);function k(W,z){return f?new Promise(L=>{d==null||d.interpolate((z==null?void 0:z.interpolate)==="linear"?wu:xp).transform(Fg(f,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>L(!0)),W)}):Promise.resolve(!1)}function w({noWheelClassName:W,noPanClassName:z,onPaneContextMenu:L,userSelectionActive:R,panOnScroll:K,panOnDrag:D,panOnScrollMode:$,panOnScrollSpeed:I,preventScrolling:F,zoomOnPinch:_,zoomOnScroll:X,zoomOnDoubleClick:V,zoomActivationKeyPressed:T,lib:ee,onTransformChange:ie,connectionInProgress:G,paneClickDistance:se,selectionOnDrag:te}){R&&!u.isZoomingOrPanning&&y();const re=K&&!T&&!R;d.clickDistance(te?1/0:!Fs(se)||se<0?0:se);const ne=re?sB({zoomPanValues:u,noWheelClassName:W,d3Selection:f,d3Zoom:d,panOnScrollMode:$,panOnScrollSpeed:I,zoomOnPinch:_,onPanZoomStart:a,onPanZoom:i,onPanZoomEnd:l}):iB({noWheelClassName:W,preventScrolling:F,d3ZoomHandler:h});if(f.on("wheel.zoom",ne,{passive:!1}),!R){const de=oB({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:a});d.on("start",de);const me=aB({zoomPanValues:u,panOnDrag:D,onPaneContextMenu:!!L,onPanZoom:i,onTransformChange:ie});d.on("zoom",me);const He=lB({zoomPanValues:u,panOnDrag:D,panOnScroll:K,onPaneContextMenu:L,onPanZoomEnd:l,onDraggingChange:c});d.on("end",He)}const ce=cB({zoomActivationKeyPressed:T,panOnDrag:D,zoomOnScroll:X,panOnScroll:K,zoomOnDoubleClick:V,zoomOnPinch:_,userSelectionActive:R,noPanClassName:z,noWheelClassName:W,lib:ee,connectionInProgress:G});d.filter(ce),V?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function y(){d.on("zoom",null)}async function v(W,z,L){const R=Dg(W),K=d==null?void 0:d.constrain()(R,z,L);return K&&await k(K),new Promise(D=>D(K))}async function x(W,z){const L=Dg(W);return await k(L,z),new Promise(R=>R(L))}function C(W){if(f){const z=Dg(W),L=f.property("__zoom");(L.k!==W.zoom||L.x!==W.x||L.y!==W.y)&&(d==null||d.transform(f,z,null,{sync:!0}))}}function N(){const W=f?yA(f.node()):{x:0,y:0,k:1};return{x:W.x,y:W.y,zoom:W.k}}function j(W,z){return f?new Promise(L=>{d==null||d.interpolate((z==null?void 0:z.interpolate)==="linear"?wu:xp).scaleTo(Fg(f,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>L(!0)),W)}):Promise.resolve(!1)}function E(W,z){return f?new Promise(L=>{d==null||d.interpolate((z==null?void 0:z.interpolate)==="linear"?wu:xp).scaleBy(Fg(f,z==null?void 0:z.duration,z==null?void 0:z.ease,()=>L(!0)),W)}):Promise.resolve(!1)}function P(W){d==null||d.scaleExtent(W)}function O(W){d==null||d.translateExtent(W)}function B(W){const z=!Fs(W)||W<0?0:W;d==null||d.clickDistance(z)}return{update:w,destroy:y,setViewport:x,setViewportConstrained:v,getViewport:N,scaleTo:j,scaleBy:E,setScaleExtent:P,setTranslateExtent:O,syncViewport:C,setClickDistance:B}}var nc;(function(e){e.Line="line",e.Handle="handle"})(nc||(nc={}));function dB({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:s,affectsY:i}){const a=e-t,l=n-r,c=[a>0?1:a<0?-1:0,l>0?1:l<0?-1:0];return a&&s&&(c[0]=c[0]*-1),l&&i&&(c[1]=c[1]*-1),c}function rN(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 co(e,t){return Math.max(0,t-e)}function uo(e,t){return Math.max(0,e-t)}function $f(e,t,n){return Math.max(0,t-e,e-n)}function sN(e,t){return e?!t:t}function fB(e,t,n,r,s,i,a,l){let{affectsX:c,affectsY:u}=t;const{isHorizontal:p,isVertical:d}=t,f=p&&d,{xSnapped:h,ySnapped:g}=n,{minWidth:k,maxWidth:w,minHeight:y,maxHeight:v}=r,{x,y:C,width:N,height:j,aspectRatio:E}=e;let P=Math.floor(p?h-e.pointerX:0),O=Math.floor(d?g-e.pointerY:0);const B=N+(c?-P:P),W=j+(u?-O:O),z=-i[0]*N,L=-i[1]*j;let R=$f(B,k,w),K=$f(W,y,v);if(a){let I=0,F=0;c&&P<0?I=co(x+P+z,a[0][0]):!c&&P>0&&(I=uo(x+B+z,a[1][0])),u&&O<0?F=co(C+O+L,a[0][1]):!u&&O>0&&(F=uo(C+W+L,a[1][1])),R=Math.max(R,I),K=Math.max(K,F)}if(l){let I=0,F=0;c&&P>0?I=uo(x+P,l[0][0]):!c&&P<0&&(I=co(x+B,l[1][0])),u&&O>0?F=uo(C+O,l[0][1]):!u&&O<0&&(F=co(C+W,l[1][1])),R=Math.max(R,I),K=Math.max(K,F)}if(s){if(p){const I=$f(B/E,y,v)*E;if(R=Math.max(R,I),a){let F=0;!c&&!u||c&&!u&&f?F=uo(C+L+B/E,a[1][1])*E:F=co(C+L+(c?P:-P)/E,a[0][1])*E,R=Math.max(R,F)}if(l){let F=0;!c&&!u||c&&!u&&f?F=co(C+B/E,l[1][1])*E:F=uo(C+(c?P:-P)/E,l[0][1])*E,R=Math.max(R,F)}}if(d){const I=$f(W*E,k,w)/E;if(K=Math.max(K,I),a){let F=0;!c&&!u||u&&!c&&f?F=uo(x+W*E+z,a[1][0])/E:F=co(x+(u?O:-O)*E+z,a[0][0])/E,K=Math.max(K,F)}if(l){let F=0;!c&&!u||u&&!c&&f?F=co(x+W*E,l[1][0])/E:F=uo(x+(u?O:-O)*E,l[0][0])/E,K=Math.max(K,F)}}}O=O+(O<0?K:-K),P=P+(P<0?R:-R),s&&(f?B>W*E?O=(sN(c,u)?-P:P)/E:P=(sN(c,u)?-O:O)*E:p?(O=P/E,u=c):(P=O*E,c=u));const D=c?x+P:x,$=u?C+O:C;return{width:N+(c?-P:P),height:j+(u?-O:O),x:i[0]*P*(c?-1:1)+D,y:i[1]*O*(u?-1:1)+$}}const UA={width:0,height:0,x:0,y:0},pB={...UA,pointerX:0,pointerY:0,aspectRatio:1};function hB(e){return[[0,0],[e.measured.width,e.measured.height]]}function mB(e,t,n){const r=t.position.x+e.position.x,s=t.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,l=n[0]*i,c=n[1]*a;return[[r-l,s-c],[r+i-l,s+a-c]]}function gB({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:s}){const i=Zr(e);let a={controlDirection:rN("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:u,boundaries:p,keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:k,shouldResize:w}){let y={...UA},v={...pB};a={boundaries:p,resizeDirection:f,keepAspectRatio:d,controlDirection:rN(u)};let x,C=null,N=[],j,E,P,O=!1;const B=rA().on("start",W=>{const{nodeLookup:z,transform:L,snapGrid:R,snapToGrid:K,nodeOrigin:D,paneDomNode:$}=n();if(x=z.get(t),!x)return;C=($==null?void 0:$.getBoundingClientRect())??null;const{xSnapped:I,ySnapped:F}=bu(W.sourceEvent,{transform:L,snapGrid:R,snapToGrid:K,containerBounds:C});y={width:x.measured.width??0,height:x.measured.height??0,x:x.position.x??0,y:x.position.y??0},v={...y,pointerX:I,pointerY:F,aspectRatio:y.width/y.height},j=void 0,x.parentId&&(x.extent==="parent"||x.expandParent)&&(j=z.get(x.parentId),E=j&&x.extent==="parent"?hB(j):void 0),N=[],P=void 0;for(const[_,X]of z)if(X.parentId===t&&(N.push({id:_,position:{...X.position},extent:X.extent}),X.extent==="parent"||X.expandParent)){const V=mB(X,x,X.origin??D);P?P=[[Math.min(V[0][0],P[0][0]),Math.min(V[0][1],P[0][1])],[Math.max(V[1][0],P[1][0]),Math.max(V[1][1],P[1][1])]]:P=V}h==null||h(W,{...y})}).on("drag",W=>{const{transform:z,snapGrid:L,snapToGrid:R,nodeOrigin:K}=n(),D=bu(W.sourceEvent,{transform:z,snapGrid:L,snapToGrid:R,containerBounds:C}),$=[];if(!x)return;const{x:I,y:F,width:_,height:X}=y,V={},T=x.origin??K,{width:ee,height:ie,x:G,y:se}=fB(v,a.controlDirection,D,a.boundaries,a.keepAspectRatio,T,E,P),te=ee!==_,re=ie!==X,ne=G!==I&&te,ce=se!==F&&re;if(!ne&&!ce&&!te&&!re)return;if((ne||ce||T[0]===1||T[1]===1)&&(V.x=ne?G:y.x,V.y=ce?se:y.y,y.x=V.x,y.y=V.y,N.length>0)){const Je=G-I,Te=se-F;for(const ot of N)ot.position={x:ot.position.x-Je+T[0]*(ee-_),y:ot.position.y-Te+T[1]*(ie-X)},$.push(ot)}if((te||re)&&(V.width=te&&(!a.resizeDirection||a.resizeDirection==="horizontal")?ee:y.width,V.height=re&&(!a.resizeDirection||a.resizeDirection==="vertical")?ie:y.height,y.width=V.width,y.height=V.height),j&&x.expandParent){const Je=T[0]*(V.width??0);V.x&&V.x<Je&&(y.x=Je,v.x=v.x-(V.x-Je));const Te=T[1]*(V.height??0);V.y&&V.y<Te&&(y.y=Te,v.y=v.y-(V.y-Te))}const de=dB({width:y.width,prevWidth:_,height:y.height,prevHeight:X,affectsX:a.controlDirection.affectsX,affectsY:a.controlDirection.affectsY}),me={...y,direction:de};(w==null?void 0:w(W,me))!==!1&&(O=!0,g==null||g(W,me),r(V,$))}).on("end",W=>{O&&(k==null||k(W,{...y}),s==null||s({...y}),O=!1)});i.call(B)}function c(){i.on(".drag",null)}return{update:l,destroy:c}}var YA={exports:{}},GA={},JA={exports:{}},XA={};/**
|
|
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 rc=m;function yB(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var xB=typeof Object.is=="function"?Object.is:yB,wB=rc.useState,bB=rc.useEffect,kB=rc.useLayoutEffect,vB=rc.useDebugValue;function SB(e,t){var n=t(),r=wB({inst:{value:n,getSnapshot:t}}),s=r[0].inst,i=r[1];return kB(function(){s.value=n,s.getSnapshot=t,zg(s)&&i({inst:s})},[e,n,t]),bB(function(){return zg(s)&&i({inst:s}),e(function(){zg(s)&&i({inst:s})})},[e]),vB(n),n}function zg(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!xB(e,n)}catch{return!0}}function NB(e,t){return t()}var jB=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?NB:SB;XA.useSyncExternalStore=rc.useSyncExternalStore!==void 0?rc.useSyncExternalStore:jB;JA.exports=XA;var QA=JA.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 om=m,CB=QA;function _B(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var EB=typeof Object.is=="function"?Object.is:_B,AB=CB.useSyncExternalStore,PB=om.useRef,IB=om.useEffect,TB=om.useMemo,RB=om.useDebugValue;GA.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var i=PB(null);if(i.current===null){var a={hasValue:!1,value:null};i.current=a}else a=i.current;i=TB(function(){function c(h){if(!u){if(u=!0,p=h,h=r(h),s!==void 0&&a.hasValue){var g=a.value;if(s(g,h))return d=g}return d=h}if(g=d,EB(p,h))return g;var k=r(h);return s!==void 0&&s(g,k)?(p=h,g):(p=h,d=k)}var u=!1,p,d,f=n===void 0?null:n;return[function(){return c(t())},f===null?void 0:function(){return c(f())}]},[t,n,r,s]);var l=AB(e,i[0],i[1]);return IB(function(){a.hasValue=!0,a.value=l},[l]),RB(l),l};YA.exports=GA;var MB=YA.exports;const $B=zo(MB),LB={},iN=e=>{let t;const n=new Set,r=(p,d)=>{const f=typeof p=="function"?p(t):p;if(!Object.is(f,t)){const h=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,h))}},s=()=>t,c={setState:r,getState:s,getInitialState:()=>u,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(LB?"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},OB=e=>e?iN(e):iN,{useDebugValue:DB}=it,{useSyncExternalStoreWithSelector:FB}=$B,zB=e=>e;function ZA(e,t=zB,n){const r=FB(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return DB(r),r}const oN=(e,t)=>{const n=OB(e),r=(s,i=t)=>ZA(n,s,i);return Object.assign(r,n),r},BB=(e,t)=>e?oN(e,t):oN;function bn(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 am=m.createContext(null),HB=am.Provider,eP=gi.error001();function Mt(e,t){const n=m.useContext(am);if(n===null)throw new Error(eP);return ZA(n,e,t)}function xn(){const e=m.useContext(am);if(e===null)throw new Error(eP);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const aN={display:"none"},WB={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},tP="react-flow__node-desc",nP="react-flow__edge-desc",VB="react-flow__aria-live",KB=e=>e.ariaLiveMessage,qB=e=>e.ariaLabelConfig;function UB({rfId:e}){const t=Mt(KB);return o.jsx("div",{id:`${VB}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:WB,children:t})}function YB({rfId:e,disableKeyboardA11y:t}){const n=Mt(qB);return o.jsxs(o.Fragment,{children:[o.jsx("div",{id:`${tP}-${e}`,style:aN,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),o.jsx("div",{id:`${nP}-${e}`,style:aN,children:n["edge.a11yDescription.default"]}),!t&&o.jsx(UB,{rfId:e})]})}const lm=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...s},i)=>{const a=`${e}`.split("-");return o.jsx("div",{className:Bn(["react-flow__panel",n,...a]),style:r,ref:i,...s,children:t})});lm.displayName="Panel";function GB({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:o.jsx(lm,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:o.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const JB=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}},Lf=e=>e.id;function XB(e,t){return bn(e.selectedNodes.map(Lf),t.selectedNodes.map(Lf))&&bn(e.selectedEdges.map(Lf),t.selectedEdges.map(Lf))}function QB({onSelectionChange:e}){const t=xn(),{selectedNodes:n,selectedEdges:r}=Mt(JB,XB);return m.useEffect(()=>{const s={nodes:n,edges:r};e==null||e(s),t.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,e]),null}const ZB=e=>!!e.onSelectionChangeHandlers;function e4({onSelectionChange:e}){const t=Mt(ZB);return e||t?o.jsx(QB,{onSelectionChange:e}):null}const Dx=typeof window<"u"?m.useLayoutEffect:m.useEffect,rP=[0,0],t4={x:0,y:0,zoom:1},n4=["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"],lN=[...n4,"rfId"],r4=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}),cN={translateExtent:Ju,nodeOrigin:rP,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function s4(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:a,reset:l,setDefaultNodesAndEdges:c}=Mt(r4,bn),u=xn();Dx(()=>(c(e.defaultNodes,e.defaultEdges),()=>{p.current=cN,l()}),[]);const p=m.useRef(cN);return Dx(()=>{for(const d of lN){const f=e[d],h=p.current[d];f!==h&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?r(f):d==="maxZoom"?s(f):d==="translateExtent"?i(f):d==="nodeExtent"?a(f):d==="ariaLabelConfig"?u.setState({ariaLabelConfig:A3(f)}):d==="fitView"?u.setState({fitViewQueued:f}):d==="fitViewOptions"?u.setState({fitViewOptions:f}):u.setState({[d]:f})))}p.current=e},lN.map(d=>e[d])),null}function uN(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function i4(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const s=uN(),i=()=>n(s!=null&&s.matches?"dark":"light");return i(),s==null||s.addEventListener("change",i),()=>{s==null||s.removeEventListener("change",i)}},[e]),t!==null?t:(r=uN())!=null&&r.matches?"dark":"light"}const dN=typeof document<"u"?document:null;function ed(e=null,t={target:dN,actInsideInputWithModifier:!0}){const[n,r]=m.useState(!1),s=m.useRef(!1),i=m.useRef(new Set([])),[a,l]=m.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
|
|
61
|
-
`).replace(`
|
|
62
|
-
|
|
63
|
-
`,`
|
|
64
|
-
+`).split(`
|
|
65
|
-
`)),p=u.reduce((d,f)=>d.concat(...f),[]);return[u,p]}return[[],[]]},[e]);return m.useEffect(()=>{const c=(t==null?void 0:t.target)??dN,u=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const p=h=>{var w,y;if(s.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!s.current||s.current&&!u)&&IA(h))return!1;const k=pN(h.code,l);if(i.current.add(h[k]),fN(a,i.current,!1)){const v=((y=(w=h.composedPath)==null?void 0:w.call(h))==null?void 0:y[0])||h.target,x=(v==null?void 0:v.nodeName)==="BUTTON"||(v==null?void 0:v.nodeName)==="A";t.preventDefault!==!1&&(s.current||!x)&&h.preventDefault(),r(!0)}},d=h=>{const g=pN(h.code,l);fN(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(h[g]),h.key==="Meta"&&i.current.clear(),s.current=!1},f=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",p),c==null||c.addEventListener("keyup",d),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{c==null||c.removeEventListener("keydown",p),c==null||c.removeEventListener("keyup",d),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,r]),n}function fN(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(s=>t.has(s)))}function pN(e,t){return t.includes(e)?"code":"key"}const o4=()=>{const e=xn();return m.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,t):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,t):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,n):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,s,i],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??r,y:t.y??s,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:s,minZoom:i,maxZoom:a,panZoom:l}=e.getState(),c=Cb(t,r,s,i,a,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:s,snapToGrid:i,domNode:a}=e.getState();if(!a)return t;const{x:l,y:c}=a.getBoundingClientRect(),u={x:t.x-l,y:t.y-c},p=n.snapGrid??s,d=n.snapToGrid??i;return jd(u,r,d,p)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:s,y:i}=r.getBoundingClientRect(),a=lh(t,n);return{x:a.x+s,y:a.y+i}}}),[])};function sP(e,t){const n=[],r=new Map,s=[];for(const i of e)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const a=r.get(i.id);a?a.push(i):r.set(i.id,[i])}for(const i of t){const a=r.get(i.id);if(!a){n.push(i);continue}if(a[0].type==="remove")continue;if(a[0].type==="replace"){n.push({...a[0].item});continue}const l={...i};for(const c of a)a4(c,l);n.push(l)}return s.length&&s.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function a4(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 ch(e,t){return sP(e,t)}function uh(e,t){return sP(e,t)}function ia(e,t){return{id:e,type:"select",selected:t}}function _l(e,t=new Set,n=!1){const r=[];for(const[s,i]of e){const a=t.has(s);!(i.selected===void 0&&!a)&&i.selected!==a&&(n&&(i.selected=a),r.push(ia(i.id,a)))}return r}function hN({items:e=[],lookup:t}){var s;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,a]of e.entries()){const l=t.get(a.id),c=((s=l==null?void 0:l.internals)==null?void 0:s.userNode)??l;c!==void 0&&c!==a&&n.push({id:a.id,item:a,type:"replace"}),c===void 0&&n.push({item:a,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function mN(e){return{id:e.id,type:"remove"}}const gN=e=>w3(e),l4=e=>SA(e);function iP(e){return m.forwardRef(e)}function yN(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>c4(()=>n(s=>s+BigInt(1))));return Dx(()=>{const s=r.get();s.length&&(e(s),r.reset())},[t]),r}function c4(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const oP=m.createContext(null);function u4({children:e}){const t=xn(),n=m.useCallback(l=>{const{nodes:c=[],setNodes:u,hasDefaultNodes:p,onNodesChange:d,nodeLookup:f,fitViewQueued:h,onNodesChangeMiddlewareMap:g}=t.getState();let k=c;for(const y of l)k=typeof y=="function"?y(k):y;let w=hN({items:k,lookup:f});for(const y of g.values())w=y(w);p&&u(k),w.length>0?d==null||d(w):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:y,nodes:v,setNodes:x}=t.getState();y&&x(v)})},[]),r=yN(n),s=m.useCallback(l=>{const{edges:c=[],setEdges:u,hasDefaultEdges:p,onEdgesChange:d,edgeLookup:f}=t.getState();let h=c;for(const g of l)h=typeof g=="function"?g(h):g;p?u(h):d&&d(hN({items:h,lookup:f}))},[]),i=yN(s),a=m.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return o.jsx(oP.Provider,{value:a,children:e})}function d4(){const e=m.useContext(oP);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const f4=e=>!!e.panZoom;function cc(){const e=o4(),t=xn(),n=d4(),r=Mt(f4),s=m.useMemo(()=>{const i=d=>t.getState().nodeLookup.get(d),a=d=>{n.nodeQueue.push(d)},l=d=>{n.edgeQueue.push(d)},c=d=>{var y,v;const{nodeLookup:f,nodeOrigin:h}=t.getState(),g=gN(d)?d:f.get(d.id),k=g.parentId?AA(g.position,g.measured,g.parentId,f,h):g.position,w={...g,position:k,width:((y=g.measured)==null?void 0:y.width)??g.width,height:((v=g.measured)==null?void 0:v.height)??g.height};return ec(w)},u=(d,f,h={replace:!1})=>{a(g=>g.map(k=>{if(k.id===d){const w=typeof f=="function"?f(k):f;return h.replace&&gN(w)?w:{...k,...w}}return k}))},p=(d,f,h={replace:!1})=>{l(g=>g.map(k=>{if(k.id===d){const w=typeof f=="function"?f(k):f;return h.replace&&l4(w)?w:{...k,...w}}return k}))};return{getNodes:()=>t.getState().nodes.map(d=>({...d})),getNode:d=>{var f;return(f=i(d))==null?void 0:f.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:d=[]}=t.getState();return d.map(f=>({...f}))},getEdge:d=>t.getState().edgeLookup.get(d),setNodes:a,setEdges:l,addNodes:d=>{const f=Array.isArray(d)?d:[d];n.nodeQueue.push(h=>[...h,...f])},addEdges:d=>{const f=Array.isArray(d)?d:[d];n.edgeQueue.push(h=>[...h,...f])},toObject:()=>{const{nodes:d=[],edges:f=[],transform:h}=t.getState(),[g,k,w]=h;return{nodes:d.map(y=>({...y})),edges:f.map(y=>({...y})),viewport:{x:g,y:k,zoom:w}}},deleteElements:async({nodes:d=[],edges:f=[]})=>{const{nodes:h,edges:g,onNodesDelete:k,onEdgesDelete:w,triggerNodeChanges:y,triggerEdgeChanges:v,onDelete:x,onBeforeDelete:C}=t.getState(),{nodes:N,edges:j}=await N3({nodesToRemove:d,edgesToRemove:f,nodes:h,edges:g,onBeforeDelete:C}),E=j.length>0,P=N.length>0;if(E){const O=j.map(mN);w==null||w(j),v(O)}if(P){const O=N.map(mN);k==null||k(N),y(O)}return(P||E)&&(x==null||x({nodes:N,edges:j})),{deletedNodes:N,deletedEdges:j}},getIntersectingNodes:(d,f=!0,h)=>{const g=qS(d),k=g?d:c(d),w=h!==void 0;return k?(h||t.getState().nodes).filter(y=>{const v=t.getState().nodeLookup.get(y.id);if(v&&!g&&(y.id===d.id||!v.internals.positionAbsolute))return!1;const x=ec(w?y:v),C=Qu(x,k);return f&&C>0||C>=x.width*x.height||C>=k.width*k.height}):[]},isNodeIntersecting:(d,f,h=!0)=>{const k=qS(d)?d:c(d);if(!k)return!1;const w=Qu(k,f);return h&&w>0||w>=f.width*f.height||w>=k.width*k.height},updateNode:u,updateNodeData:(d,f,h={replace:!1})=>{u(d,g=>{const k=typeof f=="function"?f(g):f;return h.replace?{...g,data:k}:{...g,data:{...g.data,...k}}},h)},updateEdge:p,updateEdgeData:(d,f,h={replace:!1})=>{p(d,g=>{const k=typeof f=="function"?f(g):f;return h.replace?{...g,data:k}:{...g,data:{...g.data,...k}}},h)},getNodesBounds:d=>{const{nodeLookup:f,nodeOrigin:h}=t.getState();return b3(d,{nodeLookup:f,nodeOrigin:h})},getHandleConnections:({type:d,id:f,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}-${d}${f?`-${f}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:d,handleId:f,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}${d?f?`-${d}-${f}`:`-${d}`:""}`))==null?void 0:g.values())??[])},fitView:async d=>{const f=t.getState().fitViewResolver??E3();return t.setState({fitViewQueued:!0,fitViewOptions:d,fitViewResolver:f}),n.nodeQueue.push(h=>[...h]),f.promise}}},[]);return m.useMemo(()=>({...s,...e,viewportInitialized:r}),[r])}const xN=e=>e.selected,p4=typeof window<"u"?window:void 0;function h4({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=xn(),{deleteElements:r}=cc(),s=ed(e,{actInsideInputWithModifier:!1}),i=ed(t,{target:p4});m.useEffect(()=>{if(s){const{edges:a,nodes:l}=n.getState();r({nodes:l.filter(xN),edges:a.filter(xN)}),n.setState({nodesSelectionActive:!1})}},[s]),m.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function m4(e){const t=xn();m.useEffect(()=>{const n=()=>{var s,i,a,l;if(!e.current||!(((i=(s=e.current).checkVisibility)==null?void 0:i.call(s))??!0))return!1;const r=_b(e.current);(r.height===0||r.width===0)&&((l=(a=t.getState()).onError)==null||l.call(a,"004",gi.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 cm={position:"absolute",width:"100%",height:"100%",top:0,left:0},g4=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function y4({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=wa.Free,zoomOnDoubleClick:a=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:u,minZoom:p,maxZoom:d,zoomActivationKeyCode:f,preventScrolling:h=!0,children:g,noWheelClassName:k,noPanClassName:w,onViewportChange:y,isControlledViewport:v,paneClickDistance:x,selectionOnDrag:C}){const N=xn(),j=m.useRef(null),{userSelectionActive:E,lib:P,connectionInProgress:O}=Mt(g4,bn),B=ed(f),W=m.useRef();m4(j);const z=m.useCallback(L=>{y==null||y({x:L[0],y:L[1],zoom:L[2]}),v||N.setState({transform:L})},[y,v]);return m.useEffect(()=>{if(j.current){W.current=uB({domNode:j.current,minZoom:p,maxZoom:d,translateExtent:u,viewport:c,onDraggingChange:D=>N.setState($=>$.paneDragging===D?$:{paneDragging:D}),onPanZoomStart:(D,$)=>{const{onViewportChangeStart:I,onMoveStart:F}=N.getState();F==null||F(D,$),I==null||I($)},onPanZoom:(D,$)=>{const{onViewportChange:I,onMove:F}=N.getState();F==null||F(D,$),I==null||I($)},onPanZoomEnd:(D,$)=>{const{onViewportChangeEnd:I,onMoveEnd:F}=N.getState();F==null||F(D,$),I==null||I($)}});const{x:L,y:R,zoom:K}=W.current.getViewport();return N.setState({panZoom:W.current,transform:[L,R,K],domNode:j.current.closest(".react-flow")}),()=>{var D;(D=W.current)==null||D.destroy()}}},[]),m.useEffect(()=>{var L;(L=W.current)==null||L.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:a,panOnDrag:l,zoomActivationKeyPressed:B,preventScrolling:h,noPanClassName:w,userSelectionActive:E,noWheelClassName:k,lib:P,onTransformChange:z,connectionInProgress:O,selectionOnDrag:C,paneClickDistance:x})},[e,t,n,r,s,i,a,l,B,h,w,E,k,P,z,O,C,x]),o.jsx("div",{className:"react-flow__renderer",ref:j,style:cm,children:g})}const x4=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function w4(){const{userSelectionActive:e,userSelectionRect:t}=Mt(x4,bn);return e&&t?o.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const Bg=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},b4=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function k4({isSelecting:e,selectionKeyPressed:t,selectionMode:n=Xu.Full,panOnDrag:r,paneClickDistance:s,selectionOnDrag:i,onSelectionStart:a,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:p,onPaneMouseEnter:d,onPaneMouseMove:f,onPaneMouseLeave:h,children:g}){const k=xn(),{userSelectionActive:w,elementsSelectable:y,dragging:v,connectionInProgress:x}=Mt(b4,bn),C=y&&(e||w),N=m.useRef(null),j=m.useRef(),E=m.useRef(new Set),P=m.useRef(new Set),O=m.useRef(!1),B=I=>{if(O.current||x){O.current=!1;return}c==null||c(I),k.getState().resetSelectedElements(),k.setState({nodesSelectionActive:!1})},W=I=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){I.preventDefault();return}u==null||u(I)},z=p?I=>p(I):void 0,L=I=>{O.current&&(I.stopPropagation(),O.current=!1)},R=I=>{var ie,G;const{domNode:F}=k.getState();if(j.current=F==null?void 0:F.getBoundingClientRect(),!j.current)return;const _=I.target===N.current;if(!_&&!!I.target.closest(".nokey")||!e||!(i&&_||t)||I.button!==0||!I.isPrimary)return;(G=(ie=I.target)==null?void 0:ie.setPointerCapture)==null||G.call(ie,I.pointerId),O.current=!1;const{x:T,y:ee}=zs(I.nativeEvent,j.current);k.setState({userSelectionRect:{width:0,height:0,startX:T,startY:ee,x:T,y:ee}}),_||(I.stopPropagation(),I.preventDefault())},K=I=>{const{userSelectionRect:F,transform:_,nodeLookup:X,edgeLookup:V,connectionLookup:T,triggerNodeChanges:ee,triggerEdgeChanges:ie,defaultEdgeOptions:G,resetSelectedElements:se}=k.getState();if(!j.current||!F)return;const{x:te,y:re}=zs(I.nativeEvent,j.current),{startX:ne,startY:ce}=F;if(!O.current){const Te=t?0:s;if(Math.hypot(te-ne,re-ce)<=Te)return;se(),a==null||a(I)}O.current=!0;const de={startX:ne,startY:ce,x:te<ne?te:ne,y:re<ce?re:ce,width:Math.abs(te-ne),height:Math.abs(re-ce)},me=E.current,He=P.current;E.current=new Set(jb(X,de,_,n===Xu.Partial,!0).map(Te=>Te.id)),P.current=new Set;const Je=(G==null?void 0:G.selectable)??!0;for(const Te of E.current){const ot=T.get(Te);if(ot)for(const{edgeId:gt}of ot.values()){const yt=V.get(gt);yt&&(yt.selectable??Je)&&P.current.add(gt)}}if(!US(me,E.current)){const Te=_l(X,E.current,!0);ee(Te)}if(!US(He,P.current)){const Te=_l(V,P.current);ie(Te)}k.setState({userSelectionRect:de,userSelectionActive:!0,nodesSelectionActive:!1})},D=I=>{var F,_;I.button===0&&((_=(F=I.target)==null?void 0:F.releasePointerCapture)==null||_.call(F,I.pointerId),!w&&I.target===N.current&&k.getState().userSelectionRect&&(B==null||B(I)),k.setState({userSelectionActive:!1,userSelectionRect:null}),O.current&&(l==null||l(I),k.setState({nodesSelectionActive:E.current.size>0})))},$=r===!0||Array.isArray(r)&&r.includes(0);return o.jsxs("div",{className:Bn(["react-flow__pane",{draggable:$,dragging:v,selection:e}]),onClick:C?void 0:Bg(B,N),onContextMenu:Bg(W,N),onWheel:Bg(z,N),onPointerEnter:C?void 0:d,onPointerMove:C?K:f,onPointerUp:C?D:void 0,onPointerDownCapture:C?R:void 0,onClickCapture:C?L:void 0,onPointerLeave:h,ref:N,style:cm,children:[g,o.jsx(w4,{})]})}function Fx({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:l,onError:c}=t.getState(),u=l.get(e);if(!u){c==null||c("012",gi.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(i({nodes:[u],edges:[]}),requestAnimationFrame(()=>{var p;return(p=r==null?void 0:r.current)==null?void 0:p.blur()})):s([e])}function aP({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:a}){const l=xn(),[c,u]=m.useState(!1),p=m.useRef();return m.useEffect(()=>{p.current=J3({getStoreItems:()=>l.getState(),onNodeMouseDown:d=>{Fx({id:d,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),m.useEffect(()=>{if(!(t||!e.current||!p.current))return p.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:s,nodeClickDistance:a}),()=>{var d;(d=p.current)==null||d.destroy()}},[n,r,t,i,e,s,a]),c}const v4=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function lP(){const e=xn();return m.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:a,onError:l,updateNodePositions:c,nodeLookup:u,nodeOrigin:p}=e.getState(),d=new Map,f=v4(a),h=s?i[0]:5,g=s?i[1]:5,k=n.direction.x*h*n.factor,w=n.direction.y*g*n.factor;for(const[,y]of u){if(!f(y))continue;let v={x:y.internals.positionAbsolute.x+k,y:y.internals.positionAbsolute.y+w};s&&(v=Nd(v,i));const{position:x,positionAbsolute:C}=NA({nodeId:y.id,nextPosition:v,nodeLookup:u,nodeExtent:r,nodeOrigin:p,onError:l});y.position=x,y.internals.positionAbsolute=C,d.set(y.id,y)}c(d)},[])}const Rb=m.createContext(null),S4=Rb.Provider;Rb.Consumer;const cP=()=>m.useContext(Rb),N4=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),j4=(e,t,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:a}=r,{fromHandle:l,toHandle:c,isValid:u}=a,p=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===e&&(l==null?void 0:l.id)===t&&(l==null?void 0:l.type)===n,connectingTo:p,clickConnecting:(s==null?void 0:s.nodeId)===e&&(s==null?void 0:s.id)===t&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===Ql.Strict?(l==null?void 0:l.type)!==n:e!==(l==null?void 0:l.nodeId)||t!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!s,valid:p&&u}};function C4({type:e="source",position:t=$e.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:c,className:u,onMouseDown:p,onTouchStart:d,...f},h){var K,D;const g=a||null,k=e==="target",w=xn(),y=cP(),{connectOnClick:v,noPanClassName:x,rfId:C}=Mt(N4,bn),{connectingFrom:N,connectingTo:j,clickConnecting:E,isPossibleEndHandle:P,connectionInProcess:O,clickConnectionInProcess:B,valid:W}=Mt(j4(y,g,e),bn);y||(D=(K=w.getState()).onError)==null||D.call(K,"010",gi.error010());const z=$=>{const{defaultEdgeOptions:I,onConnect:F,hasDefaultEdges:_}=w.getState(),X={...I,...$};if(_){const{edges:V,setEdges:T}=w.getState();T(vp(X,V))}F==null||F(X),l==null||l(X)},L=$=>{if(!y)return;const I=TA($.nativeEvent);if(s&&(I&&$.button===0||!I)){const F=w.getState();Ox.onPointerDown($.nativeEvent,{handleDomNode:$.currentTarget,autoPanOnConnect:F.autoPanOnConnect,connectionMode:F.connectionMode,connectionRadius:F.connectionRadius,domNode:F.domNode,nodeLookup:F.nodeLookup,lib:F.lib,isTarget:k,handleId:g,nodeId:y,flowId:F.rfId,panBy:F.panBy,cancelConnection:F.cancelConnection,onConnectStart:F.onConnectStart,onConnectEnd:(..._)=>{var X,V;return(V=(X=w.getState()).onConnectEnd)==null?void 0:V.call(X,..._)},updateConnection:F.updateConnection,onConnect:z,isValidConnection:n||((..._)=>{var X,V;return((V=(X=w.getState()).isValidConnection)==null?void 0:V.call(X,..._))??!0}),getTransform:()=>w.getState().transform,getFromHandle:()=>w.getState().connection.fromHandle,autoPanSpeed:F.autoPanSpeed,dragThreshold:F.connectionDragThreshold})}I?p==null||p($):d==null||d($)},R=$=>{const{onClickConnectStart:I,onClickConnectEnd:F,connectionClickStartHandle:_,connectionMode:X,isValidConnection:V,lib:T,rfId:ee,nodeLookup:ie,connection:G}=w.getState();if(!y||!_&&!s)return;if(!_){I==null||I($.nativeEvent,{nodeId:y,handleId:g,handleType:e}),w.setState({connectionClickStartHandle:{nodeId:y,type:e,id:g}});return}const se=PA($.target),te=n||V,{connection:re,isValid:ne}=Ox.isValid($.nativeEvent,{handle:{nodeId:y,id:g,type:e},connectionMode:X,fromNodeId:_.nodeId,fromHandleId:_.id||null,fromType:_.type,isValidConnection:te,flowId:ee,doc:se,lib:T,nodeLookup:ie});ne&&re&&z(re);const ce=structuredClone(G);delete ce.inProgress,ce.toPosition=ce.toHandle?ce.toHandle.position:null,F==null||F($,ce),w.setState({connectionClickStartHandle:null})};return o.jsx("div",{"data-handleid":g,"data-nodeid":y,"data-handlepos":t,"data-id":`${C}-${y}-${g}-${e}`,className:Bn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",x,u,{source:!k,target:k,connectable:r,connectablestart:s,connectableend:i,clickconnecting:E,connectingfrom:N,connectingto:j,valid:W,connectionindicator:r&&(!O||P)&&(O||B?i:s)}]),onMouseDown:L,onTouchStart:L,onClick:v?R:void 0,ref:h,...f,children:c})}const zn=m.memo(iP(C4));function _4({data:e,isConnectable:t,sourcePosition:n=$e.Bottom}){return o.jsxs(o.Fragment,{children:[e==null?void 0:e.label,o.jsx(zn,{type:"source",position:n,isConnectable:t})]})}function E4({data:e,isConnectable:t,targetPosition:n=$e.Top,sourcePosition:r=$e.Bottom}){return o.jsxs(o.Fragment,{children:[o.jsx(zn,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,o.jsx(zn,{type:"source",position:r,isConnectable:t})]})}function A4(){return null}function P4({data:e,isConnectable:t,targetPosition:n=$e.Top}){return o.jsxs(o.Fragment,{children:[o.jsx(zn,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const dh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},wN={input:_4,default:E4,output:P4,group:A4};function I4(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 T4=e=>{const{width:t,height:n,x:r,y:s}=Sd(e.nodeLookup,{filter:i=>!!i.selected});return{width:Fs(t)?t:null,height:Fs(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 R4({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=xn(),{width:s,height:i,transformString:a,userSelectionActive:l}=Mt(T4,bn),c=lP(),u=m.useRef(null);m.useEffect(()=>{var h;n||(h=u.current)==null||h.focus({preventScroll:!0})},[n]);const p=!l&&s!==null&&i!==null;if(aP({nodeRef:u,disabled:!p}),!p)return null;const d=e?h=>{const g=r.getState().nodes.filter(k=>k.selected);e(h,g)}:void 0,f=h=>{Object.prototype.hasOwnProperty.call(dh,h.key)&&(h.preventDefault(),c({direction:dh[h.key],factor:h.shiftKey?4:1}))};return o.jsx("div",{className:Bn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:a},children:o.jsx("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:s,height:i}})})}const bN=typeof window<"u"?window:void 0,M4=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function uP({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:u,selectionOnDrag:p,selectionMode:d,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:k,zoomActivationKeyCode:w,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:x,panOnScroll:C,panOnScrollSpeed:N,panOnScrollMode:j,zoomOnDoubleClick:E,panOnDrag:P,defaultViewport:O,translateExtent:B,minZoom:W,maxZoom:z,preventScrolling:L,onSelectionContextMenu:R,noWheelClassName:K,noPanClassName:D,disableKeyboardA11y:$,onViewportChange:I,isControlledViewport:F}){const{nodesSelectionActive:_,userSelectionActive:X}=Mt(M4,bn),V=ed(u,{target:bN}),T=ed(k,{target:bN}),ee=T||P,ie=T||C,G=p&&ee!==!0,se=V||X||G;return h4({deleteKeyCode:c,multiSelectionKeyCode:g}),o.jsx(y4,{onPaneContextMenu:i,elementsSelectable:y,zoomOnScroll:v,zoomOnPinch:x,panOnScroll:ie,panOnScrollSpeed:N,panOnScrollMode:j,zoomOnDoubleClick:E,panOnDrag:!V&&ee,defaultViewport:O,translateExtent:B,minZoom:W,maxZoom:z,zoomActivationKeyCode:w,preventScrolling:L,noWheelClassName:K,noPanClassName:D,onViewportChange:I,isControlledViewport:F,paneClickDistance:l,selectionOnDrag:G,children:o.jsxs(k4,{onSelectionStart:f,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:ee,isSelecting:!!se,selectionMode:d,selectionKeyPressed:V,paneClickDistance:l,selectionOnDrag:G,children:[e,_&&o.jsx(R4,{onSelectionContextMenu:R,noPanClassName:D,disableKeyboardA11y:$})]})})}uP.displayName="FlowRenderer";const $4=m.memo(uP),L4=e=>t=>e?jb(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 O4(e){return Mt(m.useCallback(L4(e),[e]),bn)}const D4=e=>e.updateNodeInternals;function F4(){const e=Mt(D4),[t]=m.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),e(r)}));return m.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function z4({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const s=xn(),i=m.useRef(null),a=m.useRef(null),l=m.useRef(e.sourcePosition),c=m.useRef(e.targetPosition),u=m.useRef(t),p=n&&!!e.internals.handleBounds;return m.useEffect(()=>{i.current&&!e.hidden&&(!p||a.current!==i.current)&&(a.current&&(r==null||r.unobserve(a.current)),r==null||r.observe(i.current),a.current=i.current)},[p,e.hidden]),m.useEffect(()=>()=>{a.current&&(r==null||r.unobserve(a.current),a.current=null)},[]),m.useEffect(()=>{if(i.current){const d=u.current!==t,f=l.current!==e.sourcePosition,h=c.current!==e.targetPosition;(d||f||h)&&(u.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,s.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function B4({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:a,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:p,resizeObserver:d,noDragClassName:f,noPanClassName:h,disableKeyboardA11y:g,rfId:k,nodeTypes:w,nodeClickDistance:y,onError:v}){const{node:x,internals:C,isParent:N}=Mt(te=>{const re=te.nodeLookup.get(e),ne=te.parentLookup.has(e);return{node:re,internals:re.internals,isParent:ne}},bn);let j=x.type||"default",E=(w==null?void 0:w[j])||wN[j];E===void 0&&(v==null||v("003",gi.error003(j)),j="default",E=(w==null?void 0:w.default)||wN.default);const P=!!(x.draggable||l&&typeof x.draggable>"u"),O=!!(x.selectable||c&&typeof x.selectable>"u"),B=!!(x.connectable||u&&typeof x.connectable>"u"),W=!!(x.focusable||p&&typeof x.focusable>"u"),z=xn(),L=EA(x),R=z4({node:x,nodeType:j,hasDimensions:L,resizeObserver:d}),K=aP({nodeRef:R,disabled:x.hidden||!P,noDragClassName:f,handleSelector:x.dragHandle,nodeId:e,isSelectable:O,nodeClickDistance:y}),D=lP();if(x.hidden)return null;const $=Ji(x),I=I4(x),F=O||P||t||n||r||s,_=n?te=>n(te,{...C.userNode}):void 0,X=r?te=>r(te,{...C.userNode}):void 0,V=s?te=>s(te,{...C.userNode}):void 0,T=i?te=>i(te,{...C.userNode}):void 0,ee=a?te=>a(te,{...C.userNode}):void 0,ie=te=>{const{selectNodesOnDrag:re,nodeDragThreshold:ne}=z.getState();O&&(!re||!P||ne>0)&&Fx({id:e,store:z,nodeRef:R}),t&&t(te,{...C.userNode})},G=te=>{if(!(IA(te.nativeEvent)||g)){if(wA.includes(te.key)&&O){const re=te.key==="Escape";Fx({id:e,store:z,unselect:re,nodeRef:R})}else if(P&&x.selected&&Object.prototype.hasOwnProperty.call(dh,te.key)){te.preventDefault();const{ariaLabelConfig:re}=z.getState();z.setState({ariaLiveMessage:re["node.a11yDescription.ariaLiveMessage"]({direction:te.key.replace("Arrow","").toLowerCase(),x:~~C.positionAbsolute.x,y:~~C.positionAbsolute.y})}),D({direction:dh[te.key],factor:te.shiftKey?4:1})}}},se=()=>{var He;if(g||!((He=R.current)!=null&&He.matches(":focus-visible")))return;const{transform:te,width:re,height:ne,autoPanOnNodeFocus:ce,setCenter:de}=z.getState();if(!ce)return;jb(new Map([[e,x]]),{x:0,y:0,width:re,height:ne},te,!0).length>0||de(x.position.x+$.width/2,x.position.y+$.height/2,{zoom:te[2]})};return o.jsx("div",{className:Bn(["react-flow__node",`react-flow__node-${j}`,{[h]:P},x.className,{selected:x.selected,selectable:O,parent:N,draggable:P,dragging:K}]),ref:R,style:{zIndex:C.z,transform:`translate(${C.positionAbsolute.x}px,${C.positionAbsolute.y}px)`,pointerEvents:F?"all":"none",visibility:L?"visible":"hidden",...x.style,...I},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:_,onMouseMove:X,onMouseLeave:V,onContextMenu:T,onClick:ie,onDoubleClick:ee,onKeyDown:W?G:void 0,tabIndex:W?0:void 0,onFocus:W?se:void 0,role:x.ariaRole??(W?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${tP}-${k}`,"aria-label":x.ariaLabel,...x.domAttributes,children:o.jsx(S4,{value:e,children:o.jsx(E,{id:e,data:x.data,type:j,positionAbsoluteX:C.positionAbsolute.x,positionAbsoluteY:C.positionAbsolute.y,selected:x.selected??!1,selectable:O,draggable:P,deletable:x.deletable??!0,isConnectable:B,sourcePosition:x.sourcePosition,targetPosition:x.targetPosition,dragging:K,dragHandle:x.dragHandle,zIndex:C.z,parentId:x.parentId,...$})})})}var H4=m.memo(B4);const W4=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function dP(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=Mt(W4,bn),a=O4(e.onlyRenderVisibleElements),l=F4();return o.jsx("div",{className:"react-flow__nodes",style:cm,children:a.map(c=>o.jsx(H4,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:l,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:e.nodeClickDistance,onError:i},c))})}dP.displayName="NodeRenderer";const V4=m.memo(dP);function K4(e){return Mt(m.useCallback(n=>{if(!e)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const i=n.nodeLookup.get(s.source),a=n.nodeLookup.get(s.target);i&&a&&T3({sourceNode:i,targetNode:a,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[e]),bn)}const q4=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return o.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},U4=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return o.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},kN={[oi.Arrow]:q4,[oi.ArrowClosed]:U4};function Y4(e){const t=xn();return m.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(kN,e)?kN[e]:((i=(s=t.getState()).onError)==null||i.call(s,"009",gi.error009(e)),null)},[e])}const G4=({id:e,type:t,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=Y4(t);return c?o.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:o.jsx(c,{color:n,strokeWidth:a})}):null},fP=({defaultColor:e,rfId:t})=>{const n=Mt(i=>i.edges),r=Mt(i=>i.defaultEdgeOptions),s=m.useMemo(()=>F3(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return s.length?o.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:o.jsx("defs",{children:s.map(i=>o.jsx(G4,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};fP.displayName="MarkerDefinitions";var J4=m.memo(fP);function pP({x:e,y:t,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:u,...p}){const[d,f]=m.useState({x:1,y:0,width:0,height:0}),h=Bn(["react-flow__edge-textwrapper",u]),g=m.useRef(null);return m.useEffect(()=>{if(g.current){const k=g.current.getBBox();f({x:k.x,y:k.y,width:k.width,height:k.height})}},[n]),n?o.jsxs("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:h,visibility:d.width?"visible":"hidden",...p,children:[s&&o.jsx("rect",{width:d.width+2*a[0],x:-a[0],y:-a[1],height:d.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),o.jsx("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:g,style:r,children:n}),c]}):null}pP.displayName="EdgeText";const X4=m.memo(pP);function um({path:e,labelX:t,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...p}){return o.jsxs(o.Fragment,{children:[o.jsx("path",{...p,d:e,fill:"none",className:Bn(["react-flow__edge-path",p.className])}),u?o.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,r&&Fs(t)&&Fs(n)?o.jsx(X4,{x:t,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:a,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function vN({pos:e,x1:t,y1:n,x2:r,y2:s}){return e===$e.Left||e===$e.Right?[.5*(t+r),n]:[t,.5*(n+s)]}function hP({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:r,targetY:s,targetPosition:i=$e.Top}){const[a,l]=vN({pos:n,x1:e,y1:t,x2:r,y2:s}),[c,u]=vN({pos:i,x1:r,y1:s,x2:e,y2:t}),[p,d,f,h]=RA({sourceX:e,sourceY:t,targetX:r,targetY:s,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${r},${s}`,p,d,f,h]}function mP(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a,targetPosition:l,label:c,labelStyle:u,labelShowBg:p,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:k,markerStart:w,interactionWidth:y})=>{const[v,x,C]=hP({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l}),N=e.isInternal?void 0:t;return o.jsx(um,{id:N,path:v,labelX:x,labelY:C,label:c,labelStyle:u,labelShowBg:p,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:k,markerStart:w,interactionWidth:y})})}const Q4=mP({isInternal:!1}),gP=mP({isInternal:!0});Q4.displayName="SimpleBezierEdge";gP.displayName="SimpleBezierEdgeInternal";function yP(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:d,style:f,sourcePosition:h=$e.Bottom,targetPosition:g=$e.Top,markerEnd:k,markerStart:w,pathOptions:y,interactionWidth:v})=>{const[x,C,N]=Mx({sourceX:n,sourceY:r,sourcePosition:h,targetX:s,targetY:i,targetPosition:g,borderRadius:y==null?void 0:y.borderRadius,offset:y==null?void 0:y.offset,stepPosition:y==null?void 0:y.stepPosition}),j=e.isInternal?void 0:t;return o.jsx(um,{id:j,path:x,labelX:C,labelY:N,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:d,style:f,markerEnd:k,markerStart:w,interactionWidth:v})})}const xP=yP({isInternal:!1}),wP=yP({isInternal:!0});xP.displayName="SmoothStepEdge";wP.displayName="SmoothStepEdgeInternal";function bP(e){return m.memo(({id:t,...n})=>{var s;const r=e.isInternal?void 0:t;return o.jsx(xP,{...n,id:r,pathOptions:m.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const Z4=bP({isInternal:!1}),kP=bP({isInternal:!0});Z4.displayName="StepEdge";kP.displayName="StepEdgeInternal";function vP(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:k})=>{const[w,y,v]=LA({sourceX:n,sourceY:r,targetX:s,targetY:i}),x=e.isInternal?void 0:t;return o.jsx(um,{id:x,path:w,labelX:y,labelY:v,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:p,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:g,interactionWidth:k})})}const eH=vP({isInternal:!1}),SP=vP({isInternal:!0});eH.displayName="StraightEdge";SP.displayName="StraightEdgeInternal";function NP(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:a=$e.Bottom,targetPosition:l=$e.Top,label:c,labelStyle:u,labelShowBg:p,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:k,markerStart:w,pathOptions:y,interactionWidth:v})=>{const[x,C,N]=MA({sourceX:n,sourceY:r,sourcePosition:a,targetX:s,targetY:i,targetPosition:l,curvature:y==null?void 0:y.curvature}),j=e.isInternal?void 0:t;return o.jsx(um,{id:j,path:x,labelX:C,labelY:N,label:c,labelStyle:u,labelShowBg:p,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:k,markerStart:w,interactionWidth:v})})}const tH=NP({isInternal:!1}),jP=NP({isInternal:!0});tH.displayName="BezierEdge";jP.displayName="BezierEdgeInternal";const SN={default:jP,straight:SP,step:kP,smoothstep:wP,simplebezier:gP},NN={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},nH=(e,t,n)=>n===$e.Left?e-t:n===$e.Right?e+t:e,rH=(e,t,n)=>n===$e.Top?e-t:n===$e.Bottom?e+t:e,jN="react-flow__edgeupdater";function CN({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:a,type:l}){return o.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:a,className:Bn([jN,`${jN}-${l}`]),cx:nH(t,r,e),cy:rH(n,r,e),r,stroke:"transparent",fill:"transparent"})}function sH({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:a,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:p,onReconnectEnd:d,setReconnecting:f,setUpdateHover:h}){const g=xn(),k=(C,N)=>{if(C.button!==0)return;const{autoPanOnConnect:j,domNode:E,connectionMode:P,connectionRadius:O,lib:B,onConnectStart:W,cancelConnection:z,nodeLookup:L,rfId:R,panBy:K,updateConnection:D}=g.getState(),$=N.type==="target",I=(X,V)=>{f(!1),d==null||d(X,n,N.type,V)},F=X=>u==null?void 0:u(n,X),_=(X,V)=>{f(!0),p==null||p(C,n,N.type),W==null||W(X,V)};Ox.onPointerDown(C.nativeEvent,{autoPanOnConnect:j,connectionMode:P,connectionRadius:O,domNode:E,handleId:N.id,nodeId:N.nodeId,nodeLookup:L,isTarget:$,edgeUpdaterType:N.type,lib:B,flowId:R,cancelConnection:z,panBy:K,isValidConnection:(...X)=>{var V,T;return((T=(V=g.getState()).isValidConnection)==null?void 0:T.call(V,...X))??!0},onConnect:F,onConnectStart:_,onConnectEnd:(...X)=>{var V,T;return(T=(V=g.getState()).onConnectEnd)==null?void 0:T.call(V,...X)},onReconnectEnd:I,updateConnection:D,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:C.currentTarget})},w=C=>k(C,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),y=C=>k(C,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>h(!0),x=()=>h(!1);return o.jsxs(o.Fragment,{children:[(e===!0||e==="source")&&o.jsx(CN,{position:l,centerX:r,centerY:s,radius:t,onMouseDown:w,onMouseEnter:v,onMouseOut:x,type:"source"}),(e===!0||e==="target")&&o.jsx(CN,{position:c,centerX:i,centerY:a,radius:t,onMouseDown:y,onMouseEnter:v,onMouseOut:x,type:"target"})]})}function iH({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,reconnectRadius:p,onReconnect:d,onReconnectStart:f,onReconnectEnd:h,rfId:g,edgeTypes:k,noPanClassName:w,onError:y,disableKeyboardA11y:v}){let x=Mt(de=>de.edgeLookup.get(e));const C=Mt(de=>de.defaultEdgeOptions);x=C?{...C,...x}:x;let N=x.type||"default",j=(k==null?void 0:k[N])||SN[N];j===void 0&&(y==null||y("011",gi.error011(N)),N="default",j=(k==null?void 0:k.default)||SN.default);const E=!!(x.focusable||t&&typeof x.focusable>"u"),P=typeof d<"u"&&(x.reconnectable||n&&typeof x.reconnectable>"u"),O=!!(x.selectable||r&&typeof x.selectable>"u"),B=m.useRef(null),[W,z]=m.useState(!1),[L,R]=m.useState(!1),K=xn(),{zIndex:D,sourceX:$,sourceY:I,targetX:F,targetY:_,sourcePosition:X,targetPosition:V}=Mt(m.useCallback(de=>{const me=de.nodeLookup.get(x.source),He=de.nodeLookup.get(x.target);if(!me||!He)return{zIndex:x.zIndex,...NN};const Je=D3({id:e,sourceNode:me,targetNode:He,sourceHandle:x.sourceHandle||null,targetHandle:x.targetHandle||null,connectionMode:de.connectionMode,onError:y});return{zIndex:I3({selected:x.selected,zIndex:x.zIndex,sourceNode:me,targetNode:He,elevateOnSelect:de.elevateEdgesOnSelect,zIndexMode:de.zIndexMode}),...Je||NN}},[x.source,x.target,x.sourceHandle,x.targetHandle,x.selected,x.zIndex]),bn),T=m.useMemo(()=>x.markerStart?`url('#${$x(x.markerStart,g)}')`:void 0,[x.markerStart,g]),ee=m.useMemo(()=>x.markerEnd?`url('#${$x(x.markerEnd,g)}')`:void 0,[x.markerEnd,g]);if(x.hidden||$===null||I===null||F===null||_===null)return null;const ie=de=>{var Te;const{addSelectedEdges:me,unselectNodesAndEdges:He,multiSelectionActive:Je}=K.getState();O&&(K.setState({nodesSelectionActive:!1}),x.selected&&Je?(He({nodes:[],edges:[x]}),(Te=B.current)==null||Te.blur()):me([e])),s&&s(de,x)},G=i?de=>{i(de,{...x})}:void 0,se=a?de=>{a(de,{...x})}:void 0,te=l?de=>{l(de,{...x})}:void 0,re=c?de=>{c(de,{...x})}:void 0,ne=u?de=>{u(de,{...x})}:void 0,ce=de=>{var me;if(!v&&wA.includes(de.key)&&O){const{unselectNodesAndEdges:He,addSelectedEdges:Je}=K.getState();de.key==="Escape"?((me=B.current)==null||me.blur(),He({edges:[x]})):Je([e])}};return o.jsx("svg",{style:{zIndex:D},children:o.jsxs("g",{className:Bn(["react-flow__edge",`react-flow__edge-${N}`,x.className,w,{selected:x.selected,animated:x.animated,inactive:!O&&!s,updating:W,selectable:O}]),onClick:ie,onDoubleClick:G,onContextMenu:se,onMouseEnter:te,onMouseMove:re,onMouseLeave:ne,onKeyDown:E?ce:void 0,tabIndex:E?0:void 0,role:x.ariaRole??(E?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":x.ariaLabel===null?void 0:x.ariaLabel||`Edge from ${x.source} to ${x.target}`,"aria-describedby":E?`${nP}-${g}`:void 0,ref:B,...x.domAttributes,children:[!L&&o.jsx(j,{id:e,source:x.source,target:x.target,type:x.type,selected:x.selected,animated:x.animated,selectable:O,deletable:x.deletable??!0,label:x.label,labelStyle:x.labelStyle,labelShowBg:x.labelShowBg,labelBgStyle:x.labelBgStyle,labelBgPadding:x.labelBgPadding,labelBgBorderRadius:x.labelBgBorderRadius,sourceX:$,sourceY:I,targetX:F,targetY:_,sourcePosition:X,targetPosition:V,data:x.data,style:x.style,sourceHandleId:x.sourceHandle,targetHandleId:x.targetHandle,markerStart:T,markerEnd:ee,pathOptions:"pathOptions"in x?x.pathOptions:void 0,interactionWidth:x.interactionWidth}),P&&o.jsx(sH,{edge:x,isReconnectable:P,reconnectRadius:p,onReconnect:d,onReconnectStart:f,onReconnectEnd:h,sourceX:$,sourceY:I,targetX:F,targetY:_,sourcePosition:X,targetPosition:V,setUpdateHover:z,setReconnecting:R})]})})}var oH=m.memo(iH);const aH=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function CP({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:u,onEdgeClick:p,reconnectRadius:d,onEdgeDoubleClick:f,onReconnectStart:h,onReconnectEnd:g,disableKeyboardA11y:k}){const{edgesFocusable:w,edgesReconnectable:y,elementsSelectable:v,onError:x}=Mt(aH,bn),C=K4(t);return o.jsxs("div",{className:"react-flow__edges",children:[o.jsx(J4,{defaultColor:e,rfId:n}),C.map(N=>o.jsx(oH,{id:N,edgesFocusable:w,edgesReconnectable:y,elementsSelectable:v,noPanClassName:s,onReconnect:i,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:u,onClick:p,reconnectRadius:d,onDoubleClick:f,onReconnectStart:h,onReconnectEnd:g,rfId:n,onError:x,edgeTypes:r,disableKeyboardA11y:k},N))]})}CP.displayName="EdgeRenderer";const lH=m.memo(CP),cH=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function uH({children:e}){const t=Mt(cH);return o.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function dH(e){const t=cc(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const fH=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function pH(e){const t=Mt(fH),n=xn();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function hH(e){return e.connection.inProgress?{...e.connection,to:jd(e.connection.to,e.transform)}:{...e.connection}}function mH(e){return hH}function gH(e){const t=mH();return Mt(t,bn)}const yH=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function xH({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:s,width:i,height:a,isValid:l,inProgress:c}=Mt(yH,bn);return!(i&&s&&c)?null:o.jsx("svg",{style:e,width:i,height:a,className:"react-flow__connectionline react-flow__container",children:o.jsx("g",{className:Bn(["react-flow__connection",vA(l)]),children:o.jsx(_P,{style:t,type:n,CustomComponent:r,isValid:l})})})}const _P=({style:e,type:t=xo.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:a,fromHandle:l,fromPosition:c,to:u,toNode:p,toHandle:d,toPosition:f,pointer:h}=gH();if(!s)return;if(n)return o.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:a,fromHandle:l,fromX:i.x,fromY:i.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:f,connectionStatus:vA(r),toNode:p,toHandle:d,pointer:h});let g="";const k={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:f};switch(t){case xo.Bezier:[g]=MA(k);break;case xo.SimpleBezier:[g]=hP(k);break;case xo.Step:[g]=Mx({...k,borderRadius:0});break;case xo.SmoothStep:[g]=Mx(k);break;default:[g]=LA(k)}return o.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};_P.displayName="ConnectionLine";const wH={};function _N(e=wH){m.useRef(e),xn(),m.useEffect(()=>{},[e])}function bH(){xn(),m.useRef(!1),m.useEffect(()=>{},[])}function EP({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:a,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:p,onSelectionContextMenu:d,onSelectionStart:f,onSelectionEnd:h,connectionLineType:g,connectionLineStyle:k,connectionLineComponent:w,connectionLineContainerStyle:y,selectionKeyCode:v,selectionOnDrag:x,selectionMode:C,multiSelectionKeyCode:N,panActivationKeyCode:j,zoomActivationKeyCode:E,deleteKeyCode:P,onlyRenderVisibleElements:O,elementsSelectable:B,defaultViewport:W,translateExtent:z,minZoom:L,maxZoom:R,preventScrolling:K,defaultMarkerColor:D,zoomOnScroll:$,zoomOnPinch:I,panOnScroll:F,panOnScrollSpeed:_,panOnScrollMode:X,zoomOnDoubleClick:V,panOnDrag:T,onPaneClick:ee,onPaneMouseEnter:ie,onPaneMouseMove:G,onPaneMouseLeave:se,onPaneScroll:te,onPaneContextMenu:re,paneClickDistance:ne,nodeClickDistance:ce,onEdgeContextMenu:de,onEdgeMouseEnter:me,onEdgeMouseMove:He,onEdgeMouseLeave:Je,reconnectRadius:Te,onReconnect:ot,onReconnectStart:gt,onReconnectEnd:yt,noDragClassName:Ae,noWheelClassName:dt,noPanClassName:St,disableKeyboardA11y:Wt,nodeExtent:Vt,rfId:et,viewport:fe,onViewportChange:ke}){return _N(e),_N(t),bH(),dH(n),pH(fe),o.jsx($4,{onPaneClick:ee,onPaneMouseEnter:ie,onPaneMouseMove:G,onPaneMouseLeave:se,onPaneContextMenu:re,onPaneScroll:te,paneClickDistance:ne,deleteKeyCode:P,selectionKeyCode:v,selectionOnDrag:x,selectionMode:C,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:N,panActivationKeyCode:j,zoomActivationKeyCode:E,elementsSelectable:B,zoomOnScroll:$,zoomOnPinch:I,zoomOnDoubleClick:V,panOnScroll:F,panOnScrollSpeed:_,panOnScrollMode:X,panOnDrag:T,defaultViewport:W,translateExtent:z,minZoom:L,maxZoom:R,onSelectionContextMenu:d,preventScrolling:K,noDragClassName:Ae,noWheelClassName:dt,noPanClassName:St,disableKeyboardA11y:Wt,onViewportChange:ke,isControlledViewport:!!fe,children:o.jsxs(uH,{children:[o.jsx(lH,{edgeTypes:t,onEdgeClick:s,onEdgeDoubleClick:a,onReconnect:ot,onReconnectStart:gt,onReconnectEnd:yt,onlyRenderVisibleElements:O,onEdgeContextMenu:de,onEdgeMouseEnter:me,onEdgeMouseMove:He,onEdgeMouseLeave:Je,reconnectRadius:Te,defaultMarkerColor:D,noPanClassName:St,disableKeyboardA11y:Wt,rfId:et}),o.jsx(xH,{style:k,type:g,component:w,containerStyle:y}),o.jsx("div",{className:"react-flow__edgelabel-renderer"}),o.jsx(V4,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:u,onNodeContextMenu:p,nodeClickDistance:ce,onlyRenderVisibleElements:O,noPanClassName:St,noDragClassName:Ae,disableKeyboardA11y:Wt,nodeExtent:Vt,rfId:et}),o.jsx("div",{className:"react-flow__viewport-portal"})]})})}EP.displayName="GraphView";const kH=m.memo(EP),EN=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c=.5,maxZoom:u=2,nodeOrigin:p,nodeExtent:d,zIndexMode:f="basic"}={})=>{const h=new Map,g=new Map,k=new Map,w=new Map,y=r??t??[],v=n??e??[],x=p??[0,0],C=d??Ju;FA(k,w,y);const{nodesInitialized:N}=Lx(v,h,g,{nodeOrigin:x,nodeExtent:C,zIndexMode:f});let j=[0,0,1];if(a&&s&&i){const E=Sd(h,{filter:W=>!!((W.width||W.initialWidth)&&(W.height||W.initialHeight))}),{x:P,y:O,zoom:B}=Cb(E,s,i,c,u,(l==null?void 0:l.padding)??.1);j=[P,O,B]}return{rfId:"1",width:s??0,height:i??0,transform:j,nodes:v,nodesInitialized:N,nodeLookup:h,parentLookup:g,edges:y,edgeLookup:w,connectionLookup:k,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:u,translateExtent:Ju,nodeExtent:C,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Ql.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:x,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:l,fitViewResolver:null,connection:{...kA},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:j3,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:bA,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},vH=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:p,nodeExtent:d,zIndexMode:f})=>BB((h,g)=>{async function k(){const{nodeLookup:w,panZoom:y,fitViewOptions:v,fitViewResolver:x,width:C,height:N,minZoom:j,maxZoom:E}=g();y&&(await S3({nodes:w,width:C,height:N,panZoom:y,minZoom:j,maxZoom:E},v),x==null||x.resolve(!0),h({fitViewResolver:null}))}return{...EN({nodes:e,edges:t,width:s,height:i,fitView:a,fitViewOptions:l,minZoom:c,maxZoom:u,nodeOrigin:p,nodeExtent:d,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:w=>{const{nodeLookup:y,parentLookup:v,nodeOrigin:x,elevateNodesOnSelect:C,fitViewQueued:N,zIndexMode:j,nodesSelectionActive:E}=g(),{nodesInitialized:P,hasSelectedNodes:O}=Lx(w,y,v,{nodeOrigin:x,nodeExtent:d,elevateNodesOnSelect:C,checkEquality:!0,zIndexMode:j}),B=E&&O;N&&P?(k(),h({nodes:w,nodesInitialized:P,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:B})):h({nodes:w,nodesInitialized:P,nodesSelectionActive:B})},setEdges:w=>{const{connectionLookup:y,edgeLookup:v}=g();FA(y,v,w),h({edges:w})},setDefaultNodesAndEdges:(w,y)=>{if(w){const{setNodes:v}=g();v(w),h({hasDefaultNodes:!0})}if(y){const{setEdges:v}=g();v(y),h({hasDefaultEdges:!0})}},updateNodeInternals:w=>{const{triggerNodeChanges:y,nodeLookup:v,parentLookup:x,domNode:C,nodeOrigin:N,nodeExtent:j,debug:E,fitViewQueued:P,zIndexMode:O}=g(),{changes:B,updatedInternals:W}=q3(w,v,x,C,N,j,O);W&&(H3(v,x,{nodeOrigin:N,nodeExtent:j,zIndexMode:O}),P?(k(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(B==null?void 0:B.length)>0&&(E&&console.log("React Flow: trigger node changes",B),y==null||y(B)))},updateNodePositions:(w,y=!1)=>{const v=[];let x=[];const{nodeLookup:C,triggerNodeChanges:N,connection:j,updateConnection:E,onNodesChangeMiddlewareMap:P}=g();for(const[O,B]of w){const W=C.get(O),z=!!(W!=null&&W.expandParent&&(W!=null&&W.parentId)&&(B!=null&&B.position)),L={id:O,type:"position",position:z?{x:Math.max(0,B.position.x),y:Math.max(0,B.position.y)}:B.position,dragging:y};if(W&&j.inProgress&&j.fromNode.id===W.id){const R=Pa(W,j.fromHandle,$e.Left,!0);E({...j,from:R})}z&&W.parentId&&v.push({id:O,parentId:W.parentId,rect:{...B.internals.positionAbsolute,width:B.measured.width??0,height:B.measured.height??0}}),x.push(L)}if(v.length>0){const{parentLookup:O,nodeOrigin:B}=g(),W=Tb(v,C,O,B);x.push(...W)}for(const O of P.values())x=O(x);N(x)},triggerNodeChanges:w=>{const{onNodesChange:y,setNodes:v,nodes:x,hasDefaultNodes:C,debug:N}=g();if(w!=null&&w.length){if(C){const j=ch(w,x);v(j)}N&&console.log("React Flow: trigger node changes",w),y==null||y(w)}},triggerEdgeChanges:w=>{const{onEdgesChange:y,setEdges:v,edges:x,hasDefaultEdges:C,debug:N}=g();if(w!=null&&w.length){if(C){const j=uh(w,x);v(j)}N&&console.log("React Flow: trigger edge changes",w),y==null||y(w)}},addSelectedNodes:w=>{const{multiSelectionActive:y,edgeLookup:v,nodeLookup:x,triggerNodeChanges:C,triggerEdgeChanges:N}=g();if(y){const j=w.map(E=>ia(E,!0));C(j);return}C(_l(x,new Set([...w]),!0)),N(_l(v))},addSelectedEdges:w=>{const{multiSelectionActive:y,edgeLookup:v,nodeLookup:x,triggerNodeChanges:C,triggerEdgeChanges:N}=g();if(y){const j=w.map(E=>ia(E,!0));N(j);return}N(_l(v,new Set([...w]))),C(_l(x,new Set,!0))},unselectNodesAndEdges:({nodes:w,edges:y}={})=>{const{edges:v,nodes:x,nodeLookup:C,triggerNodeChanges:N,triggerEdgeChanges:j}=g(),E=w||x,P=y||v,O=[];for(const W of E){if(!W.selected)continue;const z=C.get(W.id);z&&(z.selected=!1),O.push(ia(W.id,!1))}const B=[];for(const W of P)W.selected&&B.push(ia(W.id,!1));N(O),j(B)},setMinZoom:w=>{const{panZoom:y,maxZoom:v}=g();y==null||y.setScaleExtent([w,v]),h({minZoom:w})},setMaxZoom:w=>{const{panZoom:y,minZoom:v}=g();y==null||y.setScaleExtent([v,w]),h({maxZoom:w})},setTranslateExtent:w=>{var y;(y=g().panZoom)==null||y.setTranslateExtent(w),h({translateExtent:w})},resetSelectedElements:()=>{const{edges:w,nodes:y,triggerNodeChanges:v,triggerEdgeChanges:x,elementsSelectable:C}=g();if(!C)return;const N=y.reduce((E,P)=>P.selected?[...E,ia(P.id,!1)]:E,[]),j=w.reduce((E,P)=>P.selected?[...E,ia(P.id,!1)]:E,[]);v(N),x(j)},setNodeExtent:w=>{const{nodes:y,nodeLookup:v,parentLookup:x,nodeOrigin:C,elevateNodesOnSelect:N,nodeExtent:j,zIndexMode:E}=g();w[0][0]===j[0][0]&&w[0][1]===j[0][1]&&w[1][0]===j[1][0]&&w[1][1]===j[1][1]||(Lx(y,v,x,{nodeOrigin:C,nodeExtent:w,elevateNodesOnSelect:N,checkEquality:!1,zIndexMode:E}),h({nodeExtent:w}))},panBy:w=>{const{transform:y,width:v,height:x,panZoom:C,translateExtent:N}=g();return U3({delta:w,panZoom:C,transform:y,translateExtent:N,width:v,height:x})},setCenter:async(w,y,v)=>{const{width:x,height:C,maxZoom:N,panZoom:j}=g();if(!j)return Promise.resolve(!1);const E=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:N;return await j.setViewport({x:x/2-w*E,y:C/2-y*E,zoom:E},{duration:v==null?void 0:v.duration,ease:v==null?void 0:v.ease,interpolate:v==null?void 0:v.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...kA}})},updateConnection:w=>{h({connection:w})},reset:()=>h({...EN()})}},Object.is);function Mb({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:a,initialMaxZoom:l,initialFitViewOptions:c,fitView:u,nodeOrigin:p,nodeExtent:d,zIndexMode:f,children:h}){const[g]=m.useState(()=>vH({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:u,minZoom:a,maxZoom:l,fitViewOptions:c,nodeOrigin:p,nodeExtent:d,zIndexMode:f}));return o.jsx(HB,{value:g,children:o.jsx(u4,{children:h})})}function SH({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:a,fitView:l,fitViewOptions:c,minZoom:u,maxZoom:p,nodeOrigin:d,nodeExtent:f,zIndexMode:h}){return m.useContext(am)?o.jsx(o.Fragment,{children:e}):o.jsx(Mb,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:a,fitView:l,initialFitViewOptions:c,initialMinZoom:u,initialMaxZoom:p,nodeOrigin:d,nodeExtent:f,zIndexMode:h,children:e})}const NH={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function jH({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:a,onNodeClick:l,onEdgeClick:c,onInit:u,onMove:p,onMoveStart:d,onMoveEnd:f,onConnect:h,onConnectStart:g,onConnectEnd:k,onClickConnectStart:w,onClickConnectEnd:y,onNodeMouseEnter:v,onNodeMouseMove:x,onNodeMouseLeave:C,onNodeContextMenu:N,onNodeDoubleClick:j,onNodeDragStart:E,onNodeDrag:P,onNodeDragStop:O,onNodesDelete:B,onEdgesDelete:W,onDelete:z,onSelectionChange:L,onSelectionDragStart:R,onSelectionDrag:K,onSelectionDragStop:D,onSelectionContextMenu:$,onSelectionStart:I,onSelectionEnd:F,onBeforeDelete:_,connectionMode:X,connectionLineType:V=xo.Bezier,connectionLineStyle:T,connectionLineComponent:ee,connectionLineContainerStyle:ie,deleteKeyCode:G="Backspace",selectionKeyCode:se="Shift",selectionOnDrag:te=!1,selectionMode:re=Xu.Full,panActivationKeyCode:ne="Space",multiSelectionKeyCode:ce=Zu()?"Meta":"Control",zoomActivationKeyCode:de=Zu()?"Meta":"Control",snapToGrid:me,snapGrid:He,onlyRenderVisibleElements:Je=!1,selectNodesOnDrag:Te,nodesDraggable:ot,autoPanOnNodeFocus:gt,nodesConnectable:yt,nodesFocusable:Ae,nodeOrigin:dt=rP,edgesFocusable:St,edgesReconnectable:Wt,elementsSelectable:Vt=!0,defaultViewport:et=t4,minZoom:fe=.5,maxZoom:ke=2,translateExtent:Ve=Ju,preventScrolling:Qe=!0,nodeExtent:Se,defaultMarkerColor:_t="#b1b1b7",zoomOnScroll:dn=!0,zoomOnPinch:zt=!0,panOnScroll:at=!1,panOnScrollSpeed:fn=.5,panOnScrollMode:Z=wa.Free,zoomOnDoubleClick:Ce=!0,panOnDrag:Me=!0,onPaneClick:Ye,onPaneMouseEnter:Pt,onPaneMouseMove:Nt,onPaneMouseLeave:$n,onPaneScroll:Xt,onPaneContextMenu:Hn,paneClickDistance:Yn=1,nodeClickDistance:Wn=0,children:Ln,onReconnect:Gn,onReconnectStart:ls,onReconnectEnd:Ir,onEdgeContextMenu:wr,onEdgeDoubleClick:cs,onEdgeMouseEnter:pn,onEdgeMouseMove:rr,onEdgeMouseLeave:br,reconnectRadius:Vn=10,onNodesChange:Cn,onEdgesChange:kr,noDragClassName:Gs="nodrag",noWheelClassName:vr="nowheel",noPanClassName:Qt="nopan",fitView:le,fitViewOptions:we,connectOnClick:De,attributionPosition:wt,proOptions:Zt,defaultEdgeOptions:on,elevateNodesOnSelect:An=!0,elevateEdgesOnSelect:ur=!1,disableKeyboardA11y:nt=!1,autoPanOnConnect:xt,autoPanOnNodeDrag:Yt,autoPanSpeed:Ke,connectionRadius:Re,isValidConnection:dr,onError:ki,style:Kr,id:qr,nodeDragThreshold:Ss,connectionDragThreshold:oe,viewport:ve,onViewportChange:ae,width:ht,height:$t,colorMode:Kt="light",debug:sr,onScroll:nn,ariaLabelConfig:Ur,zIndexMode:q="basic",...pe},Pe){const _e=qr||"1",qe=i4(Kt),rn=m.useCallback(It=>{It.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),nn==null||nn(It)},[nn]);return o.jsx("div",{"data-testid":"rf__wrapper",...pe,onScroll:rn,style:{...Kr,...NH},ref:Pe,className:Bn(["react-flow",s,qe]),id:qr,role:"application",children:o.jsxs(SH,{nodes:e,edges:t,width:ht,height:$t,fitView:le,fitViewOptions:we,minZoom:fe,maxZoom:ke,nodeOrigin:dt,nodeExtent:Se,zIndexMode:q,children:[o.jsx(s4,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:g,onConnectEnd:k,onClickConnectStart:w,onClickConnectEnd:y,nodesDraggable:ot,autoPanOnNodeFocus:gt,nodesConnectable:yt,nodesFocusable:Ae,edgesFocusable:St,edgesReconnectable:Wt,elementsSelectable:Vt,elevateNodesOnSelect:An,elevateEdgesOnSelect:ur,minZoom:fe,maxZoom:ke,nodeExtent:Se,onNodesChange:Cn,onEdgesChange:kr,snapToGrid:me,snapGrid:He,connectionMode:X,translateExtent:Ve,connectOnClick:De,defaultEdgeOptions:on,fitView:le,fitViewOptions:we,onNodesDelete:B,onEdgesDelete:W,onDelete:z,onNodeDragStart:E,onNodeDrag:P,onNodeDragStop:O,onSelectionDrag:K,onSelectionDragStart:R,onSelectionDragStop:D,onMove:p,onMoveStart:d,onMoveEnd:f,noPanClassName:Qt,nodeOrigin:dt,rfId:_e,autoPanOnConnect:xt,autoPanOnNodeDrag:Yt,autoPanSpeed:Ke,onError:ki,connectionRadius:Re,isValidConnection:dr,selectNodesOnDrag:Te,nodeDragThreshold:Ss,connectionDragThreshold:oe,onBeforeDelete:_,debug:sr,ariaLabelConfig:Ur,zIndexMode:q}),o.jsx(kH,{onInit:u,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:x,onNodeMouseLeave:C,onNodeContextMenu:N,onNodeDoubleClick:j,nodeTypes:i,edgeTypes:a,connectionLineType:V,connectionLineStyle:T,connectionLineComponent:ee,connectionLineContainerStyle:ie,selectionKeyCode:se,selectionOnDrag:te,selectionMode:re,deleteKeyCode:G,multiSelectionKeyCode:ce,panActivationKeyCode:ne,zoomActivationKeyCode:de,onlyRenderVisibleElements:Je,defaultViewport:et,translateExtent:Ve,minZoom:fe,maxZoom:ke,preventScrolling:Qe,zoomOnScroll:dn,zoomOnPinch:zt,zoomOnDoubleClick:Ce,panOnScroll:at,panOnScrollSpeed:fn,panOnScrollMode:Z,panOnDrag:Me,onPaneClick:Ye,onPaneMouseEnter:Pt,onPaneMouseMove:Nt,onPaneMouseLeave:$n,onPaneScroll:Xt,onPaneContextMenu:Hn,paneClickDistance:Yn,nodeClickDistance:Wn,onSelectionContextMenu:$,onSelectionStart:I,onSelectionEnd:F,onReconnect:Gn,onReconnectStart:ls,onReconnectEnd:Ir,onEdgeContextMenu:wr,onEdgeDoubleClick:cs,onEdgeMouseEnter:pn,onEdgeMouseMove:rr,onEdgeMouseLeave:br,reconnectRadius:Vn,defaultMarkerColor:_t,noDragClassName:Gs,noWheelClassName:vr,noPanClassName:Qt,rfId:_e,disableKeyboardA11y:nt,nodeExtent:Se,viewport:ve,onViewportChange:ae}),o.jsx(e4,{onSelectionChange:L}),Ln,o.jsx(GB,{proOptions:Zt,position:wt}),o.jsx(YB,{rfId:_e,disableKeyboardA11y:nt})]})})}var AP=iP(jH);function CH(){const e=xn();return m.useCallback(t=>{const{domNode:n,updateNodeInternals:r}=e.getState(),s=Array.isArray(t)?t:[t],i=new Map;s.forEach(a=>{const l=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${a}"]`);l&&i.set(a,{id:a,nodeElement:l,force:!0})}),requestAnimationFrame(()=>r(i,{triggerFitView:!1}))},[])}function _H(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(i=>ch(s,i)),[]);return[t,n,r]}function EH(e){const[t,n]=m.useState(e),r=m.useCallback(s=>n(i=>uh(s,i)),[]);return[t,n,r]}function AH({dimensions:e,lineWidth:t,variant:n,className:r}){return o.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Bn(["react-flow__background-pattern",n,r])})}function PH({radius:e,className:t}){return o.jsx("circle",{cx:e,cy:e,r:e,className:Bn(["react-flow__background-pattern","dots",t])})}var Io;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Io||(Io={}));const IH={[Io.Dots]:1,[Io.Lines]:1,[Io.Cross]:6},TH=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function PP({id:e,variant:t=Io.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:a,bgColor:l,style:c,className:u,patternClassName:p}){const d=m.useRef(null),{transform:f,patternId:h}=Mt(TH,bn),g=r||IH[t],k=t===Io.Dots,w=t===Io.Cross,y=Array.isArray(n)?n:[n,n],v=[y[0]*f[2]||1,y[1]*f[2]||1],x=g*f[2],C=Array.isArray(i)?i:[i,i],N=w?[x,x]:v,j=[C[0]*f[2]||1+N[0]/2,C[1]*f[2]||1+N[1]/2],E=`${h}${e||""}`;return o.jsxs("svg",{className:Bn(["react-flow__background",u]),style:{...c,...cm,"--xy-background-color-props":l,"--xy-background-pattern-color-props":a},ref:d,"data-testid":"rf__background",children:[o.jsx("pattern",{id:E,x:f[0]%v[0],y:f[1]%v[1],width:v[0],height:v[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${j[0]},-${j[1]})`,children:k?o.jsx(PH,{radius:x/2,className:p}):o.jsx(AH,{dimensions:N,lineWidth:s,variant:t,className:p})}),o.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${E})`})]})}PP.displayName="Background";const IP=m.memo(PP);function RH(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:o.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function MH(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:o.jsx("path",{d:"M0 0h32v4.2H0z"})})}function $H(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:o.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function LH(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function OH(){return o.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:o.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Of({children:e,className:t,...n}){return o.jsx("button",{type:"button",className:Bn(["react-flow__controls-button",t]),...n,children:e})}const DH=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function TP({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:u,children:p,position:d="bottom-left",orientation:f="vertical","aria-label":h}){const g=xn(),{isInteractive:k,minZoomReached:w,maxZoomReached:y,ariaLabelConfig:v}=Mt(DH,bn),{zoomIn:x,zoomOut:C,fitView:N}=cc(),j=()=>{x(),i==null||i()},E=()=>{C(),a==null||a()},P=()=>{N(s),l==null||l()},O=()=>{g.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),c==null||c(!k)},B=f==="horizontal"?"horizontal":"vertical";return o.jsxs(lm,{className:Bn(["react-flow__controls",B,u]),position:d,style:e,"data-testid":"rf__controls","aria-label":h??v["controls.ariaLabel"],children:[t&&o.jsxs(o.Fragment,{children:[o.jsx(Of,{onClick:j,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:y,children:o.jsx(RH,{})}),o.jsx(Of,{onClick:E,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:w,children:o.jsx(MH,{})})]}),n&&o.jsx(Of,{className:"react-flow__controls-fitview",onClick:P,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:o.jsx($H,{})}),r&&o.jsx(Of,{className:"react-flow__controls-interactive",onClick:O,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:k?o.jsx(OH,{}):o.jsx(LH,{})}),p]})}TP.displayName="Controls";m.memo(TP);function FH({id:e,x:t,y:n,width:r,height:s,style:i,color:a,strokeColor:l,strokeWidth:c,className:u,borderRadius:p,shapeRendering:d,selected:f,onClick:h}){const{background:g,backgroundColor:k}=i||{},w=a||g||k;return o.jsx("rect",{className:Bn(["react-flow__minimap-node",{selected:f},u]),x:t,y:n,rx:p,ry:p,width:r,height:s,style:{fill:w,stroke:l,strokeWidth:c},shapeRendering:d,onClick:h?y=>h(y,e):void 0})}const zH=m.memo(FH),BH=e=>e.nodes.map(t=>t.id),Hg=e=>e instanceof Function?e:()=>e;function HH({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=zH,onClick:a}){const l=Mt(BH,bn),c=Hg(t),u=Hg(e),p=Hg(n),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return o.jsx(o.Fragment,{children:l.map(f=>o.jsx(VH,{id:f,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:p,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:a,shapeRendering:d},f))})}function WH({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:a,NodeComponent:l,onClick:c}){const{node:u,x:p,y:d,width:f,height:h}=Mt(g=>{const k=g.nodeLookup.get(e);if(!k)return{node:void 0,x:0,y:0,width:0,height:0};const w=k.internals.userNode,{x:y,y:v}=k.internals.positionAbsolute,{width:x,height:C}=Ji(w);return{node:w,x:y,y:v,width:x,height:C}},bn);return!u||u.hidden||!EA(u)?null:o.jsx(l,{x:p,y:d,width:f,height:h,style:u.style,selected:!!u.selected,className:r(u),color:t(u),borderRadius:s,strokeColor:n(u),strokeWidth:i,shapeRendering:a,onClick:c,id:u.id})}const VH=m.memo(WH);var KH=m.memo(HH);const qH=200,UH=150,YH=e=>!e.hidden,GH=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?_A(Sd(e.nodeLookup,{filter:YH}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},JH="react-flow__minimap-desc";function RP({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:l,bgColor:c,maskColor:u,maskStrokeColor:p,maskStrokeWidth:d,position:f="bottom-right",onClick:h,onNodeClick:g,pannable:k=!1,zoomable:w=!1,ariaLabel:y,inversePan:v,zoomStep:x=1,offsetScale:C=5}){const N=xn(),j=m.useRef(null),{boundingRect:E,viewBB:P,rfId:O,panZoom:B,translateExtent:W,flowWidth:z,flowHeight:L,ariaLabelConfig:R}=Mt(GH,bn),K=(e==null?void 0:e.width)??qH,D=(e==null?void 0:e.height)??UH,$=E.width/K,I=E.height/D,F=Math.max($,I),_=F*K,X=F*D,V=C*F,T=E.x-(_-E.width)/2-V,ee=E.y-(X-E.height)/2-V,ie=_+V*2,G=X+V*2,se=`${JH}-${O}`,te=m.useRef(0),re=m.useRef();te.current=F,m.useEffect(()=>{if(j.current&&B)return re.current=nB({domNode:j.current,panZoom:B,getTransform:()=>N.getState().transform,getViewScale:()=>te.current}),()=>{var me;(me=re.current)==null||me.destroy()}},[B]),m.useEffect(()=>{var me;(me=re.current)==null||me.update({translateExtent:W,width:z,height:L,inversePan:v,pannable:k,zoomStep:x,zoomable:w})},[k,w,v,x,W,z,L]);const ne=h?me=>{var Te;const[He,Je]=((Te=re.current)==null?void 0:Te.pointer(me))||[0,0];h(me,{x:He,y:Je})}:void 0,ce=g?m.useCallback((me,He)=>{const Je=N.getState().nodeLookup.get(He).internals.userNode;g(me,Je)},[]):void 0,de=y??R["minimap.ariaLabel"];return o.jsx(lm,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof d=="number"?d*F: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:Bn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:o.jsxs("svg",{width:K,height:D,viewBox:`${T} ${ee} ${ie} ${G}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":se,ref:j,onClick:ne,children:[de&&o.jsx("title",{id:se,children:de}),o.jsx(KH,{onClick:ce,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:l}),o.jsx("path",{className:"react-flow__minimap-mask",d:`M${T-V},${ee-V}h${ie+V*2}v${G+V*2}h${-ie-V*2}z
|
|
66
|
-
M${P.x},${P.y}h${P.width}v${P.height}h${-P.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}RP.displayName="MiniMap";m.memo(RP);const XH=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,QH={[nc.Line]:"right",[nc.Handle]:"bottom-right"};function ZH({nodeId:e,position:t,variant:n=nc.Handle,className:r,style:s=void 0,children:i,color:a,minWidth:l=10,minHeight:c=10,maxWidth:u=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:d=!1,resizeDirection:f,autoScale:h=!0,shouldResize:g,onResizeStart:k,onResize:w,onResizeEnd:y}){const v=cP(),x=typeof e=="string"?e:v,C=xn(),N=m.useRef(null),j=n===nc.Handle,E=Mt(m.useCallback(XH(j&&h),[j,h]),bn),P=m.useRef(null),O=t??QH[n];m.useEffect(()=>{if(!(!N.current||!x))return P.current||(P.current=gB({domNode:N.current,nodeId:x,getStoreItems:()=>{const{nodeLookup:W,transform:z,snapGrid:L,snapToGrid:R,nodeOrigin:K,domNode:D}=C.getState();return{nodeLookup:W,transform:z,snapGrid:L,snapToGrid:R,nodeOrigin:K,paneDomNode:D}},onChange:(W,z)=>{const{triggerNodeChanges:L,nodeLookup:R,parentLookup:K,nodeOrigin:D}=C.getState(),$=[],I={x:W.x,y:W.y},F=R.get(x);if(F&&F.expandParent&&F.parentId){const _=F.origin??D,X=W.width??F.measured.width??0,V=W.height??F.measured.height??0,T={id:F.id,parentId:F.parentId,rect:{width:X,height:V,...AA({x:W.x??F.position.x,y:W.y??F.position.y},{width:X,height:V},F.parentId,R,_)}},ee=Tb([T],R,K,D);$.push(...ee),I.x=W.x?Math.max(_[0]*X,W.x):void 0,I.y=W.y?Math.max(_[1]*V,W.y):void 0}if(I.x!==void 0&&I.y!==void 0){const _={id:x,type:"position",position:{...I}};$.push(_)}if(W.width!==void 0&&W.height!==void 0){const X={id:x,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:W.width,height:W.height}};$.push(X)}for(const _ of z){const X={..._,type:"position"};$.push(X)}L($)},onEnd:({width:W,height:z})=>{const L={id:x,type:"dimensions",resizing:!1,dimensions:{width:W,height:z}};C.getState().triggerNodeChanges([L])}})),P.current.update({controlPosition:O,boundaries:{minWidth:l,minHeight:c,maxWidth:u,maxHeight:p},keepAspectRatio:d,resizeDirection:f,onResizeStart:k,onResize:w,onResizeEnd:y,shouldResize:g}),()=>{var W;(W=P.current)==null||W.destroy()}},[O,l,c,u,p,d,k,w,y,g]);const B=O.split("-");return o.jsx("div",{className:Bn(["react-flow__resize-control","nodrag",...B,n,r]),ref:N,style:{...s,scale:E,...a&&{[j?"backgroundColor":"borderColor"]:a}},children:i})}const $b=m.memo(ZH),e5="modulepreload",t5=function(e){return"/"+e},AN={},n5=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=t5(c),c in AN)return;AN[c]=!0;const u=c.endsWith(".css"),p=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${p}`))return;const d=document.createElement("link");if(d.rel=u?"stylesheet":e5,u||(d.as="script"),d.crossOrigin="",d.href=c,l&&d.setAttribute("nonce",l),document.head.appendChild(d),u)return new Promise((f,h)=>{d.addEventListener("load",f),d.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(a){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=a,window.dispatchEvent(l),!l.defaultPrevented)throw a}return s.then(a=>{for(const l of a||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};function r5(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const s5=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,i5=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,o5={};function PN(e,t){return(o5.jsx?i5:s5).test(e)}const a5=/[ \t\n\f\r]/g;function l5(e){return typeof e=="object"?e.type==="text"?IN(e.value):!1:IN(e)}function IN(e){return e.replace(a5,"")===""}class Cd{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Cd.prototype.normal={};Cd.prototype.property={};Cd.prototype.space=void 0;function MP(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new Cd(n,r,t)}function zx(e){return e.toLowerCase()}class Vr{constructor(t,n){this.attribute=n,this.property=t}}Vr.prototype.attribute="";Vr.prototype.booleanish=!1;Vr.prototype.boolean=!1;Vr.prototype.commaOrSpaceSeparated=!1;Vr.prototype.commaSeparated=!1;Vr.prototype.defined=!1;Vr.prototype.mustUseProperty=!1;Vr.prototype.number=!1;Vr.prototype.overloadedBoolean=!1;Vr.prototype.property="";Vr.prototype.spaceSeparated=!1;Vr.prototype.space=void 0;let c5=0;const kt=Ba(),Dn=Ba(),Bx=Ba(),je=Ba(),ln=Ba(),Dl=Ba(),Jr=Ba();function Ba(){return 2**++c5}const Hx=Object.freeze(Object.defineProperty({__proto__:null,boolean:kt,booleanish:Dn,commaOrSpaceSeparated:Jr,commaSeparated:Dl,number:je,overloadedBoolean:Bx,spaceSeparated:ln},Symbol.toStringTag,{value:"Module"})),Wg=Object.keys(Hx);class Lb extends Vr{constructor(t,n,r,s){let i=-1;if(super(t,n),TN(this,"space",s),typeof r=="number")for(;++i<Wg.length;){const a=Wg[i];TN(this,Wg[i],(r&Hx[a])===Hx[a])}}}Lb.prototype.defined=!0;function TN(e,t,n){n&&(e[t]=n)}function uc(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new Lb(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[zx(r)]=r,n[zx(i.attribute)]=r}return new Cd(t,n,e.space)}const $P=uc({properties:{ariaActiveDescendant:null,ariaAtomic:Dn,ariaAutoComplete:null,ariaBusy:Dn,ariaChecked:Dn,ariaColCount:je,ariaColIndex:je,ariaColSpan:je,ariaControls:ln,ariaCurrent:null,ariaDescribedBy:ln,ariaDetails:null,ariaDisabled:Dn,ariaDropEffect:ln,ariaErrorMessage:null,ariaExpanded:Dn,ariaFlowTo:ln,ariaGrabbed:Dn,ariaHasPopup:null,ariaHidden:Dn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ln,ariaLevel:je,ariaLive:null,ariaModal:Dn,ariaMultiLine:Dn,ariaMultiSelectable:Dn,ariaOrientation:null,ariaOwns:ln,ariaPlaceholder:null,ariaPosInSet:je,ariaPressed:Dn,ariaReadOnly:Dn,ariaRelevant:null,ariaRequired:Dn,ariaRoleDescription:ln,ariaRowCount:je,ariaRowIndex:je,ariaRowSpan:je,ariaSelected:Dn,ariaSetSize:je,ariaSort:null,ariaValueMax:je,ariaValueMin:je,ariaValueNow:je,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function LP(e,t){return t in e?e[t]:t}function OP(e,t){return LP(e,t.toLowerCase())}const u5=uc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Dl,acceptCharset:ln,accessKey:ln,action:null,allow:null,allowFullScreen:kt,allowPaymentRequest:kt,allowUserMedia:kt,alt:null,as:null,async:kt,autoCapitalize:null,autoComplete:ln,autoFocus:kt,autoPlay:kt,blocking:ln,capture:null,charSet:null,checked:kt,cite:null,className:ln,cols:je,colSpan:null,content:null,contentEditable:Dn,controls:kt,controlsList:ln,coords:je|Dl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:kt,defer:kt,dir:null,dirName:null,disabled:kt,download:Bx,draggable:Dn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:kt,formTarget:null,headers:ln,height:je,hidden:Bx,high:je,href:null,hrefLang:null,htmlFor:ln,httpEquiv:ln,id:null,imageSizes:null,imageSrcSet:null,inert:kt,inputMode:null,integrity:null,is:null,isMap:kt,itemId:null,itemProp:ln,itemRef:ln,itemScope:kt,itemType:ln,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:kt,low:je,manifest:null,max:null,maxLength:je,media:null,method:null,min:null,minLength:je,multiple:kt,muted:kt,name:null,nonce:null,noModule:kt,noValidate:kt,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:kt,optimum:je,pattern:null,ping:ln,placeholder:null,playsInline:kt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:kt,referrerPolicy:null,rel:ln,required:kt,reversed:kt,rows:je,rowSpan:je,sandbox:ln,scope:null,scoped:kt,seamless:kt,selected:kt,shadowRootClonable:kt,shadowRootDelegatesFocus:kt,shadowRootMode:null,shape:null,size:je,sizes:null,slot:null,span:je,spellCheck:Dn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:je,step:null,style:null,tabIndex:je,target:null,title:null,translate:null,type:null,typeMustMatch:kt,useMap:null,value:Dn,width:je,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ln,axis:null,background:null,bgColor:null,border:je,borderColor:null,bottomMargin:je,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:kt,declare:kt,event:null,face:null,frame:null,frameBorder:null,hSpace:je,leftMargin:je,link:null,longDesc:null,lowSrc:null,marginHeight:je,marginWidth:je,noResize:kt,noHref:kt,noShade:kt,noWrap:kt,object:null,profile:null,prompt:null,rev:null,rightMargin:je,rules:null,scheme:null,scrolling:Dn,standby:null,summary:null,text:null,topMargin:je,valueType:null,version:null,vAlign:null,vLink:null,vSpace:je,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:kt,disableRemotePlayback:kt,prefix:null,property:null,results:je,security:null,unselectable:null},space:"html",transform:OP}),d5=uc({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:Jr,accentHeight:je,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:je,amplitude:je,arabicForm:null,ascent:je,attributeName:null,attributeType:null,azimuth:je,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:je,by:null,calcMode:null,capHeight:je,className:ln,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:je,diffuseConstant:je,direction:null,display:null,dur:null,divisor:je,dominantBaseline:null,download:kt,dx:null,dy:null,edgeMode:null,editable:null,elevation:je,enableBackground:null,end:null,event:null,exponent:je,externalResourcesRequired:null,fill:null,fillOpacity:je,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:Dl,g2:Dl,glyphName:Dl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:je,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:je,horizOriginX:je,horizOriginY:je,id:null,ideographic:je,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:je,k:je,k1:je,k2:je,k3:je,k4:je,kernelMatrix:Jr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:je,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:je,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:je,overlineThickness:je,paintOrder:null,panose1:null,path:null,pathLength:je,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ln,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:je,pointsAtY:je,pointsAtZ:je,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Jr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Jr,rev:Jr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Jr,requiredFeatures:Jr,requiredFonts:Jr,requiredFormats:Jr,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:je,specularExponent:je,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:je,strikethroughThickness:je,string:null,stroke:null,strokeDashArray:Jr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:je,strokeOpacity:je,strokeWidth:null,style:null,surfaceScale:je,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Jr,tabIndex:je,tableValues:null,target:null,targetX:je,targetY:je,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Jr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:je,underlineThickness:je,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:je,values:null,vAlphabetic:je,vMathematical:je,vectorEffect:null,vHanging:je,vIdeographic:je,version:null,vertAdvY:je,vertOriginX:je,vertOriginY:je,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:je,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:LP}),DP=uc({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()}}),FP=uc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:OP}),zP=uc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),f5={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"},p5=/[A-Z]/g,RN=/-[a-z]/g,h5=/^data[-\w.:]+$/i;function m5(e,t){const n=zx(t);let r=t,s=Vr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&h5.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(RN,y5);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!RN.test(i)){let a=i.replace(p5,g5);a.charAt(0)!=="-"&&(a="-"+a),t="data"+a}}s=Lb}return new s(r,t)}function g5(e){return"-"+e.toLowerCase()}function y5(e){return e.charAt(1).toUpperCase()}const x5=MP([$P,u5,DP,FP,zP],"html"),Ob=MP([$P,d5,DP,FP,zP],"svg");function w5(e){return e.join(" ").trim()}var Db={},MN=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,b5=/\n/g,k5=/^\s*/,v5=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,S5=/^:\s*/,N5=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,j5=/^[;\s]*/,C5=/^\s+|\s+$/g,_5=`
|
|
67
|
-
`,$N="/",LN="*",aa="",E5="comment",A5="declaration";function P5(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function s(g){var k=g.match(b5);k&&(n+=k.length);var w=g.lastIndexOf(_5);r=~w?g.length-w:r+g.length}function i(){var g={line:n,column:r};return function(k){return k.position=new a(g),u(),k}}function a(g){this.start=g,this.end={line:n,column:r},this.source=t.source}a.prototype.content=e;function l(g){var k=new Error(t.source+":"+n+":"+r+": "+g);if(k.reason=g,k.filename=t.source,k.line=n,k.column=r,k.source=e,!t.silent)throw k}function c(g){var k=g.exec(e);if(k){var w=k[0];return s(w),e=e.slice(w.length),k}}function u(){c(k5)}function p(g){var k;for(g=g||[];k=d();)k!==!1&&g.push(k);return g}function d(){var g=i();if(!($N!=e.charAt(0)||LN!=e.charAt(1))){for(var k=2;aa!=e.charAt(k)&&(LN!=e.charAt(k)||$N!=e.charAt(k+1));)++k;if(k+=2,aa===e.charAt(k-1))return l("End of comment missing");var w=e.slice(2,k-2);return r+=2,s(w),e=e.slice(k),r+=2,g({type:E5,comment:w})}}function f(){var g=i(),k=c(v5);if(k){if(d(),!c(S5))return l("property missing ':'");var w=c(N5),y=g({type:A5,property:ON(k[0].replace(MN,aa)),value:w?ON(w[0].replace(MN,aa)):aa});return c(j5),y}}function h(){var g=[];p(g);for(var k;k=f();)k!==!1&&(g.push(k),p(g));return g}return u(),h()}function ON(e){return e?e.replace(C5,aa):aa}var I5=P5,T5=Eu&&Eu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Db,"__esModule",{value:!0});Db.default=M5;const R5=T5(I5);function M5(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,R5.default)(e),s=typeof t=="function";return r.forEach(i=>{if(i.type!=="declaration")return;const{property:a,value:l}=i;s?t(a,l,i):l&&(n=n||{},n[a]=l)}),n}var dm={};Object.defineProperty(dm,"__esModule",{value:!0});dm.camelCase=void 0;var $5=/^--[a-zA-Z0-9_-]+$/,L5=/-([a-z])/g,O5=/^[^-]+$/,D5=/^-(webkit|moz|ms|o|khtml)-/,F5=/^-(ms)-/,z5=function(e){return!e||O5.test(e)||$5.test(e)},B5=function(e,t){return t.toUpperCase()},DN=function(e,t){return"".concat(t,"-")},H5=function(e,t){return t===void 0&&(t={}),z5(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(F5,DN):e=e.replace(D5,DN),e.replace(L5,B5))};dm.camelCase=H5;var W5=Eu&&Eu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},V5=W5(Db),K5=dm;function Wx(e,t){var n={};return!e||typeof e!="string"||(0,V5.default)(e,function(r,s){r&&s&&(n[(0,K5.camelCase)(r,t)]=s)}),n}Wx.default=Wx;var q5=Wx;const U5=zo(q5),BP=HP("end"),Fb=HP("start");function HP(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 Y5(e){const t=Fb(e),n=BP(e);if(t&&n)return{start:t,end:n}}function ku(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?FN(e.position):"start"in e||"end"in e?FN(e):"line"in e||"column"in e?Vx(e):""}function Vx(e){return zN(e&&e.line)+":"+zN(e&&e.column)}function FN(e){return Vx(e&&e.start)+"-"+Vx(e&&e.end)}function zN(e){return e&&typeof e=="number"?e:1}class xr extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(a=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const l=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=l?l.line:void 0,this.name=ku(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}xr.prototype.file="";xr.prototype.name="";xr.prototype.reason="";xr.prototype.message="";xr.prototype.stack="";xr.prototype.column=void 0;xr.prototype.line=void 0;xr.prototype.ancestors=void 0;xr.prototype.cause=void 0;xr.prototype.fatal=void 0;xr.prototype.place=void 0;xr.prototype.ruleId=void 0;xr.prototype.source=void 0;const zb={}.hasOwnProperty,G5=new Map,J5=/[A-Z]/g,X5=new Set(["table","tbody","thead","tfoot","tr"]),Q5=new Set(["td","th"]),WP="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Z5(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=aW(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=oW(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"?Ob:x5,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=VP(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function VP(e,t,n){if(t.type==="element")return eW(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return tW(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return rW(e,t,n);if(t.type==="mdxjsEsm")return nW(e,t);if(t.type==="root")return sW(e,t,n);if(t.type==="text")return iW(e,t)}function eW(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=Ob,e.schema=s),e.ancestors.push(t);const i=qP(e,t.tagName,!1),a=lW(e,t);let l=Hb(e,t);return X5.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!l5(c):!0})),KP(e,a,i,t),Bb(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function tW(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)}td(e,t.position)}function nW(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);td(e,t.position)}function rW(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=Ob,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:qP(e,t.name,!0),a=cW(e,t),l=Hb(e,t);return KP(e,a,i,t),Bb(a,l),e.ancestors.pop(),e.schema=r,e.create(t,i,a,n)}function sW(e,t,n){const r={};return Bb(r,Hb(e,t)),e.create(t,e.Fragment,r,n)}function iW(e,t){return t.value}function KP(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Bb(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function oW(e,t,n){return r;function r(s,i,a,l){const u=Array.isArray(a.children)?n:t;return l?u(i,a,l):u(i,a)}}function aW(e,t){return n;function n(r,s,i,a){const l=Array.isArray(i.children),c=Fb(r);return t(s,i,a,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function lW(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&zb.call(t.properties,s)){const i=uW(e,s,t.properties[s]);if(i){const[a,l]=i;e.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&Q5.has(t.tagName)?r=l:n[a]=l}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function cW(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else td(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const l=r.value.data.estree.body[0];l.type,i=e.evaluater.evaluateExpression(l.expression)}else td(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function Hb(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:G5;for(;++r<t.children.length;){const i=t.children[r];let a;if(e.passKeys){const c=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(c){const u=s.get(c)||0;a=c+"-"+u,s.set(c,u+1)}}const l=VP(e,i,a);l!==void 0&&n.push(l)}return n}function uW(e,t,n){const r=m5(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?r5(n):w5(n)),r.property==="style"){let s=typeof n=="object"?n:dW(e,String(n));return e.stylePropertyNameCase==="css"&&(s=fW(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?f5[r.property]||r.property:r.attribute,n]}}function dW(e,t){try{return U5(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new xr("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=WP+"#cannot-parse-style-attribute",s}}function qP(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,a;for(;++i<s.length;){const l=PN(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};a=a?{type:"MemberExpression",object:a,property:l,computed:!!(i&&l.type==="Literal"),optional:!1}:l}r=a}else r=PN(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return zb.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);td(e)}function td(e,t){const n=new xr("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=WP+"#cannot-handle-mdx-estrees-without-createevaluater",n}function fW(e){const t={};let n;for(n in e)zb.call(e,n)&&(t[pW(n)]=e[n]);return t}function pW(e){let t=e.replace(J5,hW);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function hW(e){return"-"+e.toLowerCase()}const Vg={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"]},mW={};function gW(e,t){const n=mW,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return UP(e,r,s)}function UP(e,t,n){if(yW(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 BN(e.children,t,n)}return Array.isArray(e)?BN(e,t,n):""}function BN(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=UP(e[s],t,n);return r.join("")}function yW(e){return!!(e&&typeof e=="object")}const HN=document.createElement("i");function Wb(e){const t="&"+e+";";HN.innerHTML=t;const n=HN.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function yi(e,t,n,r){const s=e.length;let i=0,a;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(t,n),e.splice(...a);else for(n&&e.splice(t,n);i<r.length;)a=r.slice(i,i+1e4),a.unshift(t,0),e.splice(...a),i+=1e4,t+=1e4}function ys(e,t){return e.length>0?(yi(e,e.length,0,t),e):t}const WN={}.hasOwnProperty;function xW(e){const t={};let n=-1;for(;++n<e.length;)wW(t,e[n]);return t}function wW(e,t){let n;for(n in t){const s=(WN.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let a;if(i)for(a in i){WN.call(s,a)||(s[a]=[]);const l=i[a];bW(s[a],Array.isArray(l)?l:l?[l]:[])}}}function bW(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);yi(e,0,0,r)}function YP(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 Fl(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const ai=Vo(/[A-Za-z]/),ts=Vo(/[\dA-Za-z]/),kW=Vo(/[#-'*+\--9=?A-Z^-~]/);function Kx(e){return e!==null&&(e<32||e===127)}const qx=Vo(/\d/),vW=Vo(/[\dA-Fa-f]/),SW=Vo(/[!-/:-@[-`{-~]/);function ft(e){return e!==null&&e<-2}function Wr(e){return e!==null&&(e<0||e===32)}function Ht(e){return e===-2||e===-1||e===32}const NW=Vo(new RegExp("\\p{P}|\\p{S}","u")),jW=Vo(/\s/);function Vo(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function dc(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let a="";if(i===37&&ts(e.charCodeAt(n+1))&&ts(e.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(a=String.fromCharCode(i));else if(i>55295&&i<57344){const l=e.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(a=String.fromCharCode(i,l),s=1):a="�"}else a=String.fromCharCode(i);a&&(t.push(e.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function un(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return Ht(c)?(e.enter(n),l(c)):t(c)}function l(c){return Ht(c)&&i++<s?(e.consume(c),l):(e.exit(n),t(c))}}const CW={tokenize:_W};function _W(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),un(e,t,"linePrefix")}function s(l){return e.enter("paragraph"),i(l)}function i(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,a(l)}function a(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return ft(l)?(e.consume(l),e.exit("chunkText"),i):(e.consume(l),a)}}const EW={tokenize:AW},VN={tokenize:PW};function AW(e){const t=this,n=[];let r=0,s,i,a;return l;function l(x){if(r<n.length){const C=n[r];return t.containerState=C[1],e.attempt(C[0].continuation,c,u)(x)}return u(x)}function c(x){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&v();const C=t.events.length;let N=C,j;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){j=t.events[N][1].end;break}y(r);let E=C;for(;E<t.events.length;)t.events[E][1].end={...j},E++;return yi(t.events,N+1,0,t.events.slice(C)),t.events.length=E,u(x)}return l(x)}function u(x){if(r===n.length){if(!s)return f(x);if(s.currentConstruct&&s.currentConstruct.concrete)return g(x);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(VN,p,d)(x)}function p(x){return s&&v(),y(r),f(x)}function d(x){return t.parser.lazy[t.now().line]=r!==n.length,a=t.now().offset,g(x)}function f(x){return t.containerState={},e.attempt(VN,h,g)(x)}function h(x){return r++,n.push([t.currentConstruct,t.containerState]),f(x)}function g(x){if(x===null){s&&v(),y(0),e.consume(x);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),k(x)}function k(x){if(x===null){w(e.exit("chunkFlow"),!0),y(0),e.consume(x);return}return ft(x)?(e.consume(x),w(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(x),k)}function w(x,C){const N=t.sliceStream(x);if(C&&N.push(null),x.previous=i,i&&(i.next=x),i=x,s.defineSkip(x.start),s.write(N),t.parser.lazy[x.start.line]){let j=s.events.length;for(;j--;)if(s.events[j][1].start.offset<a&&(!s.events[j][1].end||s.events[j][1].end.offset>a))return;const E=t.events.length;let P=E,O,B;for(;P--;)if(t.events[P][0]==="exit"&&t.events[P][1].type==="chunkFlow"){if(O){B=t.events[P][1].end;break}O=!0}for(y(r),j=E;j<t.events.length;)t.events[j][1].end={...B},j++;yi(t.events,P+1,0,t.events.slice(E)),t.events.length=j}}function y(x){let C=n.length;for(;C-- >x;){const N=n[C];t.containerState=N[1],N[0].exit.call(t,e)}n.length=x}function v(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function PW(e,t,n){return un(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function KN(e){if(e===null||Wr(e)||jW(e))return 1;if(NW(e))return 2}function Vb(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const Ux={name:"attention",resolveAll:IW,tokenize:TW};function IW(e,t){let n=-1,r,s,i,a,l,c,u,p;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},f={...e[n][1].start};qN(d,-c),qN(f,c),a={type:c>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},i={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},e[r][1].end={...a.start},e[n][1].start={...l.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=ys(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=ys(u,[["enter",s,t],["enter",a,t],["exit",a,t],["enter",i,t]]),u=ys(u,Vb(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=ys(u,[["exit",i,t],["enter",l,t],["exit",l,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(p=2,u=ys(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):p=0,yi(e,r-1,n-r+3,u),n=r+u.length-p-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function TW(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=KN(r);let i;return a;function a(c){return i=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===i)return e.consume(c),l;const u=e.exit("attentionSequence"),p=KN(c),d=!p||p===2&&s||n.includes(c),f=!s||s===2&&p||n.includes(r);return u._open=!!(i===42?d:d&&(s||!f)),u._close=!!(i===42?f:f&&(p||!d)),t(c)}}function qN(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const RW={name:"autolink",tokenize:MW};function MW(e,t,n){let r=0;return s;function s(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(h){return ai(h)?(e.consume(h),a):h===64?n(h):u(h)}function a(h){return h===43||h===45||h===46||ts(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||ts(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||Kx(h)?n(h):(e.consume(h),c)}function u(h){return h===64?(e.consume(h),p):kW(h)?(e.consume(h),u):n(h)}function p(h){return ts(h)?d(h):n(h)}function d(h){return h===46?(e.consume(h),r=0,p):h===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.exit("autolink"),t):f(h)}function f(h){if((h===45||ts(h))&&r++<63){const g=h===45?f:d;return e.consume(h),g}return n(h)}}const fm={partial:!0,tokenize:$W};function $W(e,t,n){return r;function r(i){return Ht(i)?un(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||ft(i)?t(i):n(i)}}const GP={continuation:{tokenize:OW},exit:DW,name:"blockQuote",tokenize:LW};function LW(e,t,n){const r=this;return s;function s(a){if(a===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(a),e.exit("blockQuoteMarker"),i}return n(a)}function i(a){return Ht(a)?(e.enter("blockQuotePrefixWhitespace"),e.consume(a),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(a))}}function OW(e,t,n){const r=this;return s;function s(a){return Ht(a)?un(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a):i(a)}function i(a){return e.attempt(GP,t,n)(a)}}function DW(e){e.exit("blockQuote")}const JP={name:"characterEscape",tokenize:FW};function FW(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return SW(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const XP={name:"characterReference",tokenize:zW};function zW(e,t,n){const r=this;let s=0,i,a;return l;function l(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),c}function c(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),i=31,a=ts,p(d))}function u(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,a=vW,p):(e.enter("characterReferenceValue"),i=7,a=qx,p(d))}function p(d){if(d===59&&s){const f=e.exit("characterReferenceValue");return a===ts&&!Wb(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return a(d)&&s++<i?(e.consume(d),p):n(d)}}const UN={partial:!0,tokenize:HW},YN={concrete:!0,name:"codeFenced",tokenize:BW};function BW(e,t,n){const r=this,s={partial:!0,tokenize:N};let i=0,a=0,l;return c;function c(j){return u(j)}function u(j){const E=r.events[r.events.length-1];return i=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,l=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),p(j)}function p(j){return j===l?(a++,e.consume(j),p):a<3?n(j):(e.exit("codeFencedFenceSequence"),Ht(j)?un(e,d,"whitespace")(j):d(j))}function d(j){return j===null||ft(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(UN,k,C)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(j))}function f(j){return j===null||ft(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(j)):Ht(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),un(e,h,"whitespace")(j)):j===96&&j===l?n(j):(e.consume(j),f)}function h(j){return j===null||ft(j)?d(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(j))}function g(j){return j===null||ft(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(j)):j===96&&j===l?n(j):(e.consume(j),g)}function k(j){return e.attempt(s,C,w)(j)}function w(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),y}function y(j){return i>0&&Ht(j)?un(e,v,"linePrefix",i+1)(j):v(j)}function v(j){return j===null||ft(j)?e.check(UN,k,C)(j):(e.enter("codeFlowValue"),x(j))}function x(j){return j===null||ft(j)?(e.exit("codeFlowValue"),v(j)):(e.consume(j),x)}function C(j){return e.exit("codeFenced"),t(j)}function N(j,E,P){let O=0;return B;function B(K){return j.enter("lineEnding"),j.consume(K),j.exit("lineEnding"),W}function W(K){return j.enter("codeFencedFence"),Ht(K)?un(j,z,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(K):z(K)}function z(K){return K===l?(j.enter("codeFencedFenceSequence"),L(K)):P(K)}function L(K){return K===l?(O++,j.consume(K),L):O>=a?(j.exit("codeFencedFenceSequence"),Ht(K)?un(j,R,"whitespace")(K):R(K)):P(K)}function R(K){return K===null||ft(K)?(j.exit("codeFencedFence"),E(K)):P(K)}}}function HW(e,t,n){const r=this;return s;function s(a){return a===null?n(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}const Kg={name:"codeIndented",tokenize:VW},WW={partial:!0,tokenize:KW};function VW(e,t,n){const r=this;return s;function s(u){return e.enter("codeIndented"),un(e,i,"linePrefix",5)(u)}function i(u){const p=r.events[r.events.length-1];return p&&p[1].type==="linePrefix"&&p[2].sliceSerialize(p[1],!0).length>=4?a(u):n(u)}function a(u){return u===null?c(u):ft(u)?e.attempt(WW,a,c)(u):(e.enter("codeFlowValue"),l(u))}function l(u){return u===null||ft(u)?(e.exit("codeFlowValue"),a(u)):(e.consume(u),l)}function c(u){return e.exit("codeIndented"),t(u)}}function KW(e,t,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):ft(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s):un(e,i,"linePrefix",5)(a)}function i(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):ft(a)?s(a):n(a)}}const qW={name:"codeText",previous:YW,resolve:UW,tokenize:GW};function UW(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 YW(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function GW(e,t,n){let r=0,s,i;return a;function a(d){return e.enter("codeText"),e.enter("codeTextSequence"),l(d)}function l(d){return d===96?(e.consume(d),r++,l):(e.exit("codeTextSequence"),c(d))}function c(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),c):d===96?(i=e.enter("codeTextSequence"),s=0,p(d)):ft(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),c):(e.enter("codeTextData"),u(d))}function u(d){return d===null||d===32||d===96||ft(d)?(e.exit("codeTextData"),c(d)):(e.consume(d),u)}function p(d){return d===96?(e.consume(d),s++,p):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(i.type="codeTextData",u(d))}}class JW{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Kc(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Kc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Kc(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);Kc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Kc(this.left,n.reverse())}}}function Kc(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 QP(e){const t={};let n=-1,r,s,i,a,l,c,u;const p=new JW(e);for(;++n<p.length;){for(;n in t;)n=t[n];if(r=p.get(n),n&&r[1].type==="chunkFlow"&&p.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type==="lineEndingBlank"&&(i+=2),i<c.length&&c[i][1].type==="content"))for(;++i<c.length&&c[i][1].type!=="content";)c[i][1].type==="chunkText"&&(c[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,XW(p,n)),n=t[n],u=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(a=p.get(i),a[1].type==="lineEnding"||a[1].type==="lineEndingBlank")a[0]==="enter"&&(s&&(p.get(s)[1].type="lineEndingBlank"),a[1].type="lineEnding",s=i);else if(!(a[1].type==="linePrefix"||a[1].type==="listItemIndent"))break;s&&(r[1].end={...p.get(s)[1].start},l=p.slice(s,n),l.unshift(r),p.splice(s,n-s+1,l))}}return yi(e,0,Number.POSITIVE_INFINITY,p.slice(0)),!u}function XW(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let a=n._tokenizer;a||(a=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(a._contentTypeTextTrailing=!0));const l=a.events,c=[],u={};let p,d,f=-1,h=n,g=0,k=0;const w=[k];for(;h;){for(;e.get(++s)[1]!==h;);i.push(s),h._tokenizer||(p=r.sliceStream(h),h.next||p.push(null),d&&a.defineSkip(h.start),h._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=!0),a.write(p),h._isInFirstContentOfListItem&&(a._gfmTasklistFirstContentOfListItem=void 0)),d=h,h=h.next}for(h=n;++f<l.length;)l[f][0]==="exit"&&l[f-1][0]==="enter"&&l[f][1].type===l[f-1][1].type&&l[f][1].start.line!==l[f][1].end.line&&(k=f+1,w.push(k),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(a.events=[],h?(h._tokenizer=void 0,h.previous=void 0):w.pop(),f=w.length;f--;){const y=l.slice(w[f],w[f+1]),v=i.pop();c.push([v,v+y.length-1]),e.splice(v,2,y)}for(c.reverse(),f=-1;++f<c.length;)u[g+c[f][0]]=g+c[f][1],g+=c[f][1]-c[f][0]-1;return u}const QW={resolve:e6,tokenize:t6},ZW={partial:!0,tokenize:n6};function e6(e){return QP(e),e}function t6(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(l)}function s(l){return l===null?i(l):ft(l)?e.check(ZW,a,i)(l):(e.consume(l),s)}function i(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function a(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function n6(e,t,n){const r=this;return s;function s(a){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),un(e,i,"linePrefix")}function i(a){if(a===null||ft(a))return n(a);const l=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(a):e.interrupt(r.parser.constructs.flow,n,t)(a)}}function ZP(e,t,n,r,s,i,a,l,c){const u=c||Number.POSITIVE_INFINITY;let p=0;return d;function d(y){return y===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(y),e.exit(i),f):y===null||y===32||y===41||Kx(y)?n(y):(e.enter(r),e.enter(a),e.enter(l),e.enter("chunkString",{contentType:"string"}),k(y))}function f(y){return y===62?(e.enter(i),e.consume(y),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===62?(e.exit("chunkString"),e.exit(l),f(y)):y===null||y===60||ft(y)?n(y):(e.consume(y),y===92?g:h)}function g(y){return y===60||y===62||y===92?(e.consume(y),h):h(y)}function k(y){return!p&&(y===null||y===41||Wr(y))?(e.exit("chunkString"),e.exit(l),e.exit(a),e.exit(r),t(y)):p<u&&y===40?(e.consume(y),p++,k):y===41?(e.consume(y),p--,k):y===null||y===32||y===40||Kx(y)?n(y):(e.consume(y),y===92?w:k)}function w(y){return y===40||y===41||y===92?(e.consume(y),k):k(y)}}function eI(e,t,n,r,s,i){const a=this;let l=0,c;return u;function u(h){return e.enter(r),e.enter(s),e.consume(h),e.exit(s),e.enter(i),p}function p(h){return l>999||h===null||h===91||h===93&&!c||h===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(h):h===93?(e.exit(i),e.enter(s),e.consume(h),e.exit(s),e.exit(r),t):ft(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),p):(e.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===null||h===91||h===93||ft(h)||l++>999?(e.exit("chunkString"),p(h)):(e.consume(h),c||(c=!Ht(h)),h===92?f:d)}function f(h){return h===91||h===92||h===93?(e.consume(h),l++,d):d(h)}}function tI(e,t,n,r,s,i){let a;return l;function l(f){return f===34||f===39||f===40?(e.enter(r),e.enter(s),e.consume(f),e.exit(s),a=f===40?41:f,c):n(f)}function c(f){return f===a?(e.enter(s),e.consume(f),e.exit(s),e.exit(r),t):(e.enter(i),u(f))}function u(f){return f===a?(e.exit(i),c(a)):f===null?n(f):ft(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),un(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),p(f))}function p(f){return f===a||f===null||ft(f)?(e.exit("chunkString"),u(f)):(e.consume(f),f===92?d:p)}function d(f){return f===a||f===92?(e.consume(f),p):p(f)}}function vu(e,t){let n;return r;function r(s){return ft(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Ht(s)?un(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const r6={name:"definition",tokenize:i6},s6={partial:!0,tokenize:o6};function i6(e,t,n){const r=this;let s;return i;function i(h){return e.enter("definition"),a(h)}function a(h){return eI.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function l(h){return s=Fl(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 Wr(h)?vu(e,u)(h):u(h)}function u(h){return ZP(e,p,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function p(h){return e.attempt(s6,d,d)(h)}function d(h){return Ht(h)?un(e,f,"whitespace")(h):f(h)}function f(h){return h===null||ft(h)?(e.exit("definition"),r.parser.defined.push(s),t(h)):n(h)}}function o6(e,t,n){return r;function r(l){return Wr(l)?vu(e,s)(l):n(l)}function s(l){return tI(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Ht(l)?un(e,a,"whitespace")(l):a(l)}function a(l){return l===null||ft(l)?t(l):n(l)}}const a6={name:"hardBreakEscape",tokenize:l6};function l6(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return ft(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const c6={name:"headingAtx",resolve:u6,tokenize:d6};function u6(e,t){let n=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},yi(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function d6(e,t,n){let r=0;return s;function s(p){return e.enter("atxHeading"),i(p)}function i(p){return e.enter("atxHeadingSequence"),a(p)}function a(p){return p===35&&r++<6?(e.consume(p),a):p===null||Wr(p)?(e.exit("atxHeadingSequence"),l(p)):n(p)}function l(p){return p===35?(e.enter("atxHeadingSequence"),c(p)):p===null||ft(p)?(e.exit("atxHeading"),t(p)):Ht(p)?un(e,l,"whitespace")(p):(e.enter("atxHeadingText"),u(p))}function c(p){return p===35?(e.consume(p),c):(e.exit("atxHeadingSequence"),l(p))}function u(p){return p===null||p===35||Wr(p)?(e.exit("atxHeadingText"),l(p)):(e.consume(p),u)}}const f6=["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"],GN=["pre","script","style","textarea"],p6={concrete:!0,name:"htmlFlow",resolveTo:g6,tokenize:y6},h6={partial:!0,tokenize:w6},m6={partial:!0,tokenize:x6};function g6(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 y6(e,t,n){const r=this;let s,i,a,l,c;return u;function u(T){return p(T)}function p(T){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(T),d}function d(T){return T===33?(e.consume(T),f):T===47?(e.consume(T),i=!0,k):T===63?(e.consume(T),s=3,r.interrupt?t:_):ai(T)?(e.consume(T),a=String.fromCharCode(T),w):n(T)}function f(T){return T===45?(e.consume(T),s=2,h):T===91?(e.consume(T),s=5,l=0,g):ai(T)?(e.consume(T),s=4,r.interrupt?t:_):n(T)}function h(T){return T===45?(e.consume(T),r.interrupt?t:_):n(T)}function g(T){const ee="CDATA[";return T===ee.charCodeAt(l++)?(e.consume(T),l===ee.length?r.interrupt?t:z:g):n(T)}function k(T){return ai(T)?(e.consume(T),a=String.fromCharCode(T),w):n(T)}function w(T){if(T===null||T===47||T===62||Wr(T)){const ee=T===47,ie=a.toLowerCase();return!ee&&!i&&GN.includes(ie)?(s=1,r.interrupt?t(T):z(T)):f6.includes(a.toLowerCase())?(s=6,ee?(e.consume(T),y):r.interrupt?t(T):z(T)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(T):i?v(T):x(T))}return T===45||ts(T)?(e.consume(T),a+=String.fromCharCode(T),w):n(T)}function y(T){return T===62?(e.consume(T),r.interrupt?t:z):n(T)}function v(T){return Ht(T)?(e.consume(T),v):B(T)}function x(T){return T===47?(e.consume(T),B):T===58||T===95||ai(T)?(e.consume(T),C):Ht(T)?(e.consume(T),x):B(T)}function C(T){return T===45||T===46||T===58||T===95||ts(T)?(e.consume(T),C):N(T)}function N(T){return T===61?(e.consume(T),j):Ht(T)?(e.consume(T),N):x(T)}function j(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(e.consume(T),c=T,E):Ht(T)?(e.consume(T),j):P(T)}function E(T){return T===c?(e.consume(T),c=null,O):T===null||ft(T)?n(T):(e.consume(T),E)}function P(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||Wr(T)?N(T):(e.consume(T),P)}function O(T){return T===47||T===62||Ht(T)?x(T):n(T)}function B(T){return T===62?(e.consume(T),W):n(T)}function W(T){return T===null||ft(T)?z(T):Ht(T)?(e.consume(T),W):n(T)}function z(T){return T===45&&s===2?(e.consume(T),D):T===60&&s===1?(e.consume(T),$):T===62&&s===4?(e.consume(T),X):T===63&&s===3?(e.consume(T),_):T===93&&s===5?(e.consume(T),F):ft(T)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(h6,V,L)(T)):T===null||ft(T)?(e.exit("htmlFlowData"),L(T)):(e.consume(T),z)}function L(T){return e.check(m6,R,V)(T)}function R(T){return e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),K}function K(T){return T===null||ft(T)?L(T):(e.enter("htmlFlowData"),z(T))}function D(T){return T===45?(e.consume(T),_):z(T)}function $(T){return T===47?(e.consume(T),a="",I):z(T)}function I(T){if(T===62){const ee=a.toLowerCase();return GN.includes(ee)?(e.consume(T),X):z(T)}return ai(T)&&a.length<8?(e.consume(T),a+=String.fromCharCode(T),I):z(T)}function F(T){return T===93?(e.consume(T),_):z(T)}function _(T){return T===62?(e.consume(T),X):T===45&&s===2?(e.consume(T),_):z(T)}function X(T){return T===null||ft(T)?(e.exit("htmlFlowData"),V(T)):(e.consume(T),X)}function V(T){return e.exit("htmlFlow"),t(T)}}function x6(e,t,n){const r=this;return s;function s(a){return ft(a)?(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function w6(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(fm,t,n)}}const b6={name:"htmlText",tokenize:k6};function k6(e,t,n){const r=this;let s,i,a;return l;function l(_){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(_),c}function c(_){return _===33?(e.consume(_),u):_===47?(e.consume(_),N):_===63?(e.consume(_),x):ai(_)?(e.consume(_),P):n(_)}function u(_){return _===45?(e.consume(_),p):_===91?(e.consume(_),i=0,g):ai(_)?(e.consume(_),v):n(_)}function p(_){return _===45?(e.consume(_),h):n(_)}function d(_){return _===null?n(_):_===45?(e.consume(_),f):ft(_)?(a=d,$(_)):(e.consume(_),d)}function f(_){return _===45?(e.consume(_),h):d(_)}function h(_){return _===62?D(_):_===45?f(_):d(_)}function g(_){const X="CDATA[";return _===X.charCodeAt(i++)?(e.consume(_),i===X.length?k:g):n(_)}function k(_){return _===null?n(_):_===93?(e.consume(_),w):ft(_)?(a=k,$(_)):(e.consume(_),k)}function w(_){return _===93?(e.consume(_),y):k(_)}function y(_){return _===62?D(_):_===93?(e.consume(_),y):k(_)}function v(_){return _===null||_===62?D(_):ft(_)?(a=v,$(_)):(e.consume(_),v)}function x(_){return _===null?n(_):_===63?(e.consume(_),C):ft(_)?(a=x,$(_)):(e.consume(_),x)}function C(_){return _===62?D(_):x(_)}function N(_){return ai(_)?(e.consume(_),j):n(_)}function j(_){return _===45||ts(_)?(e.consume(_),j):E(_)}function E(_){return ft(_)?(a=E,$(_)):Ht(_)?(e.consume(_),E):D(_)}function P(_){return _===45||ts(_)?(e.consume(_),P):_===47||_===62||Wr(_)?O(_):n(_)}function O(_){return _===47?(e.consume(_),D):_===58||_===95||ai(_)?(e.consume(_),B):ft(_)?(a=O,$(_)):Ht(_)?(e.consume(_),O):D(_)}function B(_){return _===45||_===46||_===58||_===95||ts(_)?(e.consume(_),B):W(_)}function W(_){return _===61?(e.consume(_),z):ft(_)?(a=W,$(_)):Ht(_)?(e.consume(_),W):O(_)}function z(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),s=_,L):ft(_)?(a=z,$(_)):Ht(_)?(e.consume(_),z):(e.consume(_),R)}function L(_){return _===s?(e.consume(_),s=void 0,K):_===null?n(_):ft(_)?(a=L,$(_)):(e.consume(_),L)}function R(_){return _===null||_===34||_===39||_===60||_===61||_===96?n(_):_===47||_===62||Wr(_)?O(_):(e.consume(_),R)}function K(_){return _===47||_===62||Wr(_)?O(_):n(_)}function D(_){return _===62?(e.consume(_),e.exit("htmlTextData"),e.exit("htmlText"),t):n(_)}function $(_){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),I}function I(_){return Ht(_)?un(e,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):F(_)}function F(_){return e.enter("htmlTextData"),a(_)}}const Kb={name:"labelEnd",resolveAll:j6,resolveTo:C6,tokenize:_6},v6={tokenize:E6},S6={tokenize:A6},N6={tokenize:P6};function j6(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&&yi(e,0,e.length,n),e}function C6(e,t){let n=e.length,r=0,s,i,a,l;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(a){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(a=n);const c={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[i][1].start},end:{...e[a][1].end}},p={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[a-2][1].start}};return l=[["enter",c,t],["enter",u,t]],l=ys(l,e.slice(i+1,i+r+3)),l=ys(l,[["enter",p,t]]),l=ys(l,Vb(t.parser.constructs.insideSpan.null,e.slice(i+r+4,a-3),t)),l=ys(l,[["exit",p,t],e[a-2],e[a-1],["exit",u,t]]),l=ys(l,e.slice(a+1)),l=ys(l,[["exit",c,t]]),yi(e,i,e.length,l),e}function _6(e,t,n){const r=this;let s=r.events.length,i,a;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return l;function l(f){return i?i._inactive?d(f):(a=r.parser.defined.includes(Fl(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),c):n(f)}function c(f){return f===40?e.attempt(v6,p,a?p:d)(f):f===91?e.attempt(S6,p,a?u:d)(f):a?p(f):d(f)}function u(f){return e.attempt(N6,p,d)(f)}function p(f){return t(f)}function d(f){return i._balanced=!0,n(f)}}function E6(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),s}function s(d){return Wr(d)?vu(e,i)(d):i(d)}function i(d){return d===41?p(d):ZP(e,a,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function a(d){return Wr(d)?vu(e,c)(d):p(d)}function l(d){return n(d)}function c(d){return d===34||d===39||d===40?tI(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):p(d)}function u(d){return Wr(d)?vu(e,p)(d):p(d)}function p(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function A6(e,t,n){const r=this;return s;function s(l){return eI.call(r,e,i,a,"reference","referenceMarker","referenceString")(l)}function i(l){return r.parser.defined.includes(Fl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function a(l){return n(l)}}function P6(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const I6={name:"labelStartImage",resolveAll:Kb.resolveAll,tokenize:T6};function T6(e,t,n){const r=this;return s;function s(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),i}function i(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),a):n(l)}function a(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const R6={name:"labelStartLink",resolveAll:Kb.resolveAll,tokenize:M6};function M6(e,t,n){const r=this;return s;function s(a){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelLink"),i}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const qg={name:"lineEnding",tokenize:$6};function $6(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),un(e,t,"linePrefix")}}const Sp={name:"thematicBreak",tokenize:L6};function L6(e,t,n){let r=0,s;return i;function i(u){return e.enter("thematicBreak"),a(u)}function a(u){return s=u,l(u)}function l(u){return u===s?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||ft(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===s?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),Ht(u)?un(e,l,"whitespace")(u):l(u))}}const Mr={continuation:{tokenize:z6},exit:H6,name:"list",tokenize:F6},O6={partial:!0,tokenize:W6},D6={partial:!0,tokenize:B6};function F6(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return l;function l(h){const g=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:qx(h)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(Sp,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 qx(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(fm,r.interrupt?n:p,e.attempt(O6,f,d))}function p(h){return r.containerState.initialBlankLine=!0,i++,f(h)}function d(h){return Ht(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),f):n(h)}function f(h){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function z6(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(fm,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,un(e,t,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Ht(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(D6,t,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,un(e,e.attempt(Mr,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function B6(e,t,n){const r=this;return un(e,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?t(i):n(i)}}function H6(e){e.exit(this.containerState.type)}function W6(e,t,n){const r=this;return un(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!Ht(i)&&a&&a[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const JN={name:"setextUnderline",resolveTo:V6,tokenize:K6};function V6(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",a,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=a,e.push(["exit",a,t]),e}function K6(e,t,n){const r=this;let s;return i;function i(u){let p=r.events.length,d;for(;p--;)if(r.events[p][1].type!=="lineEnding"&&r.events[p][1].type!=="linePrefix"&&r.events[p][1].type!=="content"){d=r.events[p][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(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"),Ht(u)?un(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||ft(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}const q6={tokenize:U6};function U6(e){const t=this,n=e.attempt(fm,r,e.attempt(this.parser.constructs.flowInitial,s,un(e,e.attempt(this.parser.constructs.flow,s,e.attempt(QW,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const Y6={resolveAll:rI()},G6=nI("string"),J6=nI("text");function nI(e){return{resolveAll:rI(e==="text"?X6:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,a,l);return a;function a(p){return u(p)?i(p):l(p)}function l(p){if(p===null){n.consume(p);return}return n.enter("data"),n.consume(p),c}function c(p){return u(p)?(n.exit("data"),i(p)):(n.consume(p),c)}function u(p){if(p===null)return!0;const d=s[p];let f=-1;if(d)for(;++f<d.length;){const h=d[f];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function rI(e){return t;function t(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(n,r):n}}function X6(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let i=s.length,a=-1,l=0,c;for(;i--;){const u=s[i];if(typeof u=="string"){for(a=u.length;u.charCodeAt(a-1)===32;)l++,a--;if(a)break;a=-1}else if(u===-2)c=!0,l++;else if(u!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const u={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?a:r.start._bufferIndex+a,_index:r.start._index+i,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}const Q6={42:Mr,43:Mr,45:Mr,48:Mr,49:Mr,50:Mr,51:Mr,52:Mr,53:Mr,54:Mr,55:Mr,56:Mr,57:Mr,62:GP},Z6={91:r6},e8={[-2]:Kg,[-1]:Kg,32:Kg},t8={35:c6,42:Sp,45:[JN,Sp],60:p6,61:JN,95:Sp,96:YN,126:YN},n8={38:XP,92:JP},r8={[-5]:qg,[-4]:qg,[-3]:qg,33:I6,38:XP,42:Ux,60:[RW,b6],91:R6,92:[a6,JP],93:Kb,95:Ux,96:qW},s8={null:[Ux,Y6]},i8={null:[42,95]},o8={null:[]},a8=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:i8,contentInitial:Z6,disable:o8,document:Q6,flow:t8,flowInitial:e8,insideSpan:s8,string:n8,text:r8},Symbol.toStringTag,{value:"Module"}));function l8(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let a=[],l=[];const c={attempt:E(N),check:E(j),consume:v,enter:x,exit:C,interrupt:E(j,{interrupt:!0})},u={code:null,containerState:{},defineSkip:k,events:[],now:g,parser:e,previous:null,sliceSerialize:f,sliceStream:h,write:d};let p=t.tokenize.call(u,c);return t.resolveAll&&i.push(t),u;function d(W){return a=ys(a,W),w(),a[a.length-1]!==null?[]:(P(t,0),u.events=Vb(i,u.events,u),u.events)}function f(W,z){return u8(h(W),z)}function h(W){return c8(a,W)}function g(){const{_bufferIndex:W,_index:z,line:L,column:R,offset:K}=r;return{_bufferIndex:W,_index:z,line:L,column:R,offset:K}}function k(W){s[W.line]=W.column,B()}function w(){let W;for(;r._index<a.length;){const z=a[r._index];if(typeof z=="string")for(W=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===W&&r._bufferIndex<z.length;)y(z.charCodeAt(r._bufferIndex));else y(z)}}function y(W){p=p(W)}function v(W){ft(W)?(r.line++,r.column=1,r.offset+=W===-3?2:1,B()):W!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===a[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=W}function x(W,z){const L=z||{};return L.type=W,L.start=g(),u.events.push(["enter",L,u]),l.push(L),L}function C(W){const z=l.pop();return z.end=g(),u.events.push(["exit",z,u]),z}function N(W,z){P(W,z.from)}function j(W,z){z.restore()}function E(W,z){return L;function L(R,K,D){let $,I,F,_;return Array.isArray(R)?V(R):"tokenize"in R?V([R]):X(R);function X(G){return se;function se(te){const re=te!==null&&G[te],ne=te!==null&&G.null,ce=[...Array.isArray(re)?re:re?[re]:[],...Array.isArray(ne)?ne:ne?[ne]:[]];return V(ce)(te)}}function V(G){return $=G,I=0,G.length===0?D:T(G[I])}function T(G){return se;function se(te){return _=O(),F=G,G.partial||(u.currentConstruct=G),G.name&&u.parser.constructs.disable.null.includes(G.name)?ie():G.tokenize.call(z?Object.assign(Object.create(u),z):u,c,ee,ie)(te)}}function ee(G){return W(F,_),K}function ie(G){return _.restore(),++I<$.length?T($[I]):D}}}function P(W,z){W.resolveAll&&!i.includes(W)&&i.push(W),W.resolve&&yi(u.events,z,u.events.length-z,W.resolve(u.events.slice(z),u)),W.resolveTo&&(u.events=W.resolveTo(u.events,u))}function O(){const W=g(),z=u.previous,L=u.currentConstruct,R=u.events.length,K=Array.from(l);return{from:R,restore:D};function D(){r=W,u.previous=z,u.currentConstruct=L,u.events.length=R,l=K,B()}}function B(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function c8(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let a;if(n===s)a=[e[n].slice(r,i)];else{if(a=e.slice(n,s),r>-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}i>0&&a.push(e[s].slice(0,i))}return a}function u8(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const i=e[n];let a;if(typeof i=="string")a=i;else switch(i){case-5:{a="\r";break}case-4:{a=`
|
|
68
|
-
`;break}case-3:{a=`\r
|
|
69
|
-
`;break}case-2:{a=t?" ":" ";break}case-1:{if(!t&&s)continue;a=" ";break}default:a=String.fromCharCode(i)}s=i===-2,r.push(a)}return r.join("")}function d8(e){const r={constructs:xW([a8,...(e||{}).extensions||[]]),content:s(CW),defined:[],document:s(EW),flow:s(q6),lazy:{},string:s(G6),text:s(J6)};return r;function s(i){return a;function a(l){return l8(r,i,l)}}}function f8(e){for(;!QP(e););return e}const XN=/[\0\t\n\r]/g;function p8(){let e=1,t="",n=!0,r;return s;function s(i,a,l){const c=[];let u,p,d,f,h;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(a||void 0).decode(i)),d=0,t="",n&&(i.charCodeAt(0)===65279&&d++,n=void 0);d<i.length;){if(XN.lastIndex=d,u=XN.exec(i),f=u&&u.index!==void 0?u.index:i.length,h=i.charCodeAt(f),!u){t=i.slice(d);break}if(h===10&&d===f&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),d<f&&(c.push(i.slice(d,f)),e+=f-d),h){case 0:{c.push(65533),e++;break}case 9:{for(p=Math.ceil(e/4)*4,c.push(-2);e++<p;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}d=f+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const h8=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function m8(e){return e.replace(h8,g8)}function g8(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return YP(n.slice(i?2:1),i?16:10)}return Wb(n)||e}const sI={}.hasOwnProperty;function y8(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),x8(n)(f8(d8(n).document().write(p8()(e,t,!0))))}function x8(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(yt),autolinkProtocol:O,autolinkEmail:O,atxHeading:i(Je),blockQuote:i(ne),characterEscape:O,characterReference:O,codeFenced:i(ce),codeFencedFenceInfo:a,codeFencedFenceMeta:a,codeIndented:i(ce,a),codeText:i(de,a),codeTextData:O,data:O,codeFlowValue:O,definition:i(me),definitionDestinationString:a,definitionLabelString:a,definitionTitleString:a,emphasis:i(He),hardBreakEscape:i(Te),hardBreakTrailing:i(Te),htmlFlow:i(ot,a),htmlFlowData:O,htmlText:i(ot,a),htmlTextData:O,image:i(gt),label:a,link:i(yt),listItem:i(dt),listItemValue:f,listOrdered:i(Ae,d),listUnordered:i(Ae),paragraph:i(St),reference:T,referenceString:a,resourceDestinationString:a,resourceTitleString:a,setextHeading:i(Je),strong:i(Wt),thematicBreak:i(et)},exit:{atxHeading:c(),atxHeadingSequence:N,autolink:c(),autolinkEmail:re,autolinkProtocol:te,blockQuote:c(),characterEscapeValue:B,characterReferenceMarkerHexadecimal:ie,characterReferenceMarkerNumeric:ie,characterReferenceValue:G,characterReference:se,codeFenced:c(w),codeFencedFence:k,codeFencedFenceInfo:h,codeFencedFenceMeta:g,codeFlowValue:B,codeIndented:c(y),codeText:c(K),codeTextData:B,data:B,definition:c(),definitionDestinationString:C,definitionLabelString:v,definitionTitleString:x,emphasis:c(),hardBreakEscape:c(z),hardBreakTrailing:c(z),htmlFlow:c(L),htmlFlowData:B,htmlText:c(R),htmlTextData:B,image:c($),label:F,labelText:I,lineEnding:W,link:c(D),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:ee,resourceDestinationString:_,resourceTitleString:X,resource:V,setextHeading:c(P),setextHeadingLineSequence:E,setextHeadingText:j,strong:c(),thematicBreak:c()}};iI(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(fe){let ke={type:"root",children:[]};const Ve={stack:[ke],tokenStack:[],config:t,enter:l,exit:u,buffer:a,resume:p,data:n},Qe=[];let Se=-1;for(;++Se<fe.length;)if(fe[Se][1].type==="listOrdered"||fe[Se][1].type==="listUnordered")if(fe[Se][0]==="enter")Qe.push(Se);else{const _t=Qe.pop();Se=s(fe,_t,Se)}for(Se=-1;++Se<fe.length;){const _t=t[fe[Se][0]];sI.call(_t,fe[Se][1].type)&&_t[fe[Se][1].type].call(Object.assign({sliceSerialize:fe[Se][2].sliceSerialize},Ve),fe[Se][1])}if(Ve.tokenStack.length>0){const _t=Ve.tokenStack[Ve.tokenStack.length-1];(_t[1]||QN).call(Ve,void 0,_t[0])}for(ke.position={start:fo(fe.length>0?fe[0][1].start:{line:1,column:1,offset:0}),end:fo(fe.length>0?fe[fe.length-2][1].end:{line:1,column:1,offset:0})},Se=-1;++Se<t.transforms.length;)ke=t.transforms[Se](ke)||ke;return ke}function s(fe,ke,Ve){let Qe=ke-1,Se=-1,_t=!1,dn,zt,at,fn;for(;++Qe<=Ve;){const Z=fe[Qe];switch(Z[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Z[0]==="enter"?Se++:Se--,fn=void 0;break}case"lineEndingBlank":{Z[0]==="enter"&&(dn&&!fn&&!Se&&!at&&(at=Qe),fn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:fn=void 0}if(!Se&&Z[0]==="enter"&&Z[1].type==="listItemPrefix"||Se===-1&&Z[0]==="exit"&&(Z[1].type==="listUnordered"||Z[1].type==="listOrdered")){if(dn){let Ce=Qe;for(zt=void 0;Ce--;){const Me=fe[Ce];if(Me[1].type==="lineEnding"||Me[1].type==="lineEndingBlank"){if(Me[0]==="exit")continue;zt&&(fe[zt][1].type="lineEndingBlank",_t=!0),Me[1].type="lineEnding",zt=Ce}else if(!(Me[1].type==="linePrefix"||Me[1].type==="blockQuotePrefix"||Me[1].type==="blockQuotePrefixWhitespace"||Me[1].type==="blockQuoteMarker"||Me[1].type==="listItemIndent"))break}at&&(!zt||at<zt)&&(dn._spread=!0),dn.end=Object.assign({},zt?fe[zt][1].start:Z[1].end),fe.splice(zt||Qe,0,["exit",dn,Z[2]]),Qe++,Ve++}if(Z[1].type==="listItemPrefix"){const Ce={type:"listItem",_spread:!1,start:Object.assign({},Z[1].start),end:void 0};dn=Ce,fe.splice(Qe,0,["enter",Ce,Z[2]]),Qe++,Ve++,at=void 0,fn=!0}}}return fe[ke][1]._spread=_t,Ve}function i(fe,ke){return Ve;function Ve(Qe){l.call(this,fe(Qe),Qe),ke&&ke.call(this,Qe)}}function a(){this.stack.push({type:"fragment",children:[]})}function l(fe,ke,Ve){this.stack[this.stack.length-1].children.push(fe),this.stack.push(fe),this.tokenStack.push([ke,Ve||void 0]),fe.position={start:fo(ke.start),end:void 0}}function c(fe){return ke;function ke(Ve){fe&&fe.call(this,Ve),u.call(this,Ve)}}function u(fe,ke){const Ve=this.stack.pop(),Qe=this.tokenStack.pop();if(Qe)Qe[0].type!==fe.type&&(ke?ke.call(this,fe,Qe[0]):(Qe[1]||QN).call(this,fe,Qe[0]));else throw new Error("Cannot close `"+fe.type+"` ("+ku({start:fe.start,end:fe.end})+"): it’s not open");Ve.position.end=fo(fe.end)}function p(){return gW(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(fe){if(this.data.expectingFirstListItemValue){const ke=this.stack[this.stack.length-2];ke.start=Number.parseInt(this.sliceSerialize(fe),10),this.data.expectingFirstListItemValue=void 0}}function h(){const fe=this.resume(),ke=this.stack[this.stack.length-1];ke.lang=fe}function g(){const fe=this.resume(),ke=this.stack[this.stack.length-1];ke.meta=fe}function k(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function w(){const fe=this.resume(),ke=this.stack[this.stack.length-1];ke.value=fe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const fe=this.resume(),ke=this.stack[this.stack.length-1];ke.value=fe.replace(/(\r?\n|\r)$/g,"")}function v(fe){const ke=this.resume(),Ve=this.stack[this.stack.length-1];Ve.label=ke,Ve.identifier=Fl(this.sliceSerialize(fe)).toLowerCase()}function x(){const fe=this.resume(),ke=this.stack[this.stack.length-1];ke.title=fe}function C(){const fe=this.resume(),ke=this.stack[this.stack.length-1];ke.url=fe}function N(fe){const ke=this.stack[this.stack.length-1];if(!ke.depth){const Ve=this.sliceSerialize(fe).length;ke.depth=Ve}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function E(fe){const ke=this.stack[this.stack.length-1];ke.depth=this.sliceSerialize(fe).codePointAt(0)===61?1:2}function P(){this.data.setextHeadingSlurpLineEnding=void 0}function O(fe){const Ve=this.stack[this.stack.length-1].children;let Qe=Ve[Ve.length-1];(!Qe||Qe.type!=="text")&&(Qe=Vt(),Qe.position={start:fo(fe.start),end:void 0},Ve.push(Qe)),this.stack.push(Qe)}function B(fe){const ke=this.stack.pop();ke.value+=this.sliceSerialize(fe),ke.position.end=fo(fe.end)}function W(fe){const ke=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ve=ke.children[ke.children.length-1];Ve.position.end=fo(fe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(ke.type)&&(O.call(this,fe),B.call(this,fe))}function z(){this.data.atHardBreak=!0}function L(){const fe=this.resume(),ke=this.stack[this.stack.length-1];ke.value=fe}function R(){const fe=this.resume(),ke=this.stack[this.stack.length-1];ke.value=fe}function K(){const fe=this.resume(),ke=this.stack[this.stack.length-1];ke.value=fe}function D(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const ke=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=ke,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function $(){const fe=this.stack[this.stack.length-1];if(this.data.inReference){const ke=this.data.referenceType||"shortcut";fe.type+="Reference",fe.referenceType=ke,delete fe.url,delete fe.title}else delete fe.identifier,delete fe.label;this.data.referenceType=void 0}function I(fe){const ke=this.sliceSerialize(fe),Ve=this.stack[this.stack.length-2];Ve.label=m8(ke),Ve.identifier=Fl(ke).toLowerCase()}function F(){const fe=this.stack[this.stack.length-1],ke=this.resume(),Ve=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ve.type==="link"){const Qe=fe.children;Ve.children=Qe}else Ve.alt=ke}function _(){const fe=this.resume(),ke=this.stack[this.stack.length-1];ke.url=fe}function X(){const fe=this.resume(),ke=this.stack[this.stack.length-1];ke.title=fe}function V(){this.data.inReference=void 0}function T(){this.data.referenceType="collapsed"}function ee(fe){const ke=this.resume(),Ve=this.stack[this.stack.length-1];Ve.label=ke,Ve.identifier=Fl(this.sliceSerialize(fe)).toLowerCase(),this.data.referenceType="full"}function ie(fe){this.data.characterReferenceType=fe.type}function G(fe){const ke=this.sliceSerialize(fe),Ve=this.data.characterReferenceType;let Qe;Ve?(Qe=YP(ke,Ve==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Qe=Wb(ke);const Se=this.stack[this.stack.length-1];Se.value+=Qe}function se(fe){const ke=this.stack.pop();ke.position.end=fo(fe.end)}function te(fe){B.call(this,fe);const ke=this.stack[this.stack.length-1];ke.url=this.sliceSerialize(fe)}function re(fe){B.call(this,fe);const ke=this.stack[this.stack.length-1];ke.url="mailto:"+this.sliceSerialize(fe)}function ne(){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 He(){return{type:"emphasis",children:[]}}function Je(){return{type:"heading",depth:0,children:[]}}function Te(){return{type:"break"}}function ot(){return{type:"html",value:""}}function gt(){return{type:"image",title:null,url:"",alt:null}}function yt(){return{type:"link",title:null,url:"",children:[]}}function Ae(fe){return{type:"list",ordered:fe.type==="listOrdered",start:null,spread:fe._spread,children:[]}}function dt(fe){return{type:"listItem",spread:fe._spread,checked:null,children:[]}}function St(){return{type:"paragraph",children:[]}}function Wt(){return{type:"strong",children:[]}}function Vt(){return{type:"text",value:""}}function et(){return{type:"thematicBreak"}}}function fo(e){return{line:e.line,column:e.column,offset:e.offset}}function iI(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?iI(e,r):w8(e,r)}}function w8(e,t){let n;for(n in t)if(sI.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 QN(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+ku({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+ku({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+ku({start:t.start,end:t.end})+") is still open")}function b8(e){const t=this;t.parser=n;function n(r){return y8(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function k8(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 v8(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
70
|
-
`}]}function S8(e,t){const n=t.value?t.value+`
|
|
71
|
-
`:"",r={},s=t.lang?t.lang.split(/\s+/):[];s.length>0&&(r.className=["language-"+s[0]]);let i={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(i.data={meta:t.meta}),e.patch(t,i),i=e.applyData(t,i),i={type:"element",tagName:"pre",properties:{},children:[i]},e.patch(t,i),i}function N8(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function j8(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function C8(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=dc(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let a,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),a=e.footnoteOrder.length):a=i+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};e.patch(t,c);const u={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,u),e.applyData(t,u)}function _8(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 E8(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function oI(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function A8(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return oI(e,t);const s={src:dc(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function P8(e,t){const n={src:dc(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 I8(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 T8(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return oI(e,t);const s={href:dc(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function R8(e,t){const n={href:dc(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 M8(e,t,n){const r=e.all(t),s=n?$8(n):aI(t),i={},a=[];if(typeof t.checked=="boolean"){const p=r[0];let d;p&&p.type==="element"&&p.tagName==="p"?d=p:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const p=r[l];(s||l!==0||p.type!=="element"||p.tagName!=="p")&&a.push({type:"text",value:`
|
|
72
|
-
`}),p.type==="element"&&p.tagName==="p"&&!s?a.push(...p.children):a.push(p)}const c=r[r.length-1];c&&(s||c.type!=="element"||c.tagName!=="p")&&a.push({type:"text",value:`
|
|
73
|
-
`});const u={type:"element",tagName:"li",properties:i,children:a};return e.patch(t,u),e.applyData(t,u)}function $8(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=aI(n[r])}return t}function aI(e){const t=e.spread;return t??e.children.length>1}function L8(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const a=r[s];if(a.type==="element"&&a.tagName==="li"&&a.properties&&Array.isArray(a.properties.className)&&a.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function O8(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function D8(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function F8(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function z8(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=Fb(t.children[1]),c=BP(t.children[t.children.length-1]);l&&c&&(a.position={start:l,end:c}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function B8(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:t.children.length;let c=-1;const u=[];for(;++c<l;){const d=t.children[c],f={},h=a?a[c]:void 0;h&&(f.align=h);let g={type:"element",tagName:i,properties:f,children:[]};d&&(g.children=e.all(d),e.patch(d,g),g=e.applyData(d,g)),u.push(g)}const p={type:"element",tagName:"tr",properties:{},children:e.wrap(u,!0)};return e.patch(t,p),e.applyData(t,p)}function H8(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const ZN=9,ej=32;function W8(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(tj(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(tj(t.slice(s),s>0,!1)),i.join("")}function tj(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===ZN||i===ej;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===ZN||i===ej;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function V8(e,t){const n={type:"text",value:W8(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function K8(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const q8={blockquote:k8,break:v8,code:S8,delete:N8,emphasis:j8,footnoteReference:C8,heading:_8,html:E8,imageReference:A8,image:P8,inlineCode:I8,linkReference:T8,link:R8,listItem:M8,list:L8,paragraph:O8,root:D8,strong:F8,table:z8,tableCell:H8,tableRow:B8,text:V8,thematicBreak:K8,toml:Df,yaml:Df,definition:Df,footnoteDefinition:Df};function Df(){}const lI=-1,pm=0,Su=1,fh=2,qb=3,Ub=4,Yb=5,Gb=6,cI=7,uI=8,nj=typeof self=="object"?self:globalThis,U8=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,a]=t[s];switch(i){case pm:case lI:return n(a,s);case Su:{const l=n([],s);for(const c of a)l.push(r(c));return l}case fh:{const l=n({},s);for(const[c,u]of a)l[r(c)]=r(u);return l}case qb:return n(new Date(a),s);case Ub:{const{source:l,flags:c}=a;return n(new RegExp(l,c),s)}case Yb:{const l=n(new Map,s);for(const[c,u]of a)l.set(r(c),r(u));return l}case Gb:{const l=n(new Set,s);for(const c of a)l.add(r(c));return l}case cI:{const{name:l,message:c}=a;return n(new nj[l](c),s)}case uI: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 nj[i](a),s)};return r},rj=e=>U8(new Map,e)(0),ol="",{toString:Y8}={},{keys:G8}=Object,qc=e=>{const t=typeof e;if(t!=="object"||!e)return[pm,t];const n=Y8.call(e).slice(8,-1);switch(n){case"Array":return[Su,ol];case"Object":return[fh,ol];case"Date":return[qb,ol];case"RegExp":return[Ub,ol];case"Map":return[Yb,ol];case"Set":return[Gb,ol];case"DataView":return[Su,n]}return n.includes("Array")?[Su,n]:n.includes("Error")?[cI,n]:[fh,n]},Ff=([e,t])=>e===pm&&(t==="function"||t==="symbol"),J8=(e,t,n,r)=>{const s=(a,l)=>{const c=r.push(a)-1;return n.set(l,c),c},i=a=>{if(n.has(a))return n.get(a);let[l,c]=qc(a);switch(l){case pm:{let p=a;switch(c){case"bigint":l=uI,p=a.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);p=null;break;case"undefined":return s([lI],a)}return s([l,p],a)}case Su:{if(c){let f=a;return c==="DataView"?f=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(f=new Uint8Array(a)),s([c,[...f]],a)}const p=[],d=s([l,p],a);for(const f of a)p.push(i(f));return d}case fh:{if(c)switch(c){case"BigInt":return s([c,a.toString()],a);case"Boolean":case"Number":case"String":return s([c,a.valueOf()],a)}if(t&&"toJSON"in a)return i(a.toJSON());const p=[],d=s([l,p],a);for(const f of G8(a))(e||!Ff(qc(a[f])))&&p.push([i(f),i(a[f])]);return d}case qb:return s([l,a.toISOString()],a);case Ub:{const{source:p,flags:d}=a;return s([l,{source:p,flags:d}],a)}case Yb:{const p=[],d=s([l,p],a);for(const[f,h]of a)(e||!(Ff(qc(f))||Ff(qc(h))))&&p.push([i(f),i(h)]);return d}case Gb:{const p=[],d=s([l,p],a);for(const f of a)(e||!Ff(qc(f)))&&p.push(i(f));return d}}const{message:u}=a;return s([l,{name:c,message:u}],a)};return i},sj=(e,{json:t,lossy:n}={})=>{const r=[];return J8(!(t||n),!!t,new Map,r)(e),r},ph=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?rj(sj(e,t)):structuredClone(e):(e,t)=>rj(sj(e,t));function X8(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 Q8(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Z8(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||X8,r=e.options.footnoteBackLabel||Q8,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",a=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const u=e.footnoteById.get(e.footnoteOrder[c]);if(!u)continue;const p=e.all(u),d=String(u.identifier).toUpperCase(),f=dc(d.toLowerCase());let h=0;const g=[],k=e.footnoteCounts.get(d);for(;k!==void 0&&++h<=k;){g.length>0&&g.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,h);typeof v=="string"&&(v={type:"text",value:v}),g.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,h),className:["data-footnote-backref"]},children:Array.isArray(v)?v:[v]})}const w=p[p.length-1];if(w&&w.type==="element"&&w.tagName==="p"){const v=w.children[w.children.length-1];v&&v.type==="text"?v.value+=" ":w.children.push({type:"text",value:" "}),w.children.push(...g)}else p.push(...g);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(p,!0)};e.patch(u,y),l.push(y)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...ph(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 dI=function(e){if(e==null)return r9;if(typeof e=="function")return hm(e);if(typeof e=="object")return Array.isArray(e)?e9(e):t9(e);if(typeof e=="string")return n9(e);throw new Error("Expected function, string, or object as test")};function e9(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=dI(e[n]);return hm(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function t9(e){const t=e;return hm(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function n9(e){return hm(t);function t(n){return n&&n.type===e}}function hm(e){return t;function t(n,r,s){return!!(s9(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function r9(){return!0}function s9(e){return e!==null&&typeof e=="object"&&"type"in e}const fI=[],i9=!0,ij=!1,o9="skip";function a9(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=dI(s),a=r?-1:1;l(e,void 0,[])();function l(c,u,p){const d=c&&typeof c=="object"?c:{};if(typeof d.type=="string"){const h=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(c.type+(h?"<"+h+">":""))+")"})}return f;function f(){let h=fI,g,k,w;if((!t||i(c,u,p[p.length-1]||void 0))&&(h=l9(n(c,p)),h[0]===ij))return h;if("children"in c&&c.children){const y=c;if(y.children&&h[0]!==o9)for(k=(r?y.children.length:-1)+a,w=p.concat(y);k>-1&&k<y.children.length;){const v=y.children[k];if(g=l(v,k,w)(),g[0]===ij)return g;k=typeof g[1]=="number"?g[1]:k+a}}return h}}}function l9(e){return Array.isArray(e)?e:typeof e=="number"?[i9,e]:e==null?fI:[e]}function pI(e,t,n,r){let s,i,a;typeof t=="function"&&typeof n!="function"?(i=void 0,a=t,s=n):(i=t,a=n,s=r),a9(e,i,l,s);function l(c,u){const p=u[u.length-1],d=p?p.children.indexOf(c):void 0;return a(c,d,p)}}const Yx={}.hasOwnProperty,c9={};function u9(e,t){const n=t||c9,r=new Map,s=new Map,i=new Map,a={...q8,...n.handlers},l={all:u,applyData:f9,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:a,one:c,options:n,patch:d9,wrap:h9};return pI(e,function(p){if(p.type==="definition"||p.type==="footnoteDefinition"){const d=p.type==="definition"?r:s,f=String(p.identifier).toUpperCase();d.has(f)||d.set(f,p)}}),l;function c(p,d){const f=p.type,h=l.handlers[f];if(Yx.call(l.handlers,f)&&h)return h(l,p,d);if(l.options.passThrough&&l.options.passThrough.includes(f)){if("children"in p){const{children:k,...w}=p,y=ph(w);return y.children=l.all(p),y}return ph(p)}return(l.options.unknownHandler||p9)(l,p,d)}function u(p){const d=[];if("children"in p){const f=p.children;let h=-1;for(;++h<f.length;){const g=l.one(f[h],p);if(g){if(h&&f[h-1].type==="break"&&(!Array.isArray(g)&&g.type==="text"&&(g.value=oj(g.value)),!Array.isArray(g)&&g.type==="element")){const k=g.children[0];k&&k.type==="text"&&(k.value=oj(k.value))}Array.isArray(g)?d.push(...g):d.push(g)}}}return d}}function d9(e,t){e.position&&(t.position=Y5(e))}function f9(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const a="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:a}}n.type==="element"&&i&&Object.assign(n.properties,ph(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function p9(e,t){const n=t.data||{},r="value"in t&&!(Yx.call(n,"hProperties")||Yx.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function h9(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
|
|
76
|
-
`});++r<e.length;)r&&n.push({type:"text",value:`
|
|
77
|
-
`}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
|
|
78
|
-
`}),n}function oj(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function aj(e,t){const n=u9(e,t),r=n.one(e,void 0),s=Z8(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
|
|
79
|
-
`},s),i}function m9(e,t){return e&&"run"in e?async function(n,r){const s=aj(n,{file:r,...t});await e.run(s,r)}:function(n,r){return aj(n,{file:r,...e||t})}}function lj(e){if(e)throw e}var Np=Object.prototype.hasOwnProperty,hI=Object.prototype.toString,cj=Object.defineProperty,uj=Object.getOwnPropertyDescriptor,dj=function(t){return typeof Array.isArray=="function"?Array.isArray(t):hI.call(t)==="[object Array]"},fj=function(t){if(!t||hI.call(t)!=="[object Object]")return!1;var n=Np.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&Np.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var s;for(s in t);return typeof s>"u"||Np.call(t,s)},pj=function(t,n){cj&&n.name==="__proto__"?cj(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},hj=function(t,n){if(n==="__proto__")if(Np.call(t,n)){if(uj)return uj(t,n).value}else return;return t[n]},g9=function e(){var t,n,r,s,i,a,l=arguments[0],c=1,u=arguments.length,p=!1;for(typeof l=="boolean"&&(p=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<u;++c)if(t=arguments[c],t!=null)for(n in t)r=hj(l,n),s=hj(t,n),l!==s&&(p&&s&&(fj(s)||(i=dj(s)))?(i?(i=!1,a=r&&dj(r)?r:[]):a=r&&fj(r)?r:{},pj(l,{name:n,newValue:e(p,a,s)})):typeof s<"u"&&pj(l,{name:n,newValue:s}));return l};const Ug=zo(g9);function Gx(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 y9(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const a=s.pop();if(typeof a!="function")throw new TypeError("Expected function as last argument, not "+a);l(null,...s);function l(c,...u){const p=e[++i];let d=-1;if(c){a(c);return}for(;++d<s.length;)(u[d]===null||u[d]===void 0)&&(u[d]=s[d]);s=u,p?x9(p,l)(...u):a(null,...u)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function x9(e,t){let n;return r;function r(...a){const l=e.length>a.length;let c;l&&a.push(s);try{c=e.apply(this,a)}catch(u){const p=u;if(l&&n)throw p;return s(p)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(a,...l){n||(n=!0,t(a,...l))}function i(a){s(null,a)}}const ti={basename:w9,dirname:b9,extname:k9,join:v9,sep:"/"};function w9(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');_d(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let a=-1,l=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),l>-1&&(e.codePointAt(s)===t.codePointAt(l--)?l<0&&(r=s):(l=-1,r=a));return n===r?r=a:r<0&&(r=e.length),e.slice(n,r)}function b9(e){if(_d(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 k9(e){_d(e);let t=e.length,n=-1,r=0,s=-1,i=0,a;for(;t--;){const l=e.codePointAt(t);if(l===47){if(a){r=t+1;break}continue}n<0&&(a=!0,n=t+1),l===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function v9(...e){let t=-1,n;for(;++t<e.length;)_d(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":S9(n)}function S9(e){_d(e);const t=e.codePointAt(0)===47;let n=N9(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function N9(e,t){let n="",r=0,s=-1,i=0,a=-1,l,c;for(;++a<=e.length;){if(a<e.length)l=e.codePointAt(a);else{if(l===47)break;l=47}if(l===47){if(!(s===a-1||i===1))if(s!==a-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,a):n=e.slice(s+1,a),r=a-s-1;s=a,i=0}else l===46&&i>-1?i++:i=-1}return n}function _d(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const j9={cwd:C9};function C9(){return"/"}function Jx(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function _9(e){if(typeof e=="string")e=new URL(e);else if(!Jx(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 E9(e)}function E9(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 Yg=["history","path","basename","stem","extname","dirname"];class mI{constructor(t){let n;t?Jx(t)?n={path:t}:typeof t=="string"||A9(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":j9.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Yg.length;){const i=Yg[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)Yg.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?ti.basename(this.path):void 0}set basename(t){Jg(t,"basename"),Gg(t,"basename"),this.path=ti.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?ti.dirname(this.path):void 0}set dirname(t){mj(this.basename,"dirname"),this.path=ti.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?ti.extname(this.path):void 0}set extname(t){if(Gg(t,"extname"),mj(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=ti.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Jx(t)&&(t=_9(t)),Jg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?ti.basename(this.path,this.extname):void 0}set stem(t){Jg(t,"stem"),Gg(t,"stem"),this.path=ti.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 xr(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 Gg(e,t){if(e&&e.includes(ti.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+ti.sep+"`")}function Jg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function mj(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function A9(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const P9=function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i},I9={}.hasOwnProperty;class Jb extends P9{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=y9()}copy(){const t=new Jb;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Ug(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Zg("data",this.frozen),this.namespace[t]=n,this):I9.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Zg("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=zf(t),r=this.parser||this.Parser;return Xg("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Xg("process",this.parser||this.Parser),Qg("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,a){const l=zf(t),c=r.parse(l);r.run(c,l,function(p,d,f){if(p||!d||!f)return u(p);const h=d,g=r.stringify(h,f);M9(g)?f.value=g:f.result=g,u(p,f)});function u(p,d){p||!d?a(p):i?i(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),Xg("processSync",this.parser||this.Parser),Qg("processSync",this.compiler||this.Compiler),this.process(t,s),yj("processSync","process",n),r;function s(i,a){n=!0,lj(i),r=a}}run(t,n,r){gj(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(a,l){const c=zf(n);s.run(t,c,u);function u(p,d,f){const h=d||t;p?l(p):a?a(h):r(void 0,h,f)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),yj("runSync","run",r),s;function i(a,l){lj(a),s=l,r=!0}}stringify(t,n){this.freeze();const r=zf(n),s=this.compiler||this.Compiler;return Qg("stringify",s),gj(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(Zg("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):a(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(u){if(typeof u=="function")c(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[p,...d]=u;c(p,d)}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=Ug(!0,s.settings,u.settings))}function l(u){let p=-1;if(u!=null)if(Array.isArray(u))for(;++p<u.length;){const d=u[p];i(d)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function c(u,p){let d=-1,f=-1;for(;++d<r.length;)if(r[d][0]===u){f=d;break}if(f===-1)r.push([u,...p]);else if(p.length>0){let[h,...g]=p;const k=r[f][1];Gx(k)&&Gx(h)&&(h=Ug(!0,k,h)),r[f]=[u,h,...g]}}}}const T9=new Jb().freeze();function Xg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Qg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Zg(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 gj(e){if(!Gx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function yj(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function zf(e){return R9(e)?e:new mI(e)}function R9(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function M9(e){return typeof e=="string"||$9(e)}function $9(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const L9="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",xj=[],wj={allowDangerousHtml:!0},O9=/^(https?|ircs?|mailto|xmpp)$/i,D9=[{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 gI(e){const t=F9(e),n=z9(e);return B9(t.runSync(t.parse(n),n),e)}function F9(e){const t=e.rehypePlugins||xj,n=e.remarkPlugins||xj,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...wj}:wj;return T9().use(b8).use(n).use(m9,r).use(t)}function z9(e){const t=e.children||"",n=new mI;return typeof t=="string"&&(n.value=t),n}function B9(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,a=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||H9;for(const p of D9)Object.hasOwn(t,p.from)&&(""+p.from+(p.to?"use `"+p.to+"` instead":"remove it")+L9+p.id,void 0);return pI(e,u),Z5(e,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function u(p,d,f){if(p.type==="raw"&&f&&typeof d=="number")return a?f.children.splice(d,1):f.children[d]={type:"text",value:p.value},d;if(p.type==="element"){let h;for(h in Vg)if(Object.hasOwn(Vg,h)&&Object.hasOwn(p.properties,h)){const g=p.properties[h],k=Vg[h];(k===null||k.includes(p.tagName))&&(p.properties[h]=c(String(g||""),h,p))}}if(p.type==="element"){let h=n?!n.includes(p.tagName):i?i.includes(p.tagName):!1;if(!h&&r&&typeof d=="number"&&(h=!r(p,d,f)),h&&f&&typeof d=="number")return l&&p.children?f.children.splice(d,1,...p.children):f.children.splice(d,1),d}}}function H9(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||O9.test(e.slice(0,t))?e:""}const W9=new Set(["echarts"]),V9=new Set(["line","bar","pie","scatter","radar","heatmap","tree","treemap","sunburst","sankey","graph","gauge","funnel"]),K9=new Set(["onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmouseout","onmousemove","onmouseenter","onmouseleave","oncontextmenu","onkeydown","onkeyup","onkeypress","onload","onerror"]),q9=["#7c9cff","#a8e66f","#ffcf5c","#68d8d6","#ff8fb3","#b79cff","#f59e73","#8bd17c"];function To(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Ia(e,t){if(!To(e))return{...t};const n={...e};for(const[r,s]of Object.entries(t))n[r]==null?n[r]=s:To(n[r])&&To(s)&&(n[r]=Ia(n[r],s));return n}function mm(e,t){return e==null?e:Array.isArray(e)?e.map(n=>To(n)?Ia(n,t):n):To(e)?Ia(e,t):e}function U9(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 Xx(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)=>Xx(n,`${t}[${r}]`));return}if(typeof e=="object")for(const[n,r]of Object.entries(e)){if(/^on[A-Z]/.test(n)||K9.has(n.toLowerCase()))throw new Error(`${t}.${n} is not allowed`);Xx(r,`${t}.${n}`)}}}function Y9(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(!V9.has(r))throw new Error(`series.type "${r||"(empty)"}" is not allowed`)}return t}function G9(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:Ia(e,t)}function J9(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(!To(r))return r;const i=s===0&&t&&r.text==null?{...r,text:t}:r;return Ia(i,n)}):To(e)?Ia(t&&e.text==null?{...e,text:t}:e,n):t?{...n,text:t}:e}function X9(e,t){const n={top:t?42:14,textStyle:{color:"rgba(255, 255, 255, 0.72)"},itemGap:14};return e==null?e:mm(e,n)}function bj(e,t="rgba(255, 255, 255, 0.62)"){return mm(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 Q9(e,t){const n={left:52,right:42,top:t?78:42,bottom:42,containLabel:!0};return e==null?n:mm(e,n)}function Z9(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:mm(e,t)}function eV(e,t,n){const r=J9(e.title,n),s=!!(Array.isArray(r)?r:[r]).filter(Boolean).some(a=>To(a)&&a.text),i=e.legend!=null&&e.legend!==!1;return{...e,backgroundColor:e.backgroundColor??"transparent",color:e.color??q9,textStyle:Ia(e.textStyle,{color:"rgba(255, 255, 255, 0.78)"}),title:r,tooltip:G9(e.tooltip),legend:X9(e.legend,s),grid:e.xAxis!=null||e.yAxis!=null?Q9(e.grid,s||i):e.grid,xAxis:bj(e.xAxis),yAxis:bj(e.yAxis),radar:Z9(e.radar),series:t}}function tV(e){const t=U9(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(!W9.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");Xx(n);const r=Y9(n.option.series),s=n.title==null?"":String(n.title),i=eV(n.option,r,s);return{ok:!0,spec:{...n,title:s,option:i}}}catch(n){return{ok:!1,error:String((n==null?void 0:n.message)||n)}}}function Bf(e,t){let n=0;for(let r=t-1;r>=0&&e[r]==="\\";r-=1)n+=1;return n%2===1}function nV(e,t){let n=t;for(;n<e.length&&e[n]==="`";)n+=1;return n-t}function Oi(e){let t=String(e||"").trim();if(!t.includes("|"))return[];t.startsWith("|")&&(t=t.slice(1)),t.endsWith("|")&&!Bf(t,t.length-1)&&(t=t.slice(0,-1));const n=[];let r="",s=0;for(let i=0;i<t.length;i+=1){const a=t[i];if(a==="`"&&!Bf(t,i)){const l=nV(t,i);r+=t.slice(i,i+l),s===0?s=l:s===l&&(s=0),i+=l-1;continue}if(s===0&&a==="|"&&!Bf(t,i)){n.push(r.trim()),r="";continue}if(s===0&&a==="\\"&&t[i+1]==="|"&&Bf(t,i+1)){r+="|",i+=1;continue}r+=a}return n.push(r.trim()),n}function yI(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 xI(e){const t=Oi(e);return t.length>1&&t.every(n=>/^:?-{3,}:?$/.test(n))}function wI(e){return Oi(e).map(t=>t.startsWith(":")&&t.endsWith(":")?"center":t.endsWith(":")?"right":"left")}function rV(e){return/^\s*(sequenceDiagram|flowchart\s+(?:TD|TB|BT|LR|RL)|graph\s+(?:TD|TB|BT|LR|RL))\b/i.test(String(e||""))}function sV(e){const t=String(e||"").split(/\r?\n/).map(l=>l.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[];let s="TD";const i=(l,c="")=>{const u=String(l||"").replace(/[^A-Za-z0-9_]/g,"_")||`N${n.size+1}`;return n.has(u)?c&&(n.get(u).label=c):n.set(u,{id:u,label:c||u}),u},a=l=>{const c=String(l||"").trim().replace(/[;,]+$/,""),u=c.match(/^([A-Za-z][A-Za-z0-9_]*)(?:\[(.+?)\]|\((.+?)\)|\{(.+?)\})?$/);return u?i(u[1],u[2]||u[3]||u[4]||u[1]):i(c.replace(/[^A-Za-z0-9_]/g,"_"),c)};for(const l of t){const c=l.match(/^(graph|flowchart)\s+(TD|TB|BT|LR|RL)\b/i);if(c){s=c[2].toUpperCase();continue}const u=l.match(/^(.+?)\s*-{1,2}>+\s*(.+)$/);if(u){r.push({from:a(u[1]),to:a(u[2])});continue}a(l)}return{nodes:Array.from(n.values()),edges:r,direction:s}}function iV({code:e}){const t=m.useMemo(()=>sV(e),[e]),n=t.direction==="LR"||t.direction==="RL",r=150,s=46,i=n?102:38,a=n?34:72,l=new Map;t.nodes.forEach((p,d)=>{l.set(p.id,{x:28+(n?d*(r+i):d%3*(r+i)),y:28+(n?d%3*(s+a):d*(s+a))})});const c=Math.max(520,...Array.from(l.values()).map(p=>p.x+r+28)),u=Math.max(220,...Array.from(l.values()).map(p=>p.y+s+28));return o.jsxs("svg",{viewBox:`0 0 ${c} ${u}`,role:"img","aria-label":"Mermaid flowchart preview",children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-md-mermaid-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),t.edges.map((p,d)=>{const f=l.get(p.from),h=l.get(p.to);if(!f||!h)return null;const g=n?`M ${f.x+r} ${f.y+s/2} C ${(f.x+h.x+r)/2} ${f.y+s/2}, ${(f.x+h.x+r)/2} ${h.y+s/2}, ${h.x} ${h.y+s/2}`:`M ${f.x+r/2} ${f.y+s} C ${f.x+r/2} ${f.y+s+28}, ${h.x+r/2} ${h.y-28}, ${h.x+r/2} ${h.y}`;return o.jsx("path",{className:"af-md-mermaid-edge",d:g,markerEnd:"url(#af-md-mermaid-arrow)"},`${p.from}-${p.to}-${d}`)}),t.nodes.map(p=>{const d=l.get(p.id);return o.jsxs("g",{children:[o.jsx("rect",{className:"af-md-mermaid-box",x:d.x,y:d.y,width:r,height:s,rx:"8"}),o.jsx("text",{className:"af-md-mermaid-text",x:d.x+r/2,y:d.y+s/2+5,textAnchor:"middle",children:p.label.slice(0,24)})]},p.id)})]})}function oV(e){const t=String(e||"").split(/\r?\n/).map(i=>i.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[],s=(i,a="")=>{const l=String(i||"").trim();l&&(n.has(l)||n.set(l,a||l))};for(const i of t){if(/^sequenceDiagram\b/i.test(i))continue;const a=i.match(/^(participant|actor)\s+([A-Za-z0-9_]+)(?:\s+as\s+(.+))?$/i);if(a){s(a[2],a[3]||a[2]);continue}const l=i.match(/^([A-Za-z0-9_]+)\s*[-=]+>>\+?\s*([A-Za-z0-9_]+)\s*:\s*(.+)$/);if(l){s(l[1]),s(l[2]),r.push({type:"message",from:l[1],to:l[2],text:l[3]});continue}const c=i.match(/^note\s+(?:over|right of|left of)\s+([^:]+):\s*(.+)$/i);r.push({type:"note",text:c?c[2]:i})}return{participants:Array.from(n,([i,a])=>({id:i,label:a})),rows:r}}function aV({code:e}){const t=m.useMemo(()=>oV(e),[e]),n=t.participants.length?t.participants:[{id:"A",label:"A"},{id:"B",label:"B"}],r=190,s=48,i=26,a=44,l=48,c=Math.max(620,s*2+n.length*r),u=Math.max(220,i+a+Math.max(1,t.rows.length)*l+34),p=d=>{const f=Math.max(0,n.findIndex(h=>h.id===d));return s+f*r+r/2};return o.jsxs("svg",{viewBox:`0 0 ${c} ${u}`,role:"img","aria-label":"Mermaid sequence diagram preview",children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-md-sequence-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),n.map((d,f)=>{const h=s+f*r+r/2;return o.jsxs("g",{children:[o.jsx("rect",{className:"af-md-mermaid-box",x:h-68,y:i,width:"136",height:"34",rx:"8"}),o.jsx("text",{className:"af-md-mermaid-text",x:h,y:i+22,textAnchor:"middle",children:d.label.slice(0,18)}),o.jsx("line",{className:"af-md-sequence-life",x1:h,y1:i+a,x2:h,y2:u-18})]},d.id)}),t.rows.map((d,f)=>{const h=i+a+f*l+24;if(d.type!=="message")return o.jsxs("g",{children:[o.jsx("rect",{className:"af-md-sequence-note",x:s,y:h-17,width:c-s*2,height:"30",rx:"7"}),o.jsx("text",{className:"af-md-mermaid-text",x:s+12,y:h+4,children:d.text.slice(0,120)})]},`note-${f}`);const g=p(d.from),k=p(d.to),w=(g+k)/2;return o.jsxs("g",{children:[o.jsx("line",{className:"af-md-mermaid-edge",x1:g,y1:h,x2:k,y2:h,markerEnd:"url(#af-md-sequence-arrow)"}),o.jsx("text",{className:"af-md-sequence-label",x:w,y:h-8,textAnchor:"middle",children:d.text.slice(0,72)})]},`msg-${f}`)})]})}function bI({code:e}){const t=String(e||"").trim();if(!t)return null;const n=/^sequenceDiagram\b/i.test(t);return o.jsx("div",{className:"af-md-mermaid-preview",children:n?o.jsx(aV,{code:t}):o.jsx(iV,{code:t})})}function lV(e){const t=String(e||"").replace(/\r\n/g,`
|
|
80
|
-
`).split(`
|
|
81
|
-
`),n=[];let r=[],s=!1;const i=()=>{r.length&&(n.push({type:"markdown",text:r.join(`
|
|
82
|
-
`)}),r=[])};for(let a=0;a<t.length;){const l=t[a]||"",c=l.match(/^\s*```\s*(mermaid|mmd)\s*$/i);if(!s&&c){i();const u=[];for(a++;a<t.length&&!/^\s*```\s*$/.test(t[a]||"");)u.push(t[a]||""),a++;a<t.length&&a++,n.push({type:"mermaid",text:u.join(`
|
|
83
|
-
`)});continue}if(!s&&rV(l)){i();const u=[];for(;a<t.length;){const p=t[a]||"";if(u.length>0&&(!p.trim()||/^-{3,}\s*$/.test(p)||/^#{1,6}\s+/.test(p)))break;u.push(p),a++}n.push({type:"mermaid",text:u.join(`
|
|
84
|
-
`)});continue}if(/^\s*```/.test(l)){s=!s,r.push(l),a++;continue}if(!s&&a+1<t.length&&Oi(l).length>1&&xI(t[a+1])){i();const u=Oi(l),p=wI(t[a+1]),d=[];for(a+=2;a<t.length&&t[a].trim()&&Oi(t[a]).length>1;)d.push(yI(Oi(t[a]),u.length)),a++;n.push({type:"table",headers:u,align:p,rows:d});continue}r.push(l),a++}return i(),n}function kj(e,t=""){const n=String(e||"").trim();if(!n||/^(?:https?:|data:|blob:|file:|javascript:|mailto:|tel:)/i.test(n)||n.startsWith("/")||n.startsWith("#")||!t||n.startsWith("outputs/"))return n;const r=String(t||"").split("/").filter(Boolean);r.pop();const s=[...r,...n.split("/")].filter(Boolean),i=[];for(const a of s)if(a!=="."){if(a===".."){if(i.length===0)return n;i.pop();continue}i.push(a)}return i.join("/")}function kI(e){const t=String(e||"").replace(/\r\n/g,`
|
|
85
|
-
`).split(`
|
|
86
|
-
`);let n=!1;return t.map(r=>{if(/^\s*```/.test(r))return n=!n,r;if(n)return r;let s="",i=0,a=!1;for(;i<r.length;){const l=r[i];if(l==="`"){a=!a,s+=l,i+=1;continue}if(!(!a&&/^https?:\/\//i.test(r.slice(i)))){s+=l,i+=1;continue}if((i>0?r[i-1]:"")==="("){s+=l,i+=1;continue}let p=i;for(;p<r.length&&!/\s|<|>/.test(r[p]);)p+=1;let d=r.slice(i,p),f="";for(;/[.,;:!?)}\]]$/.test(d);)f=d.slice(-1)+f,d=d.slice(0,-1);d?s+=`[${d}](${d})${f}`:s+=r.slice(i,p),i=p}return s}).join(`
|
|
87
|
-
`)}function vI(e,t=!1,n=""){const r=i=>{const a=String(i||"").trim();if(!a)return"";if(/^(?:https?:|data:|blob:|file:|javascript:|mailto:|tel:)/i.test(a)||a.startsWith("#"))return a;const l=kj(a,n);return e?e(l,{kind:"link",download:!0}):l},s=(i,a)=>{const l=r(a);!l||l.startsWith("#")||/^(?:javascript):/i.test(l)||(i.stopPropagation(),!(i.defaultPrevented||i.button!==0)&&(i.preventDefault(),window.open(l,"_blank","noopener,noreferrer")))};return{...t?{p:({children:i})=>o.jsx(o.Fragment,{children:i})}:{},code:({inline:i,className:a,children:l})=>{var p;const c=((p=String(a||"").match(/language-(\w+)/i))==null?void 0:p[1])||"",u=String(l||"").replace(/\n$/,"");return!i&&/^(mermaid|mmd)$/i.test(c)?o.jsx(bI,{code:u}):i?o.jsx("code",{className:a,children:l}):o.jsx("code",{className:a,children:l})},img:({src:i,alt:a})=>o.jsx("img",{src:e?e(kj(i,n)):i||"",alt:a||"",loading:"lazy"}),a:({href:i,children:a})=>o.jsx("a",{href:r(i),target:"_blank",rel:"noopener noreferrer",onClick:l=>s(l,i),children:a})}}function vj({children:e,resolveSrc:t,basePath:n=""}){return o.jsx(gI,{components:vI(t,!0,n),children:kI(e)})}function Xb({content:e,resolveSrc:t,basePath:n=""}){const r=m.useMemo(()=>lV(e),[e]),s=m.useMemo(()=>vI(t,!1,n),[n,t]);return o.jsx(o.Fragment,{children:r.map((i,a)=>i.type==="mermaid"?o.jsx(bI,{code:i.text},`mermaid-${a}`):i.type!=="table"?o.jsx(gI,{components:s,children:kI(i.text)},`md-${a}`):o.jsx("div",{className:"af-work-display-table-wrap",children:o.jsxs("table",{className:"af-work-display-table",children:[o.jsx("thead",{children:o.jsx("tr",{children:i.headers.map((l,c)=>o.jsx("th",{style:{textAlign:i.align[c]||"left"},children:o.jsx(vj,{resolveSrc:t,basePath:n,children:l})},c))})}),o.jsx("tbody",{children:i.rows.map((l,c)=>o.jsx("tr",{children:i.headers.map((u,p)=>o.jsx("td",{style:{textAlign:i.align[p]||"left"},children:o.jsx(vj,{resolveSrc:t,basePath:n,children:l[p]||""})},p))},c))})]})},`table-${a}`))})}function cV(e,t=","){const n=[];let r=[],s="",i=!1;const a=String(e||"").replace(/\r\n/g,`
|
|
88
|
-
`);for(let l=0;l<a.length;l+=1){const c=a[l],u=a[l+1];if(i){c==='"'&&u==='"'?(s+='"',l+=1):c==='"'?i=!1:s+=c;continue}c==='"'?i=!0:c===t?(r.push(s.trim()),s=""):c===`
|
|
89
|
-
`?(r.push(s.trim()),n.push(r),r=[],s=""):s+=c}return(s||r.length)&&(r.push(s.trim()),n.push(r)),n.filter(l=>l.some(c=>String(c||"").trim()))}function Zs(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 uV(e){if(Array.isArray(e)){if(e.every(s=>s&&typeof s=="object"&&!Array.isArray(s))){const s=Array.from(new Set(e.flatMap(i=>Object.keys(i))));return{columns:s.map(i=>({key:i,label:i,align:"left"})),rows:e.map(i=>s.map(a=>Zs(i[a])))}}if(e.every(Array.isArray)&&e.length>0){const s=e[0].map((i,a)=>Zs(i)||`Column ${a+1}`);return{columns:s.map((i,a)=>({key:String(a),label:i,align:"left"})),rows:e.slice(1).map(i=>s.map((a,l)=>Zs(i[l])))}}}if(!e||typeof e!="object")return null;const t=Array.isArray(e.columns)?e.columns:Array.isArray(e.headers)?e.headers:[],n=Array.isArray(e.rows)?e.rows:Array.isArray(e.data)?e.data:[];let r=t.map((s,i)=>s&&typeof s=="object"?{key:String(s.key||s.name||s.field||i),label:String(s.label||s.title||s.name||s.key||`Column ${i+1}`),align:["left","center","right"].includes(s.align)?s.align:"left"}:{key:String(i),label:Zs(s)||`Column ${i+1}`,align:"left"});return r.length===0&&n.every(s=>s&&typeof s=="object"&&!Array.isArray(s))&&(r=Array.from(new Set(n.flatMap(s=>Object.keys(s)))).map(s=>({key:s,label:s,align:"left"}))),r.length===0&&n.every(Array.isArray)&&n.length>0?(r=n[0].map((s,i)=>({key:String(i),label:Zs(s)||`Column ${i+1}`,align:"left"})),{columns:r,rows:n.slice(1).map(s=>r.map((i,a)=>Zs(s[a])))}):{columns:r,rows:n.map(s=>Array.isArray(s)?r.map((i,a)=>Zs(s[a])):s&&typeof s=="object"?r.map(i=>Zs(s[i.key])):r.map((i,a)=>a===0?Zs(s):""))}}function dV(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=uV(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&&Oi(s[0]).length>1&&xI(s[1])){const l=Oi(s[0]),c=wI(s[1]);return{columns:l.map((u,p)=>({key:String(p),label:u,align:c[p]||"left"})),rows:s.slice(2).map(u=>yI(Oi(u),l.length)),error:""}}const i=r.includes(" ")?" ":",",a=cV(r,i);return a.length>0&&a[0].length>1?{columns:a[0].map((c,u)=>c||`Column ${u+1}`).map((c,u)=>({key:String(u),label:c,align:"left"})),rows:a.slice(1),error:""}:{columns:[],rows:[],error:"No table data detected"}}function Qb({content:e}){const t=m.useMemo(()=>dV(e),[e]);return t.error||t.columns.length===0?o.jsxs("div",{className:"af-work-display-table-empty",children:[o.jsx("strong",{children:"Table data error"}),o.jsx("span",{children:t.error||"No columns found"})]}):o.jsx("div",{className:"af-work-display-table-wrap af-work-display-table-wrap--standalone",children:o.jsxs("table",{className:"af-work-display-table",children:[o.jsx("thead",{children:o.jsx("tr",{children:t.columns.map((n,r)=>o.jsx("th",{style:{textAlign:n.align||"left"},children:n.label},`${n.key}-${r}`))})}),o.jsx("tbody",{children:t.rows.map((n,r)=>o.jsx("tr",{children:t.columns.map((s,i)=>o.jsx("td",{style:{textAlign:s.align||"left"},children:Zs(n[i])},`${s.key}-${i}`))},r))})]})})}function Zb({content:e}){const t=m.useRef(null),n=m.useMemo(()=>tV(e),[e]),[r,s]=m.useState({loading:!1,error:""});return m.useEffect(()=>{if(!n.ok){s({loading:!1,error:n.error||"Invalid chart spec"});return}let i=!1,a=null,l=null,c=null;return s({loading:!0,error:""}),n5(()=>import("./index-DgQRkS4v.js"),[]).then(u=>{i||!t.current||(a=u.init(t.current,"dark",{renderer:"canvas"}),a.setOption(n.spec.option,!0),c=()=>a==null?void 0:a.resize(),typeof ResizeObserver<"u"&&(l=new ResizeObserver(c),l.observe(t.current)),window.addEventListener("resize",c),window.requestAnimationFrame(c),i||s({loading:!1,error:""}))}).catch(u=>{i||s({loading:!1,error:String((u==null?void 0:u.message)||u)})}),()=>{var u,p;i=!0,c&&window.removeEventListener("resize",c),(u=l==null?void 0:l.disconnect)==null||u.call(l),(p=a==null?void 0:a.dispose)==null||p.call(a)}},[n]),!n.ok||r.error?o.jsxs("div",{className:"af-work-display-chart-error",children:[o.jsx("strong",{children:"Chart configuration error"}),o.jsx("span",{children:r.error||n.error})]}):o.jsxs("div",{className:"af-work-display-chart",children:[o.jsx("div",{ref:t,className:"af-work-display-chart__canvas"}),r.loading?o.jsx("div",{className:"af-work-display-chart__loading",children:"Loading chart..."}):null]})}/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function SI(e){return typeof e>"u"||e===null}function fV(e){return typeof e=="object"&&e!==null}function pV(e){return Array.isArray(e)?e:SI(e)?[]:[e]}function hV(e,t){var n,r,s,i;if(t)for(i=Object.keys(t),n=0,r=i.length;n<r;n+=1)s=i[n],e[s]=t[s];return e}function mV(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function gV(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var yV=SI,xV=fV,wV=pV,bV=mV,kV=gV,vV=hV,ek={isNothing:yV,isObject:xV,toArray:wV,repeat:bV,isNegativeZero:kV,extend:vV};function NI(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 nd(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=NI(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}nd.prototype=Object.create(Error.prototype);nd.prototype.constructor=nd;nd.prototype.toString=function(t){return this.name+": "+NI(this,t)};var la=nd,SV=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],NV=["scalar","sequence","mapping"];function jV(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function CV(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(SV.indexOf(n)===-1)throw new la('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=jV(t.styleAliases||null),NV.indexOf(this.kind)===-1)throw new la('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var mr=CV;function Sj(e,t){var n=[];return e[t].forEach(function(r){var s=n.length;n.forEach(function(i,a){i.tag===r.tag&&i.kind===r.kind&&i.multi===r.multi&&(s=a)}),n[s]=r}),n}function _V(){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 Qx(e){return this.extend(e)}Qx.prototype.extend=function(t){var n=[],r=[];if(t instanceof mr)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 la("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(i){if(!(i instanceof mr))throw new la("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(i.loadKind&&i.loadKind!=="scalar")throw new la("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(i.multi)throw new la("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(i){if(!(i instanceof mr))throw new la("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var s=Object.create(Qx.prototype);return s.implicit=(this.implicit||[]).concat(n),s.explicit=(this.explicit||[]).concat(r),s.compiledImplicit=Sj(s,"implicit"),s.compiledExplicit=Sj(s,"explicit"),s.compiledTypeMap=_V(s.compiledImplicit,s.compiledExplicit),s};var EV=Qx,AV=new mr("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),PV=new mr("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),IV=new mr("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),TV=new EV({explicit:[AV,PV,IV]});function RV(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function MV(){return null}function $V(e){return e===null}var LV=new mr("tag:yaml.org,2002:null",{kind:"scalar",resolve:RV,construct:MV,predicate:$V,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function OV(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 DV(e){return e==="true"||e==="True"||e==="TRUE"}function FV(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var zV=new mr("tag:yaml.org,2002:bool",{kind:"scalar",resolve:OV,construct:DV,predicate:FV,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 BV(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function HV(e){return 48<=e&&e<=55}function WV(e){return 48<=e&&e<=57}function VV(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(!BV(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}if(s==="o"){for(n++;n<t;n++)if(s=e[n],s!=="_"){if(!HV(e.charCodeAt(n)))return!1;r=!0}return r&&s!=="_"}}if(s==="_")return!1;for(;n<t;n++)if(s=e[n],s!=="_"){if(!WV(e.charCodeAt(n)))return!1;r=!0}return!(!r||s==="_")}function KV(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 qV(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!ek.isNegativeZero(e)}var UV=new mr("tag:yaml.org,2002:int",{kind:"scalar",resolve:VV,construct:KV,predicate:qV,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"]}}),YV=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function GV(e){return!(e===null||!YV.test(e)||e[e.length-1]==="_")}function JV(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 XV=/^[-+]?[0-9]+e/;function QV(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(ek.isNegativeZero(e))return"-0.0";return n=e.toString(10),XV.test(n)?n.replace("e",".e"):n}function ZV(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||ek.isNegativeZero(e))}var eK=new mr("tag:yaml.org,2002:float",{kind:"scalar",resolve:GV,construct:JV,predicate:ZV,represent:QV,defaultStyle:"lowercase"}),tK=TV.extend({implicit:[LV,zV,UV,eK]}),nK=tK,jI=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),CI=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 rK(e){return e===null?!1:jI.exec(e)!==null||CI.exec(e)!==null}function sK(e){var t,n,r,s,i,a,l,c=0,u=null,p,d,f;if(t=jI.exec(e),t===null&&(t=CI.exec(e)),t===null)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,s=+t[3],!t[4])return new Date(Date.UTC(n,r,s));if(i=+t[4],a=+t[5],l=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(p=+t[10],d=+(t[11]||0),u=(p*60+d)*6e4,t[9]==="-"&&(u=-u)),f=new Date(Date.UTC(n,r,s,i,a,l,c)),u&&f.setTime(f.getTime()-u),f}function iK(e){return e.toISOString()}var oK=new mr("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:rK,construct:sK,instanceOf:Date,represent:iK});function aK(e){return e==="<<"||e===null}var lK=new mr("tag:yaml.org,2002:merge",{kind:"scalar",resolve:aK}),tk=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
94
|
-
\r`;function cK(e){if(e===null)return!1;var t,n,r=0,s=e.length,i=tk;for(n=0;n<s;n++)if(t=i.indexOf(e.charAt(n)),!(t>64)){if(t<0)return!1;r+=6}return r%8===0}function uK(e){var t,n,r=e.replace(/[\r\n=]/g,""),s=r.length,i=tk,a=0,l=[];for(t=0;t<s;t++)t%4===0&&t&&(l.push(a>>16&255),l.push(a>>8&255),l.push(a&255)),a=a<<6|i.indexOf(r.charAt(t));return n=s%4*6,n===0?(l.push(a>>16&255),l.push(a>>8&255),l.push(a&255)):n===18?(l.push(a>>10&255),l.push(a>>2&255)):n===12&&l.push(a>>4&255),new Uint8Array(l)}function dK(e){var t="",n=0,r,s,i=e.length,a=tk;for(r=0;r<i;r++)r%3===0&&r&&(t+=a[n>>18&63],t+=a[n>>12&63],t+=a[n>>6&63],t+=a[n&63]),n=(n<<8)+e[r];return s=i%3,s===0?(t+=a[n>>18&63],t+=a[n>>12&63],t+=a[n>>6&63],t+=a[n&63]):s===2?(t+=a[n>>10&63],t+=a[n>>4&63],t+=a[n<<2&63],t+=a[64]):s===1&&(t+=a[n>>2&63],t+=a[n<<4&63],t+=a[64],t+=a[64]),t}function fK(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var pK=new mr("tag:yaml.org,2002:binary",{kind:"scalar",resolve:cK,construct:uK,predicate:fK,represent:dK}),hK=Object.prototype.hasOwnProperty,mK=Object.prototype.toString;function gK(e){if(e===null)return!0;var t=[],n,r,s,i,a,l=e;for(n=0,r=l.length;n<r;n+=1){if(s=l[n],a=!1,mK.call(s)!=="[object Object]")return!1;for(i in s)if(hK.call(s,i))if(!a)a=!0;else return!1;if(!a)return!1;if(t.indexOf(i)===-1)t.push(i);else return!1}return!0}function yK(e){return e!==null?e:[]}var xK=new mr("tag:yaml.org,2002:omap",{kind:"sequence",resolve:gK,construct:yK}),wK=Object.prototype.toString;function bK(e){if(e===null)return!0;var t,n,r,s,i,a=e;for(i=new Array(a.length),t=0,n=a.length;t<n;t+=1){if(r=a[t],wK.call(r)!=="[object Object]"||(s=Object.keys(r),s.length!==1))return!1;i[t]=[s[0],r[s[0]]]}return!0}function kK(e){if(e===null)return[];var t,n,r,s,i,a=e;for(i=new Array(a.length),t=0,n=a.length;t<n;t+=1)r=a[t],s=Object.keys(r),i[t]=[s[0],r[s[0]]];return i}var vK=new mr("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:bK,construct:kK}),SK=Object.prototype.hasOwnProperty;function NK(e){if(e===null)return!0;var t,n=e;for(t in n)if(SK.call(n,t)&&n[t]!==null)return!1;return!0}function jK(e){return e!==null?e:{}}var CK=new mr("tag:yaml.org,2002:set",{kind:"mapping",resolve:NK,construct:jK});nK.extend({implicit:[oK,lK],explicit:[pK,xK,vK,CK]});function Nj(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 _K=new Array(256),EK=new Array(256);for(var al=0;al<256;al++)_K[al]=Nj(al)?1:0,EK[al]=Nj(al);const rd=["requirement","planning","code","test","normal"],jj={普通:"normal",技术规划:"planning",代码执行:"code",测试回归:"test",需求拆解:"requirement"};function nk(e,t){var s,i,a,l,c,u,p,d,f,h,g,k,w,y;const n=v=>{const x={type:(v==null?void 0:v.type)??"node",name:(v==null?void 0:v.name)??"",value:(v==null?void 0:v.value)??(v==null?void 0:v.default)??""};return(v==null?void 0:v.required)===!0&&(x.required=!0),(v==null?void 0:v.description)!=null&&String(v.description).trim()&&(x.description=String(v.description)),(v==null?void 0:v.showOnNode)!=null&&(x.showOnNode=!!v.showOnNode),x},r={};for(const v of e){if((s=v==null?void 0:v.data)!=null&&s.isWorkspaceGroup)continue;const x=t[v.id]&&typeof t[v.id]=="object"?{...t[v.id]}:{},C=((i=v.data)==null?void 0:i.definitionId)||v.id,N=((a=v.data)==null?void 0:a.inputs)??[],j=((l=v.data)==null?void 0:l.outputs)??[],E=((c=v.data)==null?void 0:c.role)!=null?String(v.data.role).trim():"",P=x.role!=null?String(x.role).trim():"",O=jj[E]||E,B=jj[P]||P,W=rd.includes(O)?O:rd.includes(B)?B:"normal",z=Array.isArray(N)?N.map(n):Array.isArray(x.input)?x.input.map(ie=>n(ie)):[],L=Array.isArray(j)?j.map(n):Array.isArray(x.output)?x.output.map(ie=>n(ie)):[],R=((u=v.data)==null?void 0:u.label)!=null?String(v.data.label):x.label!=null?String(x.label):v.id,K=(p=v.data)==null?void 0:p.body,D=K!=null?String(K):x.body!=null?String(x.body):"";let $=((d=v.data)==null?void 0:d.model)!=null&&String(v.data.model).trim()!==""?String(v.data.model).trim():x.model!=null&&String(x.model).trim()!==""?String(x.model).trim():void 0;($===""||$==="default")&&($=void 0);const I={...x,definitionId:C,label:R,role:W,model:$,input:z,output:L},F=((f=v.data)==null?void 0:f.marketplaceRef)||x.marketplaceRef;F?I.marketplaceRef=String(F):delete I.marketplaceRef;const _=((h=v.data)==null?void 0:h.marketplacePackageId)||x.marketplacePackageId;_?I.marketplacePackageId=String(_):delete I.marketplacePackageId;const X=((g=v.data)==null?void 0:g.marketplaceVersion)||x.marketplaceVersion;X?I.marketplaceVersion=String(X):delete I.marketplaceVersion,C.startsWith("provide_")||D.trim()===""?delete I.body:I.body=D;const V=Array.isArray((k=v.data)==null?void 0:k.images)?v.data.images:Array.isArray(x.images)?x.images:[];V.length>0?I.images=V:delete I.images;const T=(w=v.data)==null?void 0:w.script,ee=T!=null?String(T):x.script!=null?String(x.script):"";ee.trim()===""?delete I.script:I.script=ee;for(const ie of["scriptRef","implementationRef","implementationMode"]){const G=(y=v.data)==null?void 0:y[ie],se=G!=null?String(G):x[ie]!=null?String(x[ie]):"";se.trim()===""?delete I[ie]:I[ie]=se.trim()}delete I.temperature,delete I.maxTokens,delete I.description,r[v.id]=I}return r}function Nu(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}function AK(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 PK(e,t,n){const r=(e||[]).filter(a=>a==null?void 0:a.selected);if(r.length===0)return null;const s=new Set(r.map(a=>a.id)),i=(t||[]).filter(a=>s.has(a.source)&&s.has(a.target));return{version:1,nodes:r.map(a=>Nu(a)),edges:i.map(a=>Nu(a)),instances:nk(r,n||{})}}function IK(e,t,n,r,s={}){var d;if(!e||!Array.isArray(e.nodes)||e.nodes.length===0)return null;const i=s.offset||{x:48,y:48},a=new Set((t||[]).map(f=>f.id)),l=new Map;for(const f of e.nodes)l.set(f.id,AK(f.id,a));const c=e.nodes.map(f=>{var g,k;const h=l.get(f.id);return{...Nu(f),id:h,selected:!0,dragging:!1,position:{x:Number(((g=f.position)==null?void 0:g.x)||0)+i.x,y:Number(((k=f.position)==null?void 0:k.y)||0)+i.y}}}),u=(e.edges||[]).filter(f=>l.has(f.source)&&l.has(f.target)).map((f,h)=>{const g=l.get(f.source),k=l.get(f.target);return{...Nu(f),id:`e-${g}-${k}-${Date.now()}-${h}`,source:g,target:k,selected:!1}}),p={...r||{}};for(const[f,h]of l.entries()){const g=(d=e.instances)==null?void 0:d[f];g&&(p[h]={...Nu(g),label:g.label!=null?String(g.label):h})}return{nodes:[...(t||[]).map(f=>({...f,selected:!1})),...c],edges:[...(n||[]).map(f=>({...f,selected:!1})),...u],instances:p,pastedNodeIds:c.map(f=>f.id)}}function Sn(e){switch(hh(e)){case"text":return"#2196f3";case"file":return"#4caf50";case"node":return"#ff9800";case"bool":return"#9c27b0";default:return"#9e9e9e"}}function hh(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 TK(e,t){const n=hh(e),r=hh(t);return!n||!r?!1:n==="any"||r==="any"?!0:n===r}const RK=new Set(["knowledgeContext","workspaceContext","skillsContext","mcpContext"]);function Zx(e){const t=hh(e==null?void 0:e.type),n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim();return t==="text"&&RK.has(n)?`${t}+${n}`:t}function MK(e){return Zx(e)}function sd(e,t){if(!e||!t||!TK(e.type,t.type))return!1;const n=Zx(e),r=Zx(t),s=n.includes("+"),i=r.includes("+");return s||i?n===r:!0}function $K(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 ew(e,t,n){var l;const r=n==="source"?"outputs":"inputs",i=$K(t,n==="source"?"output":"input");return i<0?null:(Array.isArray((l=e==null?void 0:e.data)==null?void 0:l[r])?e.data[r]:[])[i]||null}const mh=/\[image\s+(\d+)\]/gi;function Xi(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 LK(e){return`image ${Xi(e).length+1}`}function OK(e,t){const n=String(e||""),r=`[${t}]`;return n.trim()?`${n.replace(/[ \t]+$/u,"")} ${r}`:r}function DK(e,t){const n=Xi(e),r=String(t||""),s=new Set;mh.lastIndex=0;let i;for(;i=mh.exec(r);)s.add(`image ${i[1]}`.toLowerCase());return s.size===0?[]:n.filter(a=>s.has(String(a.label||"").toLowerCase()))}function FK(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 _I(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 ju(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 EI({files:e,body:t,images:n}){const r=Array.from(e||[]);if(r.length===0)return null;let s=String(t||"");const i=Xi(n);for(const a of r){const l=await FK(a),c=LK(i);i.push({id:`${Date.now().toString(36)}-${i.length+1}`,label:c,...l}),s=OK(s,c)}return{body:s,images:i}}function fs(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function zK(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 BK(e){return["true","1","yes","on"].includes(String((e==null?void 0:e.value)??(e==null?void 0:e.default)??"").trim().toLowerCase())}function Ut(e){e.stopPropagation()}function HK(e){return String(e||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function WK(e,t){const n=`\\[${HK(t)}\\]`;return String(e||"").replace(new RegExp(`[ \\t]*${n}`,"gi"),"").replace(/[ \t]+\n/g,`
|
|
96
|
-
`).replace(/\n{3,}/g,`
|
|
97
|
-
|
|
98
|
-
`).trimEnd()}function ey(e){return String(e||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function VK(e){const t=String(e||"");let n="",r=0;mh.lastIndex=0;let s;for(;s=mh.exec(t);)n+=ey(t.slice(r,s.index)),n+=`<span class="af-flow-node__image-token">${ey(s[0])}</span>`,r=s.index+s[0].length;return n+=ey(t.slice(r)),n||" "}function KK(e,t){const n=window.getComputedStyle(e),r=Number.parseFloat(n.lineHeight)||18,s=Number.parseFloat(n.paddingTop)||0,i=Number.parseFloat(n.paddingBottom)||0,a=Number.parseFloat(n.borderTopWidth)||0,l=Number.parseFloat(n.borderBottomWidth)||0,c=String(t||"").split(/\r\n|\r|\n/).length,u=Math.min(Math.max(c,2),8);return Math.ceil(u*r+s+i+a+l)}function qK({data:e,selected:t,id:n,deleteNode:r,onProvideExpand:s,onProvideValueChange:i,onNodeBodyChange:a,onNodeImagesChange:l,modelLists:c,onModelChange:u}){var vr,Qt;const{t:p}=Pr(),d=(e==null?void 0:e.inputs)??[],f=(e==null?void 0:e.outputs)??[],h=((e==null?void 0:e.schemaType)??"agent").toLowerCase(),g=zK(e),k=(e==null?void 0:e.isRunMode)??!1,w=!!(e!=null&&e.readOnly),y=(e==null?void 0:e.isExecuting)??!1,v=(e==null?void 0:e.isDim)??!1,x=(e==null?void 0:e.nodeStatus)??null,C=(e==null?void 0:e.nodeElapsed)??null,N=(e==null?void 0:e.definitionId)||"",j=N.startsWith("provide_"),E=N==="provide_bool",P=N==="provide_str",O=N==="provide_file",B=N==="provide_password",W=N==="agent_subAgent",z=N==="control_agent_toBool",L=(W||z)&&!k,R=E?BK(f[0]):!1,K=j?String(((vr=f[0])==null?void 0:vr.value)??((Qt=f[0])==null?void 0:Qt.default)??(e==null?void 0:e.body)??""):"",D=String((e==null?void 0:e.body)||""),$=(e==null?void 0:e.displayLabel)||(e==null?void 0:e.label)||p("flow:node.fallbackLabel"),I=!j&&!L&&(e!=null&&e.showBodyPreview)?String((e==null?void 0:e.body)||"").trim():"",F=Xi(e==null?void 0:e.images),_=E||P||O||B||L||!!I,X=m.useRef(!1),V=m.useRef(!1),T=m.useRef(null),ee=m.useRef(null),ie=m.useRef(null),G=m.useRef(null),se=m.useRef(null),[te,re]=m.useState(K),[ne,ce]=m.useState(!1),[de,me]=m.useState(D),[He,Je]=m.useState(!1),[Te,ot]=m.useState({visible:!1,top:0,height:100}),[gt,yt]=m.useState(!1),Ae=m.useCallback(()=>{const le=ee.current;if(!le)return;const we=Math.max(1,le.scrollHeight),De=Math.max(1,le.clientHeight),wt=we>De+1,Zt=wt?Math.max(12,De/we*100):100,on=Math.max(0,100-Zt),An=wt?Math.min(on,le.scrollTop/Math.max(1,we-De)*on):0;ot({visible:wt,top:An,height:Zt})},[]);m.useEffect(()=>{X.current||re(K)},[n,K]),m.useEffect(()=>{V.current||me(D)},[n,D]),m.useEffect(()=>{const le=ee.current;if(!le)return;if(L){le.style.minHeight="",le.style.height="",ie.current&&(ie.current.style.minHeight="",ie.current.style.height="");return}const we=KK(le,de);le.style.minHeight=`${we}px`,le.style.height="",ie.current&&(ie.current.style.minHeight=`${we}px`,ie.current.style.height="")},[de,L]),m.useEffect(()=>{if(!L)return;const le=window.requestAnimationFrame(Ae),we=ee.current;if(!we||typeof ResizeObserver>"u")return()=>window.cancelAnimationFrame(le);const De=new ResizeObserver(Ae);return De.observe(we),()=>{window.cancelAnimationFrame(le),De.disconnect()}},[de,L,Ae]),m.useEffect(()=>{const le=T.current,we=e==null?void 0:e.onNodeContentResize;if(!L||!le||!we||typeof ResizeObserver>"u")return;let De=0;const wt=()=>{window.cancelAnimationFrame(De),De=window.requestAnimationFrame(()=>we(n))},Zt=new ResizeObserver(wt);return Zt.observe(le),wt(),()=>{window.cancelAnimationFrame(De),Zt.disconnect()}},[e==null?void 0:e.onNodeContentResize,L,n]),m.useEffect(()=>{if(!gt)return;const le=window.setTimeout(()=>{const we=se.current;if(!we)return;we.focus();const De=we.value.length;we.setSelectionRange(De,De)},0);return()=>window.clearTimeout(le)},[gt]);const dt=Array.isArray(c==null?void 0:c.cursor)?c.cursor:[],St=Array.isArray(c==null?void 0:c.opencode)?c.opencode:[],Wt=Array.isArray(c==null?void 0:c.claudeCode)?c.claudeCode:[],Vt=Array.isArray(c==null?void 0:c.codex)?c.codex:[],et=((e==null?void 0:e.model)??"").trim(),fe=h==="agent"&&!N.startsWith("tool_nodejs"),ke=new Set(dt.map(fs)),Ve=new Set(St.map(fs)),Qe=new Set(Wt.map(fs)),Se=new Set(Vt.map(fs)),_t=et?et.startsWith("cursor:")||et.startsWith("opencode:")||et.startsWith("codex:")||et.startsWith("claude-code:")?et:Qe.has(et)?`claude-code:${et}`:Se.has(et)?`codex:${et}`:Ve.has(et)?`opencode:${et}`:ke.has(et)?`cursor:${et}`:et:"",dn=et&&!_t.startsWith("cursor:")&&!_t.startsWith("opencode:")&&!_t.startsWith("codex:")&&!_t.startsWith("claude-code:")&&!ke.has(et)&&!Ve.has(et)&&!Qe.has(et)&&!Se.has(et),zt=et.startsWith("cursor:")?et.slice(7):et.startsWith("opencode:")?et.slice(9):et.startsWith("codex:")?et.slice(6):et.startsWith("claude-code:")?et.slice(12):et,at=le=>{if(w)return;const we=le.target.value;u&&u(n,we)},fn=le=>{le.stopPropagation(),!w&&r&&r(n)},Z=le=>{le.stopPropagation(),s&&s()},Ce=le=>{le.stopPropagation(),!w&&(i==null||i(n,le.target.value==="true"?"true":"false"))},Me=le=>{if(le.stopPropagation(),w)return;const we=le.target.value;re(we),X.current||i==null||i(n,we)},Ye=le=>{le.stopPropagation(),X.current=!0},Pt=le=>{if(le.stopPropagation(),w)return;X.current=!1;const we=le.currentTarget.value;re(we),i==null||i(n,we)},Nt=()=>{w||i==null||i(n,te)},$n=le=>{if(le.stopPropagation(),w)return;if(typeof(e==null?void 0:e.onOpenProvideFilePicker)=="function"){e.onOpenProvideFilePicker(n,te);return}const we=window.prompt("文件路径",te);we!=null&&(re(we),i==null||i(n,we))},Xt=le=>{le.stopPropagation(),ce(we=>!we)},Hn=le=>{if(me(le),a==null||a(n,le),l){const we=DK(F,le);(we.length!==F.length||we.some((De,wt)=>{var Zt;return De.id!==((Zt=F[wt])==null?void 0:Zt.id)}))&&l(n,we)}},Yn=le=>{if(le.stopPropagation(),w)return;const we=le.target.value;V.current?me(we):Hn(we)},Wn=le=>{le.stopPropagation(),!w&&(V.current=!0,Je(!0))},Ln=le=>{if(le.stopPropagation(),w)return;V.current=!1,Je(!1);const we=le.currentTarget.value;Hn(we)},Gn=()=>{w||(V.current=!1,Je(!1),Hn(de))},ls=le=>{le.stopPropagation(),le.preventDefault(),!w&&yt(!0)},Ir=()=>{yt(!1),Gn()},wr=le=>{le.stopPropagation(),le.key==="Escape"&&(le.preventDefault(),Ir())},cs=m.useCallback(le=>{const we=ee.current;if(!we)return;const De=Math.max(0,we.scrollHeight-we.clientHeight);we.scrollTop=Math.min(1,Math.max(0,le))*De,Ae()},[Ae]),pn=m.useCallback((le,we=0)=>{const De=G.current;if(!De)return 0;const wt=De.getBoundingClientRect(),Zt=Te.height/100*wt.height,on=Math.max(1,wt.height-Zt);return(le-wt.top-we)/on},[Te.height]),rr=m.useCallback(le=>{var Yt,Ke;if(!Te.visible)return;le.preventDefault(),le.stopPropagation();const we=G.current;if(!we)return;const De=we.getBoundingClientRect(),wt=Te.top/100*De.height,Zt=Te.height/100*De.height,An=le.clientY>=De.top+wt&&le.clientY<=De.top+wt+Zt?le.clientY-De.top-wt:Zt/2;cs(pn(le.clientY,An));const ur=le.pointerId;(Ke=(Yt=le.currentTarget).setPointerCapture)==null||Ke.call(Yt,ur);const nt=Re=>{Re.preventDefault(),cs(pn(Re.clientY,An))},xt=()=>{window.removeEventListener("pointermove",nt),window.removeEventListener("pointerup",xt),window.removeEventListener("pointercancel",xt)};window.addEventListener("pointermove",nt),window.addEventListener("pointerup",xt),window.addEventListener("pointercancel",xt)},[pn,Te.height,Te.top,Te.visible,cs]),br=async le=>{if(w)return;const we=await EI({files:le,body:de,images:F});we&&(me(we.body),a==null||a(n,we.body),l==null||l(n,we.images))},Vn=(le,we)=>{if(le.stopPropagation(),w)return;const De=F.filter(Zt=>Zt.id!==we.id),wt=WK(de,we.label);me(wt),a==null||a(n,wt),l==null||l(n,De)},Cn=le=>{if(w)return;const we=_I(le);we.length!==0&&(le.preventDefault(),le.stopPropagation(),br(we).catch(()=>{}))},kr=le=>{if(w)return;const we=ju(le);we.length!==0&&(le.preventDefault(),le.stopPropagation(),br(we).catch(()=>{}))},Gs=()=>{const le=ee.current,we=ie.current;!le||!we||(we.scrollTop=le.scrollTop,we.scrollLeft=le.scrollLeft)};return o.jsxs("div",{className:"af-flow-node"+(t?" af-flow-node--selected":"")+(y?" af-flow-node--executing":"")+(x==="success"?" af-flow-node--done":"")+(x==="failed"?" af-flow-node--failed":"")+(x==="running"&&!y?" af-flow-node--running-disk":"")+(v?" af-flow-node--dim":"")+(L?" af-flow-node--inline-body-editor":"")+(P?" af-flow-node--provide-text":"")+(B?" af-flow-node--provide-password":"")+" af-flow-node--"+h.replace(/[^a-z0-9_-]/g,""),"data-schema":h,children:[o.jsxs("div",{className:"af-flow-node__chrome",children:[o.jsx("span",{className:"af-flow-node__title af-flow-node__title--chrome",title:`${$}${n?` (${n})`:""}${g?` · ${g}`:""}`,children:$}),!k&&fe&&o.jsxs("div",{className:"af-flow-node__model-wrap nodrag",onPointerDown:Ut,onMouseDown:Ut,onClick:Ut,children:[o.jsxs("select",{className:"af-flow-node__model nodrag",value:_t,onChange:at,onPointerDown:Ut,onMouseDown:Ut,onClick:Ut,"aria-label":p("flow:node.model"),title:zt||p("flow:node.defaultModel"),disabled:w,children:[o.jsx("option",{value:"",children:p("flow:node.defaultModel")}),dn&&o.jsx("option",{value:et,children:et}),dt.length>0&&o.jsx("optgroup",{label:"Cursor",children:dt.map(le=>o.jsx("option",{value:`cursor:${fs(le)}`,children:fs(le)},`c-${le}`))}),St.length>0&&o.jsx("optgroup",{label:"OpenCode",children:St.map(le=>o.jsx("option",{value:`opencode:${fs(le)}`,children:fs(le)},`o-${le}`))}),Vt.length>0&&o.jsx("optgroup",{label:"Codex",children:Vt.map(le=>o.jsx("option",{value:`codex:${fs(le)}`,children:fs(le)},`codex-${le}`))}),Wt.length>0&&o.jsx("optgroup",{label:"Claude Code",children:Wt.map(le=>o.jsx("option",{value:`claude-code:${fs(le)}`,children:fs(le)},`cc-${le}`))})]}),o.jsx("span",{className:"af-flow-node__model-arrow material-symbols-outlined",children:"expand_more"})]}),y&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--executing",children:"EXECUTING"}),x==="running"&&!y&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--running-disk",title:p("flow:node.diskRunning"),children:"RUNNING"}),x==="success"&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--done",children:C!=null&&String(C).trim()!==""?C:"--"}),x==="failed"&&o.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--failed",children:"FAILED"}),!k&&j&&!E&&!P&&!O&&!B&&o.jsx("button",{type:"button",className:"af-flow-node__expand",onClick:Z,"aria-label":p("flow:node.expandProvide"),title:p("flow:node.expandProvide"),children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),!k&&o.jsx("button",{type:"button",className:"af-flow-node__delete",disabled:w,onClick:fn,"aria-label":p("flow:node.deleteNode"),title:p("flow:node.deleteNode"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-flow-node__body",children:[o.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--in",children:d.map((le,we)=>{if(le.showOnNode===!1)return null;const De=p("flow:node.inputTooltip",{name:le.name||`#${we}`,type:le.type})+(le.default!=null&&le.default!==""?p("flow:node.defaultSuffix",{value:le.default}):""),wt=le.name||`#${we+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:De,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--in",children:[wt,le.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(zn,{type:"target",position:$e.Left,id:`input-${we}`,className:"af-flow-node__handle",style:{background:Sn(le.type)},title:De})]},`in-${we}`)})}),o.jsxs("div",{className:"af-flow-node__title-wrap",children:[E?o.jsxs("select",{className:"af-flow-node__bool-select nodrag"+(R?" af-flow-node__bool-select--true":""),value:R?"true":"false",onChange:Ce,onPointerDown:Ut,onMouseDown:Ut,onClick:Ut,"aria-label":"Boolean value",title:R?"true":"false",disabled:w,children:[o.jsx("option",{value:"false",children:"false"}),o.jsx("option",{value:"true",children:"true"})]}):P?o.jsx("textarea",{className:"af-flow-node__inline-text nodrag",value:te,onChange:Me,onCompositionStart:Ye,onCompositionEnd:Pt,onBlur:Nt,onPointerDown:Ut,onMouseDown:Ut,onClick:Ut,placeholder:"输入文本",rows:2,readOnly:w}):O?o.jsxs("div",{className:"af-flow-node__file-value nodrag",onPointerDown:Ut,onMouseDown:Ut,onClick:Ut,children:[o.jsx("input",{className:"af-flow-node__file-input nodrag",value:te,onChange:Me,onCompositionStart:Ye,onCompositionEnd:Pt,onBlur:Nt,placeholder:"选择或输入文件路径",title:te||"选择或输入文件路径",readOnly:w}),o.jsx("button",{type:"button",className:"af-flow-node__file-picker nodrag",disabled:w,onClick:$n,"aria-label":"选择文件",title:"选择文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"folder_open"})})]}):B?o.jsxs("div",{className:"af-flow-node__password-value nodrag",onPointerDown:Ut,onMouseDown:Ut,onClick:Ut,children:[o.jsx("input",{className:"af-flow-node__password-input nodrag",type:ne?"text":"password",value:te,onChange:Me,onCompositionStart:Ye,onCompositionEnd:Pt,onBlur:Nt,placeholder:"输入密码或密钥",title:ne?te:"密码已隐藏",autoComplete:"off",readOnly:w}),o.jsx("button",{type:"button",className:"af-flow-node__password-toggle nodrag",disabled:w,onClick:Xt,"aria-label":ne?"隐藏密码":"预览密码",title:ne?"隐藏密码":"预览密码",children:o.jsx("span",{className:"material-symbols-outlined",children:ne?"visibility_off":"visibility"})})]}):L?o.jsxs("div",{ref:T,className:"af-flow-node__prompt-stack nodrag"+(He?" af-flow-node__prompt-stack--composing":""),children:[o.jsx("pre",{ref:ie,className:"af-flow-node__prompt-backdrop","aria-hidden":"true",dangerouslySetInnerHTML:{__html:VK(de)+`
|
|
99
|
-
`}}),o.jsx("textarea",{ref:ee,className:"af-flow-node__prompt-editor nodrag",value:de,onChange:Yn,onCompositionStart:Wn,onCompositionEnd:Ln,onBlur:Gn,onPaste:Cn,onDrop:kr,onScroll:le=>{Gs(),Ae()},onPointerDown:Ut,onMouseDown:Ut,onClick:Ut,onKeyDown:Ut,onDragOver:le=>{ju(le).length>0&&le.preventDefault()},placeholder:z?"输入判断条件 / prompt":"输入 prompt",rows:2,readOnly:w}),!w&&o.jsx("button",{type:"button",className:"af-flow-node__prompt-expand nodrag",onPointerDown:Ut,onMouseDown:Ut,onClick:ls,"aria-label":"放大编辑",title:"放大编辑",children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),o.jsx("div",{ref:G,className:"af-flow-node__prompt-scrollbar"+(Te.visible?" af-flow-node__prompt-scrollbar--visible":""),onPointerDown:rr,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${Te.height}%`,top:`${Te.top}%`}})})]}):null,L&&F.length>0?o.jsx("div",{className:"af-flow-node__image-chips",children:F.map((le,we)=>o.jsxs("span",{className:"af-flow-node__image-chip",title:le.name,children:[o.jsx("img",{src:le.dataUrl,alt:""}),o.jsxs("span",{children:["[",le.label||`image ${we+1}`,"]"]}),o.jsx("button",{type:"button",className:"af-flow-node__image-remove nodrag",disabled:w,onClick:De=>Vn(De,le),onPointerDown:Ut,onMouseDown:Ut,"aria-label":`删除 ${le.label||`image ${we+1}`}`,title:"删除图片",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},le.id||we))}):null,I?o.jsx("span",{className:"af-flow-node__prompt-preview",title:I,children:I}):null,_?null:o.jsx("span",{className:"af-flow-node__body-title",title:$,children:$})]}),o.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--out",children:f.map((le,we)=>{if(le.showOnNode===!1)return null;const De=p("flow:node.outputTooltip",{name:le.name||`#${we}`,type:le.type})+(le.default!=null&&le.default!==""?p("flow:node.defaultSuffix",{value:le.default}):""),wt=le.name||`#${we+1}`;return o.jsxs("div",{className:"af-flow-node__port-row",title:De,children:[o.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--out",children:[wt,le.required?o.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),o.jsx(zn,{type:"source",position:$e.Right,id:`output-${we}`,className:"af-flow-node__handle",style:{background:Sn(le.type)},title:De})]},`out-${we}`)})})]}),gt?Cr.createPortal(o.jsx("div",{className:"af-flow-node-full-editor nodrag",onPointerDown:Ut,onMouseDown:Ut,onClick:Ut,onWheel:Ut,children:o.jsxs("div",{className:"af-flow-node-full-editor__panel",children:[o.jsxs("div",{className:"af-flow-node-full-editor__header",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-flow-node-full-editor__title",children:$}),o.jsx("div",{className:"af-flow-node-full-editor__hint",children:"编辑 prompt,Esc 关闭"})]}),o.jsx("button",{type:"button",className:"af-flow-node-full-editor__close",onClick:Ir,"aria-label":"关闭",title:"关闭",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx("textarea",{ref:se,className:"af-flow-node-full-editor__textarea",value:de,onChange:Yn,onCompositionStart:Wn,onCompositionEnd:Ln,onPaste:Cn,onDrop:kr,onKeyDown:wr,onDragOver:le=>{ju(le).length>0&&le.preventDefault()},placeholder:z?"输入判断条件 / prompt":"输入 prompt",readOnly:w})]})}),document.body):null]})}const zl="flowNode";function tw(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 UK={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 YK(e,t,n){const r=String((n==null?void 0:n.displayName)||"").trim(),s=String(t||"").trim();return!r||!s||r===s?s:(UK[e]||[]).includes(s)?r:s}const GK={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"])},JK={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"])},XK={agent_subAgent:new Set(["knowledgeContext","skillsContext"])},QK=new Set(["display_markdown","display_mermaid","display_ascii","display_html","display_react_app","display_image","display_chart","display_table"]);function ZK(e,t){if(!QK.has(String(e||"")))return!1;const n=String((t==null?void 0:t.name)||"");return n==="content"||n==="src"}function e7(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function t7(e,t){const n=String((e==null?void 0:e.baseDefinitionId)||"").trim();return n||t}function AI(e){const t=String(e??"");return/^[A-Za-z0-9_@%+=:,./-]+$/.test(t)?t:"'"+t.replace(/'/g,"'\\''")+"'"}function n7(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 r7(e){const t=String(e??"").trim();return t?t.includes("${")?t:AI(t):""}function s7(e){if(String((e==null?void 0:e.baseDefinitionId)||"").trim()!=="tool_nodejs")return"";const t=e!=null&&e.runtime&&typeof e.runtime=="object"?e.runtime:{},n=String(t.entry||"").trim().replace(/^\/+/,"");if(n){const r=String((e==null?void 0:e.packageDir)||"").trim().replace(/\/+$/,""),s=r?`${r}/${n}`:`\${flowDir}/${n}`,i=Array.isArray(t.args)?t.args.map(r7).filter(Boolean):[];return[n7(t,n),AI(s),...i].join(" ")}return String(t.command||"").trim()}function Cj(e,t,n){return!Array.isArray(t)||!Array.isArray(n)||n.length===0?t:t.map((r,s)=>{var u,p,d;const i=n[s],l=n.find(f=>(f==null?void 0:f.name)&&f.name===r.name)||i;if(!l)return r;const c=r.showOnNode===!1&&l.showOnNode==null&&((u=GK[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&&ZK(e,r)?{showOnNode:!0}:{},...(p=XK[e])!=null&&p.has(r.name)?{showOnNode:!0}:{},...(d=JK[e])!=null&&d.has(r.name)?{showOnNode:!1}:{}}})}function i7(e){var s,i;const t=Array.isArray((s=e==null?void 0:e.data)==null?void 0:s.inputs)?e.data.inputs:[],n=Array.isArray((i=e==null?void 0:e.data)==null?void 0:i.outputs)?e.data.outputs:[],r=a=>a.map(l=>{const c=tw(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 nw(e,t,n,r,s){var I,F,_,X,V,T,ee,ie,G,se,te,re,ne,ce,de,me,He,Je,Te,ot,gt,yt;const i=((I=e.data)==null?void 0:I.definitionId)||String(e.id).replace(/-\d+$/,""),a=n.find(Ae=>Ae.id===i),l=t[e.id];let c=[],u=[],p=((F=e.data)==null?void 0:F.label)??e.id,d,f,h,g,k;const w=!!l;l&&(Array.isArray(l.input)&&(c=l.input.map(tw)),Array.isArray(l.output)&&(u=l.output.map(tw)),l.label&&(p=String(l.label)),l.role&&typeof l.role=="string"&&(d=l.role),l.model!=null&&(f=String(l.model).trim()),l.body!=null&&(h=String(l.body)),Array.isArray(l.images)&&(g=l.images),l.script!=null&&(k=String(l.script)));const y=d??(typeof((_=e.data)==null?void 0:_.role)=="string"?e.data.role:"普通"),v=f??((X=e.data)==null?void 0:X.model)??void 0,x=(a==null?void 0:a.description)!=null?String(a.description).trim():"",C=x!==""?x:void 0,N=h??((V=e.data)==null?void 0:V.body)??"",j=Array.isArray(g)?g:Array.isArray((T=e.data)==null?void 0:T.images)?e.data.images:[],E=s7(a),P=k!==void 0?k:((ee=e.data)==null?void 0:ee.script)!=null?String(e.data.script):E,O=String(e.id),B=(ie=r==null?void 0:r[s])==null?void 0:ie[O],W=(G=B==null?void 0:B.label)==null?void 0:G.label,z=B==null?void 0:B.body,L=B==null?void 0:B.description;w||(c.length===0&&((se=a==null?void 0:a.inputs)!=null&&se.length)&&(c=a.inputs.map(Ae=>({...Ae}))),u.length===0&&((te=a==null?void 0:a.outputs)!=null&&te.length)&&(u=a.outputs.map(Ae=>({...Ae}))));const R=t7(a,(a==null?void 0:a.id)??i),K=(l==null?void 0:l.marketplaceRef)||((re=e.data)==null?void 0:re.marketplaceRef)||e7(a);if(R==="agent_subAgent"&&!u.some(Ae=>(Ae==null?void 0:Ae.name)==="result")){const Ae=(ne=a==null?void 0:a.outputs)==null?void 0:ne.find(dt=>(dt==null?void 0:dt.name)==="result");u=[...u,Ae?{...Ae}:{type:"text",name:"result",default:""}]}if(R==="agent_subAgent"&&!c.some(Ae=>(Ae==null?void 0:Ae.name)==="knowledgeContext")){const Ae=(ce=a==null?void 0:a.inputs)==null?void 0:ce.find(dt=>(dt==null?void 0:dt.name)==="knowledgeContext");c=[...c,Ae?{...Ae}:{type:"text",name:"knowledgeContext",default:"",showOnNode:!0}]}if((R==="display_markdown"||R==="display_mermaid"||R==="display_ascii"||R==="display_chart"||R==="display_table")&&!u.some(Ae=>(Ae==null?void 0:Ae.name)==="next")){const Ae=(de=a==null?void 0:a.outputs)==null?void 0:de.find(dt=>(dt==null?void 0:dt.name)==="next");u=[...u,Ae?{...Ae}:{type:"node",name:"next",default:""}]}if(R==="workspace_run"){if(!c.some(Ae=>(Ae==null?void 0:Ae.name)==="prev")){const Ae=(me=a==null?void 0:a.inputs)==null?void 0:me.find(dt=>(dt==null?void 0:dt.name)==="prev");c=[Ae?{...Ae}:{type:"node",name:"prev",default:""},...c]}if(!u.some(Ae=>(Ae==null?void 0:Ae.name)==="next")){const Ae=(He=a==null?void 0:a.outputs)==null?void 0:He.find(dt=>(dt==null?void 0:dt.name)==="next");u=[...u,Ae?{...Ae}:{type:"node",name:"next",default:""}]}}c=Cj(R,c,a==null?void 0:a.inputs),u=Cj(R,u,a==null?void 0:a.outputs),R.startsWith("provide_")&&u[0]&&String(u[0].default??u[0].value??"").trim()===""&&String(N).trim()!==""&&(u=u.map((Ae,dt)=>dt===0?{...Ae,default:N,value:N}:Ae));const D=YK(R,p,a),$=R==="tool_nodejs"||String(P).trim()!=="";return{...e,type:"flowNode",data:{...e.data,label:W||p,displayLabel:D,definitionDisplayName:a==null?void 0:a.displayName,definitionId:R,...K?{marketplaceRef:K}:{},...l!=null&&l.marketplacePackageId||(Je=e.data)!=null&&Je.marketplacePackageId||a!=null&&a.packageId?{marketplacePackageId:(l==null?void 0:l.marketplacePackageId)||((Te=e.data)==null?void 0:Te.marketplacePackageId)||(a==null?void 0:a.packageId)}:{},...l!=null&&l.marketplaceVersion||(ot=e.data)!=null&&ot.marketplaceVersion||a!=null&&a.version?{marketplaceVersion:(l==null?void 0:l.marketplaceVersion)||((gt=e.data)==null?void 0:gt.marketplaceVersion)||(a==null?void 0:a.version)}:{},schemaType:((yt=e.data)==null?void 0:yt.schemaType)??e.type??"agent",role:y,model:v,body:z||N,images:j,script:P,inputs:c,outputs:u,description:L||C,originalLabel:p,originalBody:N,...$?{script:P}:{}}}}function o7(e,t){const n=new Map(t.map(r=>[r.id,r]));return e.filter(r=>{var p,d,f,h;const s=n.get(r.source),i=n.get(r.target),a=((d=(p=s==null?void 0:s.data)==null?void 0:p.outputs)==null?void 0:d.length)??0,l=((h=(f=i==null?void 0:i.data)==null?void 0:f.inputs)==null?void 0:h.length)??0,c=r.sourceHandle?parseInt(String(r.sourceHandle).replace("output-",""),10):0,u=r.targetHandle?parseInt(String(r.targetHandle).replace("input-",""),10):0;return s&&i&&c>=0&&c<a&&u>=0&&u<l})}function _j(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 Ej(e,t){return!Array.isArray(e)||!e[t]||e[t].showOnNode===!0?e:e.map((n,r)=>r===t?{...n,showOnNode:!0}:n)}function ty(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=_j(t==null?void 0:t.sourceHandle,"output"),i=_j(t==null?void 0:t.targetHandle,"input");let a=!1;const l=(e||[]).map(c=>{var u,p,d,f;if(c.id===n){const h=Ej((u=c.data)==null?void 0:u.outputs,s);if(h!==((p=c.data)==null?void 0:p.outputs))return a=!0,{...c,data:{...c.data,outputs:h}}}if(c.id===r){const h=Ej((d=c.data)==null?void 0:d.inputs,i);if(h!==((f=c.data)==null?void 0:f.inputs))return a=!0,{...c,data:{...c.data,inputs:h}}}return c});return a?l:e}function a7(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 Aj(e){return e.key==="?"||e.key==="/"&&e.shiftKey}function l7(){return typeof navigator>"u"?!1:/Mac|iPhone|iPod|iPad/i.test(navigator.platform||navigator.userAgent||"")}function c7({children:e}){return o.jsx("kbd",{className:"af-kbd",children:e})}function Ts({keys:e}){return o.jsx("span",{className:"af-shortcuts-keys",children:e.map((t,n)=>o.jsxs("span",{children:[n>0?o.jsx("span",{className:"af-shortcuts-keys__plus",children:"+"}):null,o.jsx(c7,{children:t})]},n))})}function u7({open:e,onClose:t}){const{t:n}=Pr(),r=m.useRef(null);if(m.useEffect(()=>{if(!e)return;const a=requestAnimationFrame(()=>{var l;return(l=r.current)==null?void 0:l.focus()});return()=>cancelAnimationFrame(a)},[e]),!e)return null;const i=l7()?"⌘":"Ctrl";return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:a=>{a.target===a.currentTarget&&t()},children:o.jsxs("div",{ref:r,className:"af-shortcuts-panel",role:"dialog","aria-modal":"true","aria-labelledby":"af-shortcuts-title",tabIndex:-1,onMouseDown:a=>a.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:"af-shortcuts-title",className:"af-shortcuts-panel__title",children:n("flow:shortcuts.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":n("common:common.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-shortcuts-panel__body",children:[o.jsxs("section",{className:"af-shortcuts-section",children:[o.jsx("h3",{className:"af-shortcuts-cat",children:n("flow:shortcuts.general")}),o.jsxs("ul",{className:"af-shortcuts-list",children:[o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.saveDesc")}),o.jsx(Ts,{keys:[i,"S"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.shortcutsLabel")}),o.jsx(Ts,{keys:["?"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.jumpToNode")}),o.jsx(Ts,{keys:[i,"K"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.openNodePalette")}),o.jsx(Ts,{keys:["A"]})]})]})]}),o.jsxs("section",{className:"af-shortcuts-section",children:[o.jsx("h3",{className:"af-shortcuts-cat",children:n("flow:shortcuts.canvas")}),o.jsxs("ul",{className:"af-shortcuts-list",children:[o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectTool")}),o.jsx(Ts,{keys:["V"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.panTool")}),o.jsx(Ts,{keys:["H"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.holdSpacePan")}),o.jsx(Ts,{keys:["Space"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.saveViewport")}),o.jsx(Ts,{keys:["F"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectAll")}),o.jsx(Ts,{keys:[i,"A"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.undo")}),o.jsx(Ts,{keys:[i,"Z"]})]}),o.jsxs("li",{className:"af-shortcuts-row",children:[o.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.redo")}),o.jsx(Ts,{keys:[i,"Shift","Z"]})]})]})]})]})]})})}function d7(e,t){if(!t)return 1;const n=t.toLowerCase(),r=(e.id||"").toLowerCase(),s=(e.label||"").toLowerCase(),i=(e.definitionId||"").toLowerCase();return r===n?100:r.startsWith(n)?80:r.includes(n)?60:s.startsWith(n)?40:s.includes(n)?30:i.includes(n)?15:0}function f7({open:e,onClose:t,onJump:n,nodes:r}){const{t:s}=Pr(),[i,a]=m.useState(""),[l,c]=m.useState(0),u=m.useRef(null),p=m.useRef(null);m.useEffect(()=>{if(!e)return;a(""),c(0);const g=requestAnimationFrame(()=>{var k;return(k=u.current)==null?void 0:k.focus()});return()=>cancelAnimationFrame(g)},[e]);const d=m.useMemo(()=>{const g=(r||[]).map(y=>{var v,x,C;return{id:y.id,label:((v=y.data)==null?void 0:v.label)||"",definitionId:((x=y.data)==null?void 0:x.definitionId)||"",schemaType:((C=y.data)==null?void 0:C.schemaType)||""}}),k=i.trim(),w=g.map(y=>({e:y,s:d7(y,k)})).filter(y=>y.s>0);return w.sort((y,v)=>v.s-y.s||y.e.id.localeCompare(v.e.id)),w.slice(0,50).map(y=>y.e)},[r,i]);if(m.useEffect(()=>{l>=d.length&&c(0)},[d.length,l]),m.useEffect(()=>{var k;const g=(k=p.current)==null?void 0:k.querySelector(`[data-idx="${l}"]`);g&&g.scrollIntoView({block:"nearest"})},[l]),!e)return null;const f=g=>{const k=d[g];k&&(n(k.id),t())},h=g=>{if(g.key==="Escape"){g.preventDefault(),t();return}if(g.key==="ArrowDown"){g.preventDefault(),c(k=>Math.min(d.length-1,k+1));return}if(g.key==="ArrowUp"){g.preventDefault(),c(k=>Math.max(0,k-1));return}g.key==="Enter"&&(g.preventDefault(),f(l))};return o.jsx("div",{className:"af-jump-overlay",role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&t()},children:o.jsxs("div",{className:"af-jump-panel",role:"dialog","aria-modal":"true","aria-label":s("flow:jumpPalette.title"),onMouseDown:g=>g.stopPropagation(),children:[o.jsxs("div",{className:"af-jump-panel__input-wrap",children:[o.jsx("span",{className:"af-jump-panel__icon material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{ref:u,type:"text",className:"af-jump-panel__input",placeholder:s("flow:jumpPalette.placeholder"),value:i,onChange:g=>{a(g.target.value),c(0)},onKeyDown:h,spellCheck:!1,autoComplete:"off"}),o.jsx("span",{className:"af-jump-panel__count",children:d.length})]}),d.length===0?o.jsx("div",{className:"af-jump-panel__empty",children:s("flow:jumpPalette.empty")}):o.jsx("ul",{ref:p,className:"af-jump-panel__list",role:"listbox",children:d.map((g,k)=>o.jsxs("li",{"data-idx":k,role:"option","aria-selected":k===l,className:"af-jump-panel__item"+(k===l?" af-jump-panel__item--active":""),onMouseEnter:()=>c(k),onMouseDown:w=>{w.preventDefault(),f(k)},children:[o.jsx("span",{className:"af-jump-panel__id",children:g.id}),g.label&&g.label!==g.id&&o.jsx("span",{className:"af-jump-panel__label",children:g.label}),g.definitionId&&o.jsx("span",{className:"af-jump-panel__tag",children:g.definitionId})]},g.id))}),o.jsxs("div",{className:"af-jump-panel__hint",children:[o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"↑"}),o.jsx("kbd",{className:"af-kbd",children:"↓"})," ",s("flow:jumpPalette.hintNavigate")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"Enter"})," ",s("flow:jumpPalette.hintJump")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"af-kbd",children:"Esc"})," ",s("flow:jumpPalette.hintClose")]})]})]})})}function Pj(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 p7(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 Ij(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 ny(e){return String((e==null?void 0:e.nodeId)||(e==null?void 0:e.runNodeId)||"")}function Tj(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 h7({flowParams:e,scheduleNodeId:t="",runNodeId:n="",lastRunId:r="",label:s="",onClose:i}){const[a,l]=m.useState([]),[c,u]=m.useState(""),[p,d]=m.useState(null),[f,h]=m.useState(!1),[g,k]=m.useState(!1),[w,y]=m.useState(""),[v,x]=m.useState(""),C=m.useCallback(async()=>{if(e!=null&&e.flowId){h(!0),y("");try{const P=new URLSearchParams;P.set("flowId",e.flowId),P.set("flowSource",e.flowSource||"user"),t?P.set("scheduleNodeId",t):n&&P.set("runNodeId",n),P.set("limit","80");const O=await fetch(`/api/workspace/run-logs?${P.toString()}`),B=await O.json().catch(()=>({}));if(!O.ok)throw new Error(B.error||"读取日志失败");const W=Array.isArray(B.runs)?B.runs:[];l(W),u(z=>{const L=W[0]||null;return L&&String(L.status||"")==="running"&&L.runId!==z?L.runId:z&&W.some(R=>R.runId===z)?z:r&&W.some(R=>R.runId===r)?r:(L==null?void 0:L.runId)||""})}catch(P){y(String(P.message||P)),l([])}finally{h(!1)}}},[e==null?void 0:e.flowId,e==null?void 0:e.flowSource,r,n,t]),N=m.useCallback(async P=>{if(!P){d(null);return}k(!0);try{const O=await fetch(`/api/workspace/run-logs/${encodeURIComponent(P)}`),B=await O.json().catch(()=>({}));if(!O.ok)throw new Error(B.error||"读取日志详情失败");d(B)}catch(O){d({error:String(O.message||O),events:[]})}finally{k(!1)}},[]);m.useEffect(()=>{C()},[C]),m.useEffect(()=>{N(c)},[N,c]),m.useEffect(()=>{const P=a.find(B=>B.runId===c),O=window.setInterval(()=>{C(),(!P||P.status==="running")&&c&&N(c)},2e3);return()=>window.clearInterval(O)},[N,C,a,c]);const j=m.useMemo(()=>{const P=Array.isArray(p==null?void 0:p.events)?p.events:[],O=v.trim().toLowerCase();return O?P.filter(B=>String(B.type||"").toLowerCase().includes(O)||ny(B).toLowerCase().includes(O)||Ij(B).toLowerCase().includes(O)):P},[p==null?void 0:p.events,v]),E=(p==null?void 0:p.run)||a.find(P=>P.runId===c)||null;return o.jsxs("div",{className:"af-work-run-logs",children:[o.jsxs("div",{className:"af-pipeline-drawer-head",children:[o.jsx("h2",{className:"af-pipeline-drawer-title",children:"执行日志"}),o.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:i,"aria-label":"关闭日志侧栏",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-run-logs__meta",children:[o.jsx("span",{children:s||t||n||"Workspace Run"}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>void C(),title:"刷新日志","aria-label":"刷新日志",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]}),w?o.jsx("div",{className:"af-work-run-logs__error",children:w}):null,o.jsxs("div",{className:"af-work-run-logs__body",children:[o.jsxs("div",{className:"af-work-run-logs__list",children:[o.jsx("div",{className:"af-work-run-logs__section-title",children:"最近执行"}),f?o.jsx("div",{className:"af-work-run-logs__empty",children:"Loading..."}):null,!f&&a.length===0?o.jsx("div",{className:"af-work-run-logs__empty",children:"暂无执行日志"}):null,a.map(P=>o.jsxs("button",{type:"button",className:"af-work-run-logs__run"+(P.runId===c?" af-work-run-logs__run--active":""),onClick:()=>u(P.runId),title:P.runId,children:[o.jsx("span",{className:`af-work-run-logs__status af-work-run-logs__status--${Tj(P.status)}`,children:P.status||"unknown"}),o.jsx("span",{className:"af-work-run-logs__run-label",children:P.label||P.runNodeId||P.scheduleNodeId||"Workspace Run"}),o.jsx("span",{children:Pj(P.startedAt)}),o.jsx("span",{children:p7(P.durationMs)})]},P.runId))]}),o.jsxs("div",{className:"af-work-run-logs__detail",children:[o.jsxs("div",{className:"af-work-run-logs__detail-head",children:[o.jsxs("div",{children:[o.jsx("div",{className:"af-work-run-logs__section-title",children:"详情"}),E!=null&&E.label?o.jsx("div",{className:"af-work-run-logs__detail-label",children:E.label}):null,o.jsx("div",{className:"af-work-run-logs__run-id",children:(E==null?void 0:E.runId)||"-"})]}),E?o.jsx("span",{className:`af-work-run-logs__status af-work-run-logs__status--${Tj(E.status)}`,children:E.status}):null]}),o.jsxs("label",{className:"af-work-run-logs__search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{value:v,onChange:P=>x(P.target.value),placeholder:"搜索事件、节点、错误"})]}),g?o.jsx("div",{className:"af-work-run-logs__empty",children:"Loading..."}):null,p!=null&&p.error?o.jsx("div",{className:"af-work-run-logs__error",children:p.error}):null,!g&&!j.length?o.jsx("div",{className:"af-work-run-logs__empty",children:"暂无事件"}):null,o.jsx("div",{className:"af-work-run-logs__events",children:j.map((P,O)=>o.jsxs("div",{className:"af-work-run-logs__event",children:[o.jsx("span",{className:"af-work-run-logs__event-time",children:Pj(P.ts)}),o.jsx("span",{className:"af-work-run-logs__event-type",children:P.type||"event"}),ny(P)?o.jsx("span",{className:"af-work-run-logs__event-node",children:ny(P)}):null,o.jsx("pre",{children:Ij(P)})]},`${P.ts||O}-${O}`))})]})]})]})}function m7(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 PI(e){const t=m7(e);if(!t)return{title:"React App",entry:"src/App.jsx",files:{"src/App.jsx":"export default function App() { return <main><h1>React App</h1><p>No project files yet.</p></main>; }"},inputs:{}};try{const n=JSON.parse(t);if(n&&typeof n=="object"&&!Array.isArray(n)){const r=n.files&&typeof n.files=="object"&&!Array.isArray(n.files)?n.files:{};return{title:String(n.title||n.name||"React App"),entry:String(n.entry||n.main||"src/App.jsx"),files:Object.fromEntries(Object.entries(r).map(([s,i])=>[String(s),String(i??"")])),packageJson:n.packageJson&&typeof n.packageJson=="object"?n.packageJson:null,inputs:n.inputs&&typeof n.inputs=="object"&&!Array.isArray(n.inputs)?n.inputs:{}}}}catch{}return{title:"React App",entry:"src/App.jsx",files:{"src/App.jsx":t},inputs:{}}}function g7(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 y7(e){return String(e).replace(/<\/script/gi,"<\\/script")}function gm(e){const t=PI(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 rk(e,t=""){const n=PI(e),r=n.files||{},s=r[n.entry]!=null?n.entry:Object.keys(r).find(f=>/(?:^|\/)App\.[jt]sx$/i.test(f))||Object.keys(r).find(f=>/\.[jt]sx?$/i.test(f))||n.entry,i=g7(r[s]||""),a=Object.entries(r).filter(([f])=>/\.css$/i.test(f)).map(([,f])=>String(f||"")).join(`
|
|
101
|
-
|
|
102
|
-
`),l=String(n.title||"React App"),c=JSON.stringify(String(t||"")),u=JSON.stringify(n.inputs||{}),p=y7(i||"function App() { return <main><h1>React App</h1><p>No entry file content.</p></main>; }"),d=a||`
|
|
103
|
-
* { box-sizing: border-box; }
|
|
104
|
-
body { margin: 0; min-height: 100vh; background: #111112; color: #f4f0ff; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
|
|
105
|
-
main { min-height: 100vh; padding: 24px; }
|
|
106
|
-
button, input, select, textarea { font: inherit; }
|
|
107
|
-
`;return`<!doctype html>
|
|
108
|
-
<html>
|
|
109
|
-
<head>
|
|
110
|
-
<meta charset="utf-8" />
|
|
111
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
112
|
-
<base target="_blank" />
|
|
113
|
-
<title>${l.replace(/[<&>]/g,f=>({"<":"<",">":">","&":"&"})[f])}</title>
|
|
114
|
-
<style>${d.replace(/<\/style/gi,"<\\/style")}</style>
|
|
115
|
-
</head>
|
|
116
|
-
<body>
|
|
117
|
-
<div id="root"></div>
|
|
118
|
-
<script crossorigin src="https://unpkg.com/react@18/umd/react.production.min.js"><\/script>
|
|
119
|
-
<script crossorigin src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"><\/script>
|
|
120
|
-
<script crossorigin src="https://unpkg.com/@babel/standalone/babel.min.js"><\/script>
|
|
121
|
-
<script>
|
|
122
|
-
window.AGENTFLOW_INPUTS = ${u};
|
|
123
|
-
window.addEventListener("error", (event) => {
|
|
124
|
-
const root = document.getElementById("root");
|
|
125
|
-
if (root && !root.__agentflowRendered) {
|
|
126
|
-
root.innerHTML = '<pre style="margin:16px;padding:16px;border:1px solid rgba(255,117,117,.35);border-radius:8px;background:rgba(127,29,29,.18);color:#ffb8b8;white-space:pre-wrap;">' + String(event.message || event.error || 'React app failed').replace(/[<>&]/g, (ch) => ({'<':'<','>':'>','&':'&'}[ch])) + '</pre>';
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
document.addEventListener("click", (event) => {
|
|
130
|
-
const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
|
|
131
|
-
if (!link) return;
|
|
132
|
-
const rawHref = String(link.getAttribute("href") || "").trim();
|
|
133
|
-
if (!rawHref || rawHref.startsWith("#")) return;
|
|
134
|
-
if (/^javascript:/i.test(rawHref)) {
|
|
135
|
-
event.preventDefault();
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
event.preventDefault();
|
|
139
|
-
window.open(link.href, "_blank", "noopener,noreferrer");
|
|
140
|
-
}, true);
|
|
141
|
-
<\/script>
|
|
142
|
-
<script type="text/babel">
|
|
143
|
-
const { useCallback, useEffect, useMemo, useRef, useState } = React;
|
|
144
|
-
${p}
|
|
145
|
-
const RootComponent = typeof __AgentFlowDefault !== "undefined" ? __AgentFlowDefault : (typeof App !== "undefined" ? App : function MissingApp() {
|
|
146
|
-
return <main><h1>React App</h1><p>Entry file must export or define an App component.</p></main>;
|
|
147
|
-
});
|
|
148
|
-
ReactDOM.createRoot(document.getElementById("root")).render(<RootComponent inputs={window.AGENTFLOW_INPUTS} />);
|
|
149
|
-
document.getElementById("root").__agentflowRendered = true;
|
|
150
|
-
<\/script>
|
|
151
|
-
<script>
|
|
152
|
-
(() => {
|
|
153
|
-
const frameId = ${c};
|
|
154
|
-
const postSize = () => {
|
|
155
|
-
const doc = document.documentElement;
|
|
156
|
-
const body = document.body;
|
|
157
|
-
const height = Math.ceil(Math.max(
|
|
158
|
-
doc ? doc.scrollHeight : 0,
|
|
159
|
-
doc ? doc.offsetHeight : 0,
|
|
160
|
-
doc ? doc.clientHeight : 0,
|
|
161
|
-
body ? body.scrollHeight : 0,
|
|
162
|
-
body ? body.offsetHeight : 0,
|
|
163
|
-
body ? body.clientHeight : 0,
|
|
164
|
-
window.innerHeight || 0
|
|
165
|
-
));
|
|
166
|
-
window.parent.postMessage({ source: "agentflow-html-display-size", frameId, height }, "*");
|
|
167
|
-
};
|
|
168
|
-
window.addEventListener("load", postSize);
|
|
169
|
-
window.addEventListener("resize", postSize);
|
|
170
|
-
requestAnimationFrame(postSize);
|
|
171
|
-
setTimeout(postSize, 300);
|
|
172
|
-
setTimeout(postSize, 1000);
|
|
173
|
-
if (typeof ResizeObserver !== "undefined") {
|
|
174
|
-
const resizeObserver = new ResizeObserver(postSize);
|
|
175
|
-
resizeObserver.observe(document.documentElement);
|
|
176
|
-
if (document.body) resizeObserver.observe(document.body);
|
|
177
|
-
}
|
|
178
|
-
})();
|
|
179
|
-
<\/script>
|
|
180
|
-
</body>
|
|
181
|
-
</html>`}const II=new Set(["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"]),x7=["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"];function w7(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 b7(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 Rj(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 TI(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(II.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 RI(e){return{inputNames:Rj(e==null?void 0:e.inputs),outputNames:Rj(e==null?void 0:e.outputs)}}function k7(e,t,n){const r=RI(t),s=b7(e),i=[];for(const a of s)if(!TI(a.key,r)){const l=a.key.trim()===""?n("flow:placeholder.empty"):a.key.trim();i.push({start:a.start,end:a.end,message:n("flow:placeholder.invalidPlaceholder",{hint:l})})}return i}function v7(e,t){const n=RI(t),r=/\$\{([^}]*)\}/g,s=[];let i=0,a;for(;(a=r.exec(e))!==null;){a.index>i&&s.push({kind:"plain",text:e.slice(i,a.index)});const l=a[0],c=TI(a[1],n);s.push({kind:c?"ph-valid":"ph-invalid",text:l}),i=a.index+l.length}return i<e.length&&s.push({kind:"plain",text:e.slice(i)}),s}function S7(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function N7(e){return e.map(t=>{const n=S7(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 j7(e,t){const n=[];for(const r of(e==null?void 0:e.inputs)??[]){const s=(r==null?void 0:r.name)!=null?String(r.name).trim():"";if(!s)continue;const i=(r==null?void 0:r.type)!=null?String(r.type):"";n.push({section:"input",insert:`input.${s}`,label:s,subtitle:i?t("flow:placeholder.inputSubtitle",{type:i}):t("flow:placeholder.inputSubtitleNoType")})}for(const r of(e==null?void 0:e.outputs)??[]){const s=(r==null?void 0:r.name)!=null?String(r.name).trim():"";if(!s)continue;const i=(r==null?void 0:r.type)!=null?String(r.type):"";n.push({section:"output",insert:`output.${s}`,label:s,subtitle:i?t("flow:placeholder.outputSubtitle",{type:i}):t("flow:placeholder.outputSubtitleNoType")})}for(const r of x7)II.has(r)&&n.push({section:"runtime",insert:r,label:r,subtitle:t("flow:placeholder.runtimeConst")});return n}function C7(e,t){const n=t.toLowerCase();return n?e.filter(r=>[r.insert,r.label,r.subtitle??""].map(i=>String(i).toLowerCase()).some(i=>i.includes(n))):e}function _7(e,t){if(!e||t<0)return null;const n=Math.min(t,e.value.length),r=getComputedStyle(e),s=document.createElement("div");s.setAttribute("aria-hidden","true"),s.style.visibility="hidden",s.style.position="fixed",s.style.top="0",s.style.left="-99999px",s.style.whiteSpace="pre-wrap",s.style.wordWrap="break-word",s.style.overflow="hidden";const i=e.clientWidth;if(i<=0)return null;s.style.width=`${i}px`,s.style.font=r.font,s.style.lineHeight=r.lineHeight,s.style.padding=r.padding,s.style.border=r.border,s.style.boxSizing=r.boxSizing,s.style.letterSpacing=r.letterSpacing,s.style.textIndent=r.textIndent,s.style.tabSize=r.tabSize||"8",s.textContent=e.value.slice(0,n);const a=document.createElement("span");a.textContent="",s.appendChild(a),document.body.appendChild(s);const l=a.getBoundingClientRect(),c=parseFloat(r.lineHeight),u=Number.isFinite(c)&&c>0?c:l.height||16;return document.body.removeChild(s),{top:l.top,left:l.left,bottom:l.bottom,height:u}}function Hf({value:e,onChange:t,disabled:n,placeholder:r,rows:s=8,textareaClassName:i,ioSlots:a,variant:l="drawer",images:c,onImagesChange:u}){const{t:p}=Pr(),d=m.useId(),f=m.useRef(null),h=m.useRef(null),[g,k]=m.useState(0),[w,y]=m.useState(0),[v,x]=m.useState(null),C=m.useMemo(()=>Xi(c),[c]),N=m.useMemo(()=>k7(e,a,p),[e,a,p]),j=N.length>0,E=m.useMemo(()=>v7(e,a),[e,a]),P=m.useMemo(()=>N7(E),[E]),O=m.useMemo(()=>n?null:w7(e,g),[e,g,n]),B=m.useMemo(()=>{if(!O)return[];const D=j7(a,p);return C7(D,O.query)},[O,a,p]);m.useEffect(()=>{y(D=>{const $=Math.max(0,B.length-1);return Math.min(Math.max(0,D),$)})},[B.length]);const W=m.useCallback(()=>{const D=f.current;if(!D||!O||B.length===0){x(null);return}const $=_7(D,g);if(!$){x(null);return}const I=4,F=44,_=13.5*16,X=Math.min(B.length*F+8,_);let V=$.bottom+I;V+X>window.innerHeight-8&&(V=Math.max(8,$.top-X-I));const T=288;let ee=$.left;ee=Math.max(8,Math.min(ee,window.innerWidth-T-8)),x({top:V,left:ee})},[O,B.length,g]);m.useLayoutEffect(()=>{if(!O||B.length===0){x(null);return}const D=requestAnimationFrame(()=>W());return()=>cancelAnimationFrame(D)},[O,B.length,g,e,W]),m.useEffect(()=>{if(!O||B.length===0)return;const D=()=>W();return window.addEventListener("scroll",D,!0),window.addEventListener("resize",D),()=>{window.removeEventListener("scroll",D,!0),window.removeEventListener("resize",D)}},[O,B.length,W]);const z=m.useCallback(D=>{if(!O)return;const{atIndex:$}=O,I=e.slice(0,$)+"${"+D+"}"+e.slice(g);t(I);const F=$+D.length+3;queueMicrotask(()=>{const _=f.current;_&&(_.focus(),_.setSelectionRange(F,F)),k(F)})},[O,e,g,t]),L=m.useCallback(()=>{const D=f.current,$=h.current;!D||!$||($.scrollTop=D.scrollTop,$.scrollLeft=D.scrollLeft,O&&B.length>0&&queueMicrotask(()=>W()))},[O,B.length,W]),R=m.useCallback(D=>{if(!n&&O&&B.length>0&&(D.key==="ArrowDown"||D.key==="ArrowUp"||D.key==="Enter")){if(D.key==="ArrowDown")D.preventDefault(),y($=>($+1)%B.length);else if(D.key==="ArrowUp")D.preventDefault(),y($=>($-1+B.length)%B.length);else if(D.key==="Enter"&&!D.shiftKey){D.preventDefault();const $=B[w];$&&z($.insert)}}},[n,O,B,w,z]),K=m.useCallback(async D=>{if(n||typeof u!="function")return!1;const $=await EI({files:D,body:e,images:C});return $?(t($.body),u($.images),queueMicrotask(()=>{const I=f.current;if(!I)return;I.focus();const F=$.body.length;I.setSelectionRange(F,F),k(F)}),!0):!1},[n,C,t,u,e]);return o.jsxs("div",{className:"af-body-prompt-editor"+(l==="expand"?" af-body-prompt-editor--expand":""),children:[C.length>0?o.jsx("div",{className:"af-body-image-list","aria-label":"image attachments",children:C.map((D,$)=>o.jsxs("span",{className:"af-body-image-chip",title:D.name,children:[o.jsx("img",{src:D.dataUrl,alt:""}),o.jsxs("span",{children:["[",D.label||`image ${$+1}`,"]"]})]},D.id||$))}):null,o.jsxs("div",{className:"af-body-prompt-stack",children:[o.jsx("pre",{ref:h,className:"af-body-prompt-backdrop "+i,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:P+`
|
|
182
|
-
`}}),o.jsx("textarea",{ref:f,className:"af-body-prompt-textarea "+i,rows:s,value:e,disabled:n,placeholder:r,spellCheck:!1,"aria-invalid":j,"aria-describedby":j?d:void 0,onChange:D=>{t(D.target.value),k(D.target.selectionStart??D.target.value.length)},onSelect:D=>{const $=D.target;$ instanceof HTMLTextAreaElement&&k($.selectionStart??0)},onClick:D=>{const $=D.target;$ instanceof HTMLTextAreaElement&&k($.selectionStart??0)},onKeyUp:D=>{const $=D.target;$ instanceof HTMLTextAreaElement&&k($.selectionStart??$.value.length)},onKeyDown:R,onPaste:D=>{const $=_I(D);$.length!==0&&(D.preventDefault(),K($).catch(()=>{}))},onDragOver:D=>{ju(D).length>0&&D.preventDefault()},onDrop:D=>{const $=ju(D);$.length!==0&&(D.preventDefault(),K($).catch(()=>{}))},onScroll:L})]}),O&&B.length>0&&v?Cr.createPortal(o.jsx("ul",{className:"af-body-ph-menu af-body-ph-menu--pop af-composer-mention-menu",role:"listbox","aria-label":p("flow:nodeProps.placeholderSlots"),style:{position:"fixed",top:v.top,left:v.left,right:"auto",bottom:"auto",margin:0,zIndex:2e4},children:B.map((D,$)=>o.jsx("li",{role:"option","aria-selected":$===w,children:o.jsxs("button",{type:"button",className:"af-composer-mention-item"+($===w?" af-composer-mention-item--active":""),onMouseDown:I=>I.preventDefault(),onMouseEnter:()=>y($),onClick:()=>z(D.insert),children:[o.jsx("span",{className:"af-composer-mention-id",children:`\${${D.insert}}`}),D.subtitle?o.jsx("span",{className:"af-composer-mention-sub",children:D.subtitle}):null]})},`${D.section}-${D.insert}`))}),document.body):null,j?o.jsx("p",{id:d,className:"af-body-ph-issues",role:"status",children:N.map(D=>D.message).join(" · ")}):null]})}const E7=/^[a-zA-Z_][a-zA-Z0-9_-]*$/;function Uc(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function Mj({kind:e,label:t,slots:n,onSlotsChange:r,disabled:s,requiredReadonly:i=!0}){const{t:a}=Pr(),l=()=>r([...n,{type:"text",name:"",default:"",required:!1,showOnNode:!1}]),c=d=>r(n.filter((f,h)=>h!==d)),u=(d,f,h)=>{const g=n.map((k,w)=>{if(w!==d)return k;const y={...k,[f]:h};return f==="required"&&h===!0&&(y.showOnNode=!0),y});r(g)},p=e==="input"?"input":"output";return o.jsxs("div",{className:"af-node-props-field af-node-props-field--io",children:[o.jsxs("div",{className:"af-node-props-io-head",children:[o.jsx("span",{className:"af-node-props-label",children:t}),o.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-io-add",onClick:l,disabled:s,"aria-label":a("flow:nodeProps.addPinAriaLabel",{label:t}),children:a("flow:nodeProps.addPin")})]}),o.jsx("p",{className:"af-node-props-io-hint",children:a("flow:nodeProps.handleHint",{prefix:p})}),n.length===0?o.jsx("p",{className:"af-node-props-io-empty",children:a(e==="input"?"flow:nodeProps.noInputPins":"flow:nodeProps.noOutputPins")}):null,n.length>0?o.jsxs("div",{className:"af-node-props-io-table",role:"group","aria-label":t,children:[o.jsxs("div",{className:"af-node-props-io-table-head","aria-hidden":!0,children:[o.jsx("span",{children:a("flow:nodeProps.handle")}),o.jsx("span",{children:a("flow:nodeProps.type")}),o.jsx("span",{children:a("flow:nodeProps.name")}),o.jsx("span",{children:a("flow:nodeProps.defaultValue")}),o.jsx("span",{children:a("flow:nodeProps.description")}),o.jsx("span",{children:a("flow:nodeProps.required")}),o.jsx("span",{children:a("flow:nodeProps.showOnNode")}),o.jsx("span",{})]}),n.map((d,f)=>o.jsxs("div",{className:"af-node-props-io-row",children:[o.jsxs("span",{className:"af-node-props-io-handle",title:`${p}-${f}`,children:[p,"-",f]}),o.jsx("select",{className:"af-node-props-input af-node-props-io-cell",value:d.type,onChange:h=>u(f,"type",h.target.value),disabled:s,"aria-label":a("flow:nodeProps.pinTypeAriaLabel",{label:t,index:f}),children:["node","text","file","bool"].map(h=>o.jsx("option",{value:h,children:h},h))}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:d.name,onChange:h=>u(f,"name",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinNameAriaLabel",{label:t,index:f})}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:d.default,onChange:h=>u(f,"default",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinDefaultAriaLabel",{label:t,index:f})}),o.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:d.description||"",onChange:h=>u(f,"description",h.target.value),disabled:s,spellCheck:!1,autoComplete:"off","aria-label":a("flow:nodeProps.pinDescriptionAriaLabel",{label:t,index:f})}),o.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.requiredHint"),children:o.jsx("input",{type:"checkbox",checked:!!d.required,onChange:h=>{i||u(f,"required",h.target.checked)},disabled:s||i,"aria-label":a("flow:nodeProps.pinRequiredAriaLabel",{label:t,index:f})})}),o.jsx("label",{className:"af-node-props-io-flag",title:a("flow:nodeProps.showOnNodeHint"),children:o.jsx("input",{type:"checkbox",checked:d.showOnNode!==!1,onChange:h=>u(f,"showOnNode",h.target.checked),disabled:s,"aria-label":a("flow:nodeProps.pinShowOnNodeAriaLabel",{label:t,index:f})})}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-io-remove",onClick:()=>c(f),disabled:s,"aria-label":a("flow:nodeProps.deletePinAriaLabel",{label:t,index:f}),title:a("flow:nodeProps.deletePin"),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},`${p}-${f}`))]}):null]})}function A7({draft:e,setDraft:t,definitionId:n,systemPromptReadonly:r,modelLists:s,disabled:i,onIdBlur:a,onClose:l,onPublishToMarketplace:c,allowEditRequiredPins:u=!1,error:p,ioSlots:d}){const{t:f}=Pr(),[h,g]=m.useState(!1),[k,w]=m.useState(!1),[y,v]=m.useState({status:"idle",message:""}),x=m.useCallback(L=>{t(R=>R&&{...R,...L})},[t]),{cursorList:C,opencodeList:N,claudeCodeList:j,codexList:E,currentNotInLists:P}=m.useMemo(()=>{const L=Array.isArray(s==null?void 0:s.cursor)?s.cursor:[],R=Array.isArray(s==null?void 0:s.opencode)?s.opencode:[],K=Array.isArray(s==null?void 0:s.claudeCode)?s.claudeCode:[],D=Array.isArray(s==null?void 0:s.codex)?s.codex:[],$=new Set([...L,...R,...K,...D].map(Uc)),I=((e==null?void 0:e.model)??"").trim(),F=I.startsWith("cursor:")?I.slice(7):I.startsWith("opencode:")?I.slice(9):I.startsWith("codex:")?I.slice(6):I.startsWith("claude-code:")?I.slice(12):I,_=I&&!$.has(F)?I:"";return{cursorList:L,opencodeList:R,claudeCodeList:K,codexList:D,currentNotInLists:_}},[s,e==null?void 0:e.model]);if(!e)return null;const O=String(e.script??""),B=n==="tool_nodejs"||O.trim()!=="",W=typeof c=="function"&&!i&&(e==null?void 0:e.newId),z=async()=>{if(W){v({status:"running",message:f("flow:nodeProps.publishRunning")});try{const L=await c(e,n);v({status:"success",message:L!=null&&L.definitionId?f("flow:nodeProps.publishSuccessWithId",{id:L.definitionId}):f("flow:nodeProps.publishSuccess")})}catch(L){v({status:"error",message:String((L==null?void 0:L.message)||L)})}}};return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"af-pipeline-drawer-head af-node-props-head",children:[o.jsx("h2",{className:"af-pipeline-drawer-title",children:f("flow:nodeProps.title")}),o.jsxs("div",{className:"af-node-props-head-actions",children:[o.jsxs("button",{type:"button",className:"af-btn-ghost af-node-props-market-btn",onClick:z,disabled:!W||y.status==="running",title:f("flow:nodeProps.publishToMarketplaceHint"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"inventory_2"}),y.status==="running"?f("flow:nodeProps.publishing"):f("flow:nodeProps.publishToMarketplace")]}),o.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-close-secondary",onClick:l,children:f("common:common.close")})]})]}),o.jsxs("div",{className:"af-pipeline-drawer-body af-node-props-body",children:[p?o.jsx("p",{className:"af-err af-node-props-err",children:p}):null,y.message?o.jsx("p",{className:`af-node-props-market-status af-node-props-market-status--${y.status}`,children:y.message}):null,o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:f("flow:node.nodeType")}),o.jsx("div",{className:"af-pipeline-drawer-readonly af-node-props-readonly-mono",children:n})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[f("flow:nodeProps.instanceId"),o.jsx("span",{className:"af-node-props-hint",children:f("flow:node.displayNameHint")})]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.newId,onChange:L=>x({newId:L.target.value}),onBlur:a,disabled:i,spellCheck:!1,autoComplete:"off","aria-label":f("flow:nodeProps.instanceId")})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[f("flow:node.displayName"),"(LABEL)"]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.label,onChange:L=>x({label:L.target.value}),disabled:i,spellCheck:!1})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[f("flow:node.role"),"(ROLE)"]}),o.jsx("select",{className:"af-node-props-select",value:rd.includes(e.role)?e.role:f("flow:roles.normal"),onChange:L=>x({role:L.target.value}),disabled:i,children:rd.map(L=>o.jsx("option",{value:L,children:L},L))})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsxs("span",{className:"af-node-props-label",children:[f("flow:node.model"),"(MODEL)"]}),o.jsx("span",{className:"af-node-props-sublabel",children:f("flow:node.modelHint")}),o.jsxs("select",{className:"af-node-props-select",value:(()=>{const L=(e.model||"").trim();return L?P||L:""})(),onChange:L=>x({model:L.target.value}),disabled:i,"aria-label":f("flow:nodeProps.modelAriaLabel"),children:[o.jsx("option",{value:"",children:f("flow:node.defaultModel")}),P?o.jsxs("option",{value:P,children:[P,f("flow:nodeProps.yamlValueNotInList")]}):null,C.length>0?o.jsx("optgroup",{label:"Cursor",children:C.map(L=>o.jsx("option",{value:Uc(L),children:L},`c-${L}`))}):null,N.length>0?o.jsx("optgroup",{label:"OpenCode",children:N.map(L=>o.jsx("option",{value:`opencode:${Uc(L)}`,children:L},`o-${L}`))}):null,E.length>0?o.jsx("optgroup",{label:"Codex",children:E.map(L=>o.jsx("option",{value:`codex:${Uc(L)}`,children:L},`codex-${L}`))}):null,j.length>0?o.jsx("optgroup",{label:"Claude Code",children:j.map(L=>o.jsx("option",{value:`claude-code:${Uc(L)}`,children:L},`cc-${L}`))}):null]})]}),o.jsx(Mj,{kind:"input",label:f("flow:nodeProps.inputPins"),slots:Array.isArray(e.inputs)?e.inputs:[],onSlotsChange:L=>x({inputs:L}),disabled:i,requiredReadonly:!u}),o.jsx(Mj,{kind:"output",label:f("flow:nodeProps.outputPins"),slots:Array.isArray(e.outputs)?e.outputs:[],onSlotsChange:L=>x({outputs:L}),disabled:i,requiredReadonly:!u}),B?o.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[o.jsxs("div",{className:"af-node-props-prompt-head",children:[o.jsxs("span",{className:"af-node-props-label",children:[f("flow:node.directCommand"),"(script)",o.jsx("span",{className:"af-node-props-hint",children:f("flow:node.scriptHint")})]}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>w(!0),"aria-label":f("flow:nodeProps.expandEditScript"),title:f("flow:nodeProps.expand"),disabled:i,children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(Hf,{value:O,onChange:L=>x({script:L}),disabled:i,placeholder:f("flow:nodeProps.scriptPlaceholder"),rows:6,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea af-node-props-script-textarea",ioSlots:d,variant:"drawer"})]}):null,o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:"Script file(scriptRef)"}),o.jsxs("span",{className:"af-node-props-sublabel",children:["Relative path under this flow, for example nodes/",e.id,"/script.mjs"]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.scriptRef||"",onChange:L=>x({scriptRef:L.target.value}),disabled:i,spellCheck:!1,autoComplete:"off"})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:"Implementation file(implementationRef)"}),o.jsxs("span",{className:"af-node-props-sublabel",children:["Relative path under this flow, for example nodes/",e.id,"/implementation.md"]}),o.jsx("input",{type:"text",className:"af-node-props-input",value:e.implementationRef||"",onChange:L=>x({implementationRef:L.target.value}),disabled:i,spellCheck:!1,autoComplete:"off"})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:"Implementation mode"}),o.jsxs("select",{className:"af-node-props-select",value:e.implementationMode||"",onChange:L=>x({implementationMode:L.target.value}),disabled:i,children:[o.jsx("option",{value:"",children:"auto"}),o.jsx("option",{value:"script",children:"script"}),o.jsx("option",{value:"steps",children:"steps"}),o.jsx("option",{value:"hybrid",children:"hybrid"})]})]}),o.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[o.jsxs("div",{className:"af-node-props-prompt-head",children:[o.jsx("span",{className:"af-node-props-label",children:f("flow:node.userPrompt")}),o.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>g(!0),"aria-label":f("flow:nodeProps.expandEdit"),title:f("flow:nodeProps.expand"),disabled:i,children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),o.jsx(Hf,{value:e.body,onChange:L=>x({body:L}),images:e.images,onImagesChange:L=>x({images:L}),disabled:i,placeholder:f("flow:nodeProps.bodyPlaceholder"),rows:8,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea",ioSlots:d,variant:"drawer"})]}),o.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[o.jsx("span",{className:"af-node-props-label",children:f("flow:node.systemDescription")}),o.jsx("textarea",{className:"af-pipeline-drawer-textarea af-node-props-system-readonly",rows:4,readOnly:!0,value:r||f("flow:nodeProps.noDescription"),spellCheck:!1})]})]}),k?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":f("flow:nodeProps.editScript"),onMouseDown:L=>{L.target===L.currentTarget&&w(!1)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:f("flow:node.directCommand")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>w(!1),"aria-label":f("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx(Hf,{value:O,onChange:L=>x({script:L}),disabled:i,placeholder:f("flow:nodeProps.scriptPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:d,variant:"expand"})]})}):null,h?o.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":f("flow:nodeProps.editUserPrompt"),onMouseDown:L=>{L.target===L.currentTarget&&g(!1)},children:o.jsxs("div",{className:"af-node-props-expand-panel",children:[o.jsxs("div",{className:"af-node-props-expand-head",children:[o.jsx("span",{className:"af-node-props-expand-title",children:f("flow:node.body")}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>g(!1),"aria-label":f("flow:nodeProps.collapse"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsx(Hf,{value:e.body,onChange:L=>x({body:L}),images:e.images,onImagesChange:L=>x({images:L}),disabled:i,placeholder:f("flow:nodeProps.bodyPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:d,variant:"expand"})]})}):null]})}function P7({open:e,onClose:t,flowId:n,flowSource:r,onArchived:s}){const{t:i}=Pr(),a=m.useId(),l=m.useRef(null),[c,u]=m.useState(""),[p,d]=m.useState(!1),[f,h]=m.useState("");if(m.useEffect(()=>{if(!e)return;u(""),h(""),d(!1);const y=requestAnimationFrame(()=>{var v;return(v=l.current)==null?void 0:v.focus()});return()=>cancelAnimationFrame(y)},[e,n]),!e)return null;const g=c.trim(),k=g===n;async function w(y){if(y.preventDefault(),!(!k||p)){d(!0),h("");try{const v=await fetch("/api/flow/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:g})}),x=await v.json().catch(()=>({}));if(!v.ok){h(typeof x.error=="string"?x.error:i("project:archiveModal.archiveFailed"));return}s()}catch(v){h(String((v==null?void 0:v.message)||v))}finally{d(!1)}}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&t()},children:o.jsxs("div",{ref:l,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":a,tabIndex:-1,onMouseDown:y=>y.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:a,className:"af-shortcuts-panel__title",children:i("project:archiveModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":i("project:archiveModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:w,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:i("project:archiveModal.lead",{flowId:n})}),o.jsxs("label",{className:"af-new-pipeline-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:i("project:archiveModal.confirmLabel")}),o.jsx("input",{type:"text",className:"af-new-pipeline-input",value:c,onChange:y=>u(y.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":g.length>0&&!k})]}),f?o.jsx("p",{className:"af-err af-new-pipeline-err",children:f}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:p,children:i("project:archiveModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!k||p,children:i(p?"project:archiveModal.archiving":"project:archiveModal.confirmArchive")})]})]})]})})}function I7({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:s=!1,onDeleted:i}){const{t:a}=Pr(),l=m.useId(),c=m.useRef(null),[u,p]=m.useState(""),[d,f]=m.useState(!1),[h,g]=m.useState("");if(m.useEffect(()=>{if(!e)return;p(""),g(""),f(!1);const v=requestAnimationFrame(()=>{var x;return(x=c.current)==null?void 0:x.focus()});return()=>cancelAnimationFrame(v)},[e,n]),!e)return null;const k=u.trim(),w=k===n;async function y(v){if(v.preventDefault(),!w||d)return;f(!0),g("");let x=null;try{const C=new AbortController;x=setTimeout(()=>C.abort(),15e3);const N=await fetch("/api/flow/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:k,flowArchived:s}),signal:C.signal}),j=await N.json().catch(()=>({}));if(!N.ok){g(typeof j.error=="string"?j.error:a("project:deleteModal.deleteFailed"));return}try{for(let E=localStorage.length-1;E>=0;E--){const P=localStorage.key(E);P&&(P.startsWith(`af:composer-sessions:${n}:${r}`)||P.startsWith(`af:composer-active-session:${n}:${r}`)||P.startsWith(`af:workspace-composer:${n}:${r}`))&&localStorage.removeItem(P)}}catch{}await i()}catch(C){if((C==null?void 0:C.name)==="AbortError"){g(a("project:deleteModal.deleteTimeout"));return}g(String((C==null?void 0:C.message)||C))}finally{x&&clearTimeout(x),f(!1)}}return o.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:v=>{v.target===v.currentTarget&&t()},children:o.jsxs("div",{ref:c,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":l,tabIndex:-1,onMouseDown:v=>v.stopPropagation(),children:[o.jsxs("div",{className:"af-shortcuts-panel__head",children:[o.jsx("h2",{id:l,className:"af-shortcuts-panel__title",children:a("project:deleteModal.title")}),o.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":a("project:deleteModal.close"),children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:y,children:[o.jsx("p",{className:"af-new-pipeline-lead",children:a("project:deleteModal.lead",{flowId:n})}),o.jsxs("label",{className:"af-new-pipeline-field",children:[o.jsx("span",{className:"af-pipeline-drawer-label",children:a("project:deleteModal.confirmLabel")}),o.jsx("input",{type:"text",className:"af-new-pipeline-input",value:u,onChange:v=>p(v.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":k.length>0&&!w})]}),h?o.jsx("p",{className:"af-err af-new-pipeline-err",children:h}):null,o.jsxs("div",{className:"af-new-pipeline-actions",children:[o.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:d,children:a("project:deleteModal.cancel")}),o.jsx("button",{type:"submit",className:"af-btn-primary af-btn-destructive",disabled:!w||d,children:a(d?"project:deleteModal.deleting":"project:deleteModal.confirmDelete")})]})]})]})})}const $j=80,T7=220;function R7(e){if(!e||typeof e!="object")return e;const{selected:t,dragging:n,resizing:r,className:s,positionAbsolute:i,measured:a,internals:l,...c}=e;return c}function M7(e){if(!e||typeof e!="object")return e;const{selected:t,className:n,...r}=e;return r}function Wf(e,t,n){const r={nodes:Array.isArray(e)?e.map(R7):[],edges:Array.isArray(t)?t.map(M7):[],extra:n&&typeof n=="object"?n:{}},s=JSON.stringify(r);return{value:JSON.parse(s),signature:s}}function ry(e,t){const n=[...e,t];return n.length>$j?n.slice(n.length-$j):n}function $7({nodes:e,edges:t,extra:n,enabled:r=!0,onRestore:s}){const[i,a]=m.useState(0),l=m.useRef([]),c=m.useRef([]),u=m.useRef(null),p=m.useRef(null),d=m.useRef(null),f=m.useRef(null),h=m.useRef(!1),g=m.useCallback(()=>a(N=>N+1),[]),k=m.useCallback(()=>{f.current&&(window.clearTimeout(f.current),f.current=null)},[]),w=m.useCallback(()=>{k();const N=p.current,j=d.current;return p.current=null,d.current=null,!N||!j||N.signature===j.signature?(j&&(u.current=j),!1):(l.current=ry(l.current,N),c.current=[],u.current=j,g(),!0)},[g,k]),y=m.useCallback((N=[],j=[],E={})=>{k(),l.current=[],c.current=[],p.current=null,d.current=null,u.current=Wf(N,j,E),h.current=!1,g()},[g,k]),v=m.useCallback(N=>{h.current=!0,u.current=N,p.current=null,d.current=null,k(),s==null||s(N.value),g()},[g,k,s]),x=m.useCallback(()=>{w();const N=u.current||Wf(e,t,n),j=l.current.pop();return j?(c.current=ry(c.current,N),v(j),!0):(g(),!1)},[g,t,n,w,e,v]),C=m.useCallback(()=>{w();const N=u.current||Wf(e,t,n),j=c.current.pop();return j?(l.current=ry(l.current,N),v(j),!0):(g(),!1)},[g,t,n,w,e,v]);return m.useEffect(()=>()=>k(),[k]),m.useEffect(()=>{if(!r)return;const N=Wf(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&&(p.current||(p.current=u.current),d.current=N,k(),f.current=window.setTimeout(()=>{w()},T7))},[k,t,r,n,w,e]),{canUndo:l.current.length>0||!!p.current,canRedo:c.current.length>0,resetHistory:y,undo:x,redo:C,version:i}}const L7="af:workspace-graph:v2",Lj="agentflow.workspace.sidebarCollapsed",ul=["DISPLAY","CONTROL","TOOL","PROVIDE","AGENT"],O7=new Set(["control_start","control_end","control_load_skills","control_load_mcp","control_cd_workspace","control_user_workspace"]),D7={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:""}]},F7={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:""}]},z7={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}]},B7={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}]},H7={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}]},W7={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}]},V7=new Set(["png","jpg","jpeg","gif","webp","svg"]),MI=320,$I=180,LI=960,gh=96,OI=900,rw=520,sw=320,Vf=52,Ta=240,Ra=160,iw="display-ref:",id="0 9 * * *",K7="Asia/Shanghai",q7="0.1.101";function U7(){const e=new URLSearchParams(window.location.search);return{flowId:e.get("flowId")||"",flowSource:e.get("flowSource")||"user",archived:e.get("archived")==="1"||e.get("flowArchived")==="1"}}function $r(e){const t=new URLSearchParams;return e.flowId&&t.set("flowId",e.flowId),e.flowSource&&t.set("flowSource",e.flowSource),e.archived&&t.set("archived","1"),t}function sk(e,t=4e3){const n=String(e??"").trim();return n?n.length>t?`${n.slice(0,t)}
|
|
183
|
-
...[truncated ${n.length-t} chars]`:n:""}function Y7(e){const t=sk(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 ik(e,t=80){return(Array.isArray(e)?e:[]).map(Y7).filter(Boolean).slice(-t)}function G7(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n={};for(const[r,s]of Object.entries(t).slice(-80)){const i=String(r||"").trim();if(!i||!s||typeof s!="object")continue;const a=ik(s.messages,40),l=sk(s.draft||"",2e3);!a.length&&!l||(n[i]={sessionId:String(s.sessionId||`nodechat_${i}`),messages:a,...l?{draft:l}:{},candidateContent:"",running:!1,error:""})}return n}function J7(e){return(Array.isArray(e)?e:[]).map(t=>{const n=String((t==null?void 0:t.id)||"").trim();if(!n)return null;const r=ik(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:sk((t==null?void 0:t.label)||n,120),status:s==="failed"?"failed":"done",messages:r}}).filter(Boolean).slice(-20)}function Oj(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:ik(n.messages,100),runSessions:J7(n.runSessions)},nodeChats:G7(t.nodeChats)}}function yh(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 V7.has(n)}function od(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=$r(t||{});return s.set("path",r),n.download&&s.set("download","1"),`/api/workspace/file/raw?${s.toString()}`}function X7(e){const t=String((e==null?void 0:e.flowId)||"").trim();if(!t)return"";const n=String((e==null?void 0:e.flowSource)||"user").trim()||"user";return`af:composer-skills:workspace:${t}:${n}${e!=null&&e.archived?":archived":""}`}function Q7(e){const t=String((e==null?void 0:e.username)||(e==null?void 0:e.userId)||"").trim();return t?`${Lj}:${t}`:Lj}function Z7(e){try{const t=window.localStorage.getItem(e);if(t==="false")return!1;if(t==="true")return!0}catch{}return!0}function Dj(e){return!e||typeof e.closest!="function"?!1:!!e.closest("input, textarea, select, [contenteditable='true']")}function eq(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 tq(e){return!e||typeof e.closest!="function"?!1:!!e.closest(".af-flow-node__prompt-stack")&&!eq(e)}function nq(e){const t=String(e||"").trim();if(!t||rq(t))return"";if(/^运行完成/.test(t))return"运行完成";if(/^运行暂停/.test(t))return"运行暂停";if(/^运行停止/.test(t))return"运行停止";if(/^思考中/.test(t))return"模型正在思考";if(/^生成回复中/.test(t))return"模型正在生成回复";if(/^Timing\s+(.+?):\s+(\d+)ms/i.test(t)){const n=t.match(/^Timing\s+(.+?):\s+(\d+)ms/i);return`耗时:${(n==null?void 0:n[1])||"step"} ${(n==null?void 0:n[2])||"0"}ms`}if(/^工具\s+(.+?)(?:\s+\((started|completed)\))?$/i.test(t)){const n=t.match(/^工具\s+(.+?)(?:\s+\((started|completed)\))?$/i),r=String((n==null?void 0:n[1])||"tool").trim(),s=String((n==null?void 0:n[2])||"").toLowerCase();if(r==="thinking")return"模型正在思考";const i=r==="readToolCall"?"读取文件/上下文":r==="grepToolCall"?"搜索代码":r==="editToolCall"?"编辑文件":r;return s==="completed"?`完成:${i}`:`执行:${i}`}return/^\[stderr\]/.test(t)?t:""}function rq(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 sq(e){const t=String(e||"").trim();return t?/^模型/.test(t)?"model":/^(执行|完成|耗时):/.test(t)?"tool":/^运行/.test(t)?"run":/^\[stderr\]/.test(t)?"error":"other":"other"}function sy(e,t,n,r="Workspace Run"){var c;const s=String(n||"").trim(),i=Array.isArray(e)?e.find(u=>String((u==null?void 0:u.id)||"")===s):null,a=t&&typeof t=="object"?t[s]:null;return String(((c=i==null?void 0:i.data)==null?void 0:c.label)||(a==null?void 0:a.label)||"").trim()||s||r}function iy(e,t,n="Workspace Run"){const r=String(e||"").trim()||n,s=String(t||"").trim();return!s||r===s?r:`${r} (${s})`}function ca(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 Fj(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 iq(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 oq(e){const t=iq(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 DI(e){const t=String(e||"").trim();if(!/^https?:\/\//i.test(t))return t;try{const n=new URL(t);if(n.hostname==="0.0.0.0"||n.hostname==="::"||n.hostname==="[::]"){const r=window.location.hostname;n.hostname=r&&r!=="0.0.0.0"&&r!=="::"?r:"127.0.0.1"}return n.href}catch{return t}}function xh(e){const t=String((e==null?void 0:e.url)||(e==null?void 0:e.href)||"").trim();if(t)return DI(t);const n=String((e==null?void 0:e.path)||"").trim();return n?`file://${n}`:""}function Ko(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 Ma(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 ok(e){return Ko(e==null?void 0:e.status)==="done"&&Ma(e)!=="observation"}function Bi(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 jp(e){return!e||typeof e!="object"?"":String(e.detail||e.description||e.summary||e.message||e.reason||"")}function ak(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 aq(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 lq(e,t){const n=Bi(e,t),r=Ko(e==null?void 0:e.status),s=ok(e),a=`${$a(e)} ${ak(e)}`,l=aq(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"||Ma(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"||Ma(e)==="observation")return`${l} GitLab Issue 状态已观察`}return/implementation_in_progress|impl_in_progress/.test(a)?`正在实现 ${l}`:/implementation_ready/.test(a)?`可以开始实现 ${l}`:n}function cq(e){if(!e||typeof e!="object")return"";const t=Ko(e.status),n=Ma(e),r=ok(e),i=`${$a(e)} ${ak(e)}`,a=ym(e),l=a.some(d=>/方案|plan|markdown|review|预览/i.test(String(d.label||""))),c=a.some(d=>/gitlab issue/i.test(String(d.label||""))),u=a.some(d=>/gitlab epic/i.test(String(d.label||"")));if(/issue-plan:|plan_draft_local|submit-plan|plan-doc|plan_doc_confirmed/.test(i))return r?l?"方案已确认并归档;可从下方打开方案文档预览。":"方案已确认并归档。":n==="observation"||t==="observed"?"客户端上报了当前方案阶段;这不是 ai-doc 确认结果。":t==="superseded"?"该客户端观察已被更新状态替代,仅保留为运行态记录。":t==="current"?"方案草稿已生成,等待确认;确认后会归档为正式方案。":"方案草稿已生成,等待确认。";if(/issue-gitlab:|gitlab_issue_missing|ensure-gitlab-issue/.test(i))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(i))return"需求分支已就绪,当前处于实现中;实现 MR 创建后会记录到本 Issue。";if(/implementation_ready/.test(i))return"方案文档和 GitLab Issue 已就绪,等待开始实现。";const p=jp(e);return p?p.length>180&&a.length?"相关结果和产物已更新;可从下方链接查看。":p:""}function wh(e){return!e||typeof e!="object"?"":String(e.time||e.at||e.observedAt||e.observed_at||e.reportedAt||e.reported_at||e.startedAt||e.started_at||e.completedAt||e.completed_at||e.updatedAt||e.updated_at||e.createdAt||e.created_at||"")}const FI="Asia/Shanghai",uq=new Intl.DateTimeFormat("zh-CN",{timeZone:FI,year:"numeric",month:"2-digit",day:"2-digit"}),dq=new Intl.DateTimeFormat("zh-CN",{timeZone:FI,hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1});function zI(e){const t=wh(e);if(!t)return null;const n=Date.parse(t);return Number.isFinite(n)?new Date(n):null}function fq(e){const t=zI(e);return t?uq.format(t).replace(/\//g,"-"):"无时间"}function pq(e){const t=zI(e);return t?dq.format(t):""}function hq(e=[]){const t=[];return(Array.isArray(e)?e:[]).forEach((n,r)=>{const s=fq(n);let i=t[t.length-1];(!i||i.day!==s)&&(i={day:s,items:[]},t.push(i)),i.items.push({item:n,index:r})}),t}function BI(e){const t=Ko(e);return t==="done"?"完成":t==="current"?"当前":t==="observed"?"已观察":t==="superseded"?"已更新":t==="blocked"?"阻塞":"待处理"}function bh(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 mq(e){const t=Ko(e==null?void 0:e.status);return Ma(e)==="observation"&&t==="done"?"已观察":BI(t)}function HI(e){if(!e||typeof e!="object")return[];const t=[],n=(i,a,l)=>{const c=String(l||"").trim();c&&t.push({key:`${i}:${c}`,type:i,label:String(a||c),value:c})},r=Ko(e.status),s=Ma(e)==="observation"&&r==="done"?"observed":r;return n("status",BI(s),s),n("issue",e.issueKey||e.issue_key||e.issue,e.issueKey||e.issue_key||e.issue),n("platform",bh(e.platform),e.platform),t}function gq(e=[]){const t=new Map;return(Array.isArray(e)?e:[]).forEach(n=>{HI(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 yq(e,t){const n=String(t||"all");return!n||n==="all"?!0:HI(e).some(r=>r.key===n)}function xq(e){if(!e||typeof e!="object")return[];const t=[],n=(r,s)=>{const i=String(s||"").trim();i&&t.push({label:r,value:i})};return n("Issue",e.issueKey||e.issue_key||e.issue),n("平台",bh(e.platform)),t}function ym(e){const t=[],n=(c,u)=>{const p=DI(u);p&&t.push({label:String(c||p).trim()||p,href:p})},r=(c,u="链接",p=0)=>{if(p>3||c==null)return;if(typeof c=="string"){(/^(https?:\/\/|file:\/\/)/i.test(c)||c.startsWith("/"))&&n(u,c);return}if(Array.isArray(c)){c.forEach((f,h)=>r(f,`${u} ${h+1}`,p+1));return}if(typeof c!="object")return;const d=c.label||c.title||c.name||c.kind||c.type||u;n(d,c.url||c.href||c.path||c.file||c.filePath||c.file_path);for(const f of["links","urls","artifacts","outputs","output","results","result","files"])c[f]!=null&&r(c[f],f,p+1)},s=Array.isArray(e==null?void 0:e.links)?e.links:[];for(const c of s)typeof c=="string"?n("链接",c):n((c==null?void 0:c.label)||(c==null?void 0:c.title)||(c==null?void 0:c.kind)||"链接",(c==null?void 0:c.url)||(c==null?void 0:c.href));for(const c of Array.isArray(e==null?void 0:e.artifacts)?e.artifacts:[])n((c==null?void 0:c.label)||(c==null?void 0:c.title)||(c==null?void 0:c.kind)||"Artifact",xh(c));n("TAPD",(e==null?void 0:e.tapdUrl)||(e==null?void 0:e.tapd_url)),n("ai-doc",(e==null?void 0:e.docUrl)||(e==null?void 0:e.doc_url)||(e==null?void 0:e.aiDocUrl)||(e==null?void 0:e.ai_doc_url)),n("Plan",(e==null?void 0:e.planDocUrl)||(e==null?void 0:e.plan_doc_url)||(e==null?void 0:e.planUrl)||(e==null?void 0:e.plan_url)),n("Issue",(e==null?void 0:e.issueUrl)||(e==null?void 0:e.issue_url)),n("GitLab Issue",(e==null?void 0:e.gitlabIssue)||(e==null?void 0:e.gitlab_issue)),n("GitLab Epic",(e==null?void 0:e.gitlabEpic)||(e==null?void 0:e.gitlab_epic)),n("MR",(e==null?void 0:e.mrUrl)||(e==null?void 0:e.mr_url)||(e==null?void 0:e.mergeRequestUrl)||(e==null?void 0:e.merge_request_url)),n("实现 MR",(e==null?void 0:e.implMr)||(e==null?void 0:e.impl_mr)),n("修复 MR",(e==null?void 0:e.fixMr)||(e==null?void 0:e.fix_mr)),n("提测 MR",(e==null?void 0:e.testMr)||(e==null?void 0:e.test_mr)),n("集成 MR",(e==null?void 0:e.integrationMr)||(e==null?void 0:e.integration_mr)),n("Jenkins",(e==null?void 0:e.jenkinsUrl)||(e==null?void 0:e.jenkins_url)||(e==null?void 0:e.jenkinsBuildUrl)||(e==null?void 0:e.jenkins_build_url)),n("安装包",(e==null?void 0:e.jenkinsPackageUrl)||(e==null?void 0:e.jenkins_package_url)),n("二维码",(e==null?void 0:e.jenkinsQrUrl)||(e==null?void 0:e.jenkins_qr_url)),n("调整",(e==null?void 0:e.editUrl)||(e==null?void 0:e.edit_url)||(e==null?void 0:e.adjustUrl)||(e==null?void 0:e.adjust_url)),n("链接",(e==null?void 0:e.url)||(e==null?void 0:e.href)),r(e==null?void 0:e.urls,"URL"),r(e==null?void 0:e.outputs,"产物"),r(e==null?void 0:e.output,"产物"),r(e==null?void 0:e.results,"结果"),r(e==null?void 0:e.result,"结果"),r(e==null?void 0:e.files,"文件");const i=c=>{const u=String(c||"").trim();try{const p=new URL(u,window.location.origin);return`${p.origin}${p.pathname}`}catch{return u.split(/[?#]/)[0]}},a=c=>{const u=String(c||"");return/方案文档/.test(u)?50:/临时/.test(u)?40:/Markdown Review/i.test(u)?20:/预览|review/i.test(u)?10:0},l=new Map;for(const c of t){const u=/\/api\/prd-workflow\/review\//.test(String(c.href||"")),p=u?`review:${i(c.href)}`:`${c.label}
|
|
184
|
-
${c.href}`,d=l.get(p);if(!d){l.set(p,c);continue}if(u){const f=a(d.label),h=a(c.label);(h>f||h===f&&String(c.label||"").length>String(d.label||"").length)&&l.set(p,c)}}return Array.from(l.values())}function WI(e){const t=String((e==null?void 0:e.href)||(e==null?void 0:e.url)||"").trim(),n=[e==null?void 0:e.label,e==null?void 0:e.title,e==null?void 0:e.kind,e==null?void 0:e.type,e==null?void 0:e.source,t].map(r=>String(r||"")).join(" ");return/gitlab|merge[_ -]?request|jenkins|tapd/i.test(n)?!1:/ai[-_ ]?doc|方案文档|技术方案|设计文档|代码审查|code review|markdown review|文档预览|\/api\/prd-workflow\/review\//i.test(n)}function wq(e,t=[]){const n=[],r=(l,c={})=>{const u=p=>{const d={label:String(p.label||"ai-doc").trim()||"ai-doc",href:String(p.href||p.url||"").trim(),kind:String(p.kind||p.type||"").trim()};d.href&&WI(d)&&n.push({...c,...d,kind:c.displayKind||d.kind||"ai-doc"})};for(const p of Array.isArray(l==null?void 0:l.artifacts)?l.artifacts:[])!p||typeof p!="object"||u({...p,label:p.label||p.title||p.kind||"ai-doc",href:xh(p)});for(const p of ym(l))u(p)};r(e,{displayKind:"ai-doc"});for(const l of Array.isArray(t)?t:[])r(l,{issueKey:String((l==null?void 0:l.issueKey)||(l==null?void 0:l.issue_key)||(l==null?void 0:l.issue)||"").trim(),platform:bh(l==null?void 0:l.platform),displayKind:"Workflow 文档"});for(const l of VI(e))r(l,{issueKey:Di(l),platform:bh(l==null?void 0:l.platform),displayKind:"Issue 文档"});const s=l=>{try{const c=new URL(String(l||""),window.location.origin);return`${c.origin}${c.pathname}`}catch{return String(l||"").split(/[?#]/)[0]}},i=l=>{const c=String(l||"");return/技术方案|方案文档/.test(c)?50:/代码审查|code review/i.test(c)?40:/设计文档/.test(c)?30:/markdown review|文档预览/i.test(c)?20:10},a=new Map;for(const l of n){const c=s(l.href),u=a.get(c);if(!u||i(l.label)>i(u.label)){const{displayKind:p,...d}=l;a.set(c,d)}}return Array.from(a.values())}function bq(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 Di(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 zj(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)||Di(e,t)||`Issue ${t+1}`).trim()}function kq(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 vq(e){return String((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 Bj(e){const t=ym(e),n=(s,i)=>{if(Array.isArray(s)){for(const a of s)if(a)if(typeof a=="string")t.push({label:i,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||i,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 i=String(s.href||"").trim();if(!i)return!1;const a=`${s.label}
|
|
185
|
-
${i}`;return r.has(a)?!1:(r.add(a),!0)})}function Sq(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 p of u)p&&typeof p=="object"&&c.issues.push({...p,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(kq(a)).issues.push(a);const i=a=>{const l=new Map,c=[];return a.forEach((u,p)=>{const d=Di(u,p);l.set(d,{issue:u,children:[]})}),a.forEach((u,p)=>{const d=Di(u,p),f=vq(u),h=l.get(d);f&&l.has(f)?l.get(f).children.push(h):c.push(h)}),c};return Array.from(r.values()).map(a=>({...a,issues:i(a.issues)}))}function ad(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 $a(e){if(!e||typeof e!="object")return"";const t=String(e.issueKey||e.issue_key||e.issue||"").trim(),n=String(e.action||e.actionId||e.action_id||ad(e)||"").trim(),r=String(e.stageKey||e.stage_key||e.stage||e.phase||e.code||e.pointer||n).trim(),s=[r,n,e.code,e.type,e.title].map(i=>String(i||"")).join(" ").toLowerCase();if(t){if(/plan_draft_local|submit-plan|plan-doc/.test(s))return`issue-plan:${t}`;if(/gitlab_issue_missing|ensure-gitlab-issue/.test(s))return`issue-gitlab:${t}`}return r}function kh(e){const t=wh(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 VI(e){var s,i,a,l,c,u,p,d,f,h,g,k;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 y=Array.isArray(w.issues)?w.issues:Array.isArray(w.children)?w.children:Array.isArray(w.items)?w.items:[];for(const v of y)!v||typeof v!="object"||Array.isArray(v)||(v.issue&&typeof v.issue=="object"?(n(v.issue),Array.isArray(v.children)&&v.children.forEach(x=>n((x==null?void 0:x.issue)||x))):n(v))};return[e==null?void 0:e.issues,(s=e==null?void 0:e.raw)==null?void 0:s.issues,(a=(i=e==null?void 0:e.raw)==null?void 0:i.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,(d=(p=e==null?void 0:e.raw)==null?void 0:p.prd)==null?void 0:d.epics,(h=(f=e==null?void 0:e.raw)==null?void 0:f.prd)==null?void 0:h.epicGroups,(k=(g=e==null?void 0:e.raw)==null?void 0:g.prd)==null?void 0:k.epic_groups].forEach(w=>{Array.isArray(w)&&w.forEach(r)}),t}function Nq(e,t){const n=String(t||"").trim();return n&&VI(e).find((r,s)=>Di(r,s)===n)||null}function jq(e){var t,n,r,s,i,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=(i=e==null?void 0:e.raw)==null?void 0:i.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 Cq(e,t){if(!t||typeof t!="object")return t;const n=String(t.issueKey||t.issue_key||t.issue||"").trim(),r=Nq(e,n),s=String(t.platform||(r==null?void 0:r.platform)||"").trim(),i=s&&!t.platform?{...t,platform:s}:t,a=String((r==null?void 0:r.gitlabIssue)||(r==null?void 0:r.gitlab_issue)||i.gitlabIssue||i.gitlab_issue||"").trim(),l=jq(e);if(!a&&!l)return i;const c=$a(i),u=`${c} ${ak(i)}`;if(!/issue-gitlab:|gitlab_issue_missing|ensure-gitlab-issue|implementation|impl_|fix_|testing|submit-test|self-test/i.test(u))return i;const d=[];a&&d.push({label:"GitLab Issue",kind:"gitlab-issue",durability:"durable",url:a}),l&&d.push({label:"GitLab Epic",kind:"gitlab-epic",durability:"durable",url:l});const f=Ko(i.status),h=a&&f==="done"&&/^issue-gitlab:/.test(c)&&/需要.*GitLab Issue/.test(String(i.title||i.label||""));return{...i,...a?{gitlabIssue:a,gitlab_issue:a}:{},...l?{gitlabEpic:l,gitlab_epic:l}:{},...h?{title:String(i.title||i.label||"GitLab Issue 已绑定").replace(/^需要为/,"已为").replace("创建或绑定","创建/绑定"),label:String(i.label||i.title||"GitLab Issue 已绑定").replace(/^需要为/,"已为").replace("创建或绑定","创建/绑定")}:{},artifacts:li(i.artifacts,d)}}function li(e,t){const n=[],r=new Set,s=i=>{if(!i)return;const a=typeof i=="string"?i:JSON.stringify(i);r.has(a)||(r.add(a),n.push(i))};return(Array.isArray(e)?e:[]).forEach(s),(Array.isArray(t)?t:[]).forEach(s),n}function Hj(e,t){const n=kh(t),r=kh(e),s=Number.isFinite(n)&&(!Number.isFinite(r)||n>=r)?t:e,i=(s==null?void 0:s.status)||(t==null?void 0:t.status)||(e==null?void 0:e.status);return{...e,...t,title:Bi(s,0)||Bi(t,0)||Bi(e,0),detail:jp(s)||jp(t)||jp(e),status:i,links:li(e==null?void 0:e.links,t==null?void 0:t.links),artifacts:li(e==null?void 0:e.artifacts,t==null?void 0:t.artifacts),outputs:li(e==null?void 0:e.outputs,t==null?void 0:t.outputs),results:li(e==null?void 0:e.results,t==null?void 0:t.results),events:li(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 _q(e,t){const n=[],r=new Map,s=new Map,i=new Map,a=d=>{var f,h;return!!(!d||typeof d!="object"||d.auxiliary===!0||d.auxiliary_event===!0||String(d.type||"")==="review-link"||String(d.type||"")==="action-preview"||d.preview===!0||String(d.type||"")==="same-platform-stage-conflict"&&/\/api\/prd-workflow\/review\//.test(String(((f=d.conflict)==null?void 0:f.previousArtifact)||((h=d.conflict)==null?void 0:h.incomingArtifact)||"")))},l=(d,f)=>({...d,links:li(d==null?void 0:d.links,f==null?void 0:f.links),artifacts:li(d==null?void 0:d.artifacts,f==null?void 0:f.artifacts),outputs:li(d==null?void 0:d.outputs,f==null?void 0:f.outputs),results:li(d==null?void 0:d.results,f==null?void 0:f.results)}),c=(d,f)=>{if(!d)return;const h=r.get(d);if(h!=null){n[h]=l(n[h],f);return}i.set(d,l(i.get(d)||{},f))},u=(d,f)=>d&&i.has(d)?l(f,i.get(d)):f,p=d=>{if(Array.isArray(d))for(const f of d){const h=$a(f);if(a(f)){c(h,f);continue}const g=String(f.id||f.eventId||f.event_id||f.actionId||f.action_id||"").trim(),k=h||g,w=k?r.get(k)??s.get(g):null;k&&w!=null?(n[w]=u(h,Hj(n[w],f)),h&&r.set(h,w),g&&s.set(g,w)):(k&&r.set(k,n.length),g&&s.set(g,n.length),n.push(u(h,f)))}};if(p(e==null?void 0:e.actions),p(e==null?void 0:e.workflowActions),p(e==null?void 0:e.workflow_actions),p(e==null?void 0:e.timeline),p(e==null?void 0:e.history),p(e==null?void 0:e.events),p(e==null?void 0:e.runtimeEvents),p(e==null?void 0:e.runtime_events),t&&typeof t=="object"){const d=ad(t),f=$a(t),h=f?r.get(f):d?s.get(d):null,g={...t,status:t.status||"next",kind:"next_action"};h!=null&&(n[h]=Hj(n[h],g))}return n.map((d,f)=>({item:d,index:f,ts:kh(d)})).filter(d=>Number.isFinite(d.ts)).sort((d,f)=>f.ts-d.ts||d.index-f.index).map(d=>Cq(e,d.item))}function Eq(e){return(Array.isArray(e==null?void 0:e.runtimeEvents)?e.runtimeEvents:Array.isArray(e==null?void 0:e.runtime_events)?e.runtime_events:[]).filter(n=>n&&typeof n=="object").map((n,r)=>({item:n,index:r,ts:kh(n)})).sort((n,r)=>{const s=Number.isFinite(n.ts),i=Number.isFinite(r.ts);return s&&i?r.ts-n.ts||r.index-n.index:s?-1:i?1:r.index-n.index}).slice(0,8).map(n=>n.item)}function Aq(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 Pq(e,t){const n=typeof e=="string"?e:String((e==null?void 0:e.text)||""),r=typeof e=="object"?Number(e==null?void 0:e.stepMs):NaN,s=typeof e=="object"?Number(e==null?void 0:e.totalMs):NaN,i=Number.isFinite(r)&&Number.isFinite(s)?`(+${ca(r)} / 总 ${ca(s)})`:"";return`${t+1}. ${n}${i}`}function KI(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 dl(...e){for(const t of e){const n=Number(t);if(Number.isFinite(n))return n}return NaN}function Iq(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 Tq(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 Rq(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 Mq(e){var i,a,l;const t=KI(e);if(!t||typeof t!="object")return null;const n=String(t.type||""),r=String(t.subtype||""),s=dl(t.timestamp_ms,t.completedAtMs,t.startedAtMs,e==null?void 0:e.ts,Date.now());if(n==="tool_call"&&r==="completed"){const c=Tq(t),u=Iq(t),p=dl(t.startedAtMs,c==null?void 0:c.startedAtMs),d=dl(t.completedAtMs,c==null?void 0:c.completedAtMs),f=((i=c==null?void 0:c.result)==null?void 0:i.success)||((a=c==null?void 0:c.result)==null?void 0:a.failure)||{},h=Number.isFinite(p)&&Number.isFinite(d)?Math.max(0,d-p):dl(f.executionTime,f.localExecutionTimeMs),g=String(((l=c==null?void 0:c.args)==null?void 0:l.command)||f.command||"").trim(),k=g?g.split(`
|
|
186
|
-
`).find(Boolean)||g:"";return{kind:"tool",label:Rq(u,c),durationMs:Number.isFinite(h)?h:null,at:s,detail:k?k.slice(0,90):""}}if(n==="result"){const c=dl(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 Wj(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()),i=Array.isArray(t)?t:[],a=[...i].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=dl(a==null?void 0:a.durationMs,l==null?void 0:l.totalMs,c),p=s.filter(w=>w.kind==="model").reduce((w,y)=>w+(Number(y.stepMs)||0),0),d=i.filter(w=>(w==null?void 0:w.kind)==="tool"),f=d.reduce((w,y)=>w+(Number(y.durationMs)||0),0),h=i.filter(w=>(w==null?void 0:w.kind)==="network").length,g=[...s.filter(w=>Number(w.stepMs)>=1e3).map(w=>({label:w.text,durationMs:Number(w.stepMs),detail:"Activity 间隔"})),...d.filter(w=>Number(w.durationMs)>=1e3).map(w=>({label:w.label,durationMs:Number(w.durationMs),detail:w.detail||"工具实际执行"}))].sort((w,y)=>y.durationMs-w.durationMs).slice(0,6),k=["耗时概览"];return Number.isFinite(u)&&k.push(`- 当前总耗时:${ca(u)}`),p>0&&k.push(`- 模型相关间隔:约 ${ca(p)}(按 Activity 间隔估算)`),d.length>0&&k.push(`- 工具实际执行:${ca(f)}(${d.length} 次完成事件)`),h>0&&k.push(`- 网络/会话恢复事件:${h} 次`),g.length>0&&(k.push(""),k.push("慢步骤"),g.forEach((w,y)=>{const v=w.detail?` · ${w.detail}`:"";k.push(`${y+1}. ${w.label}:${ca(w.durationMs)}${v}`)})),s.length>0&&(k.push(""),k.push("最近 Activity"),s.slice(-10).forEach((w,y)=>{k.push(Pq(w,y))})),d.length>0&&(k.push(""),k.push("最近工具完成"),d.slice(-8).forEach((w,y)=>{const v=Number.isFinite(Number(w.durationMs))?` ${ca(w.durationMs)}`:"",x=w.detail?` · ${w.detail}`:"";k.push(`${y+1}. ${w.label}${v}${x}`)})),k.join(`
|
|
187
|
-
`)}function Vj(e){if(String((e==null?void 0:e.type)||"")!=="raw"||String((e==null?void 0:e.eventType)||"")!=="thinking")return"";const t=KI(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 qI(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 UI(e){const t=String((e==null?void 0:e.marketplaceDefinitionId)||(e==null?void 0:e.id)||"").trim();return t.startsWith("marketplace:")?t:""}function lk(e){if(!e)return"";const t=String(e.baseDefinitionId||"").trim();return t||String(e.id||"").trim()}function YI(e){const t=String(e??"");return/^[A-Za-z0-9_@%+=:,./-]+$/.test(t)?t:"'"+t.replace(/'/g,"'\\''")+"'"}function $q(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 Lq(e){const t=String(e??"").trim();return t?t.includes("${")?t:YI(t):""}function GI(e){if(String((e==null?void 0:e.baseDefinitionId)||"").trim()!=="tool_nodejs")return"";const t=e!=null&&e.runtime&&typeof e.runtime=="object"?e.runtime:{},n=String(t.entry||"").trim().replace(/^\/+/,"");if(n){const s=String((e==null?void 0:e.packageDir)||"").trim().replace(/\/+$/,""),i=s?`${s}/${n}`:`\${flowDir}/${n}`,a=Array.isArray(t.args)?t.args.map(Lq).filter(Boolean):[];return[$q(t,n),YI(i),...a].join(" ")}return String(t.command||"").trim()}function iu(e){const t=String(lk(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 Kj(e){return e==="DISPLAY"?"preview":e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function vh(e){return String((e==null?void 0:e.displayName)||(e==null?void 0:e.label)||(e==null?void 0:e.id)||"Node")}function ou(e){return vh(e)}function ow(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function Kf(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 qj(e,t,n){const r=String((t==null?void 0:t.name)||(t==null?void 0:t.id)||`#${n+1}`).trim(),s=String((t==null?void 0:t.type)||"").trim(),i=String((t==null?void 0:t.default)??(t==null?void 0:t.value)??"").trim();return[e,r,s?`type: ${s}`:"",i?`default: ${i}`:""].filter(Boolean).join(" · ")}function Uj(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 oy(e,t){const n=String((e==null?void 0:e.source)||""),r=String((e==null?void 0:e.target)||"");if(!n||!r)return!1;const s=new Map(t.map(l=>[l.id,l])),i=ew(s.get(n),e.sourceHandle||"output-0","source"),a=ew(s.get(r),e.targetHandle||"input-0","target");return!!(i&&a&&sd(i,a))}function Oq(e,t){const n=String((e==null?void 0:e.nodeId)||""),r=String((e==null?void 0:e.handleId)||""),s=(e==null?void 0:e.handleType)==="target"?"target":(e==null?void 0:e.handleType)==="source"?"source":"";if(!n||!r||!s)return null;const i=t.find(l=>l.id===n),a=ew(i,r,s);return a?{nodeId:n,handleId:r,handleType:s,slot:a,slotType:MK(a)}:null}function Dq(e,t){return t?e.map((n,r)=>{const s=Array.isArray(t.handleType==="source"?n.inputs:n.outputs)?t.handleType==="source"?n.inputs:n.outputs:[];for(let i=0;i<s.length;i+=1){const a=s[i];if(!(t.handleType==="source"?sd(t.slot,a):sd(a,t.slot)))continue;const c=iu(n);return{def:n,order:r,category:c,categoryRank:ul.indexOf(c),slot:a,slotIndex:i,displayLabel:ou(n),description:ow(n)}}return null}).filter(Boolean).sort((n,r)=>{var a,l;const s=(a=n.slot)!=null&&a.required?0:1,i=(l=r.slot)!=null&&l.required?0:1;return s-i||n.slotIndex-r.slotIndex||n.categoryRank-r.categoryRank||n.order-r.order}):[]}function Fq(e,t,n){var i,a,l,c;if(!n)return[];const r=[],s=n.handleType==="source";for(const u of e||[]){if(!u||u.id===n.nodeId)continue;const p=Array.isArray(s?(i=u.data)==null?void 0:i.inputs:(a=u.data)==null?void 0:a.outputs)?s?u.data.inputs:u.data.outputs:[];for(let d=0;d<p.length;d+=1){const f=p[d];if((f==null?void 0:f.showOnNode)===!1||!(s?sd(n.slot,f):sd(f,n.slot)))continue;const g=s?{source:n.nodeId,sourceHandle:n.handleId,target:u.id,targetHandle:`input-${d}`}:{source:u.id,sourceHandle:`output-${d}`,target:n.nodeId,targetHandle:n.handleId},k=(t||[]).some(w=>w.target===g.target&&w.targetHandle===g.targetHandle);r.push({node:u,nodeId:u.id,nodeLabel:((l=u.data)==null?void 0:l.label)||u.id,definitionId:((c=u.data)==null?void 0:c.definitionId)||"",slot:f,slotIndex:d,handleId:s?g.targetHandle:g.sourceHandle,connection:g,occupied:k})}}return r.sort((u,p)=>{var k,w,y,v,x,C,N,j;const d=Number(((w=(k=u.node)==null?void 0:k.position)==null?void 0:w.y)||0),f=Number(((v=(y=p.node)==null?void 0:y.position)==null?void 0:v.y)||0),h=Number(((C=(x=u.node)==null?void 0:x.position)==null?void 0:C.x)||0),g=Number(((j=(N=p.node)==null?void 0:N.position)==null?void 0:j.x)||0);return d-f||h-g||u.slotIndex-p.slotIndex||String(u.nodeId).localeCompare(String(p.nodeId))})}function El(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 zq(e,t){const n=String(e||"node").replace(/^(agent|control|provide|tool|display)_/i,"").replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"node",r=new Set(t.map(s=>s.id));for(let s=1;s<1e4;s++){const i=`${n}_${s}`;if(!r.has(i))return i}return`${n}_${Date.now().toString(36)}`}function Bq(e){return(e==null?void 0:e.default)!=null?String(e.default):(e==null?void 0:e.value)!=null?String(e.value):""}function Hq(e){const t=Number(e);if(!Number.isFinite(t)||t<=0)return id;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} * * *`:id}function ko(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 ck(e){const t=String(e||"").trim().match(/^(\d{1,2}):(\d{1,2})$/);return t?`${ko(t[1],9,0,23)}:${ko(t[2],0,0,59)}`:"09:00"}function au(e,t,n,r,s){const i=ck(t),[a,l]=i.split(":").map(u=>Number.parseInt(u,10)),c=String(e||"daily");if(c==="weekly"){const u=Math.max(0,Math.min(6,Number.parseInt(String(n??1),10)||1));return`${l} ${a} * * ${u}`}if(c==="monthly"){const u=Math.max(1,Math.min(31,Number.parseInt(String(r??1),10)||1));return`${l} ${a} ${u} * *`}return c==="custom"?String(s||"").trim()||id:`${l} ${a} * * *`}function Wq(e){const n=String(e||id).trim().split(/\s+/);if(n.length!==5)return{scheduleType:"custom",time:"09:00",weekday:1,monthDay:1};const[r,s,i,a,l]=n,c=Number.parseInt(r,10),u=Number.parseInt(s,10),p=Number.isFinite(c)&&Number.isFinite(u)&&r===String(c)&&s===String(u),d=p?`${ko(u,9,0,23)}:${ko(c,0,0,59)}`:"09:00";return p&&i==="*"&&a==="*"&&l==="*"?{scheduleType:"daily",time:d,weekday:1,monthDay:1}:p&&i==="*"&&a==="*"&&/^\d+$/.test(l)?{scheduleType:"weekly",time:d,weekday:Math.max(0,Math.min(6,Number.parseInt(l,10))),monthDay:1}:p&&/^\d+$/.test(i)&&a==="*"&&l==="*"?{scheduleType:"monthly",time:d,weekday:1,monthDay:Math.max(1,Math.min(31,Number.parseInt(i,10)))}:{scheduleType:"custom",time:d,weekday:1,monthDay:1}}function uk(e){let t={};const n=String(e||"").trim();if(n)try{t=JSON.parse(n)}catch{t={}}const r=Number(t.intervalMinutes),s=Hq(r),i=typeof t.cron=="string"&&t.cron.trim()?t.cron.trim():s,a=Wq(i),l=["daily","weekly","monthly","custom"].includes(t.scheduleType)?t.scheduleType:a.scheduleType,c=ck(t.time||a.time||"09:00"),u=Math.max(0,Math.min(6,Number.parseInt(String(t.weekday??a.weekday??1),10)||1)),p=Math.max(1,Math.min(31,Number.parseInt(String(t.monthDay??a.monthDay??1),10)||1)),d=au(l,c,u,p,i);return{enabled:t.enabled===!0,scheduleType:l,time:c,weekday:u,monthDay:p,cron:d,timezone:K7,targetRunNodeId:typeof t.targetRunNodeId=="string"?t.targetRunNodeId.trim():"",overlapPolicy:"skip"}}function Vq(e){const t=uk(JSON.stringify(e||{}));return JSON.stringify(t)}function Kq(e){const t=Number(e||0);return!Number.isFinite(t)||t<=0?"-":new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function qq(e){return e==="weekly"?"每周":e==="monthly"?"每月":e==="custom"?"高级 Cron":"每天"}function Yj(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 qf(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:Yj(n.nextRunAt),lastAt:Yj(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 Cu(e){var t;return!!((t=e==null?void 0:e.data)!=null&&t.isWorkspaceGroup)}function Sh(e){return e>0?`Group ${e+1}`:"Group"}function Uq(e){return(Array.isArray(e)?e:[]).map((n,r)=>{const s=String((n==null?void 0:n.id)||`group_${r+1}`).trim(),i=Number(n==null?void 0:n.x),a=Number(n==null?void 0:n.y),l=Number(n==null?void 0:n.width),c=Number(n==null?void 0:n.height);return!s||!Number.isFinite(i)||!Number.isFinite(a)||!Number.isFinite(l)||!Number.isFinite(c)?null:{id:s,title:String((n==null?void 0:n.title)||Sh(r)).trim()||Sh(r),color:String((n==null?void 0:n.color)||"purple").trim()||"purple",x:i,y:a,width:Math.max(Ta,Math.round(l)),height:Math.max(Ra,Math.round(c))}}).filter(Boolean)}function Yq(e){var n;return Uq((n=e==null?void 0:e.ui)==null?void 0:n.groups).map(r=>({id:r.id,type:zl,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 aw(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(Ta,Math.round(t)),height:Math.max(Ra,Math.round(n))}}function lu(e){return(Array.isArray(e)?e:[]).map(t=>({type:(t==null?void 0:t.type)||"node",name:(t==null?void 0:t.name)||"",default:Bq(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 JI(e){const t=(e==null?void 0:e.data)||{},n=r=>(Array.isArray(r)?r:[]).map((s,i)=>(s==null?void 0:s.showOnNode)===!1?"":[i,String((s==null?void 0:s.type)||""),String((s==null?void 0:s.name)||""),s!=null&&s.required?"1":"0"].join(":")).filter(Boolean).join("|");return`${n(t.inputs)}=>${n(t.outputs)}`}function Gq(e){var i,a,l,c;const t=(e==null?void 0:e.data)||{},n=t!=null&&t.displaySize&&typeof t.displaySize=="object"?t.displaySize:{},r=t!=null&&t.nodeSize&&typeof t.nodeSize=="object"?t.nodeSize:{},s=xm(t);return[JI(e),kn(t)||"",s?"has-result":"",(t==null?void 0:t.contextRunResultNonce)||"",Number((e==null?void 0:e.width)||0)||"",Number((e==null?void 0:e.height)||0)||"",Number(((i=e==null?void 0:e.measured)==null?void 0:i.width)||0)||"",Number(((a=e==null?void 0:e.measured)==null?void 0:a.height)||0)||"",Number(r.width||0)||"",Number(r.height||0)||"",Number(n.width||0)||"",Number(n.height||0)||"",t!=null&&t.isExecuting?"executing":"",(t==null?void 0:t.nodeStatus)||"",(c=(l=t==null?void 0:t.runningRunNodeIds)==null?void 0:l.has)!=null&&c.call(l,e==null?void 0:e.id)?"running-run":""].join("::")}function Jq(e,t){return!e||!t?!1:e.selected===t.selected&&e.isExecuting===t.isExecuting&&e.nodeStatus===t.nodeStatus&&e.nodeElapsed===t.nodeElapsed&&e.optimizingRun===t.optimizingRun&&e.scheduledRunState===t.scheduledRunState&&e.nodeChatActive===t.nodeChatActive&&e.nodeChat===t.nodeChat}function Uf(e,t){var h,g;const n=e!=null&&e.instances&&typeof e.instances=="object"?e.instances:{},r=eT(n),s=Array.isArray(e==null?void 0:e.edges)?e.edges:[],i=(h=e==null?void 0:e.ui)!=null&&h.nodePositions&&typeof e.ui.nodePositions=="object"?e.ui.nodePositions:{},a=(g=e==null?void 0:e.ui)!=null&&g.nodeSizes&&typeof e.ui.nodeSizes=="object"?e.ui.nodeSizes:{},l=new Set(Object.keys(r));for(const k of s)k!=null&&k.source&&l.add(String(k.source)),k!=null&&k.target&&l.add(String(k.target));const u=Array.from(l).map(k=>{const w=r[k]||{},y=w.definitionId||k,v=t.find(z=>z.id===y),x=lk(v)||y,C=t.find(z=>z.id===x)||v,N=w.marketplaceRef||UI(v),j=GI(v),E=i[k]&&typeof i[k].x=="number"&&typeof i[k].y=="number"?i[k]:{x:320+l.size*20,y:180+l.size*12},P=!!kn({definitionId:x,inputs:w.input,outputs:w.output}),O=a[k]&&typeof a[k].width=="number"&&typeof a[k].height=="number"?{width:a[k].width,height:a[k].height}:null,B=ba(O,{display:P}),W=B&&!Ws(x);return{id:k,type:zl,position:E,...W?{width:B.width,height:B.height}:{},data:{label:w.label||vh(v)||vh(C)||k,definitionId:x,...N?{marketplaceRef:N}:{},...v!=null&&v.packageId?{marketplacePackageId:v.packageId}:{},...v!=null&&v.version?{marketplaceVersion:v.version}:{},schemaType:qI(x,C||v),role:w.role||"normal",model:w.model||void 0,body:w.body||"",script:w.script||j||"",scriptRef:w.scriptRef||"",implementationRef:w.implementationRef||"",implementationMode:w.implementationMode||"",displayReloadKey:w.displayReloadKey||"",...W?{nodeSize:B}:{},...P&&W?{displaySize:B}:{}}}}).map(k=>nw(k,r,t)),p=Yq(e),d=s.filter(k=>(k==null?void 0:k.source)&&(k==null?void 0:k.target)).filter(k=>!p.some(w=>w.id===String(k.source)||w.id===String(k.target))).map((k,w)=>({id:k.id||`we-${k.source}-${k.target}-${w}`,source:String(k.source),target:String(k.target),sourceHandle:k.sourceHandle??void 0,targetHandle:k.targetHandle??void 0,markerEnd:{type:oi.ArrowClosed}})),f=[...p,...u];return{nodes:f,edges:o7(d,f),instances:r}}function Gj(e){return`${iw}${e}`}function ay(e){const t=String(e||"");return t.startsWith(iw)?t.slice(iw.length):t}function XI(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 lw(e,t=[]){const n=new Map((Array.isArray(t)?t:[]).filter(d=>{var f;return La((f=d==null?void 0:d.data)==null?void 0:f.definitionId)}).map(d=>[d.id,d])),r=Array.isArray(e==null?void 0:e.nodeIds)?e.nodeIds:[],s=[],i=new Set;for(const d of r){const f=String(d||"").trim();!f||i.has(f)||!n.has(f)||(i.add(f),s.push(f))}const a={},l=e!=null&&e.nodePositions&&typeof e.nodePositions=="object"?e.nodePositions:{};s.forEach((d,f)=>{const h=l[d];a[d]=h&&typeof h.x=="number"&&typeof h.y=="number"?{x:h.x,y:h.y}:{x:180+f*36,y:120+f*28}});const c={},u=e!=null&&e.nodeSizes&&typeof e.nodeSizes=="object"?e.nodeSizes:{};s.forEach(d=>{const f=ba(u[d],{display:!0});f&&(c[d]=f)});const p=XI(e==null?void 0:e.viewport);return{nodeIds:s,nodePositions:a,nodeSizes:c,...p?{viewport:p}:{}}}function Xq(e,t=[]){return lw(e,t)}const ly=[{value:"1",label:"1 天"},{value:"7",label:"7 天"},{value:"30",label:"30 天"},{value:"90",label:"90 天"},{value:"365",label:"1 年"},{value:"permanent",label:"永久"}];function cy(e={}){return{title:"",layout:"gallery",nodeIds:[],expiresInDays:30,permanent:!1,...e}}function Jj(e={}){return e.permanent?"permanent":String(e.expiresInDays||30)}function Xj(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 Qq(e={}){if(!e.expiresAt)return"永久有效";const t=Date.parse(String(e.expiresAt||""));return Number.isFinite(t)?`有效期至 ${new Date(t).toLocaleString()}`:"永久有效"}function Qj(e={}){return new URL(e.url||`/display/${e.id||""}`,window.location.origin).href}const QI="af:workspace:canvas-clipboard",ZI="agentflow.workspace.canvas-clipboard";function Zq(e){return JSON.stringify({type:ZI,version:1,clipboard:e})}function eU(e){try{const t=JSON.parse(String(e||""));if((t==null?void 0:t.type)!==ZI)return null;const n=t.clipboard;return!n||!Array.isArray(n.nodes)||n.nodes.length===0?null:n}catch{return null}}function tU(e){try{localStorage.setItem(QI,Zq(e))}catch{}}function nU(){try{return eU(localStorage.getItem(QI))}catch{return null}}function rU(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}async function Zj(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 e1(e,t,n){const r=Number(e);return!Number.isFinite(r)||r<=0?0:Math.min(n,Math.max(t,Math.round(r)))}function ba(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:e1(n,$I,LI)||MI,height:e1(r,gh,OI)||gh}}function Nh(e){const t=ba(e,{display:!0});return t?{width:Math.max(320,Math.round(t.width)),height:Math.max(180,Math.round(t.height))}:null}function sU(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:rw,height:sw}}function iU(e,t=""){const n=Nh(e==null?void 0:e.displaySize);if(n)return n;const r=Nh(e==null?void 0:e.nodeSize);if(r)return r;const s=La(t)||Ed(Oo((e==null?void 0:e.inputs)||(e==null?void 0:e.input)||[],"displayType","markdown"));return sU(s)}function fl(e){var s,i,a,l,c,u,p,d,f,h,g;if(Ws((s=e==null?void 0:e.data)==null?void 0:s.definitionId))return null;const t=!!kn(e==null?void 0:e.data),n=Number(((a=(i=e==null?void 0:e.data)==null?void 0:i.displaySize)==null?void 0:a.width)||((c=(l=e==null?void 0:e.data)==null?void 0:l.nodeSize)==null?void 0:c.width)||(e==null?void 0:e.width)||(t?(u=e==null?void 0:e.measured)==null?void 0:u.width:0)||0),r=Number(((d=(p=e==null?void 0:e.data)==null?void 0:p.displaySize)==null?void 0:d.height)||((h=(f=e==null?void 0:e.data)==null?void 0:f.nodeSize)==null?void 0:h.height)||(e==null?void 0:e.height)||(t?(g=e==null?void 0:e.measured)==null?void 0:g.height:0)||0);return ba({width:n,height:r},{display:t})}function Yc(e,t,n){var p,d,f,h,g,k,w,y,v,x,C,N,j;const r=(e||[]).filter(E=>!Cu(E)),s=(e||[]).filter(Cu),i=eT(nk(r,n||{})),a=t.map(E=>({source:E.source,target:E.target,sourceHandle:E.sourceHandle??null,targetHandle:E.targetHandle??null})).filter(E=>!s.some(P=>P.id===E.source||P.id===E.target)),l={},c={},u=[];for(const E of r){l[E.id]={x:((p=E.position)==null?void 0:p.x)||0,y:((d=E.position)==null?void 0:d.y)||0};const P=fl(E);P&&(c[E.id]=P)}for(const E of s){const P=Number(((h=(f=E.data)==null?void 0:f.nodeSize)==null?void 0:h.width)||E.width||((g=E.measured)==null?void 0:g.width)||0),O=Number(((w=(k=E.data)==null?void 0:k.nodeSize)==null?void 0:w.height)||E.height||((y=E.measured)==null?void 0:y.height)||0);u.push({id:E.id,title:String(((v=E.data)==null?void 0:v.title)||((x=E.data)==null?void 0:x.label)||"Group"),color:String(((C=E.data)==null?void 0:C.color)||"purple"),x:Number(((N=E.position)==null?void 0:N.x)||0),y:Number(((j=E.position)==null?void 0:j.y)||0),width:Math.max(Ta,Math.round(P||Ta)),height:Math.max(Ra,Math.round(O||Ra))})}return{version:1,instances:i,edges:a,ui:{nodePositions:l,nodeSizes:c,groups:u}}}function eT(e){const t={};for(const[n,r]of Object.entries(e||{})){const s=String((r==null?void 0:r.definitionId)||n);if(!!La(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 La(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 kn(e){const t=La(e==null?void 0:e.definitionId);return t||(Ws(e==null?void 0:e.definitionId)&&xm(e)?Ed(Oo((e==null?void 0:e.inputs)||(e==null?void 0:e.input)||[],"displayType","markdown")):"")}function Hi(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],n=kn(e),r=Ws(e==null?void 0:e.definitionId),s=n==="image"?"src":"content",i=u=>String((u==null?void 0:u.value)??(u==null?void 0:u.default)??""),a=u=>i(u).trim(),l=t.find(u=>(u==null?void 0:u.name)===s&&a(u))||t.find(u=>(u==null?void 0:u.name)==="filePath"&&a(u))||t.find(u=>(u==null?void 0:u.type)==="text"&&a(u)),c=l?i(l):"";return String(r?c:(e==null?void 0:e.body)||c)}function Lo(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 oU(e){let t=String(e||"").replace(/\r\n/g,`
|
|
188
|
-
`).trim();return t.includes(`
|
|
189
|
-
`)||(t=t.replace(/\s+(resultFile|result|outParams|outParams\.[A-Za-z_][A-Za-z0-9_-]*)\s*:/g,`
|
|
190
|
-
$1:`).replace(/(^|\n)outParams:\s+([A-Za-z_][A-Za-z0-9_-]*\s*:)/g,`$1outParams:
|
|
191
|
-
$2`)),t}function pi(e){const t=String(e||"").trim();if(!t)return String(e||"");const n=t.match(/---agentflow\b([\s\S]*?)---end/i);if(n!=null&&n[1]){const a=oU(n[1]),l=a.match(/^resultFile\s*:\s*["']?([^"'\n]+)["']?/m);if(l!=null&&l[1])return l[1].trim();const c=a.match(/^result\s*:\s*(.*)$/m);if(c){const p=String(c[1]||"").trim();return p==="|"||p===">"?a.slice((c.index||0)+c[0].length).split(`
|
|
192
|
-
`).filter(f=>/^\s+/.test(f)||!f.trim()).map(f=>f.replace(/^\s{2}/,"")).join(`
|
|
193
|
-
`).replace(/\s+$/g,""):p.replace(/^["']|["']$/g,"")}const u=t.replace(n[0],"").trim();if(u)return u}if(!/["']result["']\s*:|["']outParams["']\s*:|["']resultFile["']\s*:/i.test(t))return String(e||"");const r=[t],s=t.indexOf("{"),i=t.lastIndexOf("}");s>=0&&i>s&&r.unshift(t.slice(s,i+1));for(const a of r)try{const l=JSON.parse(a);if(l&&typeof l=="object"&&!Array.isArray(l)&&(Object.prototype.hasOwnProperty.call(l,"result")||Object.prototype.hasOwnProperty.call(l,"resultFile"))){const c=l.resultFile||l.result;return typeof c=="string"?c:JSON.stringify(c,null,2)}}catch{}return String(e||"")}async function Oa(e,t){const n=$r(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 cw(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 aU(e,t=[],n=[]){const r=String(e||"");if(!r)return"";const s=new Map(t.map(i=>[i.id,i]));return(Array.isArray(n)?n:[]).filter(i=>String((i==null?void 0:i.target)||"")===r).slice(0,4).map(i=>{const a=s.get(String((i==null?void 0:i.source)||""));if(!a)return"";const l=a.data||{},c=String(l.body||"").trim(),u=[`- upstreamId: ${a.id}`,` label: ${String(l.label||a.id).trim()}`,` definitionId: ${String(l.definitionId||"").trim()}`];return c&&u.push(` task: ${c.slice(0,4e3)}`),u.join(`
|
|
194
|
-
`)}).filter(Boolean).join(`
|
|
195
|
-
|
|
196
|
-
`)}function fc(e){let t=pi(e).trim();if(!t)return"";const n=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*?)```/);if(n&&n[1])t=n[1].trim();else{const i=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*)$/);i&&i[1]&&(t=i[1].trim())}t=t.replace(/^html\s*\n/i,"").replace(/```\s*$/g,"").trim();const s=[/<!doctype\b/i,/<html\b/i,/<head\b/i,/<body\b/i,/<style\b/i,/<script\b/i,/<main\b/i,/<section\b/i,/<article\b/i,/<div\b/i,/<svg\b/i,/<canvas\b/i].reduce((i,a)=>{const l=a.exec(t);return l?i<0?l.index:Math.min(i,l.index):i},-1);return s>0&&(t=t.slice(s).trim()),t}function lU(e){const t=fc(e);return t.trim()?/<[^>]*$/g.test(t)?"HTML 内容末尾存在未闭合标签,可能是生成或保存时被截断。":/^(?:<!doctype\b|<html\b)/i.test(t)&&!/<\/html\s*>/i.test(t)?"完整 HTML 文档缺少 </html> 结束标签,可能是生成或保存时被截断。":"":""}function ha(e,t){return e==="html"?lU(t):""}function tT(e,t=""){const n=fc(e);if(!n.trim())return"";const s=`<base target="_blank"><script data-agentflow-display-link-guard="1">
|
|
197
|
-
(() => {
|
|
198
|
-
const frameId = ${JSON.stringify(String(t||""))};
|
|
199
|
-
const postSize = () => {
|
|
200
|
-
const doc = document.documentElement;
|
|
201
|
-
const body = document.body;
|
|
202
|
-
const height = Math.ceil(Math.max(
|
|
203
|
-
doc ? doc.scrollHeight : 0,
|
|
204
|
-
doc ? doc.offsetHeight : 0,
|
|
205
|
-
doc ? doc.clientHeight : 0,
|
|
206
|
-
body ? body.scrollHeight : 0,
|
|
207
|
-
body ? body.offsetHeight : 0,
|
|
208
|
-
body ? body.clientHeight : 0,
|
|
209
|
-
window.innerHeight || 0
|
|
210
|
-
));
|
|
211
|
-
window.parent.postMessage({ source: "agentflow-html-display-size", frameId, height }, "*");
|
|
212
|
-
};
|
|
213
|
-
document.addEventListener("click", (event) => {
|
|
214
|
-
const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
|
|
215
|
-
if (!link) return;
|
|
216
|
-
const rawHref = String(link.getAttribute("href") || "").trim();
|
|
217
|
-
if (!rawHref || rawHref.startsWith("#")) return;
|
|
218
|
-
if (/^javascript:/i.test(rawHref)) {
|
|
219
|
-
event.preventDefault();
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
event.preventDefault();
|
|
223
|
-
window.open(link.href, "_blank", "noopener,noreferrer");
|
|
224
|
-
}, true);
|
|
225
|
-
window.addEventListener("load", postSize);
|
|
226
|
-
window.addEventListener("resize", postSize);
|
|
227
|
-
requestAnimationFrame(postSize);
|
|
228
|
-
setTimeout(postSize, 60);
|
|
229
|
-
setTimeout(postSize, 300);
|
|
230
|
-
if (typeof ResizeObserver !== "undefined") {
|
|
231
|
-
const resizeObserver = new ResizeObserver(postSize);
|
|
232
|
-
resizeObserver.observe(document.documentElement);
|
|
233
|
-
if (document.body) resizeObserver.observe(document.body);
|
|
234
|
-
}
|
|
235
|
-
if (typeof MutationObserver !== "undefined") {
|
|
236
|
-
const mutationObserver = new MutationObserver(postSize);
|
|
237
|
-
mutationObserver.observe(document.documentElement, { childList: true, subtree: true, attributes: true, characterData: true });
|
|
238
|
-
}
|
|
239
|
-
})();
|
|
240
|
-
<\/script>`;return/data-agentflow-display-link-guard=["']1["']/i.test(n)?n:/<head\b[^>]*>/i.test(n)?n.replace(/<head\b([^>]*)>/i,`<head$1>${s}`):/<html\b[^>]*>/i.test(n)?n.replace(/<html\b([^>]*)>/i,`<html$1><head>${s}</head>`):`<!doctype html><html><head>${s}</head><body>${n}</body></html>`}function cU(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 uU(e,t){const n=document.createElement("a");n.href=e,n.download=t,document.body.appendChild(n),n.click(),n.remove()}function dU(e,t){const n=URL.createObjectURL(e);try{uU(n,t)}finally{window.setTimeout(()=>URL.revokeObjectURL(n),1e3)}}function nT(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 fU(e){const t=nT(e);return t!=null&&t.documentElement?`${t.doctype?`<!DOCTYPE ${t.doctype.name}${t.doctype.publicId?` PUBLIC "${t.doctype.publicId}"`:""}${t.doctype.systemId?` "${t.doctype.systemId}"`:""}>`:"<!DOCTYPE html>"}
|
|
241
|
-
${t.documentElement.outerHTML}`:""}function uy(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 pU(e,t,n,r={}){var w;const s=(w=e==null?void 0:e.getBoundingClientRect)==null?void 0:w.call(e),i=nT(e),a=i==null?void 0:i.documentElement,l=i==null?void 0:i.body,c=(r==null?void 0:r.card)||null,u=(r==null?void 0:r.displayBody)||null,p=(r==null?void 0:r.scroller)||null,d=(r==null?void 0:r.displaySize)||null,f={fallbackWidth:Number(t)||null,fallbackHeight:Number(n)||null,displaySizeWidth:Number((d==null?void 0:d.width)||0)||null,displaySizeHeight:Number((d==null?void 0:d.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:uy(c),displayBody:uy(u),scroller:uy(p)},h=[Number(t)||0,Number((d==null?void 0:d.width)||0),Number((c==null?void 0:c.clientWidth)||0),Number((c==null?void 0:c.scrollWidth)||0),Number((u==null?void 0:u.clientWidth)||0),Number((u==null?void 0:u.scrollWidth)||0),Number((p==null?void 0:p.clientWidth)||0),Number((p==null?void 0:p.scrollWidth)||0),Number(s==null?void 0:s.width)||0,Number(e==null?void 0:e.clientWidth)||0,Number((a==null?void 0:a.scrollWidth)||0),Number((l==null?void 0:l.scrollWidth)||0),Number((a==null?void 0:a.offsetWidth)||0),Number((l==null?void 0:l.offsetWidth)||0)].map(y=>Math.ceil(y)).filter(y=>y>0),g=Math.max(1,...h.length?h:[960]),k=Math.max(1,Math.round(Number(n)||(s==null?void 0:s.height)||(e==null?void 0:e.clientHeight)||640),Math.ceil(Number((a==null?void 0:a.scrollHeight)||0)),Math.ceil(Number((l==null?void 0:l.scrollHeight)||0)));return{width:g,height:k,debug:f}}async function hU({flowParams:e,content:t,sourceFilePath:n,iframe:r,width:s,height:i,filename:a,snapshotElements:l,displaySize:c}){const u=pU(r,s,i,{...l||{},displaySize:c}),p=fU(r),d=await fetch("/api/workspace/html-screenshot",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...e,content:p||t,sourceFilePath:n||"",width:u.width,height:u.height,filename:a})});if(!d.ok){const h=await d.json().catch(()=>({}));throw new Error(h.error||"截图失败")}const f=await d.blob();dU(f,a)}function mU(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 rT(e){return e==="mermaid"?"account_tree":e==="ascii"?"notes":e==="html"?"html":e==="react"?"deployed_code":e==="image"?"image":e==="chart"?"bar_chart":e==="table"?"table":"article"}function gU(e){const t=String(e||"").split(/\r?\n/).map(l=>l.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[];let s="TD";const i=(l,c="")=>{const u=String(l||"").replace(/[^A-Za-z0-9_]/g,"_")||`N${n.size+1}`;return n.has(u)?c&&(n.get(u).label=c):n.set(u,{id:u,label:c||u}),u},a=l=>{const c=String(l||"").trim().replace(/[;,]+$/,""),u=c.match(/^([A-Za-z][A-Za-z0-9_]*)(?:\[(.+?)\]|\((.+?)\)|\{(.+?)\})?$/);return u?i(u[1],u[2]||u[3]||u[4]||u[1]):i(c.replace(/[^A-Za-z0-9_]/g,"_"),c)};for(const l of t){const c=l.match(/^(graph|flowchart)\s+(TD|TB|BT|LR|RL)\b/i);if(c){s=c[2].toUpperCase();continue}const u=l.match(/^(.+?)\s*-{1,2}>+\s*(.+)$/);if(u){r.push({from:a(u[1]),to:a(u[2])});continue}a(l)}return{nodes:Array.from(n.values()),edges:r,direction:s}}function sT({code:e}){const t=m.useMemo(()=>gU(e),[e]);if(!String(e||"").trim())return null;const n=t.direction==="LR"||t.direction==="RL",r=142,s=44,i=n?96:32,a=n?30:68,l=new Map;t.nodes.forEach((p,d)=>{l.set(p.id,{x:24+(n?d*(r+i):d%3*(r+i)),y:24+(n?d%3*(s+a):d*(s+a))})});const c=Math.max(360,...Array.from(l.values()).map(p=>p.x+r+24)),u=Math.max(180,...Array.from(l.values()).map(p=>p.y+s+24));return o.jsx("div",{className:"af-work-node__mermaid-preview",children:o.jsxs("svg",{viewBox:`0 0 ${c} ${u}`,role:"img","aria-label":"Mermaid preview",children:[o.jsx("defs",{children:o.jsx("marker",{id:"af-work-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:o.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),t.edges.map((p,d)=>{const f=l.get(p.from),h=l.get(p.to);if(!f||!h)return null;const g=n?`M ${f.x+r} ${f.y+s/2} C ${(f.x+h.x+r)/2} ${f.y+s/2}, ${(f.x+h.x+r)/2} ${h.y+s/2}, ${h.x} ${h.y+s/2}`:`M ${f.x+r/2} ${f.y+s} C ${f.x+r/2} ${f.y+s+28}, ${h.x+r/2} ${h.y-28}, ${h.x+r/2} ${h.y}`;return o.jsx("path",{className:"af-work-node__mermaid-edge",d:g,markerEnd:"url(#af-work-arrow)"},`${p.from}-${p.to}-${d}`)}),t.nodes.map(p=>{const d=l.get(p.id);return o.jsxs("g",{children:[o.jsx("rect",{className:"af-work-node__mermaid-box",x:d.x,y:d.y,width:r,height:s,rx:"8"}),o.jsx("text",{className:"af-work-node__mermaid-text",x:d.x+r/2,y:d.y+s/2+5,textAnchor:"middle",children:p.label.slice(0,22)})]},p.id)})]})})}function Qs({className:e="",children:t}){const n=m.useRef(null),r=m.useRef(null),[s,i]=m.useState({visible:!1,top:0,height:100}),a=m.useCallback(()=>{const p=n.current;if(!p)return;const d=Math.max(1,p.scrollHeight),f=Math.max(1,p.clientHeight),h=d>f+1,g=h?Math.max(12,f/d*100):100,k=Math.max(0,100-g),w=h?Math.min(k,p.scrollTop/Math.max(1,d-f)*k):0;i({visible:h,top:w,height:g})},[]);m.useEffect(()=>{const p=requestAnimationFrame(a),d=n.current;if(!d||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(p);const f=new ResizeObserver(a);f.observe(d);for(const h of Array.from(d.children))f.observe(h);return()=>{cancelAnimationFrame(p),f.disconnect()}},[t,a]);const l=m.useCallback(p=>{const d=n.current;if(!d)return;const f=Math.max(0,d.scrollHeight-d.clientHeight);d.scrollTop=Math.min(1,Math.max(0,p))*f,a()},[a]),c=m.useCallback((p,d=0)=>{const f=r.current;if(!f)return 0;const h=f.getBoundingClientRect(),g=s.height/100*h.height,k=Math.max(1,h.height-g);return(p-h.top-d)/k},[s.height]),u=m.useCallback(p=>{var C,N;if(!s.visible)return;p.preventDefault(),p.stopPropagation();const d=r.current;if(!d)return;const f=d.getBoundingClientRect(),h=s.top/100*f.height,g=s.height/100*f.height,w=p.clientY>=f.top+h&&p.clientY<=f.top+h+g?p.clientY-f.top-h:g/2;l(c(p.clientY,w));const y=p.pointerId;(N=(C=p.currentTarget).setPointerCapture)==null||N.call(C,y);const v=j=>{j.preventDefault(),l(c(j.clientY,w))},x=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x)};window.addEventListener("pointermove",v),window.addEventListener("pointerup",x),window.addEventListener("pointercancel",x)},[c,l,s.height,s.top,s.visible]);return o.jsxs("div",{className:`af-visible-scroll-frame ${e}`,children:[o.jsx("div",{ref:n,className:`af-visible-scroll-frame__scroller ${e}`,onScroll:a,children:t}),o.jsx("div",{ref:r,className:"af-visible-scrollbar"+(s.visible?" af-visible-scrollbar--visible":""),onPointerDown:u,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${s.height}%`,top:`${s.top}%`}})})]})}function iT({data:e,flowParams:t,htmlFrameRef:n,htmlFrameVersion:r=0}){const s=kn(e),i=Hi(e),a=s==="image"?i:pi(i),l=s==="image"?"":Lo(a,s),[c,u]=m.useState(""),[p,d]=m.useState(""),[f,h]=m.useState(!1);m.useEffect(()=>{let v=!1;return l?(h(!0),d(""),u(""),Oa(t,l).then(x=>{v||u(x)}).catch(x=>{v||d(String(x.message||x))}).finally(()=>{v||h(!1)}),()=>{v=!0}):(u(""),d(""),h(!1),()=>{v=!0})},[l,t==null?void 0:t.flowId,t==null?void 0:t.flowSource,t==null?void 0:t.archived,e==null?void 0:e.displayReloadKey]);const g=l?c:a,k=s==="html"?fc(g):s==="react"?gm(g):pi(g),w=m.useRef("");if(w.current||(w.current=`html-display-${Math.random().toString(36).slice(2,10)}`),!s)return null;const y=ha(s,k);if(f)return o.jsxs(Qs,{className:"af-work-display-empty",children:["Loading ",l,"..."]});if(p)return o.jsx(Qs,{className:"af-work-display-empty",children:p});if(y)return o.jsx(Qs,{className:"af-work-display-empty",children:y});if(!k.trim())return o.jsx(Qs,{className:"af-work-display-empty",children:"No display content"});if(s==="html"||s==="react")return o.jsx("div",{className:"af-work-display-body af-work-display-body--html",children:o.jsx("iframe",{ref:n,className:"af-work-display-html-frame",title:(e==null?void 0:e.label)||(s==="react"?"React app preview":"HTML preview"),sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox",srcDoc:s==="react"?rk(k,w.current):tT(k,w.current)},r)});if(s==="image"){const v=od(k,t);return o.jsx(Qs,{className:"af-work-display-body af-work-display-body--image",children:o.jsx("img",{className:"af-work-display-image",src:v,alt:mU(e),loading:"lazy"})})}return s==="markdown"?o.jsx(Qs,{className:"af-work-display-body af-work-display-body--markdown",children:o.jsx(Xb,{content:k,basePath:l,resolveSrc:(v,x)=>od(v,t,x)})}):s==="chart"?o.jsx(Qs,{className:"af-work-display-body af-work-display-body--chart",children:o.jsx(Zb,{content:k})}):s==="table"?o.jsx(Qs,{className:"af-work-display-body af-work-display-body--table",children:o.jsx(Qb,{content:k})}):s==="mermaid"?o.jsxs(Qs,{className:"af-work-display-body",children:[o.jsx(sT,{code:k}),o.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--mermaid",children:k})]}):o.jsx(Qs,{className:"af-work-display-body af-work-display-body--ascii",children:o.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--ascii",children:k})})}function yU({node:e,onClose:t}){var v,x,C,N,j,E,P,O,B,W,z;const n=m.useRef(null),r=kn(e==null?void 0:e.data),s=((v=e==null?void 0:e.data)==null?void 0:v.label)||(r==="html"?"HTML 展示":r==="markdown"?"Markdown 展示":"Display 预览"),i=!!((x=e==null?void 0:e.data)!=null&&x.readOnly),[a,l]=m.useState(!1),[c,u]=m.useState(""),[p,d]=m.useState(""),[f,h]=m.useState(!1),g=Hi(e==null?void 0:e.data),k=r==="markdown"?pi(g):"",w=r==="markdown"?Lo(k,"markdown"):"",y=r==="markdown"?w?p:k:"";return m.useEffect(()=>{const L=R=>{if(R.key==="Escape"){if(a){u(String(y||"")),l(!1);return}t==null||t()}};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[y,a,t]),m.useEffect(()=>{var R;let L=!1;return r!=="markdown"||!w?(d(""),h(!1),()=>{L=!0}):(h(!0),Oa(((R=e==null?void 0:e.data)==null?void 0:R.flowParams)||{},w).then(K=>{L||d(K)}).catch(K=>{var D,$;L||(d(""),($=(D=e==null?void 0:e.data)==null?void 0:D.onStatus)==null||$.call(D,String(K.message||K)))}).finally(()=>{L||h(!1)}),()=>{L=!0})},[r,w,(N=(C=e==null?void 0:e.data)==null?void 0:C.flowParams)==null?void 0:N.flowId,(E=(j=e==null?void 0:e.data)==null?void 0:j.flowParams)==null?void 0:E.flowSource,(O=(P=e==null?void 0:e.data)==null?void 0:P.flowParams)==null?void 0:O.archived,(B=e==null?void 0:e.data)==null?void 0:B.displayReloadKey]),m.useEffect(()=>{a||u(String(y||""))},[y,a]),e?Cr.createPortal(o.jsx("div",{className:"af-display-preview-overlay",role:"dialog","aria-modal":"true","aria-label":"全屏预览",children:o.jsxs("div",{className:"af-display-preview-shell",children:[o.jsxs("div",{className:"af-display-preview-head",children:[o.jsxs("div",{className:"af-display-preview-title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:rT(r)}),o.jsx("strong",{children:s}),o.jsx("span",{children:e.id})]}),o.jsxs("div",{className:"af-display-preview-actions",children:[r==="markdown"?a?o.jsxs(o.Fragment,{children:[o.jsx("button",{type:"button",className:"af-display-preview-action",disabled:i||f,onClick:async()=>{var L,R;try{await aT({nodeId:e.id,data:e.data,filePath:w,content:c,setFileContent:d}),l(!1)}catch(K){(R=(L=e==null?void 0:e.data)==null?void 0:L.onStatus)==null||R.call(L,String(K.message||K))}},"aria-label":"保存并预览",title:"保存并预览",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"done"})}),o.jsx("button",{type:"button",className:"af-display-preview-action",onClick:()=>{u(String(y||"")),l(!1)},"aria-label":"取消编辑",title:"取消编辑",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):o.jsx("button",{type:"button",className:"af-display-preview-action",disabled:i||f,onClick:()=>{u(String(y||"")),l(!0)},"aria-label":"编辑 Markdown",title:"编辑 Markdown",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"edit"})}):null,o.jsx("button",{type:"button",className:"af-display-preview-action",onClick:t,"aria-label":"关闭全屏预览",title:"关闭",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close_fullscreen"})})]})]}),o.jsx("div",{className:"af-display-preview-content",children:r==="markdown"&&a?o.jsx(oT,{value:c,onChange:u,onUploadImage:(W=e.data)==null?void 0:W.onUploadWorkspaceImage,readOnly:i}):o.jsx(iT,{data:e.data,flowParams:(z=e.data)==null?void 0:z.flowParams,htmlFrameRef:n})})]})}),document.body):null}function xU({node:e}){var f,h,g,k,w,y,v,x,C,N;const t=kn(e==null?void 0:e.data),n=Hi(e==null?void 0:e.data),r=t==="image"?n:pi(n),s=t==="image"?"":Lo(r,t),[i,a]=m.useState(""),[l,c]=m.useState(!1);m.useEffect(()=>{var E;let j=!1;return s?(c(!0),a(""),Oa(((E=e==null?void 0:e.data)==null?void 0:E.flowParams)||{},s).then(P=>{j||a(P)}).catch(()=>{j||a("")}).finally(()=>{j||c(!1)}),()=>{j=!0}):(a(""),c(!1),()=>{j=!0})},[s,(h=(f=e==null?void 0:e.data)==null?void 0:f.flowParams)==null?void 0:h.flowId,(k=(g=e==null?void 0:e.data)==null?void 0:g.flowParams)==null?void 0:k.flowSource,(y=(w=e==null?void 0:e.data)==null?void 0:w.flowParams)==null?void 0:y.archived,(v=e==null?void 0:e.data)==null?void 0:v.displayReloadKey]);const u=s?i:r,p=t==="html"?fc(u):t==="react"?gm(u):pi(u),d=ha(t,p);return l?o.jsx("div",{className:"af-display-picker-preview__empty",children:"Loading"}):d?o.jsx("div",{className:"af-display-picker-preview__empty",children:d}):p.trim()?t==="html"||t==="react"?o.jsx("iframe",{title:((x=e==null?void 0:e.data)==null?void 0:x.label)||(e==null?void 0:e.id),sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox",srcDoc:t==="react"?rk(p):tT(p)}):t==="image"?o.jsx("img",{src:od(p,(C=e==null?void 0:e.data)==null?void 0:C.flowParams),alt:((N=e==null?void 0:e.data)==null?void 0:N.label)||(e==null?void 0:e.id),loading:"lazy"}):t==="markdown"?o.jsx("div",{className:"af-display-picker-preview__markdown",children:o.jsx(Xb,{content:p,basePath:s,resolveSrc:(j,E)=>{var P;return od(j,(P=e==null?void 0:e.data)==null?void 0:P.flowParams,E)}})}):t==="chart"?o.jsx(Zb,{content:p}):t==="table"?o.jsx(Qb,{content:p}):t==="mermaid"?o.jsxs("div",{className:"af-display-picker-preview__diagram",children:[o.jsx(sT,{code:p}),o.jsx("pre",{children:p})]}):o.jsx("pre",{className:"af-display-picker-preview__pre",children:p}):o.jsx("div",{className:"af-display-picker-preview__empty",children:"No content"})}function oT({value:e,onChange:t,onUploadImage:n,readOnly:r=!1}){const s=m.useRef(null),i=m.useRef(null),a=m.useRef(null),[l,c]=m.useState(!1),[u,p]=m.useState({visible:!1,top:0,height:100}),d=m.useCallback(()=>{const y=s.current;if(!y)return;const v=Math.max(1,y.scrollHeight),x=Math.max(1,y.clientHeight),C=v>x+1,N=C?Math.max(12,x/v*100):100,j=Math.max(0,100-N),E=C?Math.min(j,y.scrollTop/Math.max(1,v-x)*j):0;p({visible:C,top:E,height:N})},[]);m.useEffect(()=>{const y=requestAnimationFrame(d),v=s.current;if(!v||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(y);const x=new ResizeObserver(d);return x.observe(v),()=>{cancelAnimationFrame(y),x.disconnect()}},[d,e]);const f=m.useCallback(y=>{const v=s.current;if(!v)return;const x=Math.max(0,v.scrollHeight-v.clientHeight);v.scrollTop=Math.min(1,Math.max(0,y))*x,d()},[d]),h=m.useCallback((y,v=0)=>{const x=a.current;if(!x)return 0;const C=x.getBoundingClientRect(),N=u.height/100*C.height,j=Math.max(1,C.height-N);return(y-C.top-v)/j},[u.height]),g=m.useCallback(y=>{if(!u.visible)return;y.preventDefault(),y.stopPropagation();const v=a.current;if(!v)return;const x=v.getBoundingClientRect(),C=u.top/100*x.height,N=u.height/100*x.height,E=y.clientY>=x.top+C&&y.clientY<=x.top+C+N?y.clientY-x.top-C:N/2;f(h(y.clientY,E));const P=B=>{B.preventDefault(),f(h(B.clientY,E))},O=()=>{window.removeEventListener("pointermove",P),window.removeEventListener("pointerup",O),window.removeEventListener("pointercancel",O)};window.addEventListener("pointermove",P),window.addEventListener("pointerup",O),window.addEventListener("pointercancel",O)},[h,f,u.height,u.top,u.visible]),k=m.useCallback(y=>{const v=String(e||""),x=s.current,C=Number((x==null?void 0:x.selectionStart)??v.length),N=Number((x==null?void 0:x.selectionEnd)??C),j=v.slice(0,C),E=v.slice(N),P=j&&!j.endsWith(`
|
|
242
|
-
`)?`
|
|
243
|
-
`:"",O=E&&!E.startsWith(`
|
|
244
|
-
`)?`
|
|
245
|
-
`:"",B=`${j}${P}${y}${O}${E}`;t==null||t(B),window.requestAnimationFrame(()=>{var z,L;const W=j.length+P.length+y.length;(z=s.current)==null||z.focus(),(L=s.current)==null||L.setSelectionRange(W,W)})},[t,e]),w=m.useCallback(async y=>{if(!r&&!(!y||l)){c(!0);try{const v=await(n==null?void 0:n(y)),x=String(v||"").trim();if(x){const C=String(y.name||"image").replace(/\.[^.]+$/g,"").trim()||"image";k(``)}}finally{c(!1)}}},[k,n,r,l]);return o.jsxs("div",{className:"af-work-display-editor nodrag nopan",onClick:y=>y.stopPropagation(),onDragOver:y=>{var x;Array.from(((x=y.dataTransfer)==null?void 0:x.items)||[]).some(C=>String((C==null?void 0:C.type)||"").startsWith("image/"))&&(y.preventDefault(),y.dataTransfer.dropEffect="copy")},onDrop:y=>{var x;const v=Array.from(((x=y.dataTransfer)==null?void 0:x.files)||[]).find(yh);v&&(y.preventDefault(),w(v))},children:[o.jsxs("div",{className:"af-work-display-editor__toolbar",children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:l||r,onClick:()=>{var y;return(y=i.current)==null?void 0:y.click()},"aria-label":"上传图片",title:"上传图片",children:o.jsx("span",{className:"material-symbols-outlined",children:l?"hourglass_top":"add_photo_alternate"})}),o.jsx("input",{ref:i,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:y=>{var x;const v=(x=y.target.files)==null?void 0:x[0];y.target.value="",v&&w(v)}})]}),o.jsx("textarea",{ref:s,className:"af-work-display-editor__textarea",value:e,onChange:y=>t==null?void 0:t(y.target.value),onScroll:d,onKeyDown:y=>{y.key==="Escape"&&y.stopPropagation()},placeholder:"输入 Markdown 内容",spellCheck:!1,readOnly:r}),o.jsx("div",{ref:a,className:"af-work-display-editor__scrollbar"+(u.visible?" af-work-display-editor__scrollbar--visible":""),onPointerDown:g,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${u.height}%`,top:`${u.top}%`}})})]})}function wU({nodeId:e,data:t}){const n=t==null?void 0:t.nodeChatActive,r=!!(t!=null&&t.selected),s=(t==null?void 0:t.nodeChat)||{},i=Array.isArray(s.messages)?s.messages:[],a=String(s.draft||""),[l,c]=m.useState(a),u=m.useRef(!1),p=String(s.candidateContent||""),d=!!s.running,f=!!(t!=null&&t.readOnly),h=String(s.error||""),g=i.slice(-2);return m.useEffect(()=>{u.current||c(a)},[a]),!n&&!r?null:n?o.jsxs("div",{className:"af-work-node-chat nodrag nopan",onClick:k=>k.stopPropagation(),children:[o.jsxs("div",{className:"af-work-node-chat__head",children:[o.jsxs("div",{children:[o.jsx("strong",{children:"继续微调"}),o.jsx("span",{children:(t==null?void 0:t.label)||e})]}),o.jsx("button",{type:"button",onClick:()=>{var k;return(k=t==null?void 0:t.onCloseNodeChat)==null?void 0:k.call(t)},"aria-label":"关闭节点微调",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),i.length>0||d||h?o.jsxs("div",{className:"af-work-node-chat__messages",children:[g.map((k,w)=>o.jsxs("div",{className:`af-work-node-chat__msg af-work-node-chat__msg--${k.role==="assistant"?"assistant":"user"}`,children:[o.jsx("span",{children:k.role==="assistant"?"AI":"你"}),o.jsx("p",{children:k.text})]},`${k.at||w}-${w}`)),d?o.jsx("div",{className:"af-work-node-chat__pending",children:"生成中..."}):null,h?o.jsx("div",{className:"af-work-node-chat__error",children:h}):null]}):null,o.jsxs("div",{className:"af-work-node-chat__composer",children:[o.jsx("button",{type:"button",className:"af-work-node-chat__add",disabled:d||f,"aria-label":"添加上下文",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),o.jsx("textarea",{className:"af-work-node-chat__input",rows:2,value:l,disabled:d||f,placeholder:"描述你想怎么调整这个展示",onCompositionStart:()=>{u.current=!0},onCompositionEnd:k=>{var y;u.current=!1;const w=k.currentTarget.value;c(w),(y=t==null?void 0:t.onUpdateNodeChatDraft)==null||y.call(t,e,w)},onChange:k=>{var y;const w=k.target.value;c(w),u.current||(y=t==null?void 0:t.onUpdateNodeChatDraft)==null||y.call(t,e,w)},onKeyDown:k=>{var w,y;k.isComposing||(w=k.nativeEvent)!=null&&w.isComposing||k.keyCode===229||(k.metaKey||k.ctrlKey)&&k.key==="Enter"&&(k.preventDefault(),(y=t==null?void 0:t.onSendNodeChat)==null||y.call(t,e,l))}}),o.jsx("button",{type:"button",className:"af-work-node-chat__send",disabled:d||f||!l.trim(),onClick:()=>{var k;return(k=t==null?void 0:t.onSendNodeChat)==null?void 0:k.call(t,e,l)},"aria-label":"发送",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_upward"})})]}),p.trim()?o.jsx("div",{className:"af-work-node-chat__messages",children:o.jsxs("div",{className:"af-work-node-chat__msg af-work-node-chat__msg--assistant",children:[o.jsx("span",{children:"AI"}),o.jsx("p",{children:p})]})}):null]}):o.jsxs("button",{type:"button",className:"af-work-node-chat-anchor nodrag nopan",onClick:k=>{var w;k.stopPropagation(),(w=t==null?void 0:t.onToggleNodeChat)==null||w.call(t,e)},title:"微调这个节点","aria-label":"微调这个节点",children:[o.jsx("span",{className:"material-symbols-outlined af-work-node-chat-anchor__plus","aria-hidden":!0,children:"add"}),o.jsx("span",{className:"af-work-node-chat-anchor__label",children:"继续微调这个展示"}),o.jsx("span",{className:"material-symbols-outlined af-work-node-chat-anchor__expand","aria-hidden":!0,children:"open_in_full"})]})}function bU(e){return e==="mermaid"?"mmd":e==="ascii"?"txt":e==="html"?"html":e==="react"?"json":e==="image"?"txt":e==="chart"||e==="table"?"json":"md"}function kU(e){return String(e).trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)||"display"}function vU(e){return String(e||"node").trim().replace(/[^a-zA-Z0-9._-]+/g,"_").replace(/^_+|_+$/g,"").slice(0,120)||"node"}function t1(e,t=""){const n=Lo(e,t).replace(/^\/+/,"");return n.startsWith("outputs/")?n:""}function SU(e,t){const n=vU(e),r=new Set,s=kn(t)||"";Ws(t==null?void 0:t.definitionId)&&r.add(`outputs/${n}`);const i=t1(Hi(t),s);return i&&r.add(i),(Array.isArray(t==null?void 0:t.outputs)?t.outputs:[]).some(c=>{const u=String((c==null?void 0:c.value)??(c==null?void 0:c.default)??"").trim().replace(/^\/+/,""),p=t1(u,s);return p&&r.add(p),u===`outputs/${n}`||u.startsWith(`outputs/${n}/`)})&&r.add(`outputs/${n}`),Array.from(r)}function n1(e,t){const n=kn(t)||"markdown";return`outputs/${kU((t==null?void 0:t.label)||e||n)}.${bU(n)}`}async function aT({nodeId:e,data:t,filePath:n,content:r,setFileContent:s}){var i,a;if(n){const l=await cw((t==null?void 0:t.flowParams)||{},n,r);s==null||s(r),(i=t==null?void 0:t.onSetDisplayNodeContent)==null||i.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 lT({id:e,data:t,selected:n,deleteNode:r}){var se,te,re;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],a=(Array.isArray(t==null?void 0:t.outputs)?t.outputs:[]).map((ne,ce)=>({slot:ne,idx:ce})).sort((ne,ce)=>{var Te,ot,gt,yt;const de=String(((Te=ne.slot)==null?void 0:Te.name)||"").trim(),me=String(((ot=ce.slot)==null?void 0:ot.name)||"").trim();if(de==="next"&&me!=="next")return-1;if(me==="next"&&de!=="next")return 1;const He=String(((gt=ne.slot)==null?void 0:gt.type)||"").trim(),Je=String(((yt=ce.slot)==null?void 0:yt.type)||"").trim();return He==="node"&&Je!=="node"?-1:Je==="node"&&He!=="node"?1:ne.idx-ce.idx}),l=kn(t),c=m.useRef(null),u=m.useRef(null),[p,d]=m.useState(0),[f,h]=m.useState(!1),[g,k]=m.useState(!1),[w,y]=m.useState(!1),[v,x]=m.useState(""),[C,N]=m.useState(""),[j,E]=m.useState(!1),[P,O]=m.useState(!1),B=m.useRef(null),W=Hi(t),z=l==="markdown"?pi(W):"",L=l==="markdown"?Lo(z,"markdown"):"",R=l==="markdown"?L?C:z:"",K=!!(t!=null&&t.readOnly),D=!!(t!=null&&t.displayPageMode);m.useEffect(()=>{let ne=!1;return l!=="markdown"||!L?(N(""),E(!1),()=>{ne=!0}):(E(!0),Oa((t==null?void 0:t.flowParams)||{},L).then(ce=>{ne||N(ce)}).catch(ce=>{var de;ne||(N(""),(de=t==null?void 0:t.onStatus)==null||de.call(t,String(ce.message||ce)))}).finally(()=>{ne||E(!1)}),()=>{ne=!0})},[l,L,(se=t==null?void 0:t.flowParams)==null?void 0:se.flowId,(te=t==null?void 0:t.flowParams)==null?void 0:te.flowSource,(re=t==null?void 0:t.flowParams)==null?void 0:re.archived,t==null?void 0:t.displayReloadKey]),m.useEffect(()=>{if(!g)return;const ne=()=>k(!1);return window.addEventListener("pointerup",ne,!0),window.addEventListener("pointercancel",ne,!0),window.addEventListener("mouseup",ne,!0),window.addEventListener("blur",ne),()=>{window.removeEventListener("pointerup",ne,!0),window.removeEventListener("pointercancel",ne,!0),window.removeEventListener("mouseup",ne,!0),window.removeEventListener("blur",ne)}},[g]),m.useEffect(()=>{w||x(String(R||""))},[R,w]);const $=(t==null?void 0:t.label)||(l==="mermaid"?"Mermaid":l==="ascii"?"ASCII":l==="html"?"HTML":l==="react"?"React App":l==="image"?"Image":l==="chart"?"Chart":l==="table"?"Table":"Markdown"),I=String((t==null?void 0:t.sourceNodeId)||e),F=(t==null?void 0:t.sharingDisplayNodeId)===I,_=t!=null&&t.displaySize&&Number(t.displaySize.width)>0&&Number(t.displaySize.height)>0?{width:Number(t.displaySize.width),height:Number(t.displaySize.height)}:null,X=m.useCallback(async()=>{var Ae,dt,St,Wt,Vt,et,fe,ke,Ve,Qe;if(l!=="html"||f)return;const ne=Hi(t),ce=Lo(ne,l);let de=ne;if(ce)try{de=await Oa((t==null?void 0:t.flowParams)||{},ce)}catch(Se){h(!1),console.warn("Failed to read HTML display file before saving image.",Se);return}const me=fc(de);if(!me.trim())return;const He=ha(l,me);if(He){console.warn(He);return}const Je=(dt=(Ae=u.current)==null?void 0:Ae.getBoundingClientRect)==null?void 0:dt.call(Ae),Te=(Wt=(St=c.current)==null?void 0:St.querySelector)==null?void 0:Wt.call(St,".af-work-display-body"),ot=(et=(Vt=c.current)==null?void 0:Vt.querySelector)==null?void 0:et.call(Vt,".af-visible-scroll-frame__scroller"),gt=Math.round(Math.max(Number((Je==null?void 0:Je.width)||0),Number((_==null?void 0:_.width)||0),Number(((fe=c.current)==null?void 0:fe.clientWidth)||0),Number((Te==null?void 0:Te.clientWidth)||0),Number((ot==null?void 0:ot.clientWidth)||0),Math.max(320,Number((_==null?void 0:_.width)||960)-2))),yt=Math.round(Math.max(Number((Je==null?void 0:Je.height)||0),Number((_==null?void 0:_.height)||0),Number(((ke=c.current)==null?void 0:ke.clientHeight)||0),Number((Te==null?void 0:Te.clientHeight)||0),Number((ot==null?void 0:ot.clientHeight)||0),Math.max(180,Number((_==null?void 0:_.height)||640)-46)));h(!0);try{await hU({flowParams:(t==null?void 0:t.flowParams)||{},content:me,sourceFilePath:ce,iframe:u.current,width:gt,height:yt,filename:cU((t==null?void 0:t.label)||e||"html-render","png"),snapshotElements:{card:c.current,displayBody:Te,scroller:ot},displaySize:_}),(Ve=t==null?void 0:t.onStatus)==null||Ve.call(t,"已导出 HTML 展示截图")}catch(Se){const _t=String((Se==null?void 0:Se.message)||Se||"截图失败");(Qe=t==null?void 0:t.onStatus)==null||Qe.call(t,`HTML 截图失败:${_t}`),console.warn("Failed to save HTML display as PNG.",Se)}finally{h(!1)}},[t,_==null?void 0:_.height,_==null?void 0:_.width,e,l,f]),V=m.useCallback(ne=>{var ce;K||!ne||l!=="image"||(ce=t==null?void 0:t.onUploadImageToDisplayNode)==null||ce.call(t,e,ne)},[t,e,l,K]),T=m.useCallback(ne=>{var ce,de;(ce=ne==null?void 0:ne.stopPropagation)==null||ce.call(ne),!K&&((de=t==null?void 0:t.onSetDisplayNodeContent)==null||de.call(t,e,"","replace",{logChat:!1,reloadDisplay:!0,statusMessage:"已清空 Display 内容"}),l==="markdown"&&(x(""),y(!1)))},[t,e,l,K]),ee=m.useCallback(ne=>{var me,He;K||l!=="image"||!(Array.from(((me=ne.dataTransfer)==null?void 0:me.files)||[]).some(yh)||Array.from(((He=ne.dataTransfer)==null?void 0:He.items)||[]).some(Je=>String((Je==null?void 0:Je.type)||"").startsWith("image/")))||(ne.preventDefault(),ne.stopPropagation(),ne.dataTransfer.dropEffect="copy",O(!0))},[l,K]),ie=m.useCallback(ne=>{l==="image"&&(ne.currentTarget.contains(ne.relatedTarget)||O(!1))},[l]),G=m.useCallback(ne=>{var de;if(l!=="image")return;const ce=Array.from(((de=ne.dataTransfer)==null?void 0:de.files)||[]).find(yh);ce&&(ne.preventDefault(),ne.stopPropagation(),O(!1),V(ce))},[l,V]);return o.jsxs("div",{className:"af-work-display-card"+(_?" af-work-display-card--sized":"")+(n?" af-work-display-card--selected":"")+(g?" af-work-display-card--resizing":"")+(P?" af-work-display-card--image-drop":"")+(D?" af-work-display-card--presentation":"")+(t!=null&&t.isExecuting?" af-work-display-card--executing":"")+((t==null?void 0:t.nodeStatus)==="success"?" af-work-display-card--done":"")+((t==null?void 0:t.nodeStatus)==="failed"?" af-work-display-card--failed":""),style:_?{width:_.width,height:_.height}:void 0,ref:c,onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,onDragOver:ee,onDragLeave:ie,onDrop:G,children:[o.jsx($b,{className:"af-work-display-resize nodrag",position:"bottom-right",minWidth:320,minHeight:180,onResizeStart:()=>k(!0),onResizeEnd:()=>k(!1),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),s.map((ne,ce)=>{if(ne.showOnNode===!1)return null;const de=`${4.15+ce*1.75}rem`,me=ne.name||`#${ce+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:de},children:me}),o.jsx(zn,{type:"target",position:$e.Left,id:`input-${ce}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:de,background:Sn(ne.type)},title:`${me} · ${ne.type}`})]},`in-${ce}`)}),a.map(({slot:ne,idx:ce},de)=>{if(ne.showOnNode===!1)return null;const me=`${4.15+de*1.75}rem`,He=ne.name||`#${ce+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:me},children:He}),o.jsx(zn,{type:"source",position:$e.Right,id:`output-${ce}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:me,background:Sn(ne.type)},title:`${He} · ${ne.type}`})]},`out-${ce}`)}),o.jsxs("div",{className:"af-work-display-card__head",children:[o.jsxs("div",{className:"af-work-display-card__title",children:[o.jsx("span",{className:"material-symbols-outlined",children:rT(l)}),o.jsx("strong",{children:$}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"display"})]}),l==="html"?o.jsxs("div",{className:"af-work-display-card__html-controls nodrag",onClick:ne=>ne.stopPropagation(),children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var ne,ce,de,me;try{(me=(de=(ce=(ne=u.current)==null?void 0:ne.contentWindow)==null?void 0:ce.history)==null?void 0:de.back)==null||me.call(de)}catch{}},"aria-label":"后退",title:"后退",children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{var ne,ce,de,me;try{(me=(de=(ce=(ne=u.current)==null?void 0:ne.contentWindow)==null?void 0:ce.history)==null?void 0:de.forward)==null||me.call(de)}catch{}},"aria-label":"前进",title:"前进",children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_forward"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>d(ne=>ne+1),"aria-label":"刷新",title:"刷新",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:f,onClick:X,"aria-label":"截图另存为图片",title:"截图另存为图片",children:o.jsx("span",{className:"material-symbols-outlined",children:f?"hourglass_empty":"photo_camera"})})]}):null,l==="markdown"?w?o.jsxs("div",{className:"af-work-display-card__html-controls nodrag",onClick:ne=>ne.stopPropagation(),children:[o.jsx("button",{type:"button",className:"af-work-display-card__action",disabled:K||j,onClick:async()=>{var ne;try{await aT({nodeId:e,data:t,filePath:L,content:v,setFileContent:N}),y(!1)}catch(ce){(ne=t==null?void 0:t.onStatus)==null||ne.call(t,String(ce.message||ce))}},"aria-label":"保存并预览",title:"保存并预览",children:o.jsx("span",{className:"material-symbols-outlined",children:"done"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action",onClick:()=>{x(String(R||"")),y(!1)},"aria-label":"取消编辑",title:"取消编辑",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}):o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:K||j,onClick:ne=>{ne.stopPropagation(),x(String(R||"")),y(!0)},"aria-label":"编辑 Markdown",title:"编辑 Markdown",children:o.jsx("span",{className:"material-symbols-outlined",children:"edit"})}):null,l==="image"?o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:B,className:"af-hidden-file-input",type:"file",accept:"image/*",onChange:ne=>{var de;const ce=(de=ne.target.files)==null?void 0:de[0];ne.target.value="",ce&&V(ce)}}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:K,onClick:ne=>{var ce;ne.stopPropagation(),(ce=B.current)==null||ce.click()},"aria-label":"上传图片",title:"上传图片",children:o.jsx("span",{className:"material-symbols-outlined",children:"upload"})})]}):null,o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",onClick:ne=>{var ce;ne.stopPropagation(),(ce=t==null?void 0:t.onOpenDisplayPreview)==null||ce.call(t,I)},"aria-label":"全屏预览",title:"全屏预览",children:o.jsx("span",{className:"material-symbols-outlined",children:"fullscreen"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:F,onClick:ne=>{var ce;ne.stopPropagation(),(ce=t==null?void 0:t.onShareDisplayNode)==null||ce.call(t,I)},"aria-label":"分享展示",title:"分享展示",children:o.jsx("span",{className:"material-symbols-outlined",children:F?"hourglass_empty":"ios_share"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:K,onClick:T,"aria-label":"清空内容",title:"清空内容",children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_sweep"})}),o.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",disabled:K,onClick:()=>{var ne;return(ne=t==null?void 0:t.onSaveDisplayNodeToFile)==null?void 0:ne.call(t,e,t)},"aria-label":"另存为文件",title:"另存为文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"save"})}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",disabled:K,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),l==="markdown"&&w?o.jsx(oT,{value:v,onChange:x,onUploadImage:t==null?void 0:t.onUploadWorkspaceImage,readOnly:K}):o.jsx(iT,{data:t,flowParams:t==null?void 0:t.flowParams,htmlFrameRef:u,htmlFrameVersion:p}),o.jsx(wU,{nodeId:e,data:t})]})}function NU({id:e,data:t,selected:n,deleteNode:r}){var p,d,f;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],i=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],a=((d=(p=t==null?void 0:t.runningRunNodeIds)==null?void 0:p.has)==null?void 0:d.call(p,e))||((f=t==null?void 0:t.runningRunNodeIds)==null?void 0:f[e])===!0||(t==null?void 0:t.isExecuting)||(t==null?void 0:t.nodeStatus)==="running",l=(t==null?void 0:t.optimizingRun)===!0,c=(t==null?void 0:t.nodeStatus)==="stopped",u=!!(t!=null&&t.readOnly);return o.jsxs("div",{className:"af-work-run-card"+(n?" af-work-run-card--selected":"")+(a?" af-work-run-card--running":"")+(t!=null&&t.isExecuting?" af-work-run-card--executing":"")+((t==null?void 0:t.nodeStatus)==="success"?" af-work-run-card--done":"")+((t==null?void 0:t.nodeStatus)==="failed"?" af-work-run-card--failed":"")+(c?" af-work-run-card--stopped":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[s.map((h,g)=>{if(h.showOnNode===!1)return null;const k=`${2.25+g*1.75}rem`,w=h.name||`#${g+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:k},children:w}),o.jsx(zn,{type:"target",position:$e.Left,id:`input-${g}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:k,background:Sn(h.type)},title:`${w} · ${h.type}`})]},`in-${g}`)}),i.map((h,g)=>{if(h.showOnNode===!1)return null;const k=`${2.25+g*1.75}rem`,w=h.name||`#${g+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:k},children:w}),o.jsx(zn,{type:"source",position:$e.Right,id:`output-${g}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:k,background:Sn(h.type)},title:`${w} · ${h.type}`})]},`out-${g}`)}),o.jsxs("div",{className:"af-work-run-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"play_circle"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"Run"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"workspace_run"}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",disabled:u,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-run-card__actions",children:[o.jsxs("button",{type:"button",className:"af-work-run-card__button nodrag"+(a?" af-work-run-card__button--stop":""),disabled:u||l,onClick:h=>{var g,k;h.stopPropagation(),a?(g=t==null?void 0:t.onStopWorkspaceNode)==null||g.call(t,e):(k=t==null?void 0:t.onRunWorkspaceNode)==null||k.call(t,e)},children:[o.jsx("span",{className:"material-symbols-outlined",children:a?"stop_circle":"play_arrow"}),o.jsx("span",{children:a?"Stop":"Run line"})]}),o.jsx("button",{type:"button",className:"af-work-run-card__button af-work-run-card__optimize nodrag"+(l?" af-work-run-card__optimize--running":""),disabled:u||a||l,title:l?"正在优化":"为下游节点提前生成 implementation","aria-label":l?"正在优化":"优化",onClick:h=>{var g;h.stopPropagation(),(g=t==null?void 0:t.onOptimizeWorkspaceRun)==null||g.call(t,e)},children:o.jsx("span",{className:"material-symbols-outlined",children:l?"sync":"auto_fix_high"})}),o.jsx("button",{type:"button",className:"af-work-run-card__button af-work-run-card__logs nodrag",title:"查看执行日志","aria-label":"查看执行日志",onClick:h=>{var g;h.stopPropagation(),(g=t==null?void 0:t.onOpenWorkspaceRunLogs)==null||g.call(t,{nodeId:e,runNodeId:e,scheduleNodeId:"",label:(t==null?void 0:t.label)||"Run"})},children:o.jsx("span",{className:"material-symbols-outlined",children:"article"})})]})]})}function jU({id:e,data:t,selected:n,deleteNode:r,skills:s,skillCollections:i,workspaces:a}){var Qe,Se,_t,dn,zt,at,fn;const l=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],c=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],u=BU(t),[p,d]=m.useState(u.task),f=m.useRef(!1),h=m.useRef(u.task),g=((Se=(Qe=t==null?void 0:t.runningRunNodeIds)==null?void 0:Qe.has)==null?void 0:Se.call(Qe,e))||((_t=t==null?void 0:t.runningRunNodeIds)==null?void 0:_t[e])===!0||(t==null?void 0:t.isExecuting)||(t==null?void 0:t.nodeStatus)==="running",k=(t==null?void 0:t.nodeStatus)==="stopped",w=!!(t!=null&&t.readOnly),y=Array.isArray(s)?s:[],v=Array.isArray(i)?i:[],x=m.useMemo(()=>(Array.isArray(a)?a:[]).map(Z=>({id:String((Z==null?void 0:Z.id)||""),label:String((Z==null?void 0:Z.label)||(Z==null?void 0:Z.name)||"知识库"),kind:(Z==null?void 0:Z.kind)==="git"?"git":"local",path:String((Z==null?void 0:Z.path)||""),repoUrl:String((Z==null?void 0:Z.repoUrl)||""),branch:String((Z==null?void 0:Z.branch)||""),mountPath:String((Z==null?void 0:Z.mountPath)||""),builtin:(Z==null?void 0:Z.builtin)===!0,exists:(Z==null?void 0:Z.exists)!==!1,type:String((Z==null?void 0:Z.type)||"")})).filter(Z=>Z.path),[a]),[C,N]=m.useState(!1),[j,E]=m.useState(""),[P,O]=m.useState(()=>new Set),[B,W]=m.useState(!1),[z,L]=m.useState(""),[R,K]=m.useState("config"),D=xm(t),$=!!D,I=mT(u.displayType),F=m.useMemo(()=>iU(t,I),[t==null?void 0:t.displaySize,t==null?void 0:t.nodeSize,t==null?void 0:t.inputs,t==null?void 0:t.input,I]),_=m.useMemo(()=>({...t,sourceNodeId:e,label:t!=null&&t.label&&t.label!=="Context Run"?t.label:"一键任务",definitionId:I,displaySize:F,nodeSize:F,body:D,inputs:[{type:"text",name:I==="display_image"?"src":"content",value:D,default:D}],outputs:c.length?c:[{type:"node",name:"next",default:""}]}),[t,I,e,D,c,F]),X=Array.isArray((dn=t==null?void 0:t.modelLists)==null?void 0:dn.cursor)?t.modelLists.cursor:[],V=Array.isArray((zt=t==null?void 0:t.modelLists)==null?void 0:zt.opencode)?t.modelLists.opencode:[],T=Array.isArray((at=t==null?void 0:t.modelLists)==null?void 0:at.claudeCode)?t.modelLists.claudeCode:[],ee=Array.isArray((fn=t==null?void 0:t.modelLists)==null?void 0:fn.codex)?t.modelLists.codex:[],ie=m.useMemo(()=>new Set(X.map(ps)),[X]),G=m.useMemo(()=>new Set(V.map(ps)),[V]),se=m.useMemo(()=>new Set(T.map(ps)),[T]),te=m.useMemo(()=>new Set(ee.map(ps)),[ee]),re=u.model,ne=m.useMemo(()=>re?re.startsWith("cursor:")||re.startsWith("opencode:")||re.startsWith("codex:")||re.startsWith("claude-code:")?re:se.has(re)?`claude-code:${re}`:te.has(re)?`codex:${re}`:G.has(re)?`opencode:${re}`:ie.has(re)?`cursor:${re}`:re:"",[se,te,ie,G,re]),ce=re.startsWith("cursor:")?re.slice(7):re.startsWith("opencode:")?re.slice(9):re.startsWith("codex:")?re.slice(6):re.startsWith("claude-code:")?re.slice(12):re,de=ce,me=!!re&&!ie.has(de)&&!G.has(de)&&!se.has(de)&&!te.has(de),He=m.useMemo(()=>new Set(u.skillKeys),[u.skillKeys]),Je=m.useMemo(()=>new Map(y.map(Z=>[Z.key,Z])),[y]),Te=m.useMemo(()=>{const Z=new Set,Ce=v.map(Ye=>{const Pt=$o(Ye,y).map(Nt=>Je.get(Nt)).filter(Boolean);for(const Nt of Pt)Z.add(Nt.key);return{...Ye,skills:Pt}}).filter(Ye=>Ye.skills.length>0),Me=y.filter(Ye=>!Z.has(Ye.key));return{collectionGroups:Ce,ungrouped:Me}},[v,Je,y]);m.useEffect(()=>{O(Z=>{let Ce=!1;const Me=new Set(Z);for(const Ye of Te.collectionGroups)Me.has(Ye.id)||(Me.add(Ye.id),Ce=!0);return Ce?Me:Z})},[Te.collectionGroups]);const ot=m.useMemo(()=>{const Z=j.trim().toLowerCase();if(!Z)return Te;const Ce=Ye=>[Ye==null?void 0:Ye.key,Ye==null?void 0:Ye.name,Ye==null?void 0:Ye.description].map(Pt=>String(Pt||"").toLowerCase()).join(" ").includes(Z);return{collectionGroups:Te.collectionGroups.map(Ye=>{const Pt=[Ye==null?void 0:Ye.id,Ye==null?void 0:Ye.name,Ye==null?void 0:Ye.description].map(Nt=>String(Nt||"").toLowerCase()).join(" ").includes(Z);return{...Ye,skills:Pt?Ye.skills:Ye.skills.filter(Ce)}}).filter(Ye=>Ye.skills.length>0),ungrouped:Te.ungrouped.filter(Ce)}},[Te,j]),gt=uw(C,[ot.collectionGroups.length,ot.ungrouped.length,P.size,u.skillKeys.length,j]),yt=m.useMemo(()=>{const Z=z.trim().toLowerCase();return Z?x.filter(Ce=>[Ce.id,Ce.label,Ce.path,Ce.repoUrl,Ce.branch,Ce.mountPath,Ce.type].join(" ").toLowerCase().includes(Z)):x},[x,z]),Ae=m.useMemo(()=>wT(u.knowledgeContext),[u.knowledgeContext]),dt=m.useMemo(()=>new Set(Ae.map(Z=>Z.id||Z.path||Z.repoPath).filter(Boolean)),[Ae]),St=uw(B,[yt.length,Ae.length,z]);m.useEffect(()=>{u.task!==h.current&&(h.current=u.task,f.current||d(u.task))},[u.task]),m.useEffect(()=>{if(!$){K("config");return}g||K("result")},[$,D,g]),m.useEffect(()=>{var Ce,Me;if(!(R==="result"&&$))return;(Ce=t==null?void 0:t.onEnsureWorkspaceNodeDisplaySize)==null||Ce.call(t,e,F),(Me=t==null?void 0:t.onRefreshNodeInternals)==null||Me.call(t,e);const Z=window.setTimeout(()=>{var Ye;return(Ye=t==null?void 0:t.onRefreshNodeInternals)==null?void 0:Ye.call(t,e)},120);return()=>window.clearTimeout(Z)},[t==null?void 0:t.onEnsureWorkspaceNodeDisplaySize,t==null?void 0:t.onRefreshNodeInternals,I,$,e,D,F,R]);const Wt=Z=>{var Ce;(Ce=t==null?void 0:t.onChangeContextRunConfig)==null||Ce.call(t,e,{...u,task:p,...Z})},Vt=(Z=p)=>{var Me;const Ce=String(Z??"");Ce!==u.task&&(h.current=Ce,(Me=t==null?void 0:t.onChangeContextRunConfig)==null||Me.call(t,e,{...u,task:Ce}))},et=(Z,Ce)=>{const Me=new Set(u.skillKeys);for(const Ye of Z){const Pt=String(Ye||"").trim();Pt&&(Ce?Me.add(Pt):Me.delete(Pt))}Wt({skillKeys:Array.from(Me)})},fe=Z=>{O(Ce=>{const Me=new Set(Ce);return Me.has(Z)?Me.delete(Z):Me.add(Z),Me})},ke=(Z,Ce)=>{const Me=(Z==null?void 0:Z.id)||(Z==null?void 0:Z.path)||"";if(!Me)return;const Ye=x.filter(Pt=>{const Nt=Pt.id||Pt.path||"";return Nt===Me?Ce:dt.has(Nt)});Wt({knowledgeContext:wm(Ye)})},Ve=()=>{Wt({knowledgeContext:null})};return R==="result"&&$?o.jsx(lT,{id:e,data:{..._,selected:t==null?void 0:t.selected,onSelectNodePointerDown:t==null?void 0:t.onSelectNodePointerDown},selected:n,deleteNode:r}):o.jsxs("div",{className:"af-work-context-run-card"+(n?" af-work-context-run-card--selected":"")+(R==="result"&&$?" af-work-context-run-card--result":"")+(g?" af-work-context-run-card--running":"")+((t==null?void 0:t.nodeStatus)==="success"?" af-work-context-run-card--done":"")+((t==null?void 0:t.nodeStatus)==="failed"?" af-work-context-run-card--failed":"")+(k?" af-work-context-run-card--stopped":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[l.map((Z,Ce)=>{if(Z.showOnNode===!1)return null;const Me=`${2.25+Ce*1.75}rem`,Ye=Z.name||`#${Ce+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:Me},children:Ye}),o.jsx(zn,{type:"target",position:$e.Left,id:`input-${Ce}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:Me,background:Sn(Z.type)},title:`${Ye} · ${Z.type}`})]},`in-${Ce}`)}),c.map((Z,Ce)=>{if(Z.showOnNode===!1)return null;const Me=`${2.25+Ce*1.75}rem`,Ye=Z.name||`#${Ce+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:Me},children:Ye}),o.jsx(zn,{type:"source",position:$e.Right,id:`output-${Ce}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:Me,background:Sn(Z.type)},title:`${Ye} · ${Z.type}`})]},`out-${Ce}`)}),o.jsxs("div",{className:"af-work-context-run-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"automation"}),o.jsx("strong",{children:t!=null&&t.label&&t.label!=="Context Run"?t.label:"一键任务"}),o.jsxs("div",{className:"af-work-context-run-card__model-wrap nodrag",onPointerDown:Z=>Z.stopPropagation(),onMouseDown:Z=>Z.stopPropagation(),onClick:Z=>Z.stopPropagation(),children:[o.jsxs("select",{className:"af-work-context-run-card__model",value:ne,disabled:w,"aria-label":"模型",title:ce||"默认模型",onChange:Z=>Wt({model:Z.target.value}),children:[o.jsx("option",{value:"",children:"默认"}),me?o.jsx("option",{value:re,children:re}):null,X.length?o.jsx("optgroup",{label:"Cursor",children:X.map(Z=>o.jsx("option",{value:`cursor:${ps(Z)}`,children:ps(Z)},`context-cursor-${Z}`))}):null,V.length?o.jsx("optgroup",{label:"OpenCode",children:V.map(Z=>o.jsx("option",{value:`opencode:${ps(Z)}`,children:ps(Z)},`context-opencode-${Z}`))}):null,ee.length?o.jsx("optgroup",{label:"Codex",children:ee.map(Z=>o.jsx("option",{value:`codex:${ps(Z)}`,children:ps(Z)},`context-codex-${Z}`))}):null,T.length?o.jsx("optgroup",{label:"Claude Code",children:T.map(Z=>o.jsx("option",{value:`claude-code:${ps(Z)}`,children:ps(Z)},`context-claude-${Z}`))}):null]}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"expand_more"})]}),o.jsx("span",{className:"af-work-context-run-card__kind",children:Ws(t==null?void 0:t.definitionId)?"workspace_one_click_task":(t==null?void 0:t.definitionId)||"workspace_one_click_task"}),$?o.jsxs("div",{className:"af-work-context-run-card__view-switch nodrag",onClick:Z=>Z.stopPropagation(),children:[o.jsx("button",{type:"button",className:R==="config"?"is-active":"",onClick:()=>K("config"),"aria-label":"切换到任务配置",children:o.jsx("span",{className:"material-symbols-outlined",children:"tune"})}),o.jsx("button",{type:"button",className:R==="result"?"is-active":"",onClick:()=>K("result"),"aria-label":"切换到展示结果",children:o.jsx("span",{className:"material-symbols-outlined",children:"preview"})})]}):null,o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",disabled:w,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-context-run-card__body nodrag",children:[o.jsxs(o.Fragment,{children:[o.jsx("textarea",{value:p,disabled:w,placeholder:"输入任务,例如:基于选中的知识库总结需求并生成展示页",onCompositionStart:()=>{f.current=!0},onCompositionEnd:Z=>{f.current=!1,d(Z.currentTarget.value),Vt(Z.currentTarget.value)},onChange:Z=>{d(Z.target.value)},onBlur:Z=>Vt(Z.currentTarget.value)}),o.jsxs("div",{className:"af-work-context-run-card__grid",children:[o.jsxs("div",{className:"af-work-context-run-card__skills",children:[o.jsxs("button",{type:"button",disabled:w,className:"af-work-context-run-card__select",onClick:Z=>{var Ce;Z.stopPropagation(),C||(Ce=t==null?void 0:t.onRefreshSkills)==null||Ce.call(t),N(Me=>!Me)},children:[o.jsx("span",{className:"material-symbols-outlined",children:"extension"}),o.jsx("span",{children:u.skillKeys.length?`${u.skillKeys.length} skills`:"Skills"}),o.jsx("span",{className:"material-symbols-outlined",children:"expand_more"})]}),C?o.jsxs("div",{className:"af-work-context-run-card__skills-menu",onClick:Z=>Z.stopPropagation(),children:[o.jsxs("div",{className:"af-work-load-skills-search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:j,onChange:Z=>E(Z.target.value),placeholder:"搜索 Skills...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Skills"}),j?o.jsx("button",{type:"button",onClick:()=>E(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{ref:gt.menuRef,className:"af-work-load-skills-menu af-work-context-run-card__menu-scroll",onScroll:gt.updateMenuScrollbar,children:[ot.collectionGroups.map(Z=>{const Ce=Z.skills.map(Nt=>Nt.key),Me=Ce.filter(Nt=>He.has(Nt)).length,Ye=Ce.length>0&&Me===Ce.length,Pt=P.has(Z.id);return o.jsxs("section",{className:"af-work-load-skills-menu__group"+(Pt?" af-work-load-skills-menu__group--collapsed":""),children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head",children:[o.jsx("input",{type:"checkbox",checked:Ye,disabled:w,onChange:Nt=>et(Ce,Nt.target.checked),"aria-label":`选择 ${Z.name}`}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-toggle",onClick:()=>fe(Z.id),"aria-expanded":!Pt,children:o.jsxs("span",{className:"af-work-load-skills-menu__group-main",children:[o.jsx("span",{children:Z.name}),Z.description?o.jsx("em",{children:Z.description}):null]})}),o.jsxs("small",{children:[Me,"/",Ce.length]}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-arrow",onClick:()=>fe(Z.id),"aria-label":Pt?`展开 ${Z.name}`:`收起 ${Z.name}`,children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Pt?"chevron_right":"expand_more"})})]}),Pt?null:o.jsx("div",{className:"af-work-load-skills-menu__options",children:Z.skills.map(Nt=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:He.has(Nt.key),disabled:w,onChange:$n=>et([Nt.key],$n.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:Nt.name}),Nt.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:Nt.description}):null]})]},`${Z.id}:${Nt.key}`))})]},Z.id)}),ot.ungrouped.length>0?o.jsxs("section",{className:"af-work-load-skills-menu__group",children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[o.jsx("span",{children:"Ungrouped"}),o.jsx("small",{children:ot.ungrouped.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:ot.ungrouped.map(Z=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:He.has(Z.key),disabled:w,onChange:Ce=>et([Z.key],Ce.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:Z.name}),Z.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:Z.description}):null]})]},`ungrouped:${Z.key}`))})]}):null,ot.collectionGroups.length===0&&ot.ungrouped.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 Skills"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>Wt({skillKeys:[]}),children:"清空"})]}),o.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:o.jsx("span",{style:{height:`${gt.scrollbar.height}%`,top:`${gt.scrollbar.top}%`}})})]}):null]}),o.jsxs("div",{className:"af-work-context-run-card__workspace",children:[o.jsxs("button",{type:"button",disabled:w,className:"af-work-context-run-card__select",onClick:Z=>{var Ce;Z.stopPropagation(),B||(Ce=t==null?void 0:t.onRefreshWorkspaces)==null||Ce.call(t),W(Me=>!Me)},children:[o.jsx("span",{className:"material-symbols-outlined",children:Ae.length?"folder_open":"folder_off"}),o.jsx("span",{children:Ae.length?`${Ae.length} 知识库`:"知识库"}),o.jsx("span",{className:"material-symbols-outlined",children:"expand_more"})]}),B?o.jsxs("div",{className:"af-work-context-run-card__workspace-menu",onClick:Z=>Z.stopPropagation(),children:[o.jsxs("div",{className:"af-work-load-skills-search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:z,onChange:Z=>L(Z.target.value),placeholder:"搜索知识库...",spellCheck:!1,autoComplete:"off","aria-label":"搜索知识库"}),z?o.jsx("button",{type:"button",onClick:()=>L(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{ref:St.menuRef,className:"af-work-load-skills-menu af-work-context-run-card__menu-scroll",onScroll:St.updateMenuScrollbar,children:[o.jsxs("section",{className:"af-work-load-skills-menu__group",children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[o.jsx("span",{children:"知识库"}),o.jsx("small",{children:yt.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:yt.map(Z=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:dt.has(Z.id||Z.path),disabled:w,onChange:Ce=>ke(Z,Ce.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:Z.label}),o.jsxs("span",{className:"af-work-load-skills-menu__option-desc",children:[Z.kind==="git"&&Z.repoUrl?`${Z.repoUrl}${Z.branch?` · ${Z.branch}`:""}${Z.mountPath?` · ${Z.mountPath}`:""}`:Z.path,Z.exists?"":" · 路径未就绪"]})]})]},`${Z.id}:${Z.path}`))})]}),yt.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的知识库"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:Ve,children:"清空知识库"})]}),o.jsx("div",{ref:St.scrollbarTrackRef,className:"af-work-load-skills-scrollbar"+(St.scrollbar.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:St.handleScrollbarPointerDown,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${St.scrollbar.height}%`,top:`${St.scrollbar.top}%`}})})]}):null]}),o.jsxs("select",{value:u.displayType,disabled:w,onChange:Z=>Wt({displayType:Z.target.value}),children:[o.jsx("option",{value:"markdown",children:"Markdown"}),o.jsx("option",{value:"html",children:"HTML"}),o.jsx("option",{value:"react",children:"React"}),o.jsx("option",{value:"table",children:"Table"}),o.jsx("option",{value:"chart",children:"Chart"}),o.jsx("option",{value:"ascii",children:"ASCII"}),o.jsx("option",{value:"mermaid",children:"Mermaid"})]})]}),D?o.jsx("pre",{className:"af-work-context-run-card__preview",children:D.slice(0,520)}):null]}),o.jsxs("div",{className:"af-work-context-run-card__actions",children:[o.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-context-run-card__run nodrag"+(g?" af-work-run-card__button--stop":""),disabled:w,onClick:Z=>{var Ce,Me;Z.stopPropagation(),Vt(),g?(Ce=t==null?void 0:t.onStopWorkspaceNode)==null||Ce.call(t,e):(Me=t==null?void 0:t.onRunWorkspaceNode)==null||Me.call(t,e)},children:[o.jsx("span",{className:"material-symbols-outlined",children:g?"stop_circle":"play_arrow"}),o.jsx("span",{children:g?"Stop":"Run"})]}),o.jsx("button",{type:"button",className:"af-work-run-card__button af-work-context-run-card__logs nodrag",onClick:Z=>{var Ce;Z.stopPropagation(),(Ce=t==null?void 0:t.onOpenWorkspaceRunLogs)==null||Ce.call(t,{nodeId:e,runNodeId:e,scheduleNodeId:"",label:t!=null&&t.label&&t.label!=="Context Run"?t.label:"一键任务"})},children:o.jsx("span",{className:"material-symbols-outlined",children:"article"})})]})]})]})}function CU({id:e,data:t,selected:n,deleteNode:r}){var C,N,j;const s=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],i=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],a=uk((t==null?void 0:t.body)||""),l=(t==null?void 0:t.scheduledRunState)||{},c=((N=(C=t==null?void 0:t.runningRunNodeIds)==null?void 0:C.has)==null?void 0:N.call(C,e))||((j=t==null?void 0:t.runningRunNodeIds)==null?void 0:j[e])===!0||(t==null?void 0:t.isExecuting)||(t==null?void 0:t.nodeStatus)==="running",u=(t==null?void 0:t.optimizingRun)===!0,p=(t==null?void 0:t.nodeStatus)==="stopped",d=!!(t!=null&&t.readOnly),f=E=>{var P;(P=t==null?void 0:t.onChangeScheduledRunConfig)==null||P.call(t,e,{...a,...E})},h=E=>{f({scheduleType:E,cron:au(E,a.time,a.weekday,a.monthDay,a.cron)})},g=E=>{f({time:E,cron:au(a.scheduleType,E,a.weekday,a.monthDay,a.cron)})},[k,w]=ck(a.time).split(":"),y=(E,P)=>{g(`${ko(E,9,0,23)}:${ko(P,0,0,59)}`)},v=E=>{f({weekday:E,cron:au(a.scheduleType,a.time,E,a.monthDay,a.cron)})},x=E=>{f({monthDay:E,cron:au(a.scheduleType,a.time,a.weekday,E,a.cron)})};return o.jsxs("div",{className:"af-work-run-card af-work-schedule-card"+(n?" af-work-run-card--selected":"")+(a.enabled?" af-work-schedule-card--enabled":"")+(c?" af-work-run-card--running":"")+(t!=null&&t.isExecuting?" af-work-run-card--executing":"")+((t==null?void 0:t.nodeStatus)==="success"?" af-work-run-card--done":"")+((t==null?void 0:t.nodeStatus)==="failed"?" af-work-run-card--failed":"")+(p?" af-work-run-card--stopped":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[s.map((E,P)=>{if(E.showOnNode===!1)return null;const O=`${2.25+P*1.75}rem`,B=E.name||`#${P+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:O},children:B}),o.jsx(zn,{type:"target",position:$e.Left,id:`input-${P}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:O,background:Sn(E.type)},title:`${B} · ${E.type}`})]},`in-${P}`)}),i.map((E,P)=>{if(E.showOnNode===!1)return null;const O=`${2.25+P*1.75}rem`,B=E.name||`#${P+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:O},children:B}),o.jsx(zn,{type:"source",position:$e.Right,id:`output-${P}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:O,background:Sn(E.type)},title:`${B} · ${E.type}`})]},`out-${P}`)}),o.jsxs("div",{className:"af-work-run-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"event_repeat"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"Scheduled Run"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"workspace_scheduled_run"}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",disabled:d,onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-schedule-card__body nodrag",children:[o.jsxs("label",{className:"af-work-schedule-card__toggle",children:[o.jsx("input",{type:"checkbox",checked:a.enabled,disabled:d,onChange:E=>f({enabled:E.target.checked})}),o.jsx("span",{children:a.enabled?"定时开启":"定时关闭"})]}),o.jsxs("label",{className:"af-work-schedule-card__field",children:[o.jsx("span",{children:"频率"}),o.jsxs("select",{value:a.scheduleType,disabled:d,onChange:E=>h(E.target.value),children:[o.jsx("option",{value:"daily",children:"每天"}),o.jsx("option",{value:"weekly",children:"每周"}),o.jsx("option",{value:"monthly",children:"每月"}),o.jsx("option",{value:"custom",children:"高级 Cron"})]})]}),a.scheduleType!=="custom"?o.jsxs("label",{className:"af-work-schedule-card__field",children:[o.jsx("span",{children:"时间"}),o.jsxs("div",{className:"af-work-schedule-time-selects",children:[o.jsx("select",{value:k,disabled:d,"aria-label":"小时",onChange:E=>y(E.target.value,w),children:Array.from({length:24},(E,P)=>ko(P,0,0,23)).map(E=>o.jsxs("option",{value:E,children:[E," 时"]},E))}),o.jsx("select",{value:w,disabled:d,"aria-label":"分钟",onChange:E=>y(k,E.target.value),children:Array.from({length:12},(E,P)=>ko(P*5,0,0,59)).map(E=>o.jsxs("option",{value:E,children:[E," 分"]},E))})]})]}):null,a.scheduleType==="weekly"?o.jsxs("label",{className:"af-work-schedule-card__field",children:[o.jsx("span",{children:"星期"}),o.jsxs("select",{value:a.weekday,disabled:d,onChange:E=>v(E.target.value),children:[o.jsx("option",{value:1,children:"周一"}),o.jsx("option",{value:2,children:"周二"}),o.jsx("option",{value:3,children:"周三"}),o.jsx("option",{value:4,children:"周四"}),o.jsx("option",{value:5,children:"周五"}),o.jsx("option",{value:6,children:"周六"}),o.jsx("option",{value:0,children:"周日"})]})]}):null,a.scheduleType==="monthly"?o.jsxs("label",{className:"af-work-schedule-card__field",children:[o.jsx("span",{children:"日期"}),o.jsx("select",{value:a.monthDay,disabled:d,onChange:E=>x(E.target.value),children:Array.from({length:31},(E,P)=>P+1).map(E=>o.jsxs("option",{value:E,children:[E," 日"]},E))})]}):null,a.scheduleType==="custom"?o.jsxs("label",{className:"af-work-schedule-card__field",children:[o.jsx("span",{children:"Cron"}),o.jsx("input",{type:"text",value:a.cron,disabled:d,spellCheck:!1,placeholder:id,onChange:E=>f({cron:E.target.value})})]}):null,o.jsxs("div",{className:"af-work-schedule-card__meta",children:[o.jsxs("span",{children:[qq(a.scheduleType)," ",a.scheduleType==="custom"?"":a.time]}),o.jsxs("span",{children:["Next ",Kq(l.nextAt)]}),o.jsx("span",{children:c?"running":l.lastStatus||"idle"})]}),l.lastError?o.jsx("div",{className:"af-work-schedule-card__error",children:l.lastError}):null,o.jsxs("div",{className:"af-work-schedule-card__actions",children:[o.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-schedule-card__run-now nodrag"+(c?" af-work-run-card__button--stop":""),disabled:d||u,onClick:E=>{var P,O;E.stopPropagation(),c?(P=t==null?void 0:t.onStopWorkspaceNode)==null||P.call(t,e):(O=t==null?void 0:t.onRunWorkspaceNode)==null||O.call(t,e)},children:[o.jsx("span",{className:"material-symbols-outlined",children:c?"stop_circle":"play_arrow"}),o.jsx("span",{children:c?"停止":"立即运行"})]}),o.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-schedule-card__optimize nodrag"+(u?" af-work-schedule-card__optimize--running":""),disabled:d||c||u,title:"为下游节点提前生成 implementation",onClick:E=>{var P;E.stopPropagation(),(P=t==null?void 0:t.onOptimizeWorkspaceSchedule)==null||P.call(t,e)},children:[o.jsx("span",{className:"material-symbols-outlined",children:u?"sync":"auto_fix_high"}),o.jsx("span",{children:u?"优化中":"优化"})]}),o.jsxs("button",{type:"button",className:"af-work-run-card__button af-work-schedule-card__logs nodrag",onClick:E=>{var P;E.stopPropagation(),(P=t==null?void 0:t.onOpenWorkspaceRunLogs)==null||P.call(t,{nodeId:e,scheduleNodeId:e,runNodeId:l.targetRunNodeId||e,lastRunId:l.lastRunId||"",label:(t==null?void 0:t.label)||"Scheduled Run"})},children:[o.jsx("span",{className:"material-symbols-outlined",children:"article"}),o.jsx("span",{children:"日志"})]})]})]})]})}function _U({id:e,data:t,selected:n,deleteNode:r}){const{setNodes:s}=cc(),i=!!(t!=null&&t.readOnly),a=aw(t==null?void 0:t.nodeSize)||{width:Ta,height:Ra},l=m.useCallback(c=>{var u,p;c.button!==0||c.metaKey||c.ctrlKey||c.shiftKey||(p=(u=c.target)==null?void 0:u.closest)!=null&&p.call(u,".af-work-group-node__resize, .af-work-group-node__delete")||s(d=>dT(d,e))},[e,s]);return o.jsxs("div",{className:"af-work-group-node"+(n?" af-work-group-node--selected":""),style:{width:a.width,height:a.height},onPointerDownCapture:l,children:[i?null:o.jsx($b,{className:"af-work-group-node__resize nodrag",minWidth:Ta,minHeight:Ra,position:"bottom-right",children:o.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),o.jsxs("div",{className:"af-work-group-node__title nodrag",children:[o.jsx("span",{children:(t==null?void 0:t.title)||(t==null?void 0:t.label)||"Group"}),o.jsx("button",{type:"button",className:"af-work-group-node__delete",disabled:i,onClick:c=>{c.stopPropagation(),r==null||r(e)},"aria-label":"删除分组",title:"删除分组",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})]})}function EU(e){var g,k,w,y,v,x,C,N,j,E,P,O,B,W,z,L,R,K,D,$,I,F,_,X,V,T,ee,ie;const{setEdges:t,setNodes:n}=cc(),r=(g=e.data)==null?void 0:g.onSyncNodePropDraft,s=!!((k=e.data)!=null&&k.readOnly),[i,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 re,ne,ce;if(s)return;(ne=(re=e.data)==null?void 0:re.onCleanupWorkspaceNodeOutputs)==null||ne.call(re,G,e.data);const se=Ws((ce=e.data)==null?void 0:ce.definitionId)?gT(G):"",te=new Set([G,se].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 se,te;G.button!==0||G.metaKey||G.ctrlKey||G.shiftKey||(te=(se=G.target)==null?void 0:se.closest)!=null&&te.call(se,".react-flow__handle, .af-work-display-resize")||(n(re=>dT(re,e.id)),t(re=>TU(re)))},[e.id,t,n]),p=m.useCallback((G,se)=>{s||(n(te=>te.map(re=>re.id===G?{...re,data:{...re.data,model:se}}:re)),r==null||r(G,{model:se}))},[s,n,r]),d=m.useCallback((G,se)=>{s||(n(te=>te.map(re=>{var ce;if(re.id!==G)return re;const ne=Array.isArray((ce=re.data)==null?void 0:ce.outputs)&&re.data.outputs.length?re.data.outputs.map((de,me)=>me===0?{...de,default:se,value:se}:de):[{type:"bool",name:"value",default:se,value:se}];return{...re,data:{...re.data,body:"",outputs:ne}}})),r==null||r(G,te=>({body:"",outputs:Array.isArray(te==null?void 0:te.outputs)&&te.outputs.length?te.outputs.map((ne,ce)=>ce===0?{...ne,default:se,value:se}:ne):[{type:"bool",name:"value",default:se,value:se}]})))},[s,n,r]),f=m.useCallback((G,se)=>{s||(n(te=>te.map(re=>re.id===G?{...re,data:{...re.data,body:se}}:re)),r==null||r(G,{body:se}))},[s,n,r]),h=m.useCallback((G,se)=>{if(s)return;const te=Xi(se);n(re=>re.map(ne=>ne.id===G?{...ne,data:{...ne.data,images:te}}:ne)),r==null||r(G,{images:te})},[s,n,r]);return(y=e.data)!=null&&y.isWorkspaceGroup?o.jsx(_U,{...e,deleteNode:c}):La((v=e.data)==null?void 0:v.definitionId)?o.jsx(lT,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):((x=e.data)==null?void 0:x.definitionId)==="workspace_run"?o.jsx(NU,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):((C=e.data)==null?void 0:C.definitionId)==="workspace_scheduled_run"?o.jsx(CU,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c}):Ws((N=e.data)==null?void 0:N.definitionId)?o.jsx(jU,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,skills:(j=e.data)==null?void 0:j.skills,skillCollections:(E=e.data)==null?void 0:E.skillCollections,workspaces:(P=e.data)==null?void 0:P.workspaceTargets}):((O=e.data)==null?void 0:O.definitionId)==="control_load_skills"?o.jsx(YU,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,skills:(B=e.data)==null?void 0:B.skills,skillCollections:(W=e.data)==null?void 0:W.skillCollections,onChangeSkillKeys:(z=e.data)==null?void 0:z.onChangeLoadSkillKeys}):((L=e.data)==null?void 0:L.definitionId)==="control_load_mcp"?o.jsx(GU,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,servers:(R=e.data)==null?void 0:R.mcpServers,onChangeMcpNames:(K=e.data)==null?void 0:K.onChangeLoadMcpNames}):((D=e.data)==null?void 0:D.definitionId)==="control_cd_workspace"?o.jsx(JU,{...e,data:{...e.data,onSelectNodePointerDown:u},deleteNode:c,workspaces:($=e.data)==null?void 0:$.workspaceTargets,onChangeWorkspace:(I=e.data)==null?void 0:I.onChangeLoadWorkspace,onRefreshWorkspaces:(F=e.data)==null?void 0:F.onRefreshWorkspaces}):o.jsxs("div",{className:"af-work-flow-node"+(e.selected?" af-work-flow-node--selected":"")+(i?" af-work-flow-node--resizing":"")+((_=e.data)!=null&&_.isExecuting||((X=e.data)==null?void 0:X.nodeStatus)==="running"?" af-work-flow-node--executing":"")+(((V=e.data)==null?void 0:V.nodeStatus)==="success"?" af-work-flow-node--done":"")+(((T=e.data)==null?void 0:T.nodeStatus)==="failed"?" af-work-flow-node--failed":"")+(((ee=e.data)==null?void 0:ee.nodeStatus)==="stopped"?" af-work-flow-node--stopped":""),style:l?{width:l.width,height:l.height}:void 0,onPointerDownCapture:u,children:[s?null:o.jsx($b,{className:"af-work-display-resize af-work-flow-resize nodrag",position:"bottom-right",minWidth:$I,minHeight:gh,maxWidth:LI,maxHeight:OI,onResizeStart:()=>a(!0),onResizeEnd:()=>a(!1),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),o.jsx(qK,{...e,deleteNode:c,modelLists:(ie=e.data)==null?void 0:ie.modelLists,onModelChange:p,onProvideValueChange:d,onNodeBodyChange:f,onNodeImagesChange:h})]})}const AU={[zl]:EU};function dk(e,t=[]){for(const n of e||[])n.type==="file"&&t.push(n),Array.isArray(n.children)&&dk(n.children,t);return t}function cT(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)?cT(r.children,n):null;if(s)return s}return null}function PU(e){const t=String(e||"").replace(/\\/g,"/").replace(/^\/+|\/+$/g,"");return!t||!t.includes("/")?"":t.split("/").slice(0,-1).join("/")}function uT(e,t=[]){for(const n of e||[])n.type==="directory"&&(t.push(n.path),Array.isArray(n.children)&&uT(n.children,t));return t}function Yf(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 IU(e,t){const n=String(t||"");let r=!1;const s=(e||[]).map(i=>{const a=i.id===n;return i.selected===a?i:(r=!0,{...i,selected:a})});return r?s:e}function dT(e,t){const n=String(t||""),r=(e||[]).find(i=>i.id===n),s=(e||[]).reduce((i,a)=>i+(a.selected?1:0),0);return r!=null&&r.selected&&s>1?e:IU(e,n)}function TU(e){let t=!1;const n=(e||[]).map(r=>r.selected?(t=!0,{...r,selected:!1}):r);return t?n:e}function RU(e){return[...e||[]].sort((t,n)=>t.type!==n.type?t.type==="directory"?-1:1:String(t.name||"").localeCompare(String(n.name||"")))}function MU(e,t,n=0){const r=String(t||"").replace(/\\/g,"/").split("/").filter(Boolean);if(r.length===0)return e;const s=(i,a,l)=>{const c=r[a],u=l?`${l}/${c}`:c,p=a===r.length-1;let d=!1;const f=(Array.isArray(i)?i:[]).map(h=>h.name!==c?h:(d=!0,p?{...h,type:"file",name:c,path:u,icon:El(c),size:n}:{...h,type:"directory",name:c,path:u,icon:El(c,!0),children:s(h.children||[],a+1,u)}));return d||f.push(p?{type:"file",name:c,path:u,icon:El(c),size:n}:{type:"directory",name:c,path:u,icon:El(c,!0),children:s([],a+1,u)}),RU(f)};return s(e||[],0,"")}function $U(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 fT({items:e,onOpen:t,selectedPath:n,collapsedDirs:r,onToggleDir:s,onSelect:i,onFileDragStart:a,onDelete:l,onDownload:c}){return o.jsx("ul",{className:"af-work-files",children:(e||[]).map(u=>{var h;const p=u.type==="directory",d=p&&(r==null?void 0:r.has(u.path)),f=n===u.path;return o.jsxs("li",{children:[o.jsxs("div",{className:"af-work-file-row",children:[o.jsxs("button",{type:"button",className:"af-work-file af-work-file--"+u.type+(f?" af-work-file--selected":""),draggable:!p,onDragStart:g=>{p||a==null||a(g,u)},onClick:()=>{i==null||i(u),p&&(s==null||s(u.path))},onDoubleClick:()=>{p||t(u)},title:u.path,children:[p?o.jsx("span",{className:"material-symbols-outlined af-work-file__chevron",children:d?"chevron_right":"expand_more"}):null,o.jsx("span",{className:"material-symbols-outlined",children:u.icon||El(u.name,p)}),o.jsx("span",{children:u.name})]}),f?o.jsxs("div",{className:"af-work-file-actions",children:[p?null:o.jsx("button",{type:"button",className:"af-work-file-action",onClick:g=>{g.stopPropagation(),c==null||c(u)},"aria-label":`下载 ${u.name}`,title:`下载 ${u.path}`,children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"download"})}),o.jsx("button",{type:"button",className:"af-work-file-action af-work-file-action--danger",onClick:g=>{g.stopPropagation(),l==null||l(u)},"aria-label":`删除 ${u.name}`,title:`删除 ${u.path}`,children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"})})]}):null]}),p&&!d&&((h=u.children)!=null&&h.length)?o.jsx(fT,{items:u.children,onOpen:t,selectedPath:n,collapsedDirs:r,onToggleDir:s,onSelect:i,onFileDragStart:a,onDelete:l,onDownload:c}):null]},u.path)})})}function LU({files:e,query:t,onQueryChange:n,onSelect:r,onUpload:s,onClose:i}){const a=m.useMemo(()=>dk(e),[e]),l=String(t||"").trim().toLowerCase(),c=a.filter(u=>l?`${u.path} ${u.name}`.toLowerCase().includes(l):!0);return o.jsx("div",{className:"af-flow-snippet-modal-overlay",onMouseDown:i,children:o.jsxs("div",{className:"af-flow-snippet-modal af-work-file-picker-modal",role:"dialog","aria-modal":"true","aria-label":"选择文件",onMouseDown:u=>u.stopPropagation(),children:[o.jsxs("div",{className:"af-flow-snippet-modal__head",children:[o.jsxs("span",{className:"af-flow-snippet-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined",children:"folder_open"}),"选择文件"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:i,"aria-label":"关闭",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-flow-snippet-modal__body",children:[o.jsxs("div",{className:"af-work-file-picker-modal__tools",children:[o.jsx("input",{value:t,onChange:u=>n(u.target.value),placeholder:"搜索文件路径...",autoFocus:!0}),o.jsxs("button",{type:"button",onClick:()=>s==null?void 0:s(""),children:[o.jsx("span",{className:"material-symbols-outlined",children:"upload_file"}),"上传"]})]}),o.jsxs("div",{className:"af-work-file-picker-modal__list",children:[c.map(u=>o.jsxs("button",{type:"button",className:"af-work-file-picker-modal__item",onClick:()=>r(u),children:[o.jsx("span",{className:"material-symbols-outlined",children:u.icon||El(u.name)}),o.jsxs("span",{className:"af-work-file-picker-modal__main",children:[o.jsx("strong",{children:u.name}),o.jsx("small",{children:u.path})]}),u.size?o.jsx("em",{children:$U(u.size)}):null]},u.path)),c.length===0?o.jsx("div",{className:"af-work-file-picker-modal__empty",children:"没有匹配文件,可先上传或调整搜索词。"}):null]})]})]})})}function r1({messages:e,running:t,showRunningIndicator:n=!0}){const r=e.length>0;return o.jsxs("div",{className:"af-composer-ai-stack af-composer-ai-stack--in-panel af-composer-thread-stack",children:[e.map((s,i)=>{const a=s.kind==="run-log"||s.kind==="run-summary"||s.kind==="activity"||s.kind==="prompt"||s.kind==="raw"||s.kind==="thinking"||s.kind==="result"||s.kind==="assistant"?"reply":s.role==="user"?"user-msg":s.error?"error":"reply",l=s.kind==="run-summary"?"Steps":s.kind==="run-log"?"Run":s.kind==="activity"?"Activity":s.kind==="prompt"?"Prompt":s.kind==="raw"?"Raw Trace":s.kind==="thinking"?"Thinking":s.kind==="result"?"Result":s.kind==="assistant"?"Response":s.role==="user"?"You":s.error?"Error":"Reply";return o.jsxs("section",{className:`af-composer-ai-block af-composer-ai-block--${a}${s.kind?` af-composer-ai-block--kind-${s.kind}`:""}`,children:[o.jsx("div",{className:"af-composer-ai-block-label",children:l}),o.jsx("div",{className:"af-composer-ai-block-body",children:s.text})]},`${i}-${s.role}-${String(s.text||"").slice(0,24)}`)}),n&&t&&!r?o.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--reply af-composer-ai-block--pending",children:[o.jsx("div",{className:"af-composer-ai-block-label",children:"Reply"}),o.jsx("div",{className:"af-composer-ai-block-body",children:"Waiting..."})]}):null,n&&t&&r?o.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--thinking",children:[o.jsx("div",{className:"af-composer-ai-block-label",children:"Thinking"}),o.jsx("div",{className:"af-composer-ai-block-body",children:"Workspace agent is running..."})]}):null]})}function pT(e){const t=String((e==null?void 0:e.kind)||"");return["run-log","run-summary","activity","prompt","raw","thinking"].includes(t)}function OU(e,t=!1){const n=Array.isArray(e)?e:[],r=n.filter(i=>!pT(i));if(r.length>0)return r;const s=[...n].reverse().find(i=>(i==null?void 0:i.kind)==="result"||(i==null?void 0:i.kind)==="assistant"||(i==null?void 0:i.error));return s?[s]:n.length>0||t?[{role:"assistant",kind:"assistant",text:t?"正在执行,可以在完成后继续追问或要求调整。":"运行已完成。可以在下方继续追问、要求总结或调整结果。",at:0}]:[]}function DU(e){return(Array.isArray(e)?e:[]).filter(pT)}function ld(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 FU(e){const t=ld((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 ld((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function zU(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 ld((n==null?void 0:n.default)||(n==null?void 0:n.value)||"")}function hT(e,t,n=1){const r=(Array.isArray(e)?e:[]).map(i=>String(i||"").trim()).filter(Boolean);return r.length?{head:r.slice(0,n).join("、"),extra:r.length>n?`等 ${r.length} 个`:"",title:r.join(", ")}:{head:t,extra:"",title:""}}function s1(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function Oo(e,t,n=""){const r=(Array.isArray(e)?e:[]).find(i=>(i==null?void 0:i.name)===t);return String((r==null?void 0:r.value)??(r==null?void 0:r.default)??"").trim()||n}function jh(e,t){const n=Oo(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 Ed(e){const t=String(e||"").trim().toLowerCase();return["markdown","html","react","table","chart","ascii","mermaid"].includes(t)?t:"markdown"}function ps(e){const t=String(e||""),n=t.indexOf(" - ");return n>=0?t.slice(0,n).trim():t.trim()}function mT(e){const t=Ed(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 gT(e){return`${String(e||"context_run").trim()||"context_run"}__display`}function yT(e){return e==="display_image"?"src":"content"}function i1(e,t,n){const r=yT(t),s=lu(e);let i=!1;const a=s.map(l=>(l==null?void 0:l.name)===r?(i=!0,{...l,default:n,value:n,showOnNode:l.showOnNode!==!1}):(l==null?void 0:l.name)==="filePath"?{...l,default:"",value:""}:l);return i||a.push({type:"text",name:r,default:n,value:n,required:!0,showOnNode:!0}),a}function o1(e,t,n=[],r=[]){const s=Array.isArray(e)?e:[],i=new Set((Array.isArray(n)?n:[]).map(u=>String(u||"").trim()).filter(Boolean)),a=new Set((Array.isArray(r)?r:[]).map(u=>String(u||"").trim()).filter(Boolean)),l=u=>(u==null?void 0:u.showOnNode)!==!1;let c=s.findIndex(u=>l(u)&&i.has(String((u==null?void 0:u.name)||"").trim()));return c<0&&(c=s.findIndex(u=>i.has(String((u==null?void 0:u.name)||"").trim()))),c<0&&(c=s.findIndex(u=>l(u)&&a.has(String((u==null?void 0:u.type)||"").trim()))),c<0&&(c=s.findIndex(u=>l(u))),c<0&&(c=0),`${t}-${c}`}function a1(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 xm(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 BU(e){const t=Array.isArray(e==null?void 0:e.inputs)?e.inputs:[],n=Oo(t,"includeWorkspaceContext","true").toLowerCase(),r=jh(t,"knowledgeContext"),s=jh(t,"workspaceContext");return{task:String((e==null?void 0:e.body)||""),skillKeys:zU(e),includeWorkspaceContext:n!=="false"&&n!=="0"&&n!=="off",knowledgeContext:r||(s?wm([s]):null),workspaceContext:s,displayType:Ed(Oo(t,"displayType","markdown")),model:String((e==null?void 0:e.model)||"").trim()}}function Ws(e){const t=String(e||"");return t==="workspace_one_click_task"||t==="workspace_context_run"}function HU(e){const t=ld((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 ld((r==null?void 0:r.default)||(r==null?void 0:r.value)||"")}function WU(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function xT(e={},t="context"){const n=String((e==null?void 0:e.cwd)||(e==null?void 0:e.workspaceRoot)||(e==null?void 0:e.path)||"").trim(),r=String((e==null?void 0:e.id)||"").trim(),s=String((e==null?void 0:e.label)||(e==null?void 0:e.name)||"").trim();if(!n&&!r&&!s)return null;const i=String(s||r||"知识库").trim();return{id:r,label:i,kind:(e==null?void 0:e.kind)==="git"?"git":"local",type:String((e==null?void 0:e.type)||""),repoPath:n,path:n,mountPath:String((e==null?void 0:e.mountPath)||r||i).trim(),repoUrl:String((e==null?void 0:e.repoUrl)||"").trim(),branch:String((e==null?void 0:e.branch)||"").trim(),readonly:!0,role:t}}function wm(e=[]){const t=(Array.isArray(e)?e:[e]).map((n,r)=>xT(n,r===0?"primary":"context")).filter(Boolean);return t.length?{version:1,sources:t}:null}function wT(e){return(e&&typeof e=="object"&&Array.isArray(e.sources)?e.sources:[]).map(n=>xT(n,(n==null?void 0:n.role)||"context")).filter(Boolean)}function VU(e){const t=Array.isArray(e==null?void 0:e.inputs)?e.inputs:[],n=jh(t,"knowledgeContext"),r=jh(t,"workspaceContext");return{sources:wT(n||(r?wm([r]):null)),path:Oo(t,"path",""),label:Oo(t,"label","")}}function l1(e){var r,s,i,a,l,c,u,p,d;if(!e)return null;const{inputs:t,outputs:n}=i7(e);return{id:e.id,newId:e.id,label:String(((r=e.data)==null?void 0:r.label)??e.id),role:String(((s=e.data)==null?void 0:s.role)??"normal"),model:String(((i=e.data)==null?void 0:i.model)??""),body:String(((a=e.data)==null?void 0:a.body)??""),images:Xi((l=e.data)==null?void 0:l.images),script:String(((c=e.data)==null?void 0:c.script)??""),scriptRef:String(((u=e.data)==null?void 0:u.scriptRef)??""),implementationRef:String(((p=e.data)==null?void 0:p.implementationRef)??""),implementationMode:String(((d=e.data)==null?void 0:d.implementationMode)??""),inputs:t,outputs:n}}function c1(e,t,n,r=""){var c,u;const s=String(n||"").trim(),i=(Array.isArray(e)?e:[]).find(p=>String((p==null?void 0:p.id)||"")===s),a=String(((c=i==null?void 0:i.data)==null?void 0:c.model)||"").trim();if(a&&a!=="default")return a;const l=String(((u=t==null?void 0:t[s])==null?void 0:u.model)||"").trim();return l&&l!=="default"?l:String(r||"").trim()}function u1(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 KU(e,t,n){var p,d;const r=String(((p=e==null?void 0:e.data)==null?void 0:p.definitionId)??n),s=r.startsWith("provide_"),i=String((t==null?void 0:t.role)||"").trim(),a=rd.includes(i)?i:"normal",l=String((t==null?void 0:t.model)||"").trim(),c={...e.data,label:String((t==null?void 0:t.label)||"").trim()||n,role:a,model:l===""||l==="default"?void 0:l,body:s?"":String((t==null?void 0:t.body)??""),images:s?[]:Xi(t==null?void 0:t.images),inputs:u1(t==null?void 0:t.inputs),outputs:s&&Array.isArray((d=e.data)==null?void 0:d.outputs)?e.data.outputs:u1(t==null?void 0:t.outputs)},u=String((t==null?void 0:t.script)??"").trim();r==="tool_nodejs"||u!==""?c.script=String((t==null?void 0:t.script)??""):delete c.script;for(const f of["scriptRef","implementationRef","implementationMode"]){const h=String((t==null?void 0:t[f])??"").trim();h?c[f]=h:delete c[f]}return c}function d1({nodes:e,edges:t,instances:n,selectedNode:r,draft:s,allowRename:i=!1}){if(!s||!r)return{ok:!1,error:""};const a=r.id,l=String(s.newId||"").trim(),c=i?l:a;if(i){if(!E7.test(c))return{ok:!1,error:"Invalid instance id"};if(e.some(k=>k.id===c&&k.id!==a))return{ok:!1,error:"Duplicate instance id"}}const u=KU(r,s,c),p=r.data||{};if(!(c!==a||p.label!==u.label||p.role!==u.role||p.model!==u.model||p.body!==u.body||JSON.stringify(Xi(p.images))!==JSON.stringify(u.images)||(p.script??void 0)!==(u.script??void 0)||(p.scriptRef??void 0)!==(u.scriptRef??void 0)||(p.implementationRef??void 0)!==(u.implementationRef??void 0)||(p.implementationMode??void 0)!==(u.implementationMode??void 0)||JSON.stringify(p.inputs||[])!==JSON.stringify(u.inputs||[])||JSON.stringify(p.outputs||[])!==JSON.stringify(u.outputs||[])))return{ok:!0,changed:!1,nextId:c,nodes:e,edges:t,instances:n};const f=e.map(k=>k.id===a?{...k,id:c,selected:!0,data:u}:k);let h=t,g=n;if(c!==a){g={...n||{}};const k={...g[a]||{}};delete g[a],g[c]=k,h=t.map((w,y)=>({...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}-${y}`}))}return{ok:!0,changed:!0,nextId:c,nodes:f,edges:h,instances:g}}function qU(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function UU(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"])qU(e[s],t[s])&&(r[s]=n[s]);return r}function uw(e,t=[]){const n=m.useRef(null),r=m.useRef(null),[s,i]=m.useState({visible:!1,top:0,height:100}),a=m.useCallback(()=>{const p=n.current;if(!p)return;const d=Math.max(1,p.scrollHeight),f=Math.max(1,p.clientHeight),h=d>f+1,g=h?Math.max(12,f/d*100):100,k=Math.max(0,100-g),w=h?Math.min(k,p.scrollTop/Math.max(1,d-f)*k):0;i({visible:h,top:w,height:g})},[]);m.useEffect(()=>{if(!e)return;const p=requestAnimationFrame(a);return()=>cancelAnimationFrame(p)},[e,a,...t]);const l=m.useCallback(p=>{const d=n.current;if(!d)return;const f=Math.max(0,d.scrollHeight-d.clientHeight);d.scrollTop=Math.min(1,Math.max(0,p))*f,a()},[a]),c=m.useCallback((p,d=0)=>{const f=r.current;if(!f)return 0;const h=f.getBoundingClientRect(),g=s.height/100*h.height,k=Math.max(1,h.height-g);return(p-h.top-d)/k},[s.height]),u=m.useCallback(p=>{var C,N;if(!s.visible)return;p.preventDefault(),p.stopPropagation();const d=r.current;if(!d)return;const f=d.getBoundingClientRect(),h=s.top/100*f.height,g=s.height/100*f.height,w=p.clientY>=f.top+h&&p.clientY<=f.top+h+g?p.clientY-f.top-h:g/2;l(c(p.clientY,w));const y=p.pointerId;(N=(C=p.currentTarget).setPointerCapture)==null||N.call(C,y);const v=j=>{j.preventDefault(),l(c(j.clientY,w))},x=()=>{window.removeEventListener("pointermove",v),window.removeEventListener("pointerup",x),window.removeEventListener("pointercancel",x)};window.addEventListener("pointermove",v),window.addEventListener("pointerup",x),window.addEventListener("pointercancel",x)},[c,l,s.height,s.top,s.visible]);return{menuRef:n,scrollbarTrackRef:r,scrollbar:s,updateMenuScrollbar:a,handleScrollbarPointerDown:u}}function YU({id:e,data:t,selected:n,deleteNode:r,skills:s,skillCollections:i,onChangeSkillKeys:a}){const l=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],c=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],u=Array.isArray(s)?s:[],p=Array.isArray(i)?i:[],[d,f]=m.useState(!1),[h,g]=m.useState(""),[k,w]=m.useState(()=>new Set),y=m.useRef(null),v=m.useRef(null),[x,C]=m.useState({visible:!1,top:0,height:100}),N=m.useMemo(()=>new Set(FU(t)),[t]),j=m.useMemo(()=>new Map(u.map($=>[$.key,$])),[u]),E=m.useMemo(()=>Array.from(N).map($=>{var I;return((I=j.get($))==null?void 0:I.name)||$}),[j,N]),P=m.useMemo(()=>hT(E,"选择 Skills"),[E]),O=m.useMemo(()=>{const $=new Set,I=p.map(_=>{const X=$o(_,u).map(V=>j.get(V)).filter(Boolean);for(const V of X)$.add(V.key);return{..._,skills:X}}).filter(_=>_.skills.length>0),F=u.filter(_=>!$.has(_.key));return{collectionGroups:I,ungrouped:F}},[j,p,u]);m.useEffect(()=>{w($=>{let I=!1;const F=new Set($);for(const _ of O.collectionGroups)F.has(_.id)||(F.add(_.id),I=!0);return I?F:$})},[O.collectionGroups]);const B=m.useMemo(()=>{const $=h.trim().toLowerCase();if(!$)return O;const I=_=>[_==null?void 0:_.key,_==null?void 0:_.name,_==null?void 0:_.description].map(V=>String(V||"").toLowerCase()).join(" ").includes($);return{collectionGroups:O.collectionGroups.map(_=>{const V=[_==null?void 0:_.id,_==null?void 0:_.name,_==null?void 0:_.description].map(T=>String(T||"").toLowerCase()).join(" ").includes($)?_.skills:_.skills.filter(I);return{..._,skills:V}}).filter(_=>_.skills.length>0),ungrouped:O.ungrouped.filter(I)}},[O,h]),W=m.useCallback(($,I)=>{const F=new Set(N);for(const _ of $)I?F.add(_):F.delete(_);a==null||a(e,Array.from(F))},[e,N,a]),z=m.useCallback($=>{w(I=>{const F=new Set(I);return F.has($)?F.delete($):F.add($),F})},[]),L=m.useCallback(()=>{const $=y.current;if(!$)return;const I=Math.max(1,$.scrollHeight),F=Math.max(1,$.clientHeight),_=I>F+1,X=_?Math.max(12,F/I*100):100,V=Math.max(0,100-X),T=_?Math.min(V,$.scrollTop/Math.max(1,I-F)*V):0;C({visible:_,top:T,height:X})},[]);m.useEffect(()=>{if(!d)return;const $=requestAnimationFrame(L);return()=>cancelAnimationFrame($)},[k,B,N.size,d,L]);const R=m.useCallback($=>{const I=y.current;if(!I)return;const F=Math.max(0,I.scrollHeight-I.clientHeight);I.scrollTop=Math.min(1,Math.max(0,$))*F,L()},[L]),K=m.useCallback(($,I=0)=>{const F=v.current;if(!F)return 0;const _=F.getBoundingClientRect(),X=x.height/100*_.height,V=Math.max(1,_.height-X);return($-_.top-I)/V},[x.height]),D=m.useCallback($=>{var se,te;if(!x.visible)return;$.preventDefault(),$.stopPropagation();const I=v.current;if(!I)return;const F=I.getBoundingClientRect(),_=x.top/100*F.height,X=x.height/100*F.height,T=$.clientY>=F.top+_&&$.clientY<=F.top+_+X?$.clientY-F.top-_:X/2;R(K($.clientY,T));const ee=$.pointerId;(te=(se=$.currentTarget).setPointerCapture)==null||te.call(se,ee);const ie=re=>{re.preventDefault(),R(K(re.clientY,T))},G=()=>{window.removeEventListener("pointermove",ie),window.removeEventListener("pointerup",G),window.removeEventListener("pointercancel",G)};window.addEventListener("pointermove",ie),window.addEventListener("pointerup",G),window.addEventListener("pointercancel",G)},[K,R,x.height,x.top,x.visible]);return o.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":"")+(d?" af-work-load-skills-card--menu-open":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[l.map(($,I)=>{if($.showOnNode===!1)return null;const F=`${2.6+I*1.7}rem`,_=$.name||`#${I+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:F},children:_}),o.jsx(zn,{type:"target",position:$e.Left,id:`input-${I}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:F,background:Sn($.type)},title:`${_} · ${$.type}`})]},`in-${I}`)}),c.map(($,I)=>{if($.showOnNode===!1)return null;const F=`${2.6+I*1.7}rem`,_=$.name||`#${I+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:F},children:_}),o.jsx(zn,{type:"source",position:$e.Right,id:`output-${I}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:F,background:Sn($.type)},title:`${_} · ${$.type}`})]},`out-${I}`)}),o.jsxs("div",{className:"af-work-load-skills-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"extension"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"Load Skills"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"control_load_skills"}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-load-skills-card__body nodrag",children:[o.jsxs("button",{type:"button",className:"af-work-load-skills-card__select",onClick:$=>{var I;$.stopPropagation(),d||(I=t==null?void 0:t.onRefreshSkills)==null||I.call(t),f(F=>!F)},children:[o.jsxs("span",{className:"af-work-load-skills-card__summary",title:P.title,children:[o.jsx("span",{className:"af-work-load-skills-card__summary-main",children:P.head}),P.extra?o.jsx("span",{className:"af-work-load-skills-card__summary-extra",children:P.extra}):null]}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:d?"expand_less":"expand_more"})]}),d?o.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick:$=>$.stopPropagation(),children:[o.jsxs("div",{className:"af-work-load-skills-search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:h,onChange:$=>g($.target.value),placeholder:"搜索 Skills...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 Skills"}),h?o.jsx("button",{type:"button",onClick:()=>g(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{ref:y,className:"af-work-load-skills-menu",onScroll:L,children:[B.collectionGroups.map($=>{const I=$.skills.map(V=>V.key),F=I.filter(V=>N.has(V)).length,_=I.length>0&&F===I.length,X=k.has($.id);return o.jsxs("section",{className:"af-work-load-skills-menu__group"+(X?" af-work-load-skills-menu__group--collapsed":""),children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head",children:[o.jsx("input",{type:"checkbox",checked:_,onChange:V=>W(I,V.target.checked),"aria-label":`选择 ${$.name}`}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-toggle",onClick:()=>z($.id),"aria-expanded":!X,children:o.jsxs("span",{className:"af-work-load-skills-menu__group-main",children:[o.jsx("span",{children:$.name}),$.description?o.jsx("em",{children:$.description}):null]})}),o.jsxs("small",{children:[F,"/",I.length]}),o.jsx("button",{type:"button",className:"af-work-load-skills-menu__group-arrow",onClick:()=>z($.id),"aria-label":X?`展开 ${$.name}`:`收起 ${$.name}`,children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:X?"chevron_right":"expand_more"})})]}),X?null:o.jsx("div",{className:"af-work-load-skills-menu__options",children:$.skills.map(V=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:N.has(V.key),onChange:T=>W([V.key],T.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:V.name}),V.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:V.description}):null]})]},`${$.id}:${V.key}`))})]},$.id)}),B.ungrouped.length>0?o.jsxs("section",{className:"af-work-load-skills-menu__group",children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[o.jsx("span",{children:"Ungrouped"}),o.jsx("small",{children:B.ungrouped.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:B.ungrouped.map($=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:N.has($.key),onChange:I=>W([$.key],I.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:$.name}),$.description?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:$.description}):null]})]},`ungrouped:${$.key}`))})]}):null,B.collectionGroups.length===0&&B.ungrouped.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 Skills"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>a==null?void 0:a(e,[]),children:"清空"})]}),o.jsx("div",{ref:v,className:"af-work-load-skills-scrollbar"+(x.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:D,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${x.height}%`,top:`${x.top}%`}})})]}):null]})]})}function GU({id:e,data:t,selected:n,deleteNode:r,servers:s=[],onChangeMcpNames:i}){const a=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],l=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],[c,u]=m.useState(!1),[p,d]=m.useState(""),f=m.useMemo(()=>new Set(HU(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]),g=m.useMemo(()=>{const w=p.trim().toLowerCase();return w?h.filter(y=>[y.name,y.description,y.detail,y.type].join(" ").toLowerCase().includes(w)):h},[p,h]),k=m.useCallback((w,y)=>{const v=new Set(f);for(const x of w)y?v.add(x):v.delete(x);i==null||i(e,Array.from(v))},[e,f,i]);return o.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,y)=>{if(w.showOnNode===!1)return null;const v=`${2.6+y*1.7}rem`,x=w.name||`#${y+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:v},children:x}),o.jsx(zn,{type:"target",position:$e.Left,id:`input-${y}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:v,background:Sn(w.type)},title:`${x} · ${w.type}`})]},`in-${y}`)}),l.map((w,y)=>{if(w.showOnNode===!1)return null;const v=`${2.6+y*1.7}rem`,x=w.name||`#${y+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:v},children:x}),o.jsx(zn,{type:"source",position:$e.Right,id:`output-${y}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:v,background:Sn(w.type)},title:`${x} · ${w.type}`})]},`out-${y}`)}),o.jsxs("div",{className:"af-work-load-skills-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"hub"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"Load MCP"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"control_load_mcp"}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-load-skills-card__body nodrag",children:[o.jsxs("button",{type:"button",className:"af-work-load-skills-card__select",onClick:w=>{var y;w.stopPropagation(),c||(y=t==null?void 0:t.onRefreshMcps)==null||y.call(t),u(v=>!v)},children:[o.jsx("span",{children:f.size>0?`${f.size} MCP selected`:"选择 MCP"}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:c?"expand_less":"expand_more"})]}),c?o.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick:w=>w.stopPropagation(),children:[o.jsxs("div",{className:"af-work-load-skills-search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:p,onChange:w=>d(w.target.value),placeholder:"搜索 MCP...",spellCheck:!1,autoComplete:"off","aria-label":"搜索 MCP"}),p?o.jsx("button",{type:"button",onClick:()=>d(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{className:"af-work-load-skills-menu",children:[o.jsxs("section",{className:"af-work-load-skills-menu__group",children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[o.jsx("span",{children:"MCP Servers"}),o.jsx("small",{children:g.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:g.map(w=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:f.has(w.name),onChange:y=>k([w.name],y.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:w.name}),w.description||w.detail?o.jsx("span",{className:"af-work-load-skills-menu__option-desc",children:w.description||w.detail}):null]})]},w.name))})]}),g.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的 MCP"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>i==null?void 0:i(e,[]),children:"清空"})]})]}):null]})]})}function JU({id:e,data:t,selected:n,deleteNode:r,workspaces:s=[],onChangeWorkspace:i,onRefreshWorkspaces:a}){const l=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],c=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],[u,p]=m.useState(!1),[d,f]=m.useState(""),h=VU(t),g=m.useMemo(()=>(Array.isArray(s)?s:[]).map(N=>({id:String((N==null?void 0:N.id)||""),label:String((N==null?void 0:N.label)||(N==null?void 0:N.name)||"知识库"),kind:(N==null?void 0:N.kind)==="git"?"git":"local",path:String((N==null?void 0:N.path)||""),repoUrl:String((N==null?void 0:N.repoUrl)||""),branch:String((N==null?void 0:N.branch)||""),mountPath:String((N==null?void 0:N.mountPath)||""),builtin:(N==null?void 0:N.builtin)===!0,exists:(N==null?void 0:N.exists)!==!1})).filter(N=>N.path),[s]),k=m.useMemo(()=>{const N=d.trim().toLowerCase();return N?g.filter(j=>[j.id,j.label,j.path,j.repoUrl,j.branch,j.mountPath].join(" ").toLowerCase().includes(N)):g},[d,g]),w=m.useMemo(()=>new Set((h.sources||[]).map(N=>N.id||N.path||N.repoPath).filter(Boolean)),[h.sources]),y=m.useMemo(()=>(h.sources||[]).map(N=>N.label||N.id||N.mountPath||N.path),[h.sources]),v=m.useMemo(()=>hT(y,"选择知识库"),[y]),x=uw(u,[k.length,y.length,d]),C=(N,j)=>{const E=(N==null?void 0:N.id)||(N==null?void 0:N.path)||"",P=g.filter(O=>{const B=O.id||O.path||"";return B===E?j:w.has(B)});i==null||i(e,P)};return o.jsxs("div",{className:"af-work-load-skills-card af-work-load-workspace-card"+(n?" af-work-load-skills-card--selected":"")+(u?" af-work-load-skills-card--menu-open":""),onPointerDownCapture:t==null?void 0:t.onSelectNodePointerDown,children:[l.map((N,j)=>{if(N.showOnNode===!1)return null;const E=`${2.6+j*1.7}rem`,P=N.name||`#${j+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:E},children:P}),o.jsx(zn,{type:"target",position:$e.Left,id:`input-${j}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:E,background:Sn(N.type)},title:`${P} · ${N.type}`})]},`in-${j}`)}),c.map((N,j)=>{if(N.showOnNode===!1)return null;const E=`${2.6+j*1.7}rem`,P=N.name||`#${j+1}`;return o.jsxs(m.Fragment,{children:[o.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:E},children:P}),o.jsx(zn,{type:"source",position:$e.Right,id:`output-${j}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:E,background:Sn(N.type)},title:`${P} · ${N.type}`})]},`out-${j}`)}),o.jsxs("div",{className:"af-work-load-skills-card__head",children:[o.jsx("span",{className:"material-symbols-outlined",children:"folder_managed"}),o.jsx("strong",{children:(t==null?void 0:t.label)||"加载知识库"}),o.jsx("span",{children:(t==null?void 0:t.definitionId)||"control_cd_workspace"}),o.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-work-load-skills-card__body nodrag",children:[o.jsxs("button",{type:"button",className:"af-work-load-skills-card__select",onClick:N=>{N.stopPropagation(),u||a==null||a(),p(j=>!j)},children:[o.jsxs("span",{className:"af-work-load-skills-card__summary",title:v.title,children:[o.jsx("span",{className:"af-work-load-skills-card__summary-main",children:v.head}),v.extra?o.jsx("span",{className:"af-work-load-skills-card__summary-extra",children:v.extra}):null]}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:u?"expand_less":"expand_more"})]}),u?o.jsxs("div",{className:"af-work-load-skills-menu-shell",onClick:N=>N.stopPropagation(),children:[o.jsxs("div",{className:"af-work-load-skills-search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:d,onChange:N=>f(N.target.value),placeholder:"搜索知识库...",spellCheck:!1,autoComplete:"off","aria-label":"搜索知识库"}),d?o.jsx("button",{type:"button",onClick:()=>f(""),"aria-label":"清空搜索",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),o.jsxs("div",{ref:x.menuRef,className:"af-work-load-skills-menu",onScroll:x.updateMenuScrollbar,children:[o.jsxs("section",{className:"af-work-load-skills-menu__group",children:[o.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[o.jsx("span",{children:"知识库"}),o.jsx("small",{children:k.length})]}),o.jsx("div",{className:"af-work-load-skills-menu__options",children:k.map(N=>o.jsxs("label",{className:"af-work-load-skills-menu__option",children:[o.jsx("input",{type:"checkbox",checked:w.has(N.id||N.path),onChange:j=>C(N,j.target.checked)}),o.jsxs("span",{className:"af-work-load-skills-menu__option-main",children:[o.jsx("span",{className:"af-work-load-skills-menu__option-title",children:N.label}),o.jsxs("span",{className:"af-work-load-skills-menu__option-desc",children:[N.kind==="git"&&N.repoUrl?`${N.repoUrl}${N.branch?` · ${N.branch}`:""}${N.mountPath?` · ${N.mountPath}`:""}`:N.path,N.exists?"":" · 路径未就绪"]})]})]},`${N.id}:${N.path}`))})]}),k.length===0?o.jsx("div",{className:"af-work-load-skills-menu__empty",children:"没有匹配的知识库"}):null,o.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>i==null?void 0:i(e,[]),children:"清空知识库"})]}),o.jsx("div",{ref:x.scrollbarTrackRef,className:"af-work-load-skills-scrollbar"+(x.scrollbar.visible?" af-work-load-skills-scrollbar--visible":""),onPointerDown:x.handleScrollbarPointerDown,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${x.scrollbar.height}%`,top:`${x.scrollbar.top}%`}})})]}):null]})]})}function XU({projectId:e,tapdId:t,setTapdId:n,snapshot:r,loading:s,error:i,actionRunning:a,actionOutput:l,pendingConfirm:c,conflict:u,reviewPublishing:p,onRefresh:d,onRunDryRun:f,onConfirmAction:h,onRetryConflict:g,onPublishReview:k}){const[w,y]=m.useState("all"),[v,x]=m.useState("all"),C=String((r==null?void 0:r.phase)||(t?"unavailable":"unselected")),N=Array.isArray(r==null?void 0:r.issues)?r.issues:[],j=Sq(r),E=j.reduce((T,ee)=>T+ee.issues.reduce((ie,G)=>ie+1+(Array.isArray(G.children)?G.children.length:0),0),0),P=Array.isArray(r==null?void 0:r.artifacts)?r.artifacts:[];Array.isArray(r==null?void 0:r.optionalGaps)&&r.optionalGaps;const O=r!=null&&r.nextAction&&typeof r.nextAction=="object"?r.nextAction:null,B=_q(r,O),W=wq(r,B),z=P.filter(T=>!WI({...T,href:xh(T)})),L=m.useMemo(()=>gq(B),[B]);m.useEffect(()=>{v!=="all"&&(L.some(T=>T.key===v)||x("all"))},[v,L]);const R=B.filter(T=>yq(T,v)),K=hq(R),D=Eq(r),$=D.filter(T=>Aq(T,w)),I=R.filter(T=>ok(T)).length,F=r!=null&&r.collaboration&&typeof r.collaboration=="object"?r.collaboration:{},_=F.activeAction&&typeof F.activeAction=="object"?F.activeAction:null;Array.isArray(r==null?void 0:r.clientObservations)&&r.clientObservations;const X=String((r==null?void 0:r.rawOutput)||""),V=oq(C);return o.jsxs("main",{className:"af-prd-workflow af-prd-workflow--timeline","aria-label":"PRD Workflow",children:[o.jsxs("section",{className:"af-prd-workflow__statusbar",children:[o.jsxs("div",{className:"af-prd-workflow__status-main",children:[o.jsx("span",{className:`af-prd-workflow-phase af-prd-workflow-phase--${C.toLowerCase().replace(/[^a-z0-9_-]+/gi,"_")}`,children:Fj(C)}),o.jsx("h1",{children:(r==null?void 0:r.pointer)||(t?"等待 prd-flow 返回状态":"绑定 TAPD 需求后读取状态")}),o.jsxs("p",{className:"af-prd-workflow__status-subtitle",children:["Project ",o.jsx("strong",{children:e||"Workspace"}),t?o.jsxs(o.Fragment,{children:[" · TAPD ",o.jsx("strong",{children:t})]}):o.jsx(o.Fragment,{children:" · 未绑定 TAPD"})]}),i?o.jsx("p",{className:"af-prd-workflow-error",children:i}):null,_||F.subscribers?o.jsxs("div",{className:"af-prd-workflow-collab",children:[_?o.jsxs("span",{children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"lock"}),_.title||_.action||"Workflow action"," 执行中",_.userId?o.jsx("small",{children:_.userId}):null]}):null,F.subscribers?o.jsxs("span",{children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"group"}),F.subscribers," 个连接"]}):null]}):null]}),o.jsxs("form",{className:"af-prd-workflow__lookup",onSubmit:T=>{T.preventDefault(),d==null||d()},children:[o.jsx("div",{className:"af-prd-workflow-flow","aria-label":"需求流程阶段",children:V.map(T=>o.jsxs("div",{className:`af-prd-workflow-flow__step af-prd-workflow-flow__step--${T.status}`,children:[o.jsx("span",{"aria-hidden":"true"}),o.jsx("small",{children:T.label})]},T.label))}),o.jsxs("div",{className:"af-prd-workflow__lookup-row",children:[o.jsxs("label",{children:[o.jsx("span",{children:"Project 绑定 TAPD"}),o.jsx("input",{value:t,onChange:T=>n(T.target.value),placeholder:"输入需求 ID",autoComplete:"off",spellCheck:!1})]}),o.jsxs("button",{type:"submit",disabled:s,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:s?"hourglass_empty":"sync"}),s?"读取中":t?"刷新":"绑定"]})]})]})]}),u?o.jsxs("section",{className:"af-prd-workflow-conflict","aria-label":"Workflow conflict",children:[o.jsxs("div",{children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"sync_problem"}),o.jsxs("div",{children:[o.jsx("strong",{children:"状态已变化,需要重新确认"}),o.jsx("p",{children:u.message||"当前 workflow 状态和执行前不一致。"})]})]}),o.jsxs("dl",{children:[o.jsxs("div",{children:[o.jsx("dt",{children:"执行时 revision"}),o.jsx("dd",{children:u.expectedRevision||"空"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"当前 revision"}),o.jsx("dd",{children:u.currentRevision||"未知"})]}),o.jsxs("div",{children:[o.jsx("dt",{children:"当前状态"}),o.jsx("dd",{children:[Fj(u.currentPhase),u.currentPointer].filter(Boolean).join(" · ")||"未知"})]})]}),o.jsx("div",{className:"af-prd-workflow-conflict__actions",children:o.jsx("button",{type:"button",onClick:()=>d==null?void 0:d(),disabled:s||a,children:"刷新状态"})})]}):null,o.jsxs("section",{className:"af-prd-workflow__main",children:[o.jsxs("article",{className:"af-prd-workflow-actions","aria-label":"Workflow actions",children:[o.jsxs("div",{className:"af-prd-workflow-actions__head",children:[o.jsxs("div",{children:[o.jsx("h2",{children:"Action 时间线"}),o.jsx("p",{children:B.length?`${I}/${R.length} 已完成${v!=="all"?` · 共 ${B.length}`:""}`:"等待 prd-flow 返回 action 列表"})]}),O&&ad(O)?o.jsxs("div",{className:"af-prd-workflow-local-command",children:[o.jsx("span",{children:"本地 agent 执行"}),o.jsx("code",{children:O.command||Bi(O,0)})]}):null]}),L.length?o.jsxs("div",{className:"af-prd-workflow-action-filters","aria-label":"Action tag filters",children:[o.jsxs("button",{type:"button",className:v==="all"?"is-active":"","aria-pressed":v==="all",onClick:()=>x("all"),children:["全部 ",o.jsx("span",{children:B.length})]}),L.map(T=>o.jsxs("button",{type:"button",className:v===T.key?"is-active":"","aria-pressed":v===T.key,onClick:()=>x(T.key),children:[T.label," ",o.jsx("span",{children:T.count})]},T.key))]}):null,o.jsx("div",{className:"af-prd-workflow-action-list",children:R.length?K.map(T=>o.jsxs("section",{className:"af-prd-workflow-action-day",children:[o.jsxs("div",{className:"af-prd-workflow-action-day__label",children:[o.jsx("span",{children:T.day}),o.jsx("small",{children:"北京时间"})]}),o.jsx("div",{className:"af-prd-workflow-action-day__items",children:T.items.map(({item:ee,index:ie})=>{const G=Ko(ee.status),se=Ma(ee)==="observation"&&G==="done"?"observed":G,te=ym(ee),re=pq(ee),ne=xq(ee),ce=lq(ee,ie),de=cq(ee);return o.jsxs("div",{className:`af-prd-workflow-action af-prd-workflow-action--${se}`,children:[o.jsx("div",{className:"af-prd-workflow-action__rail",children:o.jsx("span",{className:"af-prd-workflow-action__dot"})}),o.jsxs("div",{className:"af-prd-workflow-action__body",children:[o.jsxs("div",{className:"af-prd-workflow-action__top",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"af-prd-workflow-action__title",children:[re?o.jsx("time",{dateTime:wh(ee),children:re}):null,o.jsx("strong",{children:ce})]}),de?o.jsx("p",{children:de}):null,ne.length?o.jsx("div",{className:"af-prd-workflow-action__meta",children:ne.map(me=>o.jsxs("span",{children:[o.jsx("b",{children:me.label}),me.value]},`${me.label}-${me.value}`))}):null]}),o.jsx("span",{className:"af-prd-workflow-action__status",children:mq(ee)})]}),te.length?o.jsx("div",{className:"af-prd-workflow-action__links",children:te.map(me=>o.jsxs("a",{href:me.href,target:"_blank",rel:"noreferrer",children:[o.jsx("span",{children:me.label}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"})]},`${me.label}-${me.href}`))}):null]})]},ee.id||ee.actionId||`${Bi(ee,ie)}-${ie}`)})})]},T.day)):o.jsxs("div",{className:"af-prd-workflow-action-empty",children:[o.jsx("strong",{children:t?B.length?"当前 tag 下暂无 action":"暂无 prd-flow 上报 action":"先绑定 TAPD 需求"}),o.jsx("p",{children:t?B.length?"切换到其它 tag 或查看全部。":"Workflow tab 不会生成默认步骤;需要 prd-flow snapshot 返回 actions/timeline/events/history 或 nextAction。":"绑定后从 prd-flow 读取真实 action、产物和 URL。"})]})})]}),o.jsxs("aside",{className:"af-prd-workflow-side","aria-label":"Workflow related links",children:[z.length?o.jsxs("article",{className:"af-prd-workflow-card",children:[o.jsxs("div",{className:"af-prd-workflow-card__head",children:[o.jsx("h2",{children:"关联产物"}),o.jsx("span",{children:z.length})]}),o.jsx("div",{className:"af-prd-workflow-list",children:z.map((T,ee)=>{const ie=xh(T),G=String(T.label||T.title||T.kind||ie||`Artifact ${ee+1}`);return ie?o.jsxs("a",{href:ie,target:"_blank",rel:"noreferrer",children:[o.jsx("span",{children:G}),o.jsx("small",{children:T.kind||ie})]},`${ie}-${ee}`):o.jsxs("div",{children:[o.jsx("span",{children:G}),o.jsx("small",{children:T.kind||""})]},`${G}-${ee}`)})})]}):null,o.jsxs("article",{className:"af-prd-workflow-card",children:[o.jsxs("div",{className:"af-prd-workflow-card__head",children:[o.jsx("h2",{children:"AI Docs"}),o.jsx("span",{children:W.length})]}),o.jsx("div",{className:"af-prd-workflow-list",children:W.length?W.map(T=>o.jsxs("a",{href:T.href,target:"_blank",rel:"noreferrer",children:[o.jsx("span",{children:T.label}),o.jsx("small",{children:[T.issueKey,T.platform,T.kind].filter(Boolean).join(" · ")||"ai-doc"})]},T.href)):o.jsx("p",{className:"af-prd-workflow-muted",children:"暂无 ai-doc 文档。"})})]}),o.jsxs("article",{className:"af-prd-workflow-card",children:[o.jsxs("div",{className:"af-prd-workflow-card__head",children:[o.jsx("h2",{children:"Issues"}),o.jsx("span",{children:E||N.length})]}),o.jsx("div",{className:"af-prd-workflow-issues",children:j.length?j.map(T=>o.jsxs("div",{className:"af-prd-workflow-epic",children:[o.jsxs("div",{className:"af-prd-workflow-epic__head",children:[o.jsx("strong",{children:T.title||T.key}),o.jsx("small",{children:T.issues.length})]}),T.issues.map((ee,ie)=>{var te;const G=ee.issue||{},se=Bj(G);return o.jsxs("div",{className:"af-prd-workflow-issue",children:[o.jsx("strong",{children:zj(G,ie)}),o.jsx("small",{children:[Di(G,ie),G.platform,G.status].filter(Boolean).join(" · ")}),se.length?o.jsx("div",{className:"af-prd-workflow-issue__links",children:se.map(re=>o.jsx("a",{href:re.href,target:"_blank",rel:"noreferrer",children:re.label},`${re.label}-${re.href}`))}):null,(te=ee.children)!=null&&te.length?o.jsx("div",{className:"af-prd-workflow-issue__children",children:ee.children.map((re,ne)=>{const ce=re.issue||{},de=Bj(ce);return o.jsxs("div",{className:"af-prd-workflow-issue af-prd-workflow-issue--child",children:[o.jsx("strong",{children:zj(ce,ne)}),o.jsx("small",{children:[Di(ce,ne),ce.platform,ce.status].filter(Boolean).join(" · ")}),de.length?o.jsx("div",{className:"af-prd-workflow-issue__links",children:de.map(me=>o.jsx("a",{href:me.href,target:"_blank",rel:"noreferrer",children:me.label},`${me.label}-${me.href}`))}):null]},Di(ce,ne))})}):null]},Di(G,ie))})]},T.key)):o.jsx("p",{className:"af-prd-workflow-muted",children:"暂无 Issue 信息。"})})]}),o.jsxs("article",{className:"af-prd-workflow-card",children:[o.jsxs("div",{className:"af-prd-workflow-card__head",children:[o.jsx("h2",{children:"运行审计"}),o.jsxs("span",{children:[$.length,"/",D.length]})]}),o.jsx("div",{className:"af-prd-workflow-audit-filter",role:"tablist","aria-label":"运行审计筛选",children:[["all","全部"],["errors","异常"],["review","Review"],["external","外部"]].map(([T,ee])=>o.jsx("button",{type:"button",className:w===T?"is-active":"",onClick:()=>y(T),children:ee},T))}),o.jsx("div",{className:"af-prd-workflow-audit",children:$.length?$.map((T,ee)=>o.jsxs("div",{children:[o.jsx("strong",{children:Bi(T,ee)}),o.jsx("small",{children:[T.status,T.type,wh(T)].filter(Boolean).join(" · ")})]},T.id||`${T.type}-${ee}`)):o.jsx("p",{className:"af-prd-workflow-muted",children:"暂无运行事件。"})})]}),X||l?o.jsxs("article",{className:"af-prd-workflow-card af-prd-workflow-card--raw",children:[o.jsx("div",{className:"af-prd-workflow-card__head",children:o.jsx("h2",{children:"Raw"})}),o.jsx("pre",{children:l||X})]}):null]})]})]})}function QU(){var Kv,qv;const{t:e,i18n:t}=Pr(),{navigate:n}=xi(),r=cc(),s=CH(),i=m.useMemo(U7,[]),[a,l]=m.useState(()=>(()=>{const b=new URLSearchParams(window.location.search).get("view");return b==="display"||b==="workflow"?b:"workspace"})()),[c,u]=m.useState(!1),[p,d]=m.useState(!1),[f,h]=_H([]),[g,k]=EH([]),w=m.useRef([]),y=m.useRef([]),v=m.useRef(null),[x,C]=m.useState(()=>lw(null,[])),N=m.useRef(x),[j,E]=m.useState(null),P=m.useRef(null),[O,B]=m.useState([]),W=m.useRef(new Map),z=m.useRef(new Map),L=m.useRef(null),R=m.useRef(null),K=m.useRef(null),[D,$]=m.useState(null),[I,F]=m.useState({}),_=m.useRef({}),X=m.useRef(!1),V=m.useRef(null),T=m.useRef(!1),ee=m.useRef(null),[ie,G]=m.useState([]),[se,te]=m.useState(""),[re,ne]=m.useState("nodes"),[ce,de]=m.useState([]),[me,He]=m.useState(!1),[Je,Te]=m.useState(""),[ot,gt]=m.useState(!1),[yt,Ae]=m.useState({name:"",id:"",description:""}),[dt,St]=m.useState(!1),[Wt,Vt]=m.useState(""),[et,fe]=m.useState(""),ke=m.useRef(null),[Ve,Qe]=m.useState(!1),[Se,_t]=m.useState(!1),[dn,zt]=m.useState(""),[at,fn]=m.useState(null),[Z,Ce]=m.useState(()=>cy()),[Me,Ye]=m.useState(""),[Pt,Nt]=m.useState(!1),[$n,Xt]=m.useState(""),[Hn,Yn]=m.useState(!1),[Wn,Ln]=m.useState([]),[Gn,ls]=m.useState(!1),[Ir,wr]=m.useState(""),[cs,pn]=m.useState(""),[rr,br]=m.useState(""),[Vn,Cn]=m.useState(!1),[kr,Gs]=m.useState(""),[vr,Qt]=m.useState(""),[le,we]=m.useState(!1),[De,wt]=m.useState("nodes"),[Zt,on]=m.useState(""),[An,ur]=m.useState(0),[nt,xt]=m.useState(""),Yt=m.useRef(""),[Ke,Re]=m.useState(null),dr=m.useRef(null),[ki,Kr]=m.useState(""),[qr,Ss]=m.useState([]),[oe,ve]=m.useState(""),[ae,ht]=m.useState(!0),[$t,Kt]=m.useState(""),[sr,nn]=m.useState(()=>new Set),[Ur,q]=m.useState(""),[pe,Pe]=m.useState({nodeId:"",query:""}),[_e,qe]=m.useState(!1),rn=m.useRef(null),It=m.useRef(null),Jn=m.useRef(""),[Yr,qo]=m.useState(()=>{try{const b=Number(window.localStorage.getItem("agentflow.workspace.filesPaneHeight")||0);if(Number.isFinite(b)&&b>=160)return b}catch{}return 360}),[Uo,Ck]=m.useState(!1),[Yo,fR]=m.useState({cursor:[],opencode:[],claudeCode:[],codex:[]}),[vi,pR]=m.useState(""),[Ns,hR]=m.useState([]),[_k,Ek]=m.useState(!1),[js,xc]=m.useState([]),[Ha,mR]=m.useState([]),[Ak,gR]=m.useState(!1),[Pk,Ik]=m.useState([]),[Tk,Rk]=m.useState([]),[ir,yR]=m.useState(()=>{try{const b=String(new URLSearchParams(window.location.search).get("tapdId")||"").trim();return b||String(window.localStorage.getItem(`agentflow.workflow.tapdId:${i.flowSource||"user"}:${i.flowId||""}`)||"").trim()}catch{return""}}),[en,Md]=m.useState(null),[xR,Mk]=m.useState(!1),[wR,Wa]=m.useState(""),[Cm,$k]=m.useState(!1),[_m,$d]=m.useState(""),[us,Ld]=m.useState(null),[Em,Lk]=m.useState(!1),[wc,bc]=m.useState(null),Ok=m.useCallback(b=>{ke.current&&window.clearTimeout(ke.current),fe(b),ke.current=window.setTimeout(()=>{fe(""),ke.current=null},3800)},[]),Zi=m.useCallback(b=>{const S=String(b||"").trim();if(!S)return;const A=()=>s(S);window.requestAnimationFrame(A),window.setTimeout(A,80)},[s]),Dk=m.useCallback((b,S)=>{const A=String(b||"").trim(),M=Nh(S);!A||!M||(h(H=>H.map(U=>{var ue;if(U.id!==A)return U;const Y=Nh((ue=U.data)==null?void 0:ue.displaySize),J=Y&&Y.width===M.width&&Y.height===M.height,Q=Math.round(Number(U.width||0))===M.width&&Math.round(Number(U.height||0))===M.height;return J&&Q?U:{...U,width:M.width,height:M.height,data:{...U.data,nodeSize:M,displaySize:M}}})),Zi(A))},[Zi,h]);m.useEffect(()=>{try{window.localStorage.setItem("agentflow.workspace.filesPaneHeight",String(Math.round(Yr)))}catch{}},[Yr]);const Am=m.useCallback(b=>{const S=rn.current;if(!S)return;const A=S.getBoundingClientRect(),M=16,H=150,U=230,Y=A.top+M,J=A.bottom-M,Q=Math.max(H,J-Y-U),ue=Math.min(Math.max(b-Y,H),Q);qo(ue)},[]),bR=m.useCallback(b=>{b.preventDefault(),b.stopPropagation(),Ck(!0),Am(b.clientY);const S=M=>{M.preventDefault(),Am(M.clientY)},A=()=>{Ck(!1),window.removeEventListener("pointermove",S,!0),window.removeEventListener("pointerup",A,!0),window.removeEventListener("pointercancel",A,!0)};window.addEventListener("pointermove",S,!0),window.addEventListener("pointerup",A,!0),window.addEventListener("pointercancel",A,!0)},[Am]);m.useEffect(()=>()=>{ke.current&&window.clearTimeout(ke.current),ee.current&&window.clearTimeout(ee.current)},[]);const[kR,Fk]=m.useState(()=>new Set),[Od,Pm]=m.useState(!1),Im=m.useRef(null),zk=m.useRef(null),Bk=m.useRef(null),[vR,SR]=m.useState({}),[Go,Tm]=m.useState(""),[Gr,Hk]=m.useState(!1),[Jo,Va]=m.useState([]),[Cs,On]=m.useState([]),[Tr,ds]=m.useState("workspace"),[kc,Ka]=m.useState(!1),Wk=m.useRef(null),Rm=m.useRef(null),[vc,qa]=m.useState(null),[NR,Mm]=m.useState(!0),[Vk,Kk]=m.useState(""),[Xo,eo]=m.useState({}),[Sr,qk]=m.useState(null),[Uk,Yk]=m.useState(!1),Ua=m.useMemo(()=>Uk?Q7(Sr):"",[Uk,Sr]),[Sc,Dd]=m.useState(!0);m.useEffect(()=>{Ua&&Dd(Z7(Ua))},[Ua]),m.useEffect(()=>{if(Ua)try{window.localStorage.setItem(Ua,Sc?"true":"false")}catch{}},[Sc,Ua]);const[$m,Fd]=m.useState(!1),[Lm,Gk]=m.useState(!1),[Om,Jk]=m.useState("pan"),[Xk,jR]=m.useState({}),Nc=m.useRef({}),[Qk,Qo]=m.useState({}),jc=m.useRef(new Map),Cc=m.useRef(new Set),[Zk,Ya]=m.useState(()=>new Set),[Dm,Ga]=m.useState({}),[ev,tv]=m.useState(""),[CR,xe]=m.useState(""),Si=m.useMemo(()=>X7(i),[i]),[nv,rv]=m.useState(""),zd=i.flowSource||"user",sv=m.useMemo(()=>new Set(Object.values(Xk||{}).map(b=>String((b==null?void 0:b.runNodeId)||"").trim()).filter(Boolean)),[Xk]),Ni=m.useCallback(b=>{const S=Nc.current||{},A=typeof b=="function"?b(S):b,M=A&&typeof A=="object"&&!Array.isArray(A)?A:{};return Nc.current=M,jR(M),M},[]),iv=!!(i.flowId&&!i.archived&&(zd==="user"||zd==="workspace"));m.useEffect(()=>{i.flowId&&uO(i.flowId,i.flowSource||"user","workspace",!!i.archived)},[i]),m.useEffect(()=>{const b=()=>{l(new URLSearchParams(window.location.search).get("view")==="display"?"display":"workspace")};return window.addEventListener("popstate",b),()=>window.removeEventListener("popstate",b)},[]),m.useEffect(()=>{Va([]),On([]),ds("workspace"),Mm(!0)},[i]);const Pn=m.useCallback(async()=>{const b=$r(i),S=await fetch(`/api/workspace/files?${b.toString()}`),A=await S.json();if(!S.ok)throw new Error(A.error||"读取 workspace 失败");const M=A.files||[];Ss(M),nn(new Set(uT(M))),ve(A.root||"")},[i]),Bd=m.useCallback(async()=>{He(!0),Te("");try{const b=await fetch("/api/marketplace/flow-snippets"),S=await b.json().catch(()=>({}));if(!b.ok)throw new Error(S.error||"读取流程片段失败");de(Array.isArray(S.snippets)?S.snippets:[])}catch(b){Te(String(b.message||b)),de([])}finally{He(!1)}},[]),qt=m.useCallback(async(b=f,S=g)=>{var U;if(!X.current)return;if(!ae)throw xe("Readonly workspace"),new Error("Readonly workspace");const A=Yc(b,S,_.current);A.ui={...A.ui||{},...P.current?{viewport:P.current}:{},displayPage:Xq(N.current,b)};const M=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,graph:A})}),H=await M.json();if(!M.ok)throw new Error(H.error||"保存 workspace graph 失败");_.current=((U=H.graph)==null?void 0:U.instances)||A.instances,F(_.current),Qo(qf(H.workspaceSchedules||[])),xe("Workspace graph saved")},[g,i,f,ae]),_R=m.useCallback(b=>{var A;const S=(A=b==null?void 0:b.extra)!=null&&A.instances&&typeof b.extra.instances=="object"?b.extra.instances:{};_.current=S,F(S),h(Array.isArray(b==null?void 0:b.nodes)?b.nodes:[]),k(Array.isArray(b==null?void 0:b.edges)?b.edges:[]),xt(""),$(null)},[k,h]),ER=m.useMemo(()=>({instances:I}),[I]),AR=$7({nodes:f,edges:g,extra:ER,enabled:X.current,onRestore:_R}),{resetHistory:Hd,undo:ov,redo:av}=AR,Ja=m.useCallback(async()=>{var Ee,st;X.current=!1;const b=$r(i),S=$r(i);S.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const[A,M]=await Promise.all([fetch(`/api/nodes?${S.toString()}`),fetch(`/api/workspace/graph?${b.toString()}`),Pn()]),H=await A.json(),U=await M.json();if(!A.ok)throw new Error(H.error||"读取节点定义失败");if(!M.ok)throw new Error(U.error||"读取 workspace graph 失败");const Y=[...(Array.isArray(H)?H:H.nodes||[]).filter(Le=>!O7.has(Le.id)),W7,H7,z7,B7,D7,F7];G(Y);const J=U.graph||JSON.parse(localStorage.getItem(L7)||"null")||{},Q=Uf(J,Y),ue=lw((Ee=J==null?void 0:J.ui)==null?void 0:Ee.displayPage,Q.nodes),be=XI((st=J==null?void 0:J.ui)==null?void 0:st.viewport);_.current=Q.instances,F(Q.instances),h(Q.nodes),k(Q.edges),Qo(qf(U.workspaceSchedules||[])),C(ue),N.current=ue,E(be),P.current=be,B([]),Hd(Q.nodes,Q.edges,{instances:Q.instances});const ge=U.writable!==!1;ht(ge),xe(ge?"Workspace ready":"Readonly workspace"),X.current=!0},[i,t.language,Pn,Hd,k,h]),Wd=m.useCallback(async(b=ir)=>{const S=String(b||"").trim();Mk(!0),Wa("");try{const A=$r(i);A.set("tapdId",S);const M=await fetch(`/api/prd-workflow/snapshot?${A.toString()}`),H=await M.json().catch(()=>({}));if(!M.ok)throw new Error(H.error||"读取 PRD Workflow 失败");Md(H.snapshot||null),$d(""),Ld(null),bc(null);try{const U=`agentflow.workflow.tapdId:${i.flowSource||"user"}:${i.flowId||""}`;S?window.localStorage.setItem(U,S):window.localStorage.removeItem(U)}catch{}}catch(A){Wa(String(A.message||A))}finally{Mk(!1)}},[i,ir]),Xa=m.useCallback(async(b=null,S={})=>{const A=b&&typeof b=="object"?b:en==null?void 0:en.nextAction,M=ad(A);if(!M||Cm)return;const H=(S==null?void 0:S.confirm)===!0,U=String((S==null?void 0:S.expectedRevision)||(en==null?void 0:en.revision)||"");$k(!0),Wa(""),H||($d(""),Ld(null),bc(null));try{const Y=await fetch("/api/prd-workflow/action",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,tapdId:ir,action:M,stage:$a(A),title:Bi(A,0),...bq(A),dryRun:!H,confirm:H,issueKey:A.issueKey||A.issue_key||"",expectedRevision:U,idempotencyKey:`workflow-${Date.now()}-${Math.random().toString(36).slice(2)}`})}),J=await Y.json().catch(()=>({}));if(!Y.ok||J.ok===!1)throw J.snapshot&&Md(J.snapshot),J.conflict&&bc({...J.conflict,action:A}),new Error(J.error||"执行 PRD Workflow action 失败");$d(J.rawOutput||(J.output?JSON.stringify(J.output,null,2):"")),Md(J.snapshot||en),bc(null),Ld(H?null:{action:A,output:J.output||null,expectedRevision:U,at:new Date().toISOString()})}catch(Y){Wa(String(Y.message||Y))}finally{$k(!1)}},[i,Cm,en,ir]),PR=m.useCallback((b=null)=>Xa(b,{confirm:!1}),[Xa]),IR=m.useCallback(()=>{const b=(us==null?void 0:us.action)||(en==null?void 0:en.nextAction);return Xa(b,{confirm:!0,expectedRevision:(us==null?void 0:us.expectedRevision)||""})},[Xa,us,en]),TR=m.useCallback(()=>{const b=(wc==null?void 0:wc.action)||(en==null?void 0:en.nextAction);return bc(null),Xa(b,{confirm:!1})},[Xa,wc,en]),RR=m.useCallback(async()=>{var U;const b=String(_m||(en==null?void 0:en.rawOutput)||"").trim();if(!b||Em)return;const S=(us==null?void 0:us.action)||(en==null?void 0:en.nextAction)||{},A=`Review: ${Bi(S,0)||(en==null?void 0:en.pointer)||ir||"PRD Workflow"}`,M=/^[\[{]/.test(b),H=b.startsWith("#")?b:`# ${A}
|
|
246
|
-
|
|
247
|
-
${M?`\`\`\`json
|
|
248
|
-
${b}
|
|
249
|
-
\`\`\``:b}`;Lk(!0),Wa("");try{const Y=await fetch("/api/prd-workflow/review-link",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,tapdId:ir,title:A,markdown:H,action:ad(S),stage:$a(S),issueKey:S.issueKey||S.issue_key||"",artifactLabel:"临时 Review"})}),J=await Y.json().catch(()=>({}));if(!Y.ok||J.ok===!1)throw new Error(J.error||"生成 Review 链接失败");Md(J.snapshot||en);const Q=((U=J.review)==null?void 0:U.url)||"";Q&&$d(ue=>`${ue||b}
|
|
250
|
-
|
|
251
|
-
Review link: ${Q}`)}catch(Y){Wa(String(Y.message||Y))}finally{Lk(!1)}},[i,_m,us,Em,en,ir]),MR=m.useCallback(async(b,S)=>{const A={packageId:(b==null?void 0:b.newId)||(b==null?void 0:b.id)||(b==null?void 0:b.label),label:(b==null?void 0:b.label)||(b==null?void 0:b.newId)||(b==null?void 0:b.id),version:"1.0.0",definitionId:S,body:(b==null?void 0:b.body)||"",script:(b==null?void 0:b.script)||"",scriptRef:(b==null?void 0:b.scriptRef)||"",implementationRef:(b==null?void 0:b.implementationRef)||"",implementationMode:(b==null?void 0:b.implementationMode)||"",inputs:Array.isArray(b==null?void 0:b.inputs)?b.inputs:[],outputs:Array.isArray(b==null?void 0:b.outputs)?b.outputs:[],flowId:i.flowId,flowSource:i.flowSource||"user",archived:!!i.archived},M=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(A)}),H=await M.json().catch(()=>({}));if(!M.ok||(H==null?void 0:H.ok)===!1)throw new Error((H==null?void 0:H.error)||"Publish failed");return await Ja(),xe(`Published node ${H.definitionId||H.id||A.packageId}`),H},[i,Ja]),Zo=m.useCallback((b=Cs)=>{const S=Array.isArray(b)?b:[],M=[...S].reverse().find(H=>(H==null?void 0:H.status)==="running"||(H==null?void 0:H.status)==="stopping")||[...S].reverse().find(H=>H==null?void 0:H.id);return String((M==null?void 0:M.id)||"workspace")},[Cs]),$R=m.useCallback(b=>{const S=String(b||"").trim();!S||S==="workspace"||On(A=>{const M=(Array.isArray(A)?A:[]).filter(H=>H.id!==S);return ds(H=>H===S?Zo(M):H),M})},[Zo]);m.useCallback((b="")=>{Ka(!0),qa(null),Re(null),ds(b||Zo())},[Zo]);const lv=m.useCallback((b={})=>{qa({scheduleNodeId:String(b.scheduleNodeId||""),runNodeId:String(b.runNodeId||b.nodeId||""),lastRunId:String(b.lastRunId||""),label:String(b.label||"")}),Ka(!1),Re(null),xt("")},[]),Fm=m.useCallback(async(b="")=>{const S=String(b||"").trim();if(!(!S||!ae)){tv(S),xe(`Optimizing run: ${S}`);try{await qt(w.current,y.current);const A=Yc(w.current,y.current,_.current),M=c1(w.current,_.current,S,vi),H=await fetch("/api/workspace/run/optimize",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,runNodeId:S,graph:A,model:M})}),U=await H.json().catch(()=>({}));if(!H.ok||U.ok===!1)throw new Error(U.error||"优化失败");const Y=U.graph||A,J=Uf(Y,ie);_.current=J.instances,F(J.instances),h(J.nodes),k(J.edges),Qo(qf(U.workspaceSchedules||[])),Hd(J.nodes,J.edges,{instances:J.instances});const Q=Array.isArray(U.optimized)?U.optimized.length:0;xe(Q>0?`已生成 ${Q} 个 implementation`:"没有需要优化的节点")}catch(A){xe(String(A.message||A))}finally{tv("")}}},[vi,y,i,w,ie,Hd,qt,k,h,ae]),cv=m.useCallback(async(b="")=>{const S=String(b||"").trim(),A=Nc.current||{},M=Object.entries(A).find(([Q,ue])=>Q===S||String((ue==null?void 0:ue.runNodeId)||"")===S)||Object.entries(A)[0]||null,H=(M==null?void 0:M[0])||"",U=(M==null?void 0:M[1])||null,Y=String((U==null?void 0:U.runNodeId)||S||"").trim();if((U==null?void 0:U.status)==="stopping")return;const J=new Set([Y,...Array.isArray(U==null?void 0:U.plannedNodeIds)?U.plannedNodeIds:[]].map(Q=>String(Q||"").trim()).filter(Boolean));H&&Ni(Q=>{const ue={...Q};return ue[H]&&(ue[H]={...ue[H],status:"stopping"}),ue}),xe(Y?`Stopping Workspace run: ${Y}...`:"Stopping Workspace run..."),On(Q=>Q.map(ue=>(H?ue.id===H:!Y||ue.runNodeId===Y)&&ue.status==="running"?{...ue,status:"stopping"}:ue));try{const Q=await fetch("/api/workspace/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,runId:H,runNodeId:Y})}),ue=await Q.json().catch(()=>({}));if(!Q.ok||(ue==null?void 0:ue.stopped)!==!0)throw new Error(ue.error||"Workspace run stop failed");const be=H?jc.current.get(H):null;be&&(be.abort(),jc.current.delete(H)),H&&Ni(ge=>{const Ee={...ge};return delete Ee[H],Ee}),Ya(ge=>{const Ee=new Set(ge);for(const st of J)Ee.delete(st);return Ee}),Ga(ge=>{var st;const Ee={...ge};for(const Le of J)Le&&(!Ee[Le]||((st=Ee[Le])==null?void 0:st.status)==="running")&&(Ee[Le]={status:"stopped"});return Ee}),xe(Y?`Workspace run stopped: ${Y}`:"Workspace run stopped"),On(ge=>ge.map(Ee=>(H?Ee.id===H:!Y||Ee.runNodeId===Y)?{...Ee,status:"stopped",endedAt:Date.now(),messages:[...Array.isArray(Ee.messages)?Ee.messages:[],{role:"assistant",kind:"status",text:"Workspace run stopped.",at:Date.now()}].slice(-160)}:Ee))}catch(Q){H&&Ni(be=>{const ge={...be};return ge[H]&&(ge[H]={...ge[H],status:"running"}),ge});const ue=String((Q==null?void 0:Q.message)||Q||"Workspace run stop failed");xe(`停止失败:${ue}`),On(be=>be.map(ge=>(H?ge.id===H:!Y||ge.runNodeId===Y)?{...ge,status:"running",messages:[...Array.isArray(ge.messages)?ge.messages:[],{role:"assistant",kind:"error",error:!0,text:`停止失败:${ue}`,at:Date.now()}].slice(-160)}:ge))}},[i,Ni]),uv=m.useCallback(async()=>{if(i.flowId)try{const b=$r(i),S=await fetch(`/api/workspace/run/status?${b.toString()}`),A=await S.json().catch(()=>({}));if(!S.ok||!A.running)return;const M=Array.isArray(A.runs)&&A.runs.length?A.runs:[{runId:`run-restored-${A.startedAt||Date.now()}`,runNodeId:A.runNodeId||"",startedAt:A.startedAt||Date.now(),plannedNodeIds:[]}],H={},U=[];for(const Y of M){const J=String((Y==null?void 0:Y.runNodeId)||"").trim(),Q=String((Y==null?void 0:Y.runId)||`run-restored-${(Y==null?void 0:Y.startedAt)||Date.now()}-${J}`).trim();if(!Q)continue;const ue=String((Y==null?void 0:Y.label)||"").trim()||sy(w.current,_.current,J,"Workspace Run");H[Q]={id:Q,runNodeId:J,label:ue,status:(Y==null?void 0:Y.state)==="stopping"?"stopping":"running",plannedNodeIds:Array.isArray(Y==null?void 0:Y.plannedNodeIds)?Y.plannedNodeIds:[],startedAt:(Y==null?void 0:Y.startedAt)||Date.now()},J&&U.push(J)}if(!Object.keys(H).length)return;Ni(Y=>({...Y,...H})),Ya(Y=>{const J=new Set(Y);for(const Q of U)J.add(Q);return J}),Ga(Y=>{const J={...Y};for(const Q of U)J[Q]={status:"running"};return J}),xe(U.length?`Workspace run still running: ${U.join(", ")}`:"Workspace run still running"),On(Y=>{const J=[...Y];for(const[Q,ue]of Object.entries(H)){if(J.some(Ee=>Ee.id===Q||["running","stopping"].includes(Ee.status)&&Ee.runNodeId===ue.runNodeId))continue;const be=String(ue.runNodeId||""),ge=String(ue.label||"").trim()||sy(w.current,_.current,be,"Workspace Run");J.push({id:Q,label:iy(ge,be,"Workspace Run"),alias:ge,runNodeId:be,status:ue.status,startedAt:ue.startedAt||Date.now(),steps:be?[{id:be,label:iy(ge,be,"Workspace Run"),status:"running"}]:[],messages:[{role:"assistant",kind:"run-summary",text:ue.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{}},[i,w,Ni]),dv=m.useCallback(async b=>{if(!ae){xe("Readonly workspace");return}if(!b)return;if(Object.values(Nc.current||{}).find(tt=>String((tt==null?void 0:tt.runNodeId)||"")===String(b||""))){xe(`Workspace run already running: ${b}`);return}let A=w.current,M=y.current,H=_.current;const U=dr.current;if(U!=null&&U.id){const tt=A.find(Ie=>Ie.id===U.id),Ge=d1({nodes:A,edges:M,instances:H,selectedNode:tt,draft:U,allowRename:!1});if(Ge!=null&&Ge.error){Kr(Ge.error),xe(Ge.error);return}Ge!=null&&Ge.ok&&Ge.changed&&(A=Ge.nodes,M=Ge.edges,H=Ge.instances,_.current=H,w.current=A,y.current=M,F(H),h(A),k(M),Zi(Ge.nextId||U.id))}const Y=Yc(A,M,H),J=`run-${Date.now()}-${String(b).replace(/[^a-z0-9_-]+/gi,"_")}`,Q=sy(A,H,b,"Workspace Run"),ue=iy(Q,b,"Workspace Run");let be=[b];try{const tt=await fetch("/api/workspace/run/plan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,graph:Y,runNodeId:b})}),Ge=await tt.json().catch(()=>({}));if(!tt.ok||(Ge==null?void 0:Ge.ok)===!1)throw new Error(Ge.error||"Workspace run plan failed");be=Array.isArray(Ge.plannedNodeIds)&&Ge.plannedNodeIds.length?Ge.plannedNodeIds.map(Lt=>String(Lt||"").trim()).filter(Boolean):[b],be=Array.from(new Set([b,...be].filter(Boolean)));const Ie=Ge.conflict||null;if(Ie!=null&&Ie.runNodeId||Ie!=null&&Ie.runId){const Lt=Array.isArray(Ie.conflictNodeIds)&&Ie.conflictNodeIds.length?`: ${Ie.conflictNodeIds.join(", ")}`:"";xe(`Run ${b} conflicts with running ${Ie.runNodeId||Ie.runId}${Lt}`);return}}catch(tt){xe(String(tt.message||tt));return}const ge=new Set(be),Ee=Object.values(Nc.current||{}).find(tt=>(Array.isArray(tt==null?void 0:tt.plannedNodeIds)?tt.plannedNodeIds:[]).some(Ge=>ge.has(String(Ge||"").trim())));if(Ee){const tt=(Array.isArray(Ee.plannedNodeIds)?Ee.plannedNodeIds:[]).map(Ge=>String(Ge||"").trim()).filter(Ge=>Ge&&ge.has(Ge));xe(`Run ${b} conflicts with running ${Ee.runNodeId||"workspace run"}${tt.length?`: ${tt.join(", ")}`:""}`);return}const st=new AbortController;jc.current.set(J,st),Cc.current.delete(J),Ni(tt=>({...tt,[J]:{id:J,runNodeId:b,label:Q,plannedNodeIds:be,startedAt:Date.now()}})),Ya(tt=>new Set([...tt,b])),Ga(tt=>({...tt,[b]:{status:"running"}})),xe(`Running ${ue}...`),ds(J),On(tt=>[...tt.slice(-7),{id:J,label:ue,alias:Q,runNodeId:b,status:"running",startedAt:Date.now(),steps:[],messages:[{role:"assistant",kind:"run-summary",text:"准备运行...",at:Date.now()}]}]);let Le=b;const Ue=new Map,We=()=>Cc.current.has(J),Oe=tt=>{const Ge=new Set((tt||[]).map(Ie=>String(Ie||"").trim()).filter(Boolean));Ge.size||Ge.add(String(b||"")),Ya(Ie=>{const Lt=new Set(Ie);for(const Ze of Ge)Lt.delete(Ze);return Lt})},Bt=(tt,Ge)=>{const Ie=new Set((tt||[]).map(Lt=>String(Lt||"").trim()).filter(Boolean));Ie.size||Ie.add(String(b||"")),Ga(Lt=>{var pt;const Ze={...Lt};for(const Dt of Ie)Dt&&(!Ze[Dt]||((pt=Ze[Dt])==null?void 0:pt.status)==="running")&&(Ze[Dt]={status:Ge});return Ze})};try{await qt(A,M);const tt=c1(A,H,b,vi),Ge=await fetch("/api/workspace/run",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},signal:st.signal,body:JSON.stringify({...i,graph:Y,runNodeId:b,runAlias:Q,runSessionId:J,model:tt,selectedSkills:js,stream:!0})});if(!Ge.ok){const he=await Ge.json().catch(()=>({}));throw new Error(he.error||"Workspace run failed")}if(!Ge.body)throw new Error("Workspace run stream unavailable");const Ie=Ge.body.getReader(),Lt=new TextDecoder;let Ze="",pt=[],Dt=[];const Xm=(he,Xe)=>{var rt,jt;const Fe=f.find(Tt=>Tt.id===he),lt=String(((rt=Fe==null?void 0:Fe.data)==null?void 0:rt.label)||he||"").trim(),ye=String(Xe||((jt=Fe==null?void 0:Fe.data)==null?void 0:jt.definitionId)||"").trim();return ye&&ye!==lt?`${lt} (${ye})`:lt},Rc=(he,Xe,Fe)=>{const lt=String(he||"").trim();lt&&On(ye=>ye.map(rt=>{if(rt.id!==J)return rt;const Tt=[...Array.isArray(rt.steps)?rt.steps:[]],ct=Tt.findIndex(an=>an.id===lt),bt={id:lt,label:Xm(lt,Xe),status:Fe};ct>=0?Tt[ct]={...Tt[ct],...bt}:Tt.push(bt);const sn=Tt.map((an,ro)=>{const _i=an.status==="done"?"[done]":an.status==="failed"?"[failed]":"[running]";return`${ro+1}. ${_i} ${an.label}`}).join(`
|
|
252
|
-
`),Ft=Array.isArray(rt.messages)?rt.messages:[],Gt=Ft.findIndex(an=>an.kind==="run-summary"),hn={role:"assistant",kind:"run-summary",text:sn||"准备运行...",at:Date.now()},Rt=[...Ft];return Gt>=0?Rt[Gt]=hn:Rt.unshift(hn),{...rt,steps:Tt,messages:Rt.slice(-160)}}))},Qm=(he,Xe)=>{var Qv,Zv,e0,t0,n0,r0,s0,i0,o0,a0;const Fe=String(he||"").trim(),lt=String(Xe||"").trim();if(!Fe||!lt)return;const ye=(Qv=_.current)==null?void 0:Qv[Fe];if(!Ws(ye==null?void 0:ye.definitionId))return;const rt=Oo(ye==null?void 0:ye.input,"displayType","markdown"),jt=mT(rt),Tt=gT(Fe),ct=ie.find(Nr=>Nr.id===jt),bt=i1(ct==null?void 0:ct.inputs,jt,lt),sn=i1(ct==null?void 0:ct.outputs,jt,lt),Ft=String((ye==null?void 0:ye.label)||Fe||"一键任务").trim(),Gt={..._.current||{},[Fe]:{...ye||{},output:a1(ye==null?void 0:ye.output)},[Tt]:{...((Zv=_.current)==null?void 0:Zv[Tt])||{},definitionId:jt,label:Ft,role:"normal",body:lt,input:bt,output:sn,sourceContextRunNodeId:Fe,displayReloadKey:String(Date.now())}};_.current=Gt,F(Gt);const hn=w.current||[],Rt=hn.find(Nr=>Nr.id===Fe),an=hn.find(Nr=>Nr.id===Tt),ro=Number(((e0=Rt==null?void 0:Rt.measured)==null?void 0:e0.width)||(Rt==null?void 0:Rt.width)||((n0=(t0=Rt==null?void 0:Rt.data)==null?void 0:t0.nodeSize)==null?void 0:n0.width)||520),_i=(an==null?void 0:an.position)||{x:Number(((r0=Rt==null?void 0:Rt.position)==null?void 0:r0.x)||0)+ro+120,y:Number(((s0=Rt==null?void 0:Rt.position)==null?void 0:s0.y)||0)},Qn=((i0=an==null?void 0:an.data)==null?void 0:i0.displaySize)||((o0=an==null?void 0:an.data)==null?void 0:o0.nodeSize)||{width:rw,height:sw},Js=nw({id:Tt,type:zl,position:_i,width:Number(Qn.width)||rw,height:Number(Qn.height)||sw,data:{label:Ft,definitionId:jt,role:"normal",body:lt,inputs:bt,outputs:sn,sourceContextRunNodeId:Fe,displayReloadKey:Gt[Tt].displayReloadKey,nodeSize:Qn,displaySize:Qn}},Gt,ie),so=hn.map(Nr=>{if(Nr.id===Fe){const{width:woe,height:boe,measured:koe,...IM}=Nr,{nodeSize:voe,displaySize:Soe,...cf}=Nr.data||{};return{...IM,data:{...cf,outputs:a1(cf==null?void 0:cf.outputs),contextRunResultNonce:Date.now()}}}return Nr.id===Tt?{...Js,selected:Nr.selected}:Nr});an||so.push(Js),w.current=so,h(so);const io=y.current||[],lf=yT(jt),eg=o1((ye==null?void 0:ye.output)||((a0=Rt==null?void 0:Rt.data)==null?void 0:a0.outputs),"output",["content","result"],["text"]),AM=o1(bt,"input",[lf,"content"],["text"]),PM={id:`we-${Fe}-${Tt}`,source:Fe,target:Tt,sourceHandle:eg,targetHandle:AM,markerEnd:{type:oi.ArrowClosed}},Xv=[...io.filter(Nr=>!(Nr.source===Fe&&Nr.target===Tt)),PM];y.current=Xv,k(Xv),window.requestAnimationFrame(()=>{s(Fe),s(Tt)})},rf=(he,Xe=null)=>{const Fe=he!=null&&he.instances&&typeof he.instances=="object"?he.instances:{},lt=Xe instanceof Set?Xe:null;for(const[ye,rt]of Object.entries(Fe)){if(lt&&!lt.has(ye)||!Ws(rt==null?void 0:rt.definitionId))continue;const jt=xm({outputs:rt.output});jt&&Qm(ye,jt)}},Uv=he=>{const Xe=String(he||"").trim();if(!Xe)return;const Fe=Le;Le=Xe,Ya(lt=>{const ye=new Set(lt);return Fe&&Fe!==Xe&&Fe!==b&&ye.delete(Fe),b&&ye.add(b),ye.add(Xe),ye}),Ga(lt=>{var ye;return{...lt,...Fe&&Fe!==Xe&&Fe!==b&&((ye=lt[Fe])==null?void 0:ye.status)==="running"?{[Fe]:{status:"success"}}:{},...b?{[b]:{status:"running"}}:{},[Xe]:{status:"running"}}})},Yv=he=>{const Xe=String(he||"").trim();Xe&&(Ya(Fe=>{const lt=new Set(Fe);return lt.delete(Xe),lt}),Ga(Fe=>({...Fe,[Xe]:{status:"success"}})))},Gv=(he,Xe)=>{const Fe=String(Xe||"");if(!Fe.trim())return;const lt=["assistant","thinking","result","error","prompt"].includes(he)?he:"assistant";On(ye=>ye.map(rt=>{if(rt.id!==J)return rt;let jt=Array.isArray(rt.messages)?rt.messages:[];if(lt==="result"){const bt=[...jt].reverse().find(sn=>sn.kind==="assistant");if(String((bt==null?void 0:bt.text)||"").trim()===Fe.trim())return rt}if(lt==="assistant"){const bt=jt.findIndex(sn=>sn.kind==="result"&&String(sn.text||"").trim()===Fe.trim());bt>=0&&(jt=jt.filter((sn,Ft)=>Ft!==bt))}const Tt=[...jt],ct=Tt[Tt.length-1];return ct&&ct.kind===lt&&!ct.error?Tt[Tt.length-1]={...ct,text:`${ct.text||""}${ct.text?`
|
|
253
|
-
`:""}${Fe}`}:Tt.push({role:"assistant",kind:lt,text:Fe,...lt==="error"?{error:!0}:{},at:Date.now()}),{...rt,messages:Tt.slice(-160)}}))},sf=he=>{const Xe=String(he||"");Xe.trim()&&On(Fe=>Fe.map(lt=>{var Tt;if(lt.id!==J)return lt;const ye=Array.isArray(lt.messages)?lt.messages:[],rt=ye.findIndex(ct=>ct.kind==="thinking"),jt=[...ye];if(rt>=0){const ct=String(((Tt=jt[rt])==null?void 0:Tt.text)||"");jt[rt]={...jt[rt],text:`${ct}${ct&&!ct.endsWith(`
|
|
254
|
-
`),""}${Xe}`,at:Date.now()}}else{const ct=jt.findIndex(bt=>bt.kind==="activity");jt.splice(ct>=0?ct+1:jt.length,0,{role:"assistant",kind:"thinking",text:Xe,at:Date.now()})}return{...lt,messages:jt.slice(-160)}}))},no=(he,Xe=null)=>{const Fe=nq(he);Fe&&On(lt=>lt.map(ye=>{if(ye.id!==J)return ye;const rt=Number(Xe==null?void 0:Xe.ts)||Date.now(),jt=Number(ye.startedAt)||rt,Tt=Number(ye.lastActivityAt)||jt,ct=Math.max(0,rt-Tt),bt=Number.isFinite(Number(Xe==null?void 0:Xe.runElapsedMs))?Math.max(0,Number(Xe.runElapsedMs)):Math.max(0,rt-jt),sn=Array.isArray(ye.activities)?ye.activities:[],Ft=sn[sn.length-1],hn=(typeof Ft=="string"?Ft:String((Ft==null?void 0:Ft.text)||""))===Fe?sn:[...sn,{text:Fe,kind:sq(Fe),stepMs:ct,totalMs:bt,at:rt}].slice(-30),Rt=Array.isArray(ye.timingEntries)?ye.timingEntries:[],an=Array.isArray(ye.messages)?ye.messages:[],ro=an.findIndex(Js=>Js.kind==="activity"),_i={role:"assistant",kind:"activity",text:Wj(hn,Rt,jt,rt),at:Date.now()},Qn=[...an];if(ro>=0)Qn[ro]=_i;else{const Js=Qn.findIndex(so=>so.kind==="run-summary");Qn.splice(Js>=0?Js+1:0,0,_i)}return{...ye,activities:hn,lastActivityAt:rt,messages:Qn.slice(-160)}}))},Jv=he=>{const Xe=String((he==null?void 0:he.source)||"runner"),Fe=String((he==null?void 0:he.stream)||""),lt=String((he==null?void 0:he.eventType)||"event"),ye=String((he==null?void 0:he.text)||"").trim();if(!ye)return;const rt=`[${Xe}${Fe?`:${Fe}`:""}] ${lt}
|
|
255
|
-
${ye}`,jt=Mq(he);On(Tt=>Tt.map(ct=>{if(ct.id!==J)return ct;const sn=[...Array.isArray(ct.rawTrace)?ct.rawTrace:[],rt].slice(-80),Ft=Array.isArray(ct.timingEntries)?ct.timingEntries:[],Gt=jt?[...Ft,jt].slice(-80):Ft,hn=Array.isArray(ct.activities)?ct.activities:[],Rt=Number(ct.startedAt)||Number(he==null?void 0:he.ts)||Date.now(),an=Number(jt==null?void 0:jt.at)||Number(he==null?void 0:he.ts)||Date.now(),ro=Array.isArray(ct.messages)?ct.messages:[],_i={role:"assistant",kind:"raw",text:sn.join(`
|
|
256
|
-
|
|
257
|
-
---
|
|
258
|
-
|
|
259
|
-
`),at:Date.now()},Qn=[...ro],Js=Qn.findIndex(io=>io.kind==="activity");if(jt){const io={role:"assistant",kind:"activity",text:Wj(hn,Gt,Rt,an),at:Date.now()};if(Js>=0)Qn[Js]=io;else{const lf=Qn.findIndex(eg=>eg.kind==="run-summary");Qn.splice(lf>=0?lf+1:0,0,io)}}const so=Qn.findIndex(io=>io.kind==="raw");return so>=0?Qn[so]=_i:Qn.push(_i),{...ct,rawTrace:sn,timingEntries:Gt,messages:Qn.slice(-160)}}))},EM=he=>{On(Xe=>Xe.map(Fe=>Fe.id===J?{...Fe,status:he,endedAt:Date.now()}:Fe))},of=he=>{const Xe=new Set,Fe=String((he==null?void 0:he.nodeId)||"").trim();Fe&&Xe.add(Fe);for(const lt of Array.isArray(he==null?void 0:he.displayNodeIds)?he.displayNodeIds:[]){const ye=String(lt||"").trim();ye&&Xe.add(ye)}for(const lt of Array.isArray(he==null?void 0:he.touchedNodeIds)?he.touchedNodeIds:[]){const ye=String(lt||"").trim();ye&&Xe.add(ye)}if(Xe.size===0)for(const lt of Array.isArray(he==null?void 0:he.order)?he.order:[]){const ye=String(lt||"").trim();ye&&Xe.add(ye)}return Xe},af=(he,Xe=null)=>{const Fe=Uf(he||Y,ie),lt=new Map(Fe.nodes.map(ct=>[ct.id,ct])),ye=Fe.instances||{},rt=Xe instanceof Set?Xe:null,jt=(ct,bt)=>{const sn={...ct||bt};Array.isArray(bt==null?void 0:bt.output)&&(sn.output=bt.output);for(const Ft of["scriptRef","implementationRef","implementationMode"])(bt==null?void 0:bt[Ft])!=null&&String(bt[Ft]).trim()!==""&&(sn[Ft]=bt[Ft]);return sn},Tt=(ct,bt)=>{const sn={...ct||{}};Array.isArray(bt==null?void 0:bt.outputs)&&(sn.outputs=bt.outputs);for(const Ft of["scriptRef","implementationRef","implementationMode"])(bt==null?void 0:bt[Ft])!=null&&String(bt[Ft]).trim()!==""&&(sn[Ft]=bt[Ft]);return sn};h(ct=>{const bt=new Set(ct.map(Gt=>Gt.id)),Ft={...Yc(ct,y.current,_.current).instances||{}};for(const[Gt,hn]of Object.entries(ye)){if(rt&&!rt.has(Gt)||!bt.has(Gt))continue;const Rt=Ft[Gt];La((hn==null?void 0:hn.definitionId)||(Rt==null?void 0:Rt.definitionId))?Ft[Gt]=hn:Array.isArray(hn==null?void 0:hn.output)&&(Ft[Gt]=jt(Rt,hn))}return _.current=Ft,F(Ft),ct.map(Gt=>{var Rt,an;if(rt&&!rt.has(Gt.id))return Gt;const hn=lt.get(Gt.id);return hn?La(((Rt=hn.data)==null?void 0:Rt.definitionId)||((an=Gt.data)==null?void 0:an.definitionId))?{...Gt,data:{...Gt.data,...hn.data}}:{...Gt,data:Tt(Gt.data,hn.data)}:Gt})})};for(;;){const{value:he,done:Xe}=await Ie.read();if(Xe)break;Ze+=Lt.decode(he,{stream:!0});const Fe=Ze.split(`
|
|
260
|
-
`);Ze=Fe.pop()||"";for(const lt of Fe){if(!lt.trim())continue;const ye=JSON.parse(lt);if(ye.type==="error")throw new Error(ye.error||"Workspace run failed");if(ye.type==="stopped"){Cc.current.add(J),pt=Array.isArray(ye.order)?ye.order:pt,no("运行停止",ye);continue}if(ye.type==="node-start"&&(xe(`Running ${ye.nodeId}...`),Uv(ye.nodeId),Rc(ye.nodeId,ye.definitionId,"running")),ye.type==="node-done"){const rt=Ue.get(String(ye.nodeId||"").trim());rt&&Qm(ye.nodeId,rt),Yv(ye.nodeId),Rc(ye.nodeId,ye.definitionId,"done")}if(ye.type==="status"&&no(ye.line||ye.message||"",ye),ye.type==="paused"&&(Dt=Array.isArray(ye.nodeIds)?ye.nodeIds:[],no("运行暂停",ye)),ye.type==="natural"&&((ye.kind==="result"||/---agentflow\b|resultFile\s*:|\"resultFile\"\s*:|\"result\"\s*:/i.test(String(ye.text||"")))&&ye.nodeId&&Ue.set(String(ye.nodeId||"").trim(),String(ye.text||"")),ye.kind==="thinking"?sf(ye.text||""):Gv(ye.kind,ye.text||"")),ye.type==="raw"){const rt=Vj(ye);rt&&sf(rt),Jv(ye)}if(ye.type==="graph"&&ye.graph){const rt=of(ye);af(ye.graph,rt),rf(ye.graph,rt)}if(ye.type==="done"){if(ye.graph){const rt=of(ye);af(ye.graph,rt),rf(ye.graph,rt)}pt=Array.isArray(ye.order)?ye.order:[],Dt=Array.isArray(ye.pauseNodeIds)?ye.pauseNodeIds:Dt,no(Dt.length?"运行暂停":"运行完成",ye)}}}if(Ze.trim()){const he=JSON.parse(Ze);if(he.type==="error")throw new Error(he.error||"Workspace run failed");if(he.type==="stopped"&&(Cc.current.add(J),no("运行停止",he)),he.type==="node-start"&&(xe(`Running ${he.nodeId}...`),Uv(he.nodeId),Rc(he.nodeId,he.definitionId,"running")),he.type==="node-done"){const Xe=Ue.get(String(he.nodeId||"").trim());Xe&&Qm(he.nodeId,Xe),Yv(he.nodeId),Rc(he.nodeId,he.definitionId,"done")}if(he.type==="status"&&no(he.line||he.message||"",he),he.type==="paused"&&(Dt=Array.isArray(he.nodeIds)?he.nodeIds:[],no("运行暂停",he)),he.type==="natural"&&((he.kind==="result"||/---agentflow\b|resultFile\s*:|\"resultFile\"\s*:|\"result\"\s*:/i.test(String(he.text||"")))&&he.nodeId&&Ue.set(String(he.nodeId||"").trim(),String(he.text||"")),he.kind==="thinking"?sf(he.text||""):Gv(he.kind,he.text||"")),he.type==="raw"){const Xe=Vj(he);Xe&&sf(Xe),Jv(he)}if(he.type==="graph"&&he.graph){const Xe=of(he);af(he.graph,Xe),rf(he.graph,Xe)}if(he.type==="done"){if(he.graph){const Xe=of(he);af(he.graph,Xe),rf(he.graph,Xe)}pt=Array.isArray(he.order)?he.order:[],Dt=Array.isArray(he.pauseNodeIds)?he.pauseNodeIds:Dt,no(Dt.length?"运行暂停":"运行完成",he)}}We()&&(Oe(be),Bt(be,"stopped"));const Zm=We()?`Workspace run stopped: ${b}`:Dt.length?`Workspace run paused at ${Dt.join(", ")}`:`Workspace run done: ${pt.length?pt.join(" -> "):b}`;if(xe(Zm),We()||Bt(be,Dt.length?"paused":"success"),EM(We()?"stopped":Dt.length?"paused":"done"),!We()){try{await qt(w.current,y.current),xe(Zm)}catch(he){xe(`${Zm},但保存结果失败:${String(he.message||he)}`)}await Pn()}}catch(tt){if(We()||(tt==null?void 0:tt.name)==="AbortError"){Oe(be),Bt(be,"stopped"),xe(`Workspace run stopped: ${b}`),On(Ge=>Ge.map(Ie=>Ie.id===J?{...Ie,status:"stopped",endedAt:Date.now()}:Ie));return}Oe(be),Bt([b,Le].filter(Boolean),"failed"),xe(String(tt.message||tt)),On(Ge=>Ge.map(Ie=>Ie.id===J?{...Ie,status:"failed",endedAt:Date.now(),messages:[...Array.isArray(Ie.messages)?Ie.messages:[],{role:"assistant",error:!0,text:String(tt.message||tt),at:Date.now()}].slice(-160)}:Ie))}finally{jc.current.get(J)===st&&jc.current.delete(J),Ni(tt=>{const Ge={...tt};return delete Ge[J],Ge}),Cc.current.delete(J),Oe(be)}},[vi,g,i,Pn,f,ie,Zi,qt,js,k,h,Ni,s,ae]),Vd=m.useCallback(async()=>{try{const S=await(await fetch("/api/skills")).json().catch(()=>({})),A=Array.isArray(S.skills)?S.skills.map(M=>({key:String(M.key),name:String(M.name||M.id||M.key),description:M.description?String(M.description):"",sourceLabel:M.sourceLabel?String(M.sourceLabel):""})):[];hR(A),Ek(!0)}catch{Ek(!0)}},[]),Kd=m.useCallback(async()=>{try{const S=await(await fetch("/api/mcps")).json().catch(()=>({})),A=Array.isArray(S.servers)?S.servers.map(M=>({name:String((M==null?void 0:M.name)||""),type:String((M==null?void 0:M.type)||""),url:String((M==null?void 0:M.url)||""),command:String((M==null?void 0:M.command)||""),args:Array.isArray(M==null?void 0:M.args)?M.args.map(String):[],description:String((M==null?void 0:M.description)||"")})).filter(M=>M.name):[];Ik(A)}catch{Ik([])}},[]),qd=m.useCallback(async()=>{try{const b=$r(i),A=await(await fetch(`/api/workspaces?${b.toString()}`)).json().catch(()=>({})),M=Array.isArray(A.workspaces)?A.workspaces.map(H=>({id:String((H==null?void 0:H.id)||""),label:String((H==null?void 0:H.label)||(H==null?void 0:H.name)||"知识库"),path:String((H==null?void 0:H.path)||""),kind:(H==null?void 0:H.kind)==="git"?"git":"local",repoUrl:String((H==null?void 0:H.repoUrl)||""),branch:String((H==null?void 0:H.branch)||""),mountPath:String((H==null?void 0:H.mountPath)||""),type:String((H==null?void 0:H.type)||""),builtin:(H==null?void 0:H.builtin)===!0,exists:(H==null?void 0:H.exists)!==!1})).filter(H=>H.path):[];Rk(M)}catch{Rk([])}},[i]),fv=m.useCallback(async()=>{T.current=!1;try{const b=$r(i),S=await fetch(`/api/workspace/conversations?${b.toString()}`),A=await S.json().catch(()=>({}));if(!S.ok)throw new Error(A.error||`HTTP ${S.status}`);const M=Oj(A.conversations||{});Va(M.composer.messages),On(M.composer.runSessions),ds(M.composer.activeSessionId||"workspace"),eo(M.nodeChats)}catch{Va([]),On([]),ds("workspace"),eo({})}finally{T.current=!0}},[i]),pv=m.useCallback(async()=>{if(!ae||i.archived)return;const b=Oj({composer:{activeSessionId:Tr,messages:Jo,runSessions:Cs},nodeChats:Xo});await fetch("/api/workspace/conversations",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,conversations:b})}).then(async S=>{if(!S.ok){const A=await S.json().catch(()=>({}));throw new Error(A.error||`HTTP ${S.status}`)}})},[Tr,Jo,Cs,i,Xo,ae]);m.useEffect(()=>{Ja().catch(b=>xe(String(b.message||b))),fv(),Bd(),fetch("/api/model-lists").then(b=>b.json()).then(b=>fR({cursor:Array.isArray(b.cursor)?b.cursor.map(String):[],opencode:Array.isArray(b.opencode)?b.opencode.map(String):[],claudeCode:Array.isArray(b.claudeCode)?b.claudeCode.map(String):[],codex:Array.isArray(b.codex)?b.codex.map(String):[]})).catch(()=>{}),Vd(),Kd(),qd(),uv(),fetch("/api/skill-collections").then(b=>b.json()).then(b=>{mR(ya(b)),gR(!0)}).catch(()=>{}),fetch("/api/auth/me").then(b=>b.json()).then(b=>{qk(b.user||null),Yk(!0)}).catch(()=>{qk(null),Yk(!0)})},[Ja,fv,Bd,Kd,Vd,uv,qd,Si]),m.useEffect(()=>{if(rv(""),!(!_k||!Ak)){if(!Si){xc([]);return}xc(vO(Si,"workspace",Ns,Ha)),rv(Si)}},[Ha,Ak,Ns,_k,Si]),m.useEffect(()=>{if(!(nv!==Si||!Si))try{localStorage.setItem(Si,JSON.stringify(js))}catch{}},[js,Si,nv]),m.useEffect(()=>{_.current=I},[I]),m.useEffect(()=>{w.current=f},[f]),m.useEffect(()=>{const b=W.current,S=new Map,A=[];for(const Y of f){const J=JI(Y);S.set(Y.id,J),b.get(Y.id)!==J&&A.push(Y.id)}if(W.current=S,A.length===0)return;const M=()=>A.forEach(Y=>s(Y)),H=window.requestAnimationFrame(M),U=window.setTimeout(M,80);return()=>{window.cancelAnimationFrame(H),window.clearTimeout(U)}},[f,s]),m.useEffect(()=>{y.current=g},[g]),m.useEffect(()=>{N.current=x},[x]),m.useEffect(()=>{P.current=j},[j]),m.useEffect(()=>{dr.current=Ke},[Ke]),m.useEffect(()=>{Yt.current=nt},[nt]),m.useEffect(()=>{K.current=D},[D]),m.useEffect(()=>{if(!D)return;const b=A=>{A.key==="Escape"&&$(null)},S=A=>{var M,H;(H=(M=A.target)==null?void 0:M.closest)!=null&&H.call(M,".af-connect-node-menu")||$(null)};return document.addEventListener("keydown",b),document.addEventListener("pointerdown",S),()=>{document.removeEventListener("keydown",b),document.removeEventListener("pointerdown",S)}},[D]),m.useEffect(()=>{if(X.current&&ae)return V.current&&window.clearTimeout(V.current),V.current=window.setTimeout(()=>{qt().catch(b=>xe(String(b.message||b)))},650),()=>{V.current&&window.clearTimeout(V.current)}},[f,g,x,qt,ae]),m.useEffect(()=>{if(T.current&&!(!ae||i.archived))return ee.current&&window.clearTimeout(ee.current),ee.current=window.setTimeout(()=>{pv().catch(b=>xe(String(b.message||b)))},900),()=>{ee.current&&window.clearTimeout(ee.current)}},[Tr,Jo,Cs,i.archived,Xo,pv,ae]);const _c=m.useMemo(()=>f.filter(b=>{var S;return((S=b==null?void 0:b.data)==null?void 0:S.definitionId)==="workspace_scheduled_run"}).map(b=>{var S;return{id:b.id,config:uk(((S=b.data)==null?void 0:S.body)||"")}}),[f]),LR=m.useMemo(()=>_c.map(b=>`${b.id}:${b.config.enabled?"1":"0"}:${b.config.cron}:${b.config.timezone}`).join("|"),[_c]);m.useEffect(()=>{if(!X.current||a!=="workspace"||!i.flowId){Qo({});return}if(!_c.length){Qo({});return}let b=!1;const S=async()=>{try{const M=$r(i),H=await fetch(`/api/workspace/schedules?${M.toString()}`),U=await H.json().catch(()=>({}));if(!H.ok)throw new Error(U.error||"读取 Workspace 定时状态失败");b||Qo(qf(U.schedules||[]))}catch{b||Qo(M=>{var U;const H={};for(const Y of _c)H[Y.id]={...M[Y.id]||{},lastStatus:((U=M[Y.id])==null?void 0:U.lastStatus)||"unknown"};return H})}};S();const A=window.setInterval(S,5e3);return()=>{b=!0,window.clearInterval(A)}},[i,_c,LR,a]);const hv=m.useCallback((b,S)=>{if(!ae){xe("Readonly workspace");return}const A=s1(S),M=Q=>Array.isArray(Q)?Q.map(ue=>(ue==null?void 0:ue.name)!=="skillKeys"&&(ue==null?void 0:ue.name)!=="skillsContext"&&(ue==null?void 0:ue.type)!=="text"?ue:{...ue,default:A,value:A}):[],H=f.map(Q=>{var ue;return Q.id!==b?Q:{...Q,data:{...Q.data,body:A,inputs:M((ue=Q.data)==null?void 0:ue.inputs)}}}),U=_.current||{},Y=U[b]&&typeof U[b]=="object"?U[b]:{},J={...U,[b]:{...Y,body:A,input:M(Y.input)}};_.current=J,h(H),F(J),Re(Q=>!Q||Q.id!==b?Q:{...Q,body:A,inputs:M(Q.inputs)}),qt(H,g).catch(Q=>xe(String(Q.message||Q)))},[g,f,qt,h,ae]),mv=m.useCallback((b,S)=>{if(!ae){xe("Readonly workspace");return}const A=WU(S),M=Q=>Array.isArray(Q)?Q.map(ue=>(ue==null?void 0:ue.name)!=="serverNames"&&(ue==null?void 0:ue.name)!=="mcpContext"&&(ue==null?void 0:ue.type)!=="text"?ue:{...ue,default:A,value:A}):[],H=f.map(Q=>{var ue;return Q.id!==b?Q:{...Q,data:{...Q.data,body:A,inputs:M((ue=Q.data)==null?void 0:ue.inputs)}}}),U=_.current||{},Y=U[b]&&typeof U[b]=="object"?U[b]:{},J={...U,[b]:{...Y,body:A,input:M(Y.input)}};_.current=J,h(H),F(J),Re(Q=>!Q||Q.id!==b?Q:{...Q,body:A,inputs:M(Q.inputs)}),qt(H,g).catch(Q=>xe(String(Q.message||Q)))},[g,f,qt,h,ae]),gv=m.useCallback((b,S)=>{if(!ae){xe("Readonly workspace");return}const A=(Array.isArray(S)?S:S?[S]:[]).filter(Le=>String((Le==null?void 0:Le.path)||"").trim()),M=A[0]||null,H=String((M==null?void 0:M.path)||"").trim(),U=A.length===1?String((M==null?void 0:M.label)||(M==null?void 0:M.id)||"知识库").trim():A.length?`${A.length} 个知识库`:"",Y=A.length?JSON.stringify(wm(A)):"",J=M?JSON.stringify({version:1,id:(M==null?void 0:M.id)||"",label:String((M==null?void 0:M.label)||(M==null?void 0:M.id)||"知识库").trim(),kind:(M==null?void 0:M.kind)||"local",cwd:H,workspaceRoot:H,repoUrl:(M==null?void 0:M.repoUrl)||"",branch:(M==null?void 0:M.branch)||"",mountPath:(M==null?void 0:M.mountPath)||"",type:(M==null?void 0:M.type)||""}):"",Q=Le=>Array.isArray(Le)?Le.map(Ue=>(Ue==null?void 0:Ue.name)==="path"?{...Ue,default:H,value:H}:(Ue==null?void 0:Ue.name)==="label"?{...Ue,default:U,value:U}:(Ue==null?void 0:Ue.name)==="knowledgeContext"?{...Ue,default:Y,value:Y}:(Ue==null?void 0:Ue.name)==="workspaceContext"?{...Ue,default:J,value:J}:(Ue==null?void 0:Ue.name)==="mode"?{...Ue,default:"set",value:"set"}:Ue):[],ue=Le=>Array.isArray(Le)?Le.map(Ue=>(Ue==null?void 0:Ue.name)==="knowledgeContext"?{...Ue,default:Y,value:Y}:(Ue==null?void 0:Ue.name)==="workspaceContext"?{...Ue,default:J,value:J,showOnNode:!1}:(Ue==null?void 0:Ue.name)==="cwd"?{...Ue,default:H,value:H,showOnNode:!1}:Ue):[],be=f.map(Le=>{var Ue,We,Oe;return Le.id===b?{...Le,data:{...Le.data,label:((Ue=Le.data)==null?void 0:Ue.label)||"加载知识库",inputs:Q((We=Le.data)==null?void 0:We.inputs),outputs:ue((Oe=Le.data)==null?void 0:Oe.outputs)}}:Le}),ge=_.current||{},Ee=ge[b]&&typeof ge[b]=="object"?ge[b]:{},st={...ge,[b]:{...Ee,label:Ee.label||"加载知识库",input:Q(Ee.input),output:ue(Ee.output)}};_.current=st,h(be),F(st),Re(Le=>(Le==null?void 0:Le.id)===b?{...Le,inputs:Q(Le.inputs),outputs:ue(Le.outputs)}:Le),qt(be,g).catch(Le=>xe(String(Le.message||Le)))},[g,f,qt,h,ae]),yv=m.useCallback((b,S)=>{if(!ae){xe("Readonly workspace");return}const A=String(b||"");if(!A)return;const M=s1((S==null?void 0:S.skillKeys)||[]),H=Ed((S==null?void 0:S.displayType)||"markdown"),U=String((S==null?void 0:S.model)||"").trim(),Y=(S==null?void 0:S.includeWorkspaceContext)===!1?"false":"true",J=S!=null&&S.workspaceContext&&typeof S.workspaceContext=="object"?JSON.stringify(S.workspaceContext):"",Q=S!=null&&S.knowledgeContext&&typeof S.knowledgeContext=="object"?JSON.stringify(S.knowledgeContext):"",ue=We=>Array.isArray(We)?We.map(Oe=>(Oe==null?void 0:Oe.name)==="skillKeys"?{...Oe,default:M,value:M}:(Oe==null?void 0:Oe.name)==="displayType"?{...Oe,default:H,value:H}:(Oe==null?void 0:Oe.name)==="includeWorkspaceContext"?{...Oe,default:Y,value:Y}:(Oe==null?void 0:Oe.name)==="knowledgeContext"?{...Oe,default:Q,value:Q}:(Oe==null?void 0:Oe.name)==="workspaceContext"?{...Oe,default:J,value:J}:Oe):[],be=We=>Array.isArray(We)?We.map(Oe=>(Oe==null?void 0:Oe.name)==="displayType"?{...Oe,default:H,value:H}:Oe):[],ge=String((S==null?void 0:S.task)??""),Ee=f.map(We=>{var Oe,Bt;return We.id===A?{...We,data:{...We.data,body:ge,model:U,inputs:ue((Oe=We.data)==null?void 0:Oe.inputs),outputs:be((Bt=We.data)==null?void 0:Bt.outputs)}}:We}),st=_.current||{},Le=st[A]&&typeof st[A]=="object"?st[A]:{},Ue={...st,[A]:{...Le,body:ge,model:U,input:ue(Le.input),output:be(Le.output)}};_.current=Ue,h(Ee),F(Ue),Re(We=>(We==null?void 0:We.id)===A?{...We,body:ge,model:U,inputs:ue(We.inputs),outputs:be(We.outputs)}:We),qt(Ee,g).catch(We=>xe(String(We.message||We)))},[g,f,qt,h,ae]),xv=m.useCallback((b,S)=>{if(!ae){xe("Readonly workspace");return}const A=Vq(S),M=f.map(J=>J.id===b?{...J,data:{...J.data,body:A}}:J),H=_.current||{},U=H[b]&&typeof H[b]=="object"?H[b]:{},Y={...H,[b]:{...U,body:A}};_.current=Y,h(M),F(Y),Re(J=>(J==null?void 0:J.id)===b?{...J,body:A}:J),qt(M,g).catch(J=>xe(String(J.message||J)))},[g,f,qt,h,ae]),wv=m.useCallback(b=>{const S=String(b||"").trim();S&&(Kk(A=>A===S?"":S),eo(A=>({...A,[S]:A[S]||{sessionId:`nodechat_${Date.now()}_${S.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[],draft:"",candidateContent:"",running:!1,error:""}})))},[]),bv=m.useCallback(()=>Kk(""),[]),kv=m.useCallback((b,S)=>{const A=String(b||"").trim();A&&eo(M=>({...M,[A]:{...M[A]||{sessionId:`nodechat_${Date.now()}_${A.replace(/[^a-z0-9_-]+/gi,"_")}`,messages:[]},draft:String(S||""),error:""}}))},[]),_s=m.useCallback((b,S,A="replace",M={})=>{var tt,Ge;if(!ae){xe("Readonly workspace");return}const H=String(b||"").trim();if(!H)return;const U=w.current.find(Ie=>Ie.id===H),Y=kn(U==null?void 0:U.data),J=Ws((tt=U==null?void 0:U.data)==null?void 0:tt.definitionId),Q=pi(S),ue=Y==="html"?fc(Q):Y==="react"?gm(Q):String(Q||""),be=U?Hi(U.data):"",ge=A==="append"&&String(be||"").trim()?`${String(be).replace(/\s+$/g,"")}
|
|
261
|
-
|
|
262
|
-
${ue.trim()}`:ue,Ee=Y==="image"?"src":"content",st=M!=null&&M.reloadDisplay?Date.now():(Ge=U==null?void 0:U.data)==null?void 0:Ge.displayReloadKey,Le=Ie=>{let Lt=!1;return(Array.isArray(Ie)?Ie:[]).map(pt=>{const Dt=String((pt==null?void 0:pt.name)||""),Xm=String((pt==null?void 0:pt.type)||"");return(J?Dt===Ee||Dt==="result"||Dt==="filePath":Dt===Ee||Dt==="filePath"||Xm==="text")?Lt?{...pt,default:"",value:""}:(Lt=!0,{...pt,default:ge,value:ge}):pt})},Ue=w.current.map(Ie=>{var Lt,Ze;return Ie.id!==H?Ie:{...Ie,data:{...Ie.data,body:J?Ie.data.body:ge,...st?{displayReloadKey:st}:{},inputs:Le((Lt=Ie.data)==null?void 0:Lt.inputs),outputs:Le((Ze=Ie.data)==null?void 0:Ze.outputs)}}}),We=_.current||{},Oe=We[H]&&typeof We[H]=="object"?We[H]:{},Bt={...We,[H]:{...Oe,body:J?Oe.body:ge,input:Le(Oe.input),output:Le(Oe.output)}};_.current=Bt,h(Ue),F(Bt),Re(Ie=>(Ie==null?void 0:Ie.id)===H?{...Ie,...J?{}:{body:ge}}:Ie),(M==null?void 0:M.logChat)!==!1&&eo(Ie=>{var Lt;return{...Ie,[H]:{...Ie[H]||{},candidateContent:"",messages:[...(Lt=Ie[H])!=null&&Lt.messages&&Array.isArray(Ie[H].messages)?Ie[H].messages:[],{role:"assistant",text:A==="append"?"已追加到当前节点内容。":"已替换当前节点内容。",at:Date.now()}]}}}),qt(Ue,y.current).catch(Ie=>xe(String(Ie.message||Ie))),xe(String((M==null?void 0:M.statusMessage)||"")||(A==="append"?"已追加节点内容":"已替换节点内容"))},[qt,h,ae]),Ud=m.useCallback(async(b,S="")=>{if(!ae)return xe("Readonly workspace"),"";if(!b)return"";try{const A=new FormData;A.set("file",b),A.set("dir",String(S||"")),i.flowId&&A.set("flowId",i.flowId),i.flowSource&&A.set("flowSource",i.flowSource),i.archived&&A.set("archived","1");const M=await fetch("/api/workspace/upload",{method:"POST",body:A}),H=await M.json().catch(()=>({}));if(!M.ok)throw new Error(H.error||"上传文件失败");const U=String(H.path||"").trim();if(!U)throw new Error("上传文件失败:未返回路径");return await Pn(),nn(Y=>{const J=new Set(Y);for(const Q of Yf(U))J.delete(Q);return J}),xe(`已上传 ${U}`),U}catch(A){return xe(String(A.message||A)),""}},[i,Pn,ae]),Yd=m.useCallback(async b=>yh(b)?Ud(b,"img"):(xe("请选择图片文件"),""),[Ud]),vv=m.useCallback((b="")=>{var S;if(!ae){xe("Readonly workspace");return}Jn.current=String(b||""),(S=It.current)==null||S.click()},[ae]),OR=m.useCallback(async b=>{const S=Array.from(b.target.files||[]);if(b.target.value="",!S.length)return;const A=Jn.current||"";qe(!0);try{let M="";for(const H of S){const U=await Ud(H,A);U&&(M=U)}S.length>1&&xe(`已上传 ${S.length} 个文件${M?`,最后一个:${M}`:""}`)}catch(M){xe(String(M.message||M))}finally{qe(!1)}},[Ud]),Sv=m.useCallback(async(b,S)=>{const A=String(b||"").trim();if(!A)return;const M=await Yd(S);M&&_s(A,M,"replace",{logChat:!1,statusMessage:`已上传图片 ${M}`})},[_s,Yd]),Nv=m.useCallback(async(b,S=void 0)=>{var Le,Ue;if(!ae){xe("Readonly workspace");return}const A=String(b||"").trim();if(!A)return;const M=Xo[A]||{},H=String(S!==void 0?S:M.draft||"").trim();if(!H||M.running)return;const U=w.current.find(We=>We.id===A);if(!U)return;const Y=kn(U.data)||"markdown",J=Hi(U.data);let Q=Lo(J,Y),ue=pi(J);if(Q)try{ue=await Oa(i,Q)}catch(We){xe(String(We.message||We))}else if(Y!=="image"&&String(ue||"").trim()){const We=ha(Y,ue);if(We){xe(`${We} 未进入微调。`);return}try{const Oe=await cw(i,n1(A,U.data),ue);await Pn(),_s(A,Oe,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已将展示保存为 ${Oe}`}),Q=Oe,ue=""}catch(Oe){xe(String(Oe.message||Oe));return}}const be=aU(A,w.current,y.current),ge={role:"user",text:H,at:Date.now()},Ee=Array.isArray(M.messages)?M.messages:[],st=M.sessionId||`nodechat_${Date.now()}_${A.replace(/[^a-z0-9_-]+/gi,"_")}`;eo(We=>({...We,[A]:{...M,sessionId:st,messages:[...Ee,ge],draft:"",running:!0,error:""}}));try{const We=await fetch("/api/workspace/node-chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,sessionId:st,node:{id:A,label:((Le=U.data)==null?void 0:Le.label)||A,definitionId:((Ue=U.data)==null?void 0:Ue.definitionId)||""},nodeKind:Y,currentContent:Q?"":ue,sourceContext:be,targetFilePath:Q,messages:Ee,message:H,model:vi})}),Oe=await We.json().catch(()=>({}));if(!We.ok)throw new Error(Oe.error||"节点微调失败");const Bt=String(Oe.candidateContent||Oe.reply||"").trim(),tt=!!Oe.directFileEdit,Ge=String(Oe.artifactPath||Q||"").trim();if(tt&&Ge){const Ie=ha(Y,Bt);if(Ie)throw new Error(`${Ie} 文件已由 agent 修改,请检查 ${Ge}。`);await Pn(),_s(A,Ge,"replace",{logChat:!1,reloadDisplay:!0,statusMessage:`已按微调描述更新 ${Ge}`})}else if(Bt){const Ie=ha(Y,Bt);if(Ie)throw new Error(`${Ie} 已取消写入,避免覆盖当前展示文件。`);if(Q){const Lt=await cw(i,Q,Bt);await Pn(),_s(A,Lt,"replace",{logChat:!1,statusMessage:`已按微调描述更新 ${Lt}`})}else _s(A,Bt,"replace",{logChat:!1,statusMessage:"已按微调描述更新展示内容"})}eo(Ie=>{var Lt;return{...Ie,[A]:{...Ie[A]||{},sessionId:String(Oe.sessionId||st),running:!1,candidateContent:"",messages:[...(Lt=Ie[A])!=null&&Lt.messages&&Array.isArray(Ie[A].messages)?Ie[A].messages:[...Ee,ge],{role:"assistant",text:Bt||tt?Ge?`已更新文件 ${Ge}。`:"已按你的描述更新当前展示。":"没有生成可更新的内容。",at:Date.now()}]}}})}catch(We){const Oe=String(We.message||We);eo(Bt=>({...Bt,[A]:{...Bt[A]||{},running:!1,error:Oe}})),xe(Oe)}},[vi,i,Pn,Xo,_s,ae]),jv=m.useCallback(async(b,S)=>{if(!ae){xe("Readonly workspace");return}const A=kn(S)||"markdown",M=Hi(S),H=Lo(M,A);let U=pi(M);if(H)try{U=await Oa(i,H)}catch(ue){xe(String(ue.message||ue));return}if(!String(U||"").trim()){xe("展示节点没有可保存内容");return}const Y=ha(A,U);if(Y){xe(`${Y} 未保存文件。`);return}const J=n1(b,S),Q=window.prompt("保存到 workspace 相对路径",J);if(Q)try{const ue=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:Q,content:U})}),be=await ue.json().catch(()=>({}));if(!ue.ok)throw new Error(be.error||"保存文件失败");const ge=be.path||Q,Ee=$r(i);Ee.set("path",ge);const st=await fetch(`/api/workspace/file?${Ee.toString()}`);if(!st.ok){const Le=await st.json().catch(()=>({}));throw new Error(Le.error||`保存后读取失败:${ge}`)}await Pn(),Ss(Le=>MU(Le,ge,String(U||"").length)),nn(Le=>{const Ue=new Set(Le);for(const We of Yf(ge))Ue.delete(We);return Ue}),_s(b,ge,"replace",{logChat:!1,statusMessage:`已保存并引用 ${ge}`}),xe(`已保存 ${ge}`)}catch(ue){xe(String(ue.message||ue))}},[i,Pn,_s,ae]),Cv=m.useCallback(b=>{var H,U;const S=String(b||"").trim();if(!S||Me)return;const A=w.current.find(Y=>Y.id===S);if(!A||!kn(A==null?void 0:A.data)){xe("展示节点不可用");return}const M=String(((H=A.data)==null?void 0:H.label)||((U=A.data)==null?void 0:U.displayName)||S).trim()||"AgentFlow Display";Ce(cy({title:M,layout:"single",nodeIds:[S],mode:"single-node",sourceNodeId:S})),zt(""),fn(null),Qe(!0)},[Me]),Gd=m.useCallback((b,S)=>{const A=String(b||"");A&&Re(M=>{if(!M||M.id!==A)return M;const H=typeof S=="function"?S(M):S;return!H||typeof H!="object"?M:{...M,...H}})},[]),_v=m.useCallback((b,S)=>{const A=String(b||"");!A||!ae||(h(M=>M.map(H=>{var Y;if(H.id!==A)return H;const U=Array.isArray((Y=H.data)==null?void 0:Y.outputs)&&H.data.outputs.length?H.data.outputs.map((J,Q)=>Q===0?{...J,default:S,value:S}:J):[{type:"file",name:"value",default:S,value:S}];return{...H,data:{...H.data,body:"",outputs:U}}})),Gd(A,M=>({body:"",outputs:Array.isArray(M==null?void 0:M.outputs)&&M.outputs.length?M.outputs.map((U,Y)=>Y===0?{...U,default:S,value:S}:U):[{type:"file",name:"value",default:S,value:S}]})),xe(`已选择文件 ${S}`))},[h,Gd,ae]),Ev=m.useCallback(b=>{Pe({nodeId:String(b||""),query:""})},[]),zm=m.useCallback(()=>{Pe({nodeId:"",query:""})},[]),DR=m.useCallback(b=>{const S=String((b==null?void 0:b.path)||"").trim();!S||!pe.nodeId||(_v(pe.nodeId,S),zm())},[zm,pe.nodeId,_v]),Av=m.useCallback(async(b,S)=>{if(!ae)return;const A=SU(b,S);if(A.length===0)return;const M=[];try{for(const H of A){const U=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:H})});if(U.status===404)continue;const Y=await U.json().catch(()=>({}));if(!U.ok)throw new Error(Y.error||"清理节点输出失败");M.push(Y.path||H)}if(M.length===0)return;xe(`已清理 ${M.join(", ")}`),await Pn(),q(H=>A.some(U=>H===U||H.startsWith(`${U}/`))?"":H)}catch(H){xe(String(H.message||H))}},[i,Pn,ae]),Jd=m.useMemo(()=>({modelLists:Yo,showBodyPreview:!0,flowParams:i,readOnly:!ae,onRunWorkspaceNode:dv,onStopWorkspaceNode:cv,onOpenWorkspaceRunLogs:lv,onOptimizeWorkspaceRun:Fm,onOptimizeWorkspaceSchedule:Fm,runningRunNodeIds:sv,onChangeScheduledRunConfig:xv,onChangeContextRunConfig:yv,skills:Ns,skillCollections:Ha,onChangeLoadSkillKeys:hv,onRefreshSkills:Vd,mcpServers:Pk,onChangeLoadMcpNames:mv,onRefreshMcps:Kd,workspaceTargets:Tk,onChangeLoadWorkspace:gv,onRefreshWorkspaces:qd,onSaveDisplayNodeToFile:jv,onShareDisplayNode:Cv,onOpenDisplayPreview:Qt,onRefreshNodeInternals:Zi,onEnsureWorkspaceNodeDisplaySize:Dk,sharingDisplayNodeId:Me,onUploadWorkspaceImage:Yd,onUploadImageToDisplayNode:Sv,onOpenProvideFilePicker:Ev,onStatus:xe,onSetDisplayNodeContent:_s,onToggleNodeChat:wv,onCloseNodeChat:bv,onUpdateNodeChatDraft:kv,onSendNodeChat:Nv,onSyncNodePropDraft:Gd,onCleanupWorkspaceNodeOutputs:Av}),[yv,mv,hv,gv,xv,Av,bv,Dk,i,Pk,Yo,Ev,lv,Fm,Kd,Zi,Vd,qd,dv,sv,jv,Nv,_s,Cv,Me,Ha,Ns,cv,Gd,wv,kv,Sv,Yd,Tk,ae]),FR=m.useRef(new Map),Es=m.useMemo(()=>{const b=FR.current,S=new Set,A=f.map(M=>{var J,Q;const H={selected:M.selected===!0,isExecuting:Zk.has(M.id),nodeStatus:((J=Dm[M.id])==null?void 0:J.status)??null,nodeElapsed:((Q=Dm[M.id])==null?void 0:Q.elapsed)??null,optimizingRun:ev===M.id,scheduledRunState:Qk[M.id]||null,nodeChatActive:Vk===M.id,nodeChat:Xo[M.id]||null},U=b.get(M.id);if(U&&U.source===M&&U.commonData===Jd&&Jq(U.runtime,H))return S.add(M.id),U.node;const Y={...M,data:{...M.data,...Jd,...H}};return b.set(M.id,{source:M,commonData:Jd,runtime:H,node:Y}),S.add(M.id),Y});for(const M of b.keys())S.has(M)||b.delete(M);return A},[Vk,Jd,Xo,f,ev,Qk,Zk,Dm]),Bm=m.useMemo(()=>new Map(Es.map(b=>[b.id,b])),[Es]),Pv=vr?Bm.get(vr):null,Ec=m.useMemo(()=>{const b=new Set(O);return x.nodeIds.map((S,A)=>{const M=Bm.get(S);if(!M||!kn(M.data))return null;const H=fl(M)||{width:520,height:320},U=ba(x.nodeSizes[S]||H,{display:!0})||H,Y=x.nodePositions[S]||{x:180+A*36,y:120+A*28};return{...M,id:Gj(S),position:Y,selected:b.has(S),width:U.width,height:U.height,data:{...M.data,sourceNodeId:S,displayPageMode:!0,readOnly:!0,selected:b.has(S),displaySize:U,nodeSize:U}}}).filter(Boolean)},[x,Bm,O]),Qa=m.useMemo(()=>Es.filter(b=>kn(b==null?void 0:b.data)),[Es]),ut=a==="display",In=a==="workflow";m.useEffect(()=>{if(!ut||!x.viewport)return;const b=x.viewport,S=()=>{try{r.setViewport(b,{duration:0})}catch{}},A=window.requestAnimationFrame(()=>window.requestAnimationFrame(S));return()=>window.cancelAnimationFrame(A)},[x.viewport,ut,r]),m.useEffect(()=>{if(ut||In||!j)return;const b=j,S=()=>{try{r.setViewport(b,{duration:0})}catch{}},A=window.requestAnimationFrame(()=>window.requestAnimationFrame(S));return()=>window.cancelAnimationFrame(A)},[ut,In,r,j]),m.useEffect(()=>{In&&Wd(ir)},[In]),m.useEffect(()=>{if(!In||!ir)return;const b=$r(i);b.set("tapdId",ir);const S=new EventSource(`/api/prd-workflow/events?${b.toString()}`);return S.onmessage=()=>{Wd(ir)},S.onerror=()=>{S.close()},()=>S.close()},[i,In,Wd,ir]),m.useEffect(()=>{const b=z.current,S=new Map,A=[];for(const Y of[...Es,...Ec]){const J=Gq(Y);S.set(Y.id,J),b.get(Y.id)!==J&&A.push(Y.id)}if(z.current=S,A.length===0)return;const M=()=>A.forEach(Y=>s(Y)),H=window.requestAnimationFrame(M),U=window.setTimeout(M,80);return()=>{window.cancelAnimationFrame(H),window.clearTimeout(U)}},[Ec,Es,s]);const tn=m.useMemo(()=>f.find(b=>b.id===nt)||null,[f,nt]),Hm=m.useRef({id:"",draft:null}),zR=m.useMemo(()=>{const b=l1(tn);return b?JSON.stringify(b):""},[tn]);m.useEffect(()=>{if(!tn){Hm.current={id:"",draft:null},Re(null),Kr("");return}const b=l1(tn),S=Hm.current;Hm.current={id:tn.id,draft:b},Re(A=>!A||A.id!==tn.id||S.id!==tn.id||!S.draft?b:UU(A,S.draft,b)),Kr("")},[tn==null?void 0:tn.id,zR]);const Wm=m.useCallback((b=!1)=>{if(!Ke||!tn)return!1;if(!ae)return Kr("Readonly workspace"),xe("Readonly workspace"),!1;Kr("");const S=d1({nodes:f,edges:g,instances:_.current,selectedNode:tn,draft:Ke,allowRename:b});return S!=null&&S.error?(Kr(S.error),!1):(!(S!=null&&S.ok)||!S.changed||(_.current=S.instances,F(S.instances),h(S.nodes),k(S.edges),S.nextId!==tn.id&&xt(S.nextId),Zi(S.nextId)),!0)},[g,Ke,f,tn,k,h,Zi,ae]);m.useEffect(()=>{if(!ae||!Ke||!tn)return;const b=window.setTimeout(()=>{Wm(!1)},350);return()=>window.clearTimeout(b)},[Ke==null?void 0:Ke.label,Ke==null?void 0:Ke.role,Ke==null?void 0:Ke.model,Ke==null?void 0:Ke.body,JSON.stringify((Ke==null?void 0:Ke.images)||[]),Ke==null?void 0:Ke.script,Ke==null?void 0:Ke.scriptRef,Ke==null?void 0:Ke.implementationRef,Ke==null?void 0:Ke.implementationMode,JSON.stringify((Ke==null?void 0:Ke.inputs)||[]),JSON.stringify((Ke==null?void 0:Ke.outputs)||[]),Wm,tn==null?void 0:tn.id,ae]);const BR=m.useMemo(()=>{const b=new Map(Es.map(S=>[S.id,S]));return g.map(S=>{var ue,be,ge,Ee;const A=b.get(S.source),M=b.get(S.target),H=/^output-(\d+)$/.exec(S.sourceHandle||""),U=/^input-(\d+)$/.exec(S.targetHandle||""),Y=A&&H?(be=(ue=A.data)==null?void 0:ue.outputs)==null?void 0:be[parseInt(H[1],10)]:null,J=M&&U?(Ee=(ge=M.data)==null?void 0:ge.inputs)==null?void 0:Ee[parseInt(U[1],10)]:null,Q=Y!=null&&Y.type?Sn(Y.type):J!=null&&J.type?Sn(J.type):"";return Q?{...S,style:{...S.style||{},stroke:Q,strokeWidth:2},markerEnd:{type:oi.ArrowClosed,color:Q}}:S})},[g,Es]),HR=ut?Ec:Es,WR=ut?[]:BR,VR=m.useMemo(()=>ut?Ec.map(b=>({...b,id:ay(b.id)})):Es,[Ec,Es,ut]),KR=m.useCallback(b=>{const S=String(b||"").trim();if(!S)return;const A=ut?Gj(S):S;ut?B([S]):(h(H=>H.map(U=>({...U,selected:U.id===A}))),k(H=>H.map(U=>({...U,selected:!1}))),xt(A));const M=()=>{var ue,be,ge;const H=r.getNode(A);if(!H)return;const U=(ue=r.getInternalNode)==null?void 0:ue.call(r,A),Y=((be=U==null?void 0:U.measured)==null?void 0:be.width)??(U==null?void 0:U.width)??H.width??260,J=((ge=U==null?void 0:U.measured)==null?void 0:ge.height)??(U==null?void 0:U.height)??H.height??120,{zoom:Q}=r.getViewport();r.setCenter(H.position.x+Y/2,H.position.y+J/2,{zoom:rU(Q),duration:240})};window.requestAnimationFrame(()=>window.requestAnimationFrame(M))},[ut,r,k,h]),Iv=m.useCallback(()=>{const b=r.getViewport(),S={x:Number(b.x)||0,y:Number(b.y)||0,zoom:Math.min(Math.max(Number(b.zoom)||1,.1),4)};if(ut){const A={...N.current,viewport:S};N.current=A,C(A),xe("已固定 Display 进入视角")}else P.current=S,E(S),xe("已固定 Workspace 进入视角");qt(w.current,y.current).catch(A=>xe(String(A.message||A)))},[ut,r,qt]),Vm=m.useMemo(()=>{const b=se.trim().toLowerCase(),S={DISPLAY:[],CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const A of ie)b&&![A.id,A.label,A.displayName,A.description].some(M=>String(M||"").toLowerCase().includes(b))||S[iu(A)].push(A);for(const A of ul)S[A].sort((M,H)=>M.id.localeCompare(H.id));return S},[ie,se]),Ac=m.useMemo(()=>{const b=Zt.trim().toLowerCase();return ie.filter(S=>!b||[S.id,S.label,S.displayName,S.description].some(A=>String(A||"").toLowerCase().includes(b))).sort((S,A)=>{const M=ul.indexOf(iu(S)),H=ul.indexOf(iu(A));return M!==H?M-H:ou(S).localeCompare(ou(A))}).slice(0,30)},[ie,Zt]),Pc=m.useMemo(()=>{const b=Zt.trim().toLowerCase();return ce.filter(S=>!b||[S.id,S.version,S.displayName,S.name,S.description,...Array.isArray(S.tags)?S.tags:[]].some(A=>String(A||"").toLowerCase().includes(b))).sort((S,A)=>String(S.displayName||S.name||S.id).localeCompare(String(A.displayName||A.name||A.id))).slice(0,30)},[ce,Zt]);m.useEffect(()=>{ur(0)},[Zt,le,De]),m.useEffect(()=>{if(!le)return;const b=window.setTimeout(()=>{var S;return(S=Bk.current)==null?void 0:S.focus()},0);return()=>window.clearTimeout(b)},[le]);const qR=m.useMemo(()=>{const b=$t.trim().toLowerCase();return b?dk(qr).filter(S=>S.path.toLowerCase().includes(b)):qr},[$t,qr]),ea=m.useMemo(()=>cT(qr,Ur),[qr,Ur]),ji=(ea==null?void 0:ea.type)==="directory"?ea.path:PU((ea==null?void 0:ea.path)||""),UR=m.useCallback(b=>{var S,A;(A=(S=b.target)==null?void 0:S.closest)!=null&&A.call(S,".af-work-file")||q("")},[]),YR=[...(Yo.cursor||[]).map(b=>({label:`Cursor · ${b.split(" - ")[0]}`,value:`cursor:${b.split(" - ")[0]}`})),...(Yo.opencode||[]).map(b=>({label:`OpenCode · ${b.split(" - ")[0]}`,value:`opencode:${b.split(" - ")[0]}`})),...(Yo.claudeCode||[]).map(b=>({label:`Claude · ${b.split(" - ")[0]}`,value:`claude-code:${b.split(" - ")[0]}`})),...(Yo.codex||[]).map(b=>({label:`Codex · ${b.split(" - ")[0]}`,value:`codex:${b.split(" - ")[0]}`}))],Km=m.useMemo(()=>new Set(js),[js]),Za=m.useMemo(()=>{const b=new Map(Ns.map(U=>[U.key,U])),S=new Set,A=new Set,M=Ha.map(U=>{const Y=$o(U,Ns).map(J=>b.get(J)).filter(Boolean);for(const J of Y)S.add(J.key),A.add(String(J.name||J.id||J.key||"").trim());return{...U,skills:Y}}).filter(U=>U.skills.length>0),H=Ns.filter(U=>{const Y=String(U.name||U.id||U.key||"").trim();return!S.has(U.key)&&!A.has(Y)});return{groups:M,ungrouped:H}},[Ha,Ns]);m.useEffect(()=>{Fk(b=>{let S=!1;const A=new Set(b);for(const M of Za.groups)A.has(M.id)||(A.add(M.id),S=!0);return S?A:b})},[Za.groups]);const Kn=m.useMemo(()=>{const b=f.filter(S=>S.selected);return b.length>0?b:nt?f.filter(S=>S.id===nt):[]},[f,nt]),Xd=m.useMemo(()=>Kn.map(b=>b.id),[Kn]),Tv=m.useCallback(()=>{if(ut)return;if(!ae){xe("Readonly workspace");return}const b=(w.current||[]).filter(J=>(J==null?void 0:J.selected)&&!Cu(J));if(b.length<2){xe("选择至少两个节点后按 G 创建 Group");return}const S=b.reduce((J,Q)=>{var st,Le,Ue,We,Oe,Bt,tt,Ge,Ie,Lt,Ze,pt;const ue=Number(((st=Q.position)==null?void 0:st.x)||0),be=Number(((Le=Q.position)==null?void 0:Le.y)||0),ge=Number(((Ue=Q.measured)==null?void 0:Ue.width)||Q.width||((Oe=(We=Q.data)==null?void 0:We.nodeSize)==null?void 0:Oe.width)||((tt=(Bt=Q.data)==null?void 0:Bt.displaySize)==null?void 0:tt.width)||MI),Ee=Number(((Ge=Q.measured)==null?void 0:Ge.height)||Q.height||((Lt=(Ie=Q.data)==null?void 0:Ie.nodeSize)==null?void 0:Lt.height)||((pt=(Ze=Q.data)==null?void 0:Ze.displaySize)==null?void 0:pt.height)||gh);return{minX:Math.min(J.minX,ue),minY:Math.min(J.minY,be),maxX:Math.max(J.maxX,ue+ge),maxY:Math.max(J.maxY,be+Ee)}},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0});if(!Number.isFinite(S.minX)||!Number.isFinite(S.minY))return;const A=new Set((w.current||[]).map(J=>J.id));let M=1,H=`group_${M}`;for(;A.has(H);)M+=1,H=`group_${M}`;const U=aw({width:S.maxX-S.minX+Vf*2,height:S.maxY-S.minY+Vf*2})||{width:Ta,height:Ra},Y={id:H,type:zl,position:{x:S.minX-Vf,y:S.minY-Vf},width:U.width,height:U.height,selected:!0,draggable:!0,selectable:!0,zIndex:0,data:{isWorkspaceGroup:!0,label:Sh(M-1),title:Sh(M-1),color:"purple",nodeSize:U}};h(J=>[Y,...J.map(Q=>({...Q,selected:!1}))]),k(J=>J.map(Q=>({...Q,selected:!1}))),xt(""),xe(`Created group for ${b.length} nodes`)},[ut,k,h,ae]),Ic=m.useMemo(()=>f.filter(b=>kn(b==null?void 0:b.data)),[f]),qm=m.useMemo(()=>Kn.filter(b=>kn(b==null?void 0:b.data)).map(b=>b.id),[Kn]),GR=m.useMemo(()=>{const b=String((Sr==null?void 0:Sr.username)||(Sr==null?void 0:Sr.userId)||"").trim();return b?b.slice(0,1).toUpperCase():"?"},[Sr]),Um=m.useMemo(()=>new Set(Xd),[Xd]),Qd=m.useMemo(()=>g.filter(b=>Um.has(b.source)&&Um.has(b.target)),[g,Um]),Ym=m.useCallback(b=>{const S=b==="display"?"display":b==="workflow"?"workflow":"workspace";l(S),xt(""),B([]),$(null),we(!1),Cn(!1);const A=$r(i);S==="display"&&A.set("view","display"),S==="workflow"&&(A.set("view","workflow"),ir.trim()&&A.set("tapdId",ir.trim()));const M=`/workspace${A.toString()?`?${A.toString()}`:""}`;window.history.pushState({},"",M)},[i,ir]),Rv=m.useCallback(b=>{const S=String(b||"").trim();if(!S)return;const A=w.current.find(M=>M.id===S);if(!A||!kn(A.data)){xe("展示节点不可用");return}C(M=>{if(M.nodeIds.includes(S))return M;const H=M.nodeIds.length,U=fl(A);return{nodeIds:[...M.nodeIds,S],nodePositions:{...M.nodePositions,[S]:{x:180+H*36,y:120+H*28}},nodeSizes:{...M.nodeSizes,...U?{[S]:U}:{}}}}),B([S])},[]),Mv=m.useCallback(b=>{const S=String(b||"").trim();S&&(C(A=>{const M=A.nodeIds.filter(Y=>Y!==S),H={...A.nodePositions},U={...A.nodeSizes};return delete H[S],delete U[S],{nodeIds:M,nodePositions:H,nodeSizes:U}}),B(A=>A.filter(M=>M!==S)))},[]),$v=m.useCallback(b=>{const S=String(b||"").trim();S&&(N.current.nodeIds.includes(S)?Mv(S):Rv(S))},[Rv,Mv]),Zd=m.useMemo(()=>{const b=kr.trim().toLowerCase();return b?Qa.filter(S=>{var A,M;return[S.id,(A=S.data)==null?void 0:A.label,(M=S.data)==null?void 0:M.definitionId].filter(Boolean).some(H=>String(H).toLowerCase().includes(b))}):Qa},[Qa,kr]),Lv=m.useMemo(()=>{const b=Zd.length,S=b<=1?1:b<=4?2:3,A=Array.from({length:S},()=>({height:0,nodes:[]}));for(const M of Zd){const H=fl(M)||{width:420,height:260},U=Math.max(1,Number(H.width)||420),Y=Math.max(1,Number(H.height)||260),J=Math.min(26,Math.max(5.5,Y/U*16))+3.2;let Q=A[0];for(const ue of A)ue.height<Q.height&&(Q=ue);Q.nodes.push(M),Q.height+=J}return A.map(M=>M.nodes)},[Zd]),JR=m.useCallback(b=>{var U;const S=x.nodeIds.includes(b.id),A=fl(b)||{width:420,height:260},M=Math.max(1,Math.round(Number(A.width)||420)),H=Math.max(1,Math.round(Number(A.height)||260));return o.jsxs("button",{type:"button",className:"af-display-picker-card"+(S?" af-display-picker-card--selected":""),style:{"--af-display-picker-card-ratio":`${M} / ${H}`},onClick:()=>$v(b.id),children:[o.jsx("span",{className:"af-display-picker-card__check","aria-hidden":!0,children:o.jsx("input",{type:"checkbox",checked:S,readOnly:!0,tabIndex:-1})}),o.jsx("span",{className:"af-display-picker-card__preview",children:o.jsx(xU,{node:b})}),o.jsxs("span",{className:"af-display-picker-card__meta",children:[o.jsx("strong",{children:((U=b.data)==null?void 0:U.label)||b.id}),o.jsxs("small",{children:[kn(b.data)," · ",b.id]})]})]},b.id)},[x.nodeIds,$v]),Ov=m.useMemo(()=>{const b=se.trim().toLowerCase();return b?ce.filter(S=>[S.id,S.version,S.displayName,S.name,S.description,...Array.isArray(S.tags)?S.tags:[]].filter(Boolean).some(A=>String(A).toLowerCase().includes(b))):ce},[ce,se]),Dv=m.useCallback((b,S)=>{const A=String(b||"snippet_node").trim().replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"snippet_node";let M=`${A}_${Date.now().toString(36)}`,H=2;for(;S.has(M);)M=`${A}_${Date.now().toString(36)}_${H}`,H+=1;return S.add(M),M},[]),Tc=m.useCallback((b,S)=>{var Ie,Lt;if(!ae){xe("Readonly workspace");return}const A=b!=null&&b.snippet&&typeof b.snippet=="object"?b.snippet:{},M=A.instances&&typeof A.instances=="object"?A.instances:{},H=Object.keys(M);if(H.length===0)return;const U=new Set(w.current.map(Ze=>Ze.id)),Y={};for(const Ze of H)Y[Ze]=Dv(Ze,U);const J=(Ie=A.ui)!=null&&Ie.nodePositions&&typeof A.ui.nodePositions=="object"?A.ui.nodePositions:{},Q=(Lt=A.ui)!=null&&Lt.nodeSizes&&typeof A.ui.nodeSizes=="object"?A.ui.nodeSizes:{},ue=H.map(Ze=>{const pt=J[Ze];return{id:Ze,x:typeof(pt==null?void 0:pt.x)=="number"?pt.x:0,y:typeof(pt==null?void 0:pt.y)=="number"?pt.y:0}}),be=Math.min(...ue.map(Ze=>Ze.x)),ge=Math.min(...ue.map(Ze=>Ze.y));let Ee=S||{x:360+w.current.length*24,y:180+w.current.length*18};if(!S){const Ze=document.querySelector(".af-workspace-canvas .react-flow");if(Ze){const pt=Ze.getBoundingClientRect();Ee=r.screenToFlowPosition({x:pt.left+pt.width*.48,y:pt.top+pt.height*.32})}}const st={},Le={},Ue={};for(const Ze of ue){const pt=Y[Ze.id];st[pt]={...M[Ze.id]||{}},Le[pt]={x:Ee.x+(Ze.x-be),y:Ee.y+(Ze.y-ge)};const Dt=Q[Ze.id];typeof(Dt==null?void 0:Dt.width)=="number"&&typeof(Dt==null?void 0:Dt.height)=="number"&&(Ue[pt]={width:Dt.width,height:Dt.height})}const We=new Set(H),Oe=(Array.isArray(A.edges)?A.edges:[]).filter(Ze=>We.has(Ze==null?void 0:Ze.source)&&We.has(Ze==null?void 0:Ze.target)).map(Ze=>({source:Y[Ze.source],target:Y[Ze.target],sourceHandle:Ze.sourceHandle??null,targetHandle:Ze.targetHandle??null})),Bt=Uf({instances:st,edges:Oe,ui:{nodePositions:Le,nodeSizes:Ue}},ie),tt=Bt.nodes.map(Ze=>Ze.id),Ge=Bt.nodes.map(Ze=>({...Ze,selected:!0}));_.current={..._.current,...Bt.instances},F(_.current),h(Ze=>[...Ze.map(pt=>({...pt,selected:!1})),...Ge]),k(Ze=>[...Ze.map(pt=>({...pt,selected:!1})),...Bt.edges.map(pt=>({...pt,selected:!1}))]),xt(""),B([]),xe(`已添加流程片段:${b.displayName||b.id}(已选中 ${tt.length} 个节点)`)},[Dv,ie,r,k,h,ae]),XR=m.useCallback(()=>{var A,M;if(Kn.length<2){Te("请先在 workspace 画布上选择至少两个节点。"),ne("flows");return}const b=Kn[0],S=Kn.length===2?`${((A=b.data)==null?void 0:A.label)||b.id} 片段`:`${((M=b.data)==null?void 0:M.label)||b.id} 等 ${Kn.length} 个节点`;Ae({name:S,id:S.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),Vt(""),gt(!0),ne("flows")},[Kn]),QR=m.useCallback(async()=>{var H,U;if(Kn.length<2)return;const b=yt.name.trim();if(!b){Vt("请填写片段名称。");return}const S={},A={};for(const Y of Kn){S[Y.id]={x:((H=Y.position)==null?void 0:H.x)||0,y:((U=Y.position)==null?void 0:U.y)||0};const J=fl(Y);J&&(A[Y.id]=J)}const M=Qd.map(Y=>({source:Y.source,target:Y.target,sourceHandle:Y.sourceHandle??null,targetHandle:Y.targetHandle??null}));St(!0),Vt("");try{const Y=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:yt.id,name:b,displayName:b,version:"1.0.0",description:yt.description,snippet:{instances:nk(Kn,_.current),edges:M,ui:{nodePositions:S,nodeSizes:A}}})}),J=await Y.json().catch(()=>({}));if(!Y.ok||J.ok===!1)throw new Error(J.error||"发布流程片段失败");gt(!1),xe(`流程片段已发布:${J.id||b}`),Ok(`流程片段已发布:${J.id||b}`),await Bd(),ne("flows")}catch(Y){Vt(String(Y.message||Y))}finally{St(!1)}},[Bd,yt,Qd,Kn,Ok]);m.useCallback(()=>{if(Ic.length===0){xe("当前 workspace 没有 display 节点");return}const b=qm.length>0?qm:Ic.map(A=>A.id),S=i.flowId?`${i.flowId} 展示页`:"AgentFlow Display";Ce(cy({title:S,layout:"gallery",nodeIds:b,mode:"multi-node"})),zt(""),fn(null),Qe(!0)},[i.flowId,qm,Ic]);const ZR=m.useCallback(b=>{Ce(S=>{const A=Array.isArray(S.nodeIds)?S.nodeIds:[];return A.includes(b)?{...S,nodeIds:A.filter(M=>M!==b)}:{...S,nodeIds:[...A,b]}})},[]),As=m.useCallback(async()=>{ls(!0),wr("");try{const b=await fetch("/api/display/shares"),S=await b.json().catch(()=>({}));if(!b.ok)throw new Error(S.error||"读取分享列表失败");Ln(Array.isArray(S.shares)?S.shares:[])}catch(b){wr(String(b.message||b)),Ln([])}finally{ls(!1)}},[]),eM=m.useCallback(()=>{Yn(!0),br(""),As()},[As]),tM=m.useCallback(async()=>{var A,M;const b=Z.title.trim(),S=Array.isArray(Z.nodeIds)?Z.nodeIds:[];if(S.length===0){zt("请选择至少一个 display 节点。");return}_t(!0),zt(""),fn(null);try{await qt(f,g);const H=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,title:b,layout:Z.layout,nodeIds:S,...Xj(Z)})}),U=await H.json().catch(()=>({}));if(!H.ok||U.ok===!1)throw new Error(U.error||"发布展示页失败");const Y=new URL(U.url||`/display/${((A=U.share)==null?void 0:A.id)||""}`,window.location.origin).href;fn({...U,absoluteUrl:Y}),xe((M=U.share)!=null&&M.expiresAt?"展示页已生成":"展示页已生成:永久有效"),Hn&&As()}catch(H){zt(String(H.message||H))}finally{_t(!1)}},[Z,Hn,g,i,As,f,qt]),nM=m.useCallback(async()=>{var S,A;const b=Array.isArray(x.nodeIds)?x.nodeIds:[];if(b.length===0){zt("请先添加至少一个展示节点。"),xe("请先添加至少一个展示节点"),Cn(!0);return}_t(!0),zt("");try{await qt(f,g);const M=i.flowId?`${i.flowId} 展示页`:"AgentFlow Display",H=await fetch("/api/display/share",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,title:M,layout:"canvas",nodeIds:b,...Xj(Z)})}),U=await H.json().catch(()=>({}));if(!H.ok||U.ok===!1)throw new Error(U.error||"生成展示链接失败");const Y=new URL(U.url||`/display/${((S=U.share)==null?void 0:S.id)||""}`,window.location.origin).href;fn({...U,absoluteUrl:Y}),Nt(!0),xe((A=U.share)!=null&&A.expiresAt?"展示链接已生成":"展示链接已生成:永久有效"),Hn&&As()}catch(M){const H=String(M.message||M);zt(H),xe(H)}finally{_t(!1)}},[x.nodeIds,Z,Hn,g,i,As,f,qt]),Fv=m.useCallback(async()=>{const b=at==null?void 0:at.absoluteUrl;if(!b)return;const S=await Zj(b);Xt(S?"copied":"failed"),window.setTimeout(()=>Xt(""),1600)},[at==null?void 0:at.absoluteUrl]),rM=m.useCallback(async b=>{const S=Qj(b),A=await Zj(S);br(A?String((b==null?void 0:b.id)||""):"failed"),window.setTimeout(()=>br(""),1600)},[]),sM=m.useCallback(async(b,S)=>{const A=String((b==null?void 0:b.id)||"");if(A){pn(A),wr("");try{const M=S==="permanent"?{id:A,expiresMode:"permanent",permanent:!0}:{id:A,expiresMode:"days",expiresInDays:Number(S||30)},H=await fetch("/api/display/share",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(M)}),U=await H.json().catch(()=>({}));if(!H.ok||U.ok===!1)throw new Error(U.error||"更新分享有效期失败");await As(),xe("分享有效期已更新")}catch(M){wr(String(M.message||M))}finally{pn("")}}},[As]),iM=m.useCallback(async b=>{const S=String((b==null?void 0:b.id)||"");if(S){pn(S),wr("");try{const A=await fetch(`/api/display/share?id=${encodeURIComponent(S)}`,{method:"DELETE"}),M=await A.json().catch(()=>({}));if(!A.ok||M.ok===!1)throw new Error(M.error||"撤销分享失败");await As(),xe("分享已撤销")}catch(A){wr(String(A.message||A))}finally{pn("")}}},[As]),oM=m.useCallback(b=>{h(S=>S.map(A=>A.id===b?{...A,selected:!1}:A)),xt(S=>S===b?"":S)},[h]),el=m.useCallback(()=>{const b=Im.current;if(!b)return;const S=b.getBoundingClientRect(),A=Math.min(420,Math.max(320,S.width+160)),M=12,H=Math.max(180,S.top-M*2),U=Math.min(560,H);SR({position:"fixed",left:Math.max(12,Math.min(window.innerWidth-A-12,S.left)),top:Math.max(M,S.top-U-M),width:A,maxHeight:U,zIndex:1e4})},[]);m.useEffect(()=>{if(!Od)return;el();const b=A=>{var H,U;const M=A.target;(H=Im.current)!=null&&H.contains(M)||(U=zk.current)!=null&&U.contains(M)||Pm(!1)},S=A=>{A.key==="Escape"&&Pm(!1)};return window.addEventListener("pointerdown",b),window.addEventListener("keydown",S),window.addEventListener("resize",el),window.addEventListener("scroll",el,!0),()=>{window.removeEventListener("pointerdown",b),window.removeEventListener("keydown",S),window.removeEventListener("resize",el),window.removeEventListener("scroll",el,!0)}},[Od,el]);const aM=m.useCallback(b=>{var M,H;if(a==="display"){const U=[];let Y=!1;C(J=>{var be,ge;const Q={...J.nodePositions},ue={...J.nodeSizes};for(const Ee of b||[]){const st=ay(Ee==null?void 0:Ee.id);if(!(!st||!J.nodeIds.includes(st))){if(Ee.type==="select"){Ee.selected&&U.push(st);continue}if(Ee.type==="position"&&Ee.position){Q[st]={x:Ee.position.x,y:Ee.position.y},Y=!0;continue}if(Ee.type==="dimensions"&&((be=Ee.dimensions)!=null&&be.width)&&((ge=Ee.dimensions)!=null&&ge.height)){const Le=ba({width:Math.round(Number(Ee.dimensions.width)),height:Math.round(Number(Ee.dimensions.height))},{display:!0});Le&&(ue[st]=Le,Y=!0)}}}return Y?{...J,nodePositions:Q,nodeSizes:ue}:J}),(b||[]).some(J=>(J==null?void 0:J.type)==="select")&&B(U);return}if(!ae){const U=(b||[]).filter(Y=>(Y==null?void 0:Y.type)==="select");U.length>0&&h(Y=>ch(U,Y));return}const S=new Map;for(const U of b||[])if((U==null?void 0:U.type)==="dimensions"&&((M=U.dimensions)!=null&&M.width)&&((H=U.dimensions)!=null&&H.height)){const Y=f.find(ge=>ge.id===U.id),J=Cu(Y),Q=!!kn(Y==null?void 0:Y.data),ue={width:Math.round(Number(U.dimensions.width)),height:Math.round(Number(U.dimensions.height))},be=J?aw(ue):ba(ue,{display:Q});be&&S.set(U.id,be)}const A=Array.from(S.keys());if(h(U=>ch(b,U).map(Y=>{const J=S.get(Y.id);return J?Cu(Y)?{...Y,width:J.width,height:J.height,data:{...Y.data,nodeSize:J}}:kn(Y.data)?{...Y,width:J.width,height:J.height,data:{...Y.data,nodeSize:J,displaySize:J}}:{...Y,width:J.width,height:J.height,data:{...Y.data,nodeSize:J}}:Y})),A.length>0){const U=()=>A.forEach(Y=>s(Y));window.requestAnimationFrame(U),window.setTimeout(U,80)}},[f,h,s,a,ae]),lM=m.useCallback(b=>{if(a!=="display"){if(!ae){const S=(b||[]).filter(A=>(A==null?void 0:A.type)==="select");S.length>0&&k(A=>{const M=uh(S,A);return y.current=M,M});return}k(S=>{const A=uh(b,S);return y.current=A,A})}},[k,a,ae]),tl=m.useCallback(()=>{const b=document.querySelector(".af-workspace-canvas .react-flow");if(b){const S=b.getBoundingClientRect();return r.screenToFlowPosition({x:S.left+S.width*.48,y:S.top+S.height*.32})}return{x:360+f.length*36,y:180+f.length*28}},[f.length,r]),ef=m.useCallback(()=>{var b,S,A;if(tn){const M=Number(((b=tn.measured)==null?void 0:b.width)||tn.width||260);return{x:Number(((S=tn.position)==null?void 0:S.x)||0)+M+140,y:Number(((A=tn.position)==null?void 0:A.y)||0)}}return tl()},[tl,tn]),Ci=m.useCallback((b,S={})=>{if(!ae)return xe("Readonly workspace"),null;if(!b)return null;const A=lk(b)||b.id,M=UI(b),H=GI(b),U=S.id||zq(A,f),Y=lu(b.inputs),J=lu(b.outputs),Q={definitionId:A,...M?{marketplaceRef:M}:{},...b.packageId?{marketplacePackageId:b.packageId}:{},...b.version?{marketplaceVersion:b.version}:{},label:S.label||vh(b),role:"normal",body:S.body||"",...S.script||H?{script:S.script||H}:{},...S.scriptRef?{scriptRef:S.scriptRef}:{},...S.implementationRef?{implementationRef:S.implementationRef}:{},...S.implementationMode?{implementationMode:S.implementationMode}:{},input:S.inputs||Y,output:S.outputs||J},ue={id:U,type:zl,position:S.position||tl(),data:{label:Q.label,definitionId:A,...M?{marketplaceRef:M}:{},...b.packageId?{marketplacePackageId:b.packageId}:{},...b.version?{marketplaceVersion:b.version}:{},schemaType:qI(A,b),role:"normal",body:Q.body,...Q.script?{script:Q.script}:{},...Q.scriptRef?{scriptRef:Q.scriptRef}:{},...Q.implementationRef?{implementationRef:Q.implementationRef}:{},...Q.implementationMode?{implementationMode:Q.implementationMode}:{},inputs:Q.input,outputs:Q.output}},be={...nw(ue,{..._.current,[U]:Q},ie),selected:!0};return h(ge=>[...ge.map(Ee=>({...Ee,selected:!1})),be]),S.openProperties&&xt(U),U},[tl,f,ie,h,ae]),cM=m.useCallback(b=>oy(b,w.current),[]),uM=m.useCallback(b=>{if(!ae){xe("Readonly workspace");return}if(!oy(b,w.current)){xe("端口类型不匹配,已取消连线");return}$(null),h(S=>ty(S,b)),k(S=>{const A=S.filter(H=>!(H.target===b.target&&H.targetHandle===b.targetHandle)),M=vp({...b,markerEnd:{type:oi.ArrowClosed}},A);return y.current=M,M})},[k,h,ae]),dM=m.useCallback((b,S)=>{if(!ae)return;const A=Oq(S,w.current);R.current=A?{...A,preferExisting:!!(b!=null&&b.shiftKey)}:null,$(null)},[ae]),fM=m.useCallback((b,S)=>{var We,Oe,Bt,tt;if(!ae)return;const A=R.current;if(R.current=null,!A||S!=null&&S.toNode)return;const M=Dq(ie,A),H=Fq(w.current,y.current,A);if(M.length===0&&H.length===0){xe(`没有匹配 ${A.slotType} 端口的节点`);return}const Y=!!(b!=null&&b.shiftKey||A.preferExisting)?H.length>0?"existing":"create":M.length>0?"create":"existing",J=((Oe=(We=b==null?void 0:b.changedTouches)==null?void 0:We[0])==null?void 0:Oe.clientX)??(b==null?void 0:b.clientX),Q=((tt=(Bt=b==null?void 0:b.changedTouches)==null?void 0:Bt[0])==null?void 0:tt.clientY)??(b==null?void 0:b.clientY);if(!Number.isFinite(J)||!Number.isFinite(Q))return;const ue=document.querySelector(".af-workspace-canvas .react-flow");if(!ue)return;const be=ue.getBoundingClientRect(),ge=320,Ee=Math.max(M.length,H.length),st=Math.min(480,150+Ee*58),Le=Math.max(12,Math.min(J-be.left,be.width-ge-12)),Ue=Math.max(12,Math.min(Q-be.top,be.height-st-12));$({left:Le,top:Ue,flowPosition:r.screenToFlowPosition({x:J,y:Q}),draft:A,candidates:M,existingCandidates:H,mode:Y,query:""})},[ie,r,ae]),pM=m.useCallback(b=>{if(!ae){xe("Readonly workspace"),$(null);return}const S=K.current;if(!S||!(b!=null&&b.def))return;const A=Ci(b.def,{position:S.flowPosition});if(!A)return;const M=S.draft.handleType==="source"?{source:S.draft.nodeId,sourceHandle:S.draft.handleId,target:A,targetHandle:`input-${b.slotIndex}`}:{source:A,sourceHandle:`output-${b.slotIndex}`,target:S.draft.nodeId,targetHandle:S.draft.handleId};h(H=>ty(H,M)),k(H=>{const U=H.filter(J=>!(J.target===M.target&&J.targetHandle===M.targetHandle)),Y=vp({...M,markerEnd:{type:oi.ArrowClosed}},U);return y.current=Y,Y}),$(null)},[Ci,k,ae]),hM=m.useCallback(b=>{if(!ae){xe("Readonly workspace"),$(null);return}const S=b==null?void 0:b.connection;if(!S||!oy(S,w.current)){xe("端口类型不匹配,已取消连线"),$(null);return}h(A=>ty(A,S)),k(A=>{const M=A.filter(U=>!(U.target===S.target&&U.targetHandle===S.targetHandle)),H=vp({...S,markerEnd:{type:oi.ArrowClosed}},M);return y.current=H,H}),$(null)},[k,h,ae]),zv=m.useCallback(b=>{b&&(Ci(b,{position:ef()}),we(!1),on(""))},[Ci,ef]),Bv=m.useCallback(b=>{b&&(Tc(b,ef()),we(!1),on(""))},[Tc,ef]),mM=m.useCallback(b=>{var A,M,H;if(ut||In)return;const S=b==null?void 0:b.target;Dj(S)||(A=S==null?void 0:S.closest)!=null&&A.call(S,"button, a, [role='button'], .react-flow__handle")||(H=(M=v.current)==null?void 0:M.focus)==null||H.call(M,{preventScroll:!0})},[ut,In]);m.useEffect(()=>{const b=S=>{var ue;if(S.defaultPrevented)return;const A=a7(S.target)||Dj(S.target);if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="s"){S.preventDefault(),qt().catch(be=>xe(String(be.message||be)));return}if((S.metaKey||S.ctrlKey)&&S.key.toLowerCase()==="k"){S.preventDefault(),S.stopPropagation(),Gk(be=>!be);return}if(Lm)return;if($m){(S.key==="Escape"||Aj(S))&&(S.preventDefault(),Fd(!1));return}const M=S.key.toLowerCase(),H=(S.metaKey||S.ctrlKey)&&M==="c",U=(S.metaKey||S.ctrlKey)&&M==="v",Y=A&&H&&tq(S.target);if(A&&!Y)return;const J=(S.metaKey||S.ctrlKey)&&!S.shiftKey&&M==="z",Q=(S.metaKey||S.ctrlKey)&&(S.shiftKey&&M==="z"||M==="y");if(J||Q){if(ut){S.preventDefault(),S.stopPropagation(),xe("展示页布局会自动保存");return}if(!ae){S.preventDefault(),xe("Readonly workspace");return}S.preventDefault(),S.stopPropagation();const be=J?ov():av();xe(be?J?"Undo canvas change":"Redo canvas change":J?"Nothing to undo":"Nothing to redo");return}if(H){if(ut)return;const be=Yt.current,ge=(w.current||[]).some(st=>st==null?void 0:st.selected)?w.current:(w.current||[]).map(st=>be&&st.id===be?{...st,selected:!0}:st),Ee=PK(ge,y.current,_.current);Ee&&(S.preventDefault(),S.stopPropagation(),L.current=Ee,tU(Ee),Y&&typeof((ue=S.target)==null?void 0:ue.blur)=="function"&&S.target.blur(),xe(`Copied ${Ee.nodes.length} node${Ee.nodes.length>1?"s":""}`));return}if(U){if(ut){S.preventDefault(),S.stopPropagation();return}if(!ae){S.preventDefault(),xe("Readonly workspace");return}const be=L.current||nU();be&&!L.current&&(L.current=be);const ge=IK(be,w.current,y.current,_.current);ge&&(S.preventDefault(),S.stopPropagation(),_.current=ge.instances,F(ge.instances),h(ge.nodes),k(ge.edges),xe(`Pasted ${ge.pastedNodeIds.length} node${ge.pastedNodeIds.length>1?"s":""}`));return}if(Aj(S)&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),Fd(!0);return}if(M==="g"&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),Tv();return}if(S.key==="a"||S.key==="A"){if(S.metaKey||S.ctrlKey){S.preventDefault(),ut?B(N.current.nodeIds):(h(be=>be.map(ge=>({...ge,selected:!0}))),k(be=>be.map(ge=>({...ge,selected:!1}))));return}if(S.altKey)return;if(ut){S.preventDefault(),Cn(!0);return}if(!ae){S.preventDefault(),xe("Readonly workspace");return}S.preventDefault(),we(!0);return}if((S.key==="v"||S.key==="V")&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),Jk("select");return}if((S.key==="h"||S.key==="H")&&!S.metaKey&&!S.ctrlKey&&!S.altKey){S.preventDefault(),Jk("pan");return}(S.key==="f"||S.key==="F")&&!S.metaKey&&!S.ctrlKey&&!S.altKey&&(S.preventDefault(),Iv())};return window.addEventListener("keydown",b,!0),()=>window.removeEventListener("keydown",b,!0)},[Tv,ut,Lm,Iv,av,qt,$m,k,h,ov,ae]);const gM=m.useCallback(b=>{nn(S=>{const A=new Set(S);return A.has(b)?A.delete(b):A.add(b),A})},[]),yM=m.useCallback((b,S)=>{b.dataTransfer.effectAllowed="copy",b.dataTransfer.setData("application/x-agentflow-workspace-file",JSON.stringify({path:S.path,name:S.name,type:S.type})),b.dataTransfer.setData("text/plain",S.path)},[]),xM=m.useCallback((b,S)=>{b.dataTransfer.effectAllowed="move",b.dataTransfer.setData("application/agentflow-node",S.id),b.dataTransfer.setData("text/plain",S.id)},[]),tf=m.useCallback(async(b,S)=>{const A=String((b==null?void 0:b.name)||(b==null?void 0:b.path)||"").toLowerCase(),M=A.split(".").pop(),H=["jsx","tsx","js"].includes(M)?"display_react_app":M==="html"?"display_html":M==="csv"||M==="tsv"||M==="json"&&/\b(table|data|rows|report)\b/i.test(A)?"display_table":["png","jpg","jpeg","gif","webp","svg"].includes(M)?"display_image":"display_markdown",U=ie.find(ge=>ge.id===H);if(!U){xe("展示节点不可用");return}const Y=H==="display_image";let J=String(b.path||"");if(!Y){const ge=$r(i);ge.set("path",b.path);const Ee=await fetch(`/api/workspace/file?${ge.toString()}`),st=await Ee.json();if(!Ee.ok)throw new Error(st.error||"读取文件失败");J=String(st.content||"")}const Q=H==="display_image"?"src":"content",ue=lu(U.inputs).map(ge=>ge.name===Q?{...ge,default:J,value:J}:ge),be=lu(U.outputs).map(ge=>ge.name===Q?{...ge,default:J,value:J}:ge);Ci(U,{label:b.name||"Display",body:J,inputs:ue,outputs:be,position:S}),xe(`已创建展示:${b.path}`)},[Ci,i,ie]),wM=m.useCallback(b=>{if(!ae){xe("Readonly workspace");return}tf(b,tl()).catch(S=>xe(String(S.message||S)))},[tf,tl,ae]),bM=m.useCallback(b=>{if(!ae){b.preventDefault(),xe("Readonly workspace");return}const S=b.dataTransfer.getData("application/x-agentflow-workspace-file");if(S){b.preventDefault();let Y;try{Y=JSON.parse(S)}catch{return}if(!(Y!=null&&Y.path))return;const J=r.screenToFlowPosition({x:b.clientX,y:b.clientY});tf(Y,J).catch(Q=>xe(String(Q.message||Q)));return}const A=b.dataTransfer.getData("application/agentflow-snippet");if(A){const Y=ce.find(Q=>`${Q.id}@${Q.version}`===A);if(!Y)return;b.preventDefault();const J=r.screenToFlowPosition({x:b.clientX,y:b.clientY});Tc(Y,J);return}const M=b.dataTransfer.getData("application/agentflow-node");if(!M)return;const H=ie.find(Y=>Y.id===M);if(!H)return;b.preventDefault();const U=r.screenToFlowPosition({x:b.clientX,y:b.clientY});Ci(H,{position:U})},[tf,Ci,ce,Tc,ie,r,ae]),kM=m.useCallback(b=>{if(!ae)return;const S=Array.from(b.dataTransfer.types||[]);!S.includes("application/x-agentflow-workspace-file")&&!S.includes("application/agentflow-node")&&!S.includes("application/agentflow-snippet")||(b.preventDefault(),b.dataTransfer.dropEffect=S.includes("application/agentflow-node")||S.includes("application/agentflow-snippet")?"move":"copy")},[ae]),vM=m.useCallback(async(b="")=>{if(!ae){xe("Readonly workspace");return}const S=window.prompt("新文件名",b?`${b}/notes.md`:"notes.md");if(!S)return;const A=b&&!S.includes("/")?`${b}/${S}`:S;try{const M=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:A,content:""})}),H=await M.json();if(!M.ok)throw new Error(H.error||"创建文件失败");await Pn(),nn(U=>{const Y=new Set(U);for(const J of Yf(H.path||A))Y.delete(J);return Y}),xe(`已创建 ${H.path}`)}catch(M){xe(String(M.message||M))}},[i,Pn,ae]),SM=m.useCallback(async(b="")=>{if(!ae){xe("Readonly workspace");return}const S=window.prompt("新文件夹名",b?`${b}/docs`:"docs");if(!S)return;const A=b&&!S.includes("/")?`${b}/${S}`:S;try{const M=await fetch("/api/workspace/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:A})}),H=await M.json();if(!M.ok)throw new Error(H.error||"创建文件夹失败");await Pn(),nn(U=>{const Y=new Set(U);for(const J of Yf(H.path||A))Y.delete(J);return H.path&&Y.delete(H.path),Y}),xe(`已创建 ${H.path}`)}catch(M){xe(String(M.message||M))}},[i,Pn,ae]),NM=m.useCallback(async b=>{if(!ae){xe("Readonly workspace");return}if(!(!(b!=null&&b.path)||!window.confirm(`删除 ${b.path}?`)))try{const S=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:b.path})}),A=await S.json();if(!S.ok)throw new Error(A.error||"删除失败");xe(`已删除 ${A.path}`),await Pn()}catch(S){xe(String(S.message||S))}},[i,Pn,ae]),jM=m.useCallback(b=>{if(!(b!=null&&b.path)||b.type==="directory")return;const S=od(b.path,i,{download:!0});if(!S)return;const A=document.createElement("a");A.href=S,A.download=b.name||b.path.split("/").pop()||"download",A.rel="noopener",document.body.appendChild(A),A.click(),A.remove()},[i]),nf=m.useCallback(async()=>{if(!ae){xe("Readonly workspace");return}const b=Go.trim(),S=Tr,A=Cs.find(Y=>Y.id===S)||null;if(!b||Gr||(A==null?void 0:A.status)==="running"||(A==null?void 0:A.status)==="stopping")return;const M=A?Array.isArray(A.messages)?A.messages:[]:Jo,H=Yc(f,g,_.current);Tm(""),Hk(!0),Ka(!0),qa(null);const U={role:"user",text:b,at:Date.now()};A?On(Y=>Y.map(J=>J.id===S?{...J,status:"running",messages:[...Array.isArray(J.messages)?J.messages:[],U].slice(-180)}:J)):(ds("workspace"),Va(Y=>[...Y,U]));try{await qt(f,g);const Y=await fetch("/api/workspace/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,prompt:b,outputKind:"markdown",workspaceGraph:H,allowFlowYaml:!1,model:vi,selectedSkills:js,selectedNodeIds:Xd,messages:M})}),J=await Y.json();if(!Y.ok)throw new Error(J.error||"生成失败");const ue={role:"assistant",kind:"assistant",text:String(J.content||"").trim(),at:Date.now()};A?On(be=>be.map(ge=>ge.id===S?{...ge,status:"done",messages:[...Array.isArray(ge.messages)?ge.messages:[],ue].slice(-180)}:ge)):Va(be=>[...be,ue]),await Ja(),xe("AI 生成完成")}catch(Y){const J=String(Y.message||Y),Q={role:"assistant",text:J,error:!0,at:Date.now()};A?On(ue=>ue.map(be=>be.id===S?{...be,status:"failed",messages:[...Array.isArray(be.messages)?be.messages:[],Q].slice(-180)}:be)):Va(ue=>[...ue,Q]),xe(J)}finally{Hk(!1)}},[Tr,Jo,vi,Cs,Gr,Go,g,i,Ja,f,qt,Xd,js,ae]),Xn=Cs.find(b=>b.id===Tr)||null,Gm=Xn?Array.isArray(Xn.messages)?Xn.messages:[]:Jo,nl=Xn&&(Xn.status==="running"||Xn.status==="stopping")||Gr,CM=OU(Gm,nl),Jm=DU(Gm),Hv=Xn?Xn.status==="stopping"?`${Xn.label} stopping`:Xn.status==="running"?`${Xn.label} running`:Xn.status==="paused"?`${Xn.label} paused`:Xn.status==="failed"?`${Xn.label} failed`:`${Xn.label} done`:Gr?"Workspace agent running":Jo.length>0?"Workspace conversation":"Ready";m.useEffect(()=>{Tr!=="workspace"&&(Cs.some(b=>b.id===Tr)||ds(Zo()))},[Tr,Cs,Zo]),m.useEffect(()=>{if(!kc)return;const b=window.requestAnimationFrame(()=>{var A,M;const S=Wk.current;S&&(S.scrollTop=S.scrollHeight),(M=(A=Rm.current)==null?void 0:A.scrollIntoView)==null||M.call(A,{block:"nearest",inline:"nearest"})});return()=>window.cancelAnimationFrame(b)},[Gm.length,Tr,Hv,Jm.length,kc]);const Wv=String(i.flowId||"").trim()||"Workspace",to=(Z==null?void 0:Z.mode)==="single-node",Vv=to&&Ic.find(b=>{var S;return b.id===Z.sourceNodeId||((S=Z.nodeIds)==null?void 0:S.includes(b.id))})||null,_M=to&&Vv?[Vv]:Ic;return o.jsxs("div",{className:"af-workspace-page",children:[o.jsxs("header",{className:"af-pipeline-top af-workspace-top",children:[o.jsxs("div",{className:"af-pipeline-top-left",children:[o.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-back",onClick:()=>n("/projects"),"aria-label":"返回",children:o.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),o.jsxs("div",{className:"af-pipeline-brand",title:i.flowId?`${i.flowId} · ${oe}`:oe||"PROJECT",children:[o.jsx("span",{className:"af-pipeline-brand-name",children:Wv}),o.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",q7,"-STABLE"]})]}),o.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[o.jsx("button",{type:"button",className:a==="workspace"?"af-view-switch__active":"",onClick:()=>Ym("workspace"),children:"Workspace"}),o.jsx("button",{type:"button",className:a==="display"?"af-view-switch__active":"",onClick:()=>Ym("display"),children:"Display"}),o.jsx("button",{type:"button",className:a==="workflow"?"af-view-switch__active":"",onClick:()=>Ym("workflow"),children:"Workflow"})]})]}),o.jsxs("div",{className:"af-pipeline-top-right af-workspace-actions",children:[o.jsx("span",{className:"af-workspace-save-status",children:CR}),ut?o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:Se||!(at!=null&&at.absoluteUrl)&&x.nodeIds.length===0,onClick:()=>{Xt(""),Nt(!0)},title:at!=null&&at.absoluteUrl?"查看展示链接":x.nodeIds.length===0?"先添加展示节点":"生成展示链接",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Se?"hourglass_empty":"ios_share"}),Se?"生成中":at!=null&&at.absoluteUrl?"展示链接":"生成链接"]}),o.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",disabled:Qa.length===0,onClick:()=>Cn(!0),title:Qa.length===0?"当前 workspace 没有 display 节点":"选择展示节点 (A)",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add_to_photos"}),"添加展示"]})]}):null,o.jsxs("button",{type:"button",className:"af-workspace-display-share-btn",onClick:eM,title:"查看我的展示分享",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder_shared"}),"我的分享"]}),o.jsx("button",{type:"button",className:"af-icon-btn",disabled:!iv,onClick:()=>u(!0),"aria-label":e("project:archiveModal.title"),title:e("project:archiveModal.title"),children:o.jsx("span",{className:"material-symbols-outlined",children:"archive"})}),o.jsx("button",{type:"button",className:"af-icon-btn af-icon-btn--danger",disabled:!iv,onClick:()=>d(!0),"aria-label":e("flow:topbar.deletePipeline"),title:e("flow:topbar.deletePipeline"),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_forever"})}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Fd(!0),"aria-label":"快捷键",title:"快捷键 (?)",children:o.jsx("span",{className:"material-symbols-outlined",children:"help"})}),o.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(kc?" af-composer-topbar-btn--active":"")+(Gr?" af-composer-topbar-btn--running":""),disabled:ut||In,onClick:()=>{qa(null),Ka(b=>(b||ds(Zo()),!b))},children:"AI"}),o.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!ae,onClick:()=>qt().catch(b=>xe(String(b.message||b))),children:"Save"})]})]}),et?o.jsxs("div",{className:"af-flow-snippet-toast",role:"status","aria-live":"polite",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"check_circle"}),o.jsx("span",{children:et}),o.jsx("button",{type:"button",onClick:()=>fe(""),"aria-label":"关闭发布提示",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,o.jsxs("div",{className:"af-workspace-body"+(!ut&&!In&&(kc||Ke)?" af-workspace-body--drawer":"")+(!ut&&!In&&Sc?" af-workspace-body--sidebar-collapsed":"")+(ut?" af-workspace-body--display-mode":"")+(In?" af-workspace-body--workflow-mode":""),children:[!ut&&!In&&Sc?o.jsx("nav",{className:"af-workspace-rail","aria-label":"Workspace sidebar",children:o.jsxs("div",{className:"af-workspace-rail__stack",children:[o.jsxs("button",{type:"button",className:"af-workspace-rail__primary",onClick:()=>we(!0),"aria-label":"添加节点",title:"添加节点",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"}),o.jsx("span",{className:"af-workspace-rail__dot","aria-hidden":!0})]}),o.jsx("button",{type:"button",className:"af-workspace-rail__btn",onClick:()=>Dd(!1),"aria-label":"展开文件",title:"展开文件",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder"})}),o.jsx("span",{className:"af-workspace-rail__divider","aria-hidden":!0}),o.jsx("button",{type:"button",className:"af-workspace-rail__avatar",onClick:()=>Dd(!1),"aria-label":"展开侧边栏",title:(Sr==null?void 0:Sr.username)||(Sr==null?void 0:Sr.userId)||"展开侧边栏",children:GR})]})}):null,!ut&&!In?o.jsxs("aside",{ref:rn,className:"af-workspace-sidebar"+(Uo?" af-workspace-sidebar--resizing":""),"aria-hidden":Sc,style:{"--af-work-files-pane-height":`${Math.round(Yr)}px`},children:[o.jsxs("section",{className:"af-workspace-files-section",children:[o.jsxs("div",{className:"af-workspace-sidebar-head",children:[o.jsx("h2",{children:"Files"}),o.jsxs("div",{className:"af-workspace-sidebar-actions",children:[o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Dd(!0),"aria-label":"最小化侧边栏",title:"最小化侧边栏",children:o.jsx("span",{className:"material-symbols-outlined",children:"keyboard_double_arrow_left"})}),o.jsx("button",{type:"button",className:"af-icon-btn",disabled:!ae,onClick:()=>vM(ji),"aria-label":"新增文件",title:ji?`在 ${ji} 新增文件`:"新增文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),o.jsx("button",{type:"button",className:"af-icon-btn",disabled:!ae,onClick:()=>SM(ji),"aria-label":"新增文件夹",title:ji?`在 ${ji} 新增文件夹`:"新增文件夹",children:o.jsx("span",{className:"material-symbols-outlined",children:"create_new_folder"})}),o.jsx("button",{type:"button",className:"af-icon-btn",disabled:!ae||_e,onClick:()=>vv(ji),"aria-label":"上传文件",title:ji?`上传到 ${ji}`:"上传文件",children:o.jsx("span",{className:"material-symbols-outlined",children:_e?"hourglass_top":"upload_file"})}),o.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>void Pn(),"aria-label":"刷新文件",title:"刷新文件",children:o.jsx("span",{className:"material-symbols-outlined",children:"refresh"})}),o.jsx("input",{ref:It,type:"file",multiple:!0,className:"af-visually-hidden",onChange:OR})]})]}),o.jsx("input",{className:"af-workspace-search",value:$t,onChange:b=>Kt(b.target.value),placeholder:"搜索文件..."}),o.jsx("div",{className:"af-workspace-files-scroll",onClick:UR,children:o.jsx(fT,{items:qR,onOpen:wM,selectedPath:Ur,collapsedDirs:sr,onToggleDir:gM,onSelect:b=>q(b.path||""),onFileDragStart:yM,onDelete:NM,onDownload:jM})})]}),o.jsx("button",{type:"button",className:"af-workspace-sidebar-resizer",onPointerDown:bR,role:"separator","aria-orientation":"horizontal","aria-label":"调整 Files 和 Palette 区域大小",title:"拖动调整 Files / Palette 高度"}),o.jsxs("section",{className:"af-workspace-nodes-section",children:[o.jsxs("div",{className:"af-node-palette-head af-workspace-node-palette-head",children:[o.jsxs("h2",{className:"af-node-palette-title",children:[o.jsx("span",{children:"Palette"}),o.jsx("span",{className:"af-node-palette-title-kbd","aria-label":"快捷键 A",children:"A"})]}),o.jsxs("label",{className:"af-palette-search-wrap",children:[o.jsx("span",{className:"af-visually-hidden",children:re==="flows"?"搜索流程片段":"搜索节点"}),o.jsx("span",{className:"af-palette-search-icon material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",className:"af-palette-search-input",value:se,onChange:b=>te(b.target.value),placeholder:re==="flows"?"搜索流程片段...":"搜索节点...","aria-label":re==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsxs("div",{className:"af-palette-tabs",role:"tablist","aria-label":"Palette 类型",children:[o.jsxs("button",{type:"button",role:"tab","aria-selected":re==="nodes",className:"af-palette-tab"+(re==="nodes"?" af-palette-tab--active":""),onClick:()=>ne("nodes"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),o.jsxs("button",{type:"button",role:"tab","aria-selected":re==="flows",className:"af-palette-tab"+(re==="flows"?" af-palette-tab--active":""),onClick:()=>ne("flows"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),"流程"]})]})]}),o.jsx("div",{className:"af-node-palette-scroll af-workspace-node-palette-scroll",children:re==="flows"?o.jsxs(o.Fragment,{children:[o.jsx("section",{className:"af-palette-section af-flow-palette-section--snippets",children:o.jsxs("div",{className:"af-flow-snippet-actions",children:[o.jsxs("button",{type:"button",className:"af-flow-snippet-publish-btn",onClick:XR,disabled:Kn.length<2,title:Kn.length<2?"选择至少两个节点后发布流程片段":"发布选中的流程片段",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"ios_share"}),"发布选中片段"]}),o.jsxs("span",{className:"af-flow-snippet-selection",children:["已选 ",Kn.length," 节点 / ",Qd.length," 连线"]})]})}),Je?o.jsx("p",{className:"af-err af-palette-list-err",children:Je}):null,me?o.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段..."}):Ov.length>0?o.jsxs("section",{className:"af-palette-section af-flow-palette-section--snippets",children:[o.jsx("h3",{className:"af-palette-cat",children:"FLOW SNIPPETS"}),o.jsx("div",{className:"af-palette-cards",children:Ov.map(b=>{const S=`${b.id}@${b.version}`,A=b.displayName||b.name||b.id,M=b.description||`${b.nodeCount||0} 个节点,${b.edgeCount||0} 条连线`;return o.jsxs("button",{type:"button",className:"af-palette-card af-flow-snippet-card",draggable:!0,onDragStart:H=>{H.dataTransfer.effectAllowed="move",H.dataTransfer.setData("application/agentflow-snippet",S),H.dataTransfer.setData("text/plain",S)},onClick:()=>Tc(b),title:M,children:[o.jsxs("span",{className:"af-palette-card-head",children:[o.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:"account_tree"})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:A}),o.jsxs("span",{className:"af-palette-card-id",children:[b.id,"@",b.version]})]})]}),M?o.jsx("span",{className:"af-palette-card-desc",children:M}):null,o.jsxs("span",{className:"af-flow-snippet-meta","aria-hidden":!0,children:[o.jsxs("span",{children:[b.nodeCount||0," nodes"]}),o.jsxs("span",{children:[b.edgeCount||0," edges"]})]})]},S)})})]}):o.jsx("p",{className:"af-palette-empty",children:se.trim()?"没有匹配的流程片段":"暂无流程片段。选择多个节点后发布。"})]}):o.jsxs(o.Fragment,{children:[ul.map(b=>{var S;return(S=Vm[b])!=null&&S.length?o.jsxs("section",{className:`af-palette-section af-flow-palette-section--${b}`,children:[o.jsx("h3",{className:"af-palette-cat",children:b}),o.jsx("div",{className:"af-palette-cards",children:Vm[b].map(A=>{const M=Uj(A.inputs,"input"),H=Uj(A.outputs,"output"),U=ow(A),Y=ou(A);return o.jsxs("button",{type:"button",className:"af-palette-card",draggable:!0,onDragStart:J=>xM(J,A),onClick:()=>Ci(A),title:U||A.id,children:[o.jsxs("span",{className:"af-palette-card-head",children:[o.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:Kj(b)})}),o.jsxs("span",{className:"af-palette-card-main",children:[o.jsx("span",{className:"af-palette-card-label",children:Y}),Y!==A.id?o.jsx("span",{className:"af-palette-card-id",children:A.id}):null]})]}),U?o.jsx("span",{className:"af-palette-card-desc",children:U}):null,o.jsxs("span",{className:"af-palette-card-ports","aria-hidden":!0,children:[o.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--in",children:[o.jsxs("span",{className:"af-palette-card-port-count",children:[M.list.length," IN"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[M.shown.map((J,Q)=>o.jsxs("span",{className:"af-palette-card-port",title:qj("input",J,Q),children:[o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Sn(J==null?void 0:J.type)}}),o.jsx("span",{className:"af-palette-card-port-name",children:Kf(J,Q)})]},`in-${Q}`)),M.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",M.hidden]}):null]})]}),o.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--out",children:[o.jsxs("span",{className:"af-palette-card-port-count",children:[H.list.length," OUT"]}),o.jsxs("span",{className:"af-palette-card-port-list",children:[H.shown.map((J,Q)=>o.jsxs("span",{className:"af-palette-card-port",title:qj("output",J,Q),children:[o.jsx("span",{className:"af-palette-card-port-name",children:Kf(J,Q)}),o.jsx("span",{className:"af-palette-card-port-dot",style:{background:Sn(J==null?void 0:J.type)}})]},`out-${Q}`)),H.hidden>0?o.jsxs("span",{className:"af-palette-card-port-more",children:["+",H.hidden]}):null]})]})]})]},A.id)})})]},b):null}),ie.length>0&&se.trim()&&ul.every(b=>{var S;return!((S=Vm[b])!=null&&S.length)})?o.jsx("p",{className:"af-palette-empty",children:"没有匹配的节点"}):null]})})]})]}):null,In?o.jsx(XU,{projectId:Wv,tapdId:ir,setTapdId:yR,snapshot:en,loading:xR,error:wR,actionRunning:Cm,actionOutput:_m,pendingConfirm:us,conflict:wc,reviewPublishing:Em,onRefresh:()=>Wd(ir),onRunDryRun:PR,onConfirmAction:IR,onRetryConflict:TR,onPublishReview:RR}):o.jsxs("main",{ref:v,className:"af-workspace-canvas",tabIndex:-1,onPointerDownCapture:mM,children:[o.jsx(AP,{className:"af-flow-canvas af-workspace-flow"+(Om==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select")+(ut?" af-workspace-flow--display-mode":""),nodes:HR,edges:WR,nodeTypes:AU,onNodesChange:aM,onEdgesChange:lM,onConnect:ut?void 0:uM,onConnectStart:ut?void 0:dM,onConnectEnd:ut?void 0:fM,isValidConnection:ut?void 0:cM,onNodeClick:(b,S)=>{var A;if(ut){B([ay(S.id)]);return}if((A=S==null?void 0:S.data)!=null&&A.isWorkspaceGroup){xt("");return}if(b.detail>=3){Ka(!1),h(M=>M.map(H=>({...H,selected:H.id===S.id}))),k(M=>M.map(H=>({...H,selected:!1}))),xt(S.id);return}nt&&xt(S.id)},onNodeDoubleClick:b=>{b.preventDefault()},onPaneClick:()=>{ut?B([]):xt("")},onDrop:ut?void 0:bM,onDragOver:ut?void 0:kM,nodesDraggable:ut?!0:ae,nodesConnectable:ut?!1:ae,edgesReconnectable:ut?!1:ae,deleteKeyCode:ut?null:ae?["Backspace","Delete"]:null,selectionOnDrag:Om==="select",panOnDrag:Om==="pan"?!0:[1,2],panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,children:o.jsx(IP,{color:"rgba(255,255,255,0.12)",gap:22,size:1})}),!ut&&D?(()=>{var J;const b=String(D.query||"").trim().toLowerCase(),S=D.mode==="create"?"create":"existing",A=Array.isArray(D.candidates)?D.candidates:[],M=Array.isArray(D.existingCandidates)?D.existingCandidates:[],H=b?A.filter(Q=>{var ue,be,ge;return[(ue=Q.def)==null?void 0:ue.id,Q.displayLabel,Q.description,(be=Q.slot)==null?void 0:be.name,(ge=Q.slot)==null?void 0:ge.type].filter(Boolean).some(Ee=>String(Ee).toLowerCase().includes(b))}):A,U=b?M.filter(Q=>{var ue,be;return[Q.nodeId,Q.nodeLabel,Q.definitionId,(ue=Q.slot)==null?void 0:ue.name,(be=Q.slot)==null?void 0:be.type].filter(Boolean).some(ge=>String(ge).toLowerCase().includes(b))}):M,Y=D.draft.handleType==="source"?"IN":"OUT";return o.jsxs("div",{className:"af-connect-node-menu",style:{left:D.left,top:D.top},role:"dialog","aria-label":"选择匹配节点",children:[o.jsxs("div",{className:"af-connect-node-menu__head",children:[o.jsxs("div",{className:"af-connect-node-menu__title",children:[o.jsx("span",{className:"af-connect-node-menu__dot",style:{background:Sn((J=D.draft.slot)==null?void 0:J.type)},"aria-hidden":!0}),o.jsxs("span",{children:["匹配 ",D.draft.slotType," 节点"]})]}),o.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>$(null),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("div",{className:"af-connect-node-menu__tabs",role:"tablist","aria-label":"连接方式",children:[o.jsxs("button",{type:"button",className:S==="existing"?"af-connect-node-menu__tab af-connect-node-menu__tab--active":"af-connect-node-menu__tab",disabled:M.length===0,onClick:()=>$(Q=>Q&&{...Q,mode:"existing",query:""}),children:["连接已有 ",o.jsx("span",{children:M.length})]}),o.jsxs("button",{type:"button",className:S==="create"?"af-connect-node-menu__tab af-connect-node-menu__tab--active":"af-connect-node-menu__tab",disabled:A.length===0,onClick:()=>$(Q=>Q&&{...Q,mode:"create",query:""}),children:["新建节点 ",o.jsx("span",{children:A.length})]})]}),o.jsxs("label",{className:"af-connect-node-menu__search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:D.query,onChange:Q=>$(ue=>ue&&{...ue,query:Q.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),o.jsxs("div",{className:"af-connect-node-menu__list",children:[S==="create"?H.map(Q=>{var ge,Ee;const ue=Q.displayLabel||((ge=Q.def)==null?void 0:ge.id),be=Kf(Q.slot,Q.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>pM(Q),title:Q.description||Q.def.id,children:[o.jsxs("span",{className:"af-connect-node-menu__item-main",children:[o.jsx("span",{className:"af-connect-node-menu__item-label",children:ue}),ue!==Q.def.id?o.jsx("span",{className:"af-connect-node-menu__item-id",children:Q.def.id}):null]}),o.jsxs("span",{className:"af-connect-node-menu__port",children:[o.jsx("span",{children:Y}),o.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:Sn((Ee=Q.slot)==null?void 0:Ee.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:be})]})]},`${Q.def.id}-${Q.slotIndex}`)}):U.map(Q=>{var ge;const ue=Q.nodeLabel||Q.nodeId,be=Kf(Q.slot,Q.slotIndex);return o.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>hM(Q),title:`${Q.definitionId||Q.nodeId} · ${be}`,children:[o.jsxs("span",{className:"af-connect-node-menu__item-main",children:[o.jsx("span",{className:"af-connect-node-menu__item-label",children:ue}),o.jsxs("span",{className:"af-connect-node-menu__item-id",children:[Q.definitionId?`${Q.definitionId} · `:"",Q.nodeId]})]}),o.jsxs("span",{className:"af-connect-node-menu__port",children:[o.jsx("span",{children:Y}),o.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:Sn((ge=Q.slot)==null?void 0:ge.type)},"aria-hidden":!0}),o.jsx("span",{className:"af-connect-node-menu__port-name",children:be}),Q.occupied?o.jsx("span",{className:"af-connect-node-menu__port-badge",children:"替换"}):null]})]},`${Q.nodeId}-${Q.handleId}`)}),(S==="create"?H.length:U.length)===0?o.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null,!ut&&!In&&!NR?o.jsx("div",{className:"af-workspace-composer af-bottom-composer-stack af-flow-bottom-composer",children:o.jsxs("div",{className:"af-pipeline-composer-inner",children:[o.jsx("button",{type:"button",className:"af-workspace-composer-minimize",onClick:()=>Mm(!0),"aria-label":"最小化 AI 输入框",title:"最小化",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"remove"})}),o.jsx("div",{className:"af-composer-selected","aria-label":"Selected workspace nodes",children:Kn.length===0?o.jsx("span",{className:"af-composer-selected-empty",children:"选择画布节点后,可作为本次 Workspace AI 的上下文。"}):Kn.map(b=>{var H,U;const S=String(((H=b.data)==null?void 0:H.label)??b.id),A=(U=b.data)!=null&&U.definitionId?String(b.data.definitionId):"",M=A&&A!==S?`${S} · ${b.id} · ${A}`:`${S} · ${b.id}`;return o.jsxs("div",{className:"af-composer-node-chip",title:M,children:[o.jsx("span",{className:"af-composer-node-chip-kind",children:A||"node"}),o.jsx("span",{className:"af-composer-node-chip-label",children:S}),o.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>oM(b.id),"aria-label":`取消选择 ${b.id}`,children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},b.id)})}),o.jsxs("div",{className:"af-composer-card af-composer-card--input-only",children:[o.jsx("div",{className:"af-composer-input-wrap",children:o.jsx("textarea",{className:"af-composer-textarea",value:Go,rows:2,onChange:b=>Tm(b.target.value),onKeyDown:b=>{(b.metaKey||b.ctrlKey)&&b.key==="Enter"&&(b.preventDefault(),nf())},placeholder:"描述你想在 workspace 中生成、分析或展示的内容",autoComplete:"off",spellCheck:!1,disabled:!ae})}),o.jsxs("div",{className:"af-composer-toolbar",children:[o.jsxs("div",{className:"af-composer-skills-field",children:[o.jsxs("button",{ref:Im,type:"button",className:"af-composer-skills-button"+(js.length>0?" af-composer-skills-button--active":""),disabled:Gr||!ae,"aria-haspopup":"listbox","aria-expanded":Od,onClick:()=>Pm(b=>!b),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),o.jsx("span",{children:js.length>0?`Skills ${js.length}`:"Skills"})]}),Od&&!Gr?Cr.createPortal(o.jsx("div",{ref:zk,className:"af-composer-skills-menu",role:"listbox","aria-label":"Skills",style:vR,children:Ns.length===0?o.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):o.jsxs(o.Fragment,{children:[Za.groups.map(b=>{const S=$o(b,Ns),A=bO(b,Km,Ns),M=kR.has(b.id);return o.jsxs("div",{className:"af-composer-skill-group af-composer-skill-group--framed"+(M?" af-composer-skill-group--collapsed":""),children:[o.jsxs("div",{className:"af-composer-skill-group-title af-composer-skill-group-title--selectable",children:[o.jsxs("label",{className:"af-composer-skill-group-check",children:[o.jsx("input",{type:"checkbox",checked:A==="all",disabled:S.length===0,onChange:H=>{const U=H.target.checked;xc(Y=>U?xO(Y,S):wO(Y,S))}}),o.jsxs("span",{className:"af-composer-skill-group-title-main",children:[o.jsx("span",{children:b.name}),b.builtin?o.jsx("em",{children:"built-in"}):null,A==="partial"?o.jsx("em",{children:"partial"}):null]})]}),o.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":M?`展开 ${b.name}`:`收起 ${b.name}`,onClick:()=>{Fk(H=>{const U=new Set(H);return U.has(b.id)?U.delete(b.id):U.add(b.id),U})},children:[o.jsx("span",{children:b.skills.length}),o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:M?"expand_more":"expand_less"})]})]}),M?null:o.jsx("div",{className:"af-composer-skill-group-items",children:b.skills.map(H=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:Km.has(H.key),onChange:U=>{const Y=U.target.checked;xc(J=>Y?J.includes(H.key)?J:[...J,H.key]:J.filter(Q=>Q!==H.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:H.name}),H.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:H.description}):null]})]},`${b.id}:${H.key}`))})]},b.id)}),Za.ungrouped.length>0?o.jsxs("div",{className:"af-composer-skill-group",children:[o.jsxs("div",{className:"af-composer-skill-group-title",children:[o.jsx("span",{children:"Ungrouped"}),o.jsx("span",{children:Za.ungrouped.length})]}),Za.ungrouped.map(b=>o.jsxs("label",{className:"af-composer-skill-option",children:[o.jsx("input",{type:"checkbox",checked:Km.has(b.key),onChange:S=>{const A=S.target.checked;xc(M=>A?M.includes(b.key)?M:[...M,b.key]:M.filter(H=>H!==b.key))}}),o.jsxs("span",{className:"af-composer-skill-option-main",children:[o.jsx("span",{className:"af-composer-skill-option-title",children:b.name}),b.description?o.jsx("span",{className:"af-composer-skill-option-desc",children:b.description}):null]})]},`ungrouped:${b.key}`))]}):null]})}),document.body):null]}),o.jsx("label",{className:"af-composer-model-field",children:o.jsxs("select",{className:"af-composer-model-select",value:vi,onChange:b=>pR(b.target.value),"aria-label":"模型",children:[o.jsx("option",{value:"",children:"默认模型"}),YR.map(b=>o.jsx("option",{value:b.value,children:b.label},b.value))]})}),o.jsx("button",{type:"button",className:"af-composer-send"+(Go.trim()&&!Gr?" af-composer-send--active":"")+(Gr?" af-composer-send--stop":""),disabled:Gr||!Go.trim()||!ae,"aria-label":Gr?"Running":"Send",onClick:()=>void nf(),children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Gr?"sync":"arrow_upward"})})]})]})]})}):!ut&&!In?o.jsx("button",{type:"button",className:"af-workspace-composer-fab",onClick:()=>Mm(!1),"aria-label":"展开 AI 输入框",title:"展开 AI 输入框",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"auto_awesome"})}):null]}),!ut&&!In&&kc?o.jsx("aside",{className:"af-pipeline-drawer af-pipeline-drawer--wide af-workspace-composer-drawer","aria-label":"Workspace AI Composer",children:o.jsxs("div",{className:"af-composer-sidebar",children:[o.jsxs("div",{className:"af-pipeline-drawer-head",children:[o.jsx("h2",{className:"af-pipeline-drawer-title",children:"AI Composer"}),o.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:()=>Ka(!1),"aria-label":"关闭 AI 对话侧栏",children:o.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),o.jsxs("div",{className:"af-composer-session-tabs",children:[o.jsx("button",{type:"button",className:"af-composer-session-tab"+(Tr==="workspace"?" af-composer-session-tab--active":""),ref:Tr==="workspace"?Rm:null,onClick:()=>ds("workspace"),children:o.jsx("span",{className:"af-composer-session-label",children:"Workspace"})}),Cs.map(b=>o.jsxs("div",{role:"tab",tabIndex:0,ref:Tr===b.id?Rm:null,className:"af-composer-session-tab"+(Tr===b.id?" af-composer-session-tab--active":"")+(b.status==="running"||b.status==="stopping"?" af-composer-session-tab--running":""),onClick:()=>ds(b.id),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),ds(b.id))},title:b.runNodeId||b.label,children:[o.jsx("span",{className:"af-composer-session-label",children:b.label}),o.jsx("button",{type:"button",className:"af-composer-session-close",onClick:S=>{S.preventDefault(),S.stopPropagation(),$R(b.id)},"aria-label":`关闭 ${b.label}`,title:"关闭 tab",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]},b.id))]}),o.jsx("div",{className:"af-composer-sidebar-status"+(nl?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:Hv}),o.jsxs("div",{className:"af-composer-sidebar-thread",ref:Wk,children:[o.jsx(r1,{messages:CM,running:nl,showRunningIndicator:!Xn}),Jm.length>0?o.jsxs("details",{className:"af-composer-sidebar-log-details",...nl?{open:!0}:{},children:[o.jsx("summary",{children:"执行日志"}),o.jsx(r1,{messages:Jm,running:!1,showRunningIndicator:!1})]}):null]}),o.jsxs("div",{className:"af-composer-sidebar-input",children:[o.jsx("textarea",{className:"af-composer-sidebar-textarea",value:Go,rows:3,onChange:b=>Tm(b.target.value),onKeyDown:b=>{(b.metaKey||b.ctrlKey)&&b.key==="Enter"&&(b.preventDefault(),nf())},placeholder:Xn?"继续追问、总结或要求调整这次结果":"继续描述你想让 AI 在 workspace 中做什么",disabled:!ae||nl}),o.jsx("button",{type:"button",className:"af-composer-sidebar-send",disabled:!ae||nl||!Go.trim(),onClick:()=>void nf(),"aria-label":"发送 AI 对话",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_upward"})})]})]})}):!ut&&!In&&Ke&&tn?o.jsx("aside",{className:"af-pipeline-drawer af-workspace-node-drawer","aria-label":"Workspace Node Properties",children:o.jsx(A7,{draft:Ke,setDraft:Re,definitionId:String(((Kv=tn.data)==null?void 0:Kv.definitionId)||tn.id),systemPromptReadonly:String(((qv=tn.data)==null?void 0:qv.description)||""),modelLists:Yo,disabled:!ae,onIdBlur:()=>Wm(!0),onClose:()=>xt(""),onPublishToMarketplace:MR,error:ki,ioSlots:{inputs:Array.isArray(Ke==null?void 0:Ke.inputs)?Ke.inputs:[],outputs:Array.isArray(Ke==null?void 0:Ke.outputs)?Ke.outputs:[]}})}):null,!ut&&!In&&vc?Cr.createPortal(o.jsx("div",{className:"af-workspace-run-logs-overlay",role:"presentation",onMouseDown:()=>qa(null),children:o.jsx("aside",{className:"af-workspace-run-logs-drawer","aria-label":"Workspace Run Logs",onMouseDown:b=>b.stopPropagation(),children:o.jsx(h7,{flowParams:i,scheduleNodeId:vc.scheduleNodeId,runNodeId:vc.runNodeId,lastRunId:vc.lastRunId,label:vc.label,onClose:()=>qa(null)})})}),document.body):null,o.jsx(u7,{open:$m,onClose:()=>Fd(!1)}),o.jsx(f7,{open:Lm,onClose:()=>Gk(!1),onJump:KR,nodes:VR}),o.jsx(P7,{open:c,onClose:()=>u(!1),flowId:i.flowId||"",flowSource:zd,onArchived:()=>{u(!1),n("/projects?tab=archived")}}),o.jsx(I7,{open:p&&!!i.flowId,onClose:()=>d(!1),flowId:i.flowId||"",flowSource:zd,flowArchived:!!i.archived,onDeleted:async()=>{d(!1),n("/projects")}}),ot?Cr.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal",role:"dialog","aria-modal":"true","aria-label":"发布流程片段",children:[o.jsxs("div",{className:"af-flow-snippet-modal__head",children:[o.jsxs("span",{className:"af-flow-snippet-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"ios_share"}),"发布流程片段"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>gt(!1),"aria-label":"关闭",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("div",{className:"af-flow-snippet-modal__body",children:[o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"名称"}),o.jsx("input",{type:"text",value:yt.name,onChange:b=>{const S=b.target.value;Ae(A=>({...A,name:S,id:A.id?A.id:S.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")}))},placeholder:"例如:内容整理片段",autoFocus:!0})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"ID"}),o.jsx("input",{type:"text",value:yt.id,onChange:b=>Ae(S=>({...S,id:b.target.value})),placeholder:"content-cleanup-snippet"})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"说明"}),o.jsx("textarea",{value:yt.description,onChange:b=>Ae(S=>({...S,description:b.target.value})),placeholder:"这段流程适合什么 workspace 场景、需要接哪些上下游。",rows:4})]}),o.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",Kn.length," 个节点和 ",Qd.length," 条内部连线。"]}),Wt?o.jsx("div",{className:"af-flow-snippet-error",children:Wt}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>gt(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:dt||!yt.name.trim(),onClick:()=>void QR(),children:dt?"发布中...":"发布"})]})]})}),document.body):null,Pv?o.jsx(yU,{node:Pv,onClose:()=>Qt("")}):null,Ve?Cr.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal af-display-share-modal",role:"dialog","aria-modal":"true","aria-label":to?"新建分享":"发布展示页",children:[o.jsxs("div",{className:"af-flow-snippet-modal__head",children:[o.jsxs("span",{className:"af-flow-snippet-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"present_to_all"}),to?"新建分享":"发布展示页"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>Qe(!1),"aria-label":"关闭",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("div",{className:"af-flow-snippet-modal__body",children:[o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"标题"}),o.jsx("input",{type:"text",value:Z.title,onChange:b=>Ce(S=>({...S,title:b.target.value})),placeholder:"展示页标题",autoFocus:!0})]}),to?null:o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"布局"}),o.jsxs("select",{className:"af-display-share-select",value:Z.layout,onChange:b=>Ce(S=>({...S,layout:b.target.value})),children:[o.jsx("option",{value:"gallery",children:"Gallery"}),o.jsx("option",{value:"document",children:"Document"}),o.jsx("option",{value:"slides",children:"Slides"})]})]}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"有效期"}),o.jsx("select",{className:"af-display-share-select",value:Jj(Z),onChange:b=>{const S=b.target.value;Ce(A=>({...A,permanent:S==="permanent",expiresInDays:S==="permanent"?A.expiresInDays||30:Number(S)}))},children:ly.map(b=>o.jsx("option",{value:b.value,children:b.label},b.value))})]}),o.jsxs("div",{className:"af-display-share-node-list",role:"group","aria-label":to?"分享内容":"选择展示节点",children:[to?o.jsx("span",{className:"af-display-share-node-list__label",children:"分享内容"}):null,_M.map(b=>{var A;const S=Array.isArray(Z.nodeIds)&&Z.nodeIds.includes(b.id);return o.jsxs("label",{className:"af-display-share-node-row",children:[o.jsx("input",{type:"checkbox",checked:S,disabled:to,onChange:()=>ZR(b.id)}),o.jsxs("span",{className:"af-display-share-node-row__main",children:[o.jsx("strong",{children:((A=b.data)==null?void 0:A.label)||b.id}),o.jsxs("small",{children:[kn(b.data)," · ",b.id]})]})]},b.id)})]}),at!=null&&at.absoluteUrl?o.jsxs("div",{className:"af-display-share-result",children:[o.jsx("input",{type:"text",readOnly:!0,value:at.absoluteUrl,onFocus:b=>b.target.select()}),o.jsx("button",{type:"button",onClick:()=>window.open(at.absoluteUrl,"_blank","noopener,noreferrer"),children:"打开"}),o.jsx("button",{type:"button",onClick:()=>void Fv(),children:$n==="copied"?"已复制":$n==="failed"?"复制失败":"复制"})]}):null,dn?o.jsx("div",{className:"af-flow-snippet-error",children:dn}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>Qe(!1),children:"取消"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:Se||!Array.isArray(Z.nodeIds)||Z.nodeIds.length===0,onClick:()=>void tM(),children:Se?"生成中...":"生成链接"})]})]})}),document.body):null,Pt?Cr.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal af-display-link-modal",role:"dialog","aria-modal":"true","aria-label":"展示链接",children:[o.jsxs("div",{className:"af-flow-snippet-modal__head",children:[o.jsxs("span",{className:"af-flow-snippet-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"link"}),"展示链接"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>{Xt(""),Nt(!1)},"aria-label":"关闭",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("div",{className:"af-flow-snippet-modal__body",children:[at!=null&&at.absoluteUrl?o.jsxs("div",{className:"af-display-link-modal__url",children:[o.jsx("input",{type:"text",readOnly:!0,value:at.absoluteUrl,onFocus:b=>b.target.select(),autoFocus:!0}),o.jsxs("button",{type:"button",onClick:()=>window.open(at.absoluteUrl,"_blank","noopener,noreferrer"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"}),"打开"]}),o.jsxs("button",{type:"button",onClick:()=>void Fv(),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:$n==="copied"?"check":"content_copy"}),$n==="copied"?"已复制":$n==="failed"?"复制失败":"复制"]})]}):o.jsx("div",{className:"af-display-link-modal__empty",children:"还没有生成展示链接"}),o.jsxs("label",{className:"af-flow-snippet-field",children:[o.jsx("span",{children:"新链接有效期"}),o.jsx("select",{className:"af-display-share-select",value:Jj(Z),onChange:b=>{const S=b.target.value;Ce(A=>({...A,permanent:S==="permanent",expiresInDays:S==="permanent"?A.expiresInDays||30:Number(S)}))},children:ly.map(b=>o.jsx("option",{value:b.value,children:b.label},b.value))})]}),dn?o.jsx("div",{className:"af-flow-snippet-error",children:dn}):null]}),o.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>{Xt(""),Nt(!1)},children:"关闭"}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:Se||x.nodeIds.length===0,onClick:()=>void nM(),children:Se?"生成中...":at!=null&&at.absoluteUrl?"更新链接":"生成链接"})]})]})}),document.body):null,Hn?Cr.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal af-display-shares-modal",role:"dialog","aria-modal":"true","aria-label":"我的分享",children:[o.jsxs("div",{className:"af-flow-snippet-modal__head",children:[o.jsxs("span",{className:"af-flow-snippet-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder_shared"}),"我的分享"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>Yn(!1),"aria-label":"关闭",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("div",{className:"af-flow-snippet-modal__body",children:[o.jsxs("div",{className:"af-display-shares-toolbar",children:[o.jsx("span",{children:Wn.length?`${Wn.length} 个分享`:"暂无分享"}),o.jsxs("button",{type:"button",onClick:()=>void As(),disabled:Gn,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),"刷新"]})]}),Ir?o.jsx("div",{className:"af-flow-snippet-error",children:Ir}):null,Gn?o.jsx("div",{className:"af-display-link-modal__empty",children:"Loading..."}):null,!Gn&&Wn.length===0?o.jsx("div",{className:"af-display-link-modal__empty",children:"还没有创建过展示分享"}):null,o.jsx("div",{className:"af-display-shares-list",children:Wn.map(b=>{const S=Qj(b),A=cs===b.id,M=b.expiresAt?String(b.expiresInDays||30):"permanent";return o.jsxs("article",{className:"af-display-share-item",children:[o.jsxs("div",{className:"af-display-share-item__main",children:[o.jsx("strong",{children:b.title||"AgentFlow Display"}),o.jsxs("span",{children:[b.flowId||"-"," · ",b.layout||"gallery"," · ",Array.isArray(b.nodeIds)?b.nodeIds.length:0," nodes"]}),o.jsx("small",{children:Qq(b)})]}),o.jsx("input",{className:"af-display-share-item__url",type:"text",readOnly:!0,value:S,onFocus:H=>H.target.select()}),o.jsx("select",{className:"af-display-share-select",value:M,disabled:A,onChange:H=>void sM(b,H.target.value),"aria-label":"修改分享有效期",children:ly.map(H=>o.jsx("option",{value:H.value,children:H.label},H.value))}),o.jsxs("div",{className:"af-display-share-item__actions",children:[o.jsxs("button",{type:"button",onClick:()=>window.open(S,"_blank","noopener,noreferrer"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"}),"打开"]}),o.jsxs("button",{type:"button",onClick:()=>void rM(b),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:rr===b.id?"check":"content_copy"}),rr===b.id?"已复制":"复制"]}),o.jsxs("button",{type:"button",className:"af-display-share-item__danger",disabled:A,onClick:()=>void iM(b),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:A?"hourglass_empty":"link_off"}),"撤销"]})]})]},b.id)})})]})]})}),document.body):null,Vn?Cr.createPortal(o.jsx("div",{className:"af-flow-snippet-modal-overlay",children:o.jsxs("div",{className:"af-flow-snippet-modal af-display-picker-modal",role:"dialog","aria-modal":"true","aria-label":"选择展示节点",children:[o.jsxs("div",{className:"af-flow-snippet-modal__head",children:[o.jsxs("span",{className:"af-flow-snippet-modal__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add_to_photos"}),"选择展示节点"]}),o.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>Cn(!1),"aria-label":"关闭",children:o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),o.jsxs("div",{className:"af-flow-snippet-modal__body",children:[o.jsxs("label",{className:"af-display-picker-search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{type:"search",value:kr,onChange:b=>Gs(b.target.value),placeholder:"搜索展示节点...",autoFocus:!0})]}),o.jsx("div",{className:"af-display-picker-grid",role:"group","aria-label":"选择展示节点",style:{"--af-display-picker-columns":Lv.length||1},children:Zd.length>0?Lv.map((b,S)=>o.jsx("div",{className:"af-display-picker-column",children:b.map(JR)},`display-picker-column-${S}`)):o.jsx("div",{className:"af-display-picker-empty",children:Qa.length===0?"当前 Workspace 没有 display 节点":"没有匹配的展示节点"})})]}),o.jsx("div",{className:"af-flow-snippet-modal__foot",children:o.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",onClick:()=>Cn(!1),children:"完成"})})]})}),document.body):null,pe.nodeId?Cr.createPortal(o.jsx(LU,{files:qr,query:pe.query,onQueryChange:b=>Pe(S=>({...S,query:b})),onSelect:DR,onUpload:vv,onClose:zm}),document.body):null,!ut&&!In&&le?Cr.createPortal(o.jsx("div",{className:"af-workspace-quick-add-backdrop",onMouseDown:()=>we(!1),children:o.jsxs("div",{className:"af-workspace-quick-add",role:"dialog","aria-modal":"true","aria-label":"Add workspace node",onMouseDown:b=>b.stopPropagation(),children:[o.jsxs("div",{className:"af-workspace-quick-add__tabs",role:"tablist","aria-label":"选择添加类型",children:[o.jsx("button",{type:"button",role:"tab","aria-selected":De==="nodes",className:"af-workspace-quick-add__tab"+(De==="nodes"?" af-workspace-quick-add__tab--active":""),onClick:()=>wt("nodes"),children:"节点"}),o.jsx("button",{type:"button",role:"tab","aria-selected":De==="flows",className:"af-workspace-quick-add__tab"+(De==="flows"?" af-workspace-quick-add__tab--active":""),onClick:()=>wt("flows"),children:"流程"})]}),o.jsxs("div",{className:"af-workspace-quick-add__search",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),o.jsx("input",{ref:Bk,value:Zt,onChange:b=>on(b.target.value),onKeyDown:b=>{if(b.key==="Escape")b.preventDefault(),we(!1);else if(b.key==="ArrowDown"){b.preventDefault();const S=De==="flows"?Pc.length:Ac.length;ur(A=>Math.min(Math.max(0,S-1),A+1))}else b.key==="ArrowUp"?(b.preventDefault(),ur(S=>Math.max(0,S-1))):b.key==="Tab"?(b.preventDefault(),wt(S=>S==="nodes"?"flows":"nodes")):b.key==="Enter"&&(b.preventDefault(),De==="flows"?Bv(Pc[An]||Pc[0]):zv(Ac[An]||Ac[0]))},placeholder:De==="flows"?"搜索流程片段...":"搜索节点...","aria-label":De==="flows"?"搜索流程片段":"搜索节点"})]}),o.jsx("div",{className:"af-workspace-quick-add__list",children:De==="flows"?Pc.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:me?"正在加载流程片段...":Je||"没有匹配的流程片段"}):Pc.map((b,S)=>{const A=b.displayName||b.name||b.id,M=b.snippet&&typeof b.snippet=="object"?b.snippet.instances:null,H=b.snippet&&typeof b.snippet=="object"?b.snippet.edges:null,U=Number.isFinite(Number(b.nodeCount))?Number(b.nodeCount):Object.keys(M||{}).length,Y=Number.isFinite(Number(b.edgeCount))?Number(b.edgeCount):Array.isArray(H)?H.length:0;return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(S===An?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>ur(S),onClick:()=>Bv(b),children:[o.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:"schema"}),o.jsxs("span",{className:"af-workspace-quick-add__main",children:[o.jsx("span",{className:"af-workspace-quick-add__label",children:A}),o.jsxs("span",{className:"af-workspace-quick-add__meta",children:[b.id,b.version?` · v${b.version}`:""]}),o.jsx("span",{className:"af-workspace-quick-add__desc",children:b.description||`${U} 节点 / ${Y} 连线`})]}),o.jsx("span",{className:"af-workspace-quick-add__cat",children:"FLOW"})]},`${b.id}@${b.version}`)}):Ac.length===0?o.jsx("div",{className:"af-workspace-quick-add__empty",children:"没有匹配的节点"}):Ac.map((b,S)=>{const A=iu(b),M=ou(b),H=ow(b);return o.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(S===An?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>ur(S),onClick:()=>zv(b),children:[o.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:Kj(A)}),o.jsxs("span",{className:"af-workspace-quick-add__main",children:[o.jsx("span",{className:"af-workspace-quick-add__label",children:M}),o.jsx("span",{className:"af-workspace-quick-add__meta",children:b.id}),H?o.jsx("span",{className:"af-workspace-quick-add__desc",children:H}):null]}),o.jsx("span",{className:"af-workspace-quick-add__cat",children:A})]},b.id)})})]})}),document.body):null]})]})}function ZU(){return o.jsx(Mb,{children:o.jsx(QU,{})})}function eY(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],n=(e==null?void 0:e.kind)==="image"?"src":"content",r=a=>String((a==null?void 0:a.value)??(a==null?void 0:a.default)??""),s=a=>r(a).trim(),i=t.find(a=>(a==null?void 0:a.name)===n&&s(a))||t.find(a=>(a==null?void 0:a.name)==="filePath"&&s(a))||t.find(a=>(a==null?void 0:a.type)==="text"&&s(a));return String((e==null?void 0:e.body)||(i?r(i):""))}function tY(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 nY(e){let t=String(e||"").replace(/\r\n/g,`
|
|
263
|
-
`).trim();return t.includes(`
|
|
264
|
-
`)||(t=t.replace(/\s+(resultFile|result|outParams|outParams\.[A-Za-z_][A-Za-z0-9_-]*)\s*:/g,`
|
|
265
|
-
$1:`).replace(/(^|\n)outParams:\s+([A-Za-z_][A-Za-z0-9_-]*\s*:)/g,`$1outParams:
|
|
266
|
-
$2`)),t}function bT(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=nY(n[1]),l=a.match(/^resultFile\s*:\s*["']?([^"'\n]+)["']?/m);if(l!=null&&l[1])return l[1].trim();const c=a.match(/^result\s*:\s*(.*)$/m);if(c){const p=String(c[1]||"").trim();return p==="|"||p===">"?a.slice((c.index||0)+c[0].length).split(`
|
|
267
|
-
`).filter(f=>/^\s+/.test(f)||!f.trim()).map(f=>f.replace(/^\s{2}/,"")).join(`
|
|
268
|
-
`).replace(/\s+$/g,""):p.replace(/^["']|["']$/g,"")}const u=t.replace(n[0],"").trim();if(u)return u}if(!/["']result["']\s*:|["']outParams["']\s*:|["']resultFile["']\s*:/i.test(t))return String(e||"");const r=[t],s=t.indexOf("{"),i=t.lastIndexOf("}");s>=0&&i>s&&r.unshift(t.slice(s,i+1));for(const a of r)try{const l=JSON.parse(a);if(l&&typeof l=="object"&&!Array.isArray(l)&&(Object.prototype.hasOwnProperty.call(l,"result")||Object.prototype.hasOwnProperty.call(l,"resultFile"))){const c=l.resultFile||l.result;return typeof c=="string"?c:JSON.stringify(c,null,2)}}catch{}return String(e||"")}function fk(e){let t=bT(e).trim();if(!t)return"";const n=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*?)```/);if(n&&n[1])t=n[1].trim();else{const i=t.match(/```(?:html|HTML)?\s*\n?([\s\S]*)$/);i&&i[1]&&(t=i[1].trim())}t=t.replace(/^html\s*\n/i,"").replace(/```\s*$/g,"").trim();const s=[/<!doctype\b/i,/<html\b/i,/<head\b/i,/<body\b/i,/<style\b/i,/<script\b/i,/<main\b/i,/<section\b/i,/<article\b/i,/<div\b/i,/<svg\b/i,/<canvas\b/i].reduce((i,a)=>{const l=a.exec(t);return l?i<0?l.index:Math.min(i,l.index):i},-1);return s>0&&(t=t.slice(s).trim()),t}function rY(e){const t=fk(e);return t.trim()?/<[^>]*$/g.test(t)?"HTML 内容末尾存在未闭合标签,可能是生成或保存时被截断。":/^(?:<!doctype\b|<html\b)/i.test(t)&&!/<\/html\s*>/i.test(t)?"完整 HTML 文档缺少 </html> 结束标签,可能是生成或保存时被截断。":"":""}function sY(e){const t=fk(e);if(!t.trim())return"";const n=`<base target="_blank"><script data-agentflow-display-link-guard="1">
|
|
269
|
-
(() => {
|
|
270
|
-
document.addEventListener("click", (event) => {
|
|
271
|
-
const link = event.target && event.target.closest ? event.target.closest("a[href]") : null;
|
|
272
|
-
if (!link) return;
|
|
273
|
-
const rawHref = String(link.getAttribute("href") || "").trim();
|
|
274
|
-
if (!rawHref || rawHref.startsWith("#")) return;
|
|
275
|
-
if (/^javascript:/i.test(rawHref)) {
|
|
276
|
-
event.preventDefault();
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
event.preventDefault();
|
|
280
|
-
window.open(link.href, "_blank", "noopener,noreferrer");
|
|
281
|
-
}, true);
|
|
282
|
-
})();
|
|
283
|
-
<\/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 kT(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 iY(e,t,n={}){const r=String(e||"").trim();return r?kT(r,t,n):""}function oY({className:e="",children:t}){const n=m.useRef(null),r=m.useRef(null),[s,i]=m.useState({visible:!1,top:0,height:100}),a=m.useCallback(()=>{const p=n.current;if(!p)return;const d=Math.max(1,p.scrollHeight),f=Math.max(1,p.clientHeight),h=d>f+1,g=h?Math.max(12,f/d*100):100,k=Math.max(0,100-g),w=h?Math.min(k,p.scrollTop/Math.max(1,d-f)*k):0;i({visible:h,top:w,height:g})},[]);m.useEffect(()=>{const p=requestAnimationFrame(a),d=n.current;if(!d||typeof ResizeObserver>"u")return()=>cancelAnimationFrame(p);const f=new ResizeObserver(a);f.observe(d);for(const h of Array.from(d.children))f.observe(h);return()=>{cancelAnimationFrame(p),f.disconnect()}},[t,a]);const l=m.useCallback(p=>{const d=n.current;if(!d)return;const f=Math.max(0,d.scrollHeight-d.clientHeight);d.scrollTop=Math.min(1,Math.max(0,p))*f,a()},[a]),c=m.useCallback((p,d=0)=>{const f=r.current;if(!f)return 0;const h=f.getBoundingClientRect(),g=s.height/100*h.height,k=Math.max(1,h.height-g);return(p-h.top-d)/k},[s.height]),u=m.useCallback(p=>{if(!s.visible)return;p.preventDefault(),p.stopPropagation();const d=r.current;if(!d)return;const f=d.getBoundingClientRect(),h=s.top/100*f.height,g=s.height/100*f.height,w=p.clientY>=f.top+h&&p.clientY<=f.top+h+g?p.clientY-f.top-h:g/2;l(c(p.clientY,w));const y=x=>{x.preventDefault(),l(c(x.clientY,w))},v=()=>{window.removeEventListener("pointermove",y),window.removeEventListener("pointerup",v),window.removeEventListener("pointercancel",v)};window.addEventListener("pointermove",y),window.addEventListener("pointerup",v),window.addEventListener("pointercancel",v)},[c,l,s.height,s.top,s.visible]);return o.jsxs("div",{className:`af-public-display-node__body ${e} nowheel nopan nodrag`,children:[o.jsx("div",{ref:n,className:`af-public-display-node__scroller ${e} nowheel nopan nodrag`,onScroll:a,children:t}),o.jsx("div",{ref:r,className:"af-public-display-scrollbar"+(s.visible?" af-public-display-scrollbar--visible":""),onPointerDown:u,"aria-hidden":"true",children:o.jsx("span",{style:{height:`${s.height}%`,top:`${s.top}%`}})})]})}function dw({node:e,shareId:t,style:n,bare:r=!1}){const s=eY(e),i=e.kind==="html"?fk(s):e.kind==="react"?gm(s):bT(s),a=e.kind==="html"?rY(i):"",l=`af-public-display-node__body--${e.kind||"unknown"}`;return o.jsxs("section",{className:`af-public-display-node af-public-display-node--${e.kind||"unknown"}${r?" af-public-display-node--bare":""}`,style:n,children:[r?null:o.jsx("div",{className:"af-public-display-node__head",children:o.jsxs("div",{className:"af-public-display-node__title",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:tY(e.kind)}),o.jsx("strong",{children:e.label||e.id}),o.jsx("em",{children:e.definitionId||e.kind||"display"})]})}),o.jsx(oY,{className:l,children:a?o.jsx("div",{className:"af-public-display-empty",children:a}):i.trim()?o.jsxs(o.Fragment,{children:[e.kind==="html"?o.jsx("iframe",{title:e.label||e.id,sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox",srcDoc:sY(i)}):null,e.kind==="react"?o.jsx("iframe",{title:e.label||e.id,sandbox:"allow-scripts allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox",srcDoc:rk(i)}):null,e.kind==="image"?o.jsx("img",{src:kT(i,t),alt:e.label||e.id,loading:"lazy"}):null,e.kind==="markdown"?o.jsx("div",{className:"af-public-display-markdown",children:o.jsx(Xb,{content:i,resolveSrc:(c,u)=>iY(c,t,u)})}):null,e.kind==="chart"?o.jsx(Zb,{content:i}):null,e.kind==="table"?o.jsx(Qb,{content:i}):null,e.kind==="mermaid"||e.kind==="ascii"?o.jsx("pre",{children:i}):null]}):o.jsx("div",{className:"af-public-display-empty",children:"No display content"})})]})}function aY({data:e}){return o.jsx(dw,{node:e==null?void 0:e.node,shareId:e==null?void 0:e.shareId})}const lY={publicDisplay:aY};function cY(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 vT(){var l,c,u,p;const{path:e}=xi(),t=m.useMemo(()=>cY(e),[e]),[n,r]=m.useState({loading:!0,error:"",share:null,nodes:[]});m.useEffect(()=>{let d=!1;async function f(){if(!t){r({loading:!1,error:"Missing display share id",share:null,nodes:[]});return}r(h=>({...h,loading:!0,error:""}));try{const h=await fetch(`/api/display/share?id=${encodeURIComponent(t)}`),g=await h.json().catch(()=>({}));if(!h.ok)throw new Error(g.error||"展示页不存在");d||r({loading:!1,error:"",share:g.share||null,nodes:Array.isArray(g.nodes)?g.nodes:[]})}catch(h){d||r({loading:!1,error:String((h==null?void 0:h.message)||h),share:null,nodes:[]})}}return f(),()=>{d=!0}},[t]);const s=m.useMemo(()=>(Array.isArray(n.nodes)?n.nodes:[]).map((f,h)=>{const g=f.position&&typeof f.position.x=="number"&&typeof f.position.y=="number"?f.position:{x:120+h*40,y:100+h*32},k=f.size&&typeof f.size.width=="number"&&typeof f.size.height=="number"?f.size:{width:520,height:320};return{id:f.id,type:"publicDisplay",position:g,data:{node:f,shareId:t},selectable:!1,draggable:!1,style:{width:Math.max(1,Number(k.width)||520),height:Math.max(1,Number(k.height)||320)}}}),[t,n.nodes]),i=m.useMemo(()=>{var k;const d=(k=n.share)==null?void 0:k.viewport;if(!d||typeof d!="object")return null;const f=Number(d.x),h=Number(d.y),g=Number(d.zoom);return!Number.isFinite(f)||!Number.isFinite(h)||!Number.isFinite(g)?null:{x:f,y:h,zoom:Math.min(Math.max(g,.1),4)}},[(l=n.share)==null?void 0:l.viewport]);if(n.loading)return o.jsx("main",{className:"af-public-display-page",children:o.jsx("div",{className:"af-public-display-status",children:"Loading..."})});if(n.error)return o.jsx("main",{className:"af-public-display-page",children:o.jsxs("div",{className:"af-public-display-status af-public-display-status--error",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"error"}),o.jsx("span",{children:n.error})]})});const a=String(((c=n.share)==null?void 0:c.layout)||"").trim()||"gallery";if(a!=="canvas"){if(a==="single")return o.jsx("main",{className:"af-public-display-page af-public-display-page--single",children:o.jsx("div",{className:"af-public-display-grid",children:(n.nodes||[]).map(f=>o.jsx(dw,{node:f,shareId:t,bare:!0},f.id))})});const d=a==="slides"?"af-public-display-page--slides":a==="document"?"af-public-display-page--document":"af-public-display-page--gallery";return o.jsxs("main",{className:`af-public-display-page ${d}`,children:[o.jsxs("header",{className:"af-public-display-hero",children:[o.jsxs("div",{children:[o.jsx("p",{children:"AgentFlow Display"}),o.jsx("h1",{children:((u=n.share)==null?void 0:u.title)||"AgentFlow Display"})]}),o.jsx("span",{children:(p=n.share)!=null&&p.expiresAt?`有效期至 ${new Date(n.share.expiresAt).toLocaleString()}`:"永久有效"})]}),o.jsx("div",{className:"af-public-display-grid",children:(n.nodes||[]).map(f=>o.jsx(dw,{node:f,shareId:t},f.id))})]})}return o.jsx("main",{className:"af-public-display-page af-public-display-page--canvas",children:o.jsx(Mb,{children:o.jsx(AP,{className:"af-public-display-flow",nodes:s,edges:[],nodeTypes:lY,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnDrag:!0,noPanClassName:"nopan",noDragClassName:"nodrag",noWheelClassName:"nowheel",panOnScroll:!0,zoomOnScroll:!0,zoomOnPinch:!0,defaultViewport:i||void 0,fitView:!i,fitViewOptions:{padding:.18,duration:180},minZoom:.1,maxZoom:4,proOptions:{hideAttribution:!0},children:o.jsx(IP,{color:"rgba(255,255,255,0.12)",gap:22,size:1})})})})}const mt=e=>typeof e=="string",Gc=()=>{let e,t;const n=new Promise((r,s)=>{e=r,t=s});return n.resolve=e,n.reject=t,n},f1=e=>e==null?"":""+e,uY=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},dY=/###/g,p1=e=>e&&e.indexOf("###")>-1?e.replace(dY,"."):e,h1=e=>!e||mt(e),_u=(e,t,n)=>{const r=mt(t)?t.split("."):t;let s=0;for(;s<r.length-1;){if(h1(e))return{};const i=p1(r[s]);!e[i]&&n&&(e[i]=new n),Object.prototype.hasOwnProperty.call(e,i)?e=e[i]:e={},++s}return h1(e)?{}:{obj:e,k:p1(r[s])}},m1=(e,t,n)=>{const{obj:r,k:s}=_u(e,t,Object);if(r!==void 0||t.length===1){r[s]=n;return}let i=t[t.length-1],a=t.slice(0,t.length-1),l=_u(e,a,Object);for(;l.obj===void 0&&a.length;)i=`${a[a.length-1]}.${i}`,a=a.slice(0,a.length-1),l=_u(e,a,Object),l&&l.obj&&typeof l.obj[`${l.k}.${i}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${i}`]=n},fY=(e,t,n,r)=>{const{obj:s,k:i}=_u(e,t,Object);s[i]=s[i]||[],s[i].push(n)},Ch=(e,t)=>{const{obj:n,k:r}=_u(e,t);if(n)return n[r]},pY=(e,t,n)=>{const r=Ch(e,n);return r!==void 0?r:Ch(t,n)},ST=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?mt(e[r])||e[r]instanceof String||mt(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):ST(e[r],t[r],n):e[r]=t[r]);return e},ll=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var hY={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};const mY=e=>mt(e)?e.replace(/[&<>"'\/]/g,t=>hY[t]):e;class gY{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 yY=[" ",",","?","!",";"],xY=new gY(20),wY=(e,t,n)=>{t=t||"",n=n||"";const r=yY.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const s=xY.getRegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let i=!s.test(e);if(!i){const a=e.indexOf(n);a>0&&!s.test(e.substring(0,a))&&(i=!0)}return i},fw=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let s=e;for(let i=0;i<r.length;){if(!s||typeof s!="object")return;let a,l="";for(let c=i;c<r.length;++c)if(c!==i&&(l+=n),l+=r[c],a=s[l],a!==void 0){if(["string","number","boolean"].indexOf(typeof a)>-1&&c<r.length-1)continue;i+=c-i+1;break}s=a}return s},_h=e=>e&&e.replace("_","-"),bY={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 Eh{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||bY,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:(mt(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new Eh(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new Eh(this.logger,t)}}var ci=new Eh;class bm{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 g1 extends bm{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator,a=s.ignoreJSONStructure!==void 0?s.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;t.indexOf(".")>-1?l=t.split("."):(l=[t,n],r&&(Array.isArray(r)?l.push(...r):mt(r)&&i?l.push(...r.split(i)):l.push(r)));const c=Ch(this.data,l);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=l[0],n=l[1],r=l.slice(2).join(".")),c||!a||!mt(r)?c:fw(this.data&&this.data[t]&&this.data[t][n],r,i)}addResource(t,n,r,s){let i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator;let l=[t,n];r&&(l=l.concat(a?r.split(a):r)),t.indexOf(".")>-1&&(l=t.split("."),s=n,n=l[1]),this.addNamespaces(n),m1(this.data,l,s),i.silent||this.emit("added",t,n,r,s)}addResources(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const i in r)(mt(r[i])||Array.isArray(r[i]))&&this.addResource(t,n,i,r[i],{silent:!0});s.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,s,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},l=[t,n];t.indexOf(".")>-1&&(l=t.split("."),s=r,r=n,n=l[1]),this.addNamespaces(n);let c=Ch(this.data,l)||{};a.skipCopy||(r=JSON.parse(JSON.stringify(r))),s?ST(c,r,i):c={...c,...r},m1(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 NT={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,s){return e.forEach(i=>{this.processors[i]&&(t=this.processors[i].process(t,n,r,s))}),t}};const y1={};class Ah extends bm{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),uY(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=ci.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let i=n.ns||this.options.defaultNS||[];const a=r&&t.indexOf(r)>-1,l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!wY(t,r,s);if(a&&!l){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:mt(i)?[i]:i};const u=t.split(r);(r!==s||r===s&&this.options.ns.indexOf(u[0])>-1)&&(i=u.shift()),t=u.join(s)}return{key:t,namespaces:mt(i)?[i]:i}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const s=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:l}=this.extractFromKey(t[t.length-1],n),c=l[l.length-1],u=n.lng||this.language,p=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(p){const C=n.nsSeparator||this.options.nsSeparator;return s?{res:`${c}${C}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${C}${a}`}return s?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:a}const d=this.resolve(t,n);let f=d&&d.res;const h=d&&d.usedKey||a,g=d&&d.exactUsedKey||a,k=Object.prototype.toString.apply(f),w=["[object Number]","[object Function]","[object RegExp]"],y=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,x=!mt(f)&&typeof f!="boolean"&&typeof f!="number";if(v&&f&&x&&w.indexOf(k)<0&&!(mt(y)&&Array.isArray(f))){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const C=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,f,{...n,ns:l}):`key '${a} (${this.language})' returned an object instead of string.`;return s?(d.res=C,d.usedParams=this.getUsedParamsDetails(n),d):C}if(i){const C=Array.isArray(f),N=C?[]:{},j=C?g:h;for(const E in f)if(Object.prototype.hasOwnProperty.call(f,E)){const P=`${j}${i}${E}`;N[E]=this.translate(P,{...n,joinArrays:!1,ns:l}),N[E]===P&&(N[E]=f[E])}f=N}}else if(v&&mt(y)&&Array.isArray(f))f=f.join(y),f&&(f=this.extendTranslation(f,t,n,r));else{let C=!1,N=!1;const j=n.count!==void 0&&!mt(n.count),E=Ah.hasDefaultValue(n),P=j?this.pluralResolver.getSuffix(u,n.count,n):"",O=n.ordinal&&j?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",B=j&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),W=B&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${P}`]||n[`defaultValue${O}`]||n.defaultValue;!this.isValidLookup(f)&&E&&(C=!0,f=W),this.isValidLookup(f)||(N=!0,f=a);const L=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&N?void 0:f,R=E&&W!==f&&this.options.updateMissing;if(N||C||R){if(this.logger.log(R?"updateKey":"missingKey",u,c,a,R?W:f),i){const I=this.resolve(a,{...n,keySeparator:!1});I&&I.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let K=[];const D=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&D&&D[0])for(let I=0;I<D.length;I++)K.push(D[I]);else this.options.saveMissingTo==="all"?K=this.languageUtils.toResolveHierarchy(n.lng||this.language):K.push(n.lng||this.language);const $=(I,F,_)=>{const X=E&&_!==f?_:L;this.options.missingKeyHandler?this.options.missingKeyHandler(I,c,F,X,R,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(I,c,F,X,R,n),this.emit("missingKey",I,c,F,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&j?K.forEach(I=>{const F=this.pluralResolver.getSuffixes(I,n);B&&n[`defaultValue${this.options.pluralSeparator}zero`]&&F.indexOf(`${this.options.pluralSeparator}zero`)<0&&F.push(`${this.options.pluralSeparator}zero`),F.forEach(_=>{$([I],a+_,n[`defaultValue${_}`]||W)})}):$(K,a,W))}f=this.extendTranslation(f,t,n,d,r),N&&f===a&&this.options.appendNamespaceToMissingKey&&(f=`${c}:${a}`),(N||C)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}:${a}`:a,C?f:void 0):f=this.options.parseMissingKeyHandler(f))}return s?(d.res=f,d.usedParams=this.getUsedParamsDetails(n),d):f}extendTranslation(t,n,r,s,i){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||s.usedLng,s.usedNS,s.usedKey,{resolved:s});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=mt(t)&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let p;if(u){const f=t.match(this.interpolator.nestingRegexp);p=f&&f.length}let d=r.replace&&!mt(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),t=this.interpolator.interpolate(t,d,r.lng||this.language||s.usedLng,r),u){const f=t.match(this.interpolator.nestingRegexp),h=f&&f.length;p<h&&(r.nest=!1)}!r.lng&&this.options.compatibilityAPI!=="v1"&&s&&s.res&&(r.lng=this.language||s.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var f=arguments.length,h=new Array(f),g=0;g<f;g++)h[g]=arguments[g];return i&&i[0]===h[0]&&!r.context?(a.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${n[0]}`),null):a.translate(...h,n)},r)),r.interpolation&&this.interpolator.reset()}const l=r.postProcess||this.options.postProcess,c=mt(l)?[l]:l;return t!=null&&c&&c.length&&r.applyPostProcessor!==!1&&(t=NT.handle(c,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...s,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,s,i,a,l;return mt(t)&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(c,n),p=u.key;s=p;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&!mt(n.count),h=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),g=n.context!==void 0&&(mt(n.context)||typeof n.context=="number")&&n.context!=="",k=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(w=>{this.isValidLookup(r)||(l=w,!y1[`${k[0]}-${w}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&(y1[`${k[0]}-${w}`]=!0,this.logger.warn(`key "${s}" for languages "${k.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),k.forEach(y=>{if(this.isValidLookup(r))return;a=y;const v=[p];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,p,y,w,n);else{let C;f&&(C=this.pluralResolver.getSuffix(y,n.count,n));const N=`${this.options.pluralSeparator}zero`,j=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(v.push(p+C),n.ordinal&&C.indexOf(j)===0&&v.push(p+C.replace(j,this.options.pluralSeparator)),h&&v.push(p+N)),g){const E=`${p}${this.options.contextSeparator}${n.context}`;v.push(E),f&&(v.push(E+C),n.ordinal&&C.indexOf(j)===0&&v.push(E+C.replace(j,this.options.pluralSeparator)),h&&v.push(E+N))}}let x;for(;x=v.pop();)this.isValidLookup(r)||(i=x,r=this.getResource(y,w,x,n))}))})}),{res:r,usedKey:s,exactUsedKey:i,usedLng:a,usedNS:l}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,s):this.resourceStore.getResource(t,n,r,s)}getUsedParamsDetails(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const n=["defaultValue","ordinal","context","replace","lng","lngs","fallbackLng","ns","keySeparator","nsSeparator","returnObjects","returnDetails","joinArrays","postProcess","interpolation"],r=t.replace&&!mt(t.replace);let s=r?t.replace:t;if(r&&typeof t.count<"u"&&(s.count=t.count),this.options.interpolation.defaultVariables&&(s={...this.options.interpolation.defaultVariables,...s}),!r){s={...s};for(const i of n)delete s[i]}return s}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}const dy=e=>e.charAt(0).toUpperCase()+e.slice(1);class x1{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ci.create("languageUtils")}getScriptPartFromCode(t){if(t=_h(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=_h(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(mt(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]=dy(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]=dy(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=dy(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const s=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(s))&&(n=s)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const s=this.getLanguagePartFromCode(r);if(this.isSupportedCode(s))return n=s;n=this.options.supportedLngs.find(i=>{if(i===s)return i;if(!(i.indexOf("-")<0&&s.indexOf("-")<0)&&(i.indexOf("-")>0&&s.indexOf("-")<0&&i.substring(0,i.indexOf("-"))===s||i.indexOf(s)===0&&s.length>1))return i})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),mt(t)&&(t=[t]),Array.isArray(t))return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),s=[],i=a=>{a&&(this.isSupportedCode(a)?s.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return mt(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&i(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&i(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&i(this.getLanguagePartFromCode(t))):mt(t)&&i(this.formatLanguageCode(t)),r.forEach(a=>{s.indexOf(a)<0&&i(this.formatLanguageCode(a))}),s}}let kY=[{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}],vY={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 SY=["v1","v2","v3"],NY=["v4"],w1={zero:0,one:1,two:2,few:3,many:4,other:5},jY=()=>{const e={};return kY.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:vY[t.fc]}})}),e};class CY{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=ci.create("pluralResolver"),(!this.options.compatibilityJSON||NY.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=jY(),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=_h(t==="dev"?"en":t),s=n.ordinal?"ordinal":"cardinal",i=JSON.stringify({cleanedCode:r,type:s});if(i in this.pluralRulesCache)return this.pluralRulesCache[i];let a;try{a=new Intl.PluralRules(r,{type:s})}catch{if(!t.match(/-|_/))return;const c=this.languageUtils.getLanguagePartFromCode(t);a=this.getRule(c,n)}return this.pluralRulesCache[i]=a,a}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(s=>`${n}${s}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((s,i)=>w1[s]-w1[i]).map(s=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${s}`):r.numbers.map(s=>this.getSuffix(t,s,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const s=this.getRule(t,r);return s?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${s.select(n)}`:this.getSuffixRetroCompatible(s,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let s=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(s===2?s="plural":s===1&&(s=""));const i=()=>this.options.prepend&&s.toString()?this.options.prepend+s.toString():s.toString();return this.options.compatibilityJSON==="v1"?s===1?"":typeof s=="number"?`_plural_${s.toString()}`:i():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?i():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!SY.includes(this.options.compatibilityJSON)}}const b1=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,i=pY(e,t,n);return!i&&s&&mt(n)&&(i=fw(e,n,r),i===void 0&&(i=fw(t,n,r))),i},fy=e=>e.replace(/\$/g,"$$$$");class _Y{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=ci.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const{escape:n,escapeValue:r,useRawValueToEscape:s,prefix:i,prefixEscaped:a,suffix:l,suffixEscaped:c,formatSeparator:u,unescapeSuffix:p,unescapePrefix:d,nestingPrefix:f,nestingPrefixEscaped:h,nestingSuffix:g,nestingSuffixEscaped:k,nestingOptionsSeparator:w,maxReplaces:y,alwaysFormat:v}=t.interpolation;this.escape=n!==void 0?n:mY,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=s!==void 0?s:!1,this.prefix=i?ll(i):a||"{{",this.suffix=l?ll(l):c||"}}",this.formatSeparator=u||",",this.unescapePrefix=p?"":d||"-",this.unescapeSuffix=this.unescapePrefix?"":p||"",this.nestingPrefix=f?ll(f):h||ll("$t("),this.nestingSuffix=g?ll(g):k||ll(")"),this.nestingOptionsSeparator=w||",",this.maxReplaces=y||1e3,this.alwaysFormat=v!==void 0?v:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=(n,r)=>n&&n.source===r?(n.lastIndex=0,n):new RegExp(r,"g");this.regexp=t(this.regexp,`${this.prefix}(.+?)${this.suffix}`),this.regexpUnescape=t(this.regexpUnescape,`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`),this.nestingRegexp=t(this.nestingRegexp,`${this.nestingPrefix}(.+?)${this.nestingSuffix}`)}interpolate(t,n,r,s){let i,a,l;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},u=h=>{if(h.indexOf(this.formatSeparator)<0){const y=b1(n,c,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...s,...n,interpolationkey:h}):y}const g=h.split(this.formatSeparator),k=g.shift().trim(),w=g.join(this.formatSeparator).trim();return this.format(b1(n,c,k,this.options.keySeparator,this.options.ignoreJSONStructure),w,r,{...s,...n,interpolationkey:k})};this.resetRegExp();const p=s&&s.missingInterpolationHandler||this.options.missingInterpolationHandler,d=s&&s.interpolation&&s.interpolation.skipOnVariables!==void 0?s.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>fy(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?fy(this.escape(h)):fy(h)}].forEach(h=>{for(l=0;i=h.regex.exec(t);){const g=i[1].trim();if(a=u(g),a===void 0)if(typeof p=="function"){const w=p(t,i,s);a=mt(w)?w:""}else if(s&&Object.prototype.hasOwnProperty.call(s,g))a="";else if(d){a=i[0];continue}else this.logger.warn(`missed to pass in variable ${g} for interpolating ${t}`),a="";else!mt(a)&&!this.useRawValueToEscape&&(a=f1(a));const k=h.safeValue(a);if(t=t.replace(i[0],k),d?(h.regex.lastIndex+=a.length,h.regex.lastIndex-=i[0].length):h.regex.lastIndex=0,l++,l>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s,i,a;const l=(c,u)=>{const p=this.nestingOptionsSeparator;if(c.indexOf(p)<0)return c;const d=c.split(new RegExp(`${p}[ ]*{`));let f=`{${d[1]}`;c=d[0],f=this.interpolate(f,a);const h=f.match(/'/g),g=f.match(/"/g);(h&&h.length%2===0&&!g||g.length%2!==0)&&(f=f.replace(/'/g,'"'));try{a=JSON.parse(f),u&&(a={...u,...a})}catch(k){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,k),`${c}${p}${f}`}return a.defaultValue&&a.defaultValue.indexOf(this.prefix)>-1&&delete a.defaultValue,c};for(;s=this.nestingRegexp.exec(t);){let c=[];a={...r},a=a.replace&&!mt(a.replace)?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let u=!1;if(s[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(s[1])){const p=s[1].split(this.formatSeparator).map(d=>d.trim());s[1]=p.shift(),c=p,u=!0}if(i=n(l.call(this,s[1].trim(),a),a),i&&s[0]===t&&!mt(i))return i;mt(i)||(i=f1(i)),i||(this.logger.warn(`missed to resolve ${s[1]} for nesting ${t}`),i=""),u&&(i=c.reduce((p,d)=>this.format(p,d,r.lng,{...r,interpolationkey:s[1].trim()}),i.trim())),t=t.replace(s[0],i),this.regexp.lastIndex=0}return t}}const EY=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const s=r[1].substring(0,r[1].length-1);t==="currency"&&s.indexOf(":")<0?n.currency||(n.currency=s.trim()):t==="relativetime"&&s.indexOf(":")<0?n.range||(n.range=s.trim()):s.split(";").forEach(a=>{if(a){const[l,...c]=a.split(":"),u=c.join(":").trim().replace(/^'+|'+$/g,""),p=l.trim();n[p]||(n[p]=u),u==="false"&&(n[p]=!1),u==="true"&&(n[p]=!0),isNaN(u)||(n[p]=parseInt(u,10))}})}return{formatName:t,formatOptions:n}},cl=e=>{const t={};return(n,r,s)=>{let i=s;s&&s.interpolationkey&&s.formatParams&&s.formatParams[s.interpolationkey]&&s[s.interpolationkey]&&(i={...i,[s.interpolationkey]:void 0});const a=r+JSON.stringify(i);let l=t[a];return l||(l=e(_h(r),s),t[a]=l),l(n)}};class AY{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=ci.create("formatter"),this.options=t,this.formats={number:cl((n,r)=>{const s=new Intl.NumberFormat(n,{...r});return i=>s.format(i)}),currency:cl((n,r)=>{const s=new Intl.NumberFormat(n,{...r,style:"currency"});return i=>s.format(i)}),datetime:cl((n,r)=>{const s=new Intl.DateTimeFormat(n,{...r});return i=>s.format(i)}),relativetime:cl((n,r)=>{const s=new Intl.RelativeTimeFormat(n,{...r});return i=>s.format(i,r.range||"day")}),list:cl((n,r)=>{const s=new Intl.ListFormat(n,{...r});return i=>s.format(i)})},this.init(t)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};this.formatSeparator=n.interpolation.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=cl(n)}format(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const i=n.split(this.formatSeparator);if(i.length>1&&i[0].indexOf("(")>1&&i[0].indexOf(")")<0&&i.find(l=>l.indexOf(")")>-1)){const l=i.findIndex(c=>c.indexOf(")")>-1);i[0]=[i[0],...i.splice(1,l)].join(this.formatSeparator)}return i.reduce((l,c)=>{const{formatName:u,formatOptions:p}=EY(c);if(this.formats[u]){let d=l;try{const f=s&&s.formatParams&&s.formatParams[s.interpolationkey]||{},h=f.locale||f.lng||s.locale||s.lng||r;d=this.formats[u](l,h,{...p,...s,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return l},t)}}const PY=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class IY extends bm{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=ci.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=s.maxParallelReads||10,this.readingCalls=0,this.maxRetries=s.maxRetries>=0?s.maxRetries:5,this.retryTimeout=s.retryTimeout>=1?s.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,s.backend,s)}queueLoad(t,n,r,s){const i={},a={},l={},c={};return t.forEach(u=>{let p=!0;n.forEach(d=>{const f=`${u}|${d}`;!r.reload&&this.store.hasResourceBundle(u,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?a[f]===void 0&&(a[f]=!0):(this.state[f]=1,p=!1,a[f]===void 0&&(a[f]=!0),i[f]===void 0&&(i[f]=!0),c[d]===void 0&&(c[d]=!0)))}),p||(l[u]=!0)}),(Object.keys(i).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:s}),{toLoad:Object.keys(i),pending:Object.keys(a),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(c)}}loaded(t,n,r){const s=t.split("|"),i=s[0],a=s[1];n&&this.emit("failedLoading",i,a,n),!n&&r&&this.store.addResourceBundle(i,a,r,void 0,void 0,{skipCopy:!0}),this.state[t]=n?-1:2,n&&r&&(this.state[t]=0);const l={};this.queue.forEach(c=>{fY(c.loaded,[i],a),PY(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(u=>{l[u]||(l[u]={});const p=c.loaded[u];p.length&&p.forEach(d=>{l[u][d]===void 0&&(l[u][d]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r){let s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!t.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:s,wait:i,callback:a});return}this.readingCalls++;const l=(u,p)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&p&&s<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,s+1,i*2,a)},i);return}a(u,p)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const u=c(t,n);u&&typeof u.then=="function"?u.then(p=>l(null,p)).catch(l):l(null,u)}catch(u){l(u)}return}return c(t,n,l)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),s&&s();mt(t)&&(t=this.languageUtils.toResolveHierarchy(t)),mt(n)&&(n=[n]);const i=this.queueLoad(t,n,r,s);if(!i.toLoad.length)return i.pending.length||s(),null;i.toLoad.forEach(a=>{this.loadOne(a)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),s=r[0],i=r[1];this.read(s,i,"read",void 0,void 0,(a,l)=>{a&&this.logger.warn(`${n}loading namespace ${i} for language ${s} failed`,a),!a&&l&&this.logger.log(`${n}loaded namespace ${i} for language ${s}`,l),this.loaded(t,a,l)})}saveMissing(t,n,r,s,i){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},l=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const c={...a,isUpdate:i},u=this.backend.create.bind(this.backend);if(u.length<6)try{let p;u.length===5?p=u(t,n,r,s,c):p=u(t,n,r,s),p&&typeof p.then=="function"?p.then(d=>l(null,d)).catch(l):l(null,p)}catch(p){l(p)}else u(t,n,r,s,l,c)}!t||!t[0]||this.store.addResource(t[0],n,r,s)}}}const k1=()=>({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]),mt(e[1])&&(t.defaultValue=e[1]),mt(e[2])&&(t.tDescription=e[2]),typeof e[2]=="object"||typeof e[3]=="object"){const n=e[3]||e[2];Object.keys(n).forEach(r=>{t[r]=n[r]})}return t},interpolation:{escapeValue:!0,format:e=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}),v1=e=>(mt(e.ns)&&(e.ns=[e.ns]),mt(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),mt(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),Gf=()=>{},TY=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class cd extends bm{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=v1(t),this.services={},this.logger=ci,this.modules={external:[]},TY(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&&(mt(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const s=k1();this.options={...s,...this.options,...v1(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...s.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const i=p=>p?typeof p=="function"?new p:p:null;if(!this.options.isClone){this.modules.logger?ci.init(i(this.modules.logger),this.options):ci.init(null,this.options);let p;this.modules.formatter?p=this.modules.formatter:typeof Intl<"u"&&(p=AY);const d=new x1(this.options);this.store=new g1(this.options.resources,this.options);const f=this.services;f.logger=ci,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new CY(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),p&&(!this.options.interpolation.format||this.options.interpolation.format===s.interpolation.format)&&(f.formatter=i(p),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new _Y(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new IY(i(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(h){for(var g=arguments.length,k=new Array(g>1?g-1:0),w=1;w<g;w++)k[w-1]=arguments[w];t.emit(h,...k)}),this.modules.languageDetector&&(f.languageDetector=i(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=i(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new Ah(this.services,this.options),this.translator.on("*",function(h){for(var g=arguments.length,k=new Array(g>1?g-1:0),w=1;w<g;w++)k[w-1]=arguments[w];t.emit(h,...k)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=Gf),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const p=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);p.length>0&&p[0]!=="dev"&&(this.options.lng=p[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(p=>{this[p]=function(){return t.store[p](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(p=>{this[p]=function(){return t.store[p](...arguments),t}});const c=Gc(),u=()=>{const p=(d,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(f),r(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return p(null,this.t.bind(this));this.changeLanguage(this.options.lng,p)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),c}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Gf;const s=mt(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(s&&s.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const i=[],a=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(u=>{u!=="cimode"&&i.indexOf(u)<0&&i.push(u)})};s?a(s):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>a(c)),this.options.preload&&this.options.preload.forEach(l=>a(l)),this.services.backendConnector.load(i,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(l)})}else r(null)}reloadResources(t,n,r){const s=Gc();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=Gf),this.services.backendConnector.reload(t,n,i=>{s.resolve(),r(i)}),s}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&NT.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=Gc();this.emit("languageChanging",t);const i=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},a=(c,u)=>{u?(i(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,s.resolve(function(){return r.t(...arguments)}),n&&n(c,function(){return r.t(...arguments)})},l=c=>{!t&&!c&&this.services.languageDetector&&(c=[]);const u=mt(c)?c:this.services.languageUtils.getBestMatchFromCodes(c);u&&(this.language||i(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,p=>{a(p,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?l(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(l):this.services.languageDetector.detect(l):l(t),s}getFixedT(t,n,r){var s=this;const i=function(a,l){let c;if(typeof l!="object"){for(var u=arguments.length,p=new Array(u>2?u-2:0),d=2;d<u;d++)p[d-2]=arguments[d];c=s.options.overloadTranslationOptionHandler([a,l].concat(p))}else c={...l};c.lng=c.lng||i.lng,c.lngs=c.lngs||i.lngs,c.ns=c.ns||i.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||r||i.keyPrefix);const f=s.options.keySeparator||".";let h;return c.keyPrefix&&Array.isArray(a)?h=a.map(g=>`${c.keyPrefix}${f}${g}`):h=c.keyPrefix?`${c.keyPrefix}${f}${a}`:a,s.t(h,c)};return mt(t)?i.lng=t:i.lngs=t,i.ns=n,i.keyPrefix=r,i}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],s=this.options?this.options.fallbackLng:!1,i=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(l,c)=>{const u=this.services.backendConnector.state[`${l}|${c}`];return u===-1||u===0||u===2};if(n.precheck){const l=n.precheck(this,a);if(l!==void 0)return l}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,t)&&(!s||a(i,t)))}loadNamespaces(t,n){const r=Gc();return this.options.ns?(mt(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=Gc();mt(t)&&(t=[t]);const s=this.options.preload||[],i=t.filter(a=>s.indexOf(a)<0&&this.services.languageUtils.isSupportedCode(a));return i.length?(this.options.preload=s.concat(i),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new x1(k1());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 cd(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Gf;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const s={...this.options,...t,isClone:!0},i=new cd(s);return(t.debug!==void 0||t.prefix!==void 0)&&(i.logger=i.logger.clone(t)),["store","services","language"].forEach(l=>{i[l]=this[l]}),i.services={...this.services},i.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},r&&(i.store=new g1(this.store.data,s),i.services.resourceStore=i.store),i.translator=new Ah(i.services,s),i.translator.on("*",function(l){for(var c=arguments.length,u=new Array(c>1?c-1:0),p=1;p<c;p++)u[p-1]=arguments[p];i.emit(l,...u)}),i.init(s,n),i.translator.options=s,i.translator.backendConnector.services.utils={hasLoadedNamespace:i.hasLoadedNamespace.bind(i)},i}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const cr=cd.createInstance();cr.createInstance=cd.createInstance;cr.createInstance;cr.dir;cr.init;cr.loadResources;cr.reloadResources;cr.use;cr.changeLanguage;cr.getFixedT;cr.t;cr.exists;cr.setDefaultNamespace;cr.hasLoadedNamespace;cr.loadNamespaces;cr.loadLanguages;function RY(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ud(e){"@babel/helpers - typeof";return ud=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},ud(e)}function MY(e,t){if(ud(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(ud(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function $Y(e){var t=MY(e,"string");return ud(t)=="symbol"?t:t+""}function LY(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,$Y(r.key),r)}}function OY(e,t,n){return t&&LY(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var jT=[],DY=jT.forEach,FY=jT.slice;function zY(e){return DY.call(FY.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var S1=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,BY=function(t,n,r){var s=r||{};s.path=s.path||"/";var i=encodeURIComponent(n),a="".concat(t,"=").concat(i);if(s.maxAge>0){var l=s.maxAge-0;if(Number.isNaN(l))throw new Error("maxAge should be a Number");a+="; Max-Age=".concat(Math.floor(l))}if(s.domain){if(!S1.test(s.domain))throw new TypeError("option domain is invalid");a+="; Domain=".concat(s.domain)}if(s.path){if(!S1.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},N1={create:function(t,n,r,s){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(i.expires=new Date,i.expires.setTime(i.expires.getTime()+r*60*1e3)),s&&(i.domain=s),document.cookie=BY(t,encodeURIComponent(n),i)},read:function(t){for(var n="".concat(t,"="),r=document.cookie.split(";"),s=0;s<r.length;s++){for(var i=r[s];i.charAt(0)===" ";)i=i.substring(1,i.length);if(i.indexOf(n)===0)return i.substring(n.length,i.length)}return null},remove:function(t){this.create(t,"",-1)}},HY={name:"cookie",lookup:function(t){var n;if(t.lookupCookie&&typeof document<"u"){var r=N1.read(t.lookupCookie);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupCookie&&typeof document<"u"&&N1.create(n.lookupCookie,t,n.cookieMinutes,n.cookieDomain,n.cookieOptions)}},WY={name:"querystring",lookup:function(t){var n;if(typeof window<"u"){var r=window.location.search;!window.location.search&&window.location.hash&&window.location.hash.indexOf("?")>-1&&(r=window.location.hash.substring(window.location.hash.indexOf("?")));for(var s=r.substring(1),i=s.split("&"),a=0;a<i.length;a++){var l=i[a].indexOf("=");if(l>0){var c=i[a].substring(0,l);c===t.lookupQuerystring&&(n=i[a].substring(l+1))}}}return n}},Jc=null,j1=function(){if(Jc!==null)return Jc;try{Jc=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{Jc=!1}return Jc},VY={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&j1()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&j1()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},Xc=null,C1=function(){if(Xc!==null)return Xc;try{Xc=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{Xc=!1}return Xc},KY={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&C1()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&C1()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},qY={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}},UY={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}},YY={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}},GY={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]}},CT=!1;try{document.cookie,CT=!0}catch{}var _T=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];CT||_T.splice(1,1);function JY(){return{order:_T,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var ET=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};RY(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return OY(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=zY(r,this.options||{},JY()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(i){return i.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=s,this.addDetector(HY),this.addDetector(WY),this.addDetector(VY),this.addDetector(KY),this.addDetector(qY),this.addDetector(UY),this.addDetector(YY),this.addDetector(GY)}},{key:"addDetector",value:function(n){return this.detectors[n.name]=n,this}},{key:"detect",value:function(n){var r=this;n||(n=this.options.order);var s=[];return n.forEach(function(i){if(r.detectors[i]){var a=r.detectors[i].lookup(r.options);a&&typeof a=="string"&&(a=[a]),a&&(s=s.concat(a))}}),s=s.map(function(i){return r.options.convertDetectedLanguage(i)}),this.services.languageUtils.getBestMatchFromCodes?s:s.length>0?s[0]:null}},{key:"cacheUserLanguage",value:function(n,r){var s=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||r.forEach(function(i){s.detectors[i]&&s.detectors[i].cacheUserLanguage(n,s.options)}))}}])}();ET.type="languageDetector";const XY={name:"AgentFlow",tagline:"AI Workflow Orchestration"},QY={projects:"Projects",nodes:"Nodes",myNodes:"My Nodes",myFlows:"My Flows",skills:"Skills",mcps:"MCP",feedback:"Feedback",flowEditor:"Flow Editor",settings:"Settings",back:"Back"},ZY={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"},eG={success:"Success",failed:"Failed",pending:"Pending",running:"Running",skipped:"Skipped"},tG={agent:"Agent",control:"Control",tool:"Tool",start:"Start",end:"End"},nG={online:"Engine Online",offline:"Engine Offline",connecting:"Connecting…"},rG={hub:"AgentFlow Hub",docs:"Documentation",github:"GitHub Repository"},sG={app:XY,nav:QY,common:ZY,status:eG,nodeTypes:tG,engine:nG,links:rG},iG="Flow Editor",oG="Nodes",aG="Edges",lG="Properties",cG={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"},uG={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}}"},dG={run:"Run Flow",stop:"Stop",resume:"Resume",validate:"Validate",export:"Export",import:"Import"},fG={nodeList:"Node List",runHistory:"Run History",validation:"Validation Results"},pG={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"},hG={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)"},mG={saving:"Saving...",saved:"Saved",saveFailed:"Save failed",runInTerminal:"Please use terminal to run"},gG={requirement:"Requirement Analysis",planning:"Technical Planning",code:"Code Execution",test:"Test Regression",normal:"Normal"},yG={phase:"Phase",allPhasesComplete:"All phases completed",currentPhaseComplete:"Current phase completed, waiting for confirmation..."},xG={node:"Node",text:"Text",file:"File",bool:"Boolean"},wG={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"},bG={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"},kG={title:"Jump to node",placeholder:"Type node ID or label…",empty:"No matching nodes",hintNavigate:"navigate",hintJump:"jump",hintClose:"close"},vG={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."},SG={mainNav:"Main Navigation"},NG={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'},jG={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):
|
|
284
|
-
{{summary}}`,step:"Step {{current}}/{{total}}: {{description}}",phaseGeneration:`Phased generation ({{count}} phases): {{labels}}
|
|
285
|
-
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}}"},CG={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"},_G={nodePalette:"Node Palette",noPipelineSelected:"No pipeline selected",moreRuns:"+{{count}} more",moreFlows:"+{{count}} more flows",runId:"Run ID: {{id}}"},EG={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}}"},AG={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"},PG={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"},IG={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"},TG={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"},RG={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"},MG={invalidPlaceholder:"Invalid placeholder: {{hint}}",empty:"(empty)",inputSubtitle:"Input · {{type}}",inputSubtitleNoType:"Input",outputSubtitle:"Output · {{type}}",outputSubtitleNoType:"Output",runtimeConst:"Runtime constant"},$G={justNow:"Just now",minutesAgo:"{{n}} min ago",hoursAgo:"{{n}} hr ago",yesterday:"Yesterday",daysAgo:"{{n}} days ago",milliseconds:"{{n}} ms",seconds:"{{n}} s"},LG={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"},OG={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."},DG={title:"Print Output: {{instanceId}}",expand:"Expand",restore:"Restore"},FG={save:"Save",cancel:"Cancel"},zG={title:"Run with Params",noParams:"No input params in this flow",run:"Run",cancel:"Cancel"},BG={title:"Run with Preset",noPresets:"No presets available",default:"Default run",run:"Run",cancel:"Cancel"},HG={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"},WG={title:iG,nodes:oG,edges:aG,properties:lG,node:cG,nodeProps:uG,actions:dG,panel:fG,palette:pG,pipeline:hG,status:mG,roles:gG,phases:yG,types:xG,runContext:wG,shortcuts:bG,jumpPalette:kG,emptyCanvas:vG,sidebar:SG,validation:NG,composer:jG,topbar:CG,palette2:_G,run:EG,fileEdit:AG,settings:PG,schedule:IG,history:TG,nodePropsError:RG,placeholder:MG,time:$G,userCheck:LG,userAsk:OG,toolPrint:DG,provideEdit:FG,runParams:zG,runPreset:BG,runConfig:HG},VG="Settings",KG={engine:"Engine Settings",preferences:"Global Preferences"},qG={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)."},UG={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..."}},YG={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."},GG={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."},JG={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."},XG={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)"},QG={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"},ZG={title:"System Status",normal:"Service normal",abnormal:"Some interfaces abnormal",cursorModels:"Cursor Models",opencodeModels:"OpenCode Models",claudeCodeModels:"Claude Code Models",codexModels:"Codex Models"},eJ={title:"Shortcuts",projects:"Projects & Pipelines",flowEditor:"Node Canvas"},tJ={title:"Language",description:"Select your preferred language for the interface",options:{zh:"中文",en:"English",ja:"日本語"}},nJ={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."},rJ={title:VG,crumb:KG,workspace:qG,cursor:UG,opencode:YG,claudeCode:GG,codex:JG,env:XG,allowlist:QG,system:ZG,shortcuts:eJ,language:tJ,onboarding:nJ},sJ={thinking:"Thinking",result:"Result",reply:"Reply",error:"Error"},iJ={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)"},oJ={send:"Send",stop:"Stop",expand:"Expand",collapse:"Collapse",clear:"Clear"},aJ={conversation:"Chat",conversationWithNumber:"Chat {{num}}",default:"Default"},lJ={endSession:"End chat (will stop generation)",closeSession:"Close chat",newSession:"New chat",expandComposer:"Expand chat and output"},cJ={hint:"Use the bottom input box for AI chat, with @node mentions, model selection, and more"},uJ={aiLabels:sJ,placeholders:iJ,actions:oJ,labels:aJ,tooltips:lJ,rightPanel:cJ},dJ="Projects",fJ="All",pJ="Archived",hJ="Nodes",mJ="My Nodes",gJ="My Flows",yJ="Skills",xJ="Active Projects",wJ="Archived Pipelines",bJ="Global Nodes",kJ="All Nodes",vJ="My Nodes",SJ="Manage node versions published to the current workspace marketplace, {{count}} total.",NJ="Manage flow snippets published to the current workspace marketplace, {{count}} total.",jJ="Global Skills",CJ="Create New Project",_J="New Pipeline",EJ="SEARCH PIPELINES...",AJ="SEARCH NODES...",PJ="SEARCH FLOW SNIPPETS...",IJ="SEARCH SKILLS...",TJ="Refresh Resources",RJ="Loading pipelines...",MJ="Loading global resources...",$J="Filter result: {{count}} items (matching title, description, path and tags)",LJ="Archived pipelines can still be opened and edited; files are located in the _archived subdirectory of each pipelines directory.",OJ="Manage your distributed node architectures and monitoring pipelines. Drag flow.yaml or .zip into this page to import shared flows.",DJ="Review all globally available node definitions, {{count}} total, including built-in, workspace, and marketplace nodes.",FJ="Review Composer-selectable skills, {{count}} total, including AgentFlow built-ins and workspace skills.",zJ="Executable building blocks for pipeline runtime",BJ="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.",HJ="Published local node packages",WJ="Only node versions published to this workspace marketplace appear here. Inspect details and delete versions that no flow uses.",VJ="Published flow snippets",KJ="Flow snippets published from Pipeline or Workspace canvases appear here. Search and inspect them, then load them from the canvas flow palette.",qJ="Operating guides for Composer and agents",UJ="Skills tell AI which rules to follow for a task, how to change flows, and how to reuse project conventions.",YJ="No archived projects.",GJ="No active pipelines; archived items are in the Archived tab.",JJ="No global nodes available.",XJ="No marketplace nodes have been published.",QJ="No flow snippets have been published. Select multiple canvas nodes and publish them first.",ZJ="No skills available.",eX="No description.",tX='No node matches "{{query}}".',nX='No flow snippet matches "{{query}}".',rX='No skill matches "{{query}}".',sX="{{inputs}} in / {{outputs}} out",iX="Flow Snippet",oX="{{nodes}} nodes / {{edges}} edges",aX="Skill",lX="Node detail",cX="Flow snippet detail",uX="Skill detail",dX="Type",fX="Source",pX="Package",hX="Version",mX="Path",gX="Editable",yX="Read only",xX="Editable",wX="Schema",bX="Inputs",kX="Outputs",vX="Runtime",SX="Node Body",NX="Files",jX="Usage",CX="No runtime manifest.",_X="No node body or README.",EX="No previewable files.",AX="Select a file to preview.",PX="Binary file preview is not supported.",IX="Large file; showing the first 256KB only.",TX="No pipelines using this node were found.",RX="Node Management",MX="Delete Node Version",$X="Deleting...",LX="AgentFlow checks all flow references before deleting; installed or used versions are kept.",OX="Delete {{id}}@{{version}}? This cannot be undone.",DX="Deleted {{id}}@{{version}}.",FX="{{count}} flow(s) still use it.",zX="Flow Snippet Management",BX="Delete Flow Snippet",HX="Deleting...",WX="Deleting it only removes this reusable marketplace snippet. Nodes already loaded onto canvases are not changed.",VX="Delete {{id}}@{{version}}? This cannot be undone.",KX="Deleted {{id}}@{{version}}.",qX="No slots",UX="Purpose",YX="This node is an execution unit in a pipeline. Its schema affects canvas wiring, parameter input, and runtime scheduling.",GX="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.",JX="Scale",XX="Flow Preview",QX="Edges",ZX="Snippet JSON",eQ="{{count}} more edge(s)",tQ="No previewable nodes.",nQ="This skill is injected into Composer as context for AI, constraining its decisions, edit strategy, and output format.",rQ="SKILL.md Preview",sQ="No preview content available.",iQ="Select a resource to inspect details.",oQ="Failed to load pipeline list.",aQ="No pipelines in current workspace.",lQ="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.",cQ='No pipelines found matching "{{query}}". Try different keywords or clear the search.',uQ="Recent Activity",dQ="No recent activity",fQ="No recent activity matching the keyword",pQ="Recent Run",hQ="Recent Open",mQ={builtin:"Built-in",workspace:"Workspace",user:"User"},gQ={flow:"Flow",global:"Global",marketplace:"Marketplace"},yQ={all:"All",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},xQ={overview:"Overview",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},wQ="Open to edit this pipeline in the node canvas.",bQ={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>"},kQ={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"},vQ={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"},SQ={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"},NQ={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"},jQ={title:dJ,all:fJ,archived:pJ,nodes:hJ,myNodes:mJ,myFlows:gJ,skills:yJ,activeProjects:xJ,archivedPipelines:wJ,globalNodes:bJ,nodeScopeAll:kJ,nodeScopeMine:vJ,myNodesHint:SJ,myFlowsHint:NJ,globalSkills:jJ,createNew:CJ,newPipeline:_J,searchPipelines:EJ,searchNodes:AJ,searchFlows:PJ,searchSkills:IJ,refreshResources:TJ,loadingPipelines:RJ,loadingResources:MJ,filterResult:$J,archivedHint:LJ,activeHint:OJ,nodesHint:DJ,skillsHint:FJ,nodesPurposeTitle:zJ,nodesPurposeDesc:BJ,myNodesPurposeTitle:HJ,myNodesPurposeDesc:WJ,myFlowsPurposeTitle:VJ,myFlowsPurposeDesc:KJ,skillsPurposeTitle:qJ,skillsPurposeDesc:UJ,noArchived:YJ,noActive:GJ,noNodes:JJ,noMyNodes:XJ,noMyFlows:QJ,noSkills:ZJ,noDescription:eX,noNodeMatch:tX,noFlowSnippetMatch:nX,noSkillMatch:rX,nodeSlots:sX,flowSnippet:iX,flowSnippetNodes:oX,skill:aX,nodeDetail:lX,flowDetail:cX,skillDetail:uX,detailType:dX,detailSource:fX,detailPackage:pX,detailVersion:hX,detailPath:mX,detailEditable:gX,readOnly:yX,editable:xX,nodeSchema:wX,nodeInputs:bX,nodeOutputs:kX,nodeRuntime:vX,nodeBody:SX,nodeFiles:NX,nodeUsage:jX,noRuntimeManifest:CX,noNodeBody:_X,noNodeFiles:EX,selectNodeFile:AX,binaryFile:PX,fileTruncated:IX,noNodeUsage:TX,myNodeManagement:RX,deleteMyNode:MX,deletingMyNode:$X,deleteMyNodeHint:LX,deleteMyNodeConfirm:OX,deleteMyNodeSuccess:DX,deleteMyNodeUsedBy:FX,myFlowManagement:zX,deleteMyFlow:BX,deletingMyFlow:HX,deleteMyFlowHint:WX,deleteMyFlowConfirm:VX,deleteMyFlowSuccess:KX,noSlots:qX,resourceMeaning:UX,nodesMeaning:YX,myFlowsMeaning:GX,flowSnippetScale:JX,flowSnippetPreview:XX,flowSnippetEdges:QX,flowSnippetJson:ZX,flowSnippetMoreEdges:eQ,noFlowSnippetPreview:tQ,skillsMeaning:nQ,skillPreview:rQ,skillPreviewEmpty:sQ,selectResource:iQ,loadFailed:oQ,noPipelines:aQ,emptyHint:lQ,noMatch:cQ,recentActivity:uQ,noRecentActivity:dQ,noMatchRecent:fQ,recentRun:pQ,recentOpen:hQ,sourceBadge:mQ,resourceSource:gQ,resourceFilter:yQ,nodeDetailTabs:xQ,defaultCardDesc:wQ,hubCard:bQ,newPipelineModal:kQ,importModal:vQ,deleteModal:SQ,archiveModal:NQ},CQ="Back",_Q="Next",EQ="Skip",AQ="Done",PQ="Start Creating",IQ={intro:`Welcome to AgentFlow! This is a visual workflow orchestration tool.
|
|
286
|
-
|
|
287
|
-
Click the button below to create your first pipeline.`,hubIntro:`Don't want to start from scratch?
|
|
288
|
-
|
|
289
|
-
Browse ready-made pipelines on AgentFlow Hub — community-shared flows you can install and run in one click.`},TQ={intro:`Now you're in the flow editor.
|
|
290
|
-
|
|
291
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
292
|
-
|
|
293
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`,introEmpty:`The canvas is empty. Start creating your flow!
|
|
294
|
-
|
|
295
|
-
Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
|
|
296
|
-
|
|
297
|
-
The left node panel allows you to freely drag, delete, and adjust connections.`},RQ={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"},MQ={back:CQ,next:_Q,skip:EQ,done:AQ,startCreate:PQ,projects:IQ,flow:TQ,newPipeline:RQ},$Q={name:"AgentFlow",tagline:"AI 工作流编排"},LQ={projects:"项目",nodes:"Nodes",myNodes:"我的 Nodes",myFlows:"我的流程",skills:"Skills",mcps:"MCP",feedback:"意见反馈",flowEditor:"流程编辑器",settings:"设置",back:"返回"},OQ={loading:"加载中…",saving:"保存中…",save:"保存",cancel:"取消",delete:"删除",edit:"编辑",create:"创建",close:"关闭",confirm:"确认",copy:"复制",copied:"已复制!",refresh:"刷新",search:"搜索",filter:"筛选",success:"成功",error:"错误",warning:"警告",info:"信息",done:"完成",pending:"待处理",running:"运行中",notFound:"未找到",required:"必填",optional:"可选"},DQ={success:"成功",failed:"失败",pending:"等待",running:"运行中",skipped:"跳过"},FQ={agent:"Agent 节点",control:"控制节点",tool:"工具节点",start:"开始",end:"结束"},zQ={online:"引擎在线",offline:"引擎离线",connecting:"连接中…"},BQ={hub:"AgentFlow Hub",docs:"文档",github:"GitHub 仓库"},HQ={app:$Q,nav:LQ,common:OQ,status:DQ,nodeTypes:FQ,engine:zQ,links:BQ},WQ="流程编辑器",VQ="节点",KQ="连线",qQ="属性",UQ={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:"编辑内容"},YQ={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}}"},GQ={run:"运行流程",stop:"停止",resume:"继续",validate:"校验",export:"导出",import:"导入"},JQ={nodeList:"节点列表",runHistory:"运行历史",validation:"校验结果"},XQ={workspace:"工作区",loading:"加载中…",archived:"已归档",noPipelines:"暂无流水线",more:"更多",moreFlows:"更多流程",noRuns:"暂无运行记录",searchNodes:"搜索节点",noComponents:"暂无可用组件(检查节点库目录)",noMatch:"无匹配节点,请调整搜索词",selectPipeline:"从上方选择一条流水线以加载组件与画布",validationWarnings:"校验警告(与 agentflow validate 槽位检查一致)",output:"输出",model:"模型",userDir:"用户目录",toggleRecentActivity:"展开或收起最近打开或最近运行"},QQ={selectPipeline:"请从顶部下拉选择一条流水线",loadingProps:"加载节点属性…",pipelineId:"流水线 ID",diskPath:"磁盘路径",storageLocation:"存储位置",introduction:"介绍",introductionPlaceholder:"简要描述这条流水线的用途(写入 flow.yaml 的 ui.description)",metadata:"元数据",nodeCount:"节点数",nodesUnit:"个节点",loading:"加载中…",noRuns:"暂无运行记录(终端执行后会在工作区生成运行目录)"},ZQ={saving:"保存中…",saved:"已保存",saveFailed:"保存失败",runInTerminal:"运行请使用终端"},eZ={requirement:"需求拆解",planning:"技术规划",code:"代码执行",test:"测试回归",normal:"普通"},tZ={phase:"阶段",allPhasesComplete:"所有阶段完成",currentPhaseComplete:"当前阶段完成,等待确认继续…"},nZ={node:"节点",text:"文本",file:"文件",bool:"布尔"},rZ={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:"等待"},sZ={title:"快捷键",general:"常规",saveDesc:"保存;节点属性侧栏打开时先提交节点再保存 flow",shortcutsLabel:"快捷键",jumpToNode:"按 ID 跳转到节点",openNodePalette:"打开节点面板",canvas:"画布",selectTool:"选择工具",panTool:"平移工具",holdSpacePan:"按住空格临时平移",saveViewport:"保存当前进入视角",selectAll:"全选所有节点",undo:"撤销画布修改",redo:"重做画布修改"},iZ={title:"跳转到节点",placeholder:"输入节点 ID 或名称…",empty:"未匹配到节点",hintNavigate:"切换",hintJump:"跳转",hintClose:"关闭"},oZ={title:"开始构建你的流程",text:"在下方 AI 输入框中描述你的流程,或从左侧面板拖拽节点到画布",composerHint:"使用 AI Composer 构建 AgentFlow",composerSub:"从左侧拖入节点,或在<strong>下方输入框</strong>中用自然语言描述工作流。<br/>按 <kbd>?</kbd> 查看快捷键。"},aZ={mainNav:"主导航"},lZ={flowWarningAriaLabel:"流程校验警告",reloadFromServer:"从服务器重新加载流程并刷新校验",reloadFromServerShort:"从服务器重新加载",closeBanner:"关闭校验警告横幅",nodePrefix:"节点",focusNodeAriaLabel:"在画布中选中并定位节点 {{nodeId}}",slotWarningCount:"槽位校验 {{count}} 条(已隐藏)",show:"显示",shortcutHint:"按 ? 查看快捷键",shortcutHintLabel:"快捷键",inputSlotNoEdge:' 的 input 槽位 "{{slotName}}"({{handle}})无对应 edge 连接',outputSlotNoEdge:' 的 output 槽位 "{{slotName}}"({{handle}})无对应 edge 连接'},cZ={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}} 步):
|
|
298
|
-
{{summary}}`,step:"步骤 {{current}}/{{total}}: {{description}}",phaseGeneration:`分阶段生成({{count}} 阶段):{{labels}}
|
|
299
|
-
当前:{{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}}"},uZ={currentPipeline:"当前流水线",backToEdit:"返回编辑",backToProjects:"返回项目",executionLog:"执行日志",history:"历史",pipelineSettings:"流水线设置",shortcutsLabel:"快捷键",shortcutsTitle:"快捷键 (?)",deletePipeline:"删除流水线",resumeTitle:"在同一 run 目录继续执行(uuid={{uuid}})",resumeTitleNoUuid:"尚未收到 apply-start,将发起新的 run",rerunTitle:"从头开始新的运行",runOptions:"运行选项",runWithParams:"带参数运行",runWithPreset:"指定预设运行",editRun:"编辑运行参数",startRun:"开始执行",stopRun:"停止后台运行"},dZ={nodePalette:"节点调色板",noPipelineSelected:"未选择流水线",moreRuns:"+{{count}} 更多",moreFlows:"+{{count}} 更多流程",runId:"运行 ID: {{id}}"},fZ={connectingApi:"正在连接 /api/flow/run…",connectingApiResume:"正在连接 /api/flow/run(恢复 run uuid={{uuid}})…",connectedReceiving:"已连接执行流,正在接收 NDJSON 输出…",noBody:"响应无 body(无法流式读取),请检查浏览器与 agentflow ui 版本",nodeStart:"▶ 开始执行: {{instanceId}}",nodeStartWithLabel:"▶ 开始执行: {{instanceId}} ({{label}})",nodeDone:"✓ 完成: {{instanceId}}",nodeDoneWithElapsed:"✓ 完成: {{instanceId}} ({{elapsed}})",nodeFailed:"✗ 失败: {{instanceId}}",pipelineStart:"流水线开始执行 (uuid={{uuid}})",pipelineDone:"流水线执行完成",pipelineDoneWithElapsed:"流水线执行完成 ({{elapsed}})",pipelinePaused:"流水线暂停: 等待用户输入 ({{nodes}})",unknownError:"未知错误",executionEnd:"执行结束 (exit code: {{exitCode}})",executionStopped:"执行已暂停",pauseRun:"暂停运行(可稍后恢复)",pauseConfirm:"确认暂停当前 run?之后可从中断节点恢复。",pauseTitle:"暂停运行",pauseConfirmOk:"暂停",backPromptTitle:"返回项目列表",backPromptMessage:"流水线仍在运行,请选择处理方式:后台继续运行并退出,或停止后返回编辑。",backBackground:"后台运行并退出",backStopEdit:"停止并进入编辑",resizeConsole:"拖动调整执行日志高度",closeLog:"关闭日志",userCheckContent:"等待用户确认节点 {{instanceId}} 的内容",userAskPrompt:"等待用户选择节点 {{instanceId}} 的分支"},pZ={close:"关闭",loading:"加载中…",placeholder:"文件内容",largeFileWarning:"文件较大,编辑器性能可能受影响",reset:"重置",aiEdit:"AI 修改",aiRunning:"AI 处理中…",save:"保存",saving:"保存中…",saved:"已保存"},hZ={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:"已复制"},mZ={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:"定时配置已保存"},gZ={title:"执行历史",summary:"执行结果汇总",successCount:"{{count}} 成功",failedCount:"{{count}} 失败",stoppedCount:"{{count}} 已停止",interruptedCount:"{{count}} 已中断",runningCount:"{{count}} 进行中",success:"成功",failed:"失败",stopped:"已停止",interrupted:"已中断",running:"进行中",unknown:"未知",runLabel:"运行 #{{id}}",enterRunView:"进入该次运行的画布与日志态"},yZ={invalidInstanceId:"实例 ID 格式无效:仅允许英文字母、数字、下划线、短横线,且不能以数字开头。",duplicateInstanceId:"该实例 ID 已存在,请换一个。",loadFlowFailed:"读取 flow 失败",loadNodesFailed:"读取节点库失败"},xZ={invalidPlaceholder:"无效占位符: {{hint}}",empty:"(空)",inputSubtitle:"输入 · {{type}}",inputSubtitleNoType:"输入",outputSubtitle:"输出 · {{type}}",outputSubtitleNoType:"输出",runtimeConst:"运行时常量"},wZ={justNow:"刚刚",minutesAgo:"{{n}} 分钟前",hoursAgo:"{{n}} 小时前",yesterday:"昨天",daysAgo:"{{n}} 天前",milliseconds:"{{n}} 毫秒",seconds:"{{n}} 秒"},bZ={title:"用户确认 ({{instanceId}})",edit:"编辑",save:"保存",cancel:"取消",aiEditPlaceholder:"输入 AI 修改指令,如:删除第二项、合并前两项…",aiEditBtn:"AI 修改",aiEditStarted:"AI 正在修改内容…",aiEditDone:"AI 修改完成",aiEditFailed:"AI 修改失败",contentSaved:"内容已保存",saveFailed:"保存失败",close:"关闭",continue:"继续执行",hint:"编辑或使用 AI 修改后点击保存,然后点击「继续执行」恢复流程"},kZ={title:"用户选择 ({{instanceId}})",hint:"请从下方选项中选择一项以继续流程",submitting:"提交中…",submitFailed:"提交失败",close:"关闭",noOptions:"该节点未配置选项,请先在编辑器中为 output 槽位添加条目。"},vZ={title:"Print 输出: {{instanceId}}",expand:"放大",restore:"还原"},SZ={save:"保存",cancel:"取消"},NZ={title:"带参数运行",noParams:"此流程无输入参数",run:"运行",cancel:"取消"},jZ={title:"指定预设运行",noPresets:"无可用预设",default:"默认运行",run:"运行",cancel:"取消"},CZ={preset:"预设",default:"默认",newPreset:"新建预设",deletePreset:"删除预设",presetNamePlaceholder:"预设名称",inputParams:"输入参数",noProvideNodes:"此流程无 provide 节点",filePathPlaceholder:"文件路径…",stringValuePlaceholder:"值…",presetSaved:"预设已保存",presetDeleted:"预设已删除",savePreset:"保存当前预设",expandInput:"编辑内容"},_Z={title:WQ,nodes:VQ,edges:KQ,properties:qQ,node:UQ,nodeProps:YQ,actions:GQ,panel:JQ,palette:XQ,pipeline:QQ,status:ZQ,roles:eZ,phases:tZ,types:nZ,runContext:rZ,shortcuts:sZ,jumpPalette:iZ,emptyCanvas:oZ,sidebar:aZ,validation:lZ,composer:cZ,topbar:uZ,palette2:dZ,run:fZ,fileEdit:pZ,settings:hZ,schedule:mZ,history:gZ,nodePropsError:yZ,placeholder:xZ,time:wZ,userCheck:bZ,userAsk:kZ,toolPrint:vZ,provideEdit:SZ,runParams:NZ,runPreset:jZ,runConfig:CZ},EZ="设置",AZ={engine:"引擎设置",preferences:"全局首选项"},PZ={title:"工作区",currentPath:"当前工作区根目录",placeholder:"加载中…",copyPath:"复制路径",description:"流水线与节点清单将相对于此目录解析(由启动 UI 时传入)。"},IZ={title:"Cursor CLI",status:{cached:"已缓存",notCached:"未缓存"},modelPreviewLabel:"Cursor 模型名称列表",modelList:{cached:"模型清单已缓存",empty:"暂无模型列表",count:"{{count}} 条",fetchedAt:"更新 {{time}}",never:"尚未拉取",refresh:"刷新清单",fetching:"拉取中…"}},TZ={modelPreviewLabel:"OpenCode 模型名称列表",title:"OpenCode CLI",status:{ready:"就绪",notFound:"未找到"},provider:"方案 / Provider 标识",providerPlaceholder:"例如 bailian-coding-plan",saving:"正在保存并更新清单…",description:"对应 CLI opencode models <provider> 的参数;停止输入后会写入用户目录 config 并刷新 model-lists.json。"},RZ={title:"Claude Code CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Claude Code 模型名称列表",description:"内置模型列表(Claude Code CLI 无 models 子命令);刷新将探测 claude 二进制是否在 PATH 中。首次使用请先执行 claude /login。"},MZ={title:"Codex CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Codex 模型名称列表",description:"模型列表来自 codex debug models --bundled;首次使用请先执行 codex login。"},$Z={title:"环境变量",note:"当前登录用户私有,运行时优先于服务全局环境变量",noteAdmin:"可配置个人或全局环境变量;个人同名变量优先于全局",saving:"正在保存...",key:"键",value:"值",scope:"范围",personal:"个人",global:"全局",add:"添加",delete:"删除 {{key}}",invalidKey:"环境变量名必须以字母或下划线开头,且只能包含字母、数字和下划线。",newKey:"新环境变量键",newValue:"值(密钥请谨慎)"},LZ={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:"添加"},OZ={title:"系统状态",normal:"服务正常",abnormal:"部分接口异常",cursorModels:"Cursor 模型",opencodeModels:"OpenCode 模型",claudeCodeModels:"Claude Code 模型",codexModels:"Codex 模型"},DZ={title:"快捷入口",projects:"项目与流水线",flowEditor:"节点画布"},FZ={title:"语言",description:"选择界面显示语言",options:{zh:"中文",en:"English",ja:"日本語"}},zZ={title:"新手引导",description:"重新启动产品引导流程,了解 AgentFlow 的核心功能。",reset:"重置引导",resetSuccess:"已重置,下次访问将自动启动引导"},BZ={title:EZ,crumb:AZ,workspace:PZ,cursor:IZ,opencode:TZ,claudeCode:RZ,codex:MZ,env:$Z,allowlist:LZ,system:OZ,shortcuts:DZ,language:FZ,onboarding:zZ},HZ={thinking:"思考",result:"结果",reply:"回复",error:"错误"},WZ={input:"让 AI 协助编辑此节点…",waiting:"等待响应…",selectedEmpty:"在画布上选择节点,或在输入框用 @ 选择实例(Instances)或节点类型(Node)",textarea:"描述你的流程或让 AI 协助编辑(⌘/Ctrl+Enter 发送)"},VZ={send:"发送",stop:"停止",expand:"展开",collapse:"收起",clear:"清空"},KZ={conversation:"对话",conversationWithNumber:"对话 {{num}}",default:"默认"},qZ={endSession:"结束对话(将停止生成)",closeSession:"关闭对话",newSession:"新建对话",expandComposer:"展开对话与输出"},UZ={hint:"使用底部输入框进行 AI 对话,支持 @节点、选择模型等功能"},YZ={aiLabels:HZ,placeholders:WZ,actions:VZ,labels:KZ,tooltips:qZ,rightPanel:UZ},GZ="项目",JZ="全部",XZ="已归档",QZ="Nodes",ZZ="我的 Nodes",eee="我的流程",tee="Skills",nee="活跃项目",ree="已归档流水线",see="全局 Nodes",iee="全部 Nodes",oee="我的 Nodes",aee="管理当前工作区已发布到本地 Marketplace 的节点,共 {{count}} 个。",lee="管理当前工作区已发布到本地 Marketplace 的流程片段,共 {{count}} 个。",cee="全局 Skills",uee="创建新项目",dee="新建流水线",fee="搜索流水线…",pee="搜索 nodes…",hee="搜索流程片段…",mee="搜索 skills…",gee="刷新资源",yee="加载流水线列表…",xee="加载全局资源…",wee="筛选结果:{{count}} 条(匹配标题、描述、路径与标签)",bee="已归档的流水线仍可打开与编辑;文件位于各 pipelines 目录下的 _archived。",kee="管理分布式节点架构与监控流水线。可将 flow.yaml 或 .zip 拖入本页导入分享流程。",vee="查看当前可用的全局节点定义,共 {{count}} 个;包含内置、工作区与 marketplace 节点。",See="查看当前 Composer 可选择的 skills,共 {{count}} 个;包含 AgentFlow 内置与工作区 skills。",Nee="流程运行时的可执行积木",jee="Nodes 决定画布上能拖什么、节点有哪些输入输出,以及运行时走 agent、control、provide 或 marketplace 哪类逻辑。",Cee="已发布的本地节点包",_ee="这里仅显示你发布到当前 Workspace Marketplace 的节点版本;可查看详情并删除未被 Flow 使用的版本。",Eee="已发布的流程片段",Aee="这里显示从 Pipeline 或 Workspace 画布发布的流程片段,可搜索、检查内容,并从画布的流程面板中加载复用。",Pee="Composer/Agent 的操作指南",Iee="Skills 告诉 AI 在特定任务里应遵守什么规则、如何修改 flow、如何复用项目约定。",Tee="暂无归档项目。",Ree="暂无未归档流水线;已归档项在 Archived 标签中查看。",Mee="暂无可用全局 nodes。",$ee="暂无已发布的 marketplace nodes。",Lee="暂无已发布的流程片段。可在画布中选中多个节点后发布。",Oee="暂无可用 skills。",Dee="暂无描述。",Fee="未找到与「{{query}}」匹配的 node。",zee="未找到与「{{query}}」匹配的流程片段。",Bee="未找到与「{{query}}」匹配的 skill。",Hee="{{inputs}} in / {{outputs}} out",Wee="流程片段",Vee="{{nodes}} 节点 / {{edges}} 连线",Kee="Skill",qee="Node 详情",Uee="流程片段详情",Yee="Skill 详情",Gee="类型",Jee="来源",Xee="包",Qee="版本",Zee="路径",ete="可编辑",tte="只读",nte="可编辑",rte="Schema",ste="输入",ite="输出",ote="Runtime",ate="节点内容",lte="Files",cte="Usage",ute="暂无 runtime manifest。",dte="暂无节点正文或 README。",fte="暂无可预览文件。",pte="请选择文件查看内容。",hte="二进制文件暂不支持预览。",mte="文件较大,仅显示前 256KB。",gte="暂未发现使用此 node 的流水线。",yte="节点管理",xte="删除节点版本",wte="删除中…",bte="删除前会检查所有 Flow 引用;仍被安装或使用的版本不会被删除。",kte="确定删除 {{id}}@{{version}}?此操作不可撤销。",vte="已删除 {{id}}@{{version}}。",Ste="仍有 {{count}} 个 Flow 使用它。",Nte="流程片段管理",jte="删除流程片段",Cte="删除中…",_te="删除后不会影响已经加载到画布里的节点,只会移除 Marketplace 中这个可复用片段。",Ete="确定删除 {{id}}@{{version}}?此操作不可撤销。",Ate="已删除 {{id}}@{{version}}。",Pte="无槽位",Ite="作用",Tte="这个 node 是 pipeline 的执行单元。它的 schema 会影响画布连线、参数输入和运行时调度。",Rte="流程片段是固定化流程的一部分。加载时会复制这组节点、连线和布局到当前画布,不覆盖已有内容。",Mte="规模",$te="流程预览",Lte="连线",Ote="片段 JSON",Dte="还有 {{count}} 条连线",Fte="暂无可预览节点。",zte="这个 skill 会作为 Composer 的上下文注入给 AI,用于约束 AI 的判断、修改方式和输出口径。",Bte="SKILL.md 预览",Hte="暂无可预览内容。",Wte="请选择一个资源查看详情。",Vte="未能加载流水线列表。",Kte="当前工作区暂无流水线。",qte="在仓库根目录执行 {{code1}} 并确认工作区包含 {{code2}} 或用户目录下的流水线;亦可点击 New Pipeline 新建。",Ute="未找到与「{{query}}」匹配的流水线。可尝试其他关键词,或点击清除搜索。",Yte="最近打开或最近运行",Gte="暂无打开或运行记录",Jte="暂无与关键词匹配的最近记录",Xte="最近运行",Qte="最近打开",Zte={builtin:"内置",workspace:"工作区",user:"用户"},ene={flow:"Flow",global:"Global",marketplace:"Marketplace"},tne={all:"全部",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},nne={overview:"概览",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},rne="打开以在节点画布中编辑此流水线。",sne={eyebrow:"AgentFlow Hub",title:"浏览社区流程",desc:"发现并一键安装社区分享的现成流水线。",cta:"前往 Hub",cliHint:"或通过 CLI 安装:agentflow download <slug>"},ine={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:"关闭"},one={title:"导入流水线",lead:"已选择文件「{{filename}}」。请确认流水线名称与保存位置;ZIP 将保留目录内脚本等文件。",nameLabel:"名称(必填)",namePlaceholder:"例如 my_shared_flow",nameHint:"须以英文字母开头,仅可使用字母、数字、下划线 _ 与连字符 -",locationLabel:"保存位置",userDir:"用户目录(~/agentflow/pipelines)",workspaceDir:"当前工作区(.workspace/agentflow/pipelines)",changeFile:"更换文件…",importFailed:"导入失败",importing:"导入中…",importAndOpen:"导入并打开",cancel:"取消",close:"关闭"},ane={title:"删除流水线",lead:"将永久删除磁盘上的流水线目录(含 flow.yaml、脚本等),无法撤销。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",deleteFailed:"删除失败",deleteTimeout:"删除请求超时,请重试(可先检查终端中的 UI 服务日志)",delete:"删除",deleting:"删除中…",confirmDelete:"确认删除",cancel:"取消",close:"关闭"},lne={title:"归档流水线",lead:"归档后流水线将移入「Archived」列表,仍可从该列表打开与编辑。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",archiveFailed:"归档失败",archive:"归档",archiving:"归档中…",confirmArchive:"确认归档",cancel:"取消",close:"关闭"},cne={title:GZ,all:JZ,archived:XZ,nodes:QZ,myNodes:ZZ,myFlows:eee,skills:tee,activeProjects:nee,archivedPipelines:ree,globalNodes:see,nodeScopeAll:iee,nodeScopeMine:oee,myNodesHint:aee,myFlowsHint:lee,globalSkills:cee,createNew:uee,newPipeline:dee,searchPipelines:fee,searchNodes:pee,searchFlows:hee,searchSkills:mee,refreshResources:gee,loadingPipelines:yee,loadingResources:xee,filterResult:wee,archivedHint:bee,activeHint:kee,nodesHint:vee,skillsHint:See,nodesPurposeTitle:Nee,nodesPurposeDesc:jee,myNodesPurposeTitle:Cee,myNodesPurposeDesc:_ee,myFlowsPurposeTitle:Eee,myFlowsPurposeDesc:Aee,skillsPurposeTitle:Pee,skillsPurposeDesc:Iee,noArchived:Tee,noActive:Ree,noNodes:Mee,noMyNodes:$ee,noMyFlows:Lee,noSkills:Oee,noDescription:Dee,noNodeMatch:Fee,noFlowSnippetMatch:zee,noSkillMatch:Bee,nodeSlots:Hee,flowSnippet:Wee,flowSnippetNodes:Vee,skill:Kee,nodeDetail:qee,flowDetail:Uee,skillDetail:Yee,detailType:Gee,detailSource:Jee,detailPackage:Xee,detailVersion:Qee,detailPath:Zee,detailEditable:ete,readOnly:tte,editable:nte,nodeSchema:rte,nodeInputs:ste,nodeOutputs:ite,nodeRuntime:ote,nodeBody:ate,nodeFiles:lte,nodeUsage:cte,noRuntimeManifest:ute,noNodeBody:dte,noNodeFiles:fte,selectNodeFile:pte,binaryFile:hte,fileTruncated:mte,noNodeUsage:gte,myNodeManagement:yte,deleteMyNode:xte,deletingMyNode:wte,deleteMyNodeHint:bte,deleteMyNodeConfirm:kte,deleteMyNodeSuccess:vte,deleteMyNodeUsedBy:Ste,myFlowManagement:Nte,deleteMyFlow:jte,deletingMyFlow:Cte,deleteMyFlowHint:_te,deleteMyFlowConfirm:Ete,deleteMyFlowSuccess:Ate,noSlots:Pte,resourceMeaning:Ite,nodesMeaning:Tte,myFlowsMeaning:Rte,flowSnippetScale:Mte,flowSnippetPreview:$te,flowSnippetEdges:Lte,flowSnippetJson:Ote,flowSnippetMoreEdges:Dte,noFlowSnippetPreview:Fte,skillsMeaning:zte,skillPreview:Bte,skillPreviewEmpty:Hte,selectResource:Wte,loadFailed:Vte,noPipelines:Kte,emptyHint:qte,noMatch:Ute,recentActivity:Yte,noRecentActivity:Gte,noMatchRecent:Jte,recentRun:Xte,recentOpen:Qte,sourceBadge:Zte,resourceSource:ene,resourceFilter:tne,nodeDetailTabs:nne,defaultCardDesc:rne,hubCard:sne,newPipelineModal:ine,importModal:one,deleteModal:ane,archiveModal:lne},une="返回",dne="下一步",fne="跳过",pne="完成",hne="开始创建",mne={intro:`欢迎使用 AgentFlow!这是一个可视化流程编排工具。
|
|
300
|
-
|
|
301
|
-
点击下方按钮开始创建你的第一个流水线。`,hubIntro:`不想从零开始?
|
|
302
|
-
|
|
303
|
-
在 AgentFlow Hub 浏览社区分享的现成流水线,一键安装即可运行。`},gne={intro:`现在进入流程编辑器。
|
|
304
|
-
|
|
305
|
-
在下方输入框用自然语言描述你的需求,AI 会自动生成流程图。
|
|
306
|
-
|
|
307
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`,introEmpty:`画布为空,开始创建你的流程吧!
|
|
308
|
-
|
|
309
|
-
在下方输入框用自然语言描述需求,AI 会自动生成流程图。
|
|
310
|
-
|
|
311
|
-
左侧节点面板可以自由拖拽、删除和调整连接。`},yne={guideTitle:"首次创建提示",guideDesc:"输入名称和描述后,AI 会自动生成流程图。你可以在编辑器中自由调整节点和连接。",nameHintGuide:"例如:MyFirstFlow(字母开头,支持数字和下划线)",descPlaceholderGuide:"例如:实现用户登录功能,包含注册、验证、授权",descHintGuide:"描述越详细,AI 生成的流程越准确",createGuide:"创建并开始编辑",typeNode:"节点引用类型",typeStr:"字符串类型",typeFile:"文件路径类型",typeBool:"布尔值类型"},xne={back:une,next:dne,skip:fne,done:pne,startCreate:hne,projects:mne,flow:gne,newPipeline:yne},wne={en:{common:sG,flow:WG,settings:rJ,composer:uJ,project:jQ,onboarding:MQ},zh:{common:HQ,flow:_Z,settings:BZ,composer:YZ,project:cne,onboarding:xne}};cr.use(ET).use(xL).init({resources:wne,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 bne=[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"en",name:"English",flag:"🇬🇧"}];function kne(e){return cr.changeLanguage(e)}const pw="agentflow-settings-opencode-plan-v1",Jf="CURSOR_API_KEYS",Xf="AGENTFLOW_CURSOR_API_KEY_COOLDOWN_MINUTES",AT=["cursor","opencode","claudeCode","codex"];function PT(){return{cursor:[],opencode:[],claudeCode:[],codex:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null,codexFetchedAt:null}}function hw(e){const t=String(e||"").trim(),n=t.indexOf(" - ");return n>=0?t.slice(0,n).trim():t}function ta(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{},n={};for(const r of AT)n[r]=Array.isArray(t[r])?[...new Set(t[r].map(hw).filter(Boolean))]:[];return n}function Ai(e){if(!e||typeof e!="object")return PT();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 Bl(){return`e_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function vne(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function oa(e,t="user"){if(!Array.isArray(e))return[];const n=[];for(const r of e){if(!r||typeof r!="object")continue;const s=String(r.key??"").trim(),i=String(r.value??""),a=String(r.id??"").trim()||Bl(),c=String(r.scope??t).trim()==="global"?"global":"user";!s&&!i||n.push({id:a,key:s,value:i,scope:c})}return n}function _1(e){return oa(e).map(({key:t,value:n})=>({key:t,value:n}))}function E1(){try{return localStorage.getItem(pw)??""}catch{return""}}function IT(e){return e?e.length<=6?"•".repeat(e.length):`${"•".repeat(Math.min(20,e.length-4))}${e.slice(-4)}`:""}function Sne(e){const t=String(e||"").trim();if(!t)return[];const n=(r,s)=>{if(typeof r=="string"){const a=r.trim();return a?{id:`legacy_${s}_${a.slice(-6)}`,name:`Key ${s+1}`,key:a,createdAt:""}:null}if(!r||typeof r!="object")return null;const i=String(r.key??"").trim();return i?{id:String(r.id??"").trim()||Bl(),name:String(r.name??"").trim()||`Key ${s+1}`,key:i,createdAt:String(r.createdAt??"").trim()}:null};try{const r=JSON.parse(t);if(Array.isArray(r))return r.map(n).filter(Boolean)}catch{}return t.split(",").map((r,s)=>n(r,s)).filter(Boolean)}function A1(e){const t=Array.isArray(e)?e.map((n,r)=>({id:String((n==null?void 0:n.id)||"").trim()||Bl(),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 Nne(e){const t=String(e||"").trim();return t?t.length<=10?IT(t):`${t.slice(0,4)}${"•".repeat(Math.min(18,t.length-8))}${t.slice(-4)}`:""}function jne(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 Cne({authUser:e}){const{t,i18n:n}=Pr(["common","settings"]),r=n.language||"zh",[s,i]=m.useState(""),[a,l]=m.useState(""),[c,u]=m.useState({cursor:[],opencode:[],claudeCode:[],codex:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null,codexFetchedAt:null}),[p,d]=m.useState(PT()),[f,h]=m.useState(()=>ta({})),[g,k]=m.useState(!1),[w,y]=m.useState(""),[v,x]=m.useState(""),[C,N]=m.useState(!1),[j,E]=m.useState(!1),[P,O]=m.useState(""),[B,W]=m.useState([]),[z,L]=m.useState(""),[R,K]=m.useState(!1),[D,$]=m.useState(""),[I,F]=m.useState(""),[_,X]=m.useState(!1),[V,T]=m.useState(()=>new Set),[ee,ie]=m.useState(""),[G,se]=m.useState(""),[te,re]=m.useState(!!(e!=null&&e.isAdmin)),[ne,ce]=m.useState(""),[de,me]=m.useState([]),[He,Je]=m.useState([]),[Te,ot]=m.useState(""),[gt,yt]=m.useState(""),[Ae,dt]=m.useState(!1),[St,Wt]=m.useState(!1),[Vt,et]=m.useState(""),[fe,ke]=m.useState(""),[Ve,Qe]=m.useState(""),[Se,_t]=m.useState(null),[dn,zt]=m.useState(!1),[at,fn]=m.useState(!1),[Z,Ce]=m.useState(""),Me=m.useRef(null),Ye=m.useRef(!1),Pt=m.useRef(!1),Nt=m.useRef(""),$n=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();i(typeof ve.workspaceRoot=="string"?ve.workspaceRoot:"")}catch(oe){l(String(oe.message||oe)),i("")}},[]),Xt=m.useCallback(async()=>{x(""),N(!0),y("");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(Ai(ve.modelLists)),d(Ai(ve.allModelLists)),h(ta(ve.hiddenModels));else{const ae=Ai(ve);u(ae),d(ae),h(ta({}))}}catch(oe){x(String(oe.message||oe))}finally{N(!1)}},[e==null?void 0:e.isAdmin]),Hn=m.useCallback(async()=>{L("");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 ae=oa(Array.isArray(ve.env)?ve.env:[],"user").map(Kt=>({...Kt,scope:"user"})),$t=[...e!=null&&e.isAdmin?oa(Array.isArray(ve.globalEnv)?ve.globalEnv:[],"global").map(Kt=>({...Kt,scope:"global"})):[],...ae];Nt.current=JSON.stringify($t),W($t)}catch(oe){W([]),L(String(oe.message||oe))}finally{Pt.current=!0}},[e==null?void 0:e.isAdmin]),Yn=m.useCallback(async()=>{if(e!=null&&e.isAdmin){dt(!0),et("");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 ae=ve.allowlist&&typeof ve.allowlist=="object"?ve.allowlist:{};me(Array.isArray(ae.fileUsers)?ae.fileUsers.map(String):[]),Je(Array.isArray(ae.envUsers)?ae.envUsers.map(String):[]),ot(typeof ae.path=="string"?ae.path:"")}catch(oe){et(String(oe.message||oe))}finally{dt(!1)}}},[e==null?void 0:e.isAdmin]),Wn=m.useCallback(async oe=>{if(e!=null&&e.isAdmin){Wt(!0),et("");try{const ve=await fetch("/api/admin/user-allowlist",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({users:oe})}),ae=await ve.json().catch(()=>({}));if(!ve.ok)throw new Error(typeof ae.error=="string"?ae.error:"HTTP "+ve.status);const ht=ae.allowlist&&typeof ae.allowlist=="object"?ae.allowlist:{};me(Array.isArray(ht.fileUsers)?ht.fileUsers.map(String):[]),Je(Array.isArray(ht.envUsers)?ht.envUsers.map(String):[]),ot(typeof ht.path=="string"?ht.path:"")}catch(ve){et(String(ve.message||ve))}finally{Wt(!1)}}},[e==null?void 0:e.isAdmin]),Ln=m.useCallback(async()=>{if(e!=null&&e.isAdmin){zt(!0),Ce("");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 ae=ve.config&&typeof ve.config=="object"?ve.config:{};_t(ae),ke(typeof ae.dataRoot=="string"?ae.dataRoot:""),Qe(typeof ae.skillsRoot=="string"?ae.skillsRoot:"")}catch(oe){Ce(String(oe.message||oe))}finally{zt(!1)}}},[e==null?void 0:e.isAdmin]),Gn=m.useCallback(async()=>{if(e!=null&&e.isAdmin){fn(!0),Ce("");try{const oe=await fetch("/api/admin/storage-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dataRoot:fe.trim(),skillsRoot:Ve.trim(),migrateLegacySkills:!0})}),ve=await oe.json().catch(()=>({}));if(!oe.ok)throw new Error(typeof ve.error=="string"?ve.error:"HTTP "+oe.status);const ae=ve.config&&typeof ve.config=="object"?ve.config:{};_t(ae),ke(typeof ae.dataRoot=="string"?ae.dataRoot:""),Qe(typeof ae.skillsRoot=="string"?ae.skillsRoot:"")}catch(oe){Ce(String(oe.message||oe))}finally{fn(!1)}}},[e==null?void 0:e.isAdmin,fe,Ve]),ls=m.useCallback(async oe=>{const ve=oa(oe),ae=ve.filter($t=>$t.scope!=="global"),ht=ve.filter($t=>$t.scope==="global");K(!0),L("");try{const $t=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:_1(ae),...e!=null&&e.isAdmin?{globalEnv:_1(ht)}:{}})}),Kt=await $t.json().catch(()=>({}));if(!$t.ok)throw new Error(typeof Kt.error=="string"?Kt.error:"HTTP "+$t.status);const sr=oa(Array.isArray(Kt.env)?Kt.env:[],"user").map(q=>({...q,scope:"user"})),Ur=[...e!=null&&e.isAdmin?oa(Array.isArray(Kt.globalEnv)?Kt.globalEnv:[],"global").map(q=>({...q,scope:"global"})):[],...sr];Nt.current=JSON.stringify(Ur),W(Ur)}catch($t){L(String($t.message||$t))}finally{K(!1)}},[e==null?void 0:e.isAdmin]),Ir=m.useCallback(async()=>{x(""),N(!0);try{const oe=await fetch("/api/update-model-lists",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:ne.trim()})}),ve=await oe.json().catch(()=>({}));if(!oe.ok)throw new Error(typeof ve.error=="string"?ve.error:"HTTP "+oe.status);u(Ai(ve.modelLists)),e!=null&&e.isAdmin?await Xt():d(Ai(ve.modelLists))}catch(oe){x(String(oe.message||oe))}finally{N(!1)}},[e==null?void 0:e.isAdmin,Xt,ne]),wr=m.useCallback(async oe=>{if(!(e!=null&&e.isAdmin))return;const ve=ta(oe);h(ve),k(!0),y("");try{const ae=await fetch("/api/model-visibility",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({hiddenModels:ve})}),ht=await ae.json().catch(()=>({}));if(!ae.ok)throw new Error(typeof ht.error=="string"?ht.error:"HTTP "+ae.status);u(Ai(ht.modelLists)),d(Ai(ht.allModelLists)),h(ta(ht.hiddenModels))}catch(ae){y(String(ae.message||ae)),Xt()}finally{k(!1)}},[e==null?void 0:e.isAdmin,Xt]),cs=m.useCallback((oe,ve,ae)=>{const ht=AT.includes(oe)?oe:"cursor",$t=hw(ve);if(!$t)return;const Kt=ta(f),sr=new Set(Kt[ht]);ae?sr.delete($t):sr.add($t),wr({...Kt,[ht]:Array.from(sr)})},[f,wr]);m.useEffect(()=>{$n(),Xt(),Hn(),e!=null&&e.isAdmin&&(Yn(),Ln()),(async()=>{try{const oe=await fetch("/api/agentflow-config");if(oe.ok){const ve=await oe.json(),ae=typeof ve.opencodeProvider=="string"?ve.opencodeProvider:"";ce(ae),Me.current=ae;try{localStorage.setItem(pw,ae)}catch{}}else{const ve=E1();ce(ve),Me.current=ve}}catch{const oe=E1();ce(oe),Me.current=oe}finally{Ye.current=!0}})()},[e==null?void 0:e.isAdmin,$n,Xt,Ln,Yn,Hn]),m.useEffect(()=>{if(!Pt.current||JSON.stringify(oa(B))===Nt.current)return;const ve=setTimeout(()=>{ls(B)},350);return()=>clearTimeout(ve)},[B,ls]),m.useEffect(()=>{if(!Ye.current)return;const oe=ne.trim();if(oe===Me.current)return;const ve=setTimeout(()=>{(async()=>{E(!0),O("");try{const ae=await fetch("/api/agentflow-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:oe})}),ht=await ae.json().catch(()=>({}));if(!ae.ok)throw new Error(typeof ht.error=="string"?ht.error:"HTTP "+ae.status);Me.current=oe;try{localStorage.setItem(pw,oe)}catch{}ht.modelLists&&(u(Ai(ht.modelLists)),e!=null&&e.isAdmin?Xt():d(Ai(ht.modelLists)))}catch(ae){O(String(ae.message||ae))}finally{E(!1)}})()},450);return()=>clearTimeout(ve)},[e==null?void 0:e.isAdmin,Xt,ne]);const pn=e!=null&&e.isAdmin?p:c,rr=pn.cursor.length>0,br=pn.opencode.length>0,Vn=pn.claudeCode.length>0,Cn=pn.codex.length>0,kr=ta(f),Gs={cursor:c.cursor.length,opencode:c.opencode.length,claudeCode:c.claudeCode.length,codex:c.codex.length},vr=m.useCallback((oe,ve,ae)=>{const ht=Array.isArray(ve)?ve:[];if(!(e!=null&&e.isAdmin))return o.jsx("pre",{className:"af-set-model-preview","aria-label":ae,children:ht.join(`
|
|
312
|
-
`)});const $t=new Set(kr[oe]||[]);return o.jsxs("div",{className:"af-set-model-visibility","aria-label":ae,children:[o.jsxs("div",{className:"af-set-model-visibility-head",children:[o.jsxs("span",{children:["展示 ",Gs[oe]||0," / ",ht.length]}),o.jsx("span",{children:g?"保存中":"取消勾选后从模型下拉隐藏"})]}),o.jsx("div",{className:"af-set-model-visibility-list",children:ht.map(Kt=>{const sr=hw(Kt),nn=!$t.has(sr);return o.jsxs("label",{className:"af-set-model-visibility-row",children:[o.jsx("input",{type:"checkbox",checked:nn,disabled:g,onChange:Ur=>cs(oe,Kt,Ur.target.checked)}),o.jsx("span",{children:Kt})]},`${oe}-${Kt}`)})})]})},[e==null?void 0:e.isAdmin,kr,g,Gs,cs]),Qt=de.length>0||He.length>0,le=e!=null&&e.isAdmin&&te?"global":"user",we=m.useMemo(()=>B.find(oe=>oe.key===Jf&&(oe.scope||"user")===le)||null,[le,B]),De=m.useMemo(()=>Sne((we==null?void 0:we.value)||""),[we==null?void 0:we.value]),wt=m.useMemo(()=>B.find(oe=>oe.key===Xf&&(oe.scope||"user")===le)||null,[le,B]),Zt=wt!=null&&wt.value?String(wt.value):"30",on=m.useCallback((oe,ve,ae)=>{const ht=String(oe||"").trim();if(!ht)return;const $t=String(ve??"");W(Kt=>{const sr=Kt.find(nn=>nn.key===ht&&(nn.scope||"user")===ae);return $t?sr?Kt.map(nn=>nn.id===sr.id?{...nn,value:$t,scope:ae}:nn):[{id:Bl(),key:ht,value:$t,scope:ae},...Kt]:Kt.filter(nn=>!(nn.key===ht&&(nn.scope||"user")===ae))})},[]),An=m.useCallback(()=>{const oe=G.trim();if(!oe)return;const ve=[...De,{id:Bl(),name:ee.trim()||`Key ${De.length+1}`,key:oe,createdAt:new Date().toISOString()}];on(Jf,A1(ve),le),ie(""),se("")},[ee,De,le,G,on]),ur=m.useCallback(oe=>{const ve=De.filter(ae=>ae.id!==oe);on(Jf,ve.length?A1(ve):"",le)},[De,le,on]),nt=m.useCallback(oe=>{const ve=String(oe||"").replace(/[^\d]/g,"");if(!ve){on(Xf,"",le);return}const ae=Math.min(1440,Math.max(1,Number(ve)||30));on(Xf,String(ae),le)},[le,on]),xt=m.useCallback(()=>{var oe;s&&((oe=navigator.clipboard)==null||oe.writeText(s))},[s]),Yt=m.useCallback(()=>{const oe=D.trim(),ve=I;if(oe){if(!vne(oe)){L(t("settings:env.invalidKey"));return}W(ae=>[{id:Bl(),key:oe,value:ve,scope:e!=null&&e.isAdmin&&_?"global":"user"},...ae]),$(""),F("")}},[e==null?void 0:e.isAdmin,_,D,I,t]),Ke=m.useCallback(oe=>{W(ve=>ve.filter(ae=>ae.id!==oe))},[]),Re=m.useCallback((oe,ve)=>{W(ae=>ae.map(ht=>ht.id===oe?{...ht,...ve}:ht))},[]),dr=m.useCallback(oe=>{T(ve=>{const ae=new Set(ve);return ae.has(oe)?ae.delete(oe):ae.add(oe),ae})},[]),ki=m.useCallback(()=>{const oe=gt.trim();if(!oe)return;if(!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(oe)){et("用户名须以字母开头,仅可使用字母、数字、下划线与连字符,最多 64 字符");return}if(new Set(de.map(ae=>String(ae||"").trim().toLowerCase())).has(oe.toLowerCase())){yt("");return}yt(""),Wn([...de,oe])},[gt,de,Wn]),Kr=m.useCallback(oe=>{const ve=String(oe||"").trim().toLowerCase();ve&&Wn(de.filter(ae=>String(ae||"").trim().toLowerCase()!==ve))},[de,Wn]),qr=m.useCallback(oe=>{const ve=oe.target.value;kne(ve)},[]),Ss=oe=>{const ve=jne(oe,r);return ve?t("settings:cursor.modelList.fetchedAt",{time:ve}):t("settings:cursor.modelList.never")};return o.jsxs("div",{className:"af-settings-page",children:[o.jsx("header",{className:"af-settings-top",children:o.jsxs("div",{className:"af-settings-crumb","aria-label":t("settings:title"),children:[o.jsx("span",{className:"af-settings-crumb-muted",children:t("settings:crumb.engine")}),o.jsx("span",{className:"af-settings-crumb-sep","aria-hidden":!0,children:"/"}),o.jsx("span",{className:"af-settings-crumb-active",children:t("settings:crumb.preferences")})]})}),o.jsx("div",{className:"af-settings-body",children:o.jsxs("div",{className:"af-settings-inner",children:[o.jsxs("header",{className:"af-settings-hero",children:[o.jsxs("h1",{className:"af-settings-h1",children:[t("common:app.name")," ",t("settings:title")]}),o.jsx("p",{className:"af-settings-lead",children:t("settings:workspace.description")}),a?o.jsx("p",{className:"af-err af-settings-api-hint",children:a}):null,v?o.jsx("p",{className:"af-err af-settings-api-hint",children:v}):null,z?o.jsx("p",{className:"af-err af-settings-api-hint",children:z}):null,Z?o.jsx("p",{className:"af-err af-settings-api-hint",children:Z}):null]}),o.jsx("div",{className:"af-settings-layout",children:o.jsxs("div",{className:"af-settings-bento",children:[o.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--low af-set-workspace",children:[o.jsxs("div",{className:"af-set-card-inner",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("span",{className:"material-symbols-outlined af-set-icon af-set-icon--secondary",children:"folder_managed"}),o.jsx("h2",{className:"af-set-h2",children:t("settings:workspace.title")})]}),o.jsx("label",{className:"af-set-label",htmlFor:"af-workspace-path",children:t("settings:workspace.currentPath")}),o.jsxs("div",{className:"af-set-input-wrap",children:[o.jsx("input",{id:"af-workspace-path",className:"af-set-input af-set-input--mono",type:"text",readOnly:!0,value:s,placeholder:t("common:loading")}),o.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:xt,"aria-label":t("settings:workspace.copyPath"),disabled:!s,children:o.jsx("span",{className:"material-symbols-outlined",children:"content_copy"})})]}),o.jsx("p",{className:"af-set-hint",children:"当前页面只展示运行时根目录。可被节点加载的代码库和文档目录请在左侧“知识库”里维护。"})]}),o.jsx("div",{className:"af-set-watermark","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:"account_tree"})})]}),o.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:"Cursor CLI"}),o.jsx("span",{className:"af-set-badge"+(rr?" af-set-badge--ok":" af-set-badge--muted"),children:t(rr?"settings:cursor.status.cached":"settings:cursor.status.notCached")})]}),o.jsxs("div",{className:"af-set-cli-block",children:[o.jsx("div",{className:"af-set-cli-icon",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:rr?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(rr?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:rr?t("settings:cursor.modelList.count",{count:c.cursor.length})+(e!=null&&e.isAdmin?` / ${pn.cursor.length}`:"")+" · "+Ss(c.cursorFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),rr?vr("cursor",pn.cursor,t("settings:cursor.modelPreviewLabel")):null,w?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",role:"alert",children:w}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Ir(),disabled:C,children:t(C?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low af-set-cursor-pool",children:[o.jsxs("div",{className:"af-set-env-head",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("div",{className:"af-set-env-icon-wrap",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"key"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:"Cursor API Key 池"}),o.jsx("p",{className:"af-set-card-subtitle",children:"按请求轮换,遇到 usage limit 或 resource_exhausted 会自动尝试下一个 Key。"})]})]}),o.jsxs("span",{className:"af-set-badge"+(De.length?" af-set-badge--ok":" af-set-badge--muted"),children:[De.length," keys"]})]}),o.jsxs("div",{className:"af-set-cursor-pool-controls",children:[e!=null&&e.isAdmin?o.jsxs("div",{className:"af-set-env-scope-switch af-set-cursor-scope",role:"group","aria-label":"Cursor API Key scope",children:[o.jsx("button",{type:"button",className:te?"":"is-active",onClick:()=>re(!1),children:"个人"}),o.jsx("button",{type:"button",className:te?"is-active":"",onClick:()=>re(!0),children:"全局"})]}):null,o.jsxs("label",{className:"af-set-cursor-cooldown",children:[o.jsx("span",{children:"限额冷却"}),o.jsx("input",{className:"af-set-input af-set-input--sm af-set-input--mono",inputMode:"numeric",value:Zt,onChange:oe=>nt(oe.target.value)}),o.jsx("span",{children:"分钟"})]}),o.jsx("span",{className:"af-set-env-note",children:R?"保存中":le==="global"?"全局配置":"个人配置"})]}),o.jsx("div",{className:"af-set-cursor-key-list",children:De.length?De.map(oe=>o.jsxs("div",{className:"af-set-cursor-key-row",children:[o.jsxs("div",{className:"af-set-cursor-key-main",children:[o.jsx("strong",{children:oe.name}),o.jsx("code",{children:Nne(oe.key)})]}),o.jsx("span",{className:"af-set-cursor-key-meta",children:oe.createdAt?new Date(oe.createdAt).toLocaleString():"历史 Key"}),o.jsx("button",{type:"button",className:"af-set-env-del af-set-cursor-key-delete","aria-label":`删除 ${oe.name}`,onClick:()=>ur(oe.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})]},oe.id)):o.jsx("div",{className:"af-set-cursor-key-empty",children:"还没有配置 Key。配置后 Cursor CLI runner 会自动轮换使用。"})}),o.jsxs("div",{className:"af-set-cursor-key-add",children:[o.jsx("input",{className:"af-set-input",value:ee,onChange:oe=>ie(oe.target.value),placeholder:"名称,例如 Team Key 1"}),o.jsx("input",{className:"af-set-input af-set-input--mono",type:"password",value:G,onChange:oe=>se(oe.target.value),placeholder:"Cursor API Key"}),o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:An,disabled:!G.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"添加 Key"]})]}),o.jsxs("p",{className:"af-set-hint",children:["保存到 ",Jf,";冷却时间保存到 ",Xf,"。个人配置会覆盖全局配置。"]})]}),o.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:"OpenCode"}),o.jsx("span",{className:"af-set-badge"+(br?" af-set-badge--ok":" af-set-badge--err"),children:t(br?"settings:opencode.status.ready":"settings:opencode.status.notFound")})]}),o.jsx("p",{className:"af-set-p",children:t("settings:opencode.description")}),o.jsxs("div",{children:[o.jsx("label",{className:"af-set-label-sm",htmlFor:"af-opencode-plan",children:t("settings:opencode.provider")}),o.jsx("input",{id:"af-opencode-plan",className:"af-set-input af-set-input--sm af-set-input--mono",type:"text",value:ne,onChange:oe=>ce(oe.target.value),placeholder:t("settings:opencode.providerPlaceholder"),autoComplete:"off"}),j?o.jsx("p",{className:"af-set-hint af-set-hint--inline","aria-live":"polite",children:t("settings:opencode.saving")}):null,P?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",role:"alert",children:P}):null]}),br?o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"af-set-cli-mono af-set-cli-mono--block",children:t("settings:cursor.modelList.count",{count:c.opencode.length})+(e!=null&&e.isAdmin?` / ${pn.opencode.length}`:"")+" · "+Ss(c.opencodeFetchedAt)}),vr("opencode",pn.opencode,t("settings:opencode.modelPreviewLabel"))]}):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Ir(),disabled:C,children:t(C?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),o.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:t("settings:claudeCode.title")}),o.jsx("span",{className:"af-set-badge"+(Vn?" af-set-badge--ok":" af-set-badge--err"),children:t(Vn?"settings:claudeCode.status.ready":"settings:claudeCode.status.notFound")})]}),o.jsxs("div",{className:"af-set-cli-block",children:[o.jsx("div",{className:"af-set-cli-icon",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:Vn?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(Vn?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:Vn?t("settings:cursor.modelList.count",{count:c.claudeCode.length})+(e!=null&&e.isAdmin?` / ${pn.claudeCode.length}`:"")+" · "+Ss(c.claudeCodeFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),o.jsx("p",{className:"af-set-p",children:t("settings:claudeCode.description")}),Vn?vr("claudeCode",pn.claudeCode,t("settings:claudeCode.modelPreviewLabel")):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Ir(),disabled:C,children:t(C?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),o.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:t("settings:codex.title")}),o.jsx("span",{className:"af-set-badge"+(Cn?" af-set-badge--ok":" af-set-badge--err"),children:t(Cn?"settings:codex.status.ready":"settings:codex.status.notFound")})]}),o.jsxs("div",{className:"af-set-cli-block",children:[o.jsx("div",{className:"af-set-cli-icon",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:Cn?"check_circle":"hourglass_empty"})}),o.jsxs("div",{children:[o.jsx("p",{className:"af-set-cli-title",children:t(Cn?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),o.jsx("p",{className:"af-set-cli-mono",children:Cn?t("settings:cursor.modelList.count",{count:c.codex.length})+(e!=null&&e.isAdmin?` / ${pn.codex.length}`:"")+" · "+Ss(c.codexFetchedAt):t("settings:cursor.modelList.refresh")})]})]}),o.jsx("p",{className:"af-set-p",children:t("settings:codex.description")}),Cn?vr("codex",pn.codex,t("settings:codex.modelPreviewLabel")):null,o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>Ir(),disabled:C,children:t(C?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low af-set-env",children:[o.jsxs("div",{className:"af-set-env-head",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("div",{className:"af-set-env-icon-wrap",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"variables"})}),o.jsx("h2",{className:"af-set-h2",children:t("settings:env.title")})]}),o.jsx("span",{className:"af-set-env-note",children:R?t("settings:env.saving"):e!=null&&e.isAdmin?t("settings:env.noteAdmin"):t("settings:env.note")})]}),o.jsxs("div",{className:"af-set-env-rows"+(e!=null&&e.isAdmin?" af-set-env-rows--admin":""),children:[o.jsxs("div",{className:"af-set-env-row af-set-env-row--header","aria-hidden":!0,children:[o.jsx("span",{children:t("settings:env.key")}),e!=null&&e.isAdmin?o.jsx("span",{children:t("settings:env.scope")}):null,o.jsx("span",{children:t("settings:env.value")}),o.jsx("span",{})]}),o.jsxs("div",{className:"af-set-env-row af-set-env-row--draft"+(e!=null&&e.isAdmin?" af-set-env-row--scoped":""),children:[o.jsx("div",{className:"af-set-env-cell",children:o.jsx("input",{className:"af-set-env-inline af-set-env-inline--key",placeholder:"KEY_NAME",value:D,onChange:oe=>$(oe.target.value),"aria-label":t("settings:env.newKey")})}),e!=null&&e.isAdmin?o.jsx("div",{className:"af-set-env-cell af-set-env-cell--scope",children:o.jsxs("div",{className:"af-set-env-scope-switch",role:"group","aria-label":t("settings:env.scope"),children:[o.jsx("button",{type:"button",className:_?"":"is-active",onClick:()=>X(!1),children:t("settings:env.personal")}),o.jsx("button",{type:"button",className:_?"is-active":"",onClick:()=>X(!0),children:t("settings:env.global")})]})}):null,o.jsx("div",{className:"af-set-env-cell af-set-env-cell--grow af-set-env-cell--value",children:o.jsx("input",{className:"af-set-env-inline af-set-env-inline--value",type:"password",placeholder:t("settings:env.newValue"),value:I,onChange:oe=>F(oe.target.value),"aria-label":t("settings:env.newValue")})}),o.jsx("div",{className:"af-set-env-actions",children:o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:Yt,disabled:!D.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),t("settings:env.add")]})})]}),B.map(oe=>o.jsxs("div",{className:"af-set-env-row"+(e!=null&&e.isAdmin?" af-set-env-row--scoped":""),children:[o.jsx("div",{className:"af-set-env-cell",children:o.jsx("input",{className:"af-set-env-inline af-set-env-inline--key",value:oe.key,onChange:ve=>Re(oe.id,{key:ve.target.value}),"aria-label":t("settings:env.key"),spellCheck:!1})}),e!=null&&e.isAdmin?o.jsx("div",{className:"af-set-env-cell af-set-env-cell--scope",children:o.jsxs("div",{className:"af-set-env-scope-switch",role:"group","aria-label":t("settings:env.scope"),children:[o.jsx("button",{type:"button",className:oe.scope!=="global"?"is-active":"",onClick:()=>Re(oe.id,{scope:"user"}),children:t("settings:env.personal")}),o.jsx("button",{type:"button",className:oe.scope==="global"?"is-active":"",onClick:()=>Re(oe.id,{scope:"global"}),children:t("settings:env.global")})]})}):null,o.jsxs("div",{className:"af-set-env-cell af-set-env-cell--grow af-set-env-cell--value",children:[o.jsx("input",{className:"af-set-env-inline af-set-env-inline--value",type:V.has(oe.id)?"text":"password",value:oe.value,onChange:ve=>Re(oe.id,{value:ve.target.value}),placeholder:IT(oe.value)||t("settings:env.newValue"),"aria-label":t("settings:env.value")}),o.jsx("button",{type:"button",className:"af-set-env-value-toggle",onClick:()=>dr(oe.id),"aria-label":V.has(oe.id)?"Hide value":"Show value",children:o.jsx("span",{className:"material-symbols-outlined",children:V.has(oe.id)?"visibility_off":"visibility"})})]}),o.jsx("div",{className:"af-set-env-actions",children:o.jsx("button",{type:"button",className:"af-set-env-del","aria-label":t("settings:env.delete",{key:oe.key}),onClick:()=>Ke(oe.id),children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})})]},oe.id))]})]}),e!=null&&e.isAdmin?o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low",children:[o.jsxs("div",{className:"af-set-env-head",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("div",{className:"af-set-env-icon-wrap",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"hard_drive_2"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:"AgentFlow Data Root"}),o.jsx("p",{className:"af-set-card-subtitle",children:"配置整个 AgentFlow 数据目录的位置,保存时会迁移当前数据。"})]})]}),o.jsx("span",{className:"af-set-badge"+(Se!=null&&Se.envLocked?" af-set-badge--err":" af-set-badge--ok"),children:Se!=null&&Se.envLocked?"Env locked":"Configurable"}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void Ln(),disabled:dn||at,children:dn?"刷新中...":"刷新"})]}),Z?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:Z}):null,o.jsx("label",{className:"af-set-label-sm",htmlFor:"af-agentflow-data-root",children:"Data Root"}),o.jsxs("div",{className:"af-set-input-wrap",children:[o.jsx("input",{id:"af-agentflow-data-root",className:"af-set-input af-set-input--mono",type:"text",value:fe,onChange:oe=>ke(oe.target.value),placeholder:"/data1/services/mengmai/agentflow",autoComplete:"off",disabled:!!(Se!=null&&Se.envLocked)||at}),o.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:()=>void Gn(),"aria-label":"保存 AgentFlow Data Root",disabled:at||!!(Se!=null&&Se.envLocked),children:o.jsx("span",{className:"material-symbols-outlined",children:at?"hourglass_empty":"save"})})]}),o.jsxs("p",{className:"af-set-hint",children:["当前目录:",o.jsx("code",{children:(Se==null?void 0:Se.dataRoot)||fe||"-"}),Se!=null&&Se.configPath?o.jsxs(o.Fragment,{children:[";配置文件:",o.jsx("code",{children:Se.configPath})]}):null]}),o.jsxs("p",{className:"af-set-hint",children:["这个目录包含 ",o.jsx("code",{children:"users/"}),"、",o.jsx("code",{children:"pipelines/"}),"、",o.jsx("code",{children:"runBuild/"}),"、",o.jsx("code",{children:"auth/"})," 和 admin 配置。 保存到新绝对路径时会复制旧目录内容;旧目录不会自动删除。",Se!=null&&Se.envLocked?" 当前设置了 AGENTFLOW_HOME,需要改环境变量才能生效。":""]}),o.jsx("label",{className:"af-set-label-sm",htmlFor:"af-agentflow-skills-root",children:"Skills Root"}),o.jsxs("div",{className:"af-set-input-wrap",children:[o.jsx("input",{id:"af-agentflow-skills-root",className:"af-set-input af-set-input--mono",type:"text",value:Ve,onChange:oe=>Qe(oe.target.value),placeholder:"/data1/services/mengmai/agentflow/skills",autoComplete:"off",disabled:!!(Se!=null&&Se.skillsEnvLocked)||at}),o.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:()=>void Gn(),"aria-label":"保存 AgentFlow Skills Root",disabled:at||!!(Se!=null&&Se.skillsEnvLocked),children:o.jsx("span",{className:"material-symbols-outlined",children:at?"hourglass_empty":"save"})})]}),o.jsxs("p",{className:"af-set-hint",children:["当前 Skills:",o.jsx("code",{children:(Se==null?void 0:Se.skillsRoot)||Ve||"-"}),Se!=null&&Se.legacySkillsRootExists?o.jsxs(o.Fragment,{children:[";保存时会补迁移旧目录 ",o.jsx("code",{children:Se.legacySkillsRoot})," 中缺失的 skills。"]}):null]}),o.jsxs("p",{className:"af-set-hint",children:["SkillHub 新安装、更新和卸载都作用于 Skills Root;普通用户只通过 Workspace 的 Load Skills 使用。",Se!=null&&Se.skillsEnvLocked?" 当前设置了 AGENTFLOW_SKILLS_ROOT,需要改环境变量才能生效。":""]})]}):null,e!=null&&e.isAdmin?o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--allowlist",children:[o.jsxs("div",{className:"af-set-env-head",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("div",{className:"af-set-env-icon-wrap",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"manage_accounts"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:t("settings:allowlist.title")}),o.jsx("p",{className:"af-set-card-subtitle",children:t("settings:allowlist.description")})]})]}),o.jsx("span",{className:"af-set-badge"+(Qt?" af-set-badge--ok":" af-set-badge--muted"),children:t(Qt?"settings:allowlist.enabled":"settings:allowlist.open")}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:()=>void Yn(),disabled:Ae,children:t(Ae?"settings:allowlist.refreshing":"common:common.refresh")})]}),Vt?o.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:Vt}):null,Te?o.jsxs("p",{className:"af-set-hint af-set-hint--inline",children:[t("settings:allowlist.file"),":",o.jsx("code",{children:Te})]}):null,o.jsxs("div",{className:"af-allowlist-grid",children:[o.jsxs("div",{className:"af-allowlist-main",children:[o.jsxs("div",{className:"af-allowlist-head",children:[o.jsx("span",{children:t("settings:allowlist.fileList")}),o.jsx("span",{children:St?t("settings:allowlist.saving"):t("settings:allowlist.userCount",{count:de.length})})]}),o.jsx("div",{className:"af-allowlist-list",children:de.length>0?de.map(oe=>o.jsxs("div",{className:"af-allowlist-row",children:[o.jsx("span",{className:"af-allowlist-name",children:oe}),o.jsx("button",{type:"button",className:"af-set-env-del",onClick:()=>Kr(oe),"aria-label":t("settings:allowlist.remove",{username:oe}),disabled:St,children:o.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})]},oe)):o.jsx("div",{className:"af-allowlist-empty",children:t("settings:allowlist.emptyFile")})}),o.jsxs("div",{className:"af-allowlist-add",children:[o.jsx("input",{className:"af-set-input af-set-input--sm af-set-input--mono",value:gt,onChange:oe=>yt(oe.target.value),onKeyDown:oe=>{oe.key==="Enter"&&ki()},placeholder:"username",autoComplete:"off"}),o.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:ki,disabled:St||!gt.trim(),children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),t("settings:allowlist.add")]})]})]}),o.jsxs("div",{className:"af-allowlist-side",children:[o.jsxs("div",{className:"af-allowlist-head",children:[o.jsx("span",{children:t("settings:allowlist.envList")}),o.jsx("span",{children:t("settings:allowlist.readonly")})]}),o.jsx("div",{className:"af-allowlist-env-list",children:He.length>0?He.map(oe=>o.jsx("code",{children:oe},oe)):o.jsx("span",{children:t("settings:allowlist.emptyEnv")})}),o.jsx("p",{className:"af-set-hint af-set-hint--inline",children:t("settings:allowlist.unionHint")})]})]})]}):null,o.jsxs("section",{className:"af-settings-rail","aria-label":t("settings:title"),children:[o.jsxs("div",{className:"af-set-rail-card af-set-rail-card--accent",children:[o.jsxs("div",{className:"af-set-rail-inner",children:[o.jsx("h3",{className:"af-set-rail-h3",children:t("settings:system.title")}),o.jsxs("div",{className:"af-set-health-line",children:[o.jsx("span",{className:"af-set-pulse-dot","aria-hidden":!0}),o.jsx("span",{className:"af-set-health-label",children:t(!a&&!v?"settings:system.normal":"settings:system.abnormal")})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.cursorModels")}),o.jsx("span",{children:c.cursor.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.cursor.length>0?12+c.cursor.length*3:4)}%`}})})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.opencodeModels")}),o.jsx("span",{children:c.opencode.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.opencode.length>0?12+c.opencode.length*3:4)}%`}})})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.claudeCodeModels")}),o.jsx("span",{children:c.claudeCode.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.claudeCode.length>0?12+c.claudeCode.length*3:4)}%`}})})]}),o.jsxs("div",{className:"af-set-meter",children:[o.jsxs("div",{className:"af-set-meter-row",children:[o.jsx("span",{children:t("settings:system.codexModels")}),o.jsx("span",{children:c.codex.length})]}),o.jsx("div",{className:"af-set-meter-bar",children:o.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,c.codex.length>0?12+c.codex.length*3:4)}%`}})})]})]}),o.jsx("div",{className:"af-set-rail-watermark","aria-hidden":!0,children:o.jsx("span",{className:"material-symbols-outlined",children:"vital_signs"})})]}),o.jsxs("div",{className:"af-set-rail-card",children:[o.jsx("h3",{className:"af-set-rail-h3 af-set-rail-h3--sm",children:t("settings:language.title")}),o.jsxs("div",{className:"af-set-language-selector",children:[o.jsx("select",{className:"af-set-input af-set-input--sm",value:r,onChange:qr,"aria-label":t("settings:language.description"),children:bne.map(oe=>o.jsxs("option",{value:oe.code,children:[oe.flag," ",oe.name]},oe.code))}),o.jsx("p",{className:"af-set-hint",children:t("settings:language.description")})]})]})]})]})})]})})]})}function Rr(e){return new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(Math.max(0,Number(e||0)))}function Qf(e){return`${Math.round(Math.max(0,Math.min(1,Number(e||0)))*100)}%`}function py(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 _ne(e){const t=String(e||"");return t.includes("-")?t.slice(5):t}function hy(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 Ene(e){const t=String(e||"").trim();return t?t.length>18?t.slice(0,8)+"..."+t.slice(-6):t:"-"}function Ane(e){const t=String(e||"unknown");return t==="success"?"成功":t==="failed"?"失败":t==="running"?"运行中":t==="stopped"?"已停止":t==="interrupted"?"中断":"未知"}function Pne({authUser:e}){const[t,n]=m.useState(null),[r,s]=m.useState(!1),[i,a]=m.useState(""),l=m.useCallback(async()=>{if(e!=null&&e.isAdmin){s(!0),a("");try{const h=await fetch("/api/admin/usage-dashboard"),g=await h.json().catch(()=>({}));if(!h.ok)throw new Error(typeof g.error=="string"?g.error:"HTTP "+h.status);n(g)}catch(h){n(null),a(String((h==null?void 0:h.message)||h))}finally{s(!1)}}},[e==null?void 0:e.isAdmin]);m.useEffect(()=>{l()},[l]);const c=Array.isArray(t==null?void 0:t.dailyTrend)?t.dailyTrend:[],u=m.useMemo(()=>{const k={top:20,right:24,bottom:42,left:42},w=980-k.left-k.right,y=250-k.top-k.bottom,v=c.length>0?c:[],x=Math.max(1,...v.map(O=>Number(O.runs||0))),C=Math.max(1,...v.flatMap(O=>[Number(O.users||0),Number(O.pipelines||0)])),N=O=>k.left+(v.length<=1?w/2:O*w/(v.length-1)),j=O=>k.top+y-Math.max(0,Number(O||0))/x*y,E=O=>k.top+y-Math.max(0,Number(O||0))/C*y,P=O=>v.map((B,W)=>`${W===0?"M":"L"} ${N(W)} ${E(B[O])}`).join(" ");return{width:980,height:250,margin:k,innerHeight:y,rows:v,x:N,yRuns:j,yLine:E,lineUsers:P("users"),linePipelines:P("pipelines"),barWidth:Math.min(34,Math.max(12,w/Math.max(1,v.length)*.44))}},[c]),p=(t==null?void 0:t.usage)||{},d=(t==null?void 0:t.totals)||{},f=Array.isArray(t==null?void 0:t.recentRuns)?t.recentRuns:[];return e!=null&&e.isAdmin?o.jsxs("main",{className:"af-admin-usage-page",children:[o.jsxs("section",{className:"af-admin-usage-hero",children:[o.jsxs("div",{children:[o.jsx("p",{className:"af-admin-usage-eyebrow",children:"Admin / Usage"}),o.jsx("h1",{children:"管理看板"}),o.jsx("p",{children:"重点观察使用率、每日趋势、成功率与各用户流水线活跃度。"})]}),o.jsxs("button",{type:"button",onClick:()=>void l(),disabled:r,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),r?"刷新中":"刷新"]})]}),i?o.jsx("div",{className:"af-project-admin-usage__error",children:i}):null,o.jsxs("section",{className:"af-admin-usage-rate-grid","aria-label":"使用率",children:[o.jsxs("div",{children:[o.jsx("span",{children:"7日活跃用户率"}),o.jsx("strong",{children:Qf(p.activeUserRate)}),o.jsxs("em",{children:[Rr(p.activeUsers)," / ",Rr(d.users)," users"]})]}),o.jsxs("div",{children:[o.jsx("span",{children:"7日流水线使用率"}),o.jsx("strong",{children:Qf(p.activePipelineRate)}),o.jsxs("em",{children:[Rr(p.activePipelines)," / ",Rr(d.activePipelines)," active"]})]}),o.jsxs("div",{children:[o.jsx("span",{children:"7日 Run"}),o.jsx("strong",{children:Rr(p.runs)}),o.jsxs("em",{children:[Rr(p.avgRunsPerDay)," / day"]})]}),o.jsxs("div",{children:[o.jsx("span",{children:"7日成功率"}),o.jsx("strong",{children:Qf(p.successRate)}),o.jsxs("em",{children:["失败率 ",Qf(p.failureRate)," · avg ",py(p.avgDurationMs)]})]})]}),o.jsxs("section",{className:"af-project-admin-usage af-admin-usage-trend",children:[o.jsx("div",{className:"af-project-admin-usage__head",children:o.jsxs("div",{children:[o.jsx("strong",{children:"每日趋势"}),o.jsx("span",{children:"上方看趋势,下方看最近 50 次具体运行。"})]})}),o.jsxs("div",{className:"af-admin-usage-chart",role:"img","aria-label":"最近 14 天运行趋势",children:[o.jsxs("div",{className:"af-admin-usage-chart__legend",children:[o.jsxs("span",{children:[o.jsx("i",{className:"af-admin-usage-chart__swatch af-admin-usage-chart__swatch--runs"}),"Runs"]}),o.jsxs("span",{children:[o.jsx("i",{className:"af-admin-usage-chart__swatch af-admin-usage-chart__swatch--users"}),"活跃用户"]}),o.jsxs("span",{children:[o.jsx("i",{className:"af-admin-usage-chart__swatch af-admin-usage-chart__swatch--pipelines"}),"活跃流水线"]})]}),o.jsx("div",{className:"af-admin-usage-chart__canvas",children:o.jsxs("svg",{viewBox:`0 0 ${u.width} ${u.height}`,preserveAspectRatio:"xMidYMid meet",children:[o.jsx("line",{className:"af-admin-usage-chart__axis",x1:u.margin.left,y1:u.margin.top+u.innerHeight,x2:u.width-u.margin.right,y2:u.margin.top+u.innerHeight}),[.25,.5,.75,1].map(h=>o.jsx("line",{className:"af-admin-usage-chart__grid",x1:u.margin.left,y1:u.margin.top+u.innerHeight-u.innerHeight*h,x2:u.width-u.margin.right,y2:u.margin.top+u.innerHeight-u.innerHeight*h},h)),u.rows.map((h,g)=>{const k=u.x(g),w=u.yRuns(h.runs),y=u.margin.top+u.innerHeight,v=Math.max(2,y-w);return o.jsxs("g",{children:[o.jsx("rect",{className:"af-admin-usage-chart__run-bar",x:k-u.barWidth/2,y:y-v,width:u.barWidth,height:v,rx:"5",children:o.jsx("title",{children:`${h.date}: ${h.runs} runs`})}),o.jsx("text",{className:"af-admin-usage-chart__value",x:k,y:y+22,children:Rr(h.runs)}),o.jsx("text",{className:"af-admin-usage-chart__date",x:k,y:y+42,children:_ne(h.date)})]},h.date)}),u.rows.length>0?o.jsxs(o.Fragment,{children:[o.jsx("path",{className:"af-admin-usage-chart__line af-admin-usage-chart__line--users",d:u.lineUsers}),o.jsx("path",{className:"af-admin-usage-chart__line af-admin-usage-chart__line--pipelines",d:u.linePipelines}),u.rows.map((h,g)=>{const k=u.x(g);return o.jsxs("g",{children:[o.jsx("circle",{className:"af-admin-usage-chart__point af-admin-usage-chart__point--users",cx:k,cy:u.yLine(h.users),r:"3.5"}),o.jsx("circle",{className:"af-admin-usage-chart__point af-admin-usage-chart__point--pipelines",cx:k,cy:u.yLine(h.pipelines),r:"3.5"})]},`${h.date}-points`)})]}):null]})})]}),o.jsx("div",{className:"af-project-admin-usage__table-wrap",children:o.jsxs("table",{className:"af-project-admin-usage__table af-admin-usage-table--recent",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"用户"}),o.jsx("th",{children:"流水线"}),o.jsx("th",{children:"运行时间"}),o.jsx("th",{children:"状态"}),o.jsx("th",{children:"耗时"}),o.jsx("th",{children:"Run ID"})]})}),o.jsx("tbody",{children:f.length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:6,children:"暂无运行明细"})}):f.map(h=>o.jsxs("tr",{children:[o.jsxs("td",{children:[o.jsx("strong",{children:h.username||h.userId||"-"}),o.jsx("span",{children:h.userId||"-"})]}),o.jsxs("td",{children:[o.jsx("strong",{children:h.flowId||"-"}),o.jsxs("span",{children:[h.runType==="workspace"?"Workspace Run":"Pipeline"," · ",h.flowSource||"user"]})]}),o.jsxs("td",{children:[o.jsx("strong",{children:hy(h.at)}),h.endedAt?o.jsxs("span",{children:["结束 ",hy(h.endedAt)]}):o.jsx("span",{children:"未结束"})]}),o.jsx("td",{children:o.jsx("span",{className:"af-project-admin-usage__chips",children:o.jsx("em",{children:Ane(h.status)})})}),o.jsx("td",{children:py(h.durationMs)}),o.jsx("td",{children:o.jsx("code",{className:"af-admin-usage-run-id",children:Ene(h.runId)})})]},`${h.userId}:${h.flowSource}:${h.flowId}:${h.runId}:${h.at}`))})]})})]}),o.jsxs("section",{className:"af-project-admin-usage",children:[o.jsx("div",{className:"af-project-admin-usage__head",children:o.jsxs("div",{children:[o.jsx("strong",{children:"用户使用明细"}),o.jsx("span",{children:"按用户汇总 Pipeline 数、Run 次数和最近运行。"})]})}),o.jsx("div",{className:"af-project-admin-usage__table-wrap",children:o.jsxs("table",{className:"af-project-admin-usage__table",children:[o.jsx("thead",{children:o.jsxs("tr",{children:[o.jsx("th",{children:"User"}),o.jsx("th",{children:"Pipeline"}),o.jsx("th",{children:"Runs"}),o.jsx("th",{children:"状态"}),o.jsx("th",{children:"最近运行"})]})}),o.jsx("tbody",{children:r&&!t?o.jsx("tr",{children:o.jsx("td",{colSpan:5,children:"正在加载..."})}):((t==null?void 0:t.users)||[]).length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:5,children:"暂无用户数据"})}):((t==null?void 0:t.users)||[]).map(h=>{var g,k,w,y,v,x,C,N,j,E,P;return o.jsxs("tr",{children:[o.jsxs("td",{children:[o.jsx("strong",{children:h.username||h.userId}),o.jsxs("span",{children:[h.userId,h.isAdmin?" · admin":""]})]}),o.jsxs("td",{children:[o.jsx("strong",{children:Rr((g=h.pipelines)==null?void 0:g.total)}),o.jsxs("span",{children:[Rr((k=h.pipelines)==null?void 0:k.active)," active / ",Rr((w=h.pipelines)==null?void 0:w.archived)," archived"]})]}),o.jsxs("td",{children:[o.jsx("strong",{children:Rr((y=h.runs)==null?void 0:y.total)}),o.jsxs("span",{children:["avg ",py((v=h.runs)==null?void 0:v.avgDurationMs)]})]}),o.jsx("td",{children:o.jsxs("span",{className:"af-project-admin-usage__chips",children:[o.jsxs("em",{children:["成功 ",Rr((x=h.runs)==null?void 0:x.success)]}),o.jsxs("em",{children:["失败 ",Rr((C=h.runs)==null?void 0:C.failed)]}),o.jsxs("em",{children:["运行中 ",Rr((N=h.runs)==null?void 0:N.running)]})]})}),o.jsx("td",{children:(j=h.runs)!=null&&j.lastRunAt?o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:((E=h.runs)==null?void 0:E.lastRunFlowId)||"-"}),o.jsxs("span",{children:[((P=h.runs)==null?void 0:P.lastRunStatus)||"unknown"," · ",hy(h.runs.lastRunAt)]})]}):o.jsx("span",{children:"无运行记录"})})]},h.userId)})})]})})]})]}):o.jsx("main",{className:"af-admin-usage-page",children:o.jsx("section",{className:"af-project-admin-usage",children:o.jsx("div",{className:"af-project-admin-usage__head",children:o.jsxs("div",{children:[o.jsx("strong",{children:"管理看板"}),o.jsx("span",{children:"需要管理员权限。"})]})})})})}function Ine(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 Tne({authUser:e}){const{navigate:t}=xi(),[n,r]=m.useState(""),[s,i]=m.useState(""),[a,l]=m.useState(!1),[c,u]=m.useState(""),[p,d]=m.useState(!1),[f,h]=m.useState([]),[g,k]=m.useState(!1),[w,y]=m.useState(""),v=!!(e!=null&&e.isAdmin),x=m.useCallback(async()=>{if(v){k(!0),y("");try{const N=await fetch("/api/feedback"),j=await N.json().catch(()=>({}));if(!N.ok)throw new Error(j.error||"加载失败");h(Array.isArray(j.feedback)?j.feedback:[])}catch(N){y(String(N.message||N)),h([])}finally{k(!1)}}},[v]);m.useEffect(()=>{x()},[x]);const C=async N=>{if(N.preventDefault(),!a){l(!0),u("");try{const j=await fetch("/api/feedback",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:n,content:s,pageUrl:window.location.href})}),E=await j.json().catch(()=>({}));if(!j.ok)throw new Error(E.error||"提交失败");d(!0),r(""),i("")}catch(j){u(String(j.message||j))}finally{l(!1)}}};return v?o.jsx("main",{className:"af-feedback-page",children:o.jsxs("section",{className:"af-feedback-panel af-feedback-panel--admin",children:[o.jsxs("div",{className:"af-feedback-head",children:[o.jsxs("div",{children:[o.jsx("span",{className:"af-feedback-eyebrow",children:"Feedback"}),o.jsx("h1",{children:"意见反馈"}),o.jsx("p",{children:"查看用户提交的问题、建议和功能需求。"})]}),o.jsxs("div",{className:"af-feedback-admin-actions",children:[o.jsxs("button",{type:"button",className:"af-feedback-back",onClick:()=>void x(),disabled:g,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:g?"hourglass_empty":"refresh"}),g?"刷新中...":"刷新"]}),o.jsxs("button",{type:"button",className:"af-feedback-back",onClick:()=>t("/projects"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),"返回"]})]})]}),w?o.jsx("p",{className:"af-err af-feedback-error",children:w}):null,o.jsx("div",{className:"af-feedback-list af-feedback-list--page",children:f.length>0?f.map(N=>o.jsxs("article",{className:"af-feedback-item",children:[o.jsxs("header",{className:"af-feedback-item__head",children:[o.jsxs("div",{children:[o.jsx("h3",{children:N.title||"未命名反馈"}),o.jsxs("p",{children:[o.jsx("span",{children:N.username||N.userId||"unknown"}),o.jsx("span",{children:Ine(N.createdAt)})]})]}),N.contact?o.jsx("span",{className:"af-feedback-item__contact",children:N.contact}):null]}),o.jsx("p",{className:"af-feedback-item__content",children:N.content}),N.pageUrl?o.jsx("code",{className:"af-feedback-item__url",children:N.pageUrl}):null]},N.id)):o.jsx("div",{className:"af-feedback-empty",children:g?"正在加载反馈...":"暂无反馈"})})]})}):o.jsx("main",{className:"af-feedback-page",children:o.jsxs("section",{className:"af-feedback-panel",children:[o.jsxs("div",{className:"af-feedback-head",children:[o.jsxs("div",{children:[o.jsx("span",{className:"af-feedback-eyebrow",children:"Feedback"}),o.jsx("h1",{children:"意见反馈"}),o.jsx("p",{children:"提交使用中遇到的问题、改进建议或功能需求,管理员会在这里统一查看。"})]}),o.jsxs("button",{type:"button",className:"af-feedback-back",onClick:()=>t("/projects"),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),"返回"]})]}),p?o.jsxs("div",{className:"af-feedback-success",role:"status",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"check_circle"}),o.jsxs("div",{children:[o.jsx("strong",{children:"已提交"}),o.jsx("span",{children:"感谢反馈,管理员可以在意见反馈页查看这条记录。"})]})]}):null,o.jsxs("form",{className:"af-feedback-form",onSubmit:C,children:[o.jsxs("label",{className:"af-feedback-field",children:[o.jsx("span",{children:"标题"}),o.jsx("input",{value:n,onChange:N=>r(N.target.value),placeholder:"一句话说明问题或建议",maxLength:120,required:!0})]}),o.jsxs("label",{className:"af-feedback-field",children:[o.jsx("span",{children:"反馈内容"}),o.jsx("textarea",{value:s,onChange:N=>i(N.target.value),placeholder:"描述具体场景、期望表现、实际表现或复现步骤",maxLength:5e3,rows:9,required:!0})]}),c?o.jsx("p",{className:"af-err af-feedback-error",children:c}):null,o.jsx("div",{className:"af-feedback-actions",children:o.jsxs("button",{type:"submit",className:"af-feedback-submit",disabled:a||!n.trim()||!s.trim(),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:a?"hourglass_empty":"send"}),a?"提交中...":"提交反馈"]})})]})]})})}function TT(){return`m_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function P1(e,t=[]){const n=new Set((Array.isArray(t)?t:[]).map(String));return Object.entries(e&&typeof e=="object"?e:{}).map(([r,s])=>({id:TT(),key:r,value:String(s??""),private:n.has(r)}))}function I1(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 Cp(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(`
|
|
313
|
-
`),description:String((e==null?void 0:e.description)||t.description||""),envRows:P1(t.env||(e==null?void 0:e.env),e==null?void 0:e.privateEnvKeys),headerRows:P1(t.headers||(e==null?void 0:e.headers),e==null?void 0:e.privateHeaderKeys),extraJson:JSON.stringify(Object.fromEntries(Object.entries(t).filter(([r])=>!["url","command","args","env","headers","description","__agentflowPrivateKeys"].includes(r))),null,2)}}function my(){return Cp({name:"",raw:{command:""}})}function Rne(e){const n={...e.extraJson.trim()?JSON.parse(e.extraJson):{}};if(e.type==="url")n.url=e.url.trim();else{n.command=e.command.trim();const i=e.argsText.split(/\r?\n/g).map(a=>a.trim()).filter(Boolean);i.length&&(n.args=i)}const r=I1(e.envRows),s=I1(e.headerRows);return Object.keys(r).length&&(n.env=r),Object.keys(s).length&&(n.headers=s),e.description.trim()&&(n.description=e.description.trim()),{name:e.originalName,nextName:e.name.trim(),server:n,privateEnvKeys:e.envRows.filter(i=>i.private).map(i=>String(i.key||"").trim()).filter(Boolean),privateHeaderKeys:e.headerRows.filter(i=>i.private).map(i=>String(i.key||"").trim()).filter(Boolean)}}function T1(e){return e?e.ok?`${e.toolCount||0} tools enabled`:`Error - ${e.error||"Show Output"}`:"未检测"}function R1(e){return e?e.ok?"ok":"error":"unknown"}function mw(e){return e==="ok"?"ok":e==="partial"?"partial":e==="unsupported"?"error":"unknown"}function Mne(e,t){return e&&e.label||t}async function gy(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 pk(e){return String(e||"").trim()||"<AGENTFLOW_TOKEN>"}function RT({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:pk(t)}}}},null,2)}function MT({baseUrl:e="",token:t=""}){const n=JSON.stringify(String(e||"http://127.0.0.1:8875")),r=JSON.stringify(pk(t));return["[mcp_servers.agentflow]",'command = "agentflow"','args = ["mcp"]',"","[mcp_servers.agentflow.env]",`AGENTFLOW_BASE_URL = ${n}`,`AGENTFLOW_TOKEN = ${r}`].join(`
|
|
314
|
-
`)}function $ne({baseUrl:e="",token:t=""}){const n=String(e||"http://127.0.0.1:8875"),r=RT({baseUrl:n,token:t}),s=MT({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: ${pk(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(`
|
|
315
|
-
`)}function Lne({server:e}){const t=(e==null?void 0:e.backends)||{},n=[["Cursor",t.cursor],["Codex",t.codex]];return o.jsx("div",{className:"af-mcp-backends",children:n.map(([r,s])=>o.jsxs("div",{className:`af-mcp-backend af-mcp-backend--${mw(s==null?void 0:s.status)}`,children:[o.jsxs("div",{className:"af-mcp-backend-head",children:[o.jsx("strong",{children:r}),o.jsx("span",{children:Mne(s,"Unknown")})]}),Array.isArray(s==null?void 0:s.reasons)&&s.reasons.length?o.jsx("ul",{children:s.reasons.map(i=>o.jsx("li",{children:i},i))}):o.jsx("p",{children:"当前配置可直接使用。"})]},r))})}function M1({title:e,rows:t,onChange:n,placeholderKey:r="KEY",placeholderValue:s="value"}){const i=(a,l,c)=>n(t.map(u=>u.id===a?{...u,[l]:c}:u));return o.jsxs("div",{className:"af-mcp-field",children:[o.jsxs("div",{className:"af-mcp-field-head",children:[o.jsx("span",{children:e}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>n([...t,{id:TT(),key:"",value:"",private:!0}]),children:"添加"})]}),o.jsxs("div",{className:"af-mcp-kv-list",children:[t.length===0?o.jsx("p",{className:"af-set-hint",children:"暂无"}):null,t.map(a=>o.jsxs("div",{className:"af-mcp-kv-row",children:[o.jsx("input",{className:"af-set-input af-set-input--mono",value:a.key,placeholder:r,onChange:l=>i(a.id,"key",l.target.value)}),o.jsx("input",{className:"af-set-input af-set-input--mono",value:a.value,placeholder:s,onChange:l=>i(a.id,"value",l.target.value)}),o.jsxs("label",{className:"af-mcp-private-toggle",title:"只保存到当前 AgentFlow 用户的个人配置",children:[o.jsx("input",{type:"checkbox",checked:!!a.private,onChange:l=>i(a.id,"private",l.target.checked)}),o.jsx("span",{children:"个人"})]}),o.jsx("button",{type:"button",className:"af-set-env-del",onClick:()=>n(t.filter(l=>l.id!==a.id)),"aria-label":"删除",children:o.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},a.id))]})]})}function One(){var ie;const[e,t]=m.useState(""),[n,r]=m.useState([]),[s,i]=m.useState(my),[a,l]=m.useState(""),[c,u]=m.useState(!1),[p,d]=m.useState(!1),[f,h]=m.useState(!1),[g,k]=m.useState({}),[w,y]=m.useState(""),[v,x]=m.useState(""),[C,N]=m.useState(()=>{var G;return typeof window<"u"&&((G=window.location)!=null&&G.origin)?window.location.origin:"http://127.0.0.1:8875"}),[j,E]=m.useState(""),[P,O]=m.useState(""),B=m.useMemo(()=>n.find(G=>G.name===a)||null,[a,n]),W=B&&g[B.name]||null,z=m.useMemo(()=>RT({baseUrl:C,token:j}),[C,j]),L=m.useMemo(()=>MT({baseUrl:C,token:j}),[C,j]),R=m.useMemo(()=>$ne({baseUrl:C,token:j}),[C,j]),K=m.useCallback(async()=>{u(!0),y("");try{const G=await fetch("/api/mcps"),se=await G.json().catch(()=>({}));if(!G.ok)throw new Error(se.error||"MCP HTTP "+G.status);const te=Array.isArray(se.servers)?se.servers:[];t(String(se.path||"")),r(te),a&&te.some(re=>re.name===a)&&i(Cp(te.find(re=>re.name===a)))}catch(G){y(String(G.message||G))}finally{u(!1)}},[a]);m.useEffect(()=>{K()},[K]);const D=()=>{l(""),i(my()),x(""),y("")},$=G=>{l(G.name),i(Cp(G)),x(""),y("")},I=m.useCallback(async()=>{if(!R)return;const G=await gy(R);O(G?"prompt":"copy-failed"),window.setTimeout(()=>O(""),1200)},[R]),F=m.useCallback(async()=>{const G=await gy(z);O(G?"cursor":"copy-failed"),window.setTimeout(()=>O(""),1200)},[z]),_=m.useCallback(async()=>{const G=await gy(L);O(G?"codex":"copy-failed"),window.setTimeout(()=>O(""),1200)},[L]),X=m.useCallback(async()=>{try{const G=await fetch("/api/auth/session-token"),se=await G.json().catch(()=>({}));if(!G.ok)throw new Error(typeof se.error=="string"?se.error:"HTTP "+G.status);E(String(se.token||"")),O("token"),window.setTimeout(()=>O(""),1200)}catch(G){O(""),y(String(G.message||G))}},[]),V=async(G="")=>{h(!0),y(""),x("");try{const se=await fetch("/api/mcps/check",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(G?{name:G}:{})}),te=await se.json().catch(()=>({}));if(!se.ok)throw new Error(te.error||"检测 MCP 失败");const re=Array.isArray(te.results)?te.results:[];k(ne=>{const ce={...ne};for(const de of re)de!=null&&de.name&&(ce[de.name]=de);return ce}),x(G?`已检测 ${G}。`:"已检测所有 MCP。")}catch(se){y(String(se.message||se))}finally{h(!1)}},T=async()=>{d(!0),y(""),x("");try{const G=Rne(s);if(!G.nextName)throw new Error("请填写 MCP 名称");const se=await fetch("/api/mcps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(G)}),te=await se.json().catch(()=>({}));if(!se.ok)throw new Error(te.error||"保存 MCP 失败");const re=Array.isArray(te.servers)?te.servers:[];r(re),t(String(te.path||e)),l(G.nextName),i(Cp(re.find(ne=>ne.name===G.nextName)||null)),k(ne=>{const ce={...ne};return s.originalName&&s.originalName!==G.nextName&&delete ce[s.originalName],delete ce[G.nextName],ce}),x("已保存。Cursor CLI 下次启动时会读取新配置。")}catch(G){y(String(G.message||G))}finally{d(!1)}},ee=async G=>{if(G!=null&&G.name&&window.confirm(`删除 MCP "${G.name}"?`)){d(!0),y(""),x("");try{const se=await fetch("/api/mcps/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:G.name})}),te=await se.json().catch(()=>({}));if(!se.ok)throw new Error(te.error||"删除 MCP 失败");r(Array.isArray(te.servers)?te.servers:[]),l(""),i(my()),k(re=>{const ne={...re};return delete ne[G.name],ne}),x("已删除。")}catch(se){y(String(se.message||se))}finally{d(!1)}}};return o.jsxs("main",{className:"af-settings-page",children:[o.jsxs("header",{className:"af-settings-top",children:[o.jsxs("div",{className:"af-settings-crumb",children:[o.jsx("span",{className:"af-settings-crumb-muted",children:"AgentFlow"}),o.jsx("span",{className:"af-settings-crumb-sep",children:"/"}),o.jsx("span",{className:"af-settings-crumb-active",children:"MCP"})]}),o.jsxs("div",{className:"af-settings-top-right",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:K,disabled:c||p,children:"刷新"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>V(),disabled:f||c||p||n.length===0,children:f?"检测中...":"检测状态"}),o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:D,disabled:p,children:"新增 MCP"})]})]}),o.jsx("div",{className:"af-settings-body",children:o.jsxs("div",{className:"af-settings-inner",children:[o.jsxs("section",{className:"af-settings-hero",children:[o.jsx("h1",{className:"af-settings-h1",children:"MCP 管理"}),o.jsx("p",{className:"af-settings-lead",children:"管理 AgentFlow 暴露给外部 Agent 的 MCP 接入方式,以及 AgentFlow 自身可调用的外部 MCP server。"})]}),o.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low af-set-mcp-personal",children:[o.jsxs("div",{className:"af-set-env-head",children:[o.jsxs("div",{className:"af-set-card-head",children:[o.jsx("div",{className:"af-set-env-icon-wrap",children:o.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"lan"})}),o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:"我的 MCP"}),o.jsx("p",{className:"af-set-card-subtitle",children:"给 Cursor、Codex 等外部 Agent 配置 AgentFlow MCP,用来运行流程并读取 display 结果。"})]})]}),o.jsx("span",{className:"af-set-badge af-set-badge--ok",children:"AgentFlow as MCP"})]}),o.jsx("p",{className:"af-set-hint",children:"这里生成的是让其他 Agent 连接本平台的配置;下方“外部 MCP Servers”管理的是 AgentFlow 运行时可调用的外部工具。"}),o.jsxs("div",{className:"af-set-mcp-connect-grid",children:[o.jsxs("label",{className:"af-set-mcp-field",children:[o.jsx("span",{children:"Base URL"}),o.jsx("input",{className:"af-set-input af-set-input--mono",value:C,onChange:G=>N(G.target.value),placeholder:"http://127.0.0.1:8875"})]}),o.jsxs("label",{className:"af-set-mcp-field",children:[o.jsx("span",{children:"Token"}),o.jsxs("div",{className:"af-set-mcp-token-row",children:[o.jsx("input",{className:"af-set-input af-set-input--mono",type:"password",value:j,onChange:G=>E(G.target.value),placeholder:"<AGENTFLOW_TOKEN>"}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:X,children:P==="token"?"已填入":"使用当前登录 Token"})]})]})]}),o.jsxs("div",{className:"af-set-mcp-snippet-grid",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"af-set-mcp-snippet-head",children:[o.jsx("span",{children:"Cursor mcp.json"}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:F,children:P==="cursor"?"已复制":P==="copy-failed"?"复制失败":"复制"})]}),o.jsx("pre",{className:"af-set-mcp-code",children:z})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"af-set-mcp-snippet-head",children:[o.jsx("span",{children:"Codex config.toml"}),o.jsx("button",{type:"button",className:"af-set-btn-outline af-set-btn-outline--compact",onClick:_,children:P==="codex"?"已复制":P==="copy-failed"?"复制失败":"复制"})]}),o.jsx("pre",{className:"af-set-mcp-code",children:L})]})]}),o.jsx("div",{className:"af-set-mcp-copy-row",children:o.jsxs("button",{type:"button",className:"af-set-footer-primary",onClick:I,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"content_copy"}),P==="prompt"?"已复制 Prompt":P==="copy-failed"?"复制失败":"复制 AI 配置 Prompt"]})}),P==="copy-failed"?o.jsx("p",{className:"af-mcp-error",children:"浏览器禁止访问剪贴板,请手动选中下面的 Prompt 复制。"}):null,o.jsx("label",{className:"af-set-label-sm",htmlFor:"af-mcp-ai-prompt",children:"AI 配置 Prompt"}),o.jsx("textarea",{id:"af-mcp-ai-prompt",className:"af-set-input af-set-input--mono af-set-mcp-prompt",rows:12,readOnly:!0,value:R})]}),o.jsxs("section",{className:"af-settings-hero af-settings-hero--compact",children:[o.jsx("h2",{className:"af-settings-h2",children:"外部 MCP Servers"}),o.jsxs("p",{className:"af-settings-lead",children:["新增、编辑和删除 AgentFlow 可调用的外部 MCP server。当前配置文件:",o.jsx("span",{className:"af-settings-code",children:e||"~/.cursor/mcp.json"})]})]}),o.jsxs("div",{className:"af-mcp-layout",children:[o.jsxs("section",{className:"af-set-card af-mcp-list-card",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsx("h2",{className:"af-set-h2",children:"Servers"}),o.jsxs("div",{className:"af-mcp-list-head-actions",children:[o.jsx("span",{className:"af-set-badge af-set-badge--muted",children:n.length}),o.jsxs("button",{type:"button",className:"af-set-btn-mini",onClick:D,disabled:p,children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新增"]})]})]}),c?o.jsx("p",{className:"af-set-p",children:"加载中..."}):null,n.length===0&&!c?o.jsxs("div",{className:"af-mcp-empty",children:[o.jsx("p",{className:"af-set-p",children:"暂无 MCP server。"}),o.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:D,disabled:p,children:"新增 MCP Server"})]}):null,o.jsx("div",{className:"af-mcp-server-list",children:n.map(G=>{var se,te,re,ne;return o.jsxs("button",{type:"button",className:"af-mcp-server-item"+(a===G.name?" af-mcp-server-item--active":""),onClick:()=>$(G),children:[o.jsx("span",{className:"material-symbols-outlined",children:G.type==="url"?"cloud":"terminal"}),o.jsxs("span",{children:[o.jsxs("span",{className:"af-mcp-server-title",children:[o.jsx("strong",{children:G.name}),o.jsx("small",{className:`af-mcp-server-health af-mcp-server-health--${R1(g[G.name])}`,children:T1(g[G.name])})]}),o.jsxs("span",{className:"af-mcp-server-backends",children:[o.jsx("small",{className:`af-mcp-backend-pill af-mcp-backend-pill--${mw((te=(se=G.backends)==null?void 0:se.cursor)==null?void 0:te.status)}`,children:"Cursor"}),o.jsx("small",{className:`af-mcp-backend-pill af-mcp-backend-pill--${mw((ne=(re=G.backends)==null?void 0:re.codex)==null?void 0:ne.status)}`,children:"Codex"})]}),o.jsx("em",{children:G.url||[G.command,...G.args||[]].filter(Boolean).join(" ")})]})]},G.name)})})]}),o.jsxs("section",{className:"af-set-card af-mcp-editor-card",children:[o.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"af-set-h2",children:B?"编辑 MCP":"新增 MCP"}),o.jsx("p",{className:"af-set-p af-set-p--tight",children:"保存后会写入 Cursor MCP 配置。已运行的 agent 进程不会热更新,下一次启动会读取新配置。"})]}),B?o.jsxs("div",{className:"af-mcp-editor-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>V(B.name),disabled:f||p,children:f?"检测中...":"检测"}),o.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>ee(B),disabled:p,children:"删除"})]}):null]}),w?o.jsx("p",{className:"af-mcp-error",children:w}):null,v?o.jsx("p",{className:"af-mcp-status",children:v}):null,B?o.jsx(Lne,{server:B}):null,W?o.jsxs("div",{className:`af-mcp-check af-mcp-check--${R1(W)}`,children:[o.jsxs("div",{className:"af-mcp-check-head",children:[o.jsx("strong",{children:T1(W)}),o.jsxs("span",{children:[W.elapsedMs||0,"ms"]})]}),W.error?o.jsx("p",{children:W.error}):null,(ie=W.tools)!=null&&ie.length?o.jsx("div",{className:"af-mcp-tools-list",children:W.tools.map(G=>o.jsxs("div",{className:"af-mcp-tool-row",children:[o.jsx("strong",{children:G.name}),G.description?o.jsx("span",{children:G.description}):null]},G.name))}):null]}):null,o.jsxs("div",{className:"af-mcp-form",children:[o.jsxs("label",{className:"af-set-label",children:["MCP 名称",o.jsx("input",{className:"af-set-input af-set-input--mono",value:s.name,onChange:G=>i(se=>({...se,name:G.target.value})),placeholder:"github"})]}),o.jsxs("label",{className:"af-set-label",children:["类型",o.jsxs("select",{className:"af-set-input",value:s.type,onChange:G=>i(se=>({...se,type:G.target.value})),children:[o.jsx("option",{value:"url",children:"URL / HTTP"}),o.jsx("option",{value:"command",children:"Command / stdio"})]})]}),s.type==="url"?o.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["URL",o.jsx("input",{className:"af-set-input af-set-input--mono",value:s.url,onChange:G=>i(se=>({...se,url:G.target.value})),placeholder:"http://127.0.0.1:3845/mcp"})]}):o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"af-set-label",children:["Command",o.jsx("input",{className:"af-set-input af-set-input--mono",value:s.command,onChange:G=>i(se=>({...se,command:G.target.value})),placeholder:"uvx"})]}),o.jsxs("label",{className:"af-set-label",children:["Args,每行一个",o.jsx("textarea",{className:"af-set-input af-mcp-textarea af-set-input--mono",rows:4,value:s.argsText,onChange:G=>i(se=>({...se,argsText:G.target.value})),placeholder:`mcp-server-example
|
|
316
|
-
--flag`})]})]}),o.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["描述",o.jsx("input",{className:"af-set-input",value:s.description,onChange:G=>i(se=>({...se,description:G.target.value})),placeholder:"这个 MCP 提供什么能力"})]}),o.jsx(M1,{title:"Headers",rows:s.headerRows,onChange:G=>i(se=>({...se,headerRows:G})),placeholderKey:"Authorization",placeholderValue:"Bearer ..."}),o.jsx(M1,{title:"Env",rows:s.envRows,onChange:G=>i(se=>({...se,envRows:G})),placeholderKey:"TOKEN",placeholderValue:"..."}),o.jsxs("label",{className:"af-set-label af-mcp-field--wide",children:["额外 JSON 字段",o.jsx("textarea",{className:"af-set-input af-mcp-textarea af-set-input--mono",rows:5,value:s.extraJson,onChange:G=>i(se=>({...se,extraJson:G.target.value}))})]})]}),o.jsxs("div",{className:"af-mcp-actions",children:[o.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:D,disabled:p,children:"清空"}),o.jsx("button",{type:"button",className:"af-set-footer-primary",onClick:T,disabled:p,children:p?"保存中...":"保存 MCP"})]})]})]})]})})]})}function $1(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 Dne(e){return(e==null?void 0:e.kind)==="workspace"?"Workspace":"Pipeline"}function Fne(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 zne(){const[e,t]=m.useState([]),[n,r]=m.useState(!1),[s,i]=m.useState(""),[a,l]=m.useState(""),c=m.useCallback(async()=>{r(!0),i("");try{const d=await fetch("/api/schedules"),f=await d.json().catch(()=>({}));if(!d.ok)throw new Error(f.error||"读取定时任务失败");t(Array.isArray(f.schedules)?f.schedules:[])}catch(d){i(String(d.message||d)),t([])}finally{r(!1)}},[]);m.useEffect(()=>{c()},[c]);const u=m.useCallback(async d=>{const f=`${d.kind}:${d.flowSource||"user"}:${d.flowId||""}:${d.scheduleNodeId||""}`;l(f),i("");try{const h=await fetch("/api/schedule/toggle",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kind:d.kind,flowId:d.flowId,flowSource:d.flowSource||"user",scheduleNodeId:d.scheduleNodeId||"",enabled:!d.enabled})}),g=await h.json().catch(()=>({}));if(!h.ok||g.success===!1)throw new Error(g.error||"更新定时任务失败");await c()}catch(h){i(String(h.message||h))}finally{l("")}},[c]),p=m.useMemo(()=>{const d=e.filter(h=>h.enabled).length,f=e.filter(h=>h.kind==="workspace").length;return{total:e.length,enabled:d,workspace:f,pipeline:e.length-f}},[e]);return o.jsxs("div",{className:"af-settings-page af-schedules-page",children:[o.jsxs("div",{className:"af-settings-top",children:[o.jsxs("div",{className:"af-settings-crumb",children:[o.jsx("span",{className:"af-settings-crumb-muted",children:"AgentFlow"}),o.jsx("span",{className:"af-settings-crumb-sep",children:"/"}),o.jsx("span",{className:"af-settings-crumb-active",children:"定时任务"})]}),o.jsxs("button",{type:"button",className:"af-schedules-refresh",onClick:()=>void c(),disabled:n,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:n?"hourglass_empty":"refresh"}),"刷新"]})]}),o.jsx("div",{className:"af-settings-body",children:o.jsxs("div",{className:"af-settings-inner",children:[o.jsxs("section",{className:"af-settings-hero",children:[o.jsx("h1",{className:"af-settings-h1",children:"定时任务"}),o.jsx("p",{className:"af-settings-lead",children:"统一查看服务器上的 Pipeline 定时任务和 Workspace Scheduled Run,并在这里快捷启停。"})]}),o.jsxs("div",{className:"af-schedules-summary","aria-label":"定时任务汇总",children:[o.jsxs("div",{children:[o.jsx("span",{children:"全部"}),o.jsx("strong",{children:p.total})]}),o.jsxs("div",{children:[o.jsx("span",{children:"启用中"}),o.jsx("strong",{children:p.enabled})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Workspace"}),o.jsx("strong",{children:p.workspace})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Pipeline"}),o.jsx("strong",{children:p.pipeline})]})]}),s?o.jsx("div",{className:"af-schedules-error",children:s}):null,n?o.jsx("div",{className:"af-schedules-empty",children:"Loading..."}):null,!n&&e.length===0?o.jsx("div",{className:"af-schedules-empty",children:"暂无定时任务"}):null,o.jsx("div",{className:"af-schedules-list",children:e.map(d=>{const f=`${d.kind}:${d.flowSource||"user"}:${d.flowId||""}:${d.scheduleNodeId||""}`,h=a===f;return o.jsxs("article",{className:"af-schedule-card",children:[o.jsxs("div",{className:"af-schedule-card__main",children:[o.jsxs("div",{className:"af-schedule-card__title-row",children:[o.jsx("strong",{children:d.label||d.flowId||"-"}),o.jsx("span",{className:`af-schedule-badge af-schedule-badge--${d.kind||"pipeline"}`,children:Dne(d)}),o.jsx("span",{className:`af-schedule-state ${d.enabled?"af-schedule-state--on":"af-schedule-state--off"}`,children:Fne(d)})]}),o.jsxs("div",{className:"af-schedule-card__meta",children:[o.jsx("span",{children:d.flowId||"-"}),o.jsx("span",{children:d.flowSource||"user"}),d.scheduleNodeId?o.jsx("span",{children:d.scheduleNodeId}):null]}),o.jsxs("div",{className:"af-schedule-card__grid",children:[o.jsxs("div",{children:[o.jsx("span",{children:"Cron"}),o.jsx("strong",{children:d.cron||"-"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"时区"}),o.jsx("strong",{children:d.timezone||"Asia/Shanghai"})]}),o.jsxs("div",{children:[o.jsx("span",{children:"下次执行"}),o.jsx("strong",{children:$1(d.nextRunAt)})]}),o.jsxs("div",{children:[o.jsx("span",{children:"最近执行"}),o.jsx("strong",{children:$1(d.lastTriggeredAt)})]})]}),d.lastError?o.jsx("p",{className:"af-schedule-card__error",children:d.lastError}):null]}),o.jsx("div",{className:"af-schedule-card__actions",children:o.jsxs("button",{type:"button",className:d.enabled?"af-schedule-toggle af-schedule-toggle--on":"af-schedule-toggle af-schedule-toggle--off",disabled:h,"aria-pressed":d.enabled,title:d.enabled?"点击停用":"点击启用",onClick:()=>void u(d),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:h?"hourglass_empty":d.enabled?"toggle_on":"toggle_off"}),d.enabled?"已启用":"已停用"]})})]},f)})})]})})]})}const L1={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 O1(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 Bne(e){var c,u,p,d,f,h,g,k,w,y,v,x;const t=(e==null?void 0:e.manifest)||{},n=(e==null?void 0:e.files)||{},r=Array.isArray(t.inputs)?t.inputs:[],s=Array.isArray(t.outputs)?t.outputs:[],i=Array.isArray((c=t.configSchema)==null?void 0:c.fields)?t.configSchema.fields:[],a=Array.isArray((p=(u=t.ui)==null?void 0:u.card)==null?void 0:p.actions)?t.ui.card.actions:[],l=(d=e==null?void 0:e.test)!=null&&d.inputs&&typeof e.test.inputs=="object"?e.test.inputs:{};return[{id:"contract",label:"Contract",icon:"account_tree",rows:[...r.map(C=>[`input.${C.name||"-"}`,`${C.type||"text"}${C.required?" · required":""}${C.default?` · default: ${C.default}`:""}`]),...s.map(C=>[`output.${C.name||"-"}`,C.type||"text"]),...i.map(C=>[`config.${C.key||"-"}`,C.type||"text"])]},{id:"runtime",label:"Runtime",icon:"terminal",rows:[["runtime.type",((f=t.runtime)==null?void 0:f.type)||t.baseDefinitionId||"tool_nodejs"],["runtime.entry",((h=t.runtime)==null?void 0:h.entry)||"scripts/run.mjs"],["prompt.md",n["prompt.md"]||"-"],["implementation.md",n["implementation.md"]||"-"]]},{id:"ui",label:"UI",icon:"dashboard_customize",rows:[["card.variant",((k=(g=t.ui)==null?void 0:g.card)==null?void 0:k.variant)||"default"],["card.icon",((y=(w=t.ui)==null?void 0:w.card)==null?void 0:y.icon)||"extension"],...a.map(C=>[`action.${C.id||C.label||"-"}`,C.variant||C.label||"secondary"])]},{id:"tests",label:"Tests",icon:"science",rows:[...Object.entries(l).map(([C,N])=>[`sample.${C}`,String(N)]),["last run",`${((v=e==null?void 0:e.test)==null?void 0:v.status)||"not run"}${(x=e==null?void 0:e.test)!=null&&x.durationMs?` · ${e.test.durationMs}ms`:""}`]]}]}function Hne(){var L,R,K,D,$,I,F;const[e,t]=m.useState(null),[n,r]=m.useState("runtime"),[s,i]=m.useState(!1),[a,l]=m.useState(!0),[c,u]=m.useState(""),[p,d]=m.useState(!1),[f,h]=m.useState(""),g=e||L1,k=m.useMemo(()=>Bne(g),[g]),w=m.useMemo(()=>k.find(_=>_.id===n)||k[1],[n,k]),y=(g==null?void 0:g.manifest)||{},v=(g==null?void 0:g.config)||{},x=((L=g==null?void 0:g.test)==null?void 0:L.inputs)||{},C=Array.isArray((R=g==null?void 0:g.test)==null?void 0:R.log)?g.test.log:[],N=((D=(K=y.ui)==null?void 0:K.card)==null?void 0:D.icon)||"event_repeat",j=((I=($=y.ui)==null?void 0:$.card)==null?void 0:I.variant)||"default",E=v.enabled===!0,P=m.useCallback(async()=>{var _;l(!0),u("");try{const X=await fetch("/api/node-studio/drafts"),V=await X.json().catch(()=>({}));if(!X.ok)throw new Error(V.error||"读取节点草稿失败");const T=Array.isArray(V.drafts)?V.drafts[0]:null;if(!(T!=null&&T.id)){t(null),h("");return}const ee=await fetch(`/api/node-studio/draft?id=${encodeURIComponent(T.id)}`),ie=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(ie.error||"读取节点草稿失败");t(ie.draft||null),h(String(((_=ie.draft)==null?void 0:_.promptDraft)||""))}catch(X){u(String(X.message||X))}finally{l(!1)}},[]);m.useEffect(()=>{P()},[P]);const O=m.useCallback(async(_={})=>{var X;d(!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",..._})}),T=await V.json().catch(()=>({}));if(!V.ok||T.ok===!1)throw new Error(T.error||"保存节点草稿失败");t(T.draft||e),h(String(((X=T.draft||e)==null?void 0:X.promptDraft)||""))}catch(V){u(String(V.message||V))}finally{d(!1)}},[e]),B=()=>{i(!0),window.setTimeout(()=>i(!1),900)},W=_=>{const X={...v,enabled:_};t(V=>({...V||L1,config:X})),O({config:{enabled:_}})},z=()=>{O({promptDraft:f,appendUserMessage:!0})};return o.jsxs("div",{className:"af-node-studio-page",children:[o.jsxs("header",{className:"af-node-studio-top",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"af-settings-crumb",children:[o.jsx("span",{className:"af-settings-crumb-muted",children:"AgentFlow"}),o.jsx("span",{className:"af-settings-crumb-sep",children:"/"}),o.jsx("span",{className:"af-settings-crumb-active",children:"Node Studio"})]}),o.jsx("h1",{children:"节点编辑器"})]}),o.jsxs("div",{className:"af-node-studio-actions",children:[o.jsxs("button",{type:"button",onClick:()=>void P(),disabled:a,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"visibility"}),a?"Loading":"Preview"]}),o.jsxs("button",{type:"button",onClick:B,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:s?"sync":"science"}),"Test"]}),o.jsxs("button",{type:"button",className:"af-node-studio-actions__primary",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"publish"}),"Publish"]})]})]}),o.jsxs("main",{className:"af-node-studio-shell",children:[o.jsxs("aside",{className:"af-node-studio-agent","aria-label":"AI Agent",children:[o.jsxs("div",{className:"af-node-studio-panel-head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"auto_awesome"}),o.jsx("strong",{children:"AI Agent"})]}),c?o.jsx("div",{className:"af-node-studio-error",children:c}):null,o.jsxs("div",{className:"af-node-studio-thread",children:[e?null:o.jsx("div",{className:"af-node-studio-empty",children:"还没有节点草稿。描述你要创建的节点,发送后会创建一个新的 draft。"}),(Array.isArray(g==null?void 0:g.agentMessages)?g.agentMessages:[]).map((_,X)=>o.jsx("div",{className:_.role==="user"?"af-node-studio-message af-node-studio-message--user":"af-node-studio-message",children:_.text||""},`${_.role||"message"}-${X}`)),o.jsxs("div",{className:"af-node-studio-agent-tools",children:[o.jsxs("button",{type:"button",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"edit"}),"修改 UI"]}),o.jsxs("button",{type:"button",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"code"}),"改脚本"]}),o.jsxs("button",{type:"button",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"bug_report"}),"修复报错"]})]})]}),o.jsxs("label",{className:"af-node-studio-prompt",children:[o.jsx("span",{children:"需求"}),o.jsx("textarea",{value:f,onChange:_=>h(_.target.value)})]}),o.jsxs("button",{type:"button",className:"af-node-studio-send",onClick:z,disabled:p,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:p?"sync":"send"}),p?"Saving":"Send"]})]}),o.jsxs("section",{className:"af-node-studio-preview","aria-label":"Preview and Test",children:[o.jsxs("div",{className:"af-node-studio-panel-head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"view_in_ar"}),o.jsx("strong",{children:"Preview / Test"})]}),o.jsxs("div",{className:"af-node-studio-preview-grid",children:[o.jsx("div",{className:"af-node-studio-preview-stage",children:e?j==="schedule"?o.jsxs("div",{className:"af-node-preview-card",children:[o.jsxs("div",{className:"af-node-preview-card__head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:N}),o.jsx("strong",{children:g.title||y.name||"Untitled Node"}),o.jsx("code",{children:O1(g)})]}),o.jsxs("label",{className:"af-node-preview-toggle",children:[o.jsx("input",{type:"checkbox",checked:E,onChange:_=>W(_.target.checked)}),o.jsx("span",{children:E?"定时开启":"定时关闭"})]}),o.jsxs("div",{className:"af-node-preview-fields",children:[o.jsxs("label",{children:[o.jsx("span",{children:"频率"}),o.jsxs("select",{value:v.scheduleType||"daily",onChange:_=>O({config:{scheduleType:_.target.value}}),children:[o.jsx("option",{value:"daily",children:"每天"}),o.jsx("option",{value:"weekly",children:"每周"})]})]}),o.jsxs("label",{children:[o.jsx("span",{children:"时间"}),o.jsxs("div",{children:[o.jsxs("select",{value:v.hour||"09",onChange:_=>O({config:{hour:_.target.value}}),children:[o.jsx("option",{children:"09"}),o.jsx("option",{children:"10"})]}),o.jsxs("select",{value:v.minute||"00",onChange:_=>O({config:{minute:_.target.value}}),children:[o.jsx("option",{children:"00"}),o.jsx("option",{children:"30"})]})]})]})]}),o.jsxs("div",{className:"af-node-preview-meta",children:[o.jsxs("span",{children:[v.scheduleType==="weekly"?"每周":"每天"," ",v.hour||"09",":",v.minute||"00"]}),o.jsx("span",{children:"Next -"}),o.jsx("span",{children:E?"enabled":"disabled"})]}),o.jsxs("div",{className:"af-node-preview-actions",children:[o.jsxs("button",{type:"button",className:"af-node-preview-run",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"play_arrow"}),"立即运行"]}),o.jsxs("button",{type:"button",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"article"}),"日志"]})]})]}):o.jsxs("div",{className:"af-node-preview-card af-node-preview-card--default",children:[o.jsxs("div",{className:"af-node-preview-card__head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:N}),o.jsx("strong",{children:g.title||y.name||"Untitled Node"}),o.jsx("code",{children:O1(g)})]}),o.jsxs("div",{className:"af-node-preview-default-body",children:[o.jsx("p",{children:y.description||"这个节点还没有描述。AI 生成 runtime、prompt 或 script 后,内部信息会显示在右侧。"}),o.jsxs("div",{children:[o.jsxs("span",{children:[Array.isArray(y.inputs)?y.inputs.length:0," inputs"]}),o.jsxs("span",{children:[Array.isArray(y.outputs)?y.outputs.length:0," outputs"]}),o.jsx("span",{children:((F=y.runtime)==null?void 0:F.type)||y.baseDefinitionId||"agent_subAgent"})]})]})]}):o.jsxs("div",{className:"af-node-preview-empty",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add_box"}),o.jsx("strong",{children:"暂无预览"}),o.jsx("p",{children:"先在左侧描述你要创建的节点,AI 生成 draft 后这里会展示节点卡片。"})]})}),o.jsxs("div",{className:"af-node-studio-test",children:[o.jsxs("div",{className:"af-node-studio-subhead",children:[o.jsx("strong",{children:"Test Inputs"}),o.jsxs("button",{type:"button",onClick:B,children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:s?"sync":"play_arrow"}),"Run"]})]}),o.jsxs("div",{className:"af-node-studio-inputs",children:[o.jsxs("label",{children:[o.jsx("span",{children:"project"}),o.jsx("input",{value:x.project||"",readOnly:!0,placeholder:"-"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"date"}),o.jsx("input",{value:x.date||"",readOnly:!0,placeholder:"-"})]})]}),o.jsx("div",{className:"af-node-studio-log",children:(s?["running..."]:C.length?C:["No test run yet."]).map((_,X)=>o.jsx("span",{children:_},`${_}-${X}`))})]})]})]}),o.jsxs("aside",{className:"af-node-studio-internals","aria-label":"Internals",children:[o.jsxs("div",{className:"af-node-studio-panel-head",children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"fact_check"}),o.jsx("strong",{children:"Internals"})]}),o.jsx("div",{className:"af-node-studio-tabs",role:"tablist","aria-label":"Internals sections",children:k.map(_=>o.jsxs("button",{type:"button",className:_.id===n?"af-node-studio-tab af-node-studio-tab--active":"af-node-studio-tab",onClick:()=>r(_.id),children:[o.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:_.icon}),_.label]},_.id))}),o.jsx("div",{className:"af-node-studio-internal-list",children:w.rows.map(([_,X])=>o.jsxs("div",{className:"af-node-studio-internal-row",children:[o.jsx("span",{children:_}),o.jsx("strong",{children:X})]},_))}),o.jsx("pre",{className:"af-node-studio-code",children:w.id==="ui"?JSON.stringify(y.ui||{},null,2):w.id==="contract"?JSON.stringify({inputs:y.inputs||[],outputs:y.outputs||[],configSchema:y.configSchema||{}},null,2):w.id==="tests"?JSON.stringify((g==null?void 0:g.test)||{},null,2):JSON.stringify({runtime:y.runtime||{},files:(g==null?void 0:g.files)||{}},null,2)})]})]})]})}function Wne(){return`ws_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,7)}`}function Vne(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function _p(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 Kne(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 yy(){return{id:"",label:"",kind:"git",path:"",repoUrl:"",branch:"master",mountPath:"",credentialRef:"",type:"code",description:"",enabled:!0}}function Zf(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 qne(e){const t=e.kind==="local"?"local":"git",n=t==="git"?String(e.repoUrl||"").trim():"",r=t==="git"?String(e.mountPath||_p(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 Pi(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 Une({ok:e}){return o.jsx("span",{className:"af-workspaces-dot"+(e?" af-workspaces-dot--ok":""),"aria-hidden":!0})}function D1({item:e,selected:t,onClick:n,readOnly:r}){return o.jsxs("button",{type:"button",className:"af-workspaces-card"+(t?" af-workspaces-card--selected":""),onClick:n,children:[o.jsxs("div",{className:"af-workspaces-card__head",children:[o.jsx("strong",{children:e.label||"知识库"}),o.jsx("span",{children:e.kind==="git"?"Git":"Local"})]}),o.jsx("p",{children:e.description||e.repoUrl||e.path||"-"}),o.jsxs("div",{className:"af-workspaces-card__meta",children:[o.jsx(Une,{ok:e.exists!==!1}),o.jsx("span",{children:e.exists===!1?"路径未就绪":"路径可用"}),r?o.jsx("em",{children:"内置"}):e.enabled===!1?o.jsx("em",{children:"disabled"}):null]})]})}function Yne(){const[e,t]=m.useState(!1),[n,r]=m.useState(!1),[s,i]=m.useState(!1),[a,l]=m.useState(""),[c,u]=m.useState(""),[p,d]=m.useState(""),[f,h]=m.useState([]),[g,k]=m.useState([]),[w,y]=m.useState(yy),[v,x]=m.useState(""),[C,N]=m.useState([]),[j,E]=m.useState(""),P=m.useMemo(()=>g.findIndex((V,T)=>Pi(V,T)===j),[g,j]),B=!!m.useMemo(()=>f.find((V,T)=>Pi(V,T)===j)||null,[f,j]),W=m.useMemo(()=>{const V=String(w.credentialRef||"").trim();return V?C.some(T=>String((T==null?void 0:T.key)||"").trim()===V&&String((T==null?void 0:T.value)??"")!==""):!1},[w.credentialRef,C]),z=m.useCallback(async()=>{t(!0),l("");try{const[V,T]=await Promise.all([fetch("/api/workspaces"),fetch("/api/user-env")]),ee=await V.json().catch(()=>({})),ie=await T.json().catch(()=>({}));if(!T.ok)throw new Error(typeof ie.error=="string"?ie.error:"ENV HTTP "+T.status);if(!V.ok)throw new Error(typeof ee.error=="string"?ee.error:"HTTP "+V.status);const G=Array.isArray(ee.workspaces)?ee.workspaces:[],se=Array.isArray(ee.customWorkspaces)?ee.customWorkspaces:[];d(String(ee.path||"")),h(G.filter(te=>te==null?void 0:te.builtin)),k(se),N(Array.isArray(ie.env)?ie.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(()=>{z()},[z]);const L=m.useCallback(async(V,T="")=>{r(!0),l(""),u("");try{const ee=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspaces:V})}),ie=await ee.json().catch(()=>({}));if(!ee.ok)throw new Error(typeof ie.error=="string"?ie.error:"HTTP "+ee.status);const G=Array.isArray(ie.customWorkspaces)?ie.customWorkspaces:V;k(G),h((Array.isArray(ie.workspaces)?ie.workspaces:[]).filter(se=>se==null?void 0:se.builtin)),d(String(ie.path||p)),T&&E(T),u("已保存")}catch(ee){l(String(ee.message||ee))}finally{r(!1)}},[p]),R=m.useCallback(()=>{E(""),y(yy()),x(""),u(""),l("")},[]),K=m.useCallback((V,T)=>{E(Pi(V,T)),y(Zf(V)),x(""),u("")},[]),D=m.useCallback((V,T)=>{E(Pi(V,T)),y(Zf(V)),x(""),u("")},[]),$=m.useCallback(async(V,T)=>{const ee=String(V||"").trim(),ie=String(T??"");if(!ee||!ie)return;const G=C.filter(re=>String((re==null?void 0:re.key)||"").trim()!==ee);G.push({key:ee,value:ie});const se=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:G})}),te=await se.json().catch(()=>({}));if(!se.ok)throw new Error(typeof te.error=="string"?te.error:"ENV HTTP "+se.status);N(Array.isArray(te.env)?te.env.map(re=>({key:String((re==null?void 0:re.key)||""),value:String((re==null?void 0:re.value)??"")})):G)},[C]),I=m.useCallback(()=>{const V=qne({...w,id:w.id||Wne()}),T=v.trim();if(V.kind==="git"&&T&&!V.credentialRef&&(V.credentialRef=Kne(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&&!Vne(V.credentialRef)){l("凭证环境变量只能使用字母、数字和下划线,且不能以数字开头");return}const ee=P>=0?g.map((ie,G)=>G===P?V:ie):[V,...g];y(Zf(V)),(async()=>{r(!0);try{T&&await $(V.credentialRef,T),x(""),await L(ee,Pi(V))}catch(ie){l(String(ie.message||ie)),r(!1)}})()},[g,w,L,$,P,v]),F=m.useCallback(()=>{if(P<0)return;const V=g.filter((T,ee)=>ee!==P);y(yy()),E(""),L(V)},[g,L,P]),_=m.useCallback(async()=>{if(!B){if(P<0||!w.id){l("请先保存知识库配置,再拉取更新");return}if(w.kind!=="git"){l("只有 Git 知识库支持拉取更新");return}i(!0),l(""),u("");try{const V=await fetch("/api/workspaces/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:w.id})}),T=await V.json().catch(()=>({}));if(!V.ok)throw new Error(typeof T.error=="string"?T.error:"HTTP "+V.status);const ee=Array.isArray(T.customWorkspaces)?T.customWorkspaces:g;k(ee),h((Array.isArray(T.workspaces)?T.workspaces:[]).filter(se=>se==null?void 0:se.builtin));const ie=ee.find(se=>String((se==null?void 0:se.id)||"")===String(w.id||""));ie&&y(Zf(ie));const G=String(T.commit||"").trim();u(T.changed?`已拉取更新${G?`:${G.slice(0,8)}`:""}`:`已是最新${G?`:${G.slice(0,8)}`:""}`)}catch(V){l(String(V.message||V))}finally{i(!1)}}},[g,w,B,P]),X=m.useCallback(V=>{y(T=>({...T,...V}))},[]);return o.jsxs("div",{className:"af-workspaces-page",children:[o.jsxs("header",{className:"af-settings-top",children:[o.jsxs("div",{className:"af-settings-crumb","aria-label":"知识库",children:[o.jsx("span",{className:"af-settings-crumb-muted",children:"AgentFlow"}),o.jsx("span",{className:"af-settings-crumb-sep","aria-hidden":!0,children:"/"}),o.jsx("span",{className:"af-settings-crumb-active",children:"知识库"})]}),o.jsxs("button",{type:"button",className:"af-schedules-refresh",onClick:z,disabled:e,children:[o.jsx("span",{className:"material-symbols-outlined",children:"refresh"}),"刷新"]})]}),o.jsx("main",{className:"af-settings-body",children:o.jsxs("div",{className:"af-workspaces-inner",children:[o.jsxs("header",{className:"af-settings-hero",children:[o.jsx("h1",{className:"af-settings-h1",children:"知识库"}),o.jsx("p",{className:"af-settings-lead",children:"维护可被加载知识库、一键任务和后续 Agent 使用的只读上下文源。Git 字段与 mengmai 的资源配置保持一致。"}),p?o.jsxs("p",{className:"af-workspaces-config",children:["配置文件:",p]}):null,a?o.jsx("p",{className:"af-err af-settings-api-hint",children:a}):null,c?o.jsx("p",{className:"af-workspaces-status",children:c}):null]}),o.jsxs("section",{className:"af-workspaces-summary",children:[o.jsxs("div",{children:[o.jsx("span",{children:"内置"}),o.jsx("strong",{children:f.length})]}),o.jsxs("div",{children:[o.jsx("span",{children:"自定义"}),o.jsx("strong",{children:g.length})]}),o.jsxs("div",{children:[o.jsx("span",{children:"Git"}),o.jsx("strong",{children:g.filter(V=>V.kind==="git").length})]})]}),o.jsxs("div",{className:"af-workspaces-layout",children:[o.jsxs("section",{className:"af-workspaces-list",children:[o.jsxs("div",{className:"af-workspaces-section-head",children:[o.jsx("h2",{children:"自定义知识库"}),o.jsxs("button",{type:"button",onClick:R,children:[o.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新增"]})]}),g.length?g.map((V,T)=>o.jsx(D1,{item:V,selected:Pi(V,T)===j,onClick:()=>K(V,T)},Pi(V,T))):o.jsx("div",{className:"af-workspaces-empty",children:"暂无自定义知识库。新增 Git 或本地目录后,画布里的加载知识库和一键任务就可以选择它。"}),o.jsx("div",{className:"af-workspaces-section-head af-workspaces-section-head--sub",children:o.jsx("h2",{children:"内置知识库"})}),f.map((V,T)=>o.jsx(D1,{item:V,selected:Pi(V,T)===j,onClick:()=>D(V,T),readOnly:!0},Pi(V,T)))]}),o.jsxs("section",{className:"af-workspaces-editor",children:[o.jsxs("div",{className:"af-workspaces-editor__head",children:[o.jsxs("div",{children:[o.jsx("h2",{children:B?"查看内置知识库":P>=0?"编辑知识库":"新增知识库"}),o.jsx("p",{children:B?"内置项由当前运行环境提供,不能在这里修改。":"本地路径用于读取上下文,Git 字段用于后续同步和上下文挂载。"})]}),o.jsxs("label",{className:"af-workspaces-switch",children:[o.jsx("input",{type:"checkbox",checked:w.enabled!==!1,disabled:B,onChange:V=>X({enabled:V.target.checked})}),o.jsx("span",{children:"启用"})]})]}),o.jsxs("div",{className:"af-workspaces-kind",children:[o.jsxs("button",{type:"button",className:w.kind==="git"?"active":"",disabled:B,onClick:()=>X({kind:"git",type:w.type==="local"?"code":w.type}),children:[o.jsx("span",{className:"material-symbols-outlined",children:"account_tree"}),"Git"]}),o.jsxs("button",{type:"button",className:w.kind==="local"?"active":"",disabled:B,onClick:()=>X({kind:"local",type:"local"}),children:[o.jsx("span",{className:"material-symbols-outlined",children:"folder_open"}),"本地目录"]})]}),o.jsxs("div",{className:"af-workspaces-form",children:[o.jsxs("label",{children:[o.jsx("span",{children:"名称"}),o.jsx("input",{value:w.label,disabled:B,onChange:V=>X({label:V.target.value}),placeholder:"Likee Android"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"类型"}),o.jsxs("select",{value:w.type,disabled:B,onChange:V=>X({type:V.target.value}),children:[o.jsx("option",{value:"code",children:"code"}),o.jsx("option",{value:"docs",children:"docs"}),o.jsx("option",{value:"analytics",children:"analytics"}),o.jsx("option",{value:"config",children:"config"}),o.jsx("option",{value:"local",children:"local"}),o.jsx("option",{value:"other",children:"other"})]})]}),o.jsxs("label",{className:"af-workspaces-form__wide",children:[o.jsx("span",{children:"本地路径"}),o.jsx("input",{value:w.path,disabled:B,onChange:V=>X({path:V.target.value}),placeholder:w.kind==="git"?"可空,默认保存到全局资源目录/repos/<仓库名>":"/Users/.../project"})]}),w.kind==="git"?o.jsxs(o.Fragment,{children:[o.jsxs("label",{className:"af-workspaces-form__wide",children:[o.jsx("span",{children:"Git URL"}),o.jsx("input",{value:w.repoUrl,disabled:B,onChange:V=>{const T=V.target.value,ee=_p(w.repoUrl),ie=String(w.mountPath||"").trim();X({repoUrl:T,...!ie||ie===ee?{mountPath:_p(T)}:{}})},placeholder:"https://git.example.com/group/repo.git"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"分支"}),o.jsx("input",{value:w.branch,disabled:B,onChange:V=>X({branch:V.target.value}),placeholder:"master"})]}),o.jsxs("label",{children:[o.jsx("span",{children:"挂载目录"}),o.jsx("input",{value:w.mountPath,disabled:B,onChange:V=>X({mountPath:V.target.value}),placeholder:_p(w.repoUrl)||"repo_name"})]}),o.jsxs("label",{className:"af-workspaces-form__wide",children:[o.jsx("span",{children:"凭证环境变量"}),o.jsx("input",{value:w.credentialRef,disabled:B,onChange:V=>X({credentialRef:V.target.value}),placeholder:"LIKEE_GIT_READONLY_TOKEN"})]}),o.jsxs("label",{className:"af-workspaces-form__wide",children:[o.jsx("span",{children:"Token"}),o.jsx("input",{type:"password",value:v,disabled:B,onChange:V=>x(V.target.value),placeholder:W?"已在个人环境变量中配置;留空则不修改":"保存到个人环境变量,不写入 workspace 配置"}),o.jsx("small",{children:"保存后只在知识库配置中保留 credentialRef,token 会写入当前用户的个人环境变量。"})]})]}):null,o.jsxs("label",{className:"af-workspaces-form__wide",children:[o.jsx("span",{children:"说明"}),o.jsx("textarea",{value:w.description,disabled:B,onChange:V=>X({description:V.target.value}),placeholder:"这个知识库包含哪些代码、文档或需求上下文"})]})]}),o.jsxs("div",{className:"af-workspaces-actions",children:[!B&&P>=0?o.jsxs("button",{type:"button",className:"af-workspaces-danger",onClick:F,disabled:n||s,children:[o.jsx("span",{className:"material-symbols-outlined",children:"delete"}),"删除"]}):o.jsx("span",{}),o.jsxs("div",{children:[w.kind==="git"&&P>=0?o.jsxs("button",{type:"button",onClick:_,disabled:B||n||s,children:[o.jsx("span",{className:"material-symbols-outlined",children:s?"sync":"download"}),s?"拉取中":"拉取更新"]}):null,o.jsx("button",{type:"button",onClick:R,disabled:n||s,children:"重置"}),o.jsxs("button",{type:"button",className:"af-workspaces-primary",onClick:I,disabled:B||n||s,children:[o.jsx("span",{className:"material-symbols-outlined",children:"save"}),n?"保存中":"保存"]})]})]})]})]})]})})]})}const Gne=[{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"}],Jne=[{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 长文档","客户端原型预览","图表与表格","统一展示链接"]}],Xne=[{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"}],Qne=[["知识库","查客户端、后台、前端逻辑","广告、Feed、会员、增长、配置、接口调用链"],["数据","查 CK / Hive 并输出 SQL","PV、UV、转化、分页面、分国家、分实验组"],["产物","生成原型、PRD、Display 面板","Markdown、HTML 原型、图表、表格、交互预览"],["协作","同步 TAPD 与 Git 仓库","需求正文、变更记录、MR 链接、评审材料"]];function ep({icon:e,title:t,label:n,tone:r="violet"}){return o.jsxs("div",{className:`likee-flow-node likee-flow-node-${r}`,children:[o.jsx("span",{className:"material-symbols-outlined",children:e}),o.jsxs("div",{children:[o.jsx("strong",{children:t}),o.jsx("small",{children:n})]})]})}function Zne(){return o.jsxs("div",{className:"likee-workspace-scene","aria-hidden":"true",children:[o.jsx("div",{className:"likee-scene-grid"}),o.jsxs("svg",{className:"likee-scene-lines",viewBox:"0 0 980 560",fill:"none",children:[o.jsx("path",{d:"M96 154 C236 96 330 122 444 194 C552 262 654 260 814 160"}),o.jsx("path",{d:"M118 350 C248 288 344 304 458 372 C578 444 704 420 858 310"}),o.jsx("path",{d:"M472 196 C512 248 524 302 486 372"}),o.jsx("path",{d:"M622 126 C670 198 696 258 682 354"})]}),o.jsx("div",{className:"likee-node-pos likee-node-a",children:o.jsx(ep,{icon:"travel_explore",title:"全局上下文",label:"Likee 业务、代码、数据",tone:"pink"})}),o.jsx("div",{className:"likee-node-pos likee-node-b",children:o.jsx(ep,{icon:"database",title:"CK / Hive",label:"自动 SQL 与指标口径",tone:"cyan"})}),o.jsx("div",{className:"likee-node-pos likee-node-c",children:o.jsx(ep,{icon:"article",title:"需求文档",label:"PRD、变更说明、评审稿",tone:"amber"})}),o.jsx("div",{className:"likee-node-pos likee-node-d",children:o.jsx(ep,{icon:"sync_alt",title:"TAPD / Git",label:"同步需求与版本资产",tone:"green"})}),o.jsxs("div",{className:"likee-phone-preview",children:[o.jsxs("div",{className:"likee-phone-top",children:[o.jsx("span",{children:"关注"}),o.jsx("strong",{children:"推荐"}),o.jsx("span",{children:"直播"})]}),o.jsxs("div",{className:"likee-phone-card",children:[o.jsx("div",{className:"likee-gift",children:"AD"}),o.jsx("h4",{children:"广告个性化引导弹框"}),o.jsx("p",{children:"保持推荐体验,同时解释权益与关闭路径。"}),o.jsx("button",{children:"继续"}),o.jsx("button",{className:"secondary",children:"稍后"})]})]}),o.jsxs("div",{className:"likee-display-panel",children:[o.jsxs("div",{className:"likee-panel-header",children:[o.jsx("span",{children:"DISPLAY"}),o.jsx("strong",{children:"需求资产面板"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"需求"}),o.jsx("strong",{children:"首页广告个性化引导"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"数据"}),o.jsx("strong",{children:"m09 PV Top 1"})]}),o.jsxs("div",{className:"likee-table-row",children:[o.jsx("span",{children:"同步"}),o.jsx("strong",{children:"TAPD + Git MR"})]})]})]})}function Ep({kicker:e,title:t,children:n}){return o.jsxs("div",{className:"likee-section-copy",children:[o.jsx("p",{className:"likee-section-kicker",children:e}),o.jsx("h2",{children:t}),o.jsx("p",{children:n})]})}function ere(){return o.jsx("section",{id:"likee-skills",className:"likee-section likee-section-dark",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-two-column-skills",children:[o.jsx(Ep,{kicker:"SKILLS",title:"用 Skills 把 Likee 上下文变成可复用能力",children:"Skills 是工作区里可加载的能力包。手动搭建工作区时,只需要按场景加载对应 Skill。"}),o.jsx("div",{className:"likee-skill-grid",children:Xne.map(e=>o.jsxs("article",{className:`likee-skill-card likee-skill-${e.tone}`,children:[o.jsxs("div",{className:"likee-skill-head",children:[o.jsx("div",{className:"likee-skill-icon",children:o.jsx("span",{className:"material-symbols-outlined",children:e.icon})}),o.jsxs("div",{children:[o.jsx("h3",{children:e.name}),o.jsx("span",{children:e.namespace})]})]}),o.jsx("div",{className:"likee-skill-mode",children:e.mode}),o.jsx("p",{children:e.usage}),o.jsx("div",{className:"likee-skill-examples",children:e.examples.map(t=>o.jsx("strong",{children:t},t))})]},e.name))})]})})}function $T(){return o.jsxs("div",{className:"likee-page",children:[o.jsx("div",{className:"likee-top-actions",children:o.jsxs("a",{href:"/projects",className:"likee-home-link",children:[o.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"}),"返回首页"]})}),o.jsxs("section",{className:"likee-hero",children:[o.jsx(Zne,{}),o.jsxs("div",{className:"likee-hero-content",children:[o.jsx("p",{className:"likee-eyebrow",children:"LIKEE CONTEXT WORKSPACE"}),o.jsx("h1",{children:"Likee Agent 工作台"}),o.jsx("p",{className:"likee-hero-subtitle",children:"提供 Likee 全局上下文,赋能需求挖掘、书写和运营。"}),o.jsxs("div",{className:"likee-signal-row",children:[o.jsx("span",{children:"查业务逻辑"}),o.jsx("span",{children:"查 CK / Hive"}),o.jsx("span",{children:"生成原型"}),o.jsx("span",{children:"生成 PRD"}),o.jsx("span",{children:"同步 TAPD / Git"})]}),o.jsxs("div",{className:"likee-hero-actions",children:[o.jsxs("a",{href:"/projects",className:"likee-primary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"rocket_launch"}),"立即使用"]}),o.jsxs("a",{href:"#likee-scenarios",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"ads_click"}),"按场景查看"]}),o.jsxs("a",{href:"#likee-usecases",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"view_timeline"}),"查看 Use Cases"]}),o.jsxs("a",{href:"#likee-skills",className:"likee-secondary-action",children:[o.jsx("span",{className:"material-symbols-outlined",children:"extension"}),"查看 Skills"]})]})]})]}),o.jsx("section",{id:"likee-scenarios",className:"likee-section",children:o.jsxs("div",{className:"likee-section-inner",children:[o.jsx(Ep,{kicker:"SCENARIO TRIGGERS",title:"打造 Likee 团队全景上下文",children:"不要求先会写 Prompt,也不要求知道该找哪个系统。选择一个业务场景,工作台会把需要的 Likee 上下文、数据查询和最终产物组织起来。"}),o.jsx("div",{className:"likee-scenario-grid",children:Gne.map(e=>o.jsxs("article",{className:`likee-scenario-card likee-scenario-${e.tone}`,children:[o.jsx("div",{className:"likee-scenario-icon",children:o.jsx("span",{className:"material-symbols-outlined",children:e.icon})}),o.jsxs("div",{children:[o.jsx("h3",{children:e.title}),o.jsx("p",{children:e.question})]}),o.jsx("div",{className:"likee-scenario-context",children:e.context.map(t=>o.jsx("span",{children:t},t))}),o.jsxs("div",{className:"likee-scenario-result",children:[o.jsx("span",{children:"产出"}),o.jsx("strong",{children:e.result})]})]},e.title))})]})}),o.jsx("section",{id:"likee-usecases",className:"likee-section likee-section-muted",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-usecase-layout",children:[o.jsx(Ep,{kicker:"USE CASES",title:"沉淀 Likee 业务流水线",children:"这里展示的是平台里实际可跑的工作流:加载流程片段,在子 Agent 或 Run 节点输入业务问题,执行当前 line,最终在 Display、TAPD 和 Git 中拿到结果。"}),o.jsx("div",{className:"likee-usecase-stack",children:Jne.map(e=>o.jsxs("article",{className:"likee-usecase-card",children:[o.jsx("div",{className:`likee-usecase-media ${e.images.length>1?"likee-usecase-media-split":""}`,children:e.images.map((t,n)=>o.jsx("img",{src:t,alt:`${e.title} 工作区截图 ${n+1}`,loading:"lazy"},t))}),o.jsxs("div",{className:"likee-usecase-body",children:[o.jsx("div",{className:"likee-usecase-label",children:e.label}),o.jsx("h3",{children:e.title}),o.jsx("p",{children:e.trigger}),o.jsx("ol",{className:"likee-usecase-steps",children:e.steps.map(t=>o.jsx("li",{children:t},t))}),o.jsxs("div",{className:"likee-usecase-output",children:[o.jsx("span",{children:"实际产物"}),o.jsx("div",{children:e.outputs.map(t=>o.jsx("strong",{children:t},t))})]})]})]},e.label))})]})}),o.jsx(ere,{}),o.jsx("section",{className:"likee-section",children:o.jsxs("div",{className:"likee-section-inner likee-two-column likee-capability-layout",children:[o.jsx(Ep,{kicker:"CAPABILITY MAP",title:"每个场景背后,都连接同一套 Likee 上下文能力",children:"工作台把知识库、CK / Hive、原型、PRD、TAPD 和 Git 放到同一条链路里。用户看到的是业务场景,系统处理的是上下文、产物和同步。"}),o.jsx("div",{className:"likee-capability-table",children:Qne.map(([e,t,n])=>o.jsxs("div",{className:"likee-capability-row",children:[o.jsx("span",{children:e}),o.jsx("strong",{children:t}),o.jsx("p",{children:n})]},e))})]})})]})}function LT(e){return t=>typeof t===e}var tre=LT("function"),nre=e=>e===null,F1=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",z1=e=>!rre(e)&&!nre(e)&&(tre(e)||typeof e=="object"),rre=LT("undefined");function sre(e,t,n){return dre(n,e,t)?!0:(fre(n,e,t),e.constructor!==t.constructor?!1:Array.isArray(e)&&Array.isArray(t)?ire(e,t,n):e instanceof Map&&t instanceof Map?lre(e,t,n):e instanceof Set&&t instanceof Set?ure(e,t):e instanceof WeakMap||e instanceof WeakSet?!1:ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)?ore(e,t):F1(e)&&F1(t)?e.source===t.source&&e.flags===t.flags:e instanceof Error&&t instanceof Error?are(e,t,n):e.valueOf!==Object.prototype.valueOf?e.valueOf()===t.valueOf():e.toString!==Object.prototype.toString?e.toString()===t.toString():cre(e,t,n))}function Ad(e,t,n){return e===t||Number.isNaN(e)&&Number.isNaN(t)?!0:!e||!z1(e)||!t||!z1(t)?!1:sre(e,t,n)}function ire(e,t,n){const{length:r}=e;if(r!==t.length)return!1;for(let s=r;s--!==0;)if(!Ad(e[s],t[s],n))return!1;return!0}function ore(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 are(e,t,n){return e.message===t.message&&e.name===t.name&&Ad(e.cause,t.cause,n)}function lre(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(!Ad(r[1],t.get(r[0]),n))return!1;return!0}function cre(e,t,n){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let s=r.length;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,r[s]))return!1;for(let s=r.length;s--!==0;){const i=r[s];if(!(i==="_owner"&&e.$$typeof)&&!Ad(e[i],t[i],n))return!1}return!0}function ure(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 dre(e,t,n){var r;return((r=e.get(t))==null?void 0:r.has(n))??!1}function fre(e,t,n){let r=e.get(t);r||(r=new WeakSet,e.set(t,r)),r.add(n)}function hk(e,t){return Ad(e,t,new WeakMap)}function xy(){var e;return!!(typeof window<"u"&&((e=window==null?void 0:window.document)!=null&&e.createElement))}function pre(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}function hre(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function mre(){const e=m.useRef(!0);return e.current?(e.current=!1,!0):e.current}function gre(e,t){const n=mre();m.useEffect(()=>{if(!n)return e()},t)}function OT(e){const t=m.useRef(void 0);return m.useEffect(()=>{t.current=e}),t.current}function yre(e,t){const n=m.useRef(t);return hk(t,n.current)||(n.current=t),m.useMemo(e,n.current)}function xre(e){m.useEffect(()=>{e()},[])}function wre(e=0){const[t,n]=m.useState({height:xy()?window.innerHeight:0,width:xy()?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(!xy())return()=>{};const i=s.current;return n({height:window.innerHeight,width:window.innerWidth}),hre(window,"resize",i),()=>{pre(window,"resize",i)}},[]),t}var bre=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","URL","WeakMap","WeakSet"],kre=["bigint","boolean","null","number","string","symbol","undefined"];function Pd(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(vre(t))return t}function Ys(e){return t=>Pd(t)===e}function vre(e){return bre.includes(e)}function pc(e){return t=>typeof t===e}function Sre(e){return kre.includes(e)}var Nre=["innerHTML","ownerDocument","style","attributes","nodeValue"],Id=e=>Array.isArray(e),jre=e=>Pd(e)==="AsyncGeneratorFunction",Cre=Ys("AsyncFunction"),_re=pc("bigint"),Ere=e=>e===!0||e===!1,Are=Ys("Date"),Pre=Ys("Error"),Do=pc("function"),Ire=Ys("GeneratorFunction"),Tre=e=>typeof e=="number"&&Number.isInteger(e),gw=Ys("Map"),DT=e=>Number.isNaN(e),mk=e=>e===null,FT=Ys("Function"),Rre=Ys("Promise"),Mre=Ys("RegExp"),yw=Ys("Set"),Td=pc("string"),$re=pc("symbol"),gk=pc("undefined"),Lre=Ys("WeakMap"),Ore=Ys("WeakSet"),yk=e=>mk(e)||gk(e),zT=e=>!gk(e),Dre=e=>pc("number")(e)&&!DT(e),Fre=e=>Td(e)&&e.trim().length>0,zre=e=>{if(!Td(e)||e.length===0)return!1;const t=e.trim();return t.length>0&&Number.isFinite(Number(t))},km=e=>!yk(e)&&(Do(e)||typeof e=="object"),BT=e=>{if(Pd(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})},Bre=e=>mk(e)||Sre(typeof e),Hre=e=>Pd(e)==="URL",HT=e=>!yk(e)&&Do(e[Symbol.iterator]),Wre=e=>HT(e)&&Do(e.next)&&Do(e.throw),Vre=e=>Do(e)&&/^class\s/.test(e.toString()),Kre=(e,t)=>!Id(e)||!Do(t)?!1:e.every(n=>t(n)),qre=e=>km(e)&&!BT(e)&&e.nodeType===1&&Td(e.nodeName)&&Nre.every(t=>t in e),Ure=e=>Td(e)&&e.length===0||Id(e)&&e.length===0||km(e)&&!gw(e)&&!yw(e)&&Object.keys(e).length===0||yw(e)&&e.size===0||gw(e)&&e.size===0,Yre=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype,Gre=(e,t)=>Id(e)?e.indexOf(t)>-1:!1,Jre=(e,t,n)=>{if(!km(e)||!t)return!1;const r=e[t];return Do(n)?n(r):zT(r)};function vt(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(Id(e))return"Array";if(FT(e))return"Function";const t=Pd(e);return t||"Object"}vt.array=Id;vt.arrayOf=Kre;vt.asyncGeneratorFunction=jre;vt.asyncFunction=Cre;vt.bigint=_re;vt.boolean=Ere;vt.class=Vre;vt.date=Are;vt.defined=zT;vt.domElement=qre;vt.empty=Ure;vt.error=Pre;vt.function=Do;vt.generator=Wre;vt.generatorFunction=Ire;vt.instanceOf=Yre;vt.integer=Tre;vt.iterable=HT;vt.map=gw;vt.nan=DT;vt.null=mk;vt.nullOrUndefined=yk;vt.nonEmptyString=Fre;vt.number=Dre;vt.numericString=zre;vt.object=km;vt.oneOf=Gre;vt.plainFunction=FT;vt.plainObject=BT;vt.primitive=Bre;vt.promise=Rre;vt.propertyOf=Jre;vt.regexp=Mre;vt.set=yw;vt.string=Td;vt.symbol=$re;vt.undefined=gk;vt.url=Hre;vt.weakMap=Lre;vt.weakSet=Ore;var gr=vt;/* v8 ignore next -- @preserve */var Xre=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},Qre=function(e,t){return e+dd(t)},dd=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(Qre,""):Xre(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?dd(e.props.children):""};dd.default=dd;var Zre=dd;const wy=zo(Zre);var WT={exports:{}};(function(e){const t=Object.getPrototypeOf({});function n(){return function(i){return typeof i=="object"&&i!==null&&!(i instanceof RegExp)&&!(i instanceof Date)}}function r(s){function i(N){return N!=="constructor"&&N!=="prototype"&&N!=="__proto__"}function a(N){let j=0;const E=N.length,P=new Array(E);for(j;j<E;++j)P[j]=y(N[j]);return P}function l(N){const j={};if(f&&Object.getPrototypeOf(N)!==t)return f(N);const E=d(N);let P,O,B;for(P=0,O=E.length;P<O;++P)i(B=E[P])&&(j[B]=y(N[B]));return j}function c(N,j){const E=N.length,P=j.length;let O=0;const B=new Array(E+P);for(O;O<E;++O)B[O]=y(N[O]);for(O=0;O<P;++O)B[O+E]=y(j[O]);return B}const u=Object.prototype.propertyIsEnumerable;function p(N){const j=Object.keys(N),E=Object.getOwnPropertySymbols(N);for(let P=0,O=E.length;P<O;++P)u.call(N,E[P])&&j.push(E[P]);return j}const d=s!=null&&s.symbols?p:Object.keys,f=typeof(s==null?void 0:s.cloneProtoObject)=="function"?s.cloneProtoObject:void 0,h=typeof(s==null?void 0:s.isMergeableObject)=="function"?s.isMergeableObject:n(),g=(s==null?void 0:s.onlyDefinedProperties)===!0;function k(N){return typeof N!="object"||N===null}const w=s&&typeof s.mergeArray=="function"?s.mergeArray({clone:y,deepmerge:x,getKeys:d,isMergeableObject:h}):c;function y(N){return h(N)?Array.isArray(N)?a(N):l(N):N}function v(N,j){const E={},P=d(N),O=d(j);let B,W,z;for(B=0,W=P.length;B<W;++B)i(z=P[B])&&O.indexOf(z)===-1&&(E[z]=y(N[z]));for(B=0,W=O.length;B<W;++B)if(i(z=O[B]))if(z in N)P.indexOf(z)!==-1&&(f&&h(j[z])&&Object.getPrototypeOf(j[z])!==t?E[z]=f(j[z]):E[z]=x(N[z],j[z]));else{if(g&&typeof j[z]>"u")continue;E[z]=y(j[z])}return E}function x(N,j){if(g&&typeof j>"u")return y(N);const E=Array.isArray(j),P=Array.isArray(N);return k(j)?j:h(N)?E&&P?w(N,j):E!==P?y(j):v(N,j):y(j)}function C(){switch(arguments.length){case 0:return{};case 1:return y(arguments[0]);case 2:return x(arguments[0],arguments[1])}let N;for(let j=0,E=arguments.length;j<E;++j)N=x(N,arguments[j]);return N}return s!=null&&s.all?C:x}e.exports=r,e.exports.default=r,e.exports.deepmerge=r,Object.defineProperty(e.exports,"isMergeableObject",{get:n})})(WT);var ese=WT.exports;const tse=zo(ese);var nse=new Error("Element already at target scroll position"),rse=new Error("Scroll cancelled"),sse=Math.min,B1=Date.now,ise={left:H1("scrollLeft"),top:H1("scrollTop")};function H1(e){return function(n,r,s,i){s=s||{},typeof s=="function"&&(i=s,s={}),typeof i!="function"&&(i=ase);var a=B1(),l=n[e],c=s.ease||ose,u=isNaN(s.duration)?350:+s.duration,p=!1;return l===r?i(nse,n[e]):requestAnimationFrame(f),d;function d(){p=!0}function f(h){if(p)return i(rse,n[e]);var g=B1(),k=sse(1,(g-a)/u),w=c(k);n[e]=w*(r-l)+l,k<1?requestAnimationFrame(f):requestAnimationFrame(function(){i(null,n[e])})}}}function ose(e){return .5*(1-Math.cos(Math.PI*e))}function ase(){}const lse=zo(ise);var VT={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(Eu,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})})(VT);var cse=VT.exports;const KT=zo(cse),use=["top","right","bottom","left"],W1=["start","end"],V1=use.reduce((e,t)=>e.concat(t,t+"-"+W1[0],t+"-"+W1[1]),[]),sc=Math.min,ka=Math.max,Ph=Math.round,tp=Math.floor,hi=e=>({x:e,y:e}),dse={left:"right",right:"left",bottom:"top",top:"bottom"};function xw(e,t,n){return ka(e,sc(t,n))}function hc(e,t){return typeof e=="function"?e(t):e}function Yi(e){return e.split("-")[0]}function mi(e){return e.split("-")[1]}function qT(e){return e==="x"?"y":"x"}function xk(e){return e==="y"?"height":"width"}function vo(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function wk(e){return qT(vo(e))}function UT(e,t,n){n===void 0&&(n=!1);const r=mi(e),s=wk(e),i=xk(s);let a=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(a=Th(a)),[a,Th(a)]}function fse(e){const t=Th(e);return[Ih(e),t,Ih(t)]}function Ih(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const K1=["left","right"],q1=["right","left"],pse=["top","bottom"],hse=["bottom","top"];function mse(e,t,n){switch(e){case"top":case"bottom":return n?t?q1:K1:t?K1:q1;case"left":case"right":return t?pse:hse;default:return[]}}function gse(e,t,n,r){const s=mi(e);let i=mse(Yi(e),n==="start",r);return s&&(i=i.map(a=>a+"-"+s),t&&(i=i.concat(i.map(Ih)))),i}function Th(e){const t=Yi(e);return dse[t]+e.slice(t.length)}function yse(e){return{top:0,right:0,bottom:0,left:0,...e}}function YT(e){return typeof e!="number"?yse(e):{top:e,right:e,bottom:e,left:e}}function Rh(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 U1(e,t,n){let{reference:r,floating:s}=e;const i=vo(t),a=wk(t),l=xk(a),c=Yi(t),u=i==="y",p=r.x+r.width/2-s.width/2,d=r.y+r.height/2-s.height/2,f=r[l]/2-s[l]/2;let h;switch(c){case"top":h={x:p,y:r.y-s.height};break;case"bottom":h={x:p,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-s.width,y:d};break;default:h={x:r.x,y:r.y}}switch(mi(t)){case"start":h[a]-=f*(n&&u?-1:1);break;case"end":h[a]+=f*(n&&u?-1:1);break}return h}async function xse(e,t){var n;t===void 0&&(t={});const{x:r,y:s,platform:i,rects:a,elements:l,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:p="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=hc(t,e),g=YT(h),w=l[f?d==="floating"?"reference":"floating":d],y=Rh(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(w)))==null||n?w:w.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:p,strategy:c})),v=d==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,x=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),C=await(i.isElement==null?void 0:i.isElement(x))?await(i.getScale==null?void 0:i.getScale(x))||{x:1,y:1}:{x:1,y:1},N=Rh(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:x,strategy:c}):v);return{top:(y.top-N.top+g.top)/C.y,bottom:(N.bottom-y.bottom+g.bottom)/C.y,left:(y.left-N.left+g.left)/C.x,right:(N.right-y.right+g.right)/C.x}}const wse=50,bse=async(e,t,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:a}=n,l=a.detectOverflow?a:{...a,detectOverflow:xse},c=await(a.isRTL==null?void 0:a.isRTL(t));let u=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:p,y:d}=U1(u,r,c),f=r,h=0;const g={};for(let k=0;k<i.length;k++){const w=i[k];if(!w)continue;const{name:y,fn:v}=w,{x,y:C,data:N,reset:j}=await v({x:p,y:d,initialPlacement:r,placement:f,strategy:s,middlewareData:g,rects:u,platform:l,elements:{reference:e,floating:t}});p=x??p,d=C??d,g[y]={...g[y],...N},j&&h<wse&&(h++,typeof j=="object"&&(j.placement&&(f=j.placement),j.rects&&(u=j.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):j.rects),{x:p,y:d}=U1(u,f,c)),k=-1)}return{x:p,y:d,placement:f,strategy:s,middlewareData:g}},kse=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:s,rects:i,platform:a,elements:l,middlewareData:c}=t,{element:u,padding:p=0}=hc(e,t)||{};if(u==null)return{};const d=YT(p),f={x:n,y:r},h=wk(s),g=xk(h),k=await a.getDimensions(u),w=h==="y",y=w?"top":"left",v=w?"bottom":"right",x=w?"clientHeight":"clientWidth",C=i.reference[g]+i.reference[h]-f[h]-i.floating[g],N=f[h]-i.reference[h],j=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u));let E=j?j[x]:0;(!E||!await(a.isElement==null?void 0:a.isElement(j)))&&(E=l.floating[x]||i.floating[g]);const P=C/2-N/2,O=E/2-k[g]/2-1,B=sc(d[y],O),W=sc(d[v],O),z=B,L=E-k[g]-W,R=E/2-k[g]/2+P,K=xw(z,R,L),D=!c.arrow&&mi(s)!=null&&R!==K&&i.reference[g]/2-(R<z?B:W)-k[g]/2<0,$=D?R<z?R-z:R-L:0;return{[h]:f[h]+$,data:{[h]:K,centerOffset:R-K-$,...D&&{alignmentOffset:$}},reset:D}}});function vse(e,t,n){return(e?[...n.filter(s=>mi(s)===e),...n.filter(s=>mi(s)!==e)]:n.filter(s=>Yi(s)===s)).filter(s=>e?mi(s)===e||(t?Ih(s)!==s:!1):!0)}const Sse=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,s;const{rects:i,middlewareData:a,placement:l,platform:c,elements:u}=t,{crossAxis:p=!1,alignment:d,allowedPlacements:f=V1,autoAlignment:h=!0,...g}=hc(e,t),k=d!==void 0||f===V1?vse(d||null,h,f):f,w=await c.detectOverflow(t,g),y=((n=a.autoPlacement)==null?void 0:n.index)||0,v=k[y];if(v==null)return{};const x=UT(v,i,await(c.isRTL==null?void 0:c.isRTL(u.floating)));if(l!==v)return{reset:{placement:k[0]}};const C=[w[Yi(v)],w[x[0]],w[x[1]]],N=[...((r=a.autoPlacement)==null?void 0:r.overflows)||[],{placement:v,overflows:C}],j=k[y+1];if(j)return{data:{index:y+1,overflows:N},reset:{placement:j}};const E=N.map(B=>{const W=mi(B.placement);return[B.placement,W&&p?B.overflows.slice(0,2).reduce((z,L)=>z+L,0):B.overflows[0],B.overflows]}).sort((B,W)=>B[1]-W[1]),O=((s=E.filter(B=>B[2].slice(0,mi(B[0])?2:3).every(W=>W<=0))[0])==null?void 0:s[0])||E[0][0];return O!==l?{data:{index:y+1,overflows:N},reset:{placement:O}}:{}}}},Nse=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:s,middlewareData:i,rects:a,initialPlacement:l,platform:c,elements:u}=t,{mainAxis:p=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:k=!0,...w}=hc(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=Yi(s),v=vo(l),x=Yi(l)===l,C=await(c.isRTL==null?void 0:c.isRTL(u.floating)),N=f||(x||!k?[Th(l)]:fse(l)),j=g!=="none";!f&&j&&N.push(...gse(l,k,g,C));const E=[l,...N],P=await c.detectOverflow(t,w),O=[];let B=((r=i.flip)==null?void 0:r.overflows)||[];if(p&&O.push(P[y]),d){const R=UT(s,a,C);O.push(P[R[0]],P[R[1]])}if(B=[...B,{placement:s,overflows:O}],!O.every(R=>R<=0)){var W,z;const R=(((W=i.flip)==null?void 0:W.index)||0)+1,K=E[R];if(K&&(!(d==="alignment"?v!==vo(K):!1)||B.every(I=>vo(I.placement)===v?I.overflows[0]>0:!0)))return{data:{index:R,overflows:B},reset:{placement:K}};let D=(z=B.filter($=>$.overflows[0]<=0).sort(($,I)=>$.overflows[1]-I.overflows[1])[0])==null?void 0:z.placement;if(!D)switch(h){case"bestFit":{var L;const $=(L=B.filter(I=>{if(j){const F=vo(I.placement);return F===v||F==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(F=>F>0).reduce((F,_)=>F+_,0)]).sort((I,F)=>I[1]-F[1])[0])==null?void 0:L[0];$&&(D=$);break}case"initialPlacement":D=l;break}if(s!==D)return{reset:{placement:D}}}return{}}}},jse=new Set(["left","top"]);async function Cse(e,t){const{placement:n,platform:r,elements:s}=e,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=Yi(n),l=mi(n),c=vo(n)==="y",u=jse.has(a)?-1:1,p=i&&c?-1:1,d=hc(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return l&&typeof g=="number"&&(h=l==="end"?g*-1:g),c?{x:h*p,y:f*u}:{x:f*u,y:h*p}}const _se=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:s,y:i,placement:a,middlewareData:l}=t,c=await Cse(t,e);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:a}}}}},Ese=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:s,platform:i}=t,{mainAxis:a=!0,crossAxis:l=!1,limiter:c={fn:y=>{let{x:v,y:x}=y;return{x:v,y:x}}},...u}=hc(e,t),p={x:n,y:r},d=await i.detectOverflow(t,u),f=vo(Yi(s)),h=qT(f);let g=p[h],k=p[f];if(a){const y=h==="y"?"top":"left",v=h==="y"?"bottom":"right",x=g+d[y],C=g-d[v];g=xw(x,g,C)}if(l){const y=f==="y"?"top":"left",v=f==="y"?"bottom":"right",x=k+d[y],C=k-d[v];k=xw(x,k,C)}const w=c.fn({...t,[h]:g,[f]:k});return{...w,data:{x:w.x-n,y:w.y-r,enabled:{[h]:a,[f]:l}}}}}};function vm(){return typeof window<"u"}function mc(e){return GT(e)?(e.nodeName||"").toLowerCase():"#document"}function rs(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function bi(e){var t;return(t=(GT(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function GT(e){return vm()?e instanceof Node||e instanceof rs(e).Node:!1}function Ks(e){return vm()?e instanceof Element||e instanceof rs(e).Element:!1}function Qi(e){return vm()?e instanceof HTMLElement||e instanceof rs(e).HTMLElement:!1}function Y1(e){return!vm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof rs(e).ShadowRoot}function Rd(e){const{overflow:t,overflowX:n,overflowY:r,display:s}=qs(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&s!=="inline"&&s!=="contents"}function Ase(e){return/^(table|td|th)$/.test(mc(e))}function Sm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Pse=/transform|translate|scale|rotate|perspective|filter/,Ise=/paint|layout|strict|content/,na=e=>!!e&&e!=="none";let by;function bk(e){const t=Ks(e)?qs(e):e;return na(t.transform)||na(t.translate)||na(t.scale)||na(t.rotate)||na(t.perspective)||!kk()&&(na(t.backdropFilter)||na(t.filter))||Pse.test(t.willChange||"")||Ise.test(t.contain||"")}function Tse(e){let t=Fo(e);for(;Qi(t)&&!ic(t);){if(bk(t))return t;if(Sm(t))return null;t=Fo(t)}return null}function kk(){return by==null&&(by=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),by}function ic(e){return/^(html|body|#document)$/.test(mc(e))}function qs(e){return rs(e).getComputedStyle(e)}function Nm(e){return Ks(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Fo(e){if(mc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Y1(e)&&e.host||bi(e);return Y1(t)?t.host:t}function JT(e){const t=Fo(e);return ic(t)?e.ownerDocument?e.ownerDocument.body:e.body:Qi(t)&&Rd(t)?t:JT(t)}function fd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const s=JT(e),i=s===((r=e.ownerDocument)==null?void 0:r.body),a=rs(s);if(i){const l=ww(a);return t.concat(a,a.visualViewport||[],Rd(s)?s:[],l&&n?fd(l):[])}else return t.concat(s,fd(s,[],n))}function ww(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function XT(e){const t=qs(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const s=Qi(e),i=s?e.offsetWidth:n,a=s?e.offsetHeight:r,l=Ph(n)!==i||Ph(r)!==a;return l&&(n=i,r=a),{width:n,height:r,$:l}}function vk(e){return Ks(e)?e:e.contextElement}function Hl(e){const t=vk(e);if(!Qi(t))return hi(1);const n=t.getBoundingClientRect(),{width:r,height:s,$:i}=XT(t);let a=(i?Ph(n.width):n.width)/r,l=(i?Ph(n.height):n.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const Rse=hi(0);function QT(e){const t=rs(e);return!kk()||!t.visualViewport?Rse:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Mse(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==rs(e)?!1:t}function Da(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const s=e.getBoundingClientRect(),i=vk(e);let a=hi(1);t&&(r?Ks(r)&&(a=Hl(r)):a=Hl(e));const l=Mse(i,n,r)?QT(i):hi(0);let c=(s.left+l.x)/a.x,u=(s.top+l.y)/a.y,p=s.width/a.x,d=s.height/a.y;if(i){const f=rs(i),h=r&&Ks(r)?rs(r):r;let g=f,k=ww(g);for(;k&&r&&h!==g;){const w=Hl(k),y=k.getBoundingClientRect(),v=qs(k),x=y.left+(k.clientLeft+parseFloat(v.paddingLeft))*w.x,C=y.top+(k.clientTop+parseFloat(v.paddingTop))*w.y;c*=w.x,u*=w.y,p*=w.x,d*=w.y,c+=x,u+=C,g=rs(k),k=ww(g)}}return Rh({width:p,height:d,x:c,y:u})}function jm(e,t){const n=Nm(e).scrollLeft;return t?t.left+n:Da(bi(e)).left+n}function ZT(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-jm(e,n),s=n.top+t.scrollTop;return{x:r,y:s}}function $se(e){let{elements:t,rect:n,offsetParent:r,strategy:s}=e;const i=s==="fixed",a=bi(r),l=t?Sm(t.floating):!1;if(r===a||l&&i)return n;let c={scrollLeft:0,scrollTop:0},u=hi(1);const p=hi(0),d=Qi(r);if((d||!d&&!i)&&((mc(r)!=="body"||Rd(a))&&(c=Nm(r)),d)){const h=Da(r);u=Hl(r),p.x=h.x+r.clientLeft,p.y=h.y+r.clientTop}const f=a&&!d&&!i?ZT(a,c):hi(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+p.x+f.x,y:n.y*u.y-c.scrollTop*u.y+p.y+f.y}}function Lse(e){return Array.from(e.getClientRects())}function Ose(e){const t=bi(e),n=Nm(e),r=e.ownerDocument.body,s=ka(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=ka(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+jm(e);const l=-n.scrollTop;return qs(r).direction==="rtl"&&(a+=ka(t.clientWidth,r.clientWidth)-s),{width:s,height:i,x:a,y:l}}const G1=25;function Dse(e,t){const n=rs(e),r=bi(e),s=n.visualViewport;let i=r.clientWidth,a=r.clientHeight,l=0,c=0;if(s){i=s.width,a=s.height;const p=kk();(!p||p&&t==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const u=jm(r);if(u<=0){const p=r.ownerDocument,d=p.body,f=getComputedStyle(d),h=p.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,g=Math.abs(r.clientWidth-d.clientWidth-h);g<=G1&&(i-=g)}else u<=G1&&(i+=u);return{width:i,height:a,x:l,y:c}}function Fse(e,t){const n=Da(e,!0,t==="fixed"),r=n.top+e.clientTop,s=n.left+e.clientLeft,i=Qi(e)?Hl(e):hi(1),a=e.clientWidth*i.x,l=e.clientHeight*i.y,c=s*i.x,u=r*i.y;return{width:a,height:l,x:c,y:u}}function J1(e,t,n){let r;if(t==="viewport")r=Dse(e,n);else if(t==="document")r=Ose(bi(e));else if(Ks(t))r=Fse(t,n);else{const s=QT(e);r={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return Rh(r)}function eR(e,t){const n=Fo(e);return n===t||!Ks(n)||ic(n)?!1:qs(n).position==="fixed"||eR(n,t)}function zse(e,t){const n=t.get(e);if(n)return n;let r=fd(e,[],!1).filter(l=>Ks(l)&&mc(l)!=="body"),s=null;const i=qs(e).position==="fixed";let a=i?Fo(e):e;for(;Ks(a)&&!ic(a);){const l=qs(a),c=bk(a);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||Rd(a)&&!c&&eR(e,a))?r=r.filter(p=>p!==a):s=l,a=Fo(a)}return t.set(e,r),r}function Bse(e){let{element:t,boundary:n,rootBoundary:r,strategy:s}=e;const a=[...n==="clippingAncestors"?Sm(t)?[]:zse(t,this._c):[].concat(n),r],l=J1(t,a[0],s);let c=l.top,u=l.right,p=l.bottom,d=l.left;for(let f=1;f<a.length;f++){const h=J1(t,a[f],s);c=ka(h.top,c),u=sc(h.right,u),p=sc(h.bottom,p),d=ka(h.left,d)}return{width:u-d,height:p-c,x:d,y:c}}function Hse(e){const{width:t,height:n}=XT(e);return{width:t,height:n}}function Wse(e,t,n){const r=Qi(t),s=bi(t),i=n==="fixed",a=Da(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=hi(0);function u(){c.x=jm(s)}if(r||!r&&!i)if((mc(t)!=="body"||Rd(s))&&(l=Nm(t)),r){const h=Da(t,!0,i,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else s&&u();i&&!r&&s&&u();const p=s&&!r&&!i?ZT(s,l):hi(0),d=a.left+l.scrollLeft-c.x-p.x,f=a.top+l.scrollTop-c.y-p.y;return{x:d,y:f,width:a.width,height:a.height}}function ky(e){return qs(e).position==="static"}function X1(e,t){if(!Qi(e)||qs(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return bi(e)===n&&(n=n.ownerDocument.body),n}function tR(e,t){const n=rs(e);if(Sm(e))return n;if(!Qi(e)){let s=Fo(e);for(;s&&!ic(s);){if(Ks(s)&&!ky(s))return s;s=Fo(s)}return n}let r=X1(e,t);for(;r&&Ase(r)&&ky(r);)r=X1(r,t);return r&&ic(r)&&ky(r)&&!bk(r)?n:r||Tse(e)||n}const Vse=async function(e){const t=this.getOffsetParent||tR,n=this.getDimensions,r=await n(e.floating);return{reference:Wse(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Kse(e){return qs(e).direction==="rtl"}const qse={convertOffsetParentRelativeRectToViewportRelativeRect:$se,getDocumentElement:bi,getClippingRect:Bse,getOffsetParent:tR,getElementRects:Vse,getClientRects:Lse,getDimensions:Hse,getScale:Hl,isElement:Ks,isRTL:Kse};function nR(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Use(e,t){let n=null,r;const s=bi(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const u=e.getBoundingClientRect(),{left:p,top:d,width:f,height:h}=u;if(l||t(),!f||!h)return;const g=tp(d),k=tp(s.clientWidth-(p+f)),w=tp(s.clientHeight-(d+h)),y=tp(p),x={rootMargin:-g+"px "+-k+"px "+-w+"px "+-y+"px",threshold:ka(0,sc(1,c))||1};let C=!0;function N(j){const E=j[0].intersectionRatio;if(E!==c){if(!C)return a();E?a(!1,E):r=setTimeout(()=>{a(!1,1e-7)},1e3)}E===1&&!nR(u,e.getBoundingClientRect())&&a(),C=!1}try{n=new IntersectionObserver(N,{...x,root:s.ownerDocument})}catch{n=new IntersectionObserver(N,x)}n.observe(e)}return a(!0),i}function Q1(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=vk(e),p=s||i?[...u?fd(u):[],...t?fd(t):[]]:[];p.forEach(y=>{s&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const d=u&&l?Use(u,n):null;let f=-1,h=null;a&&(h=new ResizeObserver(y=>{let[v]=y;v&&v.target===u&&h&&t&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var x;(x=h)==null||x.observe(t)})),n()}),u&&!c&&h.observe(u),t&&h.observe(t));let g,k=c?Da(e):null;c&&w();function w(){const y=Da(e);k&&!nR(k,y)&&n(),k=y,g=requestAnimationFrame(w)}return n(),()=>{var y;p.forEach(v=>{s&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),d==null||d(),(y=h)==null||y.disconnect(),h=null,c&&cancelAnimationFrame(g)}}const Yse=_se,Gse=Sse,Jse=Ese,Xse=Nse,Z1=kse,Qse=(e,t,n)=>{const r=new Map,s={platform:qse,...n},i={...s.platform,_c:r};return bse(e,t,{...s,platform:i})};var Zse=typeof document<"u",eie=function(){},Ap=Zse?m.useLayoutEffect:eie;function Mh(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(!Mh(e[r],t[r]))return!1;return!0}if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!Mh(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function rR(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function eC(e,t){const n=rR(e);return Math.round(t*n)/n}function vy(e){const t=m.useRef(e);return Ap(()=>{t.current=e}),t}function tC(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:a}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[p,d]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=m.useState(r);Mh(f,r)||h(r);const[g,k]=m.useState(null),[w,y]=m.useState(null),v=m.useCallback(I=>{I!==j.current&&(j.current=I,k(I))},[]),x=m.useCallback(I=>{I!==E.current&&(E.current=I,y(I))},[]),C=i||g,N=a||w,j=m.useRef(null),E=m.useRef(null),P=m.useRef(p),O=c!=null,B=vy(c),W=vy(s),z=vy(u),L=m.useCallback(()=>{if(!j.current||!E.current)return;const I={placement:t,strategy:n,middleware:f};W.current&&(I.platform=W.current),Qse(j.current,E.current,I).then(F=>{const _={...F,isPositioned:z.current!==!1};R.current&&!Mh(P.current,_)&&(P.current=_,Cr.flushSync(()=>{d(_)}))})},[f,t,n,W,z]);Ap(()=>{u===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,d(I=>({...I,isPositioned:!1})))},[u]);const R=m.useRef(!1);Ap(()=>(R.current=!0,()=>{R.current=!1}),[]),Ap(()=>{if(C&&(j.current=C),N&&(E.current=N),C&&N){if(B.current)return B.current(C,N,L);L()}},[C,N,L,B,O]);const K=m.useMemo(()=>({reference:j,floating:E,setReference:v,setFloating:x}),[v,x]),D=m.useMemo(()=>({reference:C,floating:N}),[C,N]),$=m.useMemo(()=>{const I={position:n,left:0,top:0};if(!D.floating)return I;const F=eC(D.floating,p.x),_=eC(D.floating,p.y);return l?{...I,transform:"translate("+F+"px, "+_+"px)",...rR(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:_}},[n,l,D.floating,p.x,p.y]);return m.useMemo(()=>({...p,update:L,refs:K,elements:D,floatingStyles:$}),[p,L,K,D,$])}const tie=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?Z1({element:r.current,padding:s}).fn(n):{}:r?Z1({element:r,padding:s}).fn(n):{}}}},nC=(e,t)=>{const n=Yse(e);return{name:n.name,fn:n.fn,options:[e,t]}},nie=(e,t)=>{const n=Jse(e);return{name:n.name,fn:n.fn,options:[e,t]}},rie=(e,t)=>{const n=Xse(e);return{name:n.name,fn:n.fn,options:[e,t]}},sie=(e,t)=>{const n=Gse(e);return{name:n.name,fn:n.fn,options:[e,t]}},iie=(e,t)=>{const n=tie(e);return{name:n.name,fn:n.fn,options:[e,t]}},oie={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},aie={beaconOptions:{offset:-18}},sR={back:"Back",close:"Close",last:"Last",next:"Next",nextWithProgress:"Next ({current} of {total})",open:"Open the dialog",skip:"Skip"},lie={isFixed:!1,locale:sR,placement:"bottom"},cie={continuous:!1,debug:!1,run:!1,scrollToFirstStep:!1,steps:[]},At={INIT:"init",START:"start",STOP:"stop",RESET:"reset",PREV:"prev",NEXT:"next",GO:"go",CLOSE:"close",SKIP:"skip",UPDATE:"update",COMPLETE:"complete"},Zn={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"},ze={INIT:"init",READY:"ready",BEACON_BEFORE:"beacon_before",BEACON:"beacon",TOOLTIP_BEFORE:"tooltip_before",TOOLTIP:"tooltip",COMPLETE:"complete"},ri={BUTTON_BACK:"button_back",BUTTON_CLOSE:"button_close",BUTTON_PRIMARY:"button_primary",BUTTON_SKIP:"button_skip",KEYBOARD:"keyboard",OVERLAY:"overlay"},Ct={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"},uie="react-joyride-portal";function die(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function Al(...e){return tse({all:!0,isMergeableObject:t=>!(!gr.plainObject(t)||m.isValidElement(t))})(...e)}function iR(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function Ri(e,t={}){const{defaultValue:n,step:r,steps:s}=t;let i=wy(e);if(i)(i.includes("{current}")||i.includes("{total}"))&&r&&s&&(i=i.replace("{current}",r.toString()).replace("{total}",s.toString()));else if(m.isValidElement(e)&&!Object.values(e.props).length&&iR(e.type)==="function")try{i=Ri(e.type({}),t)}catch{i=wy(n)}else i=wy(n);return i}function tr(e,t,n,...r){if(!e)return;const s=new Date,i=`${String(s.getHours()).padStart(2,"0")}:${String(s.getMinutes()).padStart(2,"0")}:${String(s.getSeconds()).padStart(2,"0")}.${String(s.getMilliseconds()).padStart(3,"0")}`;console.log(`${t} %c${n}%c ${i}`,"font-weight: bold","color: gray; font-weight: normal",...r)}function fie(e,t){const n=die(t);return{...e,...n}}function pd(){}function pie(e){return Object.keys(e)}function $h(e,...t){if(!gr.plainObject(e))throw new TypeError("Expected an object");const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&(t.includes(r)||(n[r]=e[r]));return n}function rC(e,...t){if(!gr.plainObject(e))throw new TypeError("Expected an object");if(!t.length)return e;const n={};for(const r in e)({}).hasOwnProperty.call(e,r)&&t.includes(r)&&(n[r]=e[r]);return n}function bw(e,t,n){const r=i=>i.replace("{current}",String(t)).replace("{total}",String(n));if(iR(e)==="string")return r(e);if(!m.isValidElement(e))return e;const{children:s}=e.props;if(gr.string(s)&&s.includes("{current}"))return m.cloneElement(e,{children:r(s)});if(Array.isArray(s))return m.cloneElement(e,{children:s.map(i=>typeof i=="string"?r(i):bw(i,t,n))});if(gr.function(e.type)&&!Object.values(e.props).length)try{return bw(e.type({}),t,n)}catch{return e}return e}function sC(e){return pie(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})}function Sk(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function iC(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 Nk(e){return e?e.getBoundingClientRect():null}function hie(e=!1){const{body:t,documentElement:n}=document;if(!t||!n)return 0;if(e){const r=[t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight].sort((i,a)=>i-a),s=Math.floor(r.length/2);return r.length%2===0?(r[s-1]+r[s])/2:r[s]}return Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)}function xs(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 mie(e,t,n){const r=Nk(e),s=gc(e),i=s?!s.isSameNode(Fr()):!1,a=n??yc(e);let l=0,c=(r==null?void 0:r.top)??0;return i&&a?c=(r==null?void 0:r.top)??0:s instanceof HTMLElement&&(l=s.scrollTop,!i&&!a&&(c+=l),s.isSameNode(Fr())||(c+=Fr().scrollTop)),Math.floor(c-t)}function gc(e,t){if(!e)return Fr();const n=KT(e);if(n){if(n.isSameNode(Fr()))return t?document:Fr();if(!(n.scrollHeight>n.offsetHeight))return Fr()}return n}function gie(e){const t=e.getBoundingClientRect(),n=Fr(),r=t.top+t.height/2,s=window.innerHeight/2;return Math.max(0,n.scrollTop+r-s)}function yie(e,t){if(!e)return 0;const n=KT(e)??Fr(),r=parseFloat(getComputedStyle(e).scrollMarginTop)||0,s=Nk(n),i=n.scrollTop??0,{offsetTop:a=0,scrollTop:l=0}=n;let c=e.getBoundingClientRect().top+l;if(a&&(oR(e)||xie(e))){const p=e.getBoundingClientRect(),d=p.top-((s==null?void 0:s.top)??0),f=d+p.height,h=n.clientHeight,g=h*.2;d>=g&&f<=h-g?c=i:c=d+i}const u=Math.floor(c-t-r);return u<0?0:u}function xie(e){return e.offsetParent!==document.body}function oR(e){if(!e)return!1;const t=gc(e);return t?!t.isSameNode(Fr()):!1}function yc(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?yc(e.parentNode,t):!1}function np(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 oC(e){const{isFirstStep:t,scrollToFirstStep:n,step:r,target:s,targetLifecycle:i}=e;if(r.skipScroll||t&&!n&&i!==ze.TOOLTIP||r.placement==="center")return!1;const a=s!=null&&s.isConnected?gc(s):Fr(),l=a?!a.isSameNode(Fr()):!1;return(r.isFixed||yc(s))&&!l?!1:a.scrollHeight>a.clientHeight}function Fr(){return document.scrollingElement??document.documentElement}function aC(e,t){const{duration:n,element:r}=t;let s=()=>{};const i=new Promise(a=>{const{scrollTop:l}=r,c=e>l?e-l:l-e;s=lse.top(r,e,{duration:c<100?50:n},()=>{a()})});return{cancel:s,promise:i}}function wie(e){const t=e.replace(/^#?([\da-f])([\da-f])([\da-f])$/i,(r,s,i,a)=>s+s+i+i+a+a),n=/^#?([\da-f]{2})([\da-f]{2})([\da-f]{2})/i.exec(t);return n?[parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)]:[]}const aR={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555555",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,WebkitAppearance:"none"},rp={...aR,borderRadius:4,padding:8};function bie(e,t){const{styles:n}=e,r=Al(n??{},t.styles??{});let{width:s}=t;Sk()&&(s=typeof s=="number"&&window.innerWidth<s?window.innerWidth-30:s);const i={bottom:0,left:0,overflow:"hidden",position:"absolute",right:0,top:0,zIndex:t.zIndex};return Al({arrow:{alignItems:"center",color:t.arrowColor,display:"inline-flex",justifyContent:"center",position:"absolute"},beaconWrapper:{...aR,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(${wie(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:{...rp,color:t.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{...rp,color:t.textColor,height:12,padding:8,position:"absolute",right:0,top:0,width:12},buttonPrimary:{...rp,backgroundColor:t.primaryColor,color:t.backgroundColor},buttonSkip:{...rp,color:t.textColor,fontSize:14},floater:{display:"inline-block",filter:"drop-shadow(0 0 3px rgba(0, 0, 0, 0.3))",maxWidth:"100%",transition:"opacity 0.3s"},loader:{alignItems:"center",display:"flex",height:48,inset:0,justifyContent:"center",pointerEvents:"none",position:"fixed",width:48,zIndex:t.zIndex+1},overlay:{...i,backgroundColor:t.overlayColor},spotlight:{},tooltip:{backgroundColor:t.backgroundColor,borderRadius:5,boxSizing:"border-box",color:t.textColor,fontSize:16,maxWidth:"100%",padding:12,position:"relative",width:s},tooltipContainer:{lineHeight:1.4,textAlign:"center"},tooltipTitle:{fontSize:18,margin:0},tooltipContent:{paddingBottom:12,paddingTop:12},tooltipFooter:{alignItems:"center",display:"flex",justifyContent:"flex-end"},tooltipFooterSpacer:{flex:1}},r)}const kie=["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 jk(e,t){if(!t)return null;const n=Al(lie,rC(e,"arrowComponent","beaconComponent","floatingOptions","loaderComponent","locale","styles","tooltipComponent"),t),r=Al(oie,e.options??{},rC(t,...kie)),s=bie(e,{...n,...r}),i=Al(aie,e.floatingOptions??{},n.floatingOptions??{});return{...n,...r,locale:Al(sR,e.locale??{},n.locale||{}),floatingOptions:i,spotlightPadding:vie(r.spotlightPadding),styles:s}}function vie(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 Sie(e,t,n){const{action:r}=t,s=n&&[At.PREV,At.NEXT].includes(r);return e.skipBeacon||e.placement==="center"||s}function lR(e,t=!1){return gr.plainObject(e)?e.target?!0:(tr(t,"tour","target is missing from the step"),!1):(tr(t,"tour","step must be an object"),!1)}function cR(e,t=!1){return gr.array(e)?e.every(n=>lR(n,t)):(tr(t,"tour","steps must be an array"),!1)}var Nie=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",()=>$h(this.snapshot,"positioned"));_n(this,"getState",()=>$h(this.snapshot,"positioned"));_n(this,"setPositionData",(e,t)=>{var r,s,i;((r=e==="beacon"?this.beaconPosition:this.tooltipPosition)==null?void 0:r.placement)!==t.placement&&tr(this.debug,`step:${this.state.index}`,"positioned",`${e} ${t.placement}`),e==="beacon"?this.beaconPosition=t:this.tooltipPosition=t,(this.state.lifecycle===ze.BEACON_BEFORE||this.state.lifecycle===ze.TOOLTIP_BEFORE)&&!this.state.positioned&&this.updateState({positioned:!0});const n=(i=(s=this.getStep())==null?void 0:s.floatingOptions)==null?void 0:i.onPosition;n&&n(t)});_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,i=n&&!t&&e.index!==void 0?r:e.index??r,a={action:e.action??this.state.action,controlled:n,index:i,lifecycle:e.lifecycle??this.state.lifecycle,origin:e.origin??null,positioned:e.positioned??this.state.positioned,scrolling:e.scrolling??this.state.scrolling,size:e.size??this.state.size,status:e.status??this.state.status,waiting:e.waiting??this.state.waiting},l=this.applyTransitions(a);if(this.state=l,!hk(s,l)){this.snapshot=Object.freeze({...l});for(const c of this.listeners)c(this.snapshot)}});const{initialStepIndex:t,stepIndex:n,steps:r=[]}=e??{},s=gr.number(n);let i=0;this.debug=(e==null?void 0:e.debug)??!1,s?(i=n,gr.number(t)&&tr(this.debug,"tour","initialStepIndex is ignored in controlled mode")):gr.number(t)&&(t>=0&&t<r.length?i=t:r.length>0&&tr(this.debug,"tour","initialStepIndex is out of bounds")),this.props=e??{steps:[]},this.steps=r,this.state={action:At.INIT,controlled:s,index:i,lifecycle:ze.INIT,origin:null,positioned:!1,scrolling:!1,size:r.length,status:r.length?Ct.READY:Ct.IDLE,waiting:!1},this.snapshot=Object.freeze({...this.state})}applyTransitions(e){return e.status===Ct.WAITING&&e.size>0?{...e,status:Ct.RUNNING}:e}getStep(e){return jk(this.props,this.steps[e??this.state.index])}};function jie(e){return new Nie(e)}function lC(e,t){return Math.min(Math.max(e,0),t)}function Cie(e,t,n){const r=m.useRef(t),s=m.useRef(n);return r.current=t,s.current=n,m.useMemo(()=>{const i=()=>e.current.getSnapshot();return{close:(w=null)=>{const{index:y,status:v}=i();v===Ct.RUNNING&&e.current.updateState({action:At.CLOSE,index:y+1,origin:w,lifecycle:ze.COMPLETE,positioned:!1,scrolling:!1,waiting:!1})},go:w=>{const{controlled:y,size:v,status:x}=i();if(y){tr(r.current,"tour","go() is not supported in controlled mode");return}x===Ct.RUNNING&&e.current.updateState({action:At.GO,index:w,lifecycle:ze.COMPLETE,positioned:!1,scrolling:!1,status:w<v?x:Ct.FINISHED,waiting:!1})},info:()=>$h(e.current.getSnapshot(),"positioned"),next:w=>{const{index:y,size:v,status:x}=i();x===Ct.RUNNING&&e.current.updateState({action:At.NEXT,index:lC(y+1,v),lifecycle:ze.COMPLETE,origin:w,positioned:!1,scrolling:!1,waiting:!1})},open:()=>{const{status:w}=i();w===Ct.RUNNING&&e.current.updateState({action:At.UPDATE,lifecycle:ze.TOOLTIP_BEFORE,positioned:!1,scrolling:!1,waiting:!1})},prev:w=>{const{index:y,size:v,status:x}=i();x===Ct.RUNNING&&e.current.updateState({action:At.PREV,index:lC(y-1,v),lifecycle:ze.COMPLETE,origin:w,positioned:!1,scrolling:!1,waiting:!1})},reset:(w=!1)=>{const{controlled:y}=i();if(y){tr(r.current,"tour","reset() is not supported in controlled mode");return}s.current(),e.current.updateState({action:At.RESET,index:0,lifecycle:ze.INIT,positioned:!1,scrolling:!1,status:w?Ct.RUNNING:Ct.READY,waiting:!1})},skip:w=>{const{status:y}=i();y===Ct.RUNNING&&e.current.updateState({action:At.SKIP,lifecycle:ze.COMPLETE,origin:w,positioned:!1,scrolling:!1,status:Ct.SKIPPED,waiting:!1})},start:w=>{const{index:y,size:v}=i();s.current(),e.current.updateState({action:At.START,index:gr.number(w)?w:y,lifecycle:ze.INIT,positioned:!1,scrolling:!1,status:v?Ct.RUNNING:Ct.WAITING,waiting:!1},!0)},stop:(w=!1)=>{const{index:y,status:v}=i();[Ct.FINISHED,Ct.SKIPPED].includes(v)||e.current.updateState({action:At.STOP,index:y+(w?1:0),lifecycle:ze.COMPLETE,positioned:!1,scrolling:!1,status:Ct.PAUSED,waiting:!1})}}},[e])}const _ie=new Set(["origin","positioned"]);function Eie(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!t)return;const r=e.current.getSnapshot();return tr(!0,"tour","init",r),n.current=r,e.current.subscribe(s=>{const i=n.current;if(n.current=s,!i)return;const a={};let l=!1;for(const c of Object.keys(s))s[c]!==i[c]&&!_ie.has(c)&&(a[c]={from:i[c],to:s[c]},(c==="status"||c==="size")&&(l=!0));Object.keys(a).length&&(!l&&s.index>=s.size||tr(!0,l?"tour":`step:${s.index}`,"state",a))})},[t,e])}function Aie(e,t,n){const r=m.useRef(e),s=m.useRef(t);return r.current=e,s.current=t,m.useCallback((i,a,l)=>{var u;const c={...n.current.getEventState(),error:null,scroll:null,step:a,type:i,...l};(u=r.current)==null||u.call(r,c,s.current),n.current.dispatch(c,s.current)},[n])}function mo(e,t){return{hasChanged(n){return e[n]!==t[n]},hasChangedTo(n,r){const s=e[n],i=t[n];return Array.isArray(r)?r.includes(s)&&!r.includes(i):s===r&&i!==r},previous:t}}function Pie(e){const{addFailure:t,controls:n,emitEvent:r,previousState:s,props:i,state:a,step:l,store:c}=e,{action:u,index:p,lifecycle:d,positioned:f,scrolling:h,size:g,status:k}=a,w=OT(l)??null,y=m.useRef(null),v=m.useRef(i),x=m.useRef(a),C=m.useRef(s),N=m.useRef(l),j=m.useRef(w),E=m.useRef(n),P=m.useRef(null),O=m.useRef(null),B=m.useRef(null);v.current=i,x.current=a,C.current=s,N.current=l,j.current=w,E.current=n;const W=()=>{P.current&&(clearInterval(P.current),P.current=null),O.current=null,B.current&&(B.current.cancel(),B.current=null)};m.useEffect(()=>{if(!C.current)return;const{hasChangedTo:z}=mo(x.current,C.current);(z("action",[At.NEXT,At.PREV,At.SKIP,At.CLOSE])||y.current===At.CLOSE&&u===At.START)&&(y.current=u)},[u]),m.useEffect(()=>{if(!C.current)return()=>{W()};const{hasChanged:z}=mo(x.current,C.current),L=N.current;if(z("index")&&W(),k!==Ct.RUNNING||!L||d!==ze.INIT)return()=>{W()};const{hasChangedTo:R}=mo(x.current,C.current);R("status",Ct.RUNNING)&&[Ct.IDLE,Ct.READY,Ct.PAUSED].includes(C.current.status)&&r(Zn.TOUR_START,L),c.current.cleanupPositionData();const{debug:K}=v.current;if(L.before&&!B.current){tr(K,`step:${p}`,"before()",L),B.current={cancel:()=>{}},c.current.updateState({waiting:!0}),r(Zn.STEP_BEFORE_HOOK,L,{action:y.current??x.current.action});const D=()=>{B.current=null,c.current.updateState({action:y.current??x.current.action,waiting:!1,lifecycle:ze.READY})},$=new AbortController,I=L.beforeTimeout;B.current={cancel:()=>$.abort()};const F=I?setTimeout(()=>{$.signal.aborted||(tr(K,`step:${p}`,"before()","timed out",`${I}ms`),$.abort(),t(L,"before_hook"),r(Zn.ERROR,L,{error:new Error("Step before hook timed out")}),D())},I):null;L.before({...c.current.getState(),action:y.current??c.current.getState().action,step:L}).then(()=>{$.signal.aborted||(F&&clearTimeout(F),D())}).catch(_=>{$.signal.aborted||(F&&clearTimeout(F),t(L,"before_hook"),r(Zn.ERROR,L,{error:_ instanceof Error?_:new Error(String(_))}),D())})}else if(!B.current){P.current&&O.current!==L.target&&W();const D=xs(L.target);if(D&&np(D))W(),c.current.updateState({action:y.current??At.UPDATE,lifecycle:ze.READY,waiting:!1});else if(L.targetWaitTimeout===0)c.current.updateState({action:y.current??At.UPDATE,lifecycle:ze.READY,waiting:!1});else if(!P.current){const{targetWaitTimeout:$}=L,I=Date.now();O.current=L.target,tr(K,`step:${p}`,"polling","started",`${$}ms`),c.current.updateState({waiting:!0}),P.current=setInterval(()=>{const F=xs(L.target),_=Date.now()-I,X=_>=$;(F&&np(F)||X)&&(tr(K,`step:${p}`,"polling",F&&np(F)?"found":"timed out",`${_}ms`),W(),c.current.updateState({action:y.current??At.UPDATE,lifecycle:ze.READY,waiting:!1}))},100)}}return()=>{W()}},[t,r,p,d,k,c]),m.useEffect(()=>{if(!C.current)return;const{hasChanged:z,hasChangedTo:L,previous:R}=mo(x.current,C.current),K=N.current;if(!K)return;const D=xs(K.target),$=!!D;if($&&np(D)){if(L("lifecycle",ze.READY)&&R.lifecycle===ze.INIT&&r(Zn.STEP_BEFORE,K,{action:y.current??x.current.action}),L("lifecycle",ze.READY)){const I=x.current,F=Sie(K,I,v.current.continuous)?ze.TOOLTIP:ze.BEACON,_=xs(K.scrollTarget??K.spotlightTarget??K.target),X=oC({isFirstStep:I.index===0,scrollToFirstStep:v.current.scrollToFirstStep,step:K,target:_,targetLifecycle:F}),V=F===ze.TOOLTIP?ze.TOOLTIP_BEFORE:ze.BEACON_BEFORE;tr(v.current.debug,`step:${p}`,"scroll",X?"needed":"skipped"),c.current.updateState({action:At.UPDATE,lifecycle:V,scrolling:X})}}else if(x.current.status===Ct.RUNNING&&d!==ze.INIT&&d!==ze.COMPLETE&&z("lifecycle")){tr(v.current.debug,`step:${p}`,$?"Target not visible":"Target not mounted",K),t(K,"target_not_found"),r(Zn.TARGET_NOT_FOUND,K);const I=x.current;I.controlled||c.current.updateState({action:At.UPDATE,index:I.index+(I.action===At.PREV?-1:1),lifecycle:ze.INIT})}},[t,r,p,d,c]),m.useEffect(()=>{if(!C.current)return;const{hasChangedTo:z,previous:L}=mo(x.current,C.current),R=N.current,K=j.current;if(R&&z("lifecycle",ze.TOOLTIP_BEFORE)&&L.lifecycle===ze.BEACON){const I=xs(R.scrollTarget??R.spotlightTarget??R.target);if(oC({isFirstStep:x.current.index===0,scrollToFirstStep:v.current.scrollToFirstStep,step:R,target:I,targetLifecycle:ze.TOOLTIP})){c.current.updateState({scrolling:!0,positioned:!1});return}}const D=d===ze.BEACON_BEFORE||d===ze.TOOLTIP_BEFORE;if(R&&D&&!h){const I=d===ze.TOOLTIP_BEFORE?ze.TOOLTIP:ze.BEACON;c.current.updateState({action:At.UPDATE,lifecycle:I})}R&&z("lifecycle",ze.BEACON)&&r(Zn.BEACON,R),R&&z("lifecycle",ze.TOOLTIP)&&r(Zn.TOOLTIP,R);const $=x.current;if(($.status===Ct.RUNNING||$.controlled&&$.status===Ct.PAUSED&&R)&&K&&z("lifecycle",ze.COMPLETE)&&L.lifecycle===ze.TOOLTIP&&(r(Zn.STEP_AFTER,K,{action:y.current??At.UPDATE,index:L.index??$.index,lifecycle:$.lifecycle}),K.after)){r(Zn.STEP_AFTER_HOOK,K,{action:y.current??At.UPDATE,index:L.index??$.index,lifecycle:$.lifecycle});try{K.after({...c.current.getState(),action:y.current??At.UPDATE,index:L.index??$.index,lifecycle:$.lifecycle,step:K})}catch{}}},[r,d,f,h,c]),m.useEffect(()=>{if(!C.current)return;const{hasChangedTo:z,previous:L}=mo(x.current,C.current),R=N.current,K=j.current;g&&!R&&d===ze.INIT&&c.current.updateState({action:At.UPDATE,lifecycle:ze.COMPLETE,status:Ct.FINISHED}),!x.current.controlled&&k===Ct.RUNNING&&z("lifecycle",ze.COMPLETE)&&p<g&&c.current.updateState({action:At.UPDATE,lifecycle:ze.INIT}),z("lifecycle",ze.COMPLETE)&&p>=g&&c.current.updateState({action:At.UPDATE,lifecycle:ze.COMPLETE,status:Ct.FINISHED});const D=R??K??jk(v.current,v.current.steps[p-1]);if(D&&z("status",[Ct.FINISHED,Ct.SKIPPED])){let $;R?$=p:K?$=L.index??p:$=p-1,r(Zn.TOUR_END,D,{index:$}),x.current.controlled||E.current.reset(),y.current=null}R&&z("action",At.STOP)&&(y.current=null,r(Zn.TOUR_STATUS,R)),R&&z("action",At.RESET)&&(r(Zn.TOUR_STATUS,R),y.current=null)},[u,r,p,d,g,k,c])}function Iie({controls:e,emitEvent:t,props:n,state:r,store:s}){const{debug:i,initialStepIndex:a,run:l,stepIndex:c,steps:u}=n,p=m.useRef(void 0),d=m.useRef(r),f=m.useRef(e);d.current=r,f.current=e,m.useEffect(()=>{const h=p.current;if(p.current=n,!h||n===h)return;const{hasChanged:g}=mo(n,h);if(hk(h.steps,u)||(cR(u,i)?s.current.setSteps(u):(tr(i,"tour","Steps are not valid",u),t(Zn.ERROR,u[0]??{target:"",content:""},{error:new Error("Steps are not valid")}))),g("run"))l?s.current.getState().size&&f.current.start(c??a):f.current.stop();else if(gr.number(c)&&g("stepIndex")){const k=gr.number(h.stepIndex)&&h.stepIndex<c?At.NEXT:At.PREV;[Ct.FINISHED,Ct.SKIPPED].includes(d.current.status)||s.current.updateState({action:k,index:c,lifecycle:ze.INIT,positioned:!1},!0)}},[i,t,a,n,l,c,u,s])}function Tie(e,t){var l,c,u,p;const{beaconPosition:n,lifecycle:r,scrollOffset:s,step:i}=t;if(i.scrollTarget||i.spotlightTarget)return Math.max(0,e);let a=e-i.spotlightPadding.top;if(r===ze.BEACON_BEFORE&&(n!=null&&n.placement)){const d=Rie(n);["bottom"].includes(n.placement)||(a+=Math.floor(d-s))}else if(r===ze.TOOLTIP_BEFORE){const{placement:d}=i;if(d==="top"){const f=((l=document.querySelector(".react-joyride__floater"))==null?void 0:l.getBoundingClientRect().height)??0,h=(c=i.floatingOptions)!=null&&c.hideArrow?0:i.arrowSize,g=i.offset+i.spotlightPadding.top+h;a-=f+g}else if(d==="left"||d==="right"){const f=((u=document.querySelector(".react-joyride__floater"))==null?void 0:u.getBoundingClientRect().height)??0,h=((p=xs(i.target))==null?void 0:p.getBoundingClientRect().height)??0,g=s+i.spotlightPadding.top+h/2-f/2;g<s&&(a-=s-g)}}return Math.max(0,a)}function Rie(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 Mie({emitEvent:e,previousState:t,props:n,state:r,step:s,store:i}){const{index:a,lifecycle:l,positioned:c,scrolling:u,status:p}=r,d=m.useRef(null),f=m.useRef(r),h=m.useRef(t),g=m.useRef(n),k=m.useRef(s);f.current=r,h.current=t,g.current=n,k.current=s,m.useEffect(()=>()=>{var w;(w=d.current)==null||w.call(d)},[]),m.useEffect(()=>{var N;if(!h.current||!k.current)return;const{hasChangedTo:w}=mo(f.current,h.current),y=k.current,{debug:v}=g.current,{scrollDuration:x}=y,C=l===ze.BEACON_BEFORE||l===ze.TOOLTIP_BEFORE;if(p===Ct.RUNNING&&C&&u&&w("positioned",!0)){const j=xs(y.scrollTarget??y.spotlightTarget??y.target),E=i.current.getPositionData("beacon"),P=gc(j),O=P?!P.isSameNode(Fr()):!1;(N=d.current)==null||N.call(d),(async()=>{if(O&&!yc(P)){const $=Fr(),I=gie(P),F={initial:$.scrollTop,target:I,element:$,duration:x};e(Zn.SCROLL_START,y,{scroll:F});const{cancel:_,promise:X}=aC(I,{element:$,duration:x});d.current=_,await X,e(Zn.SCROLL_END,y,{scroll:F})}const W=Math.floor(yie(j,y.scrollOffset))||0,z=O?W:Tie(W,{beaconPosition:E,lifecycle:l,scrollOffset:y.scrollOffset,step:y});tr(v,`step:${a}`,"scroll",O?"custom":"document",`${W} → ${z}`);const L=P,R={initial:L.scrollTop,target:z,element:L,duration:x};e(Zn.SCROLL_START,y,{scroll:R});const{cancel:K,promise:D}=aC(z,{element:L,duration:x});d.current=K,await D,e(Zn.SCROLL_END,y,{scroll:R}),i.current.updateState({scrolling:!1})})().catch(()=>{i.current.updateState({scrolling:!1})})}},[e,a,l,c,u,p,i])}function $ie(e){const t=yre(()=>fie(cie,e),[e]),{debug:n,initialStepIndex:r,onEvent:s,run:i,stepIndex:a,steps:l}=t,c=m.useRef(jie(t)),u=QA.useSyncExternalStore(c.current.subscribe,c.current.getSnapshot,c.current.getServerSnapshot),[p,d]=m.useState([]),f=m.useCallback((N,j)=>{d(E=>[...E,{reason:j,step:N}])},[]),h=m.useCallback(()=>{d([])},[]);Eie(c,n);const g=Cie(c,n,h),k=Aie(s,g,c),{index:w,size:y,status:v}=u,x=OT(u),C=m.useMemo(()=>jk(t,l[w]),[w,t,l]);return xre(()=>{i&&y&&cR(l,n)&&g.start(a??r)}),gre(()=>{i&&y&&v===Ct.IDLE&&c.current.updateState({status:Ct.READY})},[i,y,v]),Iie({controls:g,emitEvent:k,props:t,state:u,store:c}),Pie({addFailure:f,controls:g,emitEvent:k,previousState:x,props:t,state:u,step:C,store:c}),Mie({emitEvent:k,previousState:x,props:t,state:u,step:C,store:c}),{controls:g,failures:p,mergedProps:t,state:u,step:C,store:c}}function Lie(e){const[t,n]=m.useState(null);return m.useEffect(()=>{let r=null,s=!1;if(e)if(gr.domElement(e))r=e,s=!0;else{const i=document.querySelector(e);i&&(r=i)}else{const i=document.createElement("div");i.id=uie,document.body.appendChild(i),r=i}return n(r),()=>{!r||s||r.parentNode===document.body&&document.body.removeChild(r)}},[e]),t}const Oie={animation:"joyride-loader-spin 1s linear infinite",border:"5px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",borderTopColor:"#555"};function Die({nonce:e,step:t}){const{loaderComponent:n}=t,r=!!n;if(m.useEffect(()=>{if(r||document.getElementById("joyride-loader-animation"))return pd;const c=document.createElement("style");return c.id="joyride-loader-animation",e&&c.setAttribute("nonce",e),c.appendChild(document.createTextNode(`
|
|
317
|
-
@keyframes joyride-loader-spin {
|
|
318
|
-
to { transform: rotate(360deg); }
|
|
319
|
-
}
|
|
320
|
-
`)),document.head.appendChild(c),()=>{const u=document.getElementById("joyride-loader-animation");u!=null&&u.parentNode&&u.parentNode.removeChild(u)}},[r,e]),n===null)return null;const{height:s,width:i,...a}=t.styles.loader;let l;if(n){const c=n;l=it.createElement(c,{step:t})}else l=it.createElement("div",{style:{...Oie,height:s,width:i,borderTopColor:t.primaryColor}});return it.createElement("div",{className:"react-joyride__loader","data-testid":"loader",style:a},l)}const Fie={height:0,isFixed:!1,left:0,top:0,width:0};function Qc(e,t){const n=xs(e);if(!n)return Fie;const r=Nk(n),s=yc(n),i=mie(n,t.top,s);return{height:Math.round(((r==null?void 0:r.height)??0)+t.top+t.bottom),isFixed:s,left:Math.round(((r==null?void 0:r.left)??0)-t.left),top:i,width:Math.round(((r==null?void 0:r.width)??0)+t.left+t.right)}}function zie(e,t,n){const[r,s]=m.useState(()=>Qc(e,t)),i=m.useRef(void 0),a=m.useRef(null),l=m.useRef(n),c=m.useRef(null),u=m.useCallback(()=>{clearTimeout(i.current),i.current=window.setTimeout(()=>{s(d=>{const f=Qc(e,t);return d.top===f.top&&d.left===f.left&&d.width===f.width&&d.height===f.height&&d.isFixed===f.isFixed?d:f})},100)},[e,t]);m.useEffect(()=>{let d=null;const f=g=>{a.current=gc(g,!0),a.current&&a.current.addEventListener("scroll",u,{passive:!0}),window.addEventListener("scroll",u,{passive:!0}),window.addEventListener("resize",u),typeof ResizeObserver<"u"&&(c.current=new ResizeObserver(u),c.current.observe(g)),s(Qc(e,t))},h=xs(e);return h?f(h):(d=new MutationObserver(()=>{const g=xs(e);g&&(d==null||d.disconnect(),d=null,f(g))}),d.observe(document.body,{childList:!0,subtree:!0})),()=>{var g;d==null||d.disconnect(),a.current&&a.current.removeEventListener("scroll",u),window.removeEventListener("scroll",u),window.removeEventListener("resize",u),(g=c.current)==null||g.disconnect(),clearTimeout(i.current)}},[e,t,u]),m.useEffect(()=>{l.current&&!n&&s(Qc(e,t)),l.current=n},[n,e,t]);let p=r;return l.current&&!n&&(p=Qc(e,t)),p}function Bie(e,t,n){let r=`M0 0H${e}V${t}H0Z`;return n&&(r+=` ${n}`),r}function cC(e,t,n,r,s){if(n<=0||r<=0)return"";const i=Math.max(0,Math.min(s,n/2,r/2));let a=`M${e+i} ${t}`;return a+=`H${e+n-i}`,a+=`A${i} ${i} 0 0 1 ${e+n} ${t+i}`,a+=`V${t+r-i}`,a+=`A${i} ${i} 0 0 1 ${e+n-i} ${t+r}`,a+=`H${e+i}`,a+=`A${i} ${i} 0 0 1 ${e} ${t+r-i}`,a+=`V${t+i}`,a+=`A${i} ${i} 0 0 1 ${e+i} ${t}Z`,a}const Hie=[ze.BEACON_BEFORE,ze.BEACON];function Wie(e){var D,$;const{blockTargetInteraction:t,continuous:n,hideOverlay:r,lifecycle:s,onClickOverlay:i,overlayClickAction:a,placement:l,portalElement:c,scrolling:u,spotlightPadding:p,spotlightRadius:d,spotlightTarget:f,styles:h,target:g,waiting:k}=e,w=wre(),y=zie(f??g,p,u||k),v=m.useRef(null),x=(s===ze.TOOLTIP||s===ze.TOOLTIP_BEFORE)&&l!=="center",[C,N]=m.useState(!1),j=c?(D=v.current)==null?void 0:D.offsetParent:null,E=(j==null?void 0:j.clientWidth)??w.width,P=(j==null?void 0:j.clientHeight)??hie()??w.height,O=(($=h.overlay)==null?void 0:$.backgroundColor)??"rgba(0, 0, 0, 0.5)",B=m.useMemo(()=>{const{backgroundColor:I,mixBlendMode:F,..._}=h.overlay;return{height:P,pointerEvents:"none",..._}},[P,h.overlay]),W=x&&!u&&!k;m.useEffect(()=>{W?requestAnimationFrame(()=>N(!0)):N(!1)},[W]);const z=n&&Hie.includes(s),L=!n&&s!==ze.TOOLTIP;if(r||!k&&(z||L))return null;let R="";if(W)if(c&&j){const I=xs(f??g);if(I){const F=iC(I),_=iC(j);R=cC(F.left-_.left-p.left,F.top-_.top-p.top,I.offsetWidth+p.left+p.right,I.offsetHeight+p.top+p.bottom,d)}}else R=cC(y.left,y.top,y.width,y.height,d);const K=Bie(E,P,R);return it.createElement("div",{ref:v,"aria-hidden":"true",className:"react-joyride__overlay","data-testid":"overlay",style:B},it.createElement("svg",{className:"react-joyride__spotlight","data-testid":"spotlight",style:{height:P,left:0,position:y.isFixed?"fixed":"absolute",top:0,width:E}},it.createElement("path",{d:K,fill:O,fillRule:"evenodd",onClick:i,style:{cursor:a?"pointer":"default",pointerEvents:"auto"}}),R&&it.createElement("path",{d:R,fill:O,style:{opacity:C?0:1,pointerEvents:t?"auto":"none",transition:"opacity 0.2s"}}),R&&Object.keys(h.spotlight).length>0&&it.createElement("path",{d:R,fill:"none",style:{pointerEvents:"none"},...h.spotlight})))}function uR(e){const{children:t,element:n}=e;return n?Cr.createPortal(t,n):null}const Vie='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), area[href], [tabindex]:not([tabindex="-1"]), [contenteditable]';function Kie(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!e)return pd;n.current=document.activeElement;const r=i=>{if(i.key!=="Tab")return;const a=[...e.querySelectorAll(Vie)],{shiftKey:l}=i;if(!a.length)return;i.preventDefault();let c=document.activeElement?a.indexOf(document.activeElement):0;c===-1||!l&&c+1===a.length?c=0:l&&c===0?c=a.length-1:c+=l?-1:1,a[c].focus()};e.addEventListener("keydown",r,!1);let s;{const i=e.querySelector(t);i&&(s=setTimeout(()=>{i.focus({preventScroll:!0})},100))}return()=>{var i;e.removeEventListener("keydown",r),s!==void 0&&clearTimeout(s),(i=n.current)==null||i.focus({preventScroll:!0})}},[e,t])}function Fi(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 qie(e,t,n){const[r]=e.split("-");switch(r){case"top":return{points:`0,0 ${t/2},${n} ${t},0`,...Fi(e,t,n)};case"bottom":return{points:`${t},${n} ${t/2},0 0,${n}`,...Fi(e,t,n)};case"left":return{points:`0,0 ${n},${t/2} 0,${t}`,...Fi(e,t,n)};case"right":return{points:`${n},${t} ${n},0 0,${t/2}`,...Fi(e,t,n)};default:return null}}function Uie(e,t,n,r){if(!t)return{};const[s]=e.split("-");switch(s){case"top":return{bottom:-n,left:t.x??0,...Fi(e,r,n)};case"bottom":return{top:-n,left:t.x??0,...Fi(e,r,n)};case"left":return{right:-n,top:t.y??0,...Fi(e,r,n)};case"right":return{left:-n,top:t.y??0,...Fi(e,r,n)};default:return{}}}function Yie({arrowComponent:e,arrowRef:t,base:n,placement:r,position:s,size:i,styles:a}){const l=e;let c=null;if(l){if(!Fi(r,n,i))return null;c=it.createElement("span",{style:{flexShrink:0}},it.createElement(l,{base:n,placement:r,size:i}))}else{const u=qie(r,n,i);if(!u)return null;c=it.createElement("svg",{height:u.height,width:u.width,xmlns:"http://www.w3.org/2000/svg"},it.createElement("polygon",{fill:"currentColor",points:u.points}))}return it.createElement("span",{ref:t,className:"react-joyride__arrow","data-testid":"arrow",style:{...a,...Uie(r,s,i,n),...s?{}:{visibility:"hidden"}}},c)}function Gie(e){const{beaconComponent:t,continuous:n,index:r,isLastStep:s,locale:i,nonce:a,onInteract:l,shouldFocus:c,size:u,step:p,styles:d}=e,f=m.useRef(null),h=!!t;m.useEffect(()=>{if(h||document.getElementById("joyride-beacon-animation"))return pd;const w=document.createElement("style");w.id="joyride-beacon-animation",a&&w.setAttribute("nonce",a),w.appendChild(document.createTextNode(`
|
|
321
|
-
@keyframes joyride-beacon-inner {
|
|
322
|
-
20% {
|
|
323
|
-
opacity: 0.9;
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
90% {
|
|
327
|
-
opacity: 0.7;
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
@keyframes joyride-beacon-outer {
|
|
332
|
-
0% {
|
|
333
|
-
transform: scale(1);
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
45% {
|
|
337
|
-
opacity: 0.7;
|
|
338
|
-
transform: scale(0.75);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
100% {
|
|
342
|
-
opacity: 0.9;
|
|
343
|
-
transform: scale(1);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
`)),document.head.appendChild(w);const y=setTimeout(()=>{gr.domElement(f.current)&&c&&f.current.focus()},0);return()=>{clearTimeout(y);const v=document.getElementById("joyride-beacon-animation");v!=null&&v.parentNode&&v.parentNode.removeChild(v)}},[h,a,c]);const g=Ri(i.open);let k;if(t){const w=t;k=it.createElement(w,{continuous:n,index:r,isLastStep:s,size:u,step:p})}else k=it.createElement("span",{style:d.beacon},it.createElement("span",{style:d.beaconOuter}),it.createElement("span",{style:d.beaconInner}));return it.createElement("button",{ref:f,"aria-label":g,className:"react-joyride__beacon","data-testid":"button-beacon",onClick:l,onMouseEnter:l,style:d.beaconWrapper,title:g,type:"button"},k)}function Jie({styles:e,...t}){const{color:n,height:r,width:s,...i}=e;return it.createElement("button",{style:i,type:"button",...t},it.createElement("svg",{height:typeof r=="number"?`${r}px`:r,preserveAspectRatio:"xMidYMid",version:"1.1",viewBox:"0 0 18 18",width:typeof s=="number"?`${s}px`:s,xmlns:"http://www.w3.org/2000/svg"},it.createElement("g",null,it.createElement("path",{d:"M8.13911129,9.00268191 L0.171521827,17.0258467 C-0.0498027049,17.248715 -0.0498027049,17.6098394 0.171521827,17.8327545 C0.28204354,17.9443526 0.427188206,17.9998706 0.572051765,17.9998706 C0.71714958,17.9998706 0.862013139,17.9443526 0.972581703,17.8327545 L9.0000937,9.74924618 L17.0276057,17.8327545 C17.1384085,17.9443526 17.2832721,17.9998706 17.4281356,17.9998706 C17.5729992,17.9998706 17.718097,17.9443526 17.8286656,17.8327545 C18.0499901,17.6098862 18.0499901,17.2487618 17.8286656,17.0258467 L9.86135722,9.00268191 L17.8340066,0.973848225 C18.0553311,0.750979934 18.0553311,0.389855532 17.8340066,0.16694039 C17.6126821,-0.0556467968 17.254037,-0.0556467968 17.0329467,0.16694039 L9.00042166,8.25611765 L0.967006424,0.167268345 C0.745681892,-0.0553188426 0.387317931,-0.0553188426 0.165993399,0.167268345 C-0.0553311331,0.390136635 -0.0553311331,0.751261038 0.165993399,0.974176179 L8.13920499,9.00268191 L8.13911129,9.00268191 Z",fill:n}))))}function Xie(e){const{backProps:t,closeProps:n,index:r,isLastStep:s,primaryProps:i,skipProps:a,step:l,tooltipProps:c}=e,{buttons:u,content:p,styles:d,title:f}=l,h={};u.includes("primary")&&(h.primary=it.createElement("button",{"data-testid":"button-primary",style:d.buttonPrimary,type:"button",...i})),u.includes("skip")&&!s&&(h.skip=it.createElement("button",{"aria-live":"off","data-testid":"button-skip",style:d.buttonSkip,type:"button",...a})),u.includes("back")&&r>0&&(h.back=it.createElement("button",{"data-testid":"button-back",style:d.buttonBack,type:"button",...t})),h.close=u.includes("close")&&it.createElement(Jie,{"data-testid":"button-close",styles:d.buttonClose,...n});const g=f?{"aria-labelledby":"joyride-tooltip-title","aria-describedby":"joyride-tooltip-content"}:{"aria-label":Ri(p),"aria-describedby":"joyride-tooltip-content"};return it.createElement("div",{key:"JoyrideTooltip",className:"react-joyride__tooltip","data-joyride-step":r,...l.id&&{"data-joyride-id":l.id},style:d.tooltip,...c,...g},it.createElement("div",{style:d.tooltipContainer},f&&it.createElement("h4",{id:"joyride-tooltip-title",style:d.tooltipTitle},f),it.createElement("div",{id:"joyride-tooltip-content",style:d.tooltipContent},p)),u.some(k=>k==="back"||k==="primary"||k==="skip")&&it.createElement("div",{style:d.tooltipFooter},it.createElement("div",{style:d.tooltipFooterSpacer},h.skip),h.back,h.primary),h.close)}function Qie(e){const{continuous:t,controls:n,index:r,isLastStep:s,size:i,step:a}=e,l=y=>{y.preventDefault(),n.prev(ri.BUTTON_BACK)},c=y=>{y.preventDefault(),a.closeButtonAction==="skip"?n.skip(ri.BUTTON_CLOSE):n.close(ri.BUTTON_CLOSE)},u=y=>{if(y.preventDefault(),!t){n.close(ri.BUTTON_PRIMARY);return}n.next(ri.BUTTON_PRIMARY)},p=y=>{y.preventDefault(),n.skip(ri.BUTTON_SKIP)},d=()=>{const{back:y,close:v,last:x,next:C,nextWithProgress:N,skip:j}=a.locale,E=Ri(y),P=Ri(v),O=Ri(x),B=Ri(C),W=Ri(j);let z=v,L=P;if(t){if(z=C,L=B,a.showProgress&&!s){const R=Ri(N,{step:r+1,steps:i});z=bw(N,r+1,i),L=R}s&&(z=x,L=O)}return{backProps:{"aria-label":E,children:y,"data-action":"back",onClick:l,role:"button",title:E},closeProps:{"aria-label":P,children:v,"data-action":"close",onClick:c,role:"button",title:P},primaryProps:{"aria-label":L,children:z,"data-action":"primary",onClick:u,role:"button",title:L},skipProps:{"aria-label":W,children:j,"data-action":"skip",onClick:p,role:"button",title:W},tooltipProps:{"aria-modal":!0,role:"alertdialog"}}},{arrowComponent:f,beaconComponent:h,tooltipComponent:g,...k}=a;let w;if(g){const y=g;w=it.createElement(y,{...d(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:k})}else w=it.createElement(Xie,{...d(),continuous:t,controls:n,index:r,isLastStep:s,size:i,step:k});return w}function Zie(e){if(e.startsWith("left"))return["top","bottom"];if(e.startsWith("right"))return["bottom","top"]}function eoe(e,t,n){var r,s;return e?[sie()]:((r=t.floatingOptions)==null?void 0:r.flipOptions)===!1?[]:[rie({crossAxis:!1,fallbackPlacements:Zie(n),padding:20,...(s=t.floatingOptions)==null?void 0:s.flipOptions})]}function toe(e){var F,_,X,V,T;const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:a,portalElement:l,setPositionData:c,setTooltipRef:u,shouldScroll:p,size:d,step:f,target:h,updateState:g}=e,k=m.useRef(null),w=m.useRef({}),y=m.useRef({}),v=f.placement==="center",x=f.placement==="auto",C=m.useMemo(()=>({getBoundingClientRect:()=>({x:window.innerWidth/2,y:window.innerHeight/2,top:window.innerHeight/2,left:window.innerWidth/2,bottom:window.innerHeight/2,right:window.innerWidth/2,width:0,height:0})}),[]),N=m.useMemo(()=>oR(h)?gc(h):void 0,[h]),j=m.useMemo(()=>yc(h),[h]),E=m.useMemo(()=>N?{boundary:N,rootBoundary:"viewport"}:{},[N]),P=v||x?"bottom":f.placement,O=v?"fixed":((F=f.floatingOptions)==null?void 0:F.strategy)??(f.isFixed||j?"fixed":"absolute"),B=m.useMemo(()=>{var ee,ie,G,se;return v?[{name:"center",fn:({rects:te})=>({x:(window.innerWidth-te.floating.width)/2,y:(window.innerHeight-te.floating.height)/2})}]:[nC(({placement:te})=>{var ce;let re="right";te.startsWith("top")?re="top":te.startsWith("bottom")?re="bottom":te.startsWith("left")&&(re="left");const ne=f.spotlightTarget?0:f.spotlightPadding[re];return f.offset+ne+((ce=f.floatingOptions)!=null&&ce.hideArrow?0:f.arrowSize)},[f.offset,f.spotlightPadding,f.spotlightTarget,f.arrowSize,(ee=f.floatingOptions)==null?void 0:ee.hideArrow]),...eoe(x,f,P),nie({padding:10,...E,...(ie=f.floatingOptions)==null?void 0:ie.shiftOptions}),...(G=f.floatingOptions)!=null&&G.hideArrow?[]:[iie({element:k,padding:f.arrowSpacing},[f.arrowSpacing,f.arrowBase])],...((se=f.floatingOptions)==null?void 0:se.middleware)??[]]},[v,f,x,P,E]),W=tC({...v?{elements:{reference:C}}:{},placement:P,strategy:O,middleware:B}),z=tC({strategy:O,placement:f.beaconPlacement??(x||v?"bottom":f.placement),middleware:m.useMemo(()=>{var ee,ie;return[nC(((ie=(ee=f.floatingOptions)==null?void 0:ee.beaconOptions)==null?void 0:ie.offset)??-18)]},[(X=(_=f.floatingOptions)==null?void 0:_.beaconOptions)==null?void 0:X.offset]),whileElementsMounted:Q1});y.current=W.middlewareData,w.current=z.middlewareData,m.useEffect(()=>{var G;const{floating:ee,reference:ie}=W.elements;if(!(!ie||!ee||s!==ze.TOOLTIP))return Q1(ie,ee,W.update,(G=f.floatingOptions)==null?void 0:G.autoUpdate)},[s,W.update,(V=f.floatingOptions)==null?void 0:V.autoUpdate,f.target,W.elements]),m.useEffect(()=>{!v&&h&&W.refs.setReference(h),h&&z.refs.setReference(h)},[z.refs,v,h,W.refs]),m.useEffect(()=>{W.isPositioned&&c("tooltip",{placement:W.placement,x:W.x??0,y:W.y??0,middlewareData:y.current})},[c,W.isPositioned,W.placement,W.x,W.y]),m.useEffect(()=>{z.isPositioned&&c("beacon",{placement:z.placement,x:z.x??0,y:z.y??0,middlewareData:w.current})},[c,z.isPositioned,z.placement,z.x,z.y]);const L=f.zIndex+100,R=m.useCallback(ee=>{ee.type==="mouseenter"&&f.beaconTrigger!=="hover"||g({lifecycle:ze.TOOLTIP_BEFORE,positioned:!1})},[f.beaconTrigger,g]),K=m.useCallback(ee=>{ee&&(W.refs.setFloating(ee),u(ee))},[W.refs,u]),{arrow:D,floater:$}=f.styles;let I=null;if(s===ze.TOOLTIP||s===ze.TOOLTIP_BEFORE){const ee=sC({...$,...W.floatingStyles,zIndex:L,opacity:a&&W.isPositioned?1:0,...!a&&{transition:"none"}});I=it.createElement("div",{ref:K,className:"react-joyride__floater","data-testid":"floater",id:`react-joyride-step-${r}`,style:ee},it.createElement(Qie,{continuous:t,controls:n,index:r,isLastStep:r+1===d,size:d,step:f}),!v&&!((T=f.floatingOptions)!=null&&T.hideArrow)&&it.createElement(Yie,{arrowComponent:f.arrowComponent,arrowRef:k,base:f.arrowBase,placement:W.placement,position:W.middlewareData.arrow,size:f.arrowSize,styles:D}))}else(s===ze.BEACON||s===ze.BEACON_BEFORE)&&(I=it.createElement("div",{ref:z.refs.setFloating,className:"react-joyride__floater","data-testid":"floater-beacon",id:`react-joyride-step-${r}-beacon`,style:sC({...z.floatingStyles,zIndex:L})},it.createElement(Gie,{beaconComponent:f.beaconComponent,continuous:t,index:r,isLastStep:r+1===d,locale:f.locale,nonce:i,onInteract:R,shouldFocus:p,size:d,step:f,styles:f.styles})));return it.createElement(uR,{element:l},I)}function noe(e){const{continuous:t,controls:n,index:r,lifecycle:s,nonce:i,portalElement:a,setPositionData:l,shouldScroll:c,size:u,step:p,updateState:d}=e,[f,h]=m.useState(null);Kie(p.disableFocusTrap?null:f,"[data-action=primary]");const g=xs(p.target),k=s===ze.TOOLTIP;return!lR(p)||!gr.domElement(g)?null:it.createElement(toe,{key:`JoyrideStep-${r}`,continuous:t,controls:n,index:r,lifecycle:s,nonce:i,open:k,portalElement:a,setPositionData:l,setTooltipRef:h,shouldScroll:c,size:u,step:p,target:g,updateState:d})}function roe({controls:e,mergedProps:t,state:n,step:r,store:s}){const{continuous:i,debug:a,nonce:l,portalElement:c,scrollToFirstStep:u}=t,p=Lie(c),{index:d,lifecycle:f,status:h}=n,g=h===Ct.RUNNING,[k,w]=m.useState(!1),y=m.useRef(null),v=(r==null?void 0:r.loaderDelay)??0;m.useEffect(()=>(n.waiting?v===0?w(!0):y.current=setTimeout(()=>{w(!0)},v):w(!1),()=>{y.current&&(clearTimeout(y.current),y.current=null)}),[v,n.waiting]),m.useEffect(()=>{if(!g)return;const N=j=>{!r||f!==ze.TOOLTIP||j.key==="Escape"&&r.dismissKeyAction&&(r.dismissKeyAction==="next"?e.next(ri.KEYBOARD):e.close(ri.KEYBOARD))};return document.body.addEventListener("keydown",N,{passive:!0}),()=>{document.body.removeEventListener("keydown",N)}},[e,g,f,r]);const x=m.useCallback(()=>{(r==null?void 0:r.overlayClickAction)==="close"?e.close(ri.OVERLAY):(r==null?void 0:r.overlayClickAction)==="next"&&e.next(ri.OVERLAY)},[e,r==null?void 0:r.overlayClickAction]);if(!r||!g)return null;const C=n.action===At.START&&!r.skipBeacon&&r.placement!=="center";return it.createElement(it.Fragment,null,f!==ze.INIT&&it.createElement(noe,{...n,continuous:i,controls:e,debug:a,nonce:l,portalElement:p,setPositionData:s.current.setPositionData,shouldScroll:!r.skipScroll&&(d!==0||u),step:r,updateState:s.current.updateState}),it.createElement(uR,{element:p},it.createElement(it.Fragment,null,k&&it.createElement(Die,{nonce:l,step:r}),!C&&it.createElement(Wie,{...r,continuous:i,lifecycle:f,onClickOverlay:x,portalElement:c?p:null,scrolling:n.scrolling,waiting:n.waiting}))))}function soe(e){const{controls:t,failures:n,mergedProps:r,state:s,step:i,store:a}=$ie(e);return{controls:t,failures:n,on:m.useCallback((l,c)=>a.current.on(l,c),[a]),state:m.useMemo(()=>$h(s,"positioned"),[s]),step:i,Tour:Sk()?it.createElement(roe,{controls:t,mergedProps:r,state:s,step:i,store:a}):null}}function ioe(e){const{Tour:t}=soe(e);return t}function ooe(e){return Sk()?it.createElement(ioe,e):null}function aoe(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 loe(e){return[{target:"body",content:e("onboarding:flow.intro"),disableBeacon:!0,placement:"center"}]}function coe(e){return[{target:"body",content:e("onboarding:flow.introEmpty"),disableBeacon:!0,placement:"center"}]}const sp="af:onboarding";function uoe({page:e,hasNodes:t=!1}){const{t:n}=Pr(),[r,s]=m.useState(!1),[i,a]=m.useState([]),l=m.useRef(null),c=m.useMemo(()=>e==="projects"?aoe(n):t?loe(n):coe(n),[e,t,n]);return m.useEffect(()=>{const u=localStorage.getItem(sp),p=u?JSON.parse(u):{};if(p.completed||p[e]){s(!1),a([]);return}localStorage.setItem(sp,JSON.stringify({...p,[e]:!0})),a(c),s(!0)},[e,t,c]),m.useEffect(()=>{if(!r)return;const u=p=>{var g;const d=p.target.closest("button");if(!d||!d.closest(".react-joyride__tooltip"))return;const h=(g=d.textContent)==null?void 0:g.trim();if(h===n("onboarding:done")||h===n("onboarding:startCreate")||h===n("onboarding:skip")){const k=localStorage.getItem(sp)||"{}",w=JSON.parse(k);h===n("onboarding:skip")?(w.projects=!0,w.flow=!0,w.completed=!0):w[e]=!0,localStorage.setItem(sp,JSON.stringify(w)),a([]),s(!1),e==="projects"&&(h===n("onboarding:done")||h===n("onboarding:startCreate"))&&(localStorage.setItem("af:newPipelineGuide","true"),setTimeout(()=>{const y=document.querySelector(".af-create-btn");y&&y.click()},500))}};return document.addEventListener("click",u,!0),()=>document.removeEventListener("click",u,!0)},[r,e,n]),!r||i.length===0?null:o.jsx(ooe,{ref:l,steps:i,run:r,continuous:!0,showSkipButton:!0,showProgress:i.length>1,styles:{options:{primaryColor:"#7c4dff",textColor:"#ffffff",backgroundColor:"#1a1a1a",arrowColor:"#1a1a1a",overlayColor:"rgba(0, 0, 0, 0.4)",zIndex:1e4},tooltip:{borderRadius:"1.5rem",padding:"1.5rem"},buttonNext:{borderRadius:"9999px",padding:"0.625rem 1.5rem"},buttonSkip:{borderRadius:"9999px",color:"#9ecaff"},buttonClose:{display:"none"}},locale:{back:n("onboarding:back"),next:n("onboarding:next"),skip:n("onboarding:skip"),last:n(e==="projects"?"onboarding:startCreate":"onboarding:done")},floaterProps:{disableAnimation:!0},scrollToFirstStep:!0})}function doe(){const{navigate:e,path:t}=xi(),[n,r]=m.useState([]),[s,i]=m.useState(!1);if(m.useEffect(()=>{let p=!1;const d=async()=>{try{const h=await fetch("/api/pipeline-recent-runs");if(!h.ok)return;const g=await h.json();if(p)return;const k=Array.isArray(g.runs)?g.runs:[];r(k.filter(w=>w&&w.status==="running"))}catch{}};d();const f=window.setInterval(d,3e3);return()=>{p=!0,window.clearInterval(f)}},[]),n.length===0)return null;const a=p=>{const d=new URLSearchParams({flowId:p.flowId,flowSource:p.flowSource||"workspace"});e(`/flow?${d.toString()}`),i(!1)},l=t==="/flow"?new URLSearchParams(window.location.search):null,c=(l==null?void 0:l.get("flowId"))||"",u=n.length===1;return o.jsxs("div",{className:"af-run-indicator",role:"status","aria-live":"polite",children:[s&&!u&&o.jsx("div",{className:"af-run-indicator__menu",onMouseLeave:()=>i(!1),children:n.map(p=>o.jsxs("button",{type:"button",className:"af-run-indicator__item"+(p.flowId===c?" af-run-indicator__item--current":""),onClick:()=>a(p),title:`${p.flowId} · ${p.runId}`,children:[o.jsx("span",{className:"af-run-indicator__dot"}),o.jsx("span",{className:"af-run-indicator__flow",children:p.flowId}),o.jsx("span",{className:"af-run-indicator__run",children:p.runId.slice(0,12)})]},`${p.flowId}:${p.runId}`))}),o.jsxs("button",{type:"button",className:"af-run-indicator__btn",onClick:()=>u?a(n[0]):i(p=>!p),title:u?`${n[0].flowId} 运行中,点击跳转`:`${n.length} 个 pipeline 运行中`,children:[o.jsx("span",{className:"af-run-indicator__pulse"}),o.jsx("span",{className:"af-run-indicator__label",children:u?n[0].flowId:`${n.length} running`})]})]})}function dR(e){return e==="/likee-context"||e==="/likee_context"}function foe(){const{navigate:e}=xi();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 poe extends m.Component{constructor(t){super(t),this.state={error:null,info:null}}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,n){console.error("[AgentFlow UI render error]",t,n),this.setState({error:t,info:n})}render(){var r,s,i;if(!this.state.error)return this.props.children;const t=String(((r=this.state.error)==null?void 0:r.stack)||((s=this.state.error)==null?void 0:s.message)||this.state.error),n=String(((i=this.state.info)==null?void 0:i.componentStack)||"");return o.jsx("div",{className:"af-auth-screen",children:o.jsxs("div",{className:"af-auth-panel af-ui-error-panel",children:[o.jsxs("div",{className:"af-auth-brand",children:[o.jsx("span",{className:"material-symbols-outlined",children:"error"}),o.jsxs("div",{children:[o.jsx("h1",{children:"AgentFlow UI Error"}),o.jsx("p",{children:"页面渲染失败,下面是调试堆栈。"})]})]}),o.jsx("pre",{children:t}),n?o.jsx("pre",{children:n}):null]})})}}function hoe({authUser:e}){const{path:t}=xi();return t==="/projects"||t==="/"?o.jsx(sl,{authUser:e}):t==="/nodes"?o.jsx(sl,{authUser:e,resourceKind:"nodes"}):t==="/my-nodes"?o.jsx(sl,{authUser:e,resourceKind:"my-nodes"}):t==="/my-flows"?o.jsx(sl,{authUser:e,resourceKind:"my-flows"}):t==="/skills"?o.jsx(sl,{authUser:e,resourceKind:"skills"}):t==="/workspaces"?o.jsx(Yne,{authUser:e}):t==="/mcps"?o.jsx(One,{}):t==="/schedules"?o.jsx(zne,{}):t==="/node-studio"?o.jsx(Hne,{}):t==="/flow"?o.jsx(foe,{}):t==="/workspace"?o.jsx(ZU,{}):t.startsWith("/display")?o.jsx(vT,{}):t==="/settings"?o.jsx(Cne,{authUser:e}):t==="/admin/usage"?o.jsx(Pne,{authUser:e}):t==="/feedback"?o.jsx(Tne,{authUser:e}):dR(t)?o.jsx($T,{}):o.jsx(sl,{})}function moe({children:e}){const[t,n]=m.useState({loading:!0,authenticated:!1,user:null,setupRequired:!1}),[r,s]=m.useState(""),[i,a]=m.useState(""),[l,c]=m.useState(!1),[u,p]=m.useState(""),d=async()=>{try{const g=await(await fetch("/api/auth/me")).json().catch(()=>({}));n({loading:!1,authenticated:!!g.authenticated,user:g.user||null,setupRequired:!!g.setupRequired}),p(g.error?String(g.error):"")}catch(h){n({loading:!1,authenticated:!1,user:null,setupRequired:!1}),p(String(h.message||h))}};m.useEffect(()=>{d()},[]);const f=async h=>{h.preventDefault(),c(!0),p("");try{const g=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,password:i})}),k=await g.json().catch(()=>({}));if(!g.ok)throw new Error(k.error||"登录失败");n({loading:!1,authenticated:!0,user:k.user||null,setupRequired:!1})}catch(g){p(String(g.message||g))}finally{c(!1)}};return t.loading?o.jsx("div",{className:"af-auth-screen",children:o.jsx("div",{className:"af-auth-panel",children:"Loading..."})}):t.authenticated?e({user:t.user,onLogout:async()=>{await fetch("/api/auth/logout",{method:"POST"}).catch(()=>{}),n({loading:!1,authenticated:!1,user:null,setupRequired:!1})}}):o.jsx("div",{className:"af-auth-screen",children:o.jsxs("form",{className:"af-auth-panel",onSubmit:f,children:[o.jsxs("div",{className:"af-auth-brand",children:[o.jsx("span",{className:"material-symbols-outlined",children:"account_circle"}),o.jsxs("div",{children:[o.jsx("h1",{children:"AgentFlow"}),o.jsx("p",{children:t.setupRequired?"初始化管理员账号":"登录或创建用户"})]})]}),o.jsxs("label",{className:"af-auth-field",children:[o.jsx("span",{children:"用户名"}),o.jsx("input",{value:r,onChange:h=>s(h.target.value),autoComplete:"username",autoFocus:!0})]}),o.jsxs("label",{className:"af-auth-field",children:[o.jsx("span",{children:"密码"}),o.jsx("input",{type:"password",value:i,onChange:h=>a(h.target.value),autoComplete:t.setupRequired?"new-password":"current-password"})]}),u?o.jsx("p",{className:"af-auth-error",children:u}):null,o.jsx("button",{className:"af-auth-submit",type:"submit",disabled:l||!r.trim()||i.length<4,children:l?"处理中...":t.setupRequired?"创建并登录":"登录"})]})})}function goe({authUser:e,onLogout:t}){const{path:n}=xi(),r=n==="/flow"||n==="/workspace";return o.jsxs("div",{className:"af-app",children:[n!=="/settings"?o.jsx(uoe,{page:r?"flow":"projects"}):null,r?null:o.jsx(jL,{authUser:e,onLogout:t}),o.jsx("div",{className:r?"af-main af-main--pipeline":"af-main",children:o.jsx(hoe,{authUser:e})}),o.jsx(doe,{})]})}function yoe(){return o.jsx(poe,{children:o.jsx(oL,{children:o.jsx(xoe,{})})})}function xoe(){const{path:e}=xi();return e.startsWith("/display")?o.jsx(vT,{}):dR(e)?o.jsx($T,{}):o.jsx(moe,{children:({user:t,onLogout:n})=>o.jsx(goe,{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 uC=document.querySelector('link[rel="icon"]');uC&&(uC.href=CE);Sy.createRoot(document.getElementById("root")).render(o.jsx(it.StrictMode,{children:o.jsx(yoe,{})}));
|