@fieldwangai/agentflow 0.1.33 → 0.1.35

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.
Files changed (40) hide show
  1. package/bin/lib/agent-runners.mjs +17 -0
  2. package/bin/lib/composer-agent.mjs +2 -0
  3. package/bin/lib/composer-skill-router.mjs +23 -4
  4. package/bin/lib/git-worktree.mjs +15 -0
  5. package/bin/lib/locales/en.json +3 -7
  6. package/bin/lib/locales/zh.json +2 -6
  7. package/bin/lib/paths.mjs +0 -1
  8. package/bin/lib/scheduler.mjs +8 -3
  9. package/bin/lib/skill-registry.mjs +46 -2
  10. package/bin/lib/ui-server.mjs +896 -22
  11. package/bin/pipeline/build-node-prompt.mjs +27 -1
  12. package/bin/pipeline/pre-process-node.mjs +70 -34
  13. package/builtin/nodes/agent_subAgent.md +2 -0
  14. package/builtin/nodes/control_agent_toBool.md +4 -0
  15. package/builtin/nodes/control_cancelled.md +8 -4
  16. package/builtin/nodes/control_cd_workspace.md +2 -0
  17. package/builtin/nodes/control_delay.md +9 -0
  18. package/builtin/nodes/control_toBool.md +6 -2
  19. package/builtin/nodes/control_user_workspace.md +2 -0
  20. package/builtin/nodes/control_wait_until.md +9 -0
  21. package/builtin/nodes/provide_bool.md +2 -0
  22. package/builtin/nodes/provide_file.md +2 -0
  23. package/builtin/nodes/provide_str.md +2 -0
  24. package/builtin/nodes/tool_get_env.md +4 -0
  25. package/builtin/nodes/tool_git_checkout.md +6 -1
  26. package/builtin/nodes/tool_git_worktree_load.md +7 -2
  27. package/builtin/nodes/tool_git_worktree_unload.md +5 -5
  28. package/builtin/nodes/tool_load_key.md +4 -0
  29. package/builtin/nodes/tool_nodejs.md +4 -0
  30. package/builtin/nodes/tool_print.md +2 -0
  31. package/builtin/nodes/tool_save_key.md +4 -0
  32. package/builtin/nodes/tool_user_ask.md +3 -1
  33. package/builtin/nodes/tool_user_check.md +3 -1
  34. package/builtin/web-ui/dist/assets/index-BzmhleR9.css +1 -0
  35. package/builtin/web-ui/dist/assets/index-DEeZI5V6.js +214 -0
  36. package/builtin/web-ui/dist/index.html +2 -2
  37. package/package.json +1 -1
  38. package/builtin/nodes/control_deadline.md +0 -32
  39. package/builtin/web-ui/dist/assets/index-BWAb27N0.js +0 -198
  40. package/builtin/web-ui/dist/assets/index-DgfSfcjH.css +0 -1
@@ -1,198 +0,0 @@
1
- var ET=Object.defineProperty;var _T=(e,t,n)=>t in e?ET(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var dn=(e,t,n)=>_T(e,typeof t!="symbol"?t+"":t,n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var Tu=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ko(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var v1={exports:{}},Ih={},b1={exports:{}},ht={};/**
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 xd=Symbol.for("react.element"),PT=Symbol.for("react.portal"),IT=Symbol.for("react.fragment"),AT=Symbol.for("react.strict_mode"),TT=Symbol.for("react.profiler"),RT=Symbol.for("react.provider"),LT=Symbol.for("react.context"),OT=Symbol.for("react.forward_ref"),MT=Symbol.for("react.suspense"),$T=Symbol.for("react.memo"),FT=Symbol.for("react.lazy"),j0=Symbol.iterator;function DT(e){return e===null||typeof e!="object"?null:(e=j0&&e[j0]||e["@@iterator"],typeof e=="function"?e:null)}var k1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S1=Object.assign,N1={};function dc(e,t,n){this.props=e,this.context=t,this.refs=N1,this.updater=n||k1}dc.prototype.isReactComponent={};dc.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")};dc.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function j1(){}j1.prototype=dc.prototype;function Vx(e,t,n){this.props=e,this.context=t,this.refs=N1,this.updater=n||k1}var Wx=Vx.prototype=new j1;Wx.constructor=Vx;S1(Wx,dc.prototype);Wx.isPureReactComponent=!0;var C0=Array.isArray,C1=Object.prototype.hasOwnProperty,Kx={current:null},E1={key:!0,ref:!0,__self:!0,__source:!0};function _1(e,t,n){var r,i={},s=null,o=null;if(t!=null)for(r in t.ref!==void 0&&(o=t.ref),t.key!==void 0&&(s=""+t.key),t)C1.call(t,r)&&!E1.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1<l){for(var c=Array(l),d=0;d<l;d++)c[d]=arguments[d+2];i.children=c}if(e&&e.defaultProps)for(r in l=e.defaultProps,l)i[r]===void 0&&(i[r]=l[r]);return{$$typeof:xd,type:e,key:s,ref:o,props:i,_owner:Kx.current}}function zT(e,t){return{$$typeof:xd,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function qx(e){return typeof e=="object"&&e!==null&&e.$$typeof===xd}function BT(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var E0=/\/+/g;function Dm(e,t){return typeof e=="object"&&e!==null&&e.key!=null?BT(""+e.key):t.toString(36)}function op(e,t,n,r,i){var s=typeof e;(s==="undefined"||s==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(s){case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case xd:case PT:o=!0}}if(o)return o=e,i=i(o),e=r===""?"."+Dm(o,0):r,C0(i)?(n="",e!=null&&(n=e.replace(E0,"$&/")+"/"),op(i,t,n,"",function(d){return d})):i!=null&&(qx(i)&&(i=zT(i,n+(!i.key||o&&o.key===i.key?"":(""+i.key).replace(E0,"$&/")+"/")+e)),t.push(i)),1;if(o=0,r=r===""?".":r+":",C0(e))for(var l=0;l<e.length;l++){s=e[l];var c=r+Dm(s,l);o+=op(s,t,n,c,i)}else if(c=DT(e),typeof c=="function")for(e=c.call(e),l=0;!(s=e.next()).done;)s=s.value,c=r+Dm(s,l++),o+=op(s,t,n,c,i);else if(s==="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 o}function gf(e,t,n){if(e==null)return e;var r=[],i=0;return op(e,r,"","",function(s){return t.call(n,s,i++)}),r}function HT(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 Sr={current:null},ap={transition:null},UT={ReactCurrentDispatcher:Sr,ReactCurrentBatchConfig:ap,ReactCurrentOwner:Kx};function P1(){throw Error("act(...) is not supported in production builds of React.")}ht.Children={map:gf,forEach:function(e,t,n){gf(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return gf(e,function(){t++}),t},toArray:function(e){return gf(e,function(t){return t})||[]},only:function(e){if(!qx(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ht.Component=dc;ht.Fragment=IT;ht.Profiler=TT;ht.PureComponent=Vx;ht.StrictMode=AT;ht.Suspense=MT;ht.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=UT;ht.act=P1;ht.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=S1({},e.props),i=e.key,s=e.ref,o=e._owner;if(t!=null){if(t.ref!==void 0&&(s=t.ref,o=Kx.current),t.key!==void 0&&(i=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)C1.call(t,c)&&!E1.hasOwnProperty(c)&&(r[c]=t[c]===void 0&&l!==void 0?l[c]:t[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var d=0;d<c;d++)l[d]=arguments[d+2];r.children=l}return{$$typeof:xd,type:e.type,key:i,ref:s,props:r,_owner:o}};ht.createContext=function(e){return e={$$typeof:LT,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:RT,_context:e},e.Consumer=e};ht.createElement=_1;ht.createFactory=function(e){var t=_1.bind(null,e);return t.type=e,t};ht.createRef=function(){return{current:null}};ht.forwardRef=function(e){return{$$typeof:OT,render:e}};ht.isValidElement=qx;ht.lazy=function(e){return{$$typeof:FT,_payload:{_status:-1,_result:e},_init:HT}};ht.memo=function(e,t){return{$$typeof:$T,type:e,compare:t===void 0?null:t}};ht.startTransition=function(e){var t=ap.transition;ap.transition={};try{e()}finally{ap.transition=t}};ht.unstable_act=P1;ht.useCallback=function(e,t){return Sr.current.useCallback(e,t)};ht.useContext=function(e){return Sr.current.useContext(e)};ht.useDebugValue=function(){};ht.useDeferredValue=function(e){return Sr.current.useDeferredValue(e)};ht.useEffect=function(e,t){return Sr.current.useEffect(e,t)};ht.useId=function(){return Sr.current.useId()};ht.useImperativeHandle=function(e,t,n){return Sr.current.useImperativeHandle(e,t,n)};ht.useInsertionEffect=function(e,t){return Sr.current.useInsertionEffect(e,t)};ht.useLayoutEffect=function(e,t){return Sr.current.useLayoutEffect(e,t)};ht.useMemo=function(e,t){return Sr.current.useMemo(e,t)};ht.useReducer=function(e,t,n){return Sr.current.useReducer(e,t,n)};ht.useRef=function(e){return Sr.current.useRef(e)};ht.useState=function(e){return Sr.current.useState(e)};ht.useSyncExternalStore=function(e,t,n){return Sr.current.useSyncExternalStore(e,t,n)};ht.useTransition=function(){return Sr.current.useTransition()};ht.version="18.3.1";b1.exports=ht;var m=b1.exports;const We=Ko(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 VT=m,WT=Symbol.for("react.element"),KT=Symbol.for("react.fragment"),qT=Object.prototype.hasOwnProperty,YT=VT.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,GT={key:!0,ref:!0,__self:!0,__source:!0};function I1(e,t,n){var r,i={},s=null,o=null;n!==void 0&&(s=""+n),t.key!==void 0&&(s=""+t.key),t.ref!==void 0&&(o=t.ref);for(r in t)qT.call(t,r)&&!GT.hasOwnProperty(r)&&(i[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)i[r]===void 0&&(i[r]=t[r]);return{$$typeof:WT,type:e,key:s,ref:o,props:i,_owner:YT.current}}Ih.Fragment=KT;Ih.jsx=I1;Ih.jsxs=I1;v1.exports=Ih;var a=v1.exports,ny={},A1={exports:{}},ii={},T1={exports:{}},R1={};/**
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(A,T){var C=A.length;A.push(T);e:for(;0<C;){var G=C-1>>>1,Q=A[G];if(0<i(Q,T))A[G]=T,A[C]=Q,C=G;else break e}}function n(A){return A.length===0?null:A[0]}function r(A){if(A.length===0)return null;var T=A[0],C=A.pop();if(C!==T){A[0]=C;e:for(var G=0,Q=A.length,M=Q>>>1;G<M;){var te=2*(G+1)-1,ce=A[te],le=te+1,de=A[le];if(0>i(ce,C))le<Q&&0>i(de,ce)?(A[G]=de,A[le]=C,G=le):(A[G]=ce,A[te]=C,G=te);else if(le<Q&&0>i(de,C))A[G]=de,A[le]=C,G=le;else break e}}return T}function i(A,T){var C=A.sortIndex-T.sortIndex;return C!==0?C:A.id-T.id}if(typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var o=Date,l=o.now();e.unstable_now=function(){return o.now()-l}}var c=[],d=[],u=1,p=null,f=3,h=!1,y=!1,b=!1,S=typeof setTimeout=="function"?setTimeout:null,g=typeof clearTimeout=="function"?clearTimeout:null,v=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(A){for(var T=n(d);T!==null;){if(T.callback===null)r(d);else if(T.startTime<=A)r(d),T.sortIndex=T.expirationTime,t(c,T);else break;T=n(d)}}function k(A){if(b=!1,w(A),!y)if(n(c)!==null)y=!0,z(E);else{var T=n(d);T!==null&&Y(k,T.startTime-A)}}function E(A,T){y=!1,b&&(b=!1,g(O),O=-1),h=!0;var C=f;try{for(w(T),p=n(c);p!==null&&(!(p.expirationTime>T)||A&&!R());){var G=p.callback;if(typeof G=="function"){p.callback=null,f=p.priorityLevel;var Q=G(p.expirationTime<=T);T=e.unstable_now(),typeof Q=="function"?p.callback=Q:p===n(c)&&r(c),w(T)}else r(c);p=n(c)}if(p!==null)var M=!0;else{var te=n(d);te!==null&&Y(k,te.startTime-T),M=!1}return M}finally{p=null,f=C,h=!1}}var j=!1,P=null,O=-1,F=5,W=-1;function R(){return!(e.unstable_now()-W<F)}function I(){if(P!==null){var A=e.unstable_now();W=A;var T=!0;try{T=P(!0,A)}finally{T?q():(j=!1,P=null)}}else j=!1}var q;if(typeof v=="function")q=function(){v(I)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,H=$.port2;$.port1.onmessage=I,q=function(){H.postMessage(null)}}else q=function(){S(I,0)};function z(A){P=A,j||(j=!0,q())}function Y(A,T){O=S(function(){A(e.unstable_now())},T)}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(A){A.callback=null},e.unstable_continueExecution=function(){y||h||(y=!0,z(E))},e.unstable_forceFrameRate=function(A){0>A||125<A?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):F=0<A?Math.floor(1e3/A):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_getFirstCallbackNode=function(){return n(c)},e.unstable_next=function(A){switch(f){case 1:case 2:case 3:var T=3;break;default:T=f}var C=f;f=T;try{return A()}finally{f=C}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(A,T){switch(A){case 1:case 2:case 3:case 4:case 5:break;default:A=3}var C=f;f=A;try{return T()}finally{f=C}},e.unstable_scheduleCallback=function(A,T,C){var G=e.unstable_now();switch(typeof C=="object"&&C!==null?(C=C.delay,C=typeof C=="number"&&0<C?G+C:G):C=G,A){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=C+Q,A={id:u++,callback:T,priorityLevel:A,startTime:C,expirationTime:Q,sortIndex:-1},C>G?(A.sortIndex=C,t(d,A),n(c)===null&&A===n(d)&&(b?(g(O),O=-1):b=!0,Y(k,C-G))):(A.sortIndex=Q,t(c,A),y||h||(y=!0,z(E))),A},e.unstable_shouldYield=R,e.unstable_wrapCallback=function(A){var T=f;return function(){var C=f;f=T;try{return A.apply(this,arguments)}finally{f=C}}}})(R1);T1.exports=R1;var XT=T1.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 JT=m,ni=XT;function xe(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 L1=new Set,Ru={};function Fa(e,t){Vl(e,t),Vl(e+"Capture",t)}function Vl(e,t){for(Ru[e]=t,e=0;e<t.length;e++)L1.add(t[e])}var Ws=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ry=Object.prototype.hasOwnProperty,QT=/^[: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]*$/,_0={},P0={};function ZT(e){return ry.call(P0,e)?!0:ry.call(_0,e)?!1:QT.test(e)?P0[e]=!0:(_0[e]=!0,!1)}function e2(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function t2(e,t,n,r){if(t===null||typeof t>"u"||e2(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 Nr(e,t,n,r,i,s,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var Gn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){Gn[e]=new Nr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];Gn[t]=new Nr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){Gn[e]=new Nr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){Gn[e]=new Nr(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){Gn[e]=new Nr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){Gn[e]=new Nr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){Gn[e]=new Nr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){Gn[e]=new Nr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){Gn[e]=new Nr(e,5,!1,e.toLowerCase(),null,!1,!1)});var Yx=/[\-:]([a-z])/g;function Gx(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(Yx,Gx);Gn[t]=new Nr(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(Yx,Gx);Gn[t]=new Nr(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(Yx,Gx);Gn[t]=new Nr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){Gn[e]=new Nr(e,1,!1,e.toLowerCase(),null,!1,!1)});Gn.xlinkHref=new Nr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){Gn[e]=new Nr(e,1,!1,e.toLowerCase(),null,!0,!0)});function Xx(e,t,n,r){var i=Gn.hasOwnProperty(t)?Gn[t]:null;(i!==null?i.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(t2(t,n,i,r)&&(n=null),r||i===null?ZT(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):i.mustUseProperty?e[i.propertyName]=n===null?i.type===3?!1:"":n:(t=i.attributeName,r=i.attributeNamespace,n===null?e.removeAttribute(t):(i=i.type,n=i===3||i===4&&n===!0?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}var Qs=JT.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,yf=Symbol.for("react.element"),hl=Symbol.for("react.portal"),ml=Symbol.for("react.fragment"),Jx=Symbol.for("react.strict_mode"),iy=Symbol.for("react.profiler"),O1=Symbol.for("react.provider"),M1=Symbol.for("react.context"),Qx=Symbol.for("react.forward_ref"),sy=Symbol.for("react.suspense"),oy=Symbol.for("react.suspense_list"),Zx=Symbol.for("react.memo"),xo=Symbol.for("react.lazy"),$1=Symbol.for("react.offscreen"),I0=Symbol.iterator;function zc(e){return e===null||typeof e!="object"?null:(e=I0&&e[I0]||e["@@iterator"],typeof e=="function"?e:null)}var rn=Object.assign,zm;function su(e){if(zm===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);zm=t&&t[1]||""}return`
34
- `+zm+e}var Bm=!1;function Hm(e,t){if(!e||Bm)return"";Bm=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(d){var r=d}Reflect.construct(e,[],t)}else{try{t.call()}catch(d){r=d}e.call(t.prototype)}else{try{throw Error()}catch(d){r=d}e()}}catch(d){if(d&&r&&typeof d.stack=="string"){for(var i=d.stack.split(`
35
- `),s=r.stack.split(`
36
- `),o=i.length-1,l=s.length-1;1<=o&&0<=l&&i[o]!==s[l];)l--;for(;1<=o&&0<=l;o--,l--)if(i[o]!==s[l]){if(o!==1||l!==1)do if(o--,l--,0>l||i[o]!==s[l]){var c=`
37
- `+i[o].replace(" at new "," at ");return e.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",e.displayName)),c}while(1<=o&&0<=l);break}}}finally{Bm=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?su(e):""}function n2(e){switch(e.tag){case 5:return su(e.type);case 16:return su("Lazy");case 13:return su("Suspense");case 19:return su("SuspenseList");case 0:case 2:case 15:return e=Hm(e.type,!1),e;case 11:return e=Hm(e.type.render,!1),e;case 1:return e=Hm(e.type,!0),e;default:return""}}function ay(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 ml:return"Fragment";case hl:return"Portal";case iy:return"Profiler";case Jx:return"StrictMode";case sy:return"Suspense";case oy:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case M1:return(e.displayName||"Context")+".Consumer";case O1:return(e._context.displayName||"Context")+".Provider";case Qx:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Zx:return t=e.displayName||null,t!==null?t:ay(e.type)||"Memo";case xo:t=e._payload,e=e._init;try{return ay(e(t))}catch{}}return null}function r2(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 ay(t);case 8:return t===Jx?"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 Do(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function F1(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function i2(e){var t=F1(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 i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function xf(e){e._valueTracker||(e._valueTracker=i2(e))}function D1(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=F1(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 ly(e,t){var n=t.checked;return rn({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function A0(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Do(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 z1(e,t){t=t.checked,t!=null&&Xx(e,"checked",t,!1)}function cy(e,t){z1(e,t);var n=Do(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")?uy(e,t.type,n):t.hasOwnProperty("defaultValue")&&uy(e,t.type,Do(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function T0(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 uy(e,t,n){(t!=="number"||Pp(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ou=Array.isArray;function Rl(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Do(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function dy(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(xe(91));return rn({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function R0(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(xe(92));if(ou(n)){if(1<n.length)throw Error(xe(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Do(n)}}function B1(e,t){var n=Do(t.value),r=Do(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 L0(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function H1(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 fy(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?H1(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var wf,U1=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(wf=wf||document.createElement("div"),wf.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=wf.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Lu(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var mu={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},s2=["Webkit","ms","Moz","O"];Object.keys(mu).forEach(function(e){s2.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),mu[t]=mu[e]})});function V1(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||mu.hasOwnProperty(e)&&mu[e]?(""+t).trim():t+"px"}function W1(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=V1(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var o2=rn({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function py(e,t){if(t){if(o2[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(xe(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(xe(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(xe(61))}if(t.style!=null&&typeof t.style!="object")throw Error(xe(62))}}function hy(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 my=null;function ew(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var gy=null,Ll=null,Ol=null;function O0(e){if(e=bd(e)){if(typeof gy!="function")throw Error(xe(280));var t=e.stateNode;t&&(t=Oh(t),gy(e.stateNode,e.type,t))}}function K1(e){Ll?Ol?Ol.push(e):Ol=[e]:Ll=e}function q1(){if(Ll){var e=Ll,t=Ol;if(Ol=Ll=null,O0(e),t)for(e=0;e<t.length;e++)O0(t[e])}}function Y1(e,t){return e(t)}function G1(){}var Um=!1;function X1(e,t,n){if(Um)return e(t,n);Um=!0;try{return Y1(e,t,n)}finally{Um=!1,(Ll!==null||Ol!==null)&&(G1(),q1())}}function Ou(e,t){var n=e.stateNode;if(n===null)return null;var r=Oh(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(xe(231,t,typeof n));return n}var yy=!1;if(Ws)try{var Bc={};Object.defineProperty(Bc,"passive",{get:function(){yy=!0}}),window.addEventListener("test",Bc,Bc),window.removeEventListener("test",Bc,Bc)}catch{yy=!1}function a2(e,t,n,r,i,s,o,l,c){var d=Array.prototype.slice.call(arguments,3);try{t.apply(n,d)}catch(u){this.onError(u)}}var gu=!1,Ip=null,Ap=!1,xy=null,l2={onError:function(e){gu=!0,Ip=e}};function c2(e,t,n,r,i,s,o,l,c){gu=!1,Ip=null,a2.apply(l2,arguments)}function u2(e,t,n,r,i,s,o,l,c){if(c2.apply(this,arguments),gu){if(gu){var d=Ip;gu=!1,Ip=null}else throw Error(xe(198));Ap||(Ap=!0,xy=d)}}function Da(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 J1(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 M0(e){if(Da(e)!==e)throw Error(xe(188))}function d2(e){var t=e.alternate;if(!t){if(t=Da(e),t===null)throw Error(xe(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return M0(i),e;if(s===r)return M0(i),t;s=s.sibling}throw Error(xe(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o){for(l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o)throw Error(xe(189))}}if(n.alternate!==r)throw Error(xe(190))}if(n.tag!==3)throw Error(xe(188));return n.stateNode.current===n?e:t}function Q1(e){return e=d2(e),e!==null?Z1(e):null}function Z1(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Z1(e);if(t!==null)return t;e=e.sibling}return null}var ej=ni.unstable_scheduleCallback,$0=ni.unstable_cancelCallback,f2=ni.unstable_shouldYield,p2=ni.unstable_requestPaint,yn=ni.unstable_now,h2=ni.unstable_getCurrentPriorityLevel,tw=ni.unstable_ImmediatePriority,tj=ni.unstable_UserBlockingPriority,Tp=ni.unstable_NormalPriority,m2=ni.unstable_LowPriority,nj=ni.unstable_IdlePriority,Ah=null,gs=null;function g2(e){if(gs&&typeof gs.onCommitFiberRoot=="function")try{gs.onCommitFiberRoot(Ah,e,void 0,(e.current.flags&128)===128)}catch{}}var Bi=Math.clz32?Math.clz32:w2,y2=Math.log,x2=Math.LN2;function w2(e){return e>>>=0,e===0?32:31-(y2(e)/x2|0)|0}var vf=64,bf=4194304;function au(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 Rp(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var l=o&~i;l!==0?r=au(l):(s&=o,s!==0&&(r=au(s)))}else o=n&~i,o!==0?r=au(o):s!==0&&(r=au(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Bi(t),i=1<<n,r|=e[n],t&=~i;return r}function v2(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 b2(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-Bi(s),l=1<<o,c=i[o];c===-1?(!(l&n)||l&r)&&(i[o]=v2(l,t)):c<=t&&(e.expiredLanes|=l),s&=~l}}function wy(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function rj(){var e=vf;return vf<<=1,!(vf&4194240)&&(vf=64),e}function Vm(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function wd(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Bi(t),e[t]=n}function k2(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 i=31-Bi(n),s=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~s}}function nw(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Bi(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var _t=0;function ij(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var sj,rw,oj,aj,lj,vy=!1,kf=[],_o=null,Po=null,Io=null,Mu=new Map,$u=new Map,bo=[],S2="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 F0(e,t){switch(e){case"focusin":case"focusout":_o=null;break;case"dragenter":case"dragleave":Po=null;break;case"mouseover":case"mouseout":Io=null;break;case"pointerover":case"pointerout":Mu.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":$u.delete(t.pointerId)}}function Hc(e,t,n,r,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},t!==null&&(t=bd(t),t!==null&&rw(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function N2(e,t,n,r,i){switch(t){case"focusin":return _o=Hc(_o,e,t,n,r,i),!0;case"dragenter":return Po=Hc(Po,e,t,n,r,i),!0;case"mouseover":return Io=Hc(Io,e,t,n,r,i),!0;case"pointerover":var s=i.pointerId;return Mu.set(s,Hc(Mu.get(s)||null,e,t,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,$u.set(s,Hc($u.get(s)||null,e,t,n,r,i)),!0}return!1}function cj(e){var t=xa(e.target);if(t!==null){var n=Da(t);if(n!==null){if(t=n.tag,t===13){if(t=J1(n),t!==null){e.blockedOn=t,lj(e.priority,function(){oj(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 lp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=by(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);my=r,n.target.dispatchEvent(r),my=null}else return t=bd(n),t!==null&&rw(t),e.blockedOn=n,!1;t.shift()}return!0}function D0(e,t,n){lp(e)&&n.delete(t)}function j2(){vy=!1,_o!==null&&lp(_o)&&(_o=null),Po!==null&&lp(Po)&&(Po=null),Io!==null&&lp(Io)&&(Io=null),Mu.forEach(D0),$u.forEach(D0)}function Uc(e,t){e.blockedOn===t&&(e.blockedOn=null,vy||(vy=!0,ni.unstable_scheduleCallback(ni.unstable_NormalPriority,j2)))}function Fu(e){function t(i){return Uc(i,e)}if(0<kf.length){Uc(kf[0],e);for(var n=1;n<kf.length;n++){var r=kf[n];r.blockedOn===e&&(r.blockedOn=null)}}for(_o!==null&&Uc(_o,e),Po!==null&&Uc(Po,e),Io!==null&&Uc(Io,e),Mu.forEach(t),$u.forEach(t),n=0;n<bo.length;n++)r=bo[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<bo.length&&(n=bo[0],n.blockedOn===null);)cj(n),n.blockedOn===null&&bo.shift()}var Ml=Qs.ReactCurrentBatchConfig,Lp=!0;function C2(e,t,n,r){var i=_t,s=Ml.transition;Ml.transition=null;try{_t=1,iw(e,t,n,r)}finally{_t=i,Ml.transition=s}}function E2(e,t,n,r){var i=_t,s=Ml.transition;Ml.transition=null;try{_t=4,iw(e,t,n,r)}finally{_t=i,Ml.transition=s}}function iw(e,t,n,r){if(Lp){var i=by(e,t,n,r);if(i===null)eg(e,t,r,Op,n),F0(e,r);else if(N2(i,e,t,n,r))r.stopPropagation();else if(F0(e,r),t&4&&-1<S2.indexOf(e)){for(;i!==null;){var s=bd(i);if(s!==null&&sj(s),s=by(e,t,n,r),s===null&&eg(e,t,r,Op,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else eg(e,t,r,null,n)}}var Op=null;function by(e,t,n,r){if(Op=null,e=ew(r),e=xa(e),e!==null)if(t=Da(e),t===null)e=null;else if(n=t.tag,n===13){if(e=J1(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 Op=e,null}function uj(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(h2()){case tw:return 1;case tj:return 4;case Tp:case m2:return 16;case nj:return 536870912;default:return 16}default:return 16}}var No=null,sw=null,cp=null;function dj(){if(cp)return cp;var e,t=sw,n=t.length,r,i="value"in No?No.value:No.textContent,s=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[s-r];r++);return cp=i.slice(e,1<r?1-r:void 0)}function up(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 Sf(){return!0}function z0(){return!1}function si(e){function t(n,r,i,s,o){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var l in e)e.hasOwnProperty(l)&&(n=e[l],this[l]=n?n(s):s[l]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Sf:z0,this.isPropagationStopped=z0,this}return rn(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Sf)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Sf)},persist:function(){},isPersistent:Sf}),t}var fc={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ow=si(fc),vd=rn({},fc,{view:0,detail:0}),_2=si(vd),Wm,Km,Vc,Th=rn({},vd,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:aw,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!==Vc&&(Vc&&e.type==="mousemove"?(Wm=e.screenX-Vc.screenX,Km=e.screenY-Vc.screenY):Km=Wm=0,Vc=e),Wm)},movementY:function(e){return"movementY"in e?e.movementY:Km}}),B0=si(Th),P2=rn({},Th,{dataTransfer:0}),I2=si(P2),A2=rn({},vd,{relatedTarget:0}),qm=si(A2),T2=rn({},fc,{animationName:0,elapsedTime:0,pseudoElement:0}),R2=si(T2),L2=rn({},fc,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),O2=si(L2),M2=rn({},fc,{data:0}),H0=si(M2),$2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},F2={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"},D2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function z2(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=D2[e])?!!t[e]:!1}function aw(){return z2}var B2=rn({},vd,{key:function(e){if(e.key){var t=$2[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=up(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?F2[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:aw,charCode:function(e){return e.type==="keypress"?up(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?up(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),H2=si(B2),U2=rn({},Th,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),U0=si(U2),V2=rn({},vd,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:aw}),W2=si(V2),K2=rn({},fc,{propertyName:0,elapsedTime:0,pseudoElement:0}),q2=si(K2),Y2=rn({},Th,{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}),G2=si(Y2),X2=[9,13,27,32],lw=Ws&&"CompositionEvent"in window,yu=null;Ws&&"documentMode"in document&&(yu=document.documentMode);var J2=Ws&&"TextEvent"in window&&!yu,fj=Ws&&(!lw||yu&&8<yu&&11>=yu),V0=" ",W0=!1;function pj(e,t){switch(e){case"keyup":return X2.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function hj(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var gl=!1;function Q2(e,t){switch(e){case"compositionend":return hj(t);case"keypress":return t.which!==32?null:(W0=!0,V0);case"textInput":return e=t.data,e===V0&&W0?null:e;default:return null}}function Z2(e,t){if(gl)return e==="compositionend"||!lw&&pj(e,t)?(e=dj(),cp=sw=No=null,gl=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return fj&&t.locale!=="ko"?null:t.data;default:return null}}var eR={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 K0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!eR[e.type]:t==="textarea"}function mj(e,t,n,r){K1(r),t=Mp(t,"onChange"),0<t.length&&(n=new ow("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var xu=null,Du=null;function tR(e){Cj(e,0)}function Rh(e){var t=wl(e);if(D1(t))return e}function nR(e,t){if(e==="change")return t}var gj=!1;if(Ws){var Ym;if(Ws){var Gm="oninput"in document;if(!Gm){var q0=document.createElement("div");q0.setAttribute("oninput","return;"),Gm=typeof q0.oninput=="function"}Ym=Gm}else Ym=!1;gj=Ym&&(!document.documentMode||9<document.documentMode)}function Y0(){xu&&(xu.detachEvent("onpropertychange",yj),Du=xu=null)}function yj(e){if(e.propertyName==="value"&&Rh(Du)){var t=[];mj(t,Du,e,ew(e)),X1(tR,t)}}function rR(e,t,n){e==="focusin"?(Y0(),xu=t,Du=n,xu.attachEvent("onpropertychange",yj)):e==="focusout"&&Y0()}function iR(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Rh(Du)}function sR(e,t){if(e==="click")return Rh(t)}function oR(e,t){if(e==="input"||e==="change")return Rh(t)}function aR(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ui=typeof Object.is=="function"?Object.is:aR;function zu(e,t){if(Ui(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 i=n[r];if(!ry.call(t,i)||!Ui(e[i],t[i]))return!1}return!0}function G0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function X0(e,t){var n=G0(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=G0(n)}}function xj(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?xj(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function wj(){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 cw(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 lR(e){var t=wj(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&xj(n.ownerDocument.documentElement,n)){if(r!==null&&cw(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 i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=X0(n,s);var o=X0(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.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 cR=Ws&&"documentMode"in document&&11>=document.documentMode,yl=null,ky=null,wu=null,Sy=!1;function J0(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Sy||yl==null||yl!==Pp(r)||(r=yl,"selectionStart"in r&&cw(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}),wu&&zu(wu,r)||(wu=r,r=Mp(ky,"onSelect"),0<r.length&&(t=new ow("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=yl)))}function Nf(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var xl={animationend:Nf("Animation","AnimationEnd"),animationiteration:Nf("Animation","AnimationIteration"),animationstart:Nf("Animation","AnimationStart"),transitionend:Nf("Transition","TransitionEnd")},Xm={},vj={};Ws&&(vj=document.createElement("div").style,"AnimationEvent"in window||(delete xl.animationend.animation,delete xl.animationiteration.animation,delete xl.animationstart.animation),"TransitionEvent"in window||delete xl.transitionend.transition);function Lh(e){if(Xm[e])return Xm[e];if(!xl[e])return e;var t=xl[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in vj)return Xm[e]=t[n];return e}var bj=Lh("animationend"),kj=Lh("animationiteration"),Sj=Lh("animationstart"),Nj=Lh("transitionend"),jj=new Map,Q0="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 qo(e,t){jj.set(e,t),Fa(t,[e])}for(var Jm=0;Jm<Q0.length;Jm++){var Qm=Q0[Jm],uR=Qm.toLowerCase(),dR=Qm[0].toUpperCase()+Qm.slice(1);qo(uR,"on"+dR)}qo(bj,"onAnimationEnd");qo(kj,"onAnimationIteration");qo(Sj,"onAnimationStart");qo("dblclick","onDoubleClick");qo("focusin","onFocus");qo("focusout","onBlur");qo(Nj,"onTransitionEnd");Vl("onMouseEnter",["mouseout","mouseover"]);Vl("onMouseLeave",["mouseout","mouseover"]);Vl("onPointerEnter",["pointerout","pointerover"]);Vl("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 lu="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(" "),fR=new Set("cancel close invalid load scroll toggle".split(" ").concat(lu));function Z0(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,u2(r,t,void 0,e),e.currentTarget=null}function Cj(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var s=void 0;if(t)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,d=l.currentTarget;if(l=l.listener,c!==s&&i.isPropagationStopped())break e;Z0(i,l,d),s=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,d=l.currentTarget,l=l.listener,c!==s&&i.isPropagationStopped())break e;Z0(i,l,d),s=c}}}if(Ap)throw e=xy,Ap=!1,xy=null,e}function Ft(e,t){var n=t[_y];n===void 0&&(n=t[_y]=new Set);var r=e+"__bubble";n.has(r)||(Ej(t,e,2,!1),n.add(r))}function Zm(e,t,n){var r=0;t&&(r|=4),Ej(n,e,r,t)}var jf="_reactListening"+Math.random().toString(36).slice(2);function Bu(e){if(!e[jf]){e[jf]=!0,L1.forEach(function(n){n!=="selectionchange"&&(fR.has(n)||Zm(n,!1,e),Zm(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[jf]||(t[jf]=!0,Zm("selectionchange",!1,t))}}function Ej(e,t,n,r){switch(uj(t)){case 1:var i=C2;break;case 4:i=E2;break;default:i=iw}n=i.bind(null,t,n,e),i=void 0,!yy||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function eg(e,t,n,r,i){var s=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===i||l.nodeType===8&&l.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===i||c.nodeType===8&&c.parentNode===i))return;o=o.return}for(;l!==null;){if(o=xa(l),o===null)return;if(c=o.tag,c===5||c===6){r=s=o;continue e}l=l.parentNode}}r=r.return}X1(function(){var d=s,u=ew(n),p=[];e:{var f=jj.get(e);if(f!==void 0){var h=ow,y=e;switch(e){case"keypress":if(up(n)===0)break e;case"keydown":case"keyup":h=H2;break;case"focusin":y="focus",h=qm;break;case"focusout":y="blur",h=qm;break;case"beforeblur":case"afterblur":h=qm;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=B0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=I2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=W2;break;case bj:case kj:case Sj:h=R2;break;case Nj:h=q2;break;case"scroll":h=_2;break;case"wheel":h=G2;break;case"copy":case"cut":case"paste":h=O2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=U0}var b=(t&4)!==0,S=!b&&e==="scroll",g=b?f!==null?f+"Capture":null:f;b=[];for(var v=d,w;v!==null;){w=v;var k=w.stateNode;if(w.tag===5&&k!==null&&(w=k,g!==null&&(k=Ou(v,g),k!=null&&b.push(Hu(v,k,w)))),S)break;v=v.return}0<b.length&&(f=new h(f,y,null,n,u),p.push({event:f,listeners:b}))}}if(!(t&7)){e:{if(f=e==="mouseover"||e==="pointerover",h=e==="mouseout"||e==="pointerout",f&&n!==my&&(y=n.relatedTarget||n.fromElement)&&(xa(y)||y[Ks]))break e;if((h||f)&&(f=u.window===u?u:(f=u.ownerDocument)?f.defaultView||f.parentWindow:window,h?(y=n.relatedTarget||n.toElement,h=d,y=y?xa(y):null,y!==null&&(S=Da(y),y!==S||y.tag!==5&&y.tag!==6)&&(y=null)):(h=null,y=d),h!==y)){if(b=B0,k="onMouseLeave",g="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(b=U0,k="onPointerLeave",g="onPointerEnter",v="pointer"),S=h==null?f:wl(h),w=y==null?f:wl(y),f=new b(k,v+"leave",h,n,u),f.target=S,f.relatedTarget=w,k=null,xa(u)===d&&(b=new b(g,v+"enter",y,n,u),b.target=w,b.relatedTarget=S,k=b),S=k,h&&y)t:{for(b=h,g=y,v=0,w=b;w;w=il(w))v++;for(w=0,k=g;k;k=il(k))w++;for(;0<v-w;)b=il(b),v--;for(;0<w-v;)g=il(g),w--;for(;v--;){if(b===g||g!==null&&b===g.alternate)break t;b=il(b),g=il(g)}b=null}else b=null;h!==null&&eb(p,f,h,b,!1),y!==null&&S!==null&&eb(p,S,y,b,!0)}}e:{if(f=d?wl(d):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var E=nR;else if(K0(f))if(gj)E=oR;else{E=iR;var j=rR}else(h=f.nodeName)&&h.toLowerCase()==="input"&&(f.type==="checkbox"||f.type==="radio")&&(E=sR);if(E&&(E=E(e,d))){mj(p,E,n,u);break e}j&&j(e,f,d),e==="focusout"&&(j=f._wrapperState)&&j.controlled&&f.type==="number"&&uy(f,"number",f.value)}switch(j=d?wl(d):window,e){case"focusin":(K0(j)||j.contentEditable==="true")&&(yl=j,ky=d,wu=null);break;case"focusout":wu=ky=yl=null;break;case"mousedown":Sy=!0;break;case"contextmenu":case"mouseup":case"dragend":Sy=!1,J0(p,n,u);break;case"selectionchange":if(cR)break;case"keydown":case"keyup":J0(p,n,u)}var P;if(lw)e:{switch(e){case"compositionstart":var O="onCompositionStart";break e;case"compositionend":O="onCompositionEnd";break e;case"compositionupdate":O="onCompositionUpdate";break e}O=void 0}else gl?pj(e,n)&&(O="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(O="onCompositionStart");O&&(fj&&n.locale!=="ko"&&(gl||O!=="onCompositionStart"?O==="onCompositionEnd"&&gl&&(P=dj()):(No=u,sw="value"in No?No.value:No.textContent,gl=!0)),j=Mp(d,O),0<j.length&&(O=new H0(O,e,null,n,u),p.push({event:O,listeners:j}),P?O.data=P:(P=hj(n),P!==null&&(O.data=P)))),(P=J2?Q2(e,n):Z2(e,n))&&(d=Mp(d,"onBeforeInput"),0<d.length&&(u=new H0("onBeforeInput","beforeinput",null,n,u),p.push({event:u,listeners:d}),u.data=P))}Cj(p,t)})}function Hu(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Mp(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=Ou(e,n),s!=null&&r.unshift(Hu(e,s,i)),s=Ou(e,t),s!=null&&r.push(Hu(e,s,i))),e=e.return}return r}function il(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function eb(e,t,n,r,i){for(var s=t._reactName,o=[];n!==null&&n!==r;){var l=n,c=l.alternate,d=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&d!==null&&(l=d,i?(c=Ou(n,s),c!=null&&o.unshift(Hu(n,c,l))):i||(c=Ou(n,s),c!=null&&o.push(Hu(n,c,l)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var pR=/\r\n?/g,hR=/\u0000|\uFFFD/g;function tb(e){return(typeof e=="string"?e:""+e).replace(pR,`
38
- `).replace(hR,"")}function Cf(e,t,n){if(t=tb(t),tb(e)!==t&&n)throw Error(xe(425))}function $p(){}var Ny=null,jy=null;function Cy(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Ey=typeof setTimeout=="function"?setTimeout:void 0,mR=typeof clearTimeout=="function"?clearTimeout:void 0,nb=typeof Promise=="function"?Promise:void 0,gR=typeof queueMicrotask=="function"?queueMicrotask:typeof nb<"u"?function(e){return nb.resolve(null).then(e).catch(yR)}:Ey;function yR(e){setTimeout(function(){throw e})}function tg(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),Fu(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);Fu(t)}function Ao(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 rb(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 pc=Math.random().toString(36).slice(2),fs="__reactFiber$"+pc,Uu="__reactProps$"+pc,Ks="__reactContainer$"+pc,_y="__reactEvents$"+pc,xR="__reactListeners$"+pc,wR="__reactHandles$"+pc;function xa(e){var t=e[fs];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Ks]||n[fs]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=rb(e);e!==null;){if(n=e[fs])return n;e=rb(e)}return t}e=n,n=e.parentNode}return null}function bd(e){return e=e[fs]||e[Ks],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function wl(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(xe(33))}function Oh(e){return e[Uu]||null}var Py=[],vl=-1;function Yo(e){return{current:e}}function zt(e){0>vl||(e.current=Py[vl],Py[vl]=null,vl--)}function Lt(e,t){vl++,Py[vl]=e.current,e.current=t}var zo={},cr=Yo(zo),$r=Yo(!1),_a=zo;function Wl(e,t){var n=e.type.contextTypes;if(!n)return zo;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Fr(e){return e=e.childContextTypes,e!=null}function Fp(){zt($r),zt(cr)}function ib(e,t,n){if(cr.current!==zo)throw Error(xe(168));Lt(cr,t),Lt($r,n)}function _j(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(xe(108,r2(e)||"Unknown",i));return rn({},n,r)}function Dp(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||zo,_a=cr.current,Lt(cr,e),Lt($r,$r.current),!0}function sb(e,t,n){var r=e.stateNode;if(!r)throw Error(xe(169));n?(e=_j(e,t,_a),r.__reactInternalMemoizedMergedChildContext=e,zt($r),zt(cr),Lt(cr,e)):zt($r),Lt($r,n)}var $s=null,Mh=!1,ng=!1;function Pj(e){$s===null?$s=[e]:$s.push(e)}function vR(e){Mh=!0,Pj(e)}function Go(){if(!ng&&$s!==null){ng=!0;var e=0,t=_t;try{var n=$s;for(_t=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}$s=null,Mh=!1}catch(i){throw $s!==null&&($s=$s.slice(e+1)),ej(tw,Go),i}finally{_t=t,ng=!1}}return null}var bl=[],kl=0,zp=null,Bp=0,di=[],fi=0,Pa=null,zs=1,Bs="";function ha(e,t){bl[kl++]=Bp,bl[kl++]=zp,zp=e,Bp=t}function Ij(e,t,n){di[fi++]=zs,di[fi++]=Bs,di[fi++]=Pa,Pa=e;var r=zs;e=Bs;var i=32-Bi(r)-1;r&=~(1<<i),n+=1;var s=32-Bi(t)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,zs=1<<32-Bi(t)+i|n<<i|r,Bs=s+e}else zs=1<<s|n<<i|r,Bs=e}function uw(e){e.return!==null&&(ha(e,1),Ij(e,1,0))}function dw(e){for(;e===zp;)zp=bl[--kl],bl[kl]=null,Bp=bl[--kl],bl[kl]=null;for(;e===Pa;)Pa=di[--fi],di[fi]=null,Bs=di[--fi],di[fi]=null,zs=di[--fi],di[fi]=null}var ei=null,Qr=null,qt=!1,Mi=null;function Aj(e,t){var n=mi(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 ob(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,ei=e,Qr=Ao(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,ei=e,Qr=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Pa!==null?{id:zs,overflow:Bs}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=mi(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,ei=e,Qr=null,!0):!1;default:return!1}}function Iy(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Ay(e){if(qt){var t=Qr;if(t){var n=t;if(!ob(e,t)){if(Iy(e))throw Error(xe(418));t=Ao(n.nextSibling);var r=ei;t&&ob(e,t)?Aj(r,n):(e.flags=e.flags&-4097|2,qt=!1,ei=e)}}else{if(Iy(e))throw Error(xe(418));e.flags=e.flags&-4097|2,qt=!1,ei=e}}}function ab(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;ei=e}function Ef(e){if(e!==ei)return!1;if(!qt)return ab(e),qt=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Cy(e.type,e.memoizedProps)),t&&(t=Qr)){if(Iy(e))throw Tj(),Error(xe(418));for(;t;)Aj(e,t),t=Ao(t.nextSibling)}if(ab(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(xe(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Qr=Ao(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Qr=null}}else Qr=ei?Ao(e.stateNode.nextSibling):null;return!0}function Tj(){for(var e=Qr;e;)e=Ao(e.nextSibling)}function Kl(){Qr=ei=null,qt=!1}function fw(e){Mi===null?Mi=[e]:Mi.push(e)}var bR=Qs.ReactCurrentBatchConfig;function Wc(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(xe(309));var r=n.stateNode}if(!r)throw Error(xe(147,e));var i=r,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(o){var l=i.refs;o===null?delete l[s]:l[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(xe(284));if(!n._owner)throw Error(xe(290,e))}return e}function _f(e,t){throw e=Object.prototype.toString.call(t),Error(xe(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function lb(e){var t=e._init;return t(e._payload)}function Rj(e){function t(g,v){if(e){var w=g.deletions;w===null?(g.deletions=[v],g.flags|=16):w.push(v)}}function n(g,v){if(!e)return null;for(;v!==null;)t(g,v),v=v.sibling;return null}function r(g,v){for(g=new Map;v!==null;)v.key!==null?g.set(v.key,v):g.set(v.index,v),v=v.sibling;return g}function i(g,v){return g=Oo(g,v),g.index=0,g.sibling=null,g}function s(g,v,w){return g.index=w,e?(w=g.alternate,w!==null?(w=w.index,w<v?(g.flags|=2,v):w):(g.flags|=2,v)):(g.flags|=1048576,v)}function o(g){return e&&g.alternate===null&&(g.flags|=2),g}function l(g,v,w,k){return v===null||v.tag!==6?(v=cg(w,g.mode,k),v.return=g,v):(v=i(v,w),v.return=g,v)}function c(g,v,w,k){var E=w.type;return E===ml?u(g,v,w.props.children,k,w.key):v!==null&&(v.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===xo&&lb(E)===v.type)?(k=i(v,w.props),k.ref=Wc(g,v,w),k.return=g,k):(k=yp(w.type,w.key,w.props,null,g.mode,k),k.ref=Wc(g,v,w),k.return=g,k)}function d(g,v,w,k){return v===null||v.tag!==4||v.stateNode.containerInfo!==w.containerInfo||v.stateNode.implementation!==w.implementation?(v=ug(w,g.mode,k),v.return=g,v):(v=i(v,w.children||[]),v.return=g,v)}function u(g,v,w,k,E){return v===null||v.tag!==7?(v=Sa(w,g.mode,k,E),v.return=g,v):(v=i(v,w),v.return=g,v)}function p(g,v,w){if(typeof v=="string"&&v!==""||typeof v=="number")return v=cg(""+v,g.mode,w),v.return=g,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case yf:return w=yp(v.type,v.key,v.props,null,g.mode,w),w.ref=Wc(g,null,v),w.return=g,w;case hl:return v=ug(v,g.mode,w),v.return=g,v;case xo:var k=v._init;return p(g,k(v._payload),w)}if(ou(v)||zc(v))return v=Sa(v,g.mode,w,null),v.return=g,v;_f(g,v)}return null}function f(g,v,w,k){var E=v!==null?v.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return E!==null?null:l(g,v,""+w,k);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case yf:return w.key===E?c(g,v,w,k):null;case hl:return w.key===E?d(g,v,w,k):null;case xo:return E=w._init,f(g,v,E(w._payload),k)}if(ou(w)||zc(w))return E!==null?null:u(g,v,w,k,null);_f(g,w)}return null}function h(g,v,w,k,E){if(typeof k=="string"&&k!==""||typeof k=="number")return g=g.get(w)||null,l(v,g,""+k,E);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case yf:return g=g.get(k.key===null?w:k.key)||null,c(v,g,k,E);case hl:return g=g.get(k.key===null?w:k.key)||null,d(v,g,k,E);case xo:var j=k._init;return h(g,v,w,j(k._payload),E)}if(ou(k)||zc(k))return g=g.get(w)||null,u(v,g,k,E,null);_f(v,k)}return null}function y(g,v,w,k){for(var E=null,j=null,P=v,O=v=0,F=null;P!==null&&O<w.length;O++){P.index>O?(F=P,P=null):F=P.sibling;var W=f(g,P,w[O],k);if(W===null){P===null&&(P=F);break}e&&P&&W.alternate===null&&t(g,P),v=s(W,v,O),j===null?E=W:j.sibling=W,j=W,P=F}if(O===w.length)return n(g,P),qt&&ha(g,O),E;if(P===null){for(;O<w.length;O++)P=p(g,w[O],k),P!==null&&(v=s(P,v,O),j===null?E=P:j.sibling=P,j=P);return qt&&ha(g,O),E}for(P=r(g,P);O<w.length;O++)F=h(P,g,O,w[O],k),F!==null&&(e&&F.alternate!==null&&P.delete(F.key===null?O:F.key),v=s(F,v,O),j===null?E=F:j.sibling=F,j=F);return e&&P.forEach(function(R){return t(g,R)}),qt&&ha(g,O),E}function b(g,v,w,k){var E=zc(w);if(typeof E!="function")throw Error(xe(150));if(w=E.call(w),w==null)throw Error(xe(151));for(var j=E=null,P=v,O=v=0,F=null,W=w.next();P!==null&&!W.done;O++,W=w.next()){P.index>O?(F=P,P=null):F=P.sibling;var R=f(g,P,W.value,k);if(R===null){P===null&&(P=F);break}e&&P&&R.alternate===null&&t(g,P),v=s(R,v,O),j===null?E=R:j.sibling=R,j=R,P=F}if(W.done)return n(g,P),qt&&ha(g,O),E;if(P===null){for(;!W.done;O++,W=w.next())W=p(g,W.value,k),W!==null&&(v=s(W,v,O),j===null?E=W:j.sibling=W,j=W);return qt&&ha(g,O),E}for(P=r(g,P);!W.done;O++,W=w.next())W=h(P,g,O,W.value,k),W!==null&&(e&&W.alternate!==null&&P.delete(W.key===null?O:W.key),v=s(W,v,O),j===null?E=W:j.sibling=W,j=W);return e&&P.forEach(function(I){return t(g,I)}),qt&&ha(g,O),E}function S(g,v,w,k){if(typeof w=="object"&&w!==null&&w.type===ml&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case yf:e:{for(var E=w.key,j=v;j!==null;){if(j.key===E){if(E=w.type,E===ml){if(j.tag===7){n(g,j.sibling),v=i(j,w.props.children),v.return=g,g=v;break e}}else if(j.elementType===E||typeof E=="object"&&E!==null&&E.$$typeof===xo&&lb(E)===j.type){n(g,j.sibling),v=i(j,w.props),v.ref=Wc(g,j,w),v.return=g,g=v;break e}n(g,j);break}else t(g,j);j=j.sibling}w.type===ml?(v=Sa(w.props.children,g.mode,k,w.key),v.return=g,g=v):(k=yp(w.type,w.key,w.props,null,g.mode,k),k.ref=Wc(g,v,w),k.return=g,g=k)}return o(g);case hl:e:{for(j=w.key;v!==null;){if(v.key===j)if(v.tag===4&&v.stateNode.containerInfo===w.containerInfo&&v.stateNode.implementation===w.implementation){n(g,v.sibling),v=i(v,w.children||[]),v.return=g,g=v;break e}else{n(g,v);break}else t(g,v);v=v.sibling}v=ug(w,g.mode,k),v.return=g,g=v}return o(g);case xo:return j=w._init,S(g,v,j(w._payload),k)}if(ou(w))return y(g,v,w,k);if(zc(w))return b(g,v,w,k);_f(g,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,v!==null&&v.tag===6?(n(g,v.sibling),v=i(v,w),v.return=g,g=v):(n(g,v),v=cg(w,g.mode,k),v.return=g,g=v),o(g)):n(g,v)}return S}var ql=Rj(!0),Lj=Rj(!1),Hp=Yo(null),Up=null,Sl=null,pw=null;function hw(){pw=Sl=Up=null}function mw(e){var t=Hp.current;zt(Hp),e._currentValue=t}function Ty(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 $l(e,t){Up=e,pw=Sl=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Rr=!0),e.firstContext=null)}function yi(e){var t=e._currentValue;if(pw!==e)if(e={context:e,memoizedValue:t,next:null},Sl===null){if(Up===null)throw Error(xe(308));Sl=e,Up.dependencies={lanes:0,firstContext:e}}else Sl=Sl.next=e;return t}var wa=null;function gw(e){wa===null?wa=[e]:wa.push(e)}function Oj(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,gw(t)):(n.next=i.next,i.next=n),t.interleaved=n,qs(e,r)}function qs(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 wo=!1;function yw(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Mj(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 Vs(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function To(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Nt&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,qs(e,n)}return i=r.interleaved,i===null?(t.next=t,gw(r)):(t.next=i.next,i.next=t),r.interleaved=t,qs(e,n)}function dp(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,nw(e,n)}}function cb(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,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 Vp(e,t,n,r){var i=e.updateQueue;wo=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,l=i.shared.pending;if(l!==null){i.shared.pending=null;var c=l,d=c.next;c.next=null,o===null?s=d:o.next=d,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,l=u.lastBaseUpdate,l!==o&&(l===null?u.firstBaseUpdate=d:l.next=d,u.lastBaseUpdate=c))}if(s!==null){var p=i.baseState;o=0,u=d=c=null,l=s;do{var f=l.lane,h=l.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:h,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var y=e,b=l;switch(f=t,h=n,b.tag){case 1:if(y=b.payload,typeof y=="function"){p=y.call(h,p,f);break e}p=y;break e;case 3:y.flags=y.flags&-65537|128;case 0:if(y=b.payload,f=typeof y=="function"?y.call(h,p,f):y,f==null)break e;p=rn({},p,f);break e;case 2:wo=!0}}l.callback!==null&&l.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[l]:f.push(l))}else h={eventTime:h,lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},u===null?(d=u=h,c=p):u=u.next=h,o|=f;if(l=l.next,l===null){if(l=i.shared.pending,l===null)break;f=l,l=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(!0);if(u===null&&(c=p),i.baseState=c,i.firstBaseUpdate=d,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);Aa|=o,e.lanes=o,e.memoizedState=p}}function ub(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(xe(191,i));i.call(r)}}}var kd={},ys=Yo(kd),Vu=Yo(kd),Wu=Yo(kd);function va(e){if(e===kd)throw Error(xe(174));return e}function xw(e,t){switch(Lt(Wu,t),Lt(Vu,e),Lt(ys,kd),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:fy(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=fy(t,e)}zt(ys),Lt(ys,t)}function Yl(){zt(ys),zt(Vu),zt(Wu)}function $j(e){va(Wu.current);var t=va(ys.current),n=fy(t,e.type);t!==n&&(Lt(Vu,e),Lt(ys,n))}function ww(e){Vu.current===e&&(zt(ys),zt(Vu))}var tn=Yo(0);function Wp(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 rg=[];function vw(){for(var e=0;e<rg.length;e++)rg[e]._workInProgressVersionPrimary=null;rg.length=0}var fp=Qs.ReactCurrentDispatcher,ig=Qs.ReactCurrentBatchConfig,Ia=0,nn=null,Tn=null,Bn=null,Kp=!1,vu=!1,Ku=0,kR=0;function sr(){throw Error(xe(321))}function bw(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Ui(e[n],t[n]))return!1;return!0}function kw(e,t,n,r,i,s){if(Ia=s,nn=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,fp.current=e===null||e.memoizedState===null?CR:ER,e=n(r,i),vu){s=0;do{if(vu=!1,Ku=0,25<=s)throw Error(xe(301));s+=1,Bn=Tn=null,t.updateQueue=null,fp.current=_R,e=n(r,i)}while(vu)}if(fp.current=qp,t=Tn!==null&&Tn.next!==null,Ia=0,Bn=Tn=nn=null,Kp=!1,t)throw Error(xe(300));return e}function Sw(){var e=Ku!==0;return Ku=0,e}function ls(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Bn===null?nn.memoizedState=Bn=e:Bn=Bn.next=e,Bn}function xi(){if(Tn===null){var e=nn.alternate;e=e!==null?e.memoizedState:null}else e=Tn.next;var t=Bn===null?nn.memoizedState:Bn.next;if(t!==null)Bn=t,Tn=e;else{if(e===null)throw Error(xe(310));Tn=e,e={memoizedState:Tn.memoizedState,baseState:Tn.baseState,baseQueue:Tn.baseQueue,queue:Tn.queue,next:null},Bn===null?nn.memoizedState=Bn=e:Bn=Bn.next=e}return Bn}function qu(e,t){return typeof t=="function"?t(e):t}function sg(e){var t=xi(),n=t.queue;if(n===null)throw Error(xe(311));n.lastRenderedReducer=e;var r=Tn,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var l=o=null,c=null,d=s;do{var u=d.lane;if((Ia&u)===u)c!==null&&(c=c.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),r=d.hasEagerState?d.eagerState:e(r,d.action);else{var p={lane:u,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(l=c=p,o=r):c=c.next=p,nn.lanes|=u,Aa|=u}d=d.next}while(d!==null&&d!==s);c===null?o=r:c.next=l,Ui(r,t.memoizedState)||(Rr=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=c,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do s=i.lane,nn.lanes|=s,Aa|=s,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function og(e){var t=xi(),n=t.queue;if(n===null)throw Error(xe(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,s=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do s=e(s,o.action),o=o.next;while(o!==i);Ui(s,t.memoizedState)||(Rr=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function Fj(){}function Dj(e,t){var n=nn,r=xi(),i=t(),s=!Ui(r.memoizedState,i);if(s&&(r.memoizedState=i,Rr=!0),r=r.queue,Nw(Hj.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||Bn!==null&&Bn.memoizedState.tag&1){if(n.flags|=2048,Yu(9,Bj.bind(null,n,r,i,t),void 0,null),Un===null)throw Error(xe(349));Ia&30||zj(n,t,i)}return i}function zj(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 Bj(e,t,n,r){t.value=n,t.getSnapshot=r,Uj(t)&&Vj(e)}function Hj(e,t,n){return n(function(){Uj(t)&&Vj(e)})}function Uj(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Ui(e,n)}catch{return!0}}function Vj(e){var t=qs(e,1);t!==null&&Hi(t,e,1,-1)}function db(e){var t=ls();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:qu,lastRenderedState:e},t.queue=e,e=e.dispatch=jR.bind(null,nn,e),[t.memoizedState,e]}function Yu(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 Wj(){return xi().memoizedState}function pp(e,t,n,r){var i=ls();nn.flags|=e,i.memoizedState=Yu(1|t,n,void 0,r===void 0?null:r)}function $h(e,t,n,r){var i=xi();r=r===void 0?null:r;var s=void 0;if(Tn!==null){var o=Tn.memoizedState;if(s=o.destroy,r!==null&&bw(r,o.deps)){i.memoizedState=Yu(t,n,s,r);return}}nn.flags|=e,i.memoizedState=Yu(1|t,n,s,r)}function fb(e,t){return pp(8390656,8,e,t)}function Nw(e,t){return $h(2048,8,e,t)}function Kj(e,t){return $h(4,2,e,t)}function qj(e,t){return $h(4,4,e,t)}function Yj(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 Gj(e,t,n){return n=n!=null?n.concat([e]):null,$h(4,4,Yj.bind(null,t,e),n)}function jw(){}function Xj(e,t){var n=xi();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&bw(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Jj(e,t){var n=xi();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&bw(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function Qj(e,t,n){return Ia&21?(Ui(n,t)||(n=rj(),nn.lanes|=n,Aa|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,Rr=!0),e.memoizedState=n)}function SR(e,t){var n=_t;_t=n!==0&&4>n?n:4,e(!0);var r=ig.transition;ig.transition={};try{e(!1),t()}finally{_t=n,ig.transition=r}}function Zj(){return xi().memoizedState}function NR(e,t,n){var r=Lo(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},eC(e))tC(t,n);else if(n=Oj(e,t,n,r),n!==null){var i=kr();Hi(n,e,r,i),nC(n,t,r)}}function jR(e,t,n){var r=Lo(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(eC(e))tC(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,l=s(o,n);if(i.hasEagerState=!0,i.eagerState=l,Ui(l,o)){var c=t.interleaved;c===null?(i.next=i,gw(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}finally{}n=Oj(e,t,i,r),n!==null&&(i=kr(),Hi(n,e,r,i),nC(n,t,r))}}function eC(e){var t=e.alternate;return e===nn||t!==null&&t===nn}function tC(e,t){vu=Kp=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function nC(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nw(e,n)}}var qp={readContext:yi,useCallback:sr,useContext:sr,useEffect:sr,useImperativeHandle:sr,useInsertionEffect:sr,useLayoutEffect:sr,useMemo:sr,useReducer:sr,useRef:sr,useState:sr,useDebugValue:sr,useDeferredValue:sr,useTransition:sr,useMutableSource:sr,useSyncExternalStore:sr,useId:sr,unstable_isNewReconciler:!1},CR={readContext:yi,useCallback:function(e,t){return ls().memoizedState=[e,t===void 0?null:t],e},useContext:yi,useEffect:fb,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,pp(4194308,4,Yj.bind(null,t,e),n)},useLayoutEffect:function(e,t){return pp(4194308,4,e,t)},useInsertionEffect:function(e,t){return pp(4,2,e,t)},useMemo:function(e,t){var n=ls();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ls();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=NR.bind(null,nn,e),[r.memoizedState,e]},useRef:function(e){var t=ls();return e={current:e},t.memoizedState=e},useState:db,useDebugValue:jw,useDeferredValue:function(e){return ls().memoizedState=e},useTransition:function(){var e=db(!1),t=e[0];return e=SR.bind(null,e[1]),ls().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=nn,i=ls();if(qt){if(n===void 0)throw Error(xe(407));n=n()}else{if(n=t(),Un===null)throw Error(xe(349));Ia&30||zj(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,fb(Hj.bind(null,r,s,e),[e]),r.flags|=2048,Yu(9,Bj.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=ls(),t=Un.identifierPrefix;if(qt){var n=Bs,r=zs;n=(r&~(1<<32-Bi(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ku++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=kR++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},ER={readContext:yi,useCallback:Xj,useContext:yi,useEffect:Nw,useImperativeHandle:Gj,useInsertionEffect:Kj,useLayoutEffect:qj,useMemo:Jj,useReducer:sg,useRef:Wj,useState:function(){return sg(qu)},useDebugValue:jw,useDeferredValue:function(e){var t=xi();return Qj(t,Tn.memoizedState,e)},useTransition:function(){var e=sg(qu)[0],t=xi().memoizedState;return[e,t]},useMutableSource:Fj,useSyncExternalStore:Dj,useId:Zj,unstable_isNewReconciler:!1},_R={readContext:yi,useCallback:Xj,useContext:yi,useEffect:Nw,useImperativeHandle:Gj,useInsertionEffect:Kj,useLayoutEffect:qj,useMemo:Jj,useReducer:og,useRef:Wj,useState:function(){return og(qu)},useDebugValue:jw,useDeferredValue:function(e){var t=xi();return Tn===null?t.memoizedState=e:Qj(t,Tn.memoizedState,e)},useTransition:function(){var e=og(qu)[0],t=xi().memoizedState;return[e,t]},useMutableSource:Fj,useSyncExternalStore:Dj,useId:Zj,unstable_isNewReconciler:!1};function Ri(e,t){if(e&&e.defaultProps){t=rn({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Ry(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:rn({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Fh={isMounted:function(e){return(e=e._reactInternals)?Da(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=kr(),i=Lo(e),s=Vs(r,i);s.payload=t,n!=null&&(s.callback=n),t=To(e,s,i),t!==null&&(Hi(t,e,i,r),dp(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=kr(),i=Lo(e),s=Vs(r,i);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=To(e,s,i),t!==null&&(Hi(t,e,i,r),dp(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=kr(),r=Lo(e),i=Vs(n,r);i.tag=2,t!=null&&(i.callback=t),t=To(e,i,r),t!==null&&(Hi(t,e,r,n),dp(t,e,r))}};function pb(e,t,n,r,i,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,s,o):t.prototype&&t.prototype.isPureReactComponent?!zu(n,r)||!zu(i,s):!0}function rC(e,t,n){var r=!1,i=zo,s=t.contextType;return typeof s=="object"&&s!==null?s=yi(s):(i=Fr(t)?_a:cr.current,r=t.contextTypes,s=(r=r!=null)?Wl(e,i):zo),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=Fh,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function hb(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&&Fh.enqueueReplaceState(t,t.state,null)}function Ly(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},yw(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=yi(s):(s=Fr(t)?_a:cr.current,i.context=Wl(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Ry(e,t,s,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&Fh.enqueueReplaceState(i,i.state,null),Vp(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Gl(e,t){try{var n="",r=t;do n+=n2(r),r=r.return;while(r);var i=n}catch(s){i=`
39
- Error generating stack: `+s.message+`
40
- `+s.stack}return{value:e,source:t,stack:i,digest:null}}function ag(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Oy(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var PR=typeof WeakMap=="function"?WeakMap:Map;function iC(e,t,n){n=Vs(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Gp||(Gp=!0,Wy=r),Oy(e,t)},n}function sC(e,t,n){n=Vs(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){Oy(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){Oy(e,t),typeof r!="function"&&(Ro===null?Ro=new Set([this]):Ro.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function mb(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new PR;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=UR.bind(null,e,t,n),t.then(e,e))}function gb(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 yb(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,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=Vs(-1,1),t.tag=2,To(n,t,1))),n.lanes|=1),e)}var IR=Qs.ReactCurrentOwner,Rr=!1;function vr(e,t,n,r){t.child=e===null?Lj(t,null,n,r):ql(t,e.child,n,r)}function xb(e,t,n,r,i){n=n.render;var s=t.ref;return $l(t,i),r=kw(e,t,n,r,s,i),n=Sw(),e!==null&&!Rr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Ys(e,t,i)):(qt&&n&&uw(t),t.flags|=1,vr(e,t,r,i),t.child)}function wb(e,t,n,r,i){if(e===null){var s=n.type;return typeof s=="function"&&!Rw(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,oC(e,t,s,r,i)):(e=yp(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&i)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:zu,n(o,r)&&e.ref===t.ref)return Ys(e,t,i)}return t.flags|=1,e=Oo(s,r),e.ref=t.ref,e.return=t,t.child=e}function oC(e,t,n,r,i){if(e!==null){var s=e.memoizedProps;if(zu(s,r)&&e.ref===t.ref)if(Rr=!1,t.pendingProps=r=s,(e.lanes&i)!==0)e.flags&131072&&(Rr=!0);else return t.lanes=e.lanes,Ys(e,t,i)}return My(e,t,n,r,i)}function aC(e,t,n){var r=t.pendingProps,i=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Lt(jl,Gr),Gr|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Lt(jl,Gr),Gr|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,Lt(jl,Gr),Gr|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,Lt(jl,Gr),Gr|=r;return vr(e,t,i,n),t.child}function lC(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function My(e,t,n,r,i){var s=Fr(n)?_a:cr.current;return s=Wl(t,s),$l(t,i),n=kw(e,t,n,r,s,i),r=Sw(),e!==null&&!Rr?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,Ys(e,t,i)):(qt&&r&&uw(t),t.flags|=1,vr(e,t,n,i),t.child)}function vb(e,t,n,r,i){if(Fr(n)){var s=!0;Dp(t)}else s=!1;if($l(t,i),t.stateNode===null)hp(e,t),rC(t,n,r),Ly(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,l=t.memoizedProps;o.props=l;var c=o.context,d=n.contextType;typeof d=="object"&&d!==null?d=yi(d):(d=Fr(n)?_a:cr.current,d=Wl(t,d));var u=n.getDerivedStateFromProps,p=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";p||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||c!==d)&&hb(t,o,r,d),wo=!1;var f=t.memoizedState;o.state=f,Vp(t,r,o,i),c=t.memoizedState,l!==r||f!==c||$r.current||wo?(typeof u=="function"&&(Ry(t,n,u,r),c=t.memoizedState),(l=wo||pb(t,n,l,r,f,c,d))?(p||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=c),o.props=r,o.state=c,o.context=d,r=l):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,Mj(e,t),l=t.memoizedProps,d=t.type===t.elementType?l:Ri(t.type,l),o.props=d,p=t.pendingProps,f=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=yi(c):(c=Fr(n)?_a:cr.current,c=Wl(t,c));var h=n.getDerivedStateFromProps;(u=typeof h=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==p||f!==c)&&hb(t,o,r,c),wo=!1,f=t.memoizedState,o.state=f,Vp(t,r,o,i);var y=t.memoizedState;l!==p||f!==y||$r.current||wo?(typeof h=="function"&&(Ry(t,n,h,r),y=t.memoizedState),(d=wo||pb(t,n,d,r,f,y,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,y,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,y,c)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=y),o.props=r,o.state=y,o.context=c,r=d):(typeof o.componentDidUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return $y(e,t,n,r,s,i)}function $y(e,t,n,r,i,s){lC(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return i&&sb(t,n,!1),Ys(e,t,s);r=t.stateNode,IR.current=t;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=ql(t,e.child,null,s),t.child=ql(t,null,l,s)):vr(e,t,l,s),t.memoizedState=r.state,i&&sb(t,n,!0),t.child}function cC(e){var t=e.stateNode;t.pendingContext?ib(e,t.pendingContext,t.pendingContext!==t.context):t.context&&ib(e,t.context,!1),xw(e,t.containerInfo)}function bb(e,t,n,r,i){return Kl(),fw(i),t.flags|=256,vr(e,t,n,r),t.child}var Fy={dehydrated:null,treeContext:null,retryLane:0};function Dy(e){return{baseLanes:e,cachePool:null,transitions:null}}function uC(e,t,n){var r=t.pendingProps,i=tn.current,s=!1,o=(t.flags&128)!==0,l;if((l=o)||(l=e!==null&&e.memoizedState===null?!1:(i&2)!==0),l?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),Lt(tn,i&1),e===null)return Ay(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):(o=r.children,e=r.fallback,s?(r=t.mode,s=t.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=Bh(o,r,0,null),e=Sa(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=Dy(n),t.memoizedState=Fy,e):Cw(t,o));if(i=e.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return AR(e,t,o,r,l,i,n);if(s){s=r.fallback,o=t.mode,i=e.child,l=i.sibling;var c={mode:"hidden",children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=c,t.deletions=null):(r=Oo(i,c),r.subtreeFlags=i.subtreeFlags&14680064),l!==null?s=Oo(l,s):(s=Sa(s,o,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,o=e.child.memoizedState,o=o===null?Dy(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~n,t.memoizedState=Fy,r}return s=e.child,e=s.sibling,r=Oo(s,{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 Cw(e,t){return t=Bh({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Pf(e,t,n,r){return r!==null&&fw(r),ql(t,e.child,null,n),e=Cw(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function AR(e,t,n,r,i,s,o){if(n)return t.flags&256?(t.flags&=-257,r=ag(Error(xe(422))),Pf(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,i=t.mode,r=Bh({mode:"visible",children:r.children},i,0,null),s=Sa(s,i,o,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&ql(t,e.child,null,o),t.child.memoizedState=Dy(o),t.memoizedState=Fy,s);if(!(t.mode&1))return Pf(e,t,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var l=r.dgst;return r=l,s=Error(xe(419)),r=ag(s,r,void 0),Pf(e,t,o,r)}if(l=(o&e.childLanes)!==0,Rr||l){if(r=Un,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=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:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,qs(e,i),Hi(r,e,i,-1))}return Tw(),r=ag(Error(xe(421))),Pf(e,t,o,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=VR.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,Qr=Ao(i.nextSibling),ei=t,qt=!0,Mi=null,e!==null&&(di[fi++]=zs,di[fi++]=Bs,di[fi++]=Pa,zs=e.id,Bs=e.overflow,Pa=t),t=Cw(t,r.children),t.flags|=4096,t)}function kb(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ty(e.return,t,n)}function lg(e,t,n,r,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function dC(e,t,n){var r=t.pendingProps,i=r.revealOrder,s=r.tail;if(vr(e,t,r.children,n),r=tn.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&&kb(e,n,t);else if(e.tag===19)kb(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(Lt(tn,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&Wp(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),lg(t,!1,i,n,s);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Wp(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}lg(t,!0,n,null,s);break;case"together":lg(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function hp(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ys(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Aa|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(xe(153));if(t.child!==null){for(e=t.child,n=Oo(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Oo(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function TR(e,t,n){switch(t.tag){case 3:cC(t),Kl();break;case 5:$j(t);break;case 1:Fr(t.type)&&Dp(t);break;case 4:xw(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;Lt(Hp,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Lt(tn,tn.current&1),t.flags|=128,null):n&t.child.childLanes?uC(e,t,n):(Lt(tn,tn.current&1),e=Ys(e,t,n),e!==null?e.sibling:null);Lt(tn,tn.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return dC(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Lt(tn,tn.current),r)break;return null;case 22:case 23:return t.lanes=0,aC(e,t,n)}return Ys(e,t,n)}var fC,zy,pC,hC;fC=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}};zy=function(){};pC=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,va(ys.current);var s=null;switch(n){case"input":i=ly(e,i),r=ly(e,r),s=[];break;case"select":i=rn({},i,{value:void 0}),r=rn({},r,{value:void 0}),s=[];break;case"textarea":i=dy(e,i),r=dy(e,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=$p)}py(n,r);var o;n=null;for(d in i)if(!r.hasOwnProperty(d)&&i.hasOwnProperty(d)&&i[d]!=null)if(d==="style"){var l=i[d];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(Ru.hasOwnProperty(d)?s||(s=[]):(s=s||[]).push(d,null));for(d in r){var c=r[d];if(l=i!=null?i[d]:void 0,r.hasOwnProperty(d)&&c!==l&&(c!=null||l!=null))if(d==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(s||(s=[]),s.push(d,n)),n=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(s=s||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(s=s||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(Ru.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&Ft("scroll",e),s||l===c||(s=[])):(s=s||[]).push(d,c))}n&&(s=s||[]).push("style",n);var d=s;(t.updateQueue=d)&&(t.flags|=4)}};hC=function(e,t,n,r){n!==r&&(t.flags|=4)};function Kc(e,t){if(!qt)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 or(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function RR(e,t,n){var r=t.pendingProps;switch(dw(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return or(t),null;case 1:return Fr(t.type)&&Fp(),or(t),null;case 3:return r=t.stateNode,Yl(),zt($r),zt(cr),vw(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Ef(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Mi!==null&&(Yy(Mi),Mi=null))),zy(e,t),or(t),null;case 5:ww(t);var i=va(Wu.current);if(n=t.type,e!==null&&t.stateNode!=null)pC(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(xe(166));return or(t),null}if(e=va(ys.current),Ef(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[fs]=t,r[Uu]=s,e=(t.mode&1)!==0,n){case"dialog":Ft("cancel",r),Ft("close",r);break;case"iframe":case"object":case"embed":Ft("load",r);break;case"video":case"audio":for(i=0;i<lu.length;i++)Ft(lu[i],r);break;case"source":Ft("error",r);break;case"img":case"image":case"link":Ft("error",r),Ft("load",r);break;case"details":Ft("toggle",r);break;case"input":A0(r,s),Ft("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},Ft("invalid",r);break;case"textarea":R0(r,s),Ft("invalid",r)}py(n,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var l=s[o];o==="children"?typeof l=="string"?r.textContent!==l&&(s.suppressHydrationWarning!==!0&&Cf(r.textContent,l,e),i=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(s.suppressHydrationWarning!==!0&&Cf(r.textContent,l,e),i=["children",""+l]):Ru.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&Ft("scroll",r)}switch(n){case"input":xf(r),T0(r,s,!0);break;case"textarea":xf(r),L0(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=$p)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=H1(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[fs]=t,e[Uu]=r,fC(e,t,!1,!1),t.stateNode=e;e:{switch(o=hy(n,r),n){case"dialog":Ft("cancel",e),Ft("close",e),i=r;break;case"iframe":case"object":case"embed":Ft("load",e),i=r;break;case"video":case"audio":for(i=0;i<lu.length;i++)Ft(lu[i],e);i=r;break;case"source":Ft("error",e),i=r;break;case"img":case"image":case"link":Ft("error",e),Ft("load",e),i=r;break;case"details":Ft("toggle",e),i=r;break;case"input":A0(e,r),i=ly(e,r),Ft("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=rn({},r,{value:void 0}),Ft("invalid",e);break;case"textarea":R0(e,r),i=dy(e,r),Ft("invalid",e);break;default:i=r}py(n,i),l=i;for(s in l)if(l.hasOwnProperty(s)){var c=l[s];s==="style"?W1(e,c):s==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&U1(e,c)):s==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Lu(e,c):typeof c=="number"&&Lu(e,""+c):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(Ru.hasOwnProperty(s)?c!=null&&s==="onScroll"&&Ft("scroll",e):c!=null&&Xx(e,s,c,o))}switch(n){case"input":xf(e),T0(e,r,!1);break;case"textarea":xf(e),L0(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Do(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?Rl(e,!!r.multiple,s,!1):r.defaultValue!=null&&Rl(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=$p)}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 or(t),null;case 6:if(e&&t.stateNode!=null)hC(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(xe(166));if(n=va(Wu.current),va(ys.current),Ef(t)){if(r=t.stateNode,n=t.memoizedProps,r[fs]=t,(s=r.nodeValue!==n)&&(e=ei,e!==null))switch(e.tag){case 3:Cf(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Cf(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[fs]=t,t.stateNode=r}return or(t),null;case 13:if(zt(tn),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(qt&&Qr!==null&&t.mode&1&&!(t.flags&128))Tj(),Kl(),t.flags|=98560,s=!1;else if(s=Ef(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(xe(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(xe(317));s[fs]=t}else Kl(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;or(t),s=!1}else Mi!==null&&(Yy(Mi),Mi=null),s=!0;if(!s)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||tn.current&1?Ln===0&&(Ln=3):Tw())),t.updateQueue!==null&&(t.flags|=4),or(t),null);case 4:return Yl(),zy(e,t),e===null&&Bu(t.stateNode.containerInfo),or(t),null;case 10:return mw(t.type._context),or(t),null;case 17:return Fr(t.type)&&Fp(),or(t),null;case 19:if(zt(tn),s=t.memoizedState,s===null)return or(t),null;if(r=(t.flags&128)!==0,o=s.rendering,o===null)if(r)Kc(s,!1);else{if(Ln!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Wp(e),o!==null){for(t.flags|=128,Kc(s,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,e=o.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Lt(tn,tn.current&1|2),t.child}e=e.sibling}s.tail!==null&&yn()>Xl&&(t.flags|=128,r=!0,Kc(s,!1),t.lanes=4194304)}else{if(!r)if(e=Wp(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Kc(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!qt)return or(t),null}else 2*yn()-s.renderingStartTime>Xl&&n!==1073741824&&(t.flags|=128,r=!0,Kc(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=yn(),t.sibling=null,n=tn.current,Lt(tn,r?n&1|2:n&1),t):(or(t),null);case 22:case 23:return Aw(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Gr&1073741824&&(or(t),t.subtreeFlags&6&&(t.flags|=8192)):or(t),null;case 24:return null;case 25:return null}throw Error(xe(156,t.tag))}function LR(e,t){switch(dw(t),t.tag){case 1:return Fr(t.type)&&Fp(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Yl(),zt($r),zt(cr),vw(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return ww(t),null;case 13:if(zt(tn),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(xe(340));Kl()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return zt(tn),null;case 4:return Yl(),null;case 10:return mw(t.type._context),null;case 22:case 23:return Aw(),null;case 24:return null;default:return null}}var If=!1,ar=!1,OR=typeof WeakSet=="function"?WeakSet:Set,Le=null;function Nl(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){fn(e,t,r)}else n.current=null}function By(e,t,n){try{n()}catch(r){fn(e,t,r)}}var Sb=!1;function MR(e,t){if(Ny=Lp,e=wj(),cw(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 i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,d=0,u=0,p=e,f=null;t:for(;;){for(var h;p!==n||i!==0&&p.nodeType!==3||(l=o+i),p!==s||r!==0&&p.nodeType!==3||(c=o+r),p.nodeType===3&&(o+=p.nodeValue.length),(h=p.firstChild)!==null;)f=p,p=h;for(;;){if(p===e)break t;if(f===n&&++d===i&&(l=o),f===s&&++u===r&&(c=o),(h=p.nextSibling)!==null)break;p=f,f=p.parentNode}p=h}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(jy={focusedElem:e,selectionRange:n},Lp=!1,Le=t;Le!==null;)if(t=Le,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Le=e;else for(;Le!==null;){t=Le;try{var y=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(y!==null){var b=y.memoizedProps,S=y.memoizedState,g=t.stateNode,v=g.getSnapshotBeforeUpdate(t.elementType===t.type?b:Ri(t.type,b),S);g.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(xe(163))}}catch(k){fn(t,t.return,k)}if(e=t.sibling,e!==null){e.return=t.return,Le=e;break}Le=t.return}return y=Sb,Sb=!1,y}function bu(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&By(t,n,s)}i=i.next}while(i!==r)}}function Dh(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 Hy(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 mC(e){var t=e.alternate;t!==null&&(e.alternate=null,mC(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[fs],delete t[Uu],delete t[_y],delete t[xR],delete t[wR])),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 gC(e){return e.tag===5||e.tag===3||e.tag===4}function Nb(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||gC(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 Uy(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=$p));else if(r!==4&&(e=e.child,e!==null))for(Uy(e,t,n),e=e.sibling;e!==null;)Uy(e,t,n),e=e.sibling}function Vy(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(Vy(e,t,n),e=e.sibling;e!==null;)Vy(e,t,n),e=e.sibling}var Kn=null,Li=!1;function fo(e,t,n){for(n=n.child;n!==null;)yC(e,t,n),n=n.sibling}function yC(e,t,n){if(gs&&typeof gs.onCommitFiberUnmount=="function")try{gs.onCommitFiberUnmount(Ah,n)}catch{}switch(n.tag){case 5:ar||Nl(n,t);case 6:var r=Kn,i=Li;Kn=null,fo(e,t,n),Kn=r,Li=i,Kn!==null&&(Li?(e=Kn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Kn.removeChild(n.stateNode));break;case 18:Kn!==null&&(Li?(e=Kn,n=n.stateNode,e.nodeType===8?tg(e.parentNode,n):e.nodeType===1&&tg(e,n),Fu(e)):tg(Kn,n.stateNode));break;case 4:r=Kn,i=Li,Kn=n.stateNode.containerInfo,Li=!0,fo(e,t,n),Kn=r,Li=i;break;case 0:case 11:case 14:case 15:if(!ar&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&By(n,t,o),i=i.next}while(i!==r)}fo(e,t,n);break;case 1:if(!ar&&(Nl(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){fn(n,t,l)}fo(e,t,n);break;case 21:fo(e,t,n);break;case 22:n.mode&1?(ar=(r=ar)||n.memoizedState!==null,fo(e,t,n),ar=r):fo(e,t,n);break;default:fo(e,t,n)}}function jb(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new OR),t.forEach(function(r){var i=WR.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Ai(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=e,o=t,l=o;e:for(;l!==null;){switch(l.tag){case 5:Kn=l.stateNode,Li=!1;break e;case 3:Kn=l.stateNode.containerInfo,Li=!0;break e;case 4:Kn=l.stateNode.containerInfo,Li=!0;break e}l=l.return}if(Kn===null)throw Error(xe(160));yC(s,o,i),Kn=null,Li=!1;var c=i.alternate;c!==null&&(c.return=null),i.return=null}catch(d){fn(i,t,d)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)xC(t,e),t=t.sibling}function xC(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Ai(t,e),as(e),r&4){try{bu(3,e,e.return),Dh(3,e)}catch(b){fn(e,e.return,b)}try{bu(5,e,e.return)}catch(b){fn(e,e.return,b)}}break;case 1:Ai(t,e),as(e),r&512&&n!==null&&Nl(n,n.return);break;case 5:if(Ai(t,e),as(e),r&512&&n!==null&&Nl(n,n.return),e.flags&32){var i=e.stateNode;try{Lu(i,"")}catch(b){fn(e,e.return,b)}}if(r&4&&(i=e.stateNode,i!=null)){var s=e.memoizedProps,o=n!==null?n.memoizedProps:s,l=e.type,c=e.updateQueue;if(e.updateQueue=null,c!==null)try{l==="input"&&s.type==="radio"&&s.name!=null&&z1(i,s),hy(l,o);var d=hy(l,s);for(o=0;o<c.length;o+=2){var u=c[o],p=c[o+1];u==="style"?W1(i,p):u==="dangerouslySetInnerHTML"?U1(i,p):u==="children"?Lu(i,p):Xx(i,u,p,d)}switch(l){case"input":cy(i,s);break;case"textarea":B1(i,s);break;case"select":var f=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var h=s.value;h!=null?Rl(i,!!s.multiple,h,!1):f!==!!s.multiple&&(s.defaultValue!=null?Rl(i,!!s.multiple,s.defaultValue,!0):Rl(i,!!s.multiple,s.multiple?[]:"",!1))}i[Uu]=s}catch(b){fn(e,e.return,b)}}break;case 6:if(Ai(t,e),as(e),r&4){if(e.stateNode===null)throw Error(xe(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(b){fn(e,e.return,b)}}break;case 3:if(Ai(t,e),as(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Fu(t.containerInfo)}catch(b){fn(e,e.return,b)}break;case 4:Ai(t,e),as(e);break;case 13:Ai(t,e),as(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Pw=yn())),r&4&&jb(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(ar=(d=ar)||u,Ai(t,e),ar=d):Ai(t,e),as(e),r&8192){if(d=e.memoizedState!==null,(e.stateNode.isHidden=d)&&!u&&e.mode&1)for(Le=e,u=e.child;u!==null;){for(p=Le=u;Le!==null;){switch(f=Le,h=f.child,f.tag){case 0:case 11:case 14:case 15:bu(4,f,f.return);break;case 1:Nl(f,f.return);var y=f.stateNode;if(typeof y.componentWillUnmount=="function"){r=f,n=f.return;try{t=r,y.props=t.memoizedProps,y.state=t.memoizedState,y.componentWillUnmount()}catch(b){fn(r,n,b)}}break;case 5:Nl(f,f.return);break;case 22:if(f.memoizedState!==null){Eb(p);continue}}h!==null?(h.return=f,Le=h):Eb(p)}u=u.sibling}e:for(u=null,p=e;;){if(p.tag===5){if(u===null){u=p;try{i=p.stateNode,d?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(l=p.stateNode,c=p.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=V1("display",o))}catch(b){fn(e,e.return,b)}}}else if(p.tag===6){if(u===null)try{p.stateNode.nodeValue=d?"":p.memoizedProps}catch(b){fn(e,e.return,b)}}else if((p.tag!==22&&p.tag!==23||p.memoizedState===null||p===e)&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===e)break e;for(;p.sibling===null;){if(p.return===null||p.return===e)break e;u===p&&(u=null),p=p.return}u===p&&(u=null),p.sibling.return=p.return,p=p.sibling}}break;case 19:Ai(t,e),as(e),r&4&&jb(e);break;case 21:break;default:Ai(t,e),as(e)}}function as(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(gC(n)){var r=n;break e}n=n.return}throw Error(xe(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(Lu(i,""),r.flags&=-33);var s=Nb(e);Vy(e,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,l=Nb(e);Uy(e,l,o);break;default:throw Error(xe(161))}}catch(c){fn(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function $R(e,t,n){Le=e,wC(e)}function wC(e,t,n){for(var r=(e.mode&1)!==0;Le!==null;){var i=Le,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||If;if(!o){var l=i.alternate,c=l!==null&&l.memoizedState!==null||ar;l=If;var d=ar;if(If=o,(ar=c)&&!d)for(Le=i;Le!==null;)o=Le,c=o.child,o.tag===22&&o.memoizedState!==null?_b(i):c!==null?(c.return=o,Le=c):_b(i);for(;s!==null;)Le=s,wC(s),s=s.sibling;Le=i,If=l,ar=d}Cb(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,Le=s):Cb(e)}}function Cb(e){for(;Le!==null;){var t=Le;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:ar||Dh(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!ar)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:Ri(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&ub(t,s,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}ub(t,o,n)}break;case 5:var l=t.stateNode;if(n===null&&t.flags&4){n=l;var c=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var d=t.alternate;if(d!==null){var u=d.memoizedState;if(u!==null){var p=u.dehydrated;p!==null&&Fu(p)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(xe(163))}ar||t.flags&512&&Hy(t)}catch(f){fn(t,t.return,f)}}if(t===e){Le=null;break}if(n=t.sibling,n!==null){n.return=t.return,Le=n;break}Le=t.return}}function Eb(e){for(;Le!==null;){var t=Le;if(t===e){Le=null;break}var n=t.sibling;if(n!==null){n.return=t.return,Le=n;break}Le=t.return}}function _b(e){for(;Le!==null;){var t=Le;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{Dh(4,t)}catch(c){fn(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(c){fn(t,i,c)}}var s=t.return;try{Hy(t)}catch(c){fn(t,s,c)}break;case 5:var o=t.return;try{Hy(t)}catch(c){fn(t,o,c)}}}catch(c){fn(t,t.return,c)}if(t===e){Le=null;break}var l=t.sibling;if(l!==null){l.return=t.return,Le=l;break}Le=t.return}}var FR=Math.ceil,Yp=Qs.ReactCurrentDispatcher,Ew=Qs.ReactCurrentOwner,gi=Qs.ReactCurrentBatchConfig,Nt=0,Un=null,bn=null,qn=0,Gr=0,jl=Yo(0),Ln=0,Gu=null,Aa=0,zh=0,_w=0,ku=null,Ar=null,Pw=0,Xl=1/0,Ms=null,Gp=!1,Wy=null,Ro=null,Af=!1,jo=null,Xp=0,Su=0,Ky=null,mp=-1,gp=0;function kr(){return Nt&6?yn():mp!==-1?mp:mp=yn()}function Lo(e){return e.mode&1?Nt&2&&qn!==0?qn&-qn:bR.transition!==null?(gp===0&&(gp=rj()),gp):(e=_t,e!==0||(e=window.event,e=e===void 0?16:uj(e.type)),e):1}function Hi(e,t,n,r){if(50<Su)throw Su=0,Ky=null,Error(xe(185));wd(e,n,r),(!(Nt&2)||e!==Un)&&(e===Un&&(!(Nt&2)&&(zh|=n),Ln===4&&ko(e,qn)),Dr(e,r),n===1&&Nt===0&&!(t.mode&1)&&(Xl=yn()+500,Mh&&Go()))}function Dr(e,t){var n=e.callbackNode;b2(e,t);var r=Rp(e,e===Un?qn:0);if(r===0)n!==null&&$0(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&$0(n),t===1)e.tag===0?vR(Pb.bind(null,e)):Pj(Pb.bind(null,e)),gR(function(){!(Nt&6)&&Go()}),n=null;else{switch(ij(r)){case 1:n=tw;break;case 4:n=tj;break;case 16:n=Tp;break;case 536870912:n=nj;break;default:n=Tp}n=EC(n,vC.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function vC(e,t){if(mp=-1,gp=0,Nt&6)throw Error(xe(327));var n=e.callbackNode;if(Fl()&&e.callbackNode!==n)return null;var r=Rp(e,e===Un?qn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Jp(e,r);else{t=r;var i=Nt;Nt|=2;var s=kC();(Un!==e||qn!==t)&&(Ms=null,Xl=yn()+500,ka(e,t));do try{BR();break}catch(l){bC(e,l)}while(!0);hw(),Yp.current=s,Nt=i,bn!==null?t=0:(Un=null,qn=0,t=Ln)}if(t!==0){if(t===2&&(i=wy(e),i!==0&&(r=i,t=qy(e,i))),t===1)throw n=Gu,ka(e,0),ko(e,r),Dr(e,yn()),n;if(t===6)ko(e,r);else{if(i=e.current.alternate,!(r&30)&&!DR(i)&&(t=Jp(e,r),t===2&&(s=wy(e),s!==0&&(r=s,t=qy(e,s))),t===1))throw n=Gu,ka(e,0),ko(e,r),Dr(e,yn()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(xe(345));case 2:ma(e,Ar,Ms);break;case 3:if(ko(e,r),(r&130023424)===r&&(t=Pw+500-yn(),10<t)){if(Rp(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){kr(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=Ey(ma.bind(null,e,Ar,Ms),t);break}ma(e,Ar,Ms);break;case 4:if(ko(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var o=31-Bi(r);s=1<<o,o=t[o],o>i&&(i=o),r&=~s}if(r=i,r=yn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*FR(r/1960))-r,10<r){e.timeoutHandle=Ey(ma.bind(null,e,Ar,Ms),r);break}ma(e,Ar,Ms);break;case 5:ma(e,Ar,Ms);break;default:throw Error(xe(329))}}}return Dr(e,yn()),e.callbackNode===n?vC.bind(null,e):null}function qy(e,t){var n=ku;return e.current.memoizedState.isDehydrated&&(ka(e,t).flags|=256),e=Jp(e,t),e!==2&&(t=Ar,Ar=n,t!==null&&Yy(t)),e}function Yy(e){Ar===null?Ar=e:Ar.push.apply(Ar,e)}function DR(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 i=n[r],s=i.getSnapshot;i=i.value;try{if(!Ui(s(),i))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 ko(e,t){for(t&=~_w,t&=~zh,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Bi(t),r=1<<n;e[n]=-1,t&=~r}}function Pb(e){if(Nt&6)throw Error(xe(327));Fl();var t=Rp(e,0);if(!(t&1))return Dr(e,yn()),null;var n=Jp(e,t);if(e.tag!==0&&n===2){var r=wy(e);r!==0&&(t=r,n=qy(e,r))}if(n===1)throw n=Gu,ka(e,0),ko(e,t),Dr(e,yn()),n;if(n===6)throw Error(xe(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,ma(e,Ar,Ms),Dr(e,yn()),null}function Iw(e,t){var n=Nt;Nt|=1;try{return e(t)}finally{Nt=n,Nt===0&&(Xl=yn()+500,Mh&&Go())}}function Ta(e){jo!==null&&jo.tag===0&&!(Nt&6)&&Fl();var t=Nt;Nt|=1;var n=gi.transition,r=_t;try{if(gi.transition=null,_t=1,e)return e()}finally{_t=r,gi.transition=n,Nt=t,!(Nt&6)&&Go()}}function Aw(){Gr=jl.current,zt(jl)}function ka(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,mR(n)),bn!==null)for(n=bn.return;n!==null;){var r=n;switch(dw(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Fp();break;case 3:Yl(),zt($r),zt(cr),vw();break;case 5:ww(r);break;case 4:Yl();break;case 13:zt(tn);break;case 19:zt(tn);break;case 10:mw(r.type._context);break;case 22:case 23:Aw()}n=n.return}if(Un=e,bn=e=Oo(e.current,null),qn=Gr=t,Ln=0,Gu=null,_w=zh=Aa=0,Ar=ku=null,wa!==null){for(t=0;t<wa.length;t++)if(n=wa[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var o=s.next;s.next=i,r.next=o}n.pending=r}wa=null}return e}function bC(e,t){do{var n=bn;try{if(hw(),fp.current=qp,Kp){for(var r=nn.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Kp=!1}if(Ia=0,Bn=Tn=nn=null,vu=!1,Ku=0,Ew.current=null,n===null||n.return===null){Ln=1,Gu=t,bn=null;break}e:{var s=e,o=n.return,l=n,c=t;if(t=qn,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,u=l,p=u.tag;if(!(u.mode&1)&&(p===0||p===11||p===15)){var f=u.alternate;f?(u.updateQueue=f.updateQueue,u.memoizedState=f.memoizedState,u.lanes=f.lanes):(u.updateQueue=null,u.memoizedState=null)}var h=gb(o);if(h!==null){h.flags&=-257,yb(h,o,l,s,t),h.mode&1&&mb(s,d,t),t=h,c=d;var y=t.updateQueue;if(y===null){var b=new Set;b.add(c),t.updateQueue=b}else y.add(c);break e}else{if(!(t&1)){mb(s,d,t),Tw();break e}c=Error(xe(426))}}else if(qt&&l.mode&1){var S=gb(o);if(S!==null){!(S.flags&65536)&&(S.flags|=256),yb(S,o,l,s,t),fw(Gl(c,l));break e}}s=c=Gl(c,l),Ln!==4&&(Ln=2),ku===null?ku=[s]:ku.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var g=iC(s,c,t);cb(s,g);break e;case 1:l=c;var v=s.type,w=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(Ro===null||!Ro.has(w)))){s.flags|=65536,t&=-t,s.lanes|=t;var k=sC(s,l,t);cb(s,k);break e}}s=s.return}while(s!==null)}NC(n)}catch(E){t=E,bn===n&&n!==null&&(bn=n=n.return);continue}break}while(!0)}function kC(){var e=Yp.current;return Yp.current=qp,e===null?qp:e}function Tw(){(Ln===0||Ln===3||Ln===2)&&(Ln=4),Un===null||!(Aa&268435455)&&!(zh&268435455)||ko(Un,qn)}function Jp(e,t){var n=Nt;Nt|=2;var r=kC();(Un!==e||qn!==t)&&(Ms=null,ka(e,t));do try{zR();break}catch(i){bC(e,i)}while(!0);if(hw(),Nt=n,Yp.current=r,bn!==null)throw Error(xe(261));return Un=null,qn=0,Ln}function zR(){for(;bn!==null;)SC(bn)}function BR(){for(;bn!==null&&!f2();)SC(bn)}function SC(e){var t=CC(e.alternate,e,Gr);e.memoizedProps=e.pendingProps,t===null?NC(e):bn=t,Ew.current=null}function NC(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=LR(n,t),n!==null){n.flags&=32767,bn=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ln=6,bn=null;return}}else if(n=RR(n,t,Gr),n!==null){bn=n;return}if(t=t.sibling,t!==null){bn=t;return}bn=t=e}while(t!==null);Ln===0&&(Ln=5)}function ma(e,t,n){var r=_t,i=gi.transition;try{gi.transition=null,_t=1,HR(e,t,n,r)}finally{gi.transition=i,_t=r}return null}function HR(e,t,n,r){do Fl();while(jo!==null);if(Nt&6)throw Error(xe(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(xe(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(k2(e,s),e===Un&&(bn=Un=null,qn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Af||(Af=!0,EC(Tp,function(){return Fl(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=gi.transition,gi.transition=null;var o=_t;_t=1;var l=Nt;Nt|=4,Ew.current=null,MR(e,n),xC(n,e),lR(jy),Lp=!!Ny,jy=Ny=null,e.current=n,$R(n),p2(),Nt=l,_t=o,gi.transition=s}else e.current=n;if(Af&&(Af=!1,jo=e,Xp=i),s=e.pendingLanes,s===0&&(Ro=null),g2(n.stateNode),Dr(e,yn()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Gp)throw Gp=!1,e=Wy,Wy=null,e;return Xp&1&&e.tag!==0&&Fl(),s=e.pendingLanes,s&1?e===Ky?Su++:(Su=0,Ky=e):Su=0,Go(),null}function Fl(){if(jo!==null){var e=ij(Xp),t=gi.transition,n=_t;try{if(gi.transition=null,_t=16>e?16:e,jo===null)var r=!1;else{if(e=jo,jo=null,Xp=0,Nt&6)throw Error(xe(331));var i=Nt;for(Nt|=4,Le=e.current;Le!==null;){var s=Le,o=s.child;if(Le.flags&16){var l=s.deletions;if(l!==null){for(var c=0;c<l.length;c++){var d=l[c];for(Le=d;Le!==null;){var u=Le;switch(u.tag){case 0:case 11:case 15:bu(8,u,s)}var p=u.child;if(p!==null)p.return=u,Le=p;else for(;Le!==null;){u=Le;var f=u.sibling,h=u.return;if(mC(u),u===d){Le=null;break}if(f!==null){f.return=h,Le=f;break}Le=h}}}var y=s.alternate;if(y!==null){var b=y.child;if(b!==null){y.child=null;do{var S=b.sibling;b.sibling=null,b=S}while(b!==null)}}Le=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,Le=o;else e:for(;Le!==null;){if(s=Le,s.flags&2048)switch(s.tag){case 0:case 11:case 15:bu(9,s,s.return)}var g=s.sibling;if(g!==null){g.return=s.return,Le=g;break e}Le=s.return}}var v=e.current;for(Le=v;Le!==null;){o=Le;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,Le=w;else e:for(o=v;Le!==null;){if(l=Le,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Dh(9,l)}}catch(E){fn(l,l.return,E)}if(l===o){Le=null;break e}var k=l.sibling;if(k!==null){k.return=l.return,Le=k;break e}Le=l.return}}if(Nt=i,Go(),gs&&typeof gs.onPostCommitFiberRoot=="function")try{gs.onPostCommitFiberRoot(Ah,e)}catch{}r=!0}return r}finally{_t=n,gi.transition=t}}return!1}function Ib(e,t,n){t=Gl(n,t),t=iC(e,t,1),e=To(e,t,1),t=kr(),e!==null&&(wd(e,1,t),Dr(e,t))}function fn(e,t,n){if(e.tag===3)Ib(e,e,n);else for(;t!==null;){if(t.tag===3){Ib(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ro===null||!Ro.has(r))){e=Gl(n,e),e=sC(t,e,1),t=To(t,e,1),e=kr(),t!==null&&(wd(t,1,e),Dr(t,e));break}}t=t.return}}function UR(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=kr(),e.pingedLanes|=e.suspendedLanes&n,Un===e&&(qn&n)===n&&(Ln===4||Ln===3&&(qn&130023424)===qn&&500>yn()-Pw?ka(e,0):_w|=n),Dr(e,t)}function jC(e,t){t===0&&(e.mode&1?(t=bf,bf<<=1,!(bf&130023424)&&(bf=4194304)):t=1);var n=kr();e=qs(e,t),e!==null&&(wd(e,t,n),Dr(e,n))}function VR(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),jC(e,n)}function WR(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(xe(314))}r!==null&&r.delete(t),jC(e,n)}var CC;CC=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||$r.current)Rr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Rr=!1,TR(e,t,n);Rr=!!(e.flags&131072)}else Rr=!1,qt&&t.flags&1048576&&Ij(t,Bp,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;hp(e,t),e=t.pendingProps;var i=Wl(t,cr.current);$l(t,n),i=kw(null,t,r,e,i,n);var s=Sw();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Fr(r)?(s=!0,Dp(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,yw(t),i.updater=Fh,t.stateNode=i,i._reactInternals=t,Ly(t,r,e,n),t=$y(null,t,r,!0,s,n)):(t.tag=0,qt&&s&&uw(t),vr(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(hp(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=qR(r),e=Ri(r,e),i){case 0:t=My(null,t,r,e,n);break e;case 1:t=vb(null,t,r,e,n);break e;case 11:t=xb(null,t,r,e,n);break e;case 14:t=wb(null,t,r,Ri(r.type,e),n);break e}throw Error(xe(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ri(r,i),My(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ri(r,i),vb(e,t,r,i,n);case 3:e:{if(cC(t),e===null)throw Error(xe(387));r=t.pendingProps,s=t.memoizedState,i=s.element,Mj(e,t),Vp(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=Gl(Error(xe(423)),t),t=bb(e,t,r,n,i);break e}else if(r!==i){i=Gl(Error(xe(424)),t),t=bb(e,t,r,n,i);break e}else for(Qr=Ao(t.stateNode.containerInfo.firstChild),ei=t,qt=!0,Mi=null,n=Lj(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Kl(),r===i){t=Ys(e,t,n);break e}vr(e,t,r,n)}t=t.child}return t;case 5:return $j(t),e===null&&Ay(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,Cy(r,i)?o=null:s!==null&&Cy(r,s)&&(t.flags|=32),lC(e,t),vr(e,t,o,n),t.child;case 6:return e===null&&Ay(t),null;case 13:return uC(e,t,n);case 4:return xw(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ql(t,null,r,n):vr(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ri(r,i),xb(e,t,r,i,n);case 7:return vr(e,t,t.pendingProps,n),t.child;case 8:return vr(e,t,t.pendingProps.children,n),t.child;case 12:return vr(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,Lt(Hp,r._currentValue),r._currentValue=o,s!==null)if(Ui(s.value,o)){if(s.children===i.children&&!$r.current){t=Ys(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var l=s.dependencies;if(l!==null){o=s.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(s.tag===1){c=Vs(-1,n&-n),c.tag=2;var d=s.updateQueue;if(d!==null){d=d.shared;var u=d.pending;u===null?c.next=c:(c.next=u.next,u.next=c),d.pending=c}}s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Ty(s.return,n,t),l.lanes|=n;break}c=c.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(xe(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Ty(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}vr(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,$l(t,n),i=yi(i),r=r(i),t.flags|=1,vr(e,t,r,n),t.child;case 14:return r=t.type,i=Ri(r,t.pendingProps),i=Ri(r.type,i),wb(e,t,r,i,n);case 15:return oC(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Ri(r,i),hp(e,t),t.tag=1,Fr(r)?(e=!0,Dp(t)):e=!1,$l(t,n),rC(t,r,i),Ly(t,r,i,n),$y(null,t,r,!0,e,n);case 19:return dC(e,t,n);case 22:return aC(e,t,n)}throw Error(xe(156,t.tag))};function EC(e,t){return ej(e,t)}function KR(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 mi(e,t,n,r){return new KR(e,t,n,r)}function Rw(e){return e=e.prototype,!(!e||!e.isReactComponent)}function qR(e){if(typeof e=="function")return Rw(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Qx)return 11;if(e===Zx)return 14}return 2}function Oo(e,t){var n=e.alternate;return n===null?(n=mi(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 yp(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")Rw(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ml:return Sa(n.children,i,s,t);case Jx:o=8,i|=8;break;case iy:return e=mi(12,n,t,i|2),e.elementType=iy,e.lanes=s,e;case sy:return e=mi(13,n,t,i),e.elementType=sy,e.lanes=s,e;case oy:return e=mi(19,n,t,i),e.elementType=oy,e.lanes=s,e;case $1:return Bh(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case O1:o=10;break e;case M1:o=9;break e;case Qx:o=11;break e;case Zx:o=14;break e;case xo:o=16,r=null;break e}throw Error(xe(130,e==null?e:typeof e,""))}return t=mi(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function Sa(e,t,n,r){return e=mi(7,e,r,t),e.lanes=n,e}function Bh(e,t,n,r){return e=mi(22,e,r,t),e.elementType=$1,e.lanes=n,e.stateNode={isHidden:!1},e}function cg(e,t,n){return e=mi(6,e,null,t),e.lanes=n,e}function ug(e,t,n){return t=mi(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function YR(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Vm(0),this.expirationTimes=Vm(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Vm(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Lw(e,t,n,r,i,s,o,l,c){return e=new YR(e,t,n,l,c),t===1?(t=1,s===!0&&(t|=8)):t=0,s=mi(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},yw(s),e}function GR(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:hl,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function _C(e){if(!e)return zo;e=e._reactInternals;e:{if(Da(e)!==e||e.tag!==1)throw Error(xe(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(Fr(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(xe(171))}if(e.tag===1){var n=e.type;if(Fr(n))return _j(e,n,t)}return t}function PC(e,t,n,r,i,s,o,l,c){return e=Lw(n,r,!0,e,i,s,o,l,c),e.context=_C(null),n=e.current,r=kr(),i=Lo(n),s=Vs(r,i),s.callback=t??null,To(n,s,i),e.current.lanes=i,wd(e,i,r),Dr(e,r),e}function Hh(e,t,n,r){var i=t.current,s=kr(),o=Lo(i);return n=_C(n),t.context===null?t.context=n:t.pendingContext=n,t=Vs(s,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=To(i,t,o),e!==null&&(Hi(e,i,o,s),dp(e,i,o)),o}function Qp(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 Ab(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Ow(e,t){Ab(e,t),(e=e.alternate)&&Ab(e,t)}function XR(){return null}var IC=typeof reportError=="function"?reportError:function(e){console.error(e)};function Mw(e){this._internalRoot=e}Uh.prototype.render=Mw.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(xe(409));Hh(e,t,null,null)};Uh.prototype.unmount=Mw.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ta(function(){Hh(null,e,null,null)}),t[Ks]=null}};function Uh(e){this._internalRoot=e}Uh.prototype.unstable_scheduleHydration=function(e){if(e){var t=aj();e={blockedOn:null,target:e,priority:t};for(var n=0;n<bo.length&&t!==0&&t<bo[n].priority;n++);bo.splice(n,0,e),n===0&&cj(e)}};function $w(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function Vh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Tb(){}function JR(e,t,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var d=Qp(o);s.call(d)}}var o=PC(t,r,e,0,null,!1,!1,"",Tb);return e._reactRootContainer=o,e[Ks]=o.current,Bu(e.nodeType===8?e.parentNode:e),Ta(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var l=r;r=function(){var d=Qp(c);l.call(d)}}var c=Lw(e,0,!1,null,null,!1,!1,"",Tb);return e._reactRootContainer=c,e[Ks]=c.current,Bu(e.nodeType===8?e.parentNode:e),Ta(function(){Hh(t,c,n,r)}),c}function Wh(e,t,n,r,i){var s=n._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var l=i;i=function(){var c=Qp(o);l.call(c)}}Hh(t,o,e,i)}else o=JR(n,t,e,i,r);return Qp(o)}sj=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=au(t.pendingLanes);n!==0&&(nw(t,n|1),Dr(t,yn()),!(Nt&6)&&(Xl=yn()+500,Go()))}break;case 13:Ta(function(){var r=qs(e,1);if(r!==null){var i=kr();Hi(r,e,1,i)}}),Ow(e,1)}};rw=function(e){if(e.tag===13){var t=qs(e,134217728);if(t!==null){var n=kr();Hi(t,e,134217728,n)}Ow(e,134217728)}};oj=function(e){if(e.tag===13){var t=Lo(e),n=qs(e,t);if(n!==null){var r=kr();Hi(n,e,t,r)}Ow(e,t)}};aj=function(){return _t};lj=function(e,t){var n=_t;try{return _t=e,t()}finally{_t=n}};gy=function(e,t,n){switch(t){case"input":if(cy(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 i=Oh(r);if(!i)throw Error(xe(90));D1(r),cy(r,i)}}}break;case"textarea":B1(e,n);break;case"select":t=n.value,t!=null&&Rl(e,!!n.multiple,t,!1)}};Y1=Iw;G1=Ta;var QR={usingClientEntryPoint:!1,Events:[bd,wl,Oh,K1,q1,Iw]},qc={findFiberByHostInstance:xa,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},ZR={bundleType:qc.bundleType,version:qc.version,rendererPackageName:qc.rendererPackageName,rendererConfig:qc.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Qs.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Q1(e),e===null?null:e.stateNode},findFiberByHostInstance:qc.findFiberByHostInstance||XR,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Tf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Tf.isDisabled&&Tf.supportsFiber)try{Ah=Tf.inject(ZR),gs=Tf}catch{}}ii.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=QR;ii.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!$w(t))throw Error(xe(200));return GR(e,t,null,n)};ii.createRoot=function(e,t){if(!$w(e))throw Error(xe(299));var n=!1,r="",i=IC;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=Lw(e,1,!1,null,null,n,!1,r,i),e[Ks]=t.current,Bu(e.nodeType===8?e.parentNode:e),new Mw(t)};ii.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(xe(188)):(e=Object.keys(e).join(","),Error(xe(268,e)));return e=Q1(t),e=e===null?null:e.stateNode,e};ii.flushSync=function(e){return Ta(e)};ii.hydrate=function(e,t,n){if(!Vh(t))throw Error(xe(200));return Wh(null,e,t,!0,n)};ii.hydrateRoot=function(e,t,n){if(!$w(e))throw Error(xe(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",o=IC;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=PC(t,null,e,1,n??null,i,!1,s,o),e[Ks]=t.current,Bu(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new Uh(t)};ii.render=function(e,t,n){if(!Vh(t))throw Error(xe(200));return Wh(null,e,t,!1,n)};ii.unmountComponentAtNode=function(e){if(!Vh(e))throw Error(xe(40));return e._reactRootContainer?(Ta(function(){Wh(null,null,e,!1,function(){e._reactRootContainer=null,e[Ks]=null})}),!0):!1};ii.unstable_batchedUpdates=Iw;ii.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!Vh(n))throw Error(xe(200));if(e==null||e._reactInternals===void 0)throw Error(xe(38));return Wh(e,t,n,!1,r)};ii.version="18.3.1-next-f1338f8080-20240426";function AC(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(AC)}catch(e){console.error(e)}}AC(),A1.exports=ii;var Tr=A1.exports,Rb=Tr;ny.createRoot=Rb.createRoot,ny.hydrateRoot=Rb.hydrateRoot;const TC=m.createContext(null);function Gy(e){let t=e||"/";return t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t||"/"}function eL(){const e=Gy(window.location.pathname);return e==="/"?(window.history.replaceState({},"","/projects"),"/projects"):e}function tL({children:e}){const[t,n]=m.useState(eL);m.useEffect(()=>{const s=()=>n(Gy(window.location.pathname));return window.addEventListener("popstate",s),()=>window.removeEventListener("popstate",s)},[]);const r=m.useCallback(s=>{const o=s.startsWith("/")?s:`/${s}`;let l;try{l=new URL(o,window.location.origin)}catch{l=new URL("/",window.location.origin)}const c=Gy(l.pathname),d=l.search||"";window.history.pushState({},"",c+d),n(c)},[]),i=m.useMemo(()=>({path:t,navigate:r}),[t,r]);return a.jsx(TC.Provider,{value:i,children:e})}function za(){const e=m.useContext(TC);if(!e)throw new Error("useRoute must be used within RouteProvider");return e}function nL(){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 Lb={};function Xy(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];typeof t[0]=="string"&&Lb[t[0]]||(typeof t[0]=="string"&&(Lb[t[0]]=new Date),nL(...t))}const RC=(e,t)=>()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function Ob(e,t,n){e.loadNamespaces(t,RC(e,n))}function Mb(e,t,n,r){typeof n=="string"&&(n=[n]),n.forEach(i=>{e.options.ns.indexOf(i)<0&&e.options.ns.push(i)}),e.loadLanguages(t,RC(e,r))}function rL(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],i=t.options?t.options.fallbackLng:!1,s=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(l,c)=>{const d=t.services.backendConnector.state[`${l}|${c}`];return d===-1||d===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!o(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||o(r,e)&&(!i||o(s,e)))}function iL(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(Xy("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(i,s)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!s(i.isLanguageChangingTo,e))return!1}}):rL(e,t,n)}const sL=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,oL={"&amp;":"&","&#38;":"&","&lt;":"<","&#60;":"<","&gt;":">","&#62;":">","&apos;":"'","&#39;":"'","&quot;":'"',"&#34;":'"',"&nbsp;":" ","&#160;":" ","&copy;":"©","&#169;":"©","&reg;":"®","&#174;":"®","&hellip;":"…","&#8230;":"…","&#x2F;":"/","&#47;":"/"},aL=e=>oL[e],lL=e=>e.replace(sL,aL);let Jy={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:lL};function cL(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Jy={...Jy,...e}}function uL(){return Jy}let LC;function dL(e){LC=e}function fL(){return LC}const pL={type:"3rdParty",init(e){cL(e.options.react),dL(e)}},hL=m.createContext();class mL{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const gL=(e,t)=>{const n=m.useRef();return m.useEffect(()=>{n.current=e},[e,t]),n.current};function Mt(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:i}=m.useContext(hL)||{},s=n||r||fL();if(s&&!s.reportNamespaces&&(s.reportNamespaces=new mL),!s){Xy("You will need to pass in an i18next instance by using initReactI18next");const w=(E,j)=>typeof j=="string"?j:j&&typeof j=="object"&&typeof j.defaultValue=="string"?j.defaultValue:Array.isArray(E)?E[E.length-1]:E,k=[w,{},!1];return k.t=w,k.i18n={},k.ready=!1,k}s.options.react&&s.options.react.wait!==void 0&&Xy("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const o={...uL(),...s.options.react,...t},{useSuspense:l,keyPrefix:c}=o;let d=e||i||s.options&&s.options.defaultNS;d=typeof d=="string"?[d]:d||["translation"],s.reportNamespaces.addUsedNamespaces&&s.reportNamespaces.addUsedNamespaces(d);const u=(s.isInitialized||s.initializedStoreOnce)&&d.every(w=>iL(w,s,o));function p(){return s.getFixedT(t.lng||null,o.nsMode==="fallback"?d:d[0],c)}const[f,h]=m.useState(p);let y=d.join();t.lng&&(y=`${t.lng}${y}`);const b=gL(y),S=m.useRef(!0);m.useEffect(()=>{const{bindI18n:w,bindI18nStore:k}=o;S.current=!0,!u&&!l&&(t.lng?Mb(s,t.lng,d,()=>{S.current&&h(p)}):Ob(s,d,()=>{S.current&&h(p)})),u&&b&&b!==y&&S.current&&h(p);function E(){S.current&&h(p)}return w&&s&&s.on(w,E),k&&s&&s.store.on(k,E),()=>{S.current=!1,w&&s&&w.split(" ").forEach(j=>s.off(j,E)),k&&s&&k.split(" ").forEach(j=>s.store.off(j,E))}},[s,y]);const g=m.useRef(!0);m.useEffect(()=>{S.current&&!g.current&&h(p),g.current=!1},[s,c]);const v=[f,s,u];if(v.t=f,v.i18n=s,v.ready=u,u||!u&&!l)return v;throw new Promise(w=>{t.lng?Mb(s,t.lng,d,()=>w()):Ob(s,d,()=>w())})}const OC="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",yL=[{to:"/projects",labelKey:"common:nav.projects",icon:"folder_open"},{to:"/nodes",labelKey:"common:nav.nodes",icon:"account_tree"},{to:"/my-nodes",labelKey:"common:nav.myNodes",icon:"deployed_code"},{to:"/my-flows",labelKey:"common:nav.myFlows",icon:"schema"},{to:"/skills",labelKey:"common:nav.skills",icon:"extension"},{to:"/settings",labelKey:"common:nav.settings",icon:"settings"}],xL=[{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 wL(e,t){return t==="/projects"?e==="/projects"||e==="/":e===t||e.startsWith(t+"/")}function vL({authUser:e,onLogout:t}){const{path:n,navigate:r}=za(),{t:i}=Mt(),[s,o]=m.useState(!1);return m.useEffect(()=>{let l=!1;return fetch("/api/ui-context").then(c=>c.json()).then(c=>{l||o(!!c.hideCommunityLinks)}).catch(()=>{}),()=>{l=!0}},[]),a.jsxs("aside",{className:"af-sidebar","aria-label":i("flow:sidebar.mainNav"),children:[a.jsxs("div",{className:"af-brand",children:[a.jsx("div",{className:"af-brand-mark","aria-hidden":!0,children:a.jsx("img",{src:OC,alt:"",width:"36",height:"36",decoding:"async"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"af-brand-title",children:"Agentflow"}),a.jsx("p",{className:"af-brand-tag",children:"Orchestration Engine"})]})]}),a.jsx("nav",{className:"af-nav",children:yL.map(l=>a.jsxs("button",{type:"button",className:"af-nav-link"+(wL(n,l.to)?" af-nav-link--active":""),onClick:()=>r(l.to),children:[a.jsx("span",{className:"material-symbols-outlined",children:l.icon}),a.jsx("span",{children:i(l.labelKey)})]},l.to))}),a.jsxs("div",{className:"af-sidebar-footer",children:[a.jsxs("div",{className:"af-sidebar-user",title:(e==null?void 0:e.username)||(e==null?void 0:e.userId)||"",children:[a.jsx("span",{className:"material-symbols-outlined",children:"person"}),a.jsx("span",{children:(e==null?void 0:e.username)||(e==null?void 0:e.userId)||""}),a.jsx("button",{type:"button",className:"af-sidebar-logout",onClick:t,"aria-label":"Logout",title:"Logout",children:a.jsx("span",{className:"material-symbols-outlined",children:"logout"})})]}),!s&&xL.map(l=>{const c=i(l.labelKey);return a.jsx("a",{className:"af-sidebar-ext",href:l.href,target:"_blank",rel:"noopener noreferrer","aria-label":c,title:c,children:a.jsx("span",{className:"material-symbols-outlined",children:l.icon})},l.href)})]})]})}const MC="agentflow.pipelineRecent",bL=50,kL=15;function SL(e){try{const t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function $C(){if(typeof localStorage>"u")return[];const e=localStorage.getItem(MC);return e?SL(e).filter(t=>t&&typeof t.flowId=="string"&&(t.flowSource==="user"||t.flowSource==="builtin"||t.flowSource==="workspace")&&t.kind==="opened"&&typeof t.at=="number"):[]}function Rf(e,t){if(typeof localStorage>"u")return;const n=Date.now(),r=$C(),s=[{flowId:e,flowSource:t,kind:"opened",at:n},...r.filter(o=>!(o.flowId===e&&o.flowSource===t))].slice(0,bL);try{localStorage.setItem(MC,JSON.stringify(s))}catch{}}function NL(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==="builtin")?"builtin":n[0].source??"user"}function Qy(e,t){const n=Date.now(),r=Math.max(0,n-e),i=Math.floor(r/1e3);if(i<60)return t("flow:time.justNow");const s=Math.floor(i/60);if(s<60)return t("flow:time.minutesAgo",{n:s});const o=Math.floor(s/60);if(o<24)return t("flow:time.hoursAgo",{n:o});const l=new Date(e),c=new Date,d=new Date(c);if(d.setDate(d.getDate()-1),l.toDateString()===d.toDateString())return t("flow:time.yesterday");const u=Math.floor(o/24);return u<7?t("flow:time.daysAgo",{n:u}):`${l.getMonth()+1}/${l.getDate()}`}function jL(e,t){if(e==null||!Number.isFinite(e)||e<=0)return"--";if(e<1e3)return t("flow:time.milliseconds",{n:Math.max(1,Math.round(e))});const n=e/1e3;return t("flow:time.seconds",{n:n>=10?Math.round(n):n.toFixed(1)})}function CL(e,t,n){const r=[];for(const i of e)!i||typeof i.flowId!="string"||typeof i.at!="number"||r.push({flowId:i.flowId,flowSource:NL(n,i.flowId),kind:"executed",at:i.at});for(const i of t)r.push({flowId:i.flowId,flowSource:i.flowSource,kind:"opened",at:i.at});return r.sort((i,s)=>s.at-i.at),r.slice(0,kL)}var Xr=Uint8Array,Cl=Uint16Array,EL=Int32Array,FC=new Xr([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]),DC=new Xr([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]),_L=new Xr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),zC=function(e,t){for(var n=new Cl(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new EL(n[30]),r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)i[s]=s-n[r]<<5|r;return{b:n,r:i}},BC=zC(FC,2),HC=BC.b,PL=BC.r;HC[28]=258,PL[258]=28;var IL=zC(DC,0),AL=IL.b,Zy=new Cl(32768);for(var Dt=0;Dt<32768;++Dt){var po=(Dt&43690)>>1|(Dt&21845)<<1;po=(po&52428)>>2|(po&13107)<<2,po=(po&61680)>>4|(po&3855)<<4,Zy[Dt]=((po&65280)>>8|(po&255)<<8)>>1}var Nu=function(e,t,n){for(var r=e.length,i=0,s=new Cl(t);i<r;++i)e[i]&&++s[e[i]-1];var o=new Cl(t);for(i=1;i<t;++i)o[i]=o[i-1]+s[i-1]<<1;var l;if(n){l=new Cl(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var d=i<<4|e[i],u=t-e[i],p=o[e[i]-1]++<<u,f=p|(1<<u)-1;p<=f;++p)l[Zy[p]>>c]=d}else for(l=new Cl(r),i=0;i<r;++i)e[i]&&(l[i]=Zy[o[e[i]-1]++]>>15-e[i]);return l},Sd=new Xr(288);for(var Dt=0;Dt<144;++Dt)Sd[Dt]=8;for(var Dt=144;Dt<256;++Dt)Sd[Dt]=9;for(var Dt=256;Dt<280;++Dt)Sd[Dt]=7;for(var Dt=280;Dt<288;++Dt)Sd[Dt]=8;var UC=new Xr(32);for(var Dt=0;Dt<32;++Dt)UC[Dt]=5;var TL=Nu(Sd,9,1),RL=Nu(UC,5,1),dg=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Ti=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},fg=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},LL=function(e){return(e+7)/8|0},Fw=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Xr(e.subarray(t,n))},OL=["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"],ui=function(e,t,n){var r=new Error(t||OL[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,ui),!n)throw r;return r},ML=function(e,t,n,r){var i=e.length,s=r?r.length:0;if(!i||t.f&&!t.l)return n||new Xr(0);var o=!n,l=o||t.i!=2,c=t.i;o&&(n=new Xr(i*3));var d=function(fe){var ye=n.length;if(fe>ye){var Se=new Xr(Math.max(ye*2,fe));Se.set(n),n=Se}},u=t.f||0,p=t.p||0,f=t.b||0,h=t.l,y=t.d,b=t.m,S=t.n,g=i*8;do{if(!h){u=Ti(e,p,1);var v=Ti(e,p+1,3);if(p+=3,v)if(v==1)h=TL,y=RL,b=9,S=5;else if(v==2){var j=Ti(e,p,31)+257,P=Ti(e,p+10,15)+4,O=j+Ti(e,p+5,31)+1;p+=14;for(var F=new Xr(O),W=new Xr(19),R=0;R<P;++R)W[_L[R]]=Ti(e,p+R*3,7);p+=P*3;for(var I=dg(W),q=(1<<I)-1,$=Nu(W,I,1),R=0;R<O;){var H=$[Ti(e,p,q)];p+=H&15;var w=H>>4;if(w<16)F[R++]=w;else{var z=0,Y=0;for(w==16?(Y=3+Ti(e,p,3),p+=2,z=F[R-1]):w==17?(Y=3+Ti(e,p,7),p+=3):w==18&&(Y=11+Ti(e,p,127),p+=7);Y--;)F[R++]=z}}var A=F.subarray(0,j),T=F.subarray(j);b=dg(A),S=dg(T),h=Nu(A,b,1),y=Nu(T,S,1)}else ui(1);else{var w=LL(p)+4,k=e[w-4]|e[w-3]<<8,E=w+k;if(E>i){c&&ui(0);break}l&&d(f+k),n.set(e.subarray(w,E),f),t.b=f+=k,t.p=p=E*8,t.f=u;continue}if(p>g){c&&ui(0);break}}l&&d(f+131072);for(var C=(1<<b)-1,G=(1<<S)-1,Q=p;;Q=p){var z=h[fg(e,p)&C],M=z>>4;if(p+=z&15,p>g){c&&ui(0);break}if(z||ui(2),M<256)n[f++]=M;else if(M==256){Q=p,h=null;break}else{var te=M-254;if(M>264){var R=M-257,ce=FC[R];te=Ti(e,p,(1<<ce)-1)+HC[R],p+=ce}var le=y[fg(e,p)&G],de=le>>4;le||ui(3),p+=le&15;var T=AL[de];if(de>3){var ce=DC[de];T+=fg(e,p)&(1<<ce)-1,p+=ce}if(p>g){c&&ui(0);break}l&&d(f+131072);var ue=f+te;if(f<T){var se=s-T,re=Math.min(T,ue);for(se+f<0&&ui(3);f<re;++f)n[f]=r[se+f]}for(;f<ue;++f)n[f]=n[f-T]}}t.l=h,t.p=Q,t.b=f,t.f=u,h&&(u=1,t.m=b,t.d=y,t.n=S)}while(!u);return f!=n.length&&o?Fw(n,0,f):n.subarray(0,f)},$L=new Xr(0),ps=function(e,t){return e[t]|e[t+1]<<8},$i=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},pg=function(e,t){return $i(e,t)+$i(e,t+4)*4294967296};function FL(e,t){return ML(e,{i:2},t&&t.out,t&&t.dictionary)}var ex=typeof TextDecoder<"u"&&new TextDecoder,DL=0;try{ex.decode($L,{stream:!0}),DL=1}catch{}var zL=function(e){for(var t="",n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:Fw(e,n-1)};i?i==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)):i&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 BL(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(ex)return ex.decode(e);var i=zL(e),s=i.s,n=i.r;return n.length&&ui(8),s}}var HL=function(e,t){return t+30+ps(e,t+26)+ps(e,t+28)},UL=function(e,t,n){var r=ps(e,t+28),i=BL(e.subarray(t+46,t+46+r),!(ps(e,t+8)&2048)),s=t+46+r,o=$i(e,t+20),l=n&&o==4294967295?VL(e,s):[o,$i(e,t+24),$i(e,t+42)],c=l[0],d=l[1],u=l[2];return[ps(e,t+10),c,d,i,s+ps(e,t+30)+ps(e,t+32),u]},VL=function(e,t){for(;ps(e,t)!=1;t+=4+ps(e,t+2));return[pg(e,t+12),pg(e,t+4),pg(e,t+20)]};function WL(e,t){for(var n={},r=e.length-22;$i(e,r)!=101010256;--r)(!r||e.length-r>65558)&&ui(13);var i=ps(e,r+8);if(!i)return{};var s=$i(e,r+16),o=s==4294967295||i==65535;if(o){var l=$i(e,r-12);o=$i(e,l)==101075792,o&&(i=$i(e,l+32),s=$i(e,l+48))}for(var c=0;c<i;++c){var d=UL(e,s,o),u=d[0],p=d[1],f=d[2],h=d[3],y=d[4],b=d[5],S=HL(e,b);s=y,u?u==8?n[h]=FL(e.subarray(S,S+p),{out:new Xr(f)}):ui(14,"unknown compression type "+u):n[h]=Fw(e,S,S+p)}return n}const KL=8*1024*1024,qL=500;function YL(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 GL(e){return e?e.split("/").some(n=>n==="__MACOSX"||n.startsWith("._")):!0}function XL(e){const t=e.toLowerCase();if(t==="flow.yaml"||t==="flow.yml")return"";const n="/flow.yaml",r="/flow.yml";let i=null;if(t.endsWith(n))i=e.slice(0,-n.length);else if(t.endsWith(r))i=e.slice(0,-r.length);else return null;return i.includes("/")?null:i}const JL=/^[a-zA-Z][a-zA-Z0-9_-]*$/;async function QL(e){try{const t=new Uint8Array(await e.arrayBuffer()),n=WL(t),r=new Map;let i=0,s=0;for(const[c,d]of Object.entries(n)){if(c.endsWith("/"))continue;const u=YL(c);if(!u||GL(u))continue;const p=(d==null?void 0:d.length)??0;if(i+=p,i>KL||(s+=1,s>qL))return null;r.set(u,p)}if(r.size===0)return null;const o=new Set;for(const c of r.keys()){const d=XL(c);d!==null&&o.add(d)}if(o.size!==1)return null;const[l]=[...o];if(l==="")return null;for(const c of r.keys())if(!(c===l||c.startsWith(`${l}/`)))return null;return JL.test(l)?l:null}catch{return null}}const hg=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function ZL({file:e,onClose:t,onImported:n}){const{t:r}=Mt(),i=m.useId(),s=m.useRef(null),o=m.useRef(null),[l,c]=m.useState(""),[d,u]=m.useState("user"),[p,f]=m.useState(!1),[h,y]=m.useState(""),[b,S]=m.useState(null),g=b??e;m.useEffect(()=>{const E=requestAnimationFrame(()=>{var j;return(j=s.current)==null?void 0:j.focus()});return()=>cancelAnimationFrame(E)},[]),m.useEffect(()=>{let E=!1;return(async()=>{const j=g.name||"",P=j.toLowerCase();let O="";if(P.endsWith(".zip")){if(O=await QL(g)||"",!O){const F=j.replace(/\.zip$/i,"");hg.test(F)&&(O=F)}}else if(P.endsWith(".yaml")||P.endsWith(".yml")){const F=j.replace(/\.ya?ml$/i,"");hg.test(F)&&(O=F)}E||c(O)})(),()=>{E=!0}},[g]);const v=l.trim(),w=v.length>0&&hg.test(v);async function k(E){if(E.preventDefault(),!(!w||p)){f(!0),y("");try{const j=new FormData;j.set("flowId",v),j.set("targetSpace",d),j.set("file",g,g.name);const P=await fetch("/api/flows/import",{method:"POST",body:j}),O=await P.json().catch(()=>({}));if(!P.ok){y(typeof O.error=="string"?O.error:r("project:importModal.importFailed"));return}n({id:O.flowId,source:O.flowSource??"user"})}catch(j){y(String((j==null?void 0:j.message)||j))}finally{f(!1)}}}return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:E=>{E.target===E.currentTarget&&t()},children:a.jsxs("div",{ref:s,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":i,tabIndex:-1,onMouseDown:E=>E.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:i,className:"af-shortcuts-panel__title",children:r("project:importModal.title")}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":r("project:importModal.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:k,children:[a.jsx("p",{className:"af-new-pipeline-lead",children:r("project:importModal.lead",{filename:g.name})}),a.jsx("input",{ref:o,type:"file",className:"af-import-file-input",accept:".yaml,.yml,.zip,application/zip","aria-hidden":!0,tabIndex:-1,onChange:E=>{var P;const j=(P=E.target.files)==null?void 0:P[0];j&&S(j),E.target.value=""}}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:importModal.nameLabel")}),a.jsx("input",{className:"af-new-pipeline-input",type:"text",name:"importFlowId",autoComplete:"off",spellCheck:!1,placeholder:r("project:importModal.namePlaceholder"),value:l,onChange:E=>c(E.target.value),"aria-invalid":v.length>0&&!w}),a.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r("project:importModal.nameHint")})]}),a.jsx("div",{className:"af-import-repick",children:a.jsx("button",{type:"button",className:"af-btn-secondary af-import-repick-btn",onClick:()=>{var E;return(E=o.current)==null?void 0:E.click()},children:r("project:importModal.changeFile")})}),h?a.jsx("p",{className:"af-err af-new-pipeline-err",children:h}):null,a.jsxs("div",{className:"af-new-pipeline-actions",children:[a.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:p,children:r("project:importModal.cancel")}),a.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!w||p,children:r(p?"project:importModal.importing":"project:importModal.importAndOpen")})]})]})]})})}const eO=/^[a-zA-Z][a-zA-Z0-9_-]*$/,$b="af:newPipelineGuide";function tO({open:e,onClose:t,onCreated:n}){const{t:r}=Mt(),i=m.useId(),s=m.useRef(null),[o,l]=m.useState(""),[c,d]=m.useState(""),[u,p]=m.useState("user"),[f,h]=m.useState(!1),[y,b]=m.useState(""),[S,g]=m.useState(!1);m.useEffect(()=>{if(!e)return;l(""),d(""),p("user"),b(""),h(!1),localStorage.getItem($b)==="true"&&g(!0);const P=requestAnimationFrame(()=>{var O;return(O=s.current)==null?void 0:O.focus()});return()=>cancelAnimationFrame(P)},[e]);const v=()=>{localStorage.removeItem($b),g(!1)};if(!e)return null;const w=o.trim(),k=w.length>0&&eO.test(w);async function E(j){if(j.preventDefault(),!(!k||f)){h(!0),b(""),v();try{const P=await fetch("/api/flows",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:w,description:c.trim(),targetSpace:u})}),O=await P.json().catch(()=>({}));if(!P.ok){b(typeof O.error=="string"?O.error:r("project:newPipelineModal.createFailed"));return}n({id:O.flowId,source:O.flowSource??"user"})}catch(P){b(String((P==null?void 0:P.message)||P))}finally{h(!1)}}}return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:j=>{j.target===j.currentTarget&&(v(),t())},children:a.jsxs("div",{ref:s,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":i,tabIndex:-1,onMouseDown:j=>j.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:i,className:"af-shortcuts-panel__title",children:r("project:newPipelineModal.title")}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:()=>{v(),t()},"aria-label":r("project:newPipelineModal.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),S?a.jsx("div",{className:"af-new-pipeline-guide",children:a.jsxs("div",{className:"af-new-pipeline-guide-content",children:[a.jsx("span",{className:"material-symbols-outlined af-new-pipeline-guide-icon",children:"lightbulb"}),a.jsxs("div",{className:"af-new-pipeline-guide-text",children:[a.jsx("p",{children:a.jsx("strong",{children:r("onboarding:newPipeline.guideTitle")})}),a.jsx("p",{children:r("onboarding:newPipeline.guideDesc")})]}),a.jsx("button",{type:"button",className:"af-new-pipeline-guide-close",onClick:v,children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})}):null,a.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:E,children:[a.jsx("p",{className:"af-new-pipeline-lead",children:r("project:newPipelineModal.lead")}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:newPipelineModal.nameLabel")}),a.jsx("input",{className:"af-new-pipeline-input",type:"text",name:"pipelineName",autoComplete:"off",spellCheck:!1,placeholder:r("project:newPipelineModal.namePlaceholder"),value:o,onChange:j=>l(j.target.value),"aria-invalid":w.length>0&&!k}),a.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-hint",children:r(S?"onboarding:newPipeline.nameHintGuide":"project:newPipelineModal.nameHint")})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:r("project:newPipelineModal.descLabel")}),a.jsx("textarea",{className:"af-pipeline-drawer-textarea af-new-pipeline-textarea",name:"pipelineDescription",rows:3,placeholder:r(S?"onboarding:newPipeline.descPlaceholderGuide":"project:newPipelineModal.descPlaceholder"),value:c,onChange:j=>d(j.target.value)}),S?a.jsx("span",{className:"af-pipeline-drawer-muted af-new-pipeline-guide-hint",children:r("onboarding:newPipeline.descHintGuide")}):null]}),y?a.jsx("p",{className:"af-err af-new-pipeline-err",children:y}):null,a.jsxs("div",{className:"af-new-pipeline-actions",children:[a.jsx("button",{type:"button",className:"af-btn-secondary",onClick:()=>{v(),t()},disabled:f,children:r("project:newPipelineModal.cancel")}),a.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!k||f,children:r(f?"project:newPipelineModal.creating":S?"onboarding:newPipeline.createGuide":"project:newPipelineModal.createAndOpen")})]})]})]})})}const VC="agentflow.pipelineViewPreference";function WC(e,t="user",n=!1){return`${String(t||"user")}:${String(e||"")}:${n?"archived":"active"}`}function KC(){if(typeof localStorage>"u")return{};try{const e=JSON.parse(localStorage.getItem(VC)||"{}");return e&&typeof e=="object"&&!Array.isArray(e)?e:{}}catch{return{}}}function nO(e){if(!(typeof localStorage>"u"))try{localStorage.setItem(VC,JSON.stringify(e))}catch{}}function Zp(e){return e==="pipeline"?"pipeline":"workspace"}function rO(e){return(e==null?void 0:e.hasPipeline)!==!1&&(e==null?void 0:e.hasFlow)!==!1&&(e==null?void 0:e.flowYaml)!==!1}function qC(e,t,n,r=!1){if(!e)return;const i=KC();i[WC(e,t,r)]={view:Zp(n),at:Date.now()},nO(i)}function iO(e,t="workspace"){if(!(e!=null&&e.id))return Zp(t);const r=KC()[WC(e.id,e.source??"user",!!e.archived)],i=Zp((r==null?void 0:r.view)||t);return i==="pipeline"&&!rO(e)?"workspace":i}function Dw(e,t="workspace"){if(!(e!=null&&e.id))return t==="pipeline"?"/flow":"/workspace";const n=new URLSearchParams({flowId:e.id,flowSource:e.source??"user"});return e.archived&&n.set(t==="pipeline"?"flowArchived":"archived","1"),`/${Zp(t)==="pipeline"?"flow":"workspace"}?${n.toString()}`}function Lf(e,t="workspace"){return Dw(e,iO(e,t))}function sO({onChanged:e}){const[t,n]=m.useState({available:!1,version:"",loggedIn:!1,user:"",error:""}),[r,i]=m.useState([]),[s,o]=m.useState(""),[l,c]=m.useState([]),[d,u]=m.useState(""),[p,f]=m.useState(""),[h,y]=m.useState(""),b=m.useCallback(async()=>{f("");try{const[k,E]=await Promise.all([fetch("/api/skillhub/status"),fetch("/api/skillhub/list?target=global&agent=codex")]),j=await k.json().catch(()=>({}));k.ok&&n({available:!!j.available,version:typeof j.version=="string"?j.version:"",loggedIn:!!j.loggedIn,user:typeof j.user=="string"?j.user:"",error:typeof j.error=="string"?j.error:""});const P=await E.json().catch(()=>({}));if(!E.ok)throw new Error(typeof P.error=="string"?P.error:"HTTP "+E.status);i(Array.isArray(P.skills)?P.skills:[])}catch(k){f(String(k.message||k))}},[]);m.useEffect(()=>{b()},[b]);const S=m.useCallback(async()=>{const k=s.trim();if(k){u("search"),f(""),y("");try{const E=await fetch(`/api/skillhub/search?q=${encodeURIComponent(k)}`),j=await E.json().catch(()=>({}));if(!E.ok)throw new Error(typeof j.error=="string"?j.error:"HTTP "+E.status);c(Array.isArray(j.items)?j.items:[])}catch(E){f(String(E.message||E))}finally{u("")}}},[s]),g=m.useCallback(async(k,E=!1)=>{const j=String(k||"").trim();if(j){u(`install:${j}`),f(""),y("");try{const P=await fetch("/api/skillhub/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:j,target:"global",agent:"codex",force:E})}),O=await P.json().catch(()=>({}));if(!P.ok)throw new Error(typeof O.error=="string"?O.error:"HTTP "+P.status);y(E?`已更新 ${j}`:`已安装 ${j}`),await b(),typeof e=="function"&&await e()}catch(P){f(String(P.message||P))}finally{u("")}}},[b,e]),v=m.useCallback(async k=>{const E=String(k||"").trim();if(E){u(`uninstall:${E}`),f(""),y("");try{const j=await fetch("/api/skillhub/uninstall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({slug:E,target:"global",agent:"codex"})}),P=await j.json().catch(()=>({}));if(!j.ok)throw new Error(typeof P.error=="string"?P.error:"HTTP "+j.status);y(`已卸载 ${E}`),await b(),typeof e=="function"&&await e()}catch(j){f(String(j.message||j))}finally{u("")}}},[b,e]),w=m.useCallback(async()=>{u("update-cli"),f(""),y("");try{const k=await fetch("/api/skillhub/update",{method:"POST"}),E=await k.json().catch(()=>({}));if(!k.ok)throw new Error(typeof E.error=="string"?E.error:"HTTP "+k.status);y("SkillHub CLI 已更新"),await b()}catch(k){f(String(k.message||k))}finally{u("")}},[b]);return a.jsxs("section",{className:"af-set-card af-set-card--span-all af-set-skillhub",children:[a.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"af-set-h2",children:"SkillHub"}),a.jsx("p",{className:"af-set-p af-set-p--tight",children:"搜索、安装、更新和卸载 Codex 全局 skills。"})]}),a.jsxs("div",{className:"af-set-skillhub-head-actions",children:[a.jsxs("div",{className:"af-set-skillhub-status",children:[a.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:"extension"}),a.jsx("span",{children:t.loggedIn?`已登录 ${t.user}`:"未登录 SkillHub"}),a.jsx("span",{className:"af-set-badge"+(t.available?" af-set-badge--ok":" af-set-badge--err"),children:t.available?`v${t.version}`:"not found"})]}),a.jsxs("div",{className:"af-set-skillhub-toolbar",children:[a.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:b,disabled:!!d,children:"刷新"}),a.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:w,disabled:!!d,children:d==="update-cli"?"更新中…":"更新 CLI"})]})]})]}),a.jsxs("div",{className:"af-set-skillhub-search",children:[a.jsx("input",{className:"af-set-input af-set-input--sm",value:s,onChange:k=>o(k.target.value),onKeyDown:k=>{k.key==="Enter"&&S()},placeholder:"搜索 skill slug / 关键词,例如 android、issue-tracker"}),a.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:()=>S(),disabled:!s.trim()||d==="search",children:[a.jsx("span",{className:"material-symbols-outlined",children:"search"}),d==="search"?"搜索中…":"搜索"]})]}),p?a.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",children:p}):null,h?a.jsx("p",{className:"af-set-hint af-set-hint--inline",children:h}):null,a.jsxs("div",{className:"af-set-skillhub-grid",children:[a.jsxs("div",{className:"af-set-skillhub-pane",children:[a.jsxs("div",{className:"af-set-skillhub-pane-head",children:[a.jsx("h3",{children:"已安装"}),a.jsx("span",{children:r.length})]}),a.jsx("div",{className:"af-set-skillhub-list",children:r.length===0?a.jsx("div",{className:"af-set-skillhub-empty",children:"暂无 Codex 全局 skills"}):r.map(k=>a.jsxs("div",{className:"af-set-skillhub-item",children:[a.jsxs("div",{children:[a.jsx("div",{className:"af-set-skillhub-title",children:k.name}),a.jsxs("div",{className:"af-set-skillhub-meta",children:[k.agent||"codex"," · ",k.kind||"skill"]})]}),a.jsxs("div",{className:"af-set-skillhub-actions",children:[a.jsx("button",{type:"button",className:"af-set-btn-mini",onClick:()=>g(k.name,!0),disabled:!!d,children:"更新"}),a.jsx("button",{type:"button",className:"af-set-btn-mini af-set-btn-mini--danger",onClick:()=>v(k.name),disabled:!!d,children:"卸载"})]})]},`${k.agent}:${k.path}:${k.name}`))})]}),a.jsxs("div",{className:"af-set-skillhub-pane",children:[a.jsxs("div",{className:"af-set-skillhub-pane-head",children:[a.jsx("h3",{children:"搜索结果"}),a.jsx("span",{children:l.length})]}),a.jsx("div",{className:"af-set-skillhub-list",children:l.length===0?a.jsx("div",{className:"af-set-skillhub-empty",children:"输入关键词后搜索 SkillHub"}):l.map(k=>{const E=k.slug||k.name,j=r.some(P=>P.name===E||P.name===k.name);return a.jsxs("div",{className:"af-set-skillhub-item",children:[a.jsxs("div",{children:[a.jsx("div",{className:"af-set-skillhub-title",children:k.name||E}),a.jsxs("div",{className:"af-set-skillhub-meta",children:[E,k.version?` · ${k.version}`:""]}),k.summary?a.jsx("p",{className:"af-set-skillhub-summary",children:k.summary}):null]}),a.jsx("button",{type:"button",className:j?"af-set-btn-mini":"af-set-btn-add af-set-btn-add--compact",onClick:()=>g(E,j),disabled:!!d,children:j?"更新":"安装"})]},k.id||E)})})]})]})]})}function Mo(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 oO(e){return{version:1,collections:Mo({collections:e})}}function Bo(e,t){const n=new Set((Array.isArray(t)?t:[]).map(r=>r.key).filter(Boolean));return(Array.isArray(e==null?void 0:e.skillKeys)?e.skillKeys:[]).filter(r=>n.has(r))}function YC(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 GC(e,t){const n=new Set(Array.isArray(t)?t:[]);return(Array.isArray(e)?e:[]).filter(r=>!n.has(r))}function XC(e,t,n){const r=Bo(e,n);if(r.length===0)return"empty";const i=r.filter(s=>t.has(s)).length;return i===0?"none":i===r.length?"all":"partial"}function aO(e,t,n){const r=String(e||"").trim().toLowerCase(),i=Mo({collections:n}).find(s=>s.id===r||s.name.toLowerCase()===r);return Bo(i,t)}function JC(e,t,n,r){const i=(Array.isArray(n)?n:[]).map(d=>d.key).filter(Boolean),s=String(t||"").trim().toLowerCase(),o=Mo({collections:r}),l=aO(t,n,r),c=l.length>0?l:i;if(!e)return c;try{const d=localStorage.getItem(e);if(d!==null){const u=JSON.parse(d);if(Array.isArray(u)){const p=new Set(i),f=u.map(String).filter(g=>p.has(g));if(i.length>0&&f.length===i.length)return c;const h=new Set(f),y=new Set(l),b=l.length>0&&l.every(g=>h.has(g)),S=o.some(g=>{if(!g.builtin||g.id===s||g.name.toLowerCase()===s)return!1;const v=Bo(g,n);return v.length>0&&v.every(w=>h.has(w))});return l.length>0&&S&&!b?c:f}}}catch{}return c}function Yc(e){return e==="secondary"?"af-proj-badge af-proj-badge--secondary":e==="primary"?"af-proj-badge af-proj-badge--primary":e==="muted"?"af-proj-badge af-proj-badge--muted":"af-proj-badge"}function lO(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 tx(e,t){return e==="builtin"?{label:t("project:sourceBadge.builtin"),tone:"muted"}:e==="workspace"?{label:t("project:sourceBadge.workspace"),tone:"secondary"}:{label:t("project:sourceBadge.user"),tone:"primary"}}function QC(e){const t=e.source??"user";return t==="builtin"?`builtin/pipelines / ${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 cO="project:defaultCardDesc";function ZC(e,t){const n=e.description!=null?String(e.description).trim():"";return n!==""?n:t(cO)}function uO(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function gn({children:e,className:t="",query:n}){const r=n.trim(),i=String(e);if(!r)return a.jsx("span",{className:t,children:i});const s=new RegExp(`(${uO(r)})`,"gi"),o=i.split(s);return a.jsx("span",{className:t,children:o.map((l,c)=>c%2===1?a.jsx("mark",{className:"af-search-hit",children:l},c):a.jsx("span",{children:l},c))})}function dO(e,t,n){const r=[String(e.id),ZC(e,n),QC(e),tx(e.source,n).label];return e.archived&&r.push(n("project:archived")),r.join(`
41
- `).toLowerCase()}function fO(e,t,n){return t?dO(e,t,n).includes(t):!0}function pO(e,t){const n=e.trim().toLowerCase();if(!n)return!0;const r=String(t.flowId).toLowerCase(),i=String(t.flowSource??"user").toLowerCase();return r.includes(n)||i.includes(n)}function mg(e,t){const n=e.trim().toLowerCase();return n?t.filter(Boolean).join(`
42
- `).toLowerCase().includes(n):!0}function Fb(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 Db(e){return e!=null&&e.packageDir?e.packageDir:`marketplace/flow-snippets / ${(e==null?void 0:e.id)||""}`}const hO=["all","agent","control","provide","marketplace"],mO=["all","agent","control","provide"];function Of(e){return!e||typeof e!="object"?[]:Object.entries(e).map(([t,n])=>({key:t,...n&&typeof n=="object"?n:{}}))}function Kt(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 Gc(e){return`${(e==null?void 0:e.id)||""}:${(e==null?void 0:e.version)||""}:${(e==null?void 0:e.packageDir)||""}`}function sl({resourceKind:e=""}){var Vr,Pn,Wr,hr,Xt,mr,gr,Kr;const{t}=Mt(),{navigate:n,path:r}=za(),[i,s]=m.useState(e||"all"),[o,l]=m.useState([]),[c,d]=m.useState([]),[u,p]=m.useState([]),[f,h]=m.useState([]),[y,b]=m.useState([]),[S,g]=m.useState(""),[v,w]=m.useState(!1),[k,E]=m.useState([]),[j,P]=m.useState(""),[O,F]=m.useState(""),[W,R]=m.useState(!1),[I,q]=m.useState(!1),[$,H]=m.useState(!1),[z,Y]=m.useState(null),[A,T]=m.useState(!1),[C,G]=m.useState(""),[Q,M]=m.useState(!0),[te,ce]=m.useState("all"),[le,de]=m.useState(""),[ue,se]=m.useState("overview"),[re,fe]=m.useState({}),[ye,Se]=m.useState(""),[He,st]=m.useState({}),[Ke,Te]=m.useState(""),[It,pn]=m.useState(""),[sn,Nn]=m.useState({}),[xn,On]=m.useState(""),[Ur,Jn]=m.useState(""),[oe,he]=m.useState(""),[Ve,Xe]=m.useState(!1),tt=m.useRef(0),Et=m.useRef(0),jn=m.useCallback(async()=>{const U=++Et.current;P("");try{const ge=await fetch("/api/flows");if(U!==Et.current)return;if(!ge.ok)throw new Error("HTTP "+ge.status);const _e=await ge.json();if(U!==Et.current)return;l(Array.isArray(_e)?_e:[])}catch(ge){if(U!==Et.current)return;l([]),P(String(ge.message||ge))}try{const ge=await fetch("/api/pipeline-recent-runs");if(U!==Et.current)return;if(ge.ok){const _e=await ge.json();if(U!==Et.current)return;E(Array.isArray(_e.runs)?_e.runs:[])}else E([])}catch{if(U!==Et.current)return;E([])}R(!0)},[]),xt=m.useCallback(async()=>{F(""),q(!1);try{const[U,ge,_e,ze]=await Promise.all([fetch("/api/nodes"),fetch("/api/skills"),fetch("/api/skill-collections"),fetch("/api/marketplace/flow-snippets")]),dt=await U.json().catch(()=>({})),Je=await ge.json().catch(()=>({})),gt=await _e.json().catch(()=>({})),nt=await ze.json().catch(()=>({}));if(!U.ok)throw new Error(dt.error||"Nodes HTTP "+U.status);if(!ge.ok)throw new Error(Je.error||"Skills HTTP "+ge.status);if(!_e.ok)throw new Error(gt.error||"Collections HTTP "+_e.status);if(!ze.ok)throw new Error(nt.error||"Flow snippets HTTP "+ze.status);d(Array.isArray(dt.nodes)?dt.nodes:Array.isArray(dt)?dt:[]),p(Array.isArray(Je.skills)?Je.skills:[]),b(Mo(gt)),h(Array.isArray(nt.snippets)?nt.snippets:[])}catch(U){d([]),p([]),h([]),b([]),F(String(U.message||U))}finally{q(!0)}},[]);m.useEffect(()=>{R(!1),jn(),xt()},[jn,xt]),m.useEffect(()=>{let U=!1;return fetch("/api/ui-context").then(ge=>ge.json()).then(ge=>{U||Xe(!!ge.hideCommunityLinks)}).catch(()=>{}),()=>{U=!0}},[]);const Cn=m.useCallback(async U=>{const ge=Mo({collections:U});w(!0),F("");try{const _e=await fetch("/api/skill-collections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(oO(ge))}),ze=await _e.json().catch(()=>({}));if(!_e.ok)throw new Error(ze.error||"Collections HTTP "+_e.status);b(Mo(ze))}catch(_e){F(String(_e.message||_e))}finally{w(!1)}},[]),Qn=m.useCallback(()=>{const U=S.trim();if(!U)return;const ge=U.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"collection",_e=new Set(y.map(gt=>gt.id));let ze=ge,dt=2;for(;_e.has(ze);)ze=`${ge}-${dt++}`;const Je=Date.now();Cn([...y,{id:ze,name:U,skillKeys:[],createdAt:Je,updatedAt:Je}]),g(""),ce(`collection:${ze}`)},[S,Cn,y]),Ht=m.useCallback(U=>{const ge=y.find(ze=>ze.id===U);if(ge!=null&&ge.builtin)return;const _e=y.filter(ze=>ze.id!==U);te===`collection:${U}`&&ce("all"),Cn(_e)},[te,Cn,y]),Ut=m.useCallback((U,ge,_e)=>{const ze=String(ge||"").trim();if(!ze)return;const dt=Date.now(),Je=y.map(gt=>{if(gt.id!==U)return gt;const nt=new Set(gt.skillKeys||[]);return _e?nt.add(ze):nt.delete(ze),{...gt,skillKeys:Array.from(nt),updatedAt:dt}});Cn(Je)},[Cn,y]),on=m.useCallback(async U=>{const ge=U==null?void 0:U.packageId,_e=U==null?void 0:U.version;if(!ge||!_e||!window.confirm(t("project:deleteMyNodeConfirm",{id:ge,version:_e})))return;const ze=Kt(U);Jn(ze),he(""),F("");try{const dt=new URLSearchParams({id:ge,version:_e}),Je=await fetch(`/api/marketplace/node?${dt.toString()}`,{method:"DELETE"}),gt=await Je.json().catch(()=>({}));if(!Je.ok||(gt==null?void 0:gt.ok)===!1){const nt=Array.isArray(gt==null?void 0:gt.usage)&&gt.usage.length>0?` ${t("project:deleteMyNodeUsedBy",{count:gt.usage.length})}`:"";throw new Error(((gt==null?void 0:gt.error)||"Delete failed")+nt)}he(t("project:deleteMyNodeSuccess",{id:ge,version:_e})),st(nt=>{const Fn={...nt};return delete Fn[ze],Fn}),Nn(nt=>{const Fn={};for(const[bi,ki]of Object.entries(nt))bi.startsWith(`${ze}:`)||(Fn[bi]=ki);return Fn}),de(""),await xt()}catch(dt){he(String(dt.message||dt))}finally{Jn("")}},[xt,t]);m.useEffect(()=>{if(e==="nodes"||e==="my-nodes"||e==="my-flows"||e==="skills"){s(e),ce("all"),de(""),se("overview");return}s(U=>U==="archived"?"archived":"all")},[e]),m.useEffect(()=>{if(r!=="/projects"&&r!=="/")return;const U=new URLSearchParams(window.location.search);let ge=!1;if(U.get("tab")==="nodes"){n("/nodes");return}if(U.get("tab")==="my-nodes"){n("/my-nodes");return}if(U.get("tab")==="my-flows"){n("/my-flows");return}if(U.get("tab")==="skills"){n("/skills");return}if(U.get("tab")==="archived"&&(s("archived"),U.delete("tab"),ge=!0),U.get("new")==="1"&&(H(!0),U.delete("new"),ge=!0),ge){const _e=U.toString();window.history.replaceState({},"",_e?`/projects?${_e}`:"/projects")}},[r,n]);const jr=m.useMemo(()=>CL(k,$C(),o),[k,o,r]),Yi=m.useMemo(()=>jr.filter(U=>pO(C,U)),[jr,C]),bt=C.trim().toLowerCase(),En=m.useMemo(()=>i==="archived"?o.filter(U=>U.archived):o.filter(U=>!U.archived),[o,i]),vi=m.useMemo(()=>En.filter(U=>fO(U,bt,t)),[En,bt,t]),Gt=i==="nodes"||i==="my-nodes",fr=i==="my-nodes",Zn=i==="my-flows",er=m.useMemo(()=>c.filter(U=>fr&&U.source!=="marketplace"?!1:(te==="all"||(te==="marketplace"?U.source==="marketplace":U.type===te))&&mg(C,[U.id,U.label,U.displayName,U.description,U.type,U.source,U.packageId,U.version])),[c,fr,C,te]),oi=m.useMemo(()=>{const U=new Map;for(const ge of y)U.set(ge.id,new Set(ge.skillKeys||[]));return U},[y]),Gi=m.useMemo(()=>[{id:"all",label:"全部"},...y.map(U=>({id:`collection:${U.id}`,label:U.name,count:U.skillKeys.length,collection:U})),{id:"ungrouped",label:"未分组"}],[y]),tr=m.useMemo(()=>u.filter(U=>{var ze;const ge=Kt(U);let _e=te==="all";if(te.startsWith("collection:")){const dt=te.slice(11);_e=!!((ze=oi.get(dt))!=null&&ze.has(ge))}else te==="ungrouped"&&(_e=!Array.from(oi.values()).some(dt=>dt.has(ge)));return _e&&mg(C,[U.name,U.id,U.description,U.sourceLabel,U.source,U.path])}),[u,C,te,oi]),Vn=m.useMemo(()=>f.filter(U=>mg(C,[U.id,U.name,U.displayName,U.description,U.version,U.packageDir,Array.isArray(U.tags)?U.tags.join(" "):""])),[f,C]),Xi=Gt||Zn||i==="skills",qe=m.useMemo(()=>er.find(U=>Kt(U)===le)||er[0]||null,[er,le]),jt=m.useMemo(()=>tr.find(U=>Kt(U)===le)||tr[0]||null,[tr,le]),At=m.useMemo(()=>Vn.find(U=>Gc(U)===le)||Vn[0]||null,[Vn,le]),$t=jt?re[Kt(jt)]:null,De=qe?He[Kt(qe)]:null,_n=qe&&It?sn[`${Kt(qe)}:${It}`]:null,Ne=t(Gt?"project:searchNodes":Zn?"project:searchFlows":i==="skills"?"project:searchSkills":"project:searchPipelines");m.useEffect(()=>{if(i!=="skills"||!jt)return;const U=Kt(jt);if(re[U])return;let ge=!1;return Se(U),fetch(`/api/skills/detail?key=${encodeURIComponent(U)}`).then(_e=>_e.json().then(ze=>({ok:_e.ok,json:ze}))).then(({ok:_e,json:ze})=>{ge||_e&&ze.skill&&fe(dt=>({...dt,[U]:ze.skill}))}).catch(()=>{}).finally(()=>{ge||Se("")}),()=>{ge=!0}},[i,jt,re]),m.useEffect(()=>{if(!Gt||!qe)return;const U=Kt(qe);if(He[U])return;let ge=!1;return Te(U),fetch(`/api/nodes/detail?id=${encodeURIComponent(qe.id)}`).then(_e=>_e.json().then(ze=>({ok:_e.ok,json:ze}))).then(({ok:_e,json:ze})=>{ge||_e&&st(dt=>({...dt,[U]:ze}))}).catch(()=>{}).finally(()=>{ge||Te("")}),()=>{ge=!0}},[Gt,qe,He]),m.useEffect(()=>{if(!Gt)return;const U=Array.isArray(De==null?void 0:De.files)?De.files:[];pn(ge=>{var _e;return ge&&U.some(ze=>ze.path===ge)?ge:((_e=U[0])==null?void 0:_e.path)||""})},[Gt,De]),m.useEffect(()=>{if(!Gt||!qe||!It)return;const U=`${Kt(qe)}:${It}`;if(sn[U])return;let ge=!1;return On(U),fetch(`/api/nodes/file?id=${encodeURIComponent(qe.id)}&path=${encodeURIComponent(It)}`).then(_e=>_e.json().then(ze=>({ok:_e.ok,json:ze}))).then(({ok:_e,json:ze})=>{ge||_e&&Nn(dt=>({...dt,[U]:ze}))}).catch(()=>{}).finally(()=>{ge||On("")}),()=>{ge=!0}},[Gt,qe,It,sn]),m.useEffect(()=>{he("")},[le,i]);const an=U=>{n(Lf(U,"workspace"))},pr=U=>{n(Lf({id:U.flowId,source:U.flowSource,archived:!!U.archived},"workspace"))},ot=m.useCallback(U=>{var ge,_e;U.preventDefault(),U.stopPropagation(),(_e=(ge=U.dataTransfer)==null?void 0:ge.types)!=null&&_e.includes("Files")&&(tt.current+=1,T(!0))},[]),ai=m.useCallback(U=>{U.preventDefault(),U.stopPropagation(),tt.current-=1,tt.current<=0&&(tt.current=0,T(!1))},[]),Mn=m.useCallback(U=>{U.preventDefault(),U.stopPropagation()},[]),$n=m.useCallback(U=>{var ze,dt;U.preventDefault(),U.stopPropagation(),tt.current=0,T(!1);const ge=(dt=(ze=U.dataTransfer)==null?void 0:ze.files)==null?void 0:dt[0];if(!ge)return;const _e=ge.name.toLowerCase();!_e.endsWith(".yaml")&&!_e.endsWith(".yml")&&!_e.endsWith(".zip")||Y(ge)},[]);return a.jsxs("div",{className:"af-projects"+(A?" af-projects--drop-target":""),onDragEnter:ot,onDragLeave:ai,onDragOver:Mn,onDrop:$n,children:[a.jsxs("header",{className:"af-projects-top",children:[e?a.jsx("div",{className:"af-projects-tabs af-projects-tabs--empty","aria-hidden":!0}):a.jsxs("div",{className:"af-projects-tabs",children:[a.jsx("button",{type:"button",className:i==="all"?"af-tab af-tab--active":"af-tab",onClick:()=>s("all"),children:t("project:all")}),a.jsx("button",{type:"button",className:i==="archived"?"af-tab af-tab--active":"af-tab",onClick:()=>s("archived"),children:t("project:archived")})]}),a.jsxs("div",{className:"af-projects-top-right",children:[a.jsxs("div",{className:"af-search-wrap",children:[a.jsx("span",{className:"material-symbols-outlined af-search-icon",children:"search"}),a.jsx("input",{className:"af-search"+(C.trim()?" af-search--has-clear":""),type:"search",placeholder:Ne,"aria-label":Ne,autoComplete:"off",value:C,onChange:U=>G(U.target.value),onKeyDown:U=>{U.key==="Escape"&&(G(""),U.currentTarget.blur())}}),C.trim()?a.jsx("button",{type:"button",className:"af-search-clear","aria-label":"Clear search",onClick:()=>G(""),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})}):null]}),Xi?a.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>xt(),children:t("project:refreshResources")}):a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"af-icon-btn"+(Q?" af-icon-btn--active":""),"aria-label":t("flow:palette.toggleRecentActivity"),"aria-expanded":Q,"aria-controls":"af-recent-activity-panel",onClick:()=>M(U=>!U),children:a.jsx("span",{className:"material-symbols-outlined",children:"notifications"})}),a.jsx("button",{type:"button",className:"af-btn-primary af-create-btn",onClick:()=>H(!0),children:t("project:createNew")})]})]})]}),a.jsxs("div",{className:"af-projects-body",children:[a.jsxs("section",{className:"af-projects-main",children:[a.jsxs("header",{className:"af-projects-section-head",children:[a.jsx("h2",{className:"af-projects-h2",children:t(i==="my-nodes"?"project:myNodes":i==="my-flows"?"project:myFlows":i==="nodes"?"project:globalNodes":i==="skills"?"project:globalSkills":i==="archived"?"project:archivedPipelines":"project:activeProjects")}),a.jsx("p",{className:"af-projects-sub",children:bt?t("project:filterResult",{count:i==="nodes"||i==="my-nodes"?er.length:i==="my-flows"?Vn.length:i==="skills"?tr.length:vi.length}):i==="my-nodes"?t("project:myNodesHint",{count:er.length}):i==="my-flows"?t("project:myFlowsHint",{count:Vn.length}):i==="nodes"?t("project:nodesHint",{count:c.length}):i==="skills"?t("project:skillsHint",{count:u.length}):t(i==="archived"?"project:archivedHint":"project:activeHint")}),j?a.jsx("p",{className:"af-err af-projects-api-hint",children:j}):null,O&&Xi?a.jsx("p",{className:"af-err af-projects-api-hint",children:O}):null]}),Xi?a.jsxs("div",{className:"af-resource-toolbar",children:[i==="skills"?a.jsx(sO,{onChanged:xt}):null,a.jsxs("div",{className:"af-resource-purpose",children:[a.jsx("span",{className:"material-symbols-outlined",children:Zn?"schema":Gt?fr?"deployed_code":"account_tree":"extension"}),a.jsxs("div",{children:[a.jsx("h3",{children:t(Zn?"project:myFlowsPurposeTitle":fr?"project:myNodesPurposeTitle":Gt?"project:nodesPurposeTitle":"project:skillsPurposeTitle")}),a.jsx("p",{children:t(Zn?"project:myFlowsPurposeDesc":fr?"project:myNodesPurposeDesc":Gt?"project:nodesPurposeDesc":"project:skillsPurposeDesc")})]})]}),Zn?null:a.jsx("div",{className:"af-resource-filter-row",children:(Gt?(fr?mO:hO).map(U=>({id:U,label:t(`project:resourceFilter.${U}`)})):Gi).map(U=>U.collection?a.jsxs("span",{className:"af-resource-filter-chip"+(te===U.id?" af-resource-filter-chip--active":""),children:[a.jsxs("button",{type:"button",className:"af-resource-filter af-resource-filter--embedded",onClick:()=>{ce(U.id),de("")},children:[U.label,a.jsx("em",{children:U.count}),U.collection.builtin?a.jsx("strong",{children:"built-in"}):null]}),U.collection.builtin?null:a.jsx("button",{type:"button",className:"af-resource-filter-chip__delete",disabled:v,"aria-label":`删除 ${U.collection.name}`,onClick:()=>Ht(U.collection.id),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},U.id):a.jsx("button",{type:"button",className:"af-resource-filter"+(te===U.id?" af-resource-filter--active":""),onClick:()=>{ce(U.id),de("")},children:U.label},U.id))}),i==="skills"?a.jsx("div",{className:"af-skill-collections-manager",children:a.jsxs("div",{className:"af-skill-collections-create",children:[a.jsx("input",{className:"af-set-input af-set-input--sm",value:S,onChange:U=>g(U.target.value),onKeyDown:U=>{U.key==="Enter"&&Qn()},placeholder:"新建 skill collection"}),a.jsxs("button",{type:"button",className:"af-set-btn-add af-set-btn-add--compact",disabled:!S.trim()||v,onClick:()=>Qn(),children:[a.jsx("span",{className:"material-symbols-outlined",children:"add"}),"新建"]})]})}):null]}):null,Gt?a.jsx("div",{className:"af-resource-grid",children:er.length>0?er.map(U=>a.jsxs("button",{type:"button",className:"af-resource-card"+(qe&&Kt(U)===Kt(qe)?" af-resource-card--active":""),onClick:()=>de(Kt(U)),children:[a.jsxs("div",{className:"af-resource-card-head",children:[a.jsx("span",{className:Yc(U.type==="control"?"secondary":U.type==="provide"?"primary":"muted"),children:a.jsx(gn,{query:C,children:U.type||"node"})}),a.jsx("span",{className:"af-resource-source",children:a.jsx(gn,{query:C,children:Fb(U.source,t)})})]}),a.jsx("h3",{className:"af-project-title",children:a.jsx(gn,{query:C,children:U.label||U.displayName||U.id})}),a.jsx("p",{className:"af-project-desc",children:a.jsx(gn,{query:C,children:U.description||t("project:noDescription")})}),a.jsxs("div",{className:"af-resource-meta-row",children:[a.jsx("span",{children:a.jsx(gn,{query:C,children:U.id})}),a.jsx("span",{children:t("project:nodeSlots",{inputs:Object.keys(U.inputs||{}).length,outputs:Object.keys(U.outputs||{}).length})})]}),U.packageId?a.jsxs("div",{className:"af-project-path",children:[a.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"deployed_code"}),a.jsx("span",{className:"af-path-text",children:a.jsx(gn,{query:C,children:`${U.packageId}${U.version?` / ${U.version}`:""}`})})]}):null]},`${U.id}:${U.source||""}:${U.packageId||""}`)):I?a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:bt?t("project:noNodeMatch",{query:C.trim()}):t(fr?"project:noMyNodes":"project:noNodes")})}):a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:t("project:loadingResources")})})}):Zn?a.jsx("div",{className:"af-resource-grid",children:Vn.length>0?Vn.map(U=>{const ge=U.snippet&&Array.isArray(U.snippet.instances)?U.snippet.instances:[],_e=U.snippet&&Array.isArray(U.snippet.edges)?U.snippet.edges:[],ze=Number.isFinite(Number(U.nodeCount))?Number(U.nodeCount):ge.length,dt=Number.isFinite(Number(U.edgeCount))?Number(U.edgeCount):_e.length;return a.jsxs("button",{type:"button",className:"af-resource-card"+(At&&Gc(U)===Gc(At)?" af-resource-card--active":""),onClick:()=>de(Gc(U)),children:[a.jsxs("div",{className:"af-resource-card-head",children:[a.jsx("span",{className:Yc("primary"),children:a.jsx(gn,{query:C,children:U.version?`v${U.version}`:"flow"})}),a.jsx("span",{className:"af-resource-source",children:t("project:flowSnippet")})]}),a.jsx("h3",{className:"af-project-title",children:a.jsx(gn,{query:C,children:U.displayName||U.name||U.id})}),a.jsx("p",{className:"af-project-desc",children:a.jsx(gn,{query:C,children:U.description||t("project:noDescription")})}),a.jsxs("div",{className:"af-resource-meta-row",children:[a.jsx("span",{children:t("project:flowSnippetNodes",{nodes:ze,edges:dt})}),a.jsx("span",{children:a.jsx(gn,{query:C,children:U.id})})]}),a.jsxs("div",{className:"af-project-path",children:[a.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"schema"}),a.jsx("span",{className:"af-path-text",children:a.jsx(gn,{query:C,children:Db(U)})})]})]},Gc(U))}):I?a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:bt?t("project:noFlowSnippetMatch",{query:C.trim()}):t("project:noMyFlows")})}):a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:t("project:loadingResources")})})}):i==="skills"?a.jsx("div",{className:"af-resource-grid",children:tr.length>0?tr.map(U=>a.jsxs("button",{type:"button",className:"af-resource-card"+(jt&&Kt(U)===Kt(jt)?" af-resource-card--active":""),onClick:()=>de(Kt(U)),children:[a.jsxs("div",{className:"af-resource-card-head",children:[a.jsx("span",{className:Yc(U.source==="builtin"?"muted":"primary"),children:a.jsx(gn,{query:C,children:U.sourceLabel||U.source||"skill"})}),a.jsx("span",{className:"af-resource-source",children:t("project:skill")})]}),a.jsx("h3",{className:"af-project-title",children:a.jsx(gn,{query:C,children:U.name||U.id})}),a.jsx("p",{className:"af-project-desc",children:a.jsx(gn,{query:C,children:U.description||t("project:noDescription")})}),a.jsxs("div",{className:"af-project-path",children:[a.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"extension"}),a.jsx("span",{className:"af-path-text",children:a.jsx(gn,{query:C,children:U.path||U.key||""})})]}),a.jsxs("div",{className:"af-skill-card-collections",children:[y.filter(ge=>ge.skillKeys.includes(Kt(U))).slice(0,3).map(ge=>a.jsx("span",{children:ge.name},ge.id)),y.filter(ge=>ge.skillKeys.includes(Kt(U))).length===0?a.jsx("span",{className:"af-skill-card-collection-empty",children:"未分组"}):null]})]},U.key||`${U.source}:${U.name}`)):I?a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:bt?t("project:noSkillMatch",{query:C.trim()}):t("project:noSkills")})}):a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:t("project:loadingResources")})})}):a.jsxs("div",{className:"af-project-grid",children:[vi.length>0?vi.map(U=>a.jsx("button",{type:"button",className:"af-project-card",onClick:()=>an(U),children:a.jsxs("div",{className:"af-project-card-body",children:[a.jsx("span",{className:Yc(tx(U.source,t).tone),children:a.jsx(gn,{query:C,children:tx(U.source,t).label})}),U.archived?a.jsx("span",{className:Yc("muted"),children:a.jsx(gn,{query:C,children:t("project:archived")})}):null,a.jsx("h3",{className:"af-project-title",children:a.jsx(gn,{query:C,children:U.id})}),a.jsx("p",{className:"af-project-desc",children:a.jsx(gn,{query:C,children:ZC(U,t)})}),a.jsxs("div",{className:"af-project-path",children:[a.jsx("span",{className:"material-symbols-outlined af-path-icon",children:"database"}),a.jsx("span",{className:"af-path-text",children:a.jsx(gn,{query:C,children:QC(U)})})]})]})},`${U.id}:${U.source??"user"}:${U.archived?"a":""}`)):W?En.length===0?a.jsxs("div",{className:"af-projects-empty-block",children:[a.jsx("p",{className:"af-projects-empty",children:i==="archived"?t("project:noArchived"):o.length>0?t("project:noActive"):t(j?"project:loadFailed":"project:noPipelines")}),!j&&o.length===0&&i==="all"?a.jsx("p",{className:"af-projects-empty-hint",children:t("project:emptyHint",{code1:"agentflow ui",code2:".agentflow/pipelines"})}):null]}):a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:t("project:noMatch",{query:C.trim()})})}):a.jsx("div",{className:"af-projects-empty-block",children:a.jsx("p",{className:"af-projects-empty",children:t("project:loadingPipelines")})}),a.jsxs("button",{type:"button",className:"af-project-add",onClick:()=>H(!0),children:[a.jsx("span",{className:"material-symbols-outlined af-project-add-icon",children:"add_circle"}),a.jsx("span",{className:"af-project-add-label",children:t("project:newPipeline")})]}),Ve?null:a.jsxs("a",{className:"af-hub-card",href:"https://agentflow-hub.com",target:"_blank",rel:"noopener noreferrer",children:[a.jsx("div",{className:"af-hub-card__glow","aria-hidden":!0}),a.jsxs("span",{className:"af-hub-card__eyebrow",children:[a.jsx("span",{className:"material-symbols-outlined af-hub-card__eyebrow-icon",children:"hub"}),t("project:hubCard.eyebrow")]}),a.jsx("h3",{className:"af-hub-card__title",children:t("project:hubCard.title")}),a.jsx("p",{className:"af-hub-card__desc",children:t("project:hubCard.desc")}),a.jsxs("span",{className:"af-hub-card__cta",children:[t("project:hubCard.cta"),a.jsx("span",{className:"material-symbols-outlined af-hub-card__cta-icon",children:"arrow_outward"})]}),a.jsx("code",{className:"af-hub-card__cli",children:t("project:hubCard.cliHint")})]})]})]}),Xi?a.jsx("aside",{className:"af-resource-detail","aria-label":t(Gt?"project:nodeDetail":Zn?"project:flowDetail":"project:skillDetail"),children:Gt&&qe?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-resource-detail-head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"account_tree"}),a.jsxs("div",{children:[a.jsx("h3",{children:qe.label||qe.displayName||qe.id}),a.jsx("p",{children:qe.id})]})]}),a.jsx("div",{className:"af-resource-detail-tabs",children:["overview","schema","runtime","files","usage"].map(U=>a.jsx("button",{type:"button",className:"af-resource-detail-tab"+(ue===U?" af-resource-detail-tab--active":""),onClick:()=>se(U),children:t(`project:nodeDetailTabs.${U}`)},U))}),Ke===Kt(qe)?a.jsx("p",{className:"af-resource-detail-desc",children:t("project:loadingResources")}):ue==="overview"?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"af-resource-detail-desc",children:qe.description||((Vr=De==null?void 0:De.node)==null?void 0:Vr.description)||t("project:noDescription")}),a.jsxs("dl",{className:"af-resource-detail-kv",children:[a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailType")}),a.jsx("dd",{children:qe.type||((Pn=De==null?void 0:De.node)==null?void 0:Pn.type)||"node"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailSource")}),a.jsx("dd",{children:Fb(qe.source,t)})]}),qe.packageId?a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailPackage")}),a.jsx("dd",{children:qe.packageId})]}):null,qe.version?a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailVersion")}),a.jsx("dd",{children:qe.version})]}):null,qe.packageDir||De!=null&&De.baseDir?a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailPath")}),a.jsx("dd",{children:qe.packageDir||(De==null?void 0:De.baseDir)})]}):null,a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailEditable")}),a.jsx("dd",{children:(De==null?void 0:De.readOnly)===!1?t("project:editable"):t("project:readOnly")})]})]}),fr&&qe.source==="marketplace"?a.jsxs("div",{className:"af-resource-detail-section af-resource-danger-zone",children:[a.jsx("h4",{children:t("project:myNodeManagement")}),a.jsx("p",{children:t("project:deleteMyNodeHint")}),a.jsxs("button",{type:"button",className:"af-btn-secondary af-btn-danger",disabled:Ur===Kt(qe),onClick:()=>on(qe),children:[a.jsx("span",{className:"material-symbols-outlined",children:"delete"}),Ur===Kt(qe)?t("project:deletingMyNode"):t("project:deleteMyNode")]}),oe?a.jsx("p",{className:"af-resource-action-message",children:oe}):null]}):null,a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:t("project:resourceMeaning")}),a.jsx("p",{children:t("project:nodesMeaning")})]})]}):ue==="schema"?a.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[a.jsx("h4",{children:t("project:nodeSchema")}),a.jsxs("div",{className:"af-resource-slot-group",children:[a.jsx("span",{children:t("project:nodeInputs")}),Of(((Wr=De==null?void 0:De.node)==null?void 0:Wr.inputs)||qe.inputs).length>0?Of(((hr=De==null?void 0:De.node)==null?void 0:hr.inputs)||qe.inputs).map(U=>a.jsxs("code",{children:[U.name||U.key,U.type?`: ${U.type}`:""]},U.key)):a.jsx("em",{children:t("project:noSlots")})]}),a.jsxs("div",{className:"af-resource-slot-group",children:[a.jsx("span",{children:t("project:nodeOutputs")}),Of(((Xt=De==null?void 0:De.node)==null?void 0:Xt.outputs)||qe.outputs).length>0?Of(((mr=De==null?void 0:De.node)==null?void 0:mr.outputs)||qe.outputs).map(U=>a.jsxs("code",{children:[U.name||U.key,U.type?`: ${U.type}`:""]},U.key)):a.jsx("em",{children:t("project:noSlots")})]})]}):ue==="runtime"?a.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[a.jsx("h4",{children:t("project:nodeRuntime")}),De!=null&&De.runtime?a.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(De.runtime,null,2)}):a.jsx("p",{children:t("project:noRuntimeManifest")}),De!=null&&De.body?a.jsxs(a.Fragment,{children:[a.jsx("h4",{className:"af-resource-detail-subtitle",children:t("project:nodeBody")}),a.jsx("pre",{className:"af-resource-skill-preview",children:De.body})]}):a.jsx("p",{children:t("project:noNodeBody")})]}):ue==="files"?a.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[a.jsx("h4",{children:t("project:nodeFiles")}),Array.isArray(De==null?void 0:De.files)&&De.files.length>0?a.jsxs("div",{className:"af-node-file-browser",children:[a.jsx("div",{className:"af-node-file-list",children:De.files.map(U=>a.jsxs("button",{type:"button",className:"af-node-file-item"+(It===U.path?" af-node-file-item--active":""),onClick:()=>pn(U.path),children:[a.jsx("span",{className:"material-symbols-outlined",children:"description"}),a.jsx("span",{children:U.path})]},U.path))}),a.jsxs("pre",{className:"af-resource-skill-preview",children:[xn===`${Kt(qe)}:${It}`?t("project:loadingResources"):_n!=null&&_n.binary?t("project:binaryFile"):(_n==null?void 0:_n.content)||t("project:selectNodeFile"),_n!=null&&_n.truncated?`
43
-
44
- ${t("project:fileTruncated")}`:""]})]}):a.jsx("p",{children:t("project:noNodeFiles")})]}):a.jsxs("div",{className:"af-resource-detail-section af-resource-detail-section--plain",children:[a.jsx("h4",{children:t("project:nodeUsage")}),Array.isArray(De==null?void 0:De.usage)&&De.usage.length>0?a.jsx("div",{className:"af-node-usage-list",children:De.usage.map(U=>a.jsxs("div",{className:"af-node-usage-item",children:[a.jsx("strong",{children:U.flowId}),a.jsxs("span",{children:[U.flowSource,U.archived?` · ${t("project:archived")}`:""]}),a.jsx("em",{children:U.instances.map(ge=>ge.label||ge.instanceId).join(", ")})]},`${U.flowSource}:${U.flowId}:${U.archived?"a":""}`))}):a.jsx("p",{children:t("project:noNodeUsage")})]})]}):Zn&&At?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-resource-detail-head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"schema"}),a.jsxs("div",{children:[a.jsx("h3",{children:At.displayName||At.name||At.id}),a.jsx("p",{children:At.id})]})]}),a.jsx("p",{className:"af-resource-detail-desc",children:At.description||t("project:noDescription")}),a.jsxs("dl",{className:"af-resource-detail-kv",children:[a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailVersion")}),a.jsx("dd",{children:At.version||"1.0.0"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailPath")}),a.jsx("dd",{children:Db(At)})]}),a.jsxs("div",{children:[a.jsx("dt",{children:t("project:flowSnippetScale")}),a.jsx("dd",{children:t("project:flowSnippetNodes",{nodes:Number.isFinite(Number(At.nodeCount))?Number(At.nodeCount):Array.isArray((gr=At.snippet)==null?void 0:gr.instances)?At.snippet.instances.length:0,edges:Number.isFinite(Number(At.edgeCount))?Number(At.edgeCount):Array.isArray((Kr=At.snippet)==null?void 0:Kr.edges)?At.snippet.edges.length:0})})]})]}),a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:t("project:resourceMeaning")}),a.jsx("p",{children:t("project:myFlowsMeaning")})]}),a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:t("project:flowSnippetPreview")}),a.jsx("pre",{className:"af-resource-skill-preview",children:JSON.stringify(At.snippet||{},null,2)})]})]}):i==="skills"&&jt?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-resource-detail-head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"extension"}),a.jsxs("div",{children:[a.jsx("h3",{children:jt.name||jt.id}),a.jsx("p",{children:jt.sourceLabel||jt.source})]})]}),a.jsx("p",{className:"af-resource-detail-desc",children:jt.description||t("project:noDescription")}),a.jsxs("dl",{className:"af-resource-detail-kv",children:[a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailSource")}),a.jsx("dd",{children:jt.sourceLabel||jt.source})]}),a.jsxs("div",{children:[a.jsx("dt",{children:t("project:detailPath")}),a.jsx("dd",{children:jt.path||jt.key})]})]}),a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:"Collections"}),y.length===0?a.jsx("p",{children:"暂无 collection。可在左侧新建后再添加。"}):a.jsx("div",{className:"af-skill-detail-collections",children:y.map(U=>{const ge=Kt(jt),_e=U.skillKeys.includes(ge);return a.jsxs("label",{className:"af-composer-skill-option af-skill-detail-collection-option",children:[a.jsx("input",{type:"checkbox",checked:_e,disabled:v,onChange:ze=>Ut(U.id,ge,ze.target.checked)}),a.jsxs("span",{className:"af-composer-skill-option-main",children:[a.jsx("span",{className:"af-composer-skill-option-title",children:U.name}),a.jsxs("span",{className:"af-composer-skill-option-desc",children:[U.skillKeys.length," skills"]})]})]},U.id)})})]}),a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:t("project:resourceMeaning")}),a.jsx("p",{children:t("project:skillsMeaning")})]}),a.jsxs("div",{className:"af-resource-detail-section",children:[a.jsx("h4",{children:t("project:skillPreview")}),a.jsx("pre",{className:"af-resource-skill-preview",children:ye===Kt(jt)?t("project:loadingResources"):($t==null?void 0:$t.body)||($t==null?void 0:$t.content)||t("project:skillPreviewEmpty")})]})]}):a.jsx("p",{className:"af-activity-empty",children:t("project:selectResource")})}):a.jsxs("aside",{id:"af-recent-activity-panel",className:"af-activity"+(Q?"":" af-activity--hidden"),"aria-hidden":!Q,"aria-label":t("project:recentActivity"),children:[a.jsxs("h2",{className:"af-activity-title",children:[a.jsx("span",{className:"af-activity-bullet"}),t("project:recentActivity")]}),a.jsx("div",{className:"af-activity-list",children:Yi.length===0?a.jsx("p",{className:"af-activity-empty",children:jr.length===0?t("project:noRecentActivity"):t("project:noMatchRecent")}):Yi.map(U=>a.jsxs("button",{type:"button",className:"af-activity-row af-activity-row--action",onClick:()=>pr(U),children:[a.jsxs("div",{className:"af-activity-row-top",children:[a.jsx("h4",{className:"af-activity-name",children:a.jsx(gn,{query:C,children:U.flowId})}),a.jsx("span",{className:"af-activity-time",children:Qy(U.at,t)})]}),a.jsxs("div",{className:"af-activity-meta",children:[a.jsx("span",{className:lO(U.kind),children:U.kind==="executed"?"play_arrow":"visibility"}),a.jsxs("p",{className:"af-activity-text",children:[U.kind==="executed"?t("project:recentRun"):t("project:recentOpen")," · ",Qy(U.at,t)]})]})]},`${U.kind}-${U.flowId}-${U.flowSource}-${U.at}`))})]})]}),a.jsx(tO,{open:$,onClose:()=>H(!1),onCreated:async U=>{H(!1),await jn();const ge=U.source??"user";n(Lf({id:U.id,source:ge},"workspace"))}}),z?a.jsx(ZL,{file:z,onClose:()=>Y(null),onImported:async U=>{Y(null),await jn();const ge=U.source??"user";n(Lf({id:U.id,source:ge},"workspace"))}},`${z.name}-${z.size}-${z.lastModified}`):null]})}function Sn(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=Sn(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var gO={value:()=>{}};function Kh(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new xp(n)}function xp(e){this._=e}function yO(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}xp.prototype=Kh.prototype={constructor:xp,on:function(e,t){var n=this._,r=yO(e+"",n),i,s=-1,o=r.length;if(arguments.length<2){for(;++s<o;)if((i=(e=r[s]).type)&&(i=xO(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++s<o;)if(i=(e=r[s]).type)n[i]=zb(n[i],e.name,t);else if(t==null)for(i in n)n[i]=zb(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new xp(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,s;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(s=this._[e],r=0,i=s.length;r<i;++r)s[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],i=0,s=r.length;i<s;++i)r[i].value.apply(t,n)}};function xO(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function zb(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=gO,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var nx="http://www.w3.org/1999/xhtml";const Bb={svg:"http://www.w3.org/2000/svg",xhtml:nx,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function qh(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Bb.hasOwnProperty(t)?{space:Bb[t],local:e}:e}function wO(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===nx&&t.documentElement.namespaceURI===nx?t.createElement(e):t.createElementNS(n,e)}}function vO(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function eE(e){var t=qh(e);return(t.local?vO:wO)(t)}function bO(){}function zw(e){return e==null?bO:function(){return this.querySelector(e)}}function kO(e){typeof e!="function"&&(e=zw(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],o=s.length,l=r[i]=new Array(o),c,d,u=0;u<o;++u)(c=s[u])&&(d=e.call(c,c.__data__,u,s))&&("__data__"in c&&(d.__data__=c.__data__),l[u]=d);return new ri(r,this._parents)}function SO(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function NO(){return[]}function tE(e){return e==null?NO:function(){return this.querySelectorAll(e)}}function jO(e){return function(){return SO(e.apply(this,arguments))}}function CO(e){typeof e=="function"?e=jO(e):e=tE(e);for(var t=this._groups,n=t.length,r=[],i=[],s=0;s<n;++s)for(var o=t[s],l=o.length,c,d=0;d<l;++d)(c=o[d])&&(r.push(e.call(c,c.__data__,d,o)),i.push(c));return new ri(r,i)}function nE(e){return function(){return this.matches(e)}}function rE(e){return function(t){return t.matches(e)}}var EO=Array.prototype.find;function _O(e){return function(){return EO.call(this.children,e)}}function PO(){return this.firstElementChild}function IO(e){return this.select(e==null?PO:_O(typeof e=="function"?e:rE(e)))}var AO=Array.prototype.filter;function TO(){return Array.from(this.children)}function RO(e){return function(){return AO.call(this.children,e)}}function LO(e){return this.selectAll(e==null?TO:RO(typeof e=="function"?e:rE(e)))}function OO(e){typeof e!="function"&&(e=nE(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],o=s.length,l=r[i]=[],c,d=0;d<o;++d)(c=s[d])&&e.call(c,c.__data__,d,s)&&l.push(c);return new ri(r,this._parents)}function iE(e){return new Array(e.length)}function MO(){return new ri(this._enter||this._groups.map(iE),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 $O(e){return function(){return e}}function FO(e,t,n,r,i,s){for(var o=0,l,c=t.length,d=s.length;o<d;++o)(l=t[o])?(l.__data__=s[o],r[o]=l):n[o]=new eh(e,s[o]);for(;o<c;++o)(l=t[o])&&(i[o]=l)}function DO(e,t,n,r,i,s,o){var l,c,d=new Map,u=t.length,p=s.length,f=new Array(u),h;for(l=0;l<u;++l)(c=t[l])&&(f[l]=h=o.call(c,c.__data__,l,t)+"",d.has(h)?i[l]=c:d.set(h,c));for(l=0;l<p;++l)h=o.call(e,s[l],l,s)+"",(c=d.get(h))?(r[l]=c,c.__data__=s[l],d.delete(h)):n[l]=new eh(e,s[l]);for(l=0;l<u;++l)(c=t[l])&&d.get(f[l])===c&&(i[l]=c)}function zO(e){return e.__data__}function BO(e,t){if(!arguments.length)return Array.from(this,zO);var n=t?DO:FO,r=this._parents,i=this._groups;typeof e!="function"&&(e=$O(e));for(var s=i.length,o=new Array(s),l=new Array(s),c=new Array(s),d=0;d<s;++d){var u=r[d],p=i[d],f=p.length,h=HO(e.call(u,u&&u.__data__,d,r)),y=h.length,b=l[d]=new Array(y),S=o[d]=new Array(y),g=c[d]=new Array(f);n(u,p,b,S,g,h,t);for(var v=0,w=0,k,E;v<y;++v)if(k=b[v]){for(v>=w&&(w=v+1);!(E=S[w])&&++w<y;);k._next=E||null}}return o=new ri(o,r),o._enter=l,o._exit=c,o}function HO(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function UO(){return new ri(this._exit||this._groups.map(iE),this._parents)}function VO(e,t,n){var r=this.enter(),i=this,s=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?s.remove():n(s),r&&i?r.merge(i).order():i}function WO(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,s=r.length,o=Math.min(i,s),l=new Array(i),c=0;c<o;++c)for(var d=n[c],u=r[c],p=d.length,f=l[c]=new Array(p),h,y=0;y<p;++y)(h=d[y]||u[y])&&(f[y]=h);for(;c<i;++c)l[c]=n[c];return new ri(l,this._parents)}function KO(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,s=r[i],o;--i>=0;)(o=r[i])&&(s&&o.compareDocumentPosition(s)^4&&s.parentNode.insertBefore(o,s),s=o);return this}function qO(e){e||(e=YO);function t(p,f){return p&&f?e(p.__data__,f.__data__):!p-!f}for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s){for(var o=n[s],l=o.length,c=i[s]=new Array(l),d,u=0;u<l;++u)(d=o[u])&&(c[u]=d);c.sort(t)}return new ri(i,this._parents).order()}function YO(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function GO(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function XO(){return Array.from(this)}function JO(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length;i<s;++i){var o=r[i];if(o)return o}return null}function QO(){let e=0;for(const t of this)++e;return e}function ZO(){return!this.node()}function eM(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],s=0,o=i.length,l;s<o;++s)(l=i[s])&&e.call(l,l.__data__,s,i);return this}function tM(e){return function(){this.removeAttribute(e)}}function nM(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rM(e,t){return function(){this.setAttribute(e,t)}}function iM(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function sM(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function oM(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 aM(e,t){var n=qh(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?nM:tM:typeof t=="function"?n.local?oM:sM:n.local?iM:rM)(n,t))}function sE(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function lM(e){return function(){this.style.removeProperty(e)}}function cM(e,t,n){return function(){this.style.setProperty(e,t,n)}}function uM(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function dM(e,t,n){return arguments.length>1?this.each((t==null?lM:typeof t=="function"?uM:cM)(e,t,n??"")):Jl(this.node(),e)}function Jl(e,t){return e.style.getPropertyValue(t)||sE(e).getComputedStyle(e,null).getPropertyValue(t)}function fM(e){return function(){delete this[e]}}function pM(e,t){return function(){this[e]=t}}function hM(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function mM(e,t){return arguments.length>1?this.each((t==null?fM:typeof t=="function"?hM:pM)(e,t)):this.node()[e]}function oE(e){return e.trim().split(/^|\s+/)}function Bw(e){return e.classList||new aE(e)}function aE(e){this._node=e,this._names=oE(e.getAttribute("class")||"")}aE.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 lE(e,t){for(var n=Bw(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function cE(e,t){for(var n=Bw(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function gM(e){return function(){lE(this,e)}}function yM(e){return function(){cE(this,e)}}function xM(e,t){return function(){(t.apply(this,arguments)?lE:cE)(this,e)}}function wM(e,t){var n=oE(e+"");if(arguments.length<2){for(var r=Bw(this.node()),i=-1,s=n.length;++i<s;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?xM:t?gM:yM)(n,t))}function vM(){this.textContent=""}function bM(e){return function(){this.textContent=e}}function kM(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function SM(e){return arguments.length?this.each(e==null?vM:(typeof e=="function"?kM:bM)(e)):this.node().textContent}function NM(){this.innerHTML=""}function jM(e){return function(){this.innerHTML=e}}function CM(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function EM(e){return arguments.length?this.each(e==null?NM:(typeof e=="function"?CM:jM)(e)):this.node().innerHTML}function _M(){this.nextSibling&&this.parentNode.appendChild(this)}function PM(){return this.each(_M)}function IM(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function AM(){return this.each(IM)}function TM(e){var t=typeof e=="function"?e:eE(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function RM(){return null}function LM(e,t){var n=typeof e=="function"?e:eE(e),r=t==null?RM:typeof t=="function"?t:zw(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function OM(){var e=this.parentNode;e&&e.removeChild(this)}function MM(){return this.each(OM)}function $M(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function FM(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function DM(e){return this.select(e?FM:$M)}function zM(e){return arguments.length?this.property("__data__",e):this.node().__data__}function BM(e){return function(t){e.call(this,t,this.__data__)}}function HM(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 UM(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,s;n<i;++n)s=t[n],(!e.type||s.type===e.type)&&s.name===e.name?this.removeEventListener(s.type,s.listener,s.options):t[++r]=s;++r?t.length=r:delete this.__on}}}function VM(e,t,n){return function(){var r=this.__on,i,s=BM(t);if(r){for(var o=0,l=r.length;o<l;++o)if((i=r[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=s,i.options=n),i.value=t;return}}this.addEventListener(e.type,s,n),i={type:e.type,name:e.name,value:t,listener:s,options:n},r?r.push(i):this.__on=[i]}}function WM(e,t,n){var r=HM(e+""),i,s=r.length,o;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,d=l.length,u;c<d;++c)for(i=0,u=l[c];i<s;++i)if((o=r[i]).type===u.type&&o.name===u.name)return u.value}return}for(l=t?VM:UM,i=0;i<s;++i)this.each(l(r[i],t,n));return this}function uE(e,t,n){var r=sE(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function KM(e,t){return function(){return uE(this,e,t)}}function qM(e,t){return function(){return uE(this,e,t.apply(this,arguments))}}function YM(e,t){return this.each((typeof t=="function"?qM:KM)(e,t))}function*GM(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,s=r.length,o;i<s;++i)(o=r[i])&&(yield o)}var dE=[null];function ri(e,t){this._groups=e,this._parents=t}function Nd(){return new ri([[document.documentElement]],dE)}function XM(){return this}ri.prototype=Nd.prototype={constructor:ri,select:kO,selectAll:CO,selectChild:IO,selectChildren:LO,filter:OO,data:BO,enter:MO,exit:UO,join:VO,merge:WO,selection:XM,order:KO,sort:qO,call:GO,nodes:XO,node:JO,size:QO,empty:ZO,each:eM,attr:aM,style:dM,property:mM,classed:wM,text:SM,html:EM,raise:PM,lower:AM,append:TM,insert:LM,remove:MM,clone:DM,datum:zM,on:WM,dispatch:YM,[Symbol.iterator]:GM};function Jr(e){return typeof e=="string"?new ri([[document.querySelector(e)]],[document.documentElement]):new ri([[e]],dE)}function JM(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Oi(e,t){if(e=JM(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 i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const QM={passive:!1},Xu={capture:!0,passive:!1};function gg(e){e.stopImmediatePropagation()}function Dl(e){e.preventDefault(),e.stopImmediatePropagation()}function fE(e){var t=e.document.documentElement,n=Jr(e).on("dragstart.drag",Dl,Xu);"onselectstart"in t?n.on("selectstart.drag",Dl,Xu):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function pE(e,t){var n=e.document.documentElement,r=Jr(e).on("dragstart.drag",null);t&&(r.on("click.drag",Dl,Xu),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 Mf=e=>()=>e;function rx(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:s,x:o,y:l,dx:c,dy:d,dispatch:u}){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:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:u}})}rx.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function ZM(e){return!e.ctrlKey&&!e.button}function e$(){return this.parentNode}function t$(e,t){return t??{x:e.x,y:e.y}}function n$(){return navigator.maxTouchPoints||"ontouchstart"in this}function hE(){var e=ZM,t=e$,n=t$,r=n$,i={},s=Kh("start","drag","end"),o=0,l,c,d,u,p=0;function f(k){k.on("mousedown.drag",h).filter(r).on("touchstart.drag",S).on("touchmove.drag",g,QM).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(k,E){if(!(u||!e.call(this,k,E))){var j=w(this,t.call(this,k,E),k,E,"mouse");j&&(Jr(k.view).on("mousemove.drag",y,Xu).on("mouseup.drag",b,Xu),fE(k.view),gg(k),d=!1,l=k.clientX,c=k.clientY,j("start",k))}}function y(k){if(Dl(k),!d){var E=k.clientX-l,j=k.clientY-c;d=E*E+j*j>p}i.mouse("drag",k)}function b(k){Jr(k.view).on("mousemove.drag mouseup.drag",null),pE(k.view,d),Dl(k),i.mouse("end",k)}function S(k,E){if(e.call(this,k,E)){var j=k.changedTouches,P=t.call(this,k,E),O=j.length,F,W;for(F=0;F<O;++F)(W=w(this,P,k,E,j[F].identifier,j[F]))&&(gg(k),W("start",k,j[F]))}}function g(k){var E=k.changedTouches,j=E.length,P,O;for(P=0;P<j;++P)(O=i[E[P].identifier])&&(Dl(k),O("drag",k,E[P]))}function v(k){var E=k.changedTouches,j=E.length,P,O;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),P=0;P<j;++P)(O=i[E[P].identifier])&&(gg(k),O("end",k,E[P]))}function w(k,E,j,P,O,F){var W=s.copy(),R=Oi(F||j,E),I,q,$;if(($=n.call(k,new rx("beforestart",{sourceEvent:j,target:f,identifier:O,active:o,x:R[0],y:R[1],dx:0,dy:0,dispatch:W}),P))!=null)return I=$.x-R[0]||0,q=$.y-R[1]||0,function H(z,Y,A){var T=R,C;switch(z){case"start":i[O]=H,C=o++;break;case"end":delete i[O],--o;case"drag":R=Oi(A||Y,E),C=o;break}W.call(z,k,new rx(z,{sourceEvent:Y,subject:$,target:f,identifier:O,active:C,x:R[0]+I,y:R[1]+q,dx:R[0]-T[0],dy:R[1]-T[1],dispatch:W}),P)}}return f.filter=function(k){return arguments.length?(e=typeof k=="function"?k:Mf(!!k),f):e},f.container=function(k){return arguments.length?(t=typeof k=="function"?k:Mf(k),f):t},f.subject=function(k){return arguments.length?(n=typeof k=="function"?k:Mf(k),f):n},f.touchable=function(k){return arguments.length?(r=typeof k=="function"?k:Mf(!!k),f):r},f.on=function(){var k=s.on.apply(s,arguments);return k===s?f:k},f.clickDistance=function(k){return arguments.length?(p=(k=+k)*k,f):Math.sqrt(p)},f}function Hw(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function mE(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function jd(){}var Ju=.7,th=1/Ju,zl="\\s*([+-]?\\d+)\\s*",Qu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",xs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",r$=/^#([0-9a-f]{3,8})$/,i$=new RegExp(`^rgb\\(${zl},${zl},${zl}\\)$`),s$=new RegExp(`^rgb\\(${xs},${xs},${xs}\\)$`),o$=new RegExp(`^rgba\\(${zl},${zl},${zl},${Qu}\\)$`),a$=new RegExp(`^rgba\\(${xs},${xs},${xs},${Qu}\\)$`),l$=new RegExp(`^hsl\\(${Qu},${xs},${xs}\\)$`),c$=new RegExp(`^hsla\\(${Qu},${xs},${xs},${Qu}\\)$`),Hb={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};Hw(jd,Ra,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ub,formatHex:Ub,formatHex8:u$,formatHsl:d$,formatRgb:Vb,toString:Vb});function Ub(){return this.rgb().formatHex()}function u$(){return this.rgb().formatHex8()}function d$(){return gE(this).formatHsl()}function Vb(){return this.rgb().formatRgb()}function Ra(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=r$.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Wb(t):n===3?new Lr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?$f(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?$f(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=i$.exec(e))?new Lr(t[1],t[2],t[3],1):(t=s$.exec(e))?new Lr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=o$.exec(e))?$f(t[1],t[2],t[3],t[4]):(t=a$.exec(e))?$f(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=l$.exec(e))?Yb(t[1],t[2]/100,t[3]/100,1):(t=c$.exec(e))?Yb(t[1],t[2]/100,t[3]/100,t[4]):Hb.hasOwnProperty(e)?Wb(Hb[e]):e==="transparent"?new Lr(NaN,NaN,NaN,0):null}function Wb(e){return new Lr(e>>16&255,e>>8&255,e&255,1)}function $f(e,t,n,r){return r<=0&&(e=t=n=NaN),new Lr(e,t,n,r)}function f$(e){return e instanceof jd||(e=Ra(e)),e?(e=e.rgb(),new Lr(e.r,e.g,e.b,e.opacity)):new Lr}function ix(e,t,n,r){return arguments.length===1?f$(e):new Lr(e,t,n,r??1)}function Lr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Hw(Lr,ix,mE(jd,{brighter(e){return e=e==null?th:Math.pow(th,e),new Lr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ju:Math.pow(Ju,e),new Lr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Lr(Na(this.r),Na(this.g),Na(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:Kb,formatHex:Kb,formatHex8:p$,formatRgb:qb,toString:qb}));function Kb(){return`#${ba(this.r)}${ba(this.g)}${ba(this.b)}`}function p$(){return`#${ba(this.r)}${ba(this.g)}${ba(this.b)}${ba((isNaN(this.opacity)?1:this.opacity)*255)}`}function qb(){const e=nh(this.opacity);return`${e===1?"rgb(":"rgba("}${Na(this.r)}, ${Na(this.g)}, ${Na(this.b)}${e===1?")":`, ${e})`}`}function nh(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Na(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ba(e){return e=Na(e),(e<16?"0":"")+e.toString(16)}function Yb(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Fi(e,t,n,r)}function gE(e){if(e instanceof Fi)return new Fi(e.h,e.s,e.l,e.opacity);if(e instanceof jd||(e=Ra(e)),!e)return new Fi;if(e instanceof Fi)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),s=Math.max(t,n,r),o=NaN,l=s-i,c=(s+i)/2;return l?(t===s?o=(n-r)/l+(n<r)*6:n===s?o=(r-t)/l+2:o=(t-n)/l+4,l/=c<.5?s+i:2-s-i,o*=60):l=c>0&&c<1?0:o,new Fi(o,l,c,e.opacity)}function h$(e,t,n,r){return arguments.length===1?gE(e):new Fi(e,t,n,r??1)}function Fi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Hw(Fi,h$,mE(jd,{brighter(e){return e=e==null?th:Math.pow(th,e),new Fi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ju:Math.pow(Ju,e),new Fi(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,i=2*n-r;return new Lr(yg(e>=240?e-240:e+120,i,r),yg(e,i,r),yg(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Fi(Gb(this.h),Ff(this.s),Ff(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("}${Gb(this.h)}, ${Ff(this.s)*100}%, ${Ff(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Gb(e){return e=(e||0)%360,e<0?e+360:e}function Ff(e){return Math.max(0,Math.min(1,e||0))}function yg(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 Uw=e=>()=>e;function m$(e,t){return function(n){return e+n*t}}function g$(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 y$(e){return(e=+e)==1?yE:function(t,n){return n-t?g$(t,n,e):Uw(isNaN(t)?n:t)}}function yE(e,t){var n=t-e;return n?m$(e,n):Uw(isNaN(e)?t:e)}const rh=function e(t){var n=y$(t);function r(i,s){var o=n((i=ix(i)).r,(s=ix(s)).r),l=n(i.g,s.g),c=n(i.b,s.b),d=yE(i.opacity,s.opacity);return function(u){return i.r=o(u),i.g=l(u),i.b=c(u),i.opacity=d(u),i+""}}return r.gamma=e,r}(1);function x$(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(s){for(i=0;i<n;++i)r[i]=e[i]*(1-s)+t[i]*s;return r}}function w$(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function v$(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),s=new Array(n),o;for(o=0;o<r;++o)i[o]=ju(e[o],t[o]);for(;o<n;++o)s[o]=t[o];return function(l){for(o=0;o<r;++o)s[o]=i[o](l);return s}}function b$(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function us(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function k$(e,t){var n={},r={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=ju(e[i],t[i]):r[i]=t[i];return function(s){for(i in n)r[i]=n[i](s);return r}}var sx=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,xg=new RegExp(sx.source,"g");function S$(e){return function(){return e}}function N$(e){return function(t){return e(t)+""}}function xE(e,t){var n=sx.lastIndex=xg.lastIndex=0,r,i,s,o=-1,l=[],c=[];for(e=e+"",t=t+"";(r=sx.exec(e))&&(i=xg.exec(t));)(s=i.index)>n&&(s=t.slice(n,s),l[o]?l[o]+=s:l[++o]=s),(r=r[0])===(i=i[0])?l[o]?l[o]+=i:l[++o]=i:(l[++o]=null,c.push({i:o,x:us(r,i)})),n=xg.lastIndex;return n<t.length&&(s=t.slice(n),l[o]?l[o]+=s:l[++o]=s),l.length<2?c[0]?N$(c[0].x):S$(t):(t=c.length,function(d){for(var u=0,p;u<t;++u)l[(p=c[u]).i]=p.x(d);return l.join("")})}function ju(e,t){var n=typeof t,r;return t==null||n==="boolean"?Uw(t):(n==="number"?us:n==="string"?(r=Ra(t))?(t=r,rh):xE:t instanceof Ra?rh:t instanceof Date?b$:w$(t)?x$:Array.isArray(t)?v$:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?k$:us)(e,t)}var Xb=180/Math.PI,ox={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function wE(e,t,n,r,i,s){var o,l,c;return(o=Math.sqrt(e*e+t*t))&&(e/=o,t/=o),(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,o=-o),{translateX:i,translateY:s,rotate:Math.atan2(t,e)*Xb,skewX:Math.atan(c)*Xb,scaleX:o,scaleY:l}}var Df;function j$(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?ox:wE(t.a,t.b,t.c,t.d,t.e,t.f)}function C$(e){return e==null||(Df||(Df=document.createElementNS("http://www.w3.org/2000/svg","g")),Df.setAttribute("transform",e),!(e=Df.transform.baseVal.consolidate()))?ox:(e=e.matrix,wE(e.a,e.b,e.c,e.d,e.e,e.f))}function vE(e,t,n,r){function i(d){return d.length?d.pop()+" ":""}function s(d,u,p,f,h,y){if(d!==p||u!==f){var b=h.push("translate(",null,t,null,n);y.push({i:b-4,x:us(d,p)},{i:b-2,x:us(u,f)})}else(p||f)&&h.push("translate("+p+t+f+n)}function o(d,u,p,f){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),f.push({i:p.push(i(p)+"rotate(",null,r)-2,x:us(d,u)})):u&&p.push(i(p)+"rotate("+u+r)}function l(d,u,p,f){d!==u?f.push({i:p.push(i(p)+"skewX(",null,r)-2,x:us(d,u)}):u&&p.push(i(p)+"skewX("+u+r)}function c(d,u,p,f,h,y){if(d!==p||u!==f){var b=h.push(i(h)+"scale(",null,",",null,")");y.push({i:b-4,x:us(d,p)},{i:b-2,x:us(u,f)})}else(p!==1||f!==1)&&h.push(i(h)+"scale("+p+","+f+")")}return function(d,u){var p=[],f=[];return d=e(d),u=e(u),s(d.translateX,d.translateY,u.translateX,u.translateY,p,f),o(d.rotate,u.rotate,p,f),l(d.skewX,u.skewX,p,f),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,p,f),d=u=null,function(h){for(var y=-1,b=f.length,S;++y<b;)p[(S=f[y]).i]=S.x(h);return p.join("")}}}var E$=vE(j$,"px, ","px)","deg)"),_$=vE(C$,", ",")",")"),P$=1e-12;function Jb(e){return((e=Math.exp(e))+1/e)/2}function I$(e){return((e=Math.exp(e))-1/e)/2}function A$(e){return((e=Math.exp(2*e))-1)/(e+1)}const wp=function e(t,n,r){function i(s,o){var l=s[0],c=s[1],d=s[2],u=o[0],p=o[1],f=o[2],h=u-l,y=p-c,b=h*h+y*y,S,g;if(b<P$)g=Math.log(f/d)/t,S=function(P){return[l+P*h,c+P*y,d*Math.exp(t*P*g)]};else{var v=Math.sqrt(b),w=(f*f-d*d+r*b)/(2*d*n*v),k=(f*f-d*d-r*b)/(2*f*n*v),E=Math.log(Math.sqrt(w*w+1)-w),j=Math.log(Math.sqrt(k*k+1)-k);g=(j-E)/t,S=function(P){var O=P*g,F=Jb(E),W=d/(n*v)*(F*A$(t*O+E)-I$(E));return[l+W*h,c+W*y,d*F/Jb(t*O+E)]}}return S.duration=g*1e3*t/Math.SQRT2,S}return i.rho=function(s){var o=Math.max(.001,+s),l=o*o,c=l*l;return e(o,l,c)},i}(Math.SQRT2,2,4);var Ql=0,cu=0,Xc=0,bE=1e3,ih,uu,sh=0,La=0,Yh=0,Zu=typeof performance=="object"&&performance.now?performance:Date,kE=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Vw(){return La||(kE(T$),La=Zu.now()+Yh)}function T$(){La=0}function oh(){this._call=this._time=this._next=null}oh.prototype=SE.prototype={constructor:oh,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Vw():+n)+(t==null?0:+t),!this._next&&uu!==this&&(uu?uu._next=this:ih=this,uu=this),this._call=e,this._time=n,ax()},stop:function(){this._call&&(this._call=null,this._time=1/0,ax())}};function SE(e,t,n){var r=new oh;return r.restart(e,t,n),r}function R$(){Vw(),++Ql;for(var e=ih,t;e;)(t=La-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ql}function Qb(){La=(sh=Zu.now())+Yh,Ql=cu=0;try{R$()}finally{Ql=0,O$(),La=0}}function L$(){var e=Zu.now(),t=e-sh;t>bE&&(Yh-=t,sh=e)}function O$(){for(var e,t=ih,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:ih=n);uu=e,ax(r)}function ax(e){if(!Ql){cu&&(cu=clearTimeout(cu));var t=e-La;t>24?(e<1/0&&(cu=setTimeout(Qb,e-Zu.now()-Yh)),Xc&&(Xc=clearInterval(Xc))):(Xc||(sh=Zu.now(),Xc=setInterval(L$,bE)),Ql=1,kE(Qb))}}function Zb(e,t,n){var r=new oh;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var M$=Kh("start","end","cancel","interrupt"),$$=[],NE=0,ek=1,lx=2,vp=3,tk=4,cx=5,bp=6;function Gh(e,t,n,r,i,s){var o=e.__transition;if(!o)e.__transition={};else if(n in o)return;F$(e,n,{name:t,index:r,group:i,on:M$,tween:$$,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:NE})}function Ww(e,t){var n=Ki(e,t);if(n.state>NE)throw new Error("too late; already scheduled");return n}function Ns(e,t){var n=Ki(e,t);if(n.state>vp)throw new Error("too late; already running");return n}function Ki(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function F$(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=SE(s,0,n.time);function s(d){n.state=ek,n.timer.restart(o,n.delay,n.time),n.delay<=d&&o(d-n.delay)}function o(d){var u,p,f,h;if(n.state!==ek)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===vp)return Zb(o);h.state===tk?(h.state=bp,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=bp,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(Zb(function(){n.state===vp&&(n.state=tk,n.timer.restart(l,n.delay,n.time),l(d))}),n.state=lx,n.on.call("start",e,e.__data__,n.index,n.group),n.state===lx){for(n.state=vp,i=new Array(f=n.tween.length),u=0,p=-1;u<f;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(i[++p]=h);i.length=p+1}}function l(d){for(var u=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(c),n.state=cx,1),p=-1,f=i.length;++p<f;)i[p].call(e,u);n.state===cx&&(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 d in r)return;delete e.__transition}}function kp(e,t){var n=e.__transition,r,i,s=!0,o;if(n){t=t==null?null:t+"";for(o in n){if((r=n[o]).name!==t){s=!1;continue}i=r.state>lx&&r.state<cx,r.state=bp,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[o]}s&&delete e.__transition}}function D$(e){return this.each(function(){kp(this,e)})}function z$(e,t){var n,r;return function(){var i=Ns(this,e),s=i.tween;if(s!==n){r=n=s;for(var o=0,l=r.length;o<l;++o)if(r[o].name===t){r=r.slice(),r.splice(o,1);break}}i.tween=r}}function B$(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var s=Ns(this,e),o=s.tween;if(o!==r){i=(r=o).slice();for(var l={name:t,value:n},c=0,d=i.length;c<d;++c)if(i[c].name===t){i[c]=l;break}c===d&&i.push(l)}s.tween=i}}function H$(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=Ki(this.node(),n).tween,i=0,s=r.length,o;i<s;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((t==null?z$:B$)(n,e,t))}function Kw(e,t,n){var r=e._id;return e.each(function(){var i=Ns(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return Ki(i,r).value[t]}}function jE(e,t){var n;return(typeof t=="number"?us:t instanceof Ra?rh:(n=Ra(t))?(t=n,rh):xE)(e,t)}function U$(e){return function(){this.removeAttribute(e)}}function V$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function W$(e,t,n){var r,i=n+"",s;return function(){var o=this.getAttribute(e);return o===i?null:o===r?s:s=t(r=o,n)}}function K$(e,t,n){var r,i=n+"",s;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===r?s:s=t(r=o,n)}}function q$(e,t,n){var r,i,s;return function(){var o,l=n(this),c;return l==null?void this.removeAttribute(e):(o=this.getAttribute(e),c=l+"",o===c?null:o===r&&c===i?s:(i=c,s=t(r=o,l)))}}function Y$(e,t,n){var r,i,s;return function(){var o,l=n(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),c=l+"",o===c?null:o===r&&c===i?s:(i=c,s=t(r=o,l)))}}function G$(e,t){var n=qh(e),r=n==="transform"?_$:jE;return this.attrTween(e,typeof t=="function"?(n.local?Y$:q$)(n,r,Kw(this,"attr."+e,t)):t==null?(n.local?V$:U$)(n):(n.local?K$:W$)(n,r,t))}function X$(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function J$(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Q$(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&J$(e,s)),n}return i._value=t,i}function Z$(e,t){var n,r;function i(){var s=t.apply(this,arguments);return s!==r&&(n=(r=s)&&X$(e,s)),n}return i._value=t,i}function eF(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=qh(e);return this.tween(n,(r.local?Q$:Z$)(r,t))}function tF(e,t){return function(){Ww(this,e).delay=+t.apply(this,arguments)}}function nF(e,t){return t=+t,function(){Ww(this,e).delay=t}}function rF(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?tF:nF)(t,e)):Ki(this.node(),t).delay}function iF(e,t){return function(){Ns(this,e).duration=+t.apply(this,arguments)}}function sF(e,t){return t=+t,function(){Ns(this,e).duration=t}}function oF(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?iF:sF)(t,e)):Ki(this.node(),t).duration}function aF(e,t){if(typeof t!="function")throw new Error;return function(){Ns(this,e).ease=t}}function lF(e){var t=this._id;return arguments.length?this.each(aF(t,e)):Ki(this.node(),t).ease}function cF(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ns(this,e).ease=n}}function uF(e){if(typeof e!="function")throw new Error;return this.each(cF(this._id,e))}function dF(e){typeof e!="function"&&(e=nE(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var s=t[i],o=s.length,l=r[i]=[],c,d=0;d<o;++d)(c=s[d])&&e.call(c,c.__data__,d,s)&&l.push(c);return new Gs(r,this._parents,this._name,this._id)}function fF(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,s=Math.min(r,i),o=new Array(r),l=0;l<s;++l)for(var c=t[l],d=n[l],u=c.length,p=o[l]=new Array(u),f,h=0;h<u;++h)(f=c[h]||d[h])&&(p[h]=f);for(;l<r;++l)o[l]=t[l];return new Gs(o,this._parents,this._name,this._id)}function pF(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 hF(e,t,n){var r,i,s=pF(t)?Ww:Ns;return function(){var o=s(this,e),l=o.on;l!==r&&(i=(r=l).copy()).on(t,n),o.on=i}}function mF(e,t){var n=this._id;return arguments.length<2?Ki(this.node(),n).on.on(e):this.each(hF(n,e,t))}function gF(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function yF(){return this.on("end.remove",gF(this._id))}function xF(e){var t=this._name,n=this._id;typeof e!="function"&&(e=zw(e));for(var r=this._groups,i=r.length,s=new Array(i),o=0;o<i;++o)for(var l=r[o],c=l.length,d=s[o]=new Array(c),u,p,f=0;f<c;++f)(u=l[f])&&(p=e.call(u,u.__data__,f,l))&&("__data__"in u&&(p.__data__=u.__data__),d[f]=p,Gh(d[f],t,n,f,d,Ki(u,n)));return new Gs(s,this._parents,t,n)}function wF(e){var t=this._name,n=this._id;typeof e!="function"&&(e=tE(e));for(var r=this._groups,i=r.length,s=[],o=[],l=0;l<i;++l)for(var c=r[l],d=c.length,u,p=0;p<d;++p)if(u=c[p]){for(var f=e.call(u,u.__data__,p,c),h,y=Ki(u,n),b=0,S=f.length;b<S;++b)(h=f[b])&&Gh(h,t,n,b,f,y);s.push(f),o.push(u)}return new Gs(s,o,t,n)}var vF=Nd.prototype.constructor;function bF(){return new vF(this._groups,this._parents)}function kF(e,t){var n,r,i;return function(){var s=Jl(this,e),o=(this.style.removeProperty(e),Jl(this,e));return s===o?null:s===n&&o===r?i:i=t(n=s,r=o)}}function CE(e){return function(){this.style.removeProperty(e)}}function SF(e,t,n){var r,i=n+"",s;return function(){var o=Jl(this,e);return o===i?null:o===r?s:s=t(r=o,n)}}function NF(e,t,n){var r,i,s;return function(){var o=Jl(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),Jl(this,e))),o===c?null:o===r&&c===i?s:(i=c,s=t(r=o,l))}}function jF(e,t){var n,r,i,s="style."+t,o="end."+s,l;return function(){var c=Ns(this,e),d=c.on,u=c.value[s]==null?l||(l=CE(t)):void 0;(d!==n||i!==u)&&(r=(n=d).copy()).on(o,i=u),c.on=r}}function CF(e,t,n){var r=(e+="")=="transform"?E$:jE;return t==null?this.styleTween(e,kF(e,r)).on("end.style."+e,CE(e)):typeof t=="function"?this.styleTween(e,NF(e,r,Kw(this,"style."+e,t))).each(jF(this._id,e)):this.styleTween(e,SF(e,r,t),n).on("end.style."+e,null)}function EF(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function _F(e,t,n){var r,i;function s(){var o=t.apply(this,arguments);return o!==i&&(r=(i=o)&&EF(e,o,n)),r}return s._value=t,s}function PF(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,_F(e,t,n??""))}function IF(e){return function(){this.textContent=e}}function AF(e){return function(){var t=e(this);this.textContent=t??""}}function TF(e){return this.tween("text",typeof e=="function"?AF(Kw(this,"text",e)):IF(e==null?"":e+""))}function RF(e){return function(t){this.textContent=e.call(this,t)}}function LF(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&RF(i)),t}return r._value=e,r}function OF(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,LF(e))}function MF(){for(var e=this._name,t=this._id,n=EE(),r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],l=o.length,c,d=0;d<l;++d)if(c=o[d]){var u=Ki(c,t);Gh(c,e,n,d,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Gs(r,this._parents,e,n)}function $F(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(s,o){var l={value:o},c={value:function(){--i===0&&s()}};n.each(function(){var d=Ns(this,r),u=d.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),d.on=t}),i===0&&s()})}var FF=0;function Gs(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function EE(){return++FF}var Ls=Nd.prototype;Gs.prototype={constructor:Gs,select:xF,selectAll:wF,selectChild:Ls.selectChild,selectChildren:Ls.selectChildren,filter:dF,merge:fF,selection:bF,transition:MF,call:Ls.call,nodes:Ls.nodes,node:Ls.node,size:Ls.size,empty:Ls.empty,each:Ls.each,on:mF,attr:G$,attrTween:eF,style:CF,styleTween:PF,text:TF,textTween:OF,remove:yF,tween:H$,delay:rF,duration:oF,ease:lF,easeVarying:uF,end:$F,[Symbol.iterator]:Ls[Symbol.iterator]};function DF(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var zF={time:null,delay:0,duration:250,ease:DF};function BF(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 HF(e){var t,n;e instanceof Gs?(t=e._id,e=e._name):(t=EE(),(n=zF).time=Vw(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var o=r[s],l=o.length,c,d=0;d<l;++d)(c=o[d])&&Gh(c,e,t,d,o,n||BF(c,t));return new Gs(r,this._parents,e,t)}Nd.prototype.interrupt=D$;Nd.prototype.transition=HF;const zf=e=>()=>e;function UF(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){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:i}})}function Hs(e,t,n){this.k=e,this.x=t,this.y=n}Hs.prototype={constructor:Hs,scale:function(e){return e===1?this:new Hs(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Hs(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 Xh=new Hs(1,0,0);_E.prototype=Hs.prototype;function _E(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Xh;return e.__zoom}function wg(e){e.stopImmediatePropagation()}function Jc(e){e.preventDefault(),e.stopImmediatePropagation()}function VF(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function WF(){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 nk(){return this.__zoom||Xh}function KF(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function qF(){return navigator.maxTouchPoints||"ontouchstart"in this}function YF(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],s=e.invertY(t[0][1])-n[0][1],o=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o))}function PE(){var e=VF,t=WF,n=YF,r=KF,i=qF,s=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],l=250,c=wp,d=Kh("start","zoom","end"),u,p,f,h=500,y=150,b=0,S=10;function g($){$.property("__zoom",nk).on("wheel.zoom",O,{passive:!1}).on("mousedown.zoom",F).on("dblclick.zoom",W).filter(i).on("touchstart.zoom",R).on("touchmove.zoom",I).on("touchend.zoom touchcancel.zoom",q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function($,H,z,Y){var A=$.selection?$.selection():$;A.property("__zoom",nk),$!==A?E($,H,z,Y):A.interrupt().each(function(){j(this,arguments).event(Y).start().zoom(null,typeof H=="function"?H.apply(this,arguments):H).end()})},g.scaleBy=function($,H,z,Y){g.scaleTo($,function(){var A=this.__zoom.k,T=typeof H=="function"?H.apply(this,arguments):H;return A*T},z,Y)},g.scaleTo=function($,H,z,Y){g.transform($,function(){var A=t.apply(this,arguments),T=this.__zoom,C=z==null?k(A):typeof z=="function"?z.apply(this,arguments):z,G=T.invert(C),Q=typeof H=="function"?H.apply(this,arguments):H;return n(w(v(T,Q),C,G),A,o)},z,Y)},g.translateBy=function($,H,z,Y){g.transform($,function(){return n(this.__zoom.translate(typeof H=="function"?H.apply(this,arguments):H,typeof z=="function"?z.apply(this,arguments):z),t.apply(this,arguments),o)},null,Y)},g.translateTo=function($,H,z,Y,A){g.transform($,function(){var T=t.apply(this,arguments),C=this.__zoom,G=Y==null?k(T):typeof Y=="function"?Y.apply(this,arguments):Y;return n(Xh.translate(G[0],G[1]).scale(C.k).translate(typeof H=="function"?-H.apply(this,arguments):-H,typeof z=="function"?-z.apply(this,arguments):-z),T,o)},Y,A)};function v($,H){return H=Math.max(s[0],Math.min(s[1],H)),H===$.k?$:new Hs(H,$.x,$.y)}function w($,H,z){var Y=H[0]-z[0]*$.k,A=H[1]-z[1]*$.k;return Y===$.x&&A===$.y?$:new Hs($.k,Y,A)}function k($){return[(+$[0][0]+ +$[1][0])/2,(+$[0][1]+ +$[1][1])/2]}function E($,H,z,Y){$.on("start.zoom",function(){j(this,arguments).event(Y).start()}).on("interrupt.zoom end.zoom",function(){j(this,arguments).event(Y).end()}).tween("zoom",function(){var A=this,T=arguments,C=j(A,T).event(Y),G=t.apply(A,T),Q=z==null?k(G):typeof z=="function"?z.apply(A,T):z,M=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),te=A.__zoom,ce=typeof H=="function"?H.apply(A,T):H,le=c(te.invert(Q).concat(M/te.k),ce.invert(Q).concat(M/ce.k));return function(de){if(de===1)de=ce;else{var ue=le(de),se=M/ue[2];de=new Hs(se,Q[0]-ue[0]*se,Q[1]-ue[1]*se)}C.zoom(null,de)}})}function j($,H,z){return!z&&$.__zooming||new P($,H)}function P($,H){this.that=$,this.args=H,this.active=0,this.sourceEvent=null,this.extent=t.apply($,H),this.taps=0}P.prototype={event:function($){return $&&(this.sourceEvent=$),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function($,H){return this.mouse&&$!=="mouse"&&(this.mouse[1]=H.invert(this.mouse[0])),this.touch0&&$!=="touch"&&(this.touch0[1]=H.invert(this.touch0[0])),this.touch1&&$!=="touch"&&(this.touch1[1]=H.invert(this.touch1[0])),this.that.__zoom=H,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function($){var H=Jr(this.that).datum();d.call($,this.that,new UF($,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:d}),H)}};function O($,...H){if(!e.apply(this,arguments))return;var z=j(this,H).event($),Y=this.__zoom,A=Math.max(s[0],Math.min(s[1],Y.k*Math.pow(2,r.apply(this,arguments)))),T=Oi($);if(z.wheel)(z.mouse[0][0]!==T[0]||z.mouse[0][1]!==T[1])&&(z.mouse[1]=Y.invert(z.mouse[0]=T)),clearTimeout(z.wheel);else{if(Y.k===A)return;z.mouse=[T,Y.invert(T)],kp(this),z.start()}Jc($),z.wheel=setTimeout(C,y),z.zoom("mouse",n(w(v(Y,A),z.mouse[0],z.mouse[1]),z.extent,o));function C(){z.wheel=null,z.end()}}function F($,...H){if(f||!e.apply(this,arguments))return;var z=$.currentTarget,Y=j(this,H,!0).event($),A=Jr($.view).on("mousemove.zoom",Q,!0).on("mouseup.zoom",M,!0),T=Oi($,z),C=$.clientX,G=$.clientY;fE($.view),wg($),Y.mouse=[T,this.__zoom.invert(T)],kp(this),Y.start();function Q(te){if(Jc(te),!Y.moved){var ce=te.clientX-C,le=te.clientY-G;Y.moved=ce*ce+le*le>b}Y.event(te).zoom("mouse",n(w(Y.that.__zoom,Y.mouse[0]=Oi(te,z),Y.mouse[1]),Y.extent,o))}function M(te){A.on("mousemove.zoom mouseup.zoom",null),pE(te.view,Y.moved),Jc(te),Y.event(te).end()}}function W($,...H){if(e.apply(this,arguments)){var z=this.__zoom,Y=Oi($.changedTouches?$.changedTouches[0]:$,this),A=z.invert(Y),T=z.k*($.shiftKey?.5:2),C=n(w(v(z,T),Y,A),t.apply(this,H),o);Jc($),l>0?Jr(this).transition().duration(l).call(E,C,Y,$):Jr(this).call(g.transform,C,Y,$)}}function R($,...H){if(e.apply(this,arguments)){var z=$.touches,Y=z.length,A=j(this,H,$.changedTouches.length===Y).event($),T,C,G,Q;for(wg($),C=0;C<Y;++C)G=z[C],Q=Oi(G,this),Q=[Q,this.__zoom.invert(Q),G.identifier],A.touch0?!A.touch1&&A.touch0[2]!==Q[2]&&(A.touch1=Q,A.taps=0):(A.touch0=Q,T=!0,A.taps=1+!!u);u&&(u=clearTimeout(u)),T&&(A.taps<2&&(p=Q[0],u=setTimeout(function(){u=null},h)),kp(this),A.start())}}function I($,...H){if(this.__zooming){var z=j(this,H).event($),Y=$.changedTouches,A=Y.length,T,C,G,Q;for(Jc($),T=0;T<A;++T)C=Y[T],G=Oi(C,this),z.touch0&&z.touch0[2]===C.identifier?z.touch0[0]=G:z.touch1&&z.touch1[2]===C.identifier&&(z.touch1[0]=G);if(C=z.that.__zoom,z.touch1){var M=z.touch0[0],te=z.touch0[1],ce=z.touch1[0],le=z.touch1[1],de=(de=ce[0]-M[0])*de+(de=ce[1]-M[1])*de,ue=(ue=le[0]-te[0])*ue+(ue=le[1]-te[1])*ue;C=v(C,Math.sqrt(de/ue)),G=[(M[0]+ce[0])/2,(M[1]+ce[1])/2],Q=[(te[0]+le[0])/2,(te[1]+le[1])/2]}else if(z.touch0)G=z.touch0[0],Q=z.touch0[1];else return;z.zoom("touch",n(w(C,G,Q),z.extent,o))}}function q($,...H){if(this.__zooming){var z=j(this,H).event($),Y=$.changedTouches,A=Y.length,T,C;for(wg($),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),T=0;T<A;++T)C=Y[T],z.touch0&&z.touch0[2]===C.identifier?delete z.touch0:z.touch1&&z.touch1[2]===C.identifier&&delete z.touch1;if(z.touch1&&!z.touch0&&(z.touch0=z.touch1,delete z.touch1),z.touch0)z.touch0[1]=this.__zoom.invert(z.touch0[0]);else if(z.end(),z.taps===2&&(C=Oi(C,this),Math.hypot(p[0]-C[0],p[1]-C[1])<S)){var G=Jr(this).on("dblclick.zoom");G&&G.apply(this,arguments)}}}return g.wheelDelta=function($){return arguments.length?(r=typeof $=="function"?$:zf(+$),g):r},g.filter=function($){return arguments.length?(e=typeof $=="function"?$:zf(!!$),g):e},g.touchable=function($){return arguments.length?(i=typeof $=="function"?$:zf(!!$),g):i},g.extent=function($){return arguments.length?(t=typeof $=="function"?$:zf([[+$[0][0],+$[0][1]],[+$[1][0],+$[1][1]]]),g):t},g.scaleExtent=function($){return arguments.length?(s[0]=+$[0],s[1]=+$[1],g):[s[0],s[1]]},g.translateExtent=function($){return arguments.length?(o[0][0]=+$[0][0],o[1][0]=+$[1][0],o[0][1]=+$[0][1],o[1][1]=+$[1][1],g):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},g.constrain=function($){return arguments.length?(n=$,g):n},g.duration=function($){return arguments.length?(l=+$,g):l},g.interpolate=function($){return arguments.length?(c=$,g):c},g.on=function(){var $=d.on.apply(d,arguments);return $===d?g:$},g.clickDistance=function($){return arguments.length?(b=($=+$)*$,g):Math.sqrt(b)},g.tapDistance=function($){return arguments.length?(S=+$,g):S},g}const ks={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."},ed=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],IE=["Enter"," ","Escape"],AE={"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 Zl;(function(e){e.Strict="strict",e.Loose="loose"})(Zl||(Zl={}));var ja;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(ja||(ja={}));var td;(function(e){e.Partial="partial",e.Full="full"})(td||(td={}));const TE={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var So;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(So||(So={}));var zr;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(zr||(zr={}));var $e;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})($e||($e={}));const rk={[$e.Left]:$e.Right,[$e.Right]:$e.Left,[$e.Top]:$e.Bottom,[$e.Bottom]:$e.Top};function RE(e){return e===null?null:e?"valid":"invalid"}const LE=e=>"id"in e&&"source"in e&&"target"in e,GF=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),qw=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Cd=(e,t=[0,0])=>{const{width:n,height:r}=Zs(e),i=e.origin??t,s=n*i[0],o=r*i[1];return{x:e.position.x-s,y:e.position.y-o}},XF=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const s=typeof i=="string";let o=!t.nodeLookup&&!s?i:void 0;t.nodeLookup&&(o=s?t.nodeLookup.get(i):qw(i)?i:t.nodeLookup.get(i.id));const l=o?ah(o,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Jh(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Qh(n)},Ed=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(i=>{(t.filter===void 0||t.filter(i))&&(n=Jh(n,ah(i)),r=!0)}),r?Qh(n):{x:0,y:0,width:0,height:0}},Yw=(e,t,[n,r,i]=[0,0,1],s=!1,o=!1)=>{const l={...Pd(t,[n,r,i]),width:t.width/i,height:t.height/i},c=[];for(const d of e.values()){const{measured:u,selectable:p=!0,hidden:f=!1}=d;if(o&&!p||f)continue;const h=u.width??d.width??d.initialWidth??null,y=u.height??d.height??d.initialHeight??null,b=nd(l,tc(d)),S=(h??0)*(y??0),g=s&&b>0;(!d.internals.handleBounds||g||b>=S||d.dragging)&&c.push(d)}return c},JF=(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 QF(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(i=>i.id)):null;return e.forEach(i=>{i.measured.width&&i.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!i.hidden)&&(!r||r.has(i.id))&&n.set(i.id,i)}),n}async function ZF({nodes:e,width:t,height:n,panZoom:r,minZoom:i,maxZoom:s},o){if(e.size===0)return Promise.resolve(!0);const l=QF(e,o),c=Ed(l),d=Gw(c,t,n,(o==null?void 0:o.minZoom)??i,(o==null?void 0:o.maxZoom)??s,(o==null?void 0:o.padding)??.1);return await r.setViewport(d,{duration:o==null?void 0:o.duration,ease:o==null?void 0:o.ease,interpolate:o==null?void 0:o.interpolate}),Promise.resolve(!0)}function OE({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:i,onError:s}){const o=n.get(e),l=o.parentId?n.get(o.parentId):void 0,{x:c,y:d}=l?l.internals.positionAbsolute:{x:0,y:0},u=o.origin??r;let p=o.extent||i;if(o.extent==="parent"&&!o.expandParent)if(!l)s==null||s("005",ks.error005());else{const h=l.measured.width,y=l.measured.height;h&&y&&(p=[[c,d],[c+h,d+y]])}else l&&nc(o.extent)&&(p=[[o.extent[0][0]+c,o.extent[0][1]+d],[o.extent[1][0]+c,o.extent[1][1]+d]]);const f=nc(p)?Oa(t,p,o.measured):t;return(o.measured.width===void 0||o.measured.height===void 0)&&(s==null||s("015",ks.error015())),{position:{x:f.x-c+(o.measured.width??0)*u[0],y:f.y-d+(o.measured.height??0)*u[1]},positionAbsolute:f}}async function eD({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:i}){const s=new Set(e.map(f=>f.id)),o=[];for(const f of n){if(f.deletable===!1)continue;const h=s.has(f.id),y=!h&&f.parentId&&o.find(b=>b.id===f.parentId);(h||y)&&o.push(f)}const l=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),u=JF(o,c);for(const f of c)l.has(f.id)&&!u.find(y=>y.id===f.id)&&u.push(f);if(!i)return{edges:u,nodes:o};const p=await i({nodes:o,edges:u});return typeof p=="boolean"?p?{edges:u,nodes:o}:{edges:[],nodes:[]}:p}const ec=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Oa=(e={x:0,y:0},t,n)=>({x:ec(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:ec(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function ME(e,t,n){const{width:r,height:i}=Zs(n),{x:s,y:o}=n.internals.positionAbsolute;return Oa(e,[[s,o],[s+r,o+i]],t)}const ik=(e,t,n)=>e<t?ec(Math.abs(e-t),1,t)/t:e>n?-ec(Math.abs(e-n),1,t)/t:0,$E=(e,t,n=15,r=40)=>{const i=ik(e.x,r,t.width-r)*n,s=ik(e.y,r,t.height-r)*n;return[i,s]},Jh=(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)}),ux=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),Qh=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),tc=(e,t=[0,0])=>{var i,s;const{x:n,y:r}=qw(e)?e.internals.positionAbsolute:Cd(e,t);return{x:n,y:r,width:((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0,height:((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0}},ah=(e,t=[0,0])=>{var i,s;const{x:n,y:r}=qw(e)?e.internals.positionAbsolute:Cd(e,t);return{x:n,y:r,x2:n+(((i=e.measured)==null?void 0:i.width)??e.width??e.initialWidth??0),y2:r+(((s=e.measured)==null?void 0:s.height)??e.height??e.initialHeight??0)}},FE=(e,t)=>Qh(Jh(ux(e),ux(t))),nd=(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)},sk=e=>Di(e.width)&&Di(e.height)&&Di(e.x)&&Di(e.y),Di=e=>!isNaN(e)&&isFinite(e),tD=(e,t)=>{},_d=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Pd=({x:e,y:t},[n,r,i],s=!1,o=[1,1])=>{const l={x:(e-n)/i,y:(t-r)/i};return s?_d(l,o):l},lh=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r});function ol(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 nD(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=ol(e,n),i=ol(e,t);return{top:r,right:i,bottom:r,left:i,x:i*2,y:r*2}}if(typeof e=="object"){const r=ol(e.top??e.y??0,n),i=ol(e.bottom??e.y??0,n),s=ol(e.left??e.x??0,t),o=ol(e.right??e.x??0,t);return{top:r,right:o,bottom:i,left:s,x:s+o,y:r+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function rD(e,t,n,r,i,s){const{x:o,y:l}=lh(e,[t,n,r]),{x:c,y:d}=lh({x:e.x+e.width,y:e.y+e.height},[t,n,r]),u=i-c,p=s-d;return{left:Math.floor(o),top:Math.floor(l),right:Math.floor(u),bottom:Math.floor(p)}}const Gw=(e,t,n,r,i,s)=>{const o=nD(s,t,n),l=(t-o.x)/e.width,c=(n-o.y)/e.height,d=Math.min(l,c),u=ec(d,r,i),p=e.x+e.width/2,f=e.y+e.height/2,h=t/2-p*u,y=n/2-f*u,b=rD(e,h,y,u,t,n),S={left:Math.min(b.left-o.left,0),top:Math.min(b.top-o.top,0),right:Math.min(b.right-o.right,0),bottom:Math.min(b.bottom-o.bottom,0)};return{x:h-S.left+S.right,y:y-S.top+S.bottom,zoom:u}},rd=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function nc(e){return e!=null&&e!=="parent"}function Zs(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 DE(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 zE(e,t={width:0,height:0},n,r,i){const s={...e},o=r.get(n);if(o){const l=o.origin||i;s.x+=o.internals.positionAbsolute.x-(t.width??0)*l[0],s.y+=o.internals.positionAbsolute.y-(t.height??0)*l[1]}return s}function ok(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function iD(){let e,t;return{promise:new Promise((r,i)=>{e=r,t=i}),resolve:e,reject:t}}function sD(e){return{...AE,...e||{}}}function Cu(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:i}){const{x:s,y:o}=zi(e),l=Pd({x:s-((i==null?void 0:i.left)??0),y:o-((i==null?void 0:i.top)??0)},r),{x:c,y:d}=n?_d(l,t):l;return{xSnapped:c,ySnapped:d,...l}}const Xw=e=>({width:e.offsetWidth,height:e.offsetHeight}),BE=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},oD=["INPUT","SELECT","TEXTAREA"];function HE(e){var r,i;const t=((i=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:i[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:oD.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const UE=e=>"clientX"in e,zi=(e,t)=>{var s,o;const n=UE(e),r=n?e.clientX:(s=e.touches)==null?void 0:s[0].clientX,i=n?e.clientY:(o=e.touches)==null?void 0:o[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},ak=(e,t,n,r,i)=>{const s=t.querySelectorAll(`.${e}`);return!s||!s.length?null:Array.from(s).map(o=>{const l=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:e,nodeId:i,position:o.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...Xw(o)}})};function VE({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:i,sourceControlY:s,targetControlX:o,targetControlY:l}){const c=e*.125+i*.375+o*.375+n*.125,d=t*.125+s*.375+l*.375+r*.125,u=Math.abs(c-e),p=Math.abs(d-t);return[c,d,u,p]}function Bf(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function lk({pos:e,x1:t,y1:n,x2:r,y2:i,c:s}){switch(e){case $e.Left:return[t-Bf(t-r,s),n];case $e.Right:return[t+Bf(r-t,s),n];case $e.Top:return[t,n-Bf(n-i,s)];case $e.Bottom:return[t,n+Bf(i-n,s)]}}function WE({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:r,targetY:i,targetPosition:s=$e.Top,curvature:o=.25}){const[l,c]=lk({pos:n,x1:e,y1:t,x2:r,y2:i,c:o}),[d,u]=lk({pos:s,x1:r,y1:i,x2:e,y2:t,c:o}),[p,f,h,y]=VE({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${e},${t} C${l},${c} ${d},${u} ${r},${i}`,p,f,h,y]}function KE({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,s=n<e?n+i:n-i,o=Math.abs(r-t)/2,l=r<t?r+o:r-o;return[s,l,i,o]}function aD({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:i=!1,zIndexMode:s="basic"}){if(s==="manual")return r;const o=i&&n?r+1e3:r,l=Math.max(e.parentId||i&&e.selected?e.internals.z:0,t.parentId||i&&t.selected?t.internals.z:0);return o+l}function lD({sourceNode:e,targetNode:t,width:n,height:r,transform:i}){const s=Jh(ah(e),ah(t));s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const o={x:-i[0]/i[2],y:-i[1]/i[2],width:n/i[2],height:r/i[2]};return nd(o,Qh(s))>0}const cD=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,uD=(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)),id=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||cD;let i;return LE(e)?i={...e}:i={...e,id:r(e)},uD(i,t)?t:(i.sourceHandle===null&&delete i.sourceHandle,i.targetHandle===null&&delete i.targetHandle,t.concat(i))};function qE({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,s,o,l]=KE({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,s,o,l]}const ck={[$e.Left]:{x:-1,y:0},[$e.Right]:{x:1,y:0},[$e.Top]:{x:0,y:-1},[$e.Bottom]:{x:0,y:1}},dD=({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},uk=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function fD({source:e,sourcePosition:t=$e.Bottom,target:n,targetPosition:r=$e.Top,center:i,offset:s,stepPosition:o}){const l=ck[t],c=ck[r],d={x:e.x+l.x*s,y:e.y+l.y*s},u={x:n.x+c.x*s,y:n.y+c.y*s},p=dD({source:d,sourcePosition:t,target:u}),f=p.x!==0?"x":"y",h=p[f];let y=[],b,S;const g={x:0,y:0},v={x:0,y:0},[,,w,k]=KE({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[f]*c[f]===-1){f==="x"?(b=i.x??d.x+(u.x-d.x)*o,S=i.y??(d.y+u.y)/2):(b=i.x??(d.x+u.x)/2,S=i.y??d.y+(u.y-d.y)*o);const O=[{x:b,y:d.y},{x:b,y:u.y}],F=[{x:d.x,y:S},{x:u.x,y:S}];l[f]===h?y=f==="x"?O:F:y=f==="x"?F:O}else{const O=[{x:d.x,y:u.y}],F=[{x:u.x,y:d.y}];if(f==="x"?y=l.x===h?F:O:y=l.y===h?O:F,t===r){const $=Math.abs(e[f]-n[f]);if($<=s){const H=Math.min(s-1,s-$);l[f]===h?g[f]=(d[f]>e[f]?-1:1)*H:v[f]=(u[f]>n[f]?-1:1)*H}}if(t!==r){const $=f==="x"?"y":"x",H=l[f]===c[$],z=d[$]>u[$],Y=d[$]<u[$];(l[f]===1&&(!H&&z||H&&Y)||l[f]!==1&&(!H&&Y||H&&z))&&(y=f==="x"?O:F)}const W={x:d.x+g.x,y:d.y+g.y},R={x:u.x+v.x,y:u.y+v.y},I=Math.max(Math.abs(W.x-y[0].x),Math.abs(R.x-y[0].x)),q=Math.max(Math.abs(W.y-y[0].y),Math.abs(R.y-y[0].y));I>=q?(b=(W.x+R.x)/2,S=y[0].y):(b=y[0].x,S=(W.y+R.y)/2)}const E={x:d.x+g.x,y:d.y+g.y},j={x:u.x+v.x,y:u.y+v.y};return[[e,...E.x!==y[0].x||E.y!==y[0].y?[E]:[],...y,...j.x!==y[y.length-1].x||j.y!==y[y.length-1].y?[j]:[],n],b,S,w,k]}function pD(e,t,n,r){const i=Math.min(uk(e,t)/2,uk(t,n)/2,r),{x:s,y:o}=t;if(e.x===s&&s===n.x||e.y===o&&o===n.y)return`L${s} ${o}`;if(e.y===o){const d=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${s+i*d},${o}Q ${s},${o} ${s},${o+i*u}`}const l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${s},${o+i*c}Q ${s},${o} ${s+i*l},${o}`}function dx({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:r,targetY:i,targetPosition:s=$e.Top,borderRadius:o=5,centerX:l,centerY:c,offset:d=20,stepPosition:u=.5}){const[p,f,h,y,b]=fD({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:i},targetPosition:s,center:{x:l,y:c},offset:d,stepPosition:u});let S=`M${p[0].x} ${p[0].y}`;for(let g=1;g<p.length-1;g++)S+=pD(p[g-1],p[g],p[g+1],o);return S+=`L${p[p.length-1].x} ${p[p.length-1].y}`,[S,f,h,y,b]}function dk(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function hD(e){var p;const{sourceNode:t,targetNode:n}=e;if(!dk(t)||!dk(n))return null;const r=t.internals.handleBounds||fk(t.handles),i=n.internals.handleBounds||fk(n.handles),s=pk((r==null?void 0:r.source)??[],e.sourceHandle),o=pk(e.connectionMode===Zl.Strict?(i==null?void 0:i.target)??[]:((i==null?void 0:i.target)??[]).concat((i==null?void 0:i.source)??[]),e.targetHandle);if(!s||!o)return(p=e.onError)==null||p.call(e,"008",ks.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=(s==null?void 0:s.position)||$e.Bottom,c=(o==null?void 0:o.position)||$e.Top,d=Ma(t,s,l),u=Ma(n,o,c);return{sourceX:d.x,sourceY:d.y,targetX:u.x,targetY:u.y,sourcePosition:l,targetPosition:c}}function fk(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 Ma(e,t,n=$e.Left,r=!1){const i=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,s=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:o,height:l}=t??Zs(e);if(r)return{x:i+o/2,y:s+l/2};switch((t==null?void 0:t.position)??n){case $e.Top:return{x:i+o/2,y:s};case $e.Right:return{x:i+o,y:s+l/2};case $e.Bottom:return{x:i+o/2,y:s+l};case $e.Left:return{x:i,y:s+l/2}}}function pk(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function fx(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function mD(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:i}){const s=new Set;return e.reduce((o,l)=>([l.markerStart||r,l.markerEnd||i].forEach(c=>{if(c&&typeof c=="object"){const d=fx(c,t);s.has(d)||(o.push({id:d,color:c.color||n,...c}),s.add(d))}}),o),[]).sort((o,l)=>o.id.localeCompare(l.id))}const YE=1e3,gD=10,Jw={nodeOrigin:[0,0],nodeExtent:ed,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},yD={...Jw,checkEquality:!0};function Qw(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function xD(e,t,n){const r=Qw(Jw,n);for(const i of e.values())if(i.parentId)ev(i,e,t,r);else{const s=Cd(i,r.nodeOrigin),o=nc(i.extent)?i.extent:r.nodeExtent,l=Oa(s,o,Zs(i));i.internals.positionAbsolute=l}}function wD(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const i of e.handles){const s={id:i.id,width:i.width??1,height:i.height??1,nodeId:e.id,x:i.x,y:i.y,position:i.position,type:i.type};i.type==="source"?n.push(s):i.type==="target"&&r.push(s)}return{source:n,target:r}}function Zw(e){return e==="manual"}function px(e,t,n,r={}){var u,p;const i=Qw(yD,r),s={i:0},o=new Map(t),l=i!=null&&i.elevateNodesOnSelect&&!Zw(i.zIndexMode)?YE:0;let c=e.length>0,d=!1;t.clear(),n.clear();for(const f of e){let h=o.get(f.id);if(i.checkEquality&&f===(h==null?void 0:h.internals.userNode))t.set(f.id,h);else{const y=Cd(f,i.nodeOrigin),b=nc(f.extent)?f.extent:i.nodeExtent,S=Oa(y,b,Zs(f));h={...i.defaults,...f,measured:{width:(u=f.measured)==null?void 0:u.width,height:(p=f.measured)==null?void 0:p.height},internals:{positionAbsolute:S,handleBounds:wD(f,h),z:GE(f,l,i.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&&ev(h,t,n,r,s),d||(d=f.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:d}}function vD(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 ev(e,t,n,r,i){const{elevateNodesOnSelect:s,nodeOrigin:o,nodeExtent:l,zIndexMode:c}=Qw(Jw,r),d=e.parentId,u=t.get(d);if(!u){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}vD(e,n),i&&!u.parentId&&u.internals.rootParentIndex===void 0&&c==="auto"&&(u.internals.rootParentIndex=++i.i,u.internals.z=u.internals.z+i.i*gD),i&&u.internals.rootParentIndex!==void 0&&(i.i=u.internals.rootParentIndex);const p=s&&!Zw(c)?YE:0,{x:f,y:h,z:y}=bD(e,u,o,l,p,c),{positionAbsolute:b}=e.internals,S=f!==b.x||h!==b.y;(S||y!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:S?{x:f,y:h}:b,z:y}})}function GE(e,t,n){const r=Di(e.zIndex)?e.zIndex:0;return Zw(n)?r:r+(e.selected?t:0)}function bD(e,t,n,r,i,s){const{x:o,y:l}=t.internals.positionAbsolute,c=Zs(e),d=Cd(e,n),u=nc(e.extent)?Oa(d,e.extent,c):d;let p=Oa({x:o+u.x,y:l+u.y},r,c);e.extent==="parent"&&(p=ME(p,c,t));const f=GE(e,i,s),h=t.internals.z??0;return{x:p.x,y:p.y,z:h>=f?h+1:f}}function tv(e,t,n,r=[0,0]){var o;const i=[],s=new Map;for(const l of e){const c=t.get(l.parentId);if(!c)continue;const d=((o=s.get(l.parentId))==null?void 0:o.expandedRect)??tc(c),u=FE(d,l.rect);s.set(l.parentId,{expandedRect:u,parent:c})}return s.size>0&&s.forEach(({expandedRect:l,parent:c},d)=>{var w;const u=c.internals.positionAbsolute,p=Zs(c),f=c.origin??r,h=l.x<u.x?Math.round(Math.abs(u.x-l.x)):0,y=l.y<u.y?Math.round(Math.abs(u.y-l.y)):0,b=Math.max(p.width,Math.round(l.width)),S=Math.max(p.height,Math.round(l.height)),g=(b-p.width)*f[0],v=(S-p.height)*f[1];(h>0||y>0||g||v)&&(i.push({id:d,type:"position",position:{x:c.position.x-h+g,y:c.position.y-y+v}}),(w=n.get(d))==null||w.forEach(k=>{e.some(E=>E.id===k.id)||i.push({id:k.id,type:"position",position:{x:k.position.x+h,y:k.position.y+y}})})),(p.width<l.width||p.height<l.height||h||y)&&i.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:b+(h?f[0]*h-g:0),height:S+(y?f[1]*y-v:0)}})}),i}function kD(e,t,n,r,i,s,o){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const d=[],u=window.getComputedStyle(l),{m22:p}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const h of e.values()){const y=t.get(h.id);if(!y)continue;if(y.hidden){t.set(y.id,{...y,internals:{...y.internals,handleBounds:void 0}}),c=!0;continue}const b=Xw(h.nodeElement),S=y.measured.width!==b.width||y.measured.height!==b.height;if(!!(b.width&&b.height&&(S||!y.internals.handleBounds||h.force))){const v=h.nodeElement.getBoundingClientRect(),w=nc(y.extent)?y.extent:s;let{positionAbsolute:k}=y.internals;y.parentId&&y.extent==="parent"?k=ME(k,b,t.get(y.parentId)):w&&(k=Oa(k,w,b));const E={...y,measured:b,internals:{...y.internals,positionAbsolute:k,handleBounds:{source:ak("source",h.nodeElement,v,p,y.id),target:ak("target",h.nodeElement,v,p,y.id)}}};t.set(y.id,E),y.parentId&&ev(E,t,n,{nodeOrigin:i,zIndexMode:o}),c=!0,S&&(d.push({id:y.id,type:"dimensions",dimensions:b}),y.expandParent&&y.parentId&&f.push({id:y.id,parentId:y.parentId,rect:tc(E,i)}))}}if(f.length>0){const h=tv(f,t,n,i);d.push(...h)}return{changes:d,updatedInternals:c}}async function SD({delta:e,panZoom:t,transform:n,translateExtent:r,width:i,height:s}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const o=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[i,s]],r),l=!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2]);return Promise.resolve(l)}function hk(e,t,n,r,i,s){let o=i;const l=r.get(o)||new Map;r.set(o,l.set(n,t)),o=`${i}-${e}`;const c=r.get(o)||new Map;if(r.set(o,c.set(n,t)),s){o=`${i}-${e}-${s}`;const d=r.get(o)||new Map;r.set(o,d.set(n,t))}}function XE(e,t,n){e.clear(),t.clear();for(const r of n){const{source:i,target:s,sourceHandle:o=null,targetHandle:l=null}=r,c={edgeId:r.id,source:i,target:s,sourceHandle:o,targetHandle:l},d=`${i}-${o}--${s}-${l}`,u=`${s}-${l}--${i}-${o}`;hk("source",c,u,e,i,o),hk("target",c,d,e,s,l),t.set(r.id,r)}}function JE(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:JE(n,t):!1}function mk(e,t,n){var i;let r=e;do{if((i=r==null?void 0:r.matches)!=null&&i.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function ND(e,t,n,r){const i=new Map;for(const[s,o]of e)if((o.selected||o.id===r)&&(!o.parentId||!JE(o,e))&&(o.draggable||t&&typeof o.draggable>"u")){const l=e.get(s);l&&i.set(s,{id:s,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 i}function vg({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var o,l,c;const i=[];for(const[d,u]of t){const p=(o=n.get(d))==null?void 0:o.internals.userNode;p&&i.push({...p,position:u.position,dragging:r})}if(!e)return[i[0],i];const s=(l=n.get(e))==null?void 0:l.internals.userNode;return[s?{...s,position:((c=t.get(e))==null?void 0:c.position)||s.position,dragging:r}:i[0],i]}function jD({dragItems:e,snapGrid:t,x:n,y:r}){const i=e.values().next().value;if(!i)return null;const s={x:n-i.distance.x,y:r-i.distance.y},o=_d(s,t);return{x:o.x-s.x,y:o.y-s.y}}function CD({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:i}){let s={x:null,y:null},o=0,l=new Map,c=!1,d={x:0,y:0},u=null,p=!1,f=null,h=!1,y=!1,b=null;function S({noDragClassName:v,handleSelector:w,domNode:k,isSelectable:E,nodeId:j,nodeClickDistance:P=0}){f=Jr(k);function O({x:I,y:q}){const{nodeLookup:$,nodeExtent:H,snapGrid:z,snapToGrid:Y,nodeOrigin:A,onNodeDrag:T,onSelectionDrag:C,onError:G,updateNodePositions:Q}=t();s={x:I,y:q};let M=!1;const te=l.size>1,ce=te&&H?ux(Ed(l)):null,le=te&&Y?jD({dragItems:l,snapGrid:z,x:I,y:q}):null;for(const[de,ue]of l){if(!$.has(de))continue;let se={x:I-ue.distance.x,y:q-ue.distance.y};Y&&(se=le?{x:Math.round(se.x+le.x),y:Math.round(se.y+le.y)}:_d(se,z));let re=null;if(te&&H&&!ue.extent&&ce){const{positionAbsolute:Se}=ue.internals,He=Se.x-ce.x+H[0][0],st=Se.x+ue.measured.width-ce.x2+H[1][0],Ke=Se.y-ce.y+H[0][1],Te=Se.y+ue.measured.height-ce.y2+H[1][1];re=[[He,Ke],[st,Te]]}const{position:fe,positionAbsolute:ye}=OE({nodeId:de,nextPosition:se,nodeLookup:$,nodeExtent:re||H,nodeOrigin:A,onError:G});M=M||ue.position.x!==fe.x||ue.position.y!==fe.y,ue.position=fe,ue.internals.positionAbsolute=ye}if(y=y||M,!!M&&(Q(l,!0),b&&(r||T||!j&&C))){const[de,ue]=vg({nodeId:j,dragItems:l,nodeLookup:$});r==null||r(b,l,de,ue),T==null||T(b,de,ue),j||C==null||C(b,ue)}}async function F(){if(!u)return;const{transform:I,panBy:q,autoPanSpeed:$,autoPanOnNodeDrag:H}=t();if(!H){c=!1,cancelAnimationFrame(o);return}const[z,Y]=$E(d,u,$);(z!==0||Y!==0)&&(s.x=(s.x??0)-z/I[2],s.y=(s.y??0)-Y/I[2],await q({x:z,y:Y})&&O(s)),o=requestAnimationFrame(F)}function W(I){var te;const{nodeLookup:q,multiSelectionActive:$,nodesDraggable:H,transform:z,snapGrid:Y,snapToGrid:A,selectNodesOnDrag:T,onNodeDragStart:C,onSelectionDragStart:G,unselectNodesAndEdges:Q}=t();p=!0,(!T||!E)&&!$&&j&&((te=q.get(j))!=null&&te.selected||Q()),E&&T&&j&&(e==null||e(j));const M=Cu(I.sourceEvent,{transform:z,snapGrid:Y,snapToGrid:A,containerBounds:u});if(s=M,l=ND(q,H,M,j),l.size>0&&(n||C||!j&&G)){const[ce,le]=vg({nodeId:j,dragItems:l,nodeLookup:q});n==null||n(I.sourceEvent,l,ce,le),C==null||C(I.sourceEvent,ce,le),j||G==null||G(I.sourceEvent,le)}}const R=hE().clickDistance(P).on("start",I=>{const{domNode:q,nodeDragThreshold:$,transform:H,snapGrid:z,snapToGrid:Y}=t();u=(q==null?void 0:q.getBoundingClientRect())||null,h=!1,y=!1,b=I.sourceEvent,$===0&&W(I),s=Cu(I.sourceEvent,{transform:H,snapGrid:z,snapToGrid:Y,containerBounds:u}),d=zi(I.sourceEvent,u)}).on("drag",I=>{const{autoPanOnNodeDrag:q,transform:$,snapGrid:H,snapToGrid:z,nodeDragThreshold:Y,nodeLookup:A}=t(),T=Cu(I.sourceEvent,{transform:$,snapGrid:H,snapToGrid:z,containerBounds:u});if(b=I.sourceEvent,(I.sourceEvent.type==="touchmove"&&I.sourceEvent.touches.length>1||j&&!A.has(j))&&(h=!0),!h){if(!c&&q&&p&&(c=!0,F()),!p){const C=zi(I.sourceEvent,u),G=C.x-d.x,Q=C.y-d.y;Math.sqrt(G*G+Q*Q)>Y&&W(I)}(s.x!==T.xSnapped||s.y!==T.ySnapped)&&l&&p&&(d=zi(I.sourceEvent,u),O(T))}}).on("end",I=>{if(!(!p||h)&&(c=!1,p=!1,cancelAnimationFrame(o),l.size>0)){const{nodeLookup:q,updateNodePositions:$,onNodeDragStop:H,onSelectionDragStop:z}=t();if(y&&($(l,!1),y=!1),i||H||!j&&z){const[Y,A]=vg({nodeId:j,dragItems:l,nodeLookup:q,dragging:!1});i==null||i(I.sourceEvent,l,Y,A),H==null||H(I.sourceEvent,Y,A),j||z==null||z(I.sourceEvent,A)}}}).filter(I=>{const q=I.target;return!I.button&&(!v||!mk(q,`.${v}`,k))&&(!w||mk(q,w,k))});f.call(R)}function g(){f==null||f.on(".drag",null)}return{update:S,destroy:g}}function ED(e,t,n){const r=[],i={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const s of t.values())nd(i,tc(s))>0&&r.push(s);return r}const _D=250;function PD(e,t,n,r){var l,c;let i=[],s=1/0;const o=ED(e,n,t+_D);for(const d of o){const u=[...((l=d.internals.handleBounds)==null?void 0:l.source)??[],...((c=d.internals.handleBounds)==null?void 0:c.target)??[]];for(const p of u){if(r.nodeId===p.nodeId&&r.type===p.type&&r.id===p.id)continue;const{x:f,y:h}=Ma(d,p,p.position,!0),y=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));y>t||(y<s?(i=[{...p,x:f,y:h}],s=y):y===s&&i.push({...p,x:f,y:h}))}}if(!i.length)return null;if(i.length>1){const d=r.type==="source"?"target":"source";return i.find(u=>u.type===d)??i[0]}return i[0]}function QE(e,t,n,r,i,s=!1){var d,u,p;const o=r.get(e);if(!o)return null;const l=i==="strict"?(d=o.internals.handleBounds)==null?void 0:d[t]:[...((u=o.internals.handleBounds)==null?void 0:u.source)??[],...((p=o.internals.handleBounds)==null?void 0:p.target)??[]],c=(n?l==null?void 0:l.find(f=>f.id===n):l==null?void 0:l[0])??null;return c&&s?{...c,...Ma(o,c,c.position,!0)}:c}function ZE(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function ID(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const e_=()=>!0;function AD(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:i,edgeUpdaterType:s,isTarget:o,domNode:l,nodeLookup:c,lib:d,autoPanOnConnect:u,flowId:p,panBy:f,cancelConnection:h,onConnectStart:y,onConnect:b,onConnectEnd:S,isValidConnection:g=e_,onReconnectEnd:v,updateConnection:w,getTransform:k,getFromHandle:E,autoPanSpeed:j,dragThreshold:P=1,handleDomNode:O}){const F=BE(e.target);let W=0,R;const{x:I,y:q}=zi(e),$=ZE(s,O),H=l==null?void 0:l.getBoundingClientRect();let z=!1;if(!H||!$)return;const Y=QE(i,$,r,c,t);if(!Y)return;let A=zi(e,H),T=!1,C=null,G=!1,Q=null;function M(){if(!u||!H)return;const[fe,ye]=$E(A,H,j);f({x:fe,y:ye}),W=requestAnimationFrame(M)}const te={...Y,nodeId:i,type:$,position:Y.position},ce=c.get(i);let de={inProgress:!0,isValid:null,from:Ma(ce,te,$e.Left,!0),fromHandle:te,fromPosition:te.position,fromNode:ce,to:A,toHandle:null,toPosition:rk[te.position],toNode:null,pointer:A};function ue(){z=!0,w(de),y==null||y(e,{nodeId:i,handleId:r,handleType:$})}P===0&&ue();function se(fe){if(!z){const{x:Te,y:It}=zi(fe),pn=Te-I,sn=It-q;if(!(pn*pn+sn*sn>P*P))return;ue()}if(!E()||!te){re(fe);return}const ye=k();A=zi(fe,H),R=PD(Pd(A,ye,!1,[1,1]),n,c,te),T||(M(),T=!0);const Se=t_(fe,{handle:R,connectionMode:t,fromNodeId:i,fromHandleId:r,fromType:o?"target":"source",isValidConnection:g,doc:F,lib:d,flowId:p,nodeLookup:c});Q=Se.handleDomNode,C=Se.connection,G=ID(!!R,Se.isValid);const He=c.get(i),st=He?Ma(He,te,$e.Left,!0):de.from,Ke={...de,from:st,isValid:G,to:Se.toHandle&&G?lh({x:Se.toHandle.x,y:Se.toHandle.y},ye):A,toHandle:Se.toHandle,toPosition:G&&Se.toHandle?Se.toHandle.position:rk[te.position],toNode:Se.toHandle?c.get(Se.toHandle.nodeId):null,pointer:A};w(Ke),de=Ke}function re(fe){if(!("touches"in fe&&fe.touches.length>0)){if(z){(R||Q)&&C&&G&&(b==null||b(C));const{inProgress:ye,...Se}=de,He={...Se,toPosition:de.toHandle?de.toPosition:null};S==null||S(fe,He),s&&(v==null||v(fe,He))}h(),cancelAnimationFrame(W),T=!1,G=!1,C=null,Q=null,F.removeEventListener("mousemove",se),F.removeEventListener("mouseup",re),F.removeEventListener("touchmove",se),F.removeEventListener("touchend",re)}}F.addEventListener("mousemove",se),F.addEventListener("mouseup",re),F.addEventListener("touchmove",se),F.addEventListener("touchend",re)}function t_(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:i,fromType:s,doc:o,lib:l,flowId:c,isValidConnection:d=e_,nodeLookup:u}){const p=s==="target",f=t?o.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}=zi(e),b=o.elementFromPoint(h,y),S=b!=null&&b.classList.contains(`${l}-flow__handle`)?b:f,g={handleDomNode:S,isValid:!1,connection:null,toHandle:null};if(S){const v=ZE(void 0,S),w=S.getAttribute("data-nodeid"),k=S.getAttribute("data-handleid"),E=S.classList.contains("connectable"),j=S.classList.contains("connectableend");if(!w||!v)return g;const P={source:p?w:r,sourceHandle:p?k:i,target:p?r:w,targetHandle:p?i:k};g.connection=P;const F=E&&j&&(n===Zl.Strict?p&&v==="source"||!p&&v==="target":w!==r||k!==i);g.isValid=F&&d(P),g.toHandle=QE(w,v,k,u,n,!0)}return g}const hx={onPointerDown:AD,isValid:t_};function TD({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const i=Jr(e);function s({translateExtent:l,width:c,height:d,zoomStep:u=1,pannable:p=!0,zoomable:f=!0,inversePan:h=!1}){const y=w=>{if(w.sourceEvent.type!=="wheel"||!t)return;const k=n(),E=w.sourceEvent.ctrlKey&&rd()?10:1,j=-w.sourceEvent.deltaY*(w.sourceEvent.deltaMode===1?.05:w.sourceEvent.deltaMode?1:.002)*u,P=k[2]*Math.pow(2,j*E);t.scaleTo(P)};let b=[0,0];const S=w=>{(w.sourceEvent.type==="mousedown"||w.sourceEvent.type==="touchstart")&&(b=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY])},g=w=>{const k=n();if(w.sourceEvent.type!=="mousemove"&&w.sourceEvent.type!=="touchmove"||!t)return;const E=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY],j=[E[0]-b[0],E[1]-b[1]];b=E;const P=r()*Math.max(k[2],Math.log(k[2]))*(h?-1:1),O={x:k[0]-j[0]*P,y:k[1]-j[1]*P},F=[[0,0],[c,d]];t.setViewportConstrained({x:O.x,y:O.y,zoom:k[2]},F,l)},v=PE().on("start",S).on("zoom",p?g:null).on("zoom.wheel",f?y:null);i.call(v,{})}function o(){i.on("zoom",null)}return{update:s,destroy:o,pointer:Oi}}const Zh=e=>({x:e.x,y:e.y,zoom:e.k}),bg=({x:e,y:t,zoom:n})=>Xh.translate(e,t).scale(n),El=(e,t)=>e.target.closest(`.${t}`),n_=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),RD=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,kg=(e,t=0,n=RD,r=()=>{})=>{const i=typeof t=="number"&&t>0;return i||r(),i?e.transition().duration(t).ease(n).on("end",r):e},r_=e=>{const t=e.ctrlKey&&rd()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function LD({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:i,panOnScrollSpeed:s,zoomOnPinch:o,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:d}){return u=>{if(El(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const p=n.property("__zoom").k||1;if(u.ctrlKey&&o){const S=Oi(u),g=r_(u),v=p*Math.pow(2,g);r.scaleTo(n,v,S,u);return}const f=u.deltaMode===1?20:1;let h=i===ja.Vertical?0:u.deltaX*f,y=i===ja.Horizontal?0:u.deltaY*f;!rd()&&u.shiftKey&&i!==ja.Vertical&&(h=u.deltaY*f,y=0),r.translateBy(n,-(h/p)*s,-(y/p)*s,{internal:!0});const b=Zh(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(u,b),e.panScrollTimeout=setTimeout(()=>{d==null||d(u,b),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l==null||l(u,b))}}function OD({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,i){const s=r.type==="wheel",o=!t&&s&&!r.ctrlKey,l=El(r,e);if(r.ctrlKey&&s&&l&&r.preventDefault(),o||l)return null;r.preventDefault(),n.call(this,r,i)}}function MD({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var s,o,l;if((s=r.sourceEvent)!=null&&s.internal)return;const i=Zh(r.transform);e.mouseButton=((o=r.sourceEvent)==null?void 0:o.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=i,((l=r.sourceEvent)==null?void 0:l.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,i))}}function $D({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:i}){return s=>{var o,l;e.usedRightMouseButton=!!(n&&n_(t,e.mouseButton??0)),(o=s.sourceEvent)!=null&&o.sync||r([s.transform.x,s.transform.y,s.transform.k]),i&&!((l=s.sourceEvent)!=null&&l.internal)&&(i==null||i(s.sourceEvent,Zh(s.transform)))}}function FD({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:i,onPaneContextMenu:s}){return o=>{var l;if(!((l=o.sourceEvent)!=null&&l.internal)&&(e.isZoomingOrPanning=!1,s&&n_(t,e.mouseButton??0)&&!e.usedRightMouseButton&&o.sourceEvent&&s(o.sourceEvent),e.usedRightMouseButton=!1,r(!1),i)){const c=Zh(o.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{i==null||i(o.sourceEvent,c)},n?150:0)}}}function DD({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:o,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:u}){return p=>{var S;const f=e||t,h=n&&p.ctrlKey,y=p.type==="wheel";if(p.button===1&&p.type==="mousedown"&&(El(p,`${d}-flow__node`)||El(p,`${d}-flow__edge`)))return!0;if(!r&&!f&&!i&&!s&&!n||o||u&&!y||El(p,l)&&y||El(p,c)&&(!y||i&&y&&!e)||!n&&p.ctrlKey&&y)return!1;if(!n&&p.type==="touchstart"&&((S=p.touches)==null?void 0:S.length)>1)return p.preventDefault(),!1;if(!f&&!i&&!h&&y||!r&&(p.type==="mousedown"||p.type==="touchstart")||Array.isArray(r)&&!r.includes(p.button)&&p.type==="mousedown")return!1;const b=Array.isArray(r)&&r.includes(p.button)||!p.button||p.button<=1;return(!p.ctrlKey||y)&&b}}function zD({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:i,onPanZoom:s,onPanZoomStart:o,onPanZoomEnd:l,onDraggingChange:c}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect(),p=PE().scaleExtent([t,n]).translateExtent(r),f=Jr(e).call(p);v({x:i.x,y:i.y,zoom:ec(i.zoom,t,n)},[[0,0],[u.width,u.height]],r);const h=f.on("wheel.zoom"),y=f.on("dblclick.zoom");p.wheelDelta(r_);function b(R,I){return f?new Promise(q=>{p==null||p.interpolate((I==null?void 0:I.interpolate)==="linear"?ju:wp).transform(kg(f,I==null?void 0:I.duration,I==null?void 0:I.ease,()=>q(!0)),R)}):Promise.resolve(!1)}function S({noWheelClassName:R,noPanClassName:I,onPaneContextMenu:q,userSelectionActive:$,panOnScroll:H,panOnDrag:z,panOnScrollMode:Y,panOnScrollSpeed:A,preventScrolling:T,zoomOnPinch:C,zoomOnScroll:G,zoomOnDoubleClick:Q,zoomActivationKeyPressed:M,lib:te,onTransformChange:ce,connectionInProgress:le,paneClickDistance:de,selectionOnDrag:ue}){$&&!d.isZoomingOrPanning&&g();const se=H&&!M&&!$;p.clickDistance(ue?1/0:!Di(de)||de<0?0:de);const re=se?LD({zoomPanValues:d,noWheelClassName:R,d3Selection:f,d3Zoom:p,panOnScrollMode:Y,panOnScrollSpeed:A,zoomOnPinch:C,onPanZoomStart:o,onPanZoom:s,onPanZoomEnd:l}):OD({noWheelClassName:R,preventScrolling:T,d3ZoomHandler:h});if(f.on("wheel.zoom",re,{passive:!1}),!$){const ye=MD({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:o});p.on("start",ye);const Se=$D({zoomPanValues:d,panOnDrag:z,onPaneContextMenu:!!q,onPanZoom:s,onTransformChange:ce});p.on("zoom",Se);const He=FD({zoomPanValues:d,panOnDrag:z,panOnScroll:H,onPaneContextMenu:q,onPanZoomEnd:l,onDraggingChange:c});p.on("end",He)}const fe=DD({zoomActivationKeyPressed:M,panOnDrag:z,zoomOnScroll:G,panOnScroll:H,zoomOnDoubleClick:Q,zoomOnPinch:C,userSelectionActive:$,noPanClassName:I,noWheelClassName:R,lib:te,connectionInProgress:le});p.filter(fe),Q?f.on("dblclick.zoom",y):f.on("dblclick.zoom",null)}function g(){p.on("zoom",null)}async function v(R,I,q){const $=bg(R),H=p==null?void 0:p.constrain()($,I,q);return H&&await b(H),new Promise(z=>z(H))}async function w(R,I){const q=bg(R);return await b(q,I),new Promise($=>$(q))}function k(R){if(f){const I=bg(R),q=f.property("__zoom");(q.k!==R.zoom||q.x!==R.x||q.y!==R.y)&&(p==null||p.transform(f,I,null,{sync:!0}))}}function E(){const R=f?_E(f.node()):{x:0,y:0,k:1};return{x:R.x,y:R.y,zoom:R.k}}function j(R,I){return f?new Promise(q=>{p==null||p.interpolate((I==null?void 0:I.interpolate)==="linear"?ju:wp).scaleTo(kg(f,I==null?void 0:I.duration,I==null?void 0:I.ease,()=>q(!0)),R)}):Promise.resolve(!1)}function P(R,I){return f?new Promise(q=>{p==null||p.interpolate((I==null?void 0:I.interpolate)==="linear"?ju:wp).scaleBy(kg(f,I==null?void 0:I.duration,I==null?void 0:I.ease,()=>q(!0)),R)}):Promise.resolve(!1)}function O(R){p==null||p.scaleExtent(R)}function F(R){p==null||p.translateExtent(R)}function W(R){const I=!Di(R)||R<0?0:R;p==null||p.clickDistance(I)}return{update:S,destroy:g,setViewport:w,setViewportConstrained:v,getViewport:E,scaleTo:j,scaleBy:P,setScaleExtent:O,setTranslateExtent:F,syncViewport:k,setClickDistance:W}}var rc;(function(e){e.Line="line",e.Handle="handle"})(rc||(rc={}));function BD({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:i,affectsY:s}){const o=e-t,l=n-r,c=[o>0?1:o<0?-1:0,l>0?1:l<0?-1:0];return o&&i&&(c[0]=c[0]*-1),l&&s&&(c[1]=c[1]*-1),c}function gk(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),i=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:i}}function ho(e,t){return Math.max(0,t-e)}function mo(e,t){return Math.max(0,e-t)}function Hf(e,t,n){return Math.max(0,t-e,e-n)}function yk(e,t){return e?!t:t}function HD(e,t,n,r,i,s,o,l){let{affectsX:c,affectsY:d}=t;const{isHorizontal:u,isVertical:p}=t,f=u&&p,{xSnapped:h,ySnapped:y}=n,{minWidth:b,maxWidth:S,minHeight:g,maxHeight:v}=r,{x:w,y:k,width:E,height:j,aspectRatio:P}=e;let O=Math.floor(u?h-e.pointerX:0),F=Math.floor(p?y-e.pointerY:0);const W=E+(c?-O:O),R=j+(d?-F:F),I=-s[0]*E,q=-s[1]*j;let $=Hf(W,b,S),H=Hf(R,g,v);if(o){let A=0,T=0;c&&O<0?A=ho(w+O+I,o[0][0]):!c&&O>0&&(A=mo(w+W+I,o[1][0])),d&&F<0?T=ho(k+F+q,o[0][1]):!d&&F>0&&(T=mo(k+R+q,o[1][1])),$=Math.max($,A),H=Math.max(H,T)}if(l){let A=0,T=0;c&&O>0?A=mo(w+O,l[0][0]):!c&&O<0&&(A=ho(w+W,l[1][0])),d&&F>0?T=mo(k+F,l[0][1]):!d&&F<0&&(T=ho(k+R,l[1][1])),$=Math.max($,A),H=Math.max(H,T)}if(i){if(u){const A=Hf(W/P,g,v)*P;if($=Math.max($,A),o){let T=0;!c&&!d||c&&!d&&f?T=mo(k+q+W/P,o[1][1])*P:T=ho(k+q+(c?O:-O)/P,o[0][1])*P,$=Math.max($,T)}if(l){let T=0;!c&&!d||c&&!d&&f?T=ho(k+W/P,l[1][1])*P:T=mo(k+(c?O:-O)/P,l[0][1])*P,$=Math.max($,T)}}if(p){const A=Hf(R*P,b,S)/P;if(H=Math.max(H,A),o){let T=0;!c&&!d||d&&!c&&f?T=mo(w+R*P+I,o[1][0])/P:T=ho(w+(d?F:-F)*P+I,o[0][0])/P,H=Math.max(H,T)}if(l){let T=0;!c&&!d||d&&!c&&f?T=ho(w+R*P,l[1][0])/P:T=mo(w+(d?F:-F)*P,l[0][0])/P,H=Math.max(H,T)}}}F=F+(F<0?H:-H),O=O+(O<0?$:-$),i&&(f?W>R*P?F=(yk(c,d)?-O:O)/P:O=(yk(c,d)?-F:F)*P:u?(F=O/P,d=c):(O=F*P,c=d));const z=c?w+O:w,Y=d?k+F:k;return{width:E+(c?-O:O),height:j+(d?-F:F),x:s[0]*O*(c?-1:1)+z,y:s[1]*F*(d?-1:1)+Y}}const i_={width:0,height:0,x:0,y:0},UD={...i_,pointerX:0,pointerY:0,aspectRatio:1};function VD(e){return[[0,0],[e.measured.width,e.measured.height]]}function WD(e,t,n){const r=t.position.x+e.position.x,i=t.position.y+e.position.y,s=e.measured.width??0,o=e.measured.height??0,l=n[0]*s,c=n[1]*o;return[[r-l,i-c],[r+s-l,i+o-c]]}function KD({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:i}){const s=Jr(e);let o={controlDirection:gk("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:d,boundaries:u,keepAspectRatio:p,resizeDirection:f,onResizeStart:h,onResize:y,onResizeEnd:b,shouldResize:S}){let g={...i_},v={...UD};o={boundaries:u,resizeDirection:f,keepAspectRatio:p,controlDirection:gk(d)};let w,k=null,E=[],j,P,O,F=!1;const W=hE().on("start",R=>{const{nodeLookup:I,transform:q,snapGrid:$,snapToGrid:H,nodeOrigin:z,paneDomNode:Y}=n();if(w=I.get(t),!w)return;k=(Y==null?void 0:Y.getBoundingClientRect())??null;const{xSnapped:A,ySnapped:T}=Cu(R.sourceEvent,{transform:q,snapGrid:$,snapToGrid:H,containerBounds:k});g={width:w.measured.width??0,height:w.measured.height??0,x:w.position.x??0,y:w.position.y??0},v={...g,pointerX:A,pointerY:T,aspectRatio:g.width/g.height},j=void 0,w.parentId&&(w.extent==="parent"||w.expandParent)&&(j=I.get(w.parentId),P=j&&w.extent==="parent"?VD(j):void 0),E=[],O=void 0;for(const[C,G]of I)if(G.parentId===t&&(E.push({id:C,position:{...G.position},extent:G.extent}),G.extent==="parent"||G.expandParent)){const Q=WD(G,w,G.origin??z);O?O=[[Math.min(Q[0][0],O[0][0]),Math.min(Q[0][1],O[0][1])],[Math.max(Q[1][0],O[1][0]),Math.max(Q[1][1],O[1][1])]]:O=Q}h==null||h(R,{...g})}).on("drag",R=>{const{transform:I,snapGrid:q,snapToGrid:$,nodeOrigin:H}=n(),z=Cu(R.sourceEvent,{transform:I,snapGrid:q,snapToGrid:$,containerBounds:k}),Y=[];if(!w)return;const{x:A,y:T,width:C,height:G}=g,Q={},M=w.origin??H,{width:te,height:ce,x:le,y:de}=HD(v,o.controlDirection,z,o.boundaries,o.keepAspectRatio,M,P,O),ue=te!==C,se=ce!==G,re=le!==A&&ue,fe=de!==T&&se;if(!re&&!fe&&!ue&&!se)return;if((re||fe||M[0]===1||M[1]===1)&&(Q.x=re?le:g.x,Q.y=fe?de:g.y,g.x=Q.x,g.y=Q.y,E.length>0)){const st=le-A,Ke=de-T;for(const Te of E)Te.position={x:Te.position.x-st+M[0]*(te-C),y:Te.position.y-Ke+M[1]*(ce-G)},Y.push(Te)}if((ue||se)&&(Q.width=ue&&(!o.resizeDirection||o.resizeDirection==="horizontal")?te:g.width,Q.height=se&&(!o.resizeDirection||o.resizeDirection==="vertical")?ce:g.height,g.width=Q.width,g.height=Q.height),j&&w.expandParent){const st=M[0]*(Q.width??0);Q.x&&Q.x<st&&(g.x=st,v.x=v.x-(Q.x-st));const Ke=M[1]*(Q.height??0);Q.y&&Q.y<Ke&&(g.y=Ke,v.y=v.y-(Q.y-Ke))}const ye=BD({width:g.width,prevWidth:C,height:g.height,prevHeight:G,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),Se={...g,direction:ye};(S==null?void 0:S(R,Se))!==!1&&(F=!0,y==null||y(R,Se),r(Q,Y))}).on("end",R=>{F&&(b==null||b(R,{...g}),i==null||i({...g}),F=!1)});s.call(W)}function c(){s.on(".drag",null)}return{update:l,destroy:c}}var s_={exports:{}},o_={},a_={exports:{}},l_={};/**
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 ic=m;function qD(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var YD=typeof Object.is=="function"?Object.is:qD,GD=ic.useState,XD=ic.useEffect,JD=ic.useLayoutEffect,QD=ic.useDebugValue;function ZD(e,t){var n=t(),r=GD({inst:{value:n,getSnapshot:t}}),i=r[0].inst,s=r[1];return JD(function(){i.value=n,i.getSnapshot=t,Sg(i)&&s({inst:i})},[e,n,t]),XD(function(){return Sg(i)&&s({inst:i}),e(function(){Sg(i)&&s({inst:i})})},[e]),QD(n),n}function Sg(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!YD(e,n)}catch{return!0}}function e3(e,t){return t()}var t3=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?e3:ZD;l_.useSyncExternalStore=ic.useSyncExternalStore!==void 0?ic.useSyncExternalStore:t3;a_.exports=l_;var c_=a_.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 em=m,n3=c_;function r3(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var i3=typeof Object.is=="function"?Object.is:r3,s3=n3.useSyncExternalStore,o3=em.useRef,a3=em.useEffect,l3=em.useMemo,c3=em.useDebugValue;o_.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var s=o3(null);if(s.current===null){var o={hasValue:!1,value:null};s.current=o}else o=s.current;s=l3(function(){function c(h){if(!d){if(d=!0,u=h,h=r(h),i!==void 0&&o.hasValue){var y=o.value;if(i(y,h))return p=y}return p=h}if(y=p,i3(u,h))return y;var b=r(h);return i!==void 0&&i(y,b)?(u=h,y):(u=h,p=b)}var d=!1,u,p,f=n===void 0?null:n;return[function(){return c(t())},f===null?void 0:function(){return c(f())}]},[t,n,r,i]);var l=s3(e,s[0],s[1]);return a3(function(){o.hasValue=!0,o.value=l},[l]),c3(l),l};s_.exports=o_;var u3=s_.exports;const d3=Ko(u3),f3={},xk=e=>{let t;const n=new Set,r=(u,p)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=p??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(y=>y(t,h))}},i=()=>t,c={setState:r,getState:i,getInitialState:()=>d,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(f3?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=t=e(r,i,c);return c},p3=e=>e?xk(e):xk,{useDebugValue:h3}=We,{useSyncExternalStoreWithSelector:m3}=d3,g3=e=>e;function u_(e,t=g3,n){const r=m3(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return h3(r),r}const wk=(e,t)=>{const n=p3(e),r=(i,s=t)=>u_(n,i,s);return Object.assign(r,n),r},y3=(e,t)=>e?wk(e,t):wk;function Yt(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,i]of e)if(!Object.is(i,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 tm=m.createContext(null),x3=tm.Provider,d_=ks.error001();function vt(e,t){const n=m.useContext(tm);if(n===null)throw new Error(d_);return u_(n,e,t)}function Bt(){const e=m.useContext(tm);if(e===null)throw new Error(d_);return m.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const vk={display:"none"},w3={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},f_="react-flow__node-desc",p_="react-flow__edge-desc",v3="react-flow__aria-live",b3=e=>e.ariaLiveMessage,k3=e=>e.ariaLabelConfig;function S3({rfId:e}){const t=vt(b3);return a.jsx("div",{id:`${v3}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:w3,children:t})}function N3({rfId:e,disableKeyboardA11y:t}){const n=vt(k3);return a.jsxs(a.Fragment,{children:[a.jsx("div",{id:`${f_}-${e}`,style:vk,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),a.jsx("div",{id:`${p_}-${e}`,style:vk,children:n["edge.a11yDescription.default"]}),!t&&a.jsx(S3,{rfId:e})]})}const sc=m.forwardRef(({position:e="top-left",children:t,className:n,style:r,...i},s)=>{const o=`${e}`.split("-");return a.jsx("div",{className:Sn(["react-flow__panel",n,...o]),style:r,ref:s,...i,children:t})});sc.displayName="Panel";function j3({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:a.jsx(sc,{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:a.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const C3=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}},Uf=e=>e.id;function E3(e,t){return Yt(e.selectedNodes.map(Uf),t.selectedNodes.map(Uf))&&Yt(e.selectedEdges.map(Uf),t.selectedEdges.map(Uf))}function _3({onSelectionChange:e}){const t=Bt(),{selectedNodes:n,selectedEdges:r}=vt(C3,E3);return m.useEffect(()=>{const i={nodes:n,edges:r};e==null||e(i),t.getState().onSelectionChangeHandlers.forEach(s=>s(i))},[n,r,e]),null}const P3=e=>!!e.onSelectionChangeHandlers;function I3({onSelectionChange:e}){const t=vt(P3);return e||t?a.jsx(_3,{onSelectionChange:e}):null}const mx=typeof window<"u"?m.useLayoutEffect:m.useEffect,h_=[0,0],A3={x:0,y:0,zoom:1},T3=["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"],bk=[...T3,"rfId"],R3=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}),kk={translateExtent:ed,nodeOrigin:h_,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function L3(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:i,setTranslateExtent:s,setNodeExtent:o,reset:l,setDefaultNodesAndEdges:c}=vt(R3,Yt),d=Bt();mx(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=kk,l()}),[]);const u=m.useRef(kk);return mx(()=>{for(const p of bk){const f=e[p],h=u.current[p];f!==h&&(typeof e[p]>"u"||(p==="nodes"?t(f):p==="edges"?n(f):p==="minZoom"?r(f):p==="maxZoom"?i(f):p==="translateExtent"?s(f):p==="nodeExtent"?o(f):p==="ariaLabelConfig"?d.setState({ariaLabelConfig:sD(f)}):p==="fitView"?d.setState({fitViewQueued:f}):p==="fitViewOptions"?d.setState({fitViewOptions:f}):d.setState({[p]:f})))}u.current=e},bk.map(p=>e[p])),null}function Sk(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function O3(e){var r;const[t,n]=m.useState(e==="system"?null:e);return m.useEffect(()=>{if(e!=="system"){n(e);return}const i=Sk(),s=()=>n(i!=null&&i.matches?"dark":"light");return s(),i==null||i.addEventListener("change",s),()=>{i==null||i.removeEventListener("change",s)}},[e]),t!==null?t:(r=Sk())!=null&&r.matches?"dark":"light"}const Nk=typeof document<"u"?document:null;function sd(e=null,t={target:Nk,actInsideInputWithModifier:!0}){const[n,r]=m.useState(!1),i=m.useRef(!1),s=m.useRef(new Set([])),[o,l]=m.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(p=>typeof p=="string").map(p=>p.replace("+",`
61
- `).replace(`
62
-
63
- `,`
64
- +`).split(`
65
- `)),u=d.reduce((p,f)=>p.concat(...f),[]);return[d,u]}return[[],[]]},[e]);return m.useEffect(()=>{const c=(t==null?void 0:t.target)??Nk,d=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const u=h=>{var S,g;if(i.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!i.current||i.current&&!d)&&HE(h))return!1;const b=Ck(h.code,l);if(s.current.add(h[b]),jk(o,s.current,!1)){const v=((g=(S=h.composedPath)==null?void 0:S.call(h))==null?void 0:g[0])||h.target,w=(v==null?void 0:v.nodeName)==="BUTTON"||(v==null?void 0:v.nodeName)==="A";t.preventDefault!==!1&&(i.current||!w)&&h.preventDefault(),r(!0)}},p=h=>{const y=Ck(h.code,l);jk(o,s.current,!0)?(r(!1),s.current.clear()):s.current.delete(h[y]),h.key==="Meta"&&s.current.clear(),i.current=!1},f=()=>{s.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",u),c==null||c.addEventListener("keyup",p),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{c==null||c.removeEventListener("keydown",u),c==null||c.removeEventListener("keyup",p),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,r]),n}function jk(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function Ck(e,t){return t.includes(e)?"code":"key"}const M3=()=>{const e=Bt();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,i,s],panZoom:o}=e.getState();return o?(await o.setViewport({x:t.x??r,y:t.y??i,zoom:t.zoom??s},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:i,minZoom:s,maxZoom:o,panZoom:l}=e.getState(),c=Gw(t,r,i,s,o,(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:i,snapToGrid:s,domNode:o}=e.getState();if(!o)return t;const{x:l,y:c}=o.getBoundingClientRect(),d={x:t.x-l,y:t.y-c},u=n.snapGrid??i,p=n.snapToGrid??s;return Pd(d,r,p,u)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:i,y:s}=r.getBoundingClientRect(),o=lh(t,n);return{x:o.x+i,y:o.y+s}}}),[])};function m_(e,t){const n=[],r=new Map,i=[];for(const s of e)if(s.type==="add"){i.push(s);continue}else if(s.type==="remove"||s.type==="replace")r.set(s.id,[s]);else{const o=r.get(s.id);o?o.push(s):r.set(s.id,[s])}for(const s of t){const o=r.get(s.id);if(!o){n.push(s);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){n.push({...o[0].item});continue}const l={...s};for(const c of o)$3(c,l);n.push(l)}return i.length&&i.forEach(s=>{s.index!==void 0?n.splice(s.index,0,{...s.item}):n.push({...s.item})}),n}function $3(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 nv(e,t){return m_(e,t)}function g_(e,t){return m_(e,t)}function ga(e,t){return{id:e,type:"select",selected:t}}function _l(e,t=new Set,n=!1){const r=[];for(const[i,s]of e){const o=t.has(i);!(s.selected===void 0&&!o)&&s.selected!==o&&(n&&(s.selected=o),r.push(ga(s.id,o)))}return r}function Ek({items:e=[],lookup:t}){var i;const n=[],r=new Map(e.map(s=>[s.id,s]));for(const[s,o]of e.entries()){const l=t.get(o.id),c=((i=l==null?void 0:l.internals)==null?void 0:i.userNode)??l;c!==void 0&&c!==o&&n.push({id:o.id,item:o,type:"replace"}),c===void 0&&n.push({item:o,type:"add",index:s})}for(const[s]of t)r.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function _k(e){return{id:e.id,type:"remove"}}const Pk=e=>GF(e),F3=e=>LE(e);function y_(e){return m.forwardRef(e)}function Ik(e){const[t,n]=m.useState(BigInt(0)),[r]=m.useState(()=>D3(()=>n(i=>i+BigInt(1))));return mx(()=>{const i=r.get();i.length&&(e(i),r.reset())},[t]),r}function D3(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const x_=m.createContext(null);function z3({children:e}){const t=Bt(),n=m.useCallback(l=>{const{nodes:c=[],setNodes:d,hasDefaultNodes:u,onNodesChange:p,nodeLookup:f,fitViewQueued:h,onNodesChangeMiddlewareMap:y}=t.getState();let b=c;for(const g of l)b=typeof g=="function"?g(b):g;let S=Ek({items:b,lookup:f});for(const g of y.values())S=g(S);u&&d(b),S.length>0?p==null||p(S):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:g,nodes:v,setNodes:w}=t.getState();g&&w(v)})},[]),r=Ik(n),i=m.useCallback(l=>{const{edges:c=[],setEdges:d,hasDefaultEdges:u,onEdgesChange:p,edgeLookup:f}=t.getState();let h=c;for(const y of l)h=typeof y=="function"?y(h):y;u?d(h):p&&p(Ek({items:h,lookup:f}))},[]),s=Ik(i),o=m.useMemo(()=>({nodeQueue:r,edgeQueue:s}),[]);return a.jsx(x_.Provider,{value:o,children:e})}function B3(){const e=m.useContext(x_);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const H3=e=>!!e.panZoom;function Ba(){const e=M3(),t=Bt(),n=B3(),r=vt(H3),i=m.useMemo(()=>{const s=p=>t.getState().nodeLookup.get(p),o=p=>{n.nodeQueue.push(p)},l=p=>{n.edgeQueue.push(p)},c=p=>{var g,v;const{nodeLookup:f,nodeOrigin:h}=t.getState(),y=Pk(p)?p:f.get(p.id),b=y.parentId?zE(y.position,y.measured,y.parentId,f,h):y.position,S={...y,position:b,width:((g=y.measured)==null?void 0:g.width)??y.width,height:((v=y.measured)==null?void 0:v.height)??y.height};return tc(S)},d=(p,f,h={replace:!1})=>{o(y=>y.map(b=>{if(b.id===p){const S=typeof f=="function"?f(b):f;return h.replace&&Pk(S)?S:{...b,...S}}return b}))},u=(p,f,h={replace:!1})=>{l(y=>y.map(b=>{if(b.id===p){const S=typeof f=="function"?f(b):f;return h.replace&&F3(S)?S:{...b,...S}}return b}))};return{getNodes:()=>t.getState().nodes.map(p=>({...p})),getNode:p=>{var f;return(f=s(p))==null?void 0:f.internals.userNode},getInternalNode:s,getEdges:()=>{const{edges:p=[]}=t.getState();return p.map(f=>({...f}))},getEdge:p=>t.getState().edgeLookup.get(p),setNodes:o,setEdges:l,addNodes:p=>{const f=Array.isArray(p)?p:[p];n.nodeQueue.push(h=>[...h,...f])},addEdges:p=>{const f=Array.isArray(p)?p:[p];n.edgeQueue.push(h=>[...h,...f])},toObject:()=>{const{nodes:p=[],edges:f=[],transform:h}=t.getState(),[y,b,S]=h;return{nodes:p.map(g=>({...g})),edges:f.map(g=>({...g})),viewport:{x:y,y:b,zoom:S}}},deleteElements:async({nodes:p=[],edges:f=[]})=>{const{nodes:h,edges:y,onNodesDelete:b,onEdgesDelete:S,triggerNodeChanges:g,triggerEdgeChanges:v,onDelete:w,onBeforeDelete:k}=t.getState(),{nodes:E,edges:j}=await eD({nodesToRemove:p,edgesToRemove:f,nodes:h,edges:y,onBeforeDelete:k}),P=j.length>0,O=E.length>0;if(P){const F=j.map(_k);S==null||S(j),v(F)}if(O){const F=E.map(_k);b==null||b(E),g(F)}return(O||P)&&(w==null||w({nodes:E,edges:j})),{deletedNodes:E,deletedEdges:j}},getIntersectingNodes:(p,f=!0,h)=>{const y=sk(p),b=y?p:c(p),S=h!==void 0;return b?(h||t.getState().nodes).filter(g=>{const v=t.getState().nodeLookup.get(g.id);if(v&&!y&&(g.id===p.id||!v.internals.positionAbsolute))return!1;const w=tc(S?g:v),k=nd(w,b);return f&&k>0||k>=w.width*w.height||k>=b.width*b.height}):[]},isNodeIntersecting:(p,f,h=!0)=>{const b=sk(p)?p:c(p);if(!b)return!1;const S=nd(b,f);return h&&S>0||S>=f.width*f.height||S>=b.width*b.height},updateNode:d,updateNodeData:(p,f,h={replace:!1})=>{d(p,y=>{const b=typeof f=="function"?f(y):f;return h.replace?{...y,data:b}:{...y,data:{...y.data,...b}}},h)},updateEdge:u,updateEdgeData:(p,f,h={replace:!1})=>{u(p,y=>{const b=typeof f=="function"?f(y):f;return h.replace?{...y,data:b}:{...y,data:{...y.data,...b}}},h)},getNodesBounds:p=>{const{nodeLookup:f,nodeOrigin:h}=t.getState();return XF(p,{nodeLookup:f,nodeOrigin:h})},getHandleConnections:({type:p,id:f,nodeId:h})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${h}-${p}${f?`-${f}`:""}`))==null?void 0:y.values())??[])},getNodeConnections:({type:p,handleId:f,nodeId:h})=>{var y;return Array.from(((y=t.getState().connectionLookup.get(`${h}${p?f?`-${p}-${f}`:`-${p}`:""}`))==null?void 0:y.values())??[])},fitView:async p=>{const f=t.getState().fitViewResolver??iD();return t.setState({fitViewQueued:!0,fitViewOptions:p,fitViewResolver:f}),n.nodeQueue.push(h=>[...h]),f.promise}}},[]);return m.useMemo(()=>({...i,...e,viewportInitialized:r}),[r])}const Ak=e=>e.selected,U3=typeof window<"u"?window:void 0;function V3({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Bt(),{deleteElements:r}=Ba(),i=sd(e,{actInsideInputWithModifier:!1}),s=sd(t,{target:U3});m.useEffect(()=>{if(i){const{edges:o,nodes:l}=n.getState();r({nodes:l.filter(Ak),edges:o.filter(Ak)}),n.setState({nodesSelectionActive:!1})}},[i]),m.useEffect(()=>{n.setState({multiSelectionActive:s})},[s])}function W3(e){const t=Bt();m.useEffect(()=>{const n=()=>{var i,s,o,l;if(!e.current||!(((s=(i=e.current).checkVisibility)==null?void 0:s.call(i))??!0))return!1;const r=Xw(e.current);(r.height===0||r.width===0)&&((l=(o=t.getState()).onError)==null||l.call(o,"004",ks.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 nm={position:"absolute",width:"100%",height:"100%",top:0,left:0},K3=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function q3({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:s=ja.Free,zoomOnDoubleClick:o=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:d,minZoom:u,maxZoom:p,zoomActivationKeyCode:f,preventScrolling:h=!0,children:y,noWheelClassName:b,noPanClassName:S,onViewportChange:g,isControlledViewport:v,paneClickDistance:w,selectionOnDrag:k}){const E=Bt(),j=m.useRef(null),{userSelectionActive:P,lib:O,connectionInProgress:F}=vt(K3,Yt),W=sd(f),R=m.useRef();W3(j);const I=m.useCallback(q=>{g==null||g({x:q[0],y:q[1],zoom:q[2]}),v||E.setState({transform:q})},[g,v]);return m.useEffect(()=>{if(j.current){R.current=zD({domNode:j.current,minZoom:u,maxZoom:p,translateExtent:d,viewport:c,onDraggingChange:z=>E.setState(Y=>Y.paneDragging===z?Y:{paneDragging:z}),onPanZoomStart:(z,Y)=>{const{onViewportChangeStart:A,onMoveStart:T}=E.getState();T==null||T(z,Y),A==null||A(Y)},onPanZoom:(z,Y)=>{const{onViewportChange:A,onMove:T}=E.getState();T==null||T(z,Y),A==null||A(Y)},onPanZoomEnd:(z,Y)=>{const{onViewportChangeEnd:A,onMoveEnd:T}=E.getState();T==null||T(z,Y),A==null||A(Y)}});const{x:q,y:$,zoom:H}=R.current.getViewport();return E.setState({panZoom:R.current,transform:[q,$,H],domNode:j.current.closest(".react-flow")}),()=>{var z;(z=R.current)==null||z.destroy()}}},[]),m.useEffect(()=>{var q;(q=R.current)==null||q.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:o,panOnDrag:l,zoomActivationKeyPressed:W,preventScrolling:h,noPanClassName:S,userSelectionActive:P,noWheelClassName:b,lib:O,onTransformChange:I,connectionInProgress:F,selectionOnDrag:k,paneClickDistance:w})},[e,t,n,r,i,s,o,l,W,h,S,P,b,O,I,F,k,w]),a.jsx("div",{className:"react-flow__renderer",ref:j,style:nm,children:y})}const Y3=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function G3(){const{userSelectionActive:e,userSelectionRect:t}=vt(Y3,Yt);return e&&t?a.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 Ng=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},X3=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function J3({isSelecting:e,selectionKeyPressed:t,selectionMode:n=td.Full,panOnDrag:r,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:o,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:d,onPaneScroll:u,onPaneMouseEnter:p,onPaneMouseMove:f,onPaneMouseLeave:h,children:y}){const b=Bt(),{userSelectionActive:S,elementsSelectable:g,dragging:v,connectionInProgress:w}=vt(X3,Yt),k=g&&(e||S),E=m.useRef(null),j=m.useRef(),P=m.useRef(new Set),O=m.useRef(new Set),F=m.useRef(!1),W=A=>{if(F.current||w){F.current=!1;return}c==null||c(A),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},R=A=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){A.preventDefault();return}d==null||d(A)},I=u?A=>u(A):void 0,q=A=>{F.current&&(A.stopPropagation(),F.current=!1)},$=A=>{var ce,le;const{domNode:T}=b.getState();if(j.current=T==null?void 0:T.getBoundingClientRect(),!j.current)return;const C=A.target===E.current;if(!C&&!!A.target.closest(".nokey")||!e||!(s&&C||t)||A.button!==0||!A.isPrimary)return;(le=(ce=A.target)==null?void 0:ce.setPointerCapture)==null||le.call(ce,A.pointerId),F.current=!1;const{x:M,y:te}=zi(A.nativeEvent,j.current);b.setState({userSelectionRect:{width:0,height:0,startX:M,startY:te,x:M,y:te}}),C||(A.stopPropagation(),A.preventDefault())},H=A=>{const{userSelectionRect:T,transform:C,nodeLookup:G,edgeLookup:Q,connectionLookup:M,triggerNodeChanges:te,triggerEdgeChanges:ce,defaultEdgeOptions:le,resetSelectedElements:de}=b.getState();if(!j.current||!T)return;const{x:ue,y:se}=zi(A.nativeEvent,j.current),{startX:re,startY:fe}=T;if(!F.current){const Ke=t?0:i;if(Math.hypot(ue-re,se-fe)<=Ke)return;de(),o==null||o(A)}F.current=!0;const ye={startX:re,startY:fe,x:ue<re?ue:re,y:se<fe?se:fe,width:Math.abs(ue-re),height:Math.abs(se-fe)},Se=P.current,He=O.current;P.current=new Set(Yw(G,ye,C,n===td.Partial,!0).map(Ke=>Ke.id)),O.current=new Set;const st=(le==null?void 0:le.selectable)??!0;for(const Ke of P.current){const Te=M.get(Ke);if(Te)for(const{edgeId:It}of Te.values()){const pn=Q.get(It);pn&&(pn.selectable??st)&&O.current.add(It)}}if(!ok(Se,P.current)){const Ke=_l(G,P.current,!0);te(Ke)}if(!ok(He,O.current)){const Ke=_l(Q,O.current);ce(Ke)}b.setState({userSelectionRect:ye,userSelectionActive:!0,nodesSelectionActive:!1})},z=A=>{var T,C;A.button===0&&((C=(T=A.target)==null?void 0:T.releasePointerCapture)==null||C.call(T,A.pointerId),!S&&A.target===E.current&&b.getState().userSelectionRect&&(W==null||W(A)),b.setState({userSelectionActive:!1,userSelectionRect:null}),F.current&&(l==null||l(A),b.setState({nodesSelectionActive:P.current.size>0})))},Y=r===!0||Array.isArray(r)&&r.includes(0);return a.jsxs("div",{className:Sn(["react-flow__pane",{draggable:Y,dragging:v,selection:e}]),onClick:k?void 0:Ng(W,E),onContextMenu:Ng(R,E),onWheel:Ng(I,E),onPointerEnter:k?void 0:p,onPointerMove:k?H:f,onPointerUp:k?z:void 0,onPointerDownCapture:k?$:void 0,onClickCapture:k?q:void 0,onPointerLeave:h,ref:E,style:nm,children:[y,a.jsx(G3,{})]})}function gx({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:s,multiSelectionActive:o,nodeLookup:l,onError:c}=t.getState(),d=l.get(e);if(!d){c==null||c("012",ks.error012(e));return}t.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&o)&&(s({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var u;return(u=r==null?void 0:r.current)==null?void 0:u.blur()})):i([e])}function w_({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:s,nodeClickDistance:o}){const l=Bt(),[c,d]=m.useState(!1),u=m.useRef();return m.useEffect(()=>{u.current=CD({getStoreItems:()=>l.getState(),onNodeMouseDown:p=>{gx({id:p,store:l,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),m.useEffect(()=>{if(!(t||!e.current||!u.current))return u.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:s,nodeId:i,nodeClickDistance:o}),()=>{var p;(p=u.current)==null||p.destroy()}},[n,r,t,s,e,i,o]),c}const Q3=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function v_(){const e=Bt();return m.useCallback(n=>{const{nodeExtent:r,snapToGrid:i,snapGrid:s,nodesDraggable:o,onError:l,updateNodePositions:c,nodeLookup:d,nodeOrigin:u}=e.getState(),p=new Map,f=Q3(o),h=i?s[0]:5,y=i?s[1]:5,b=n.direction.x*h*n.factor,S=n.direction.y*y*n.factor;for(const[,g]of d){if(!f(g))continue;let v={x:g.internals.positionAbsolute.x+b,y:g.internals.positionAbsolute.y+S};i&&(v=_d(v,s));const{position:w,positionAbsolute:k}=OE({nodeId:g.id,nextPosition:v,nodeLookup:d,nodeExtent:r,nodeOrigin:u,onError:l});g.position=w,g.internals.positionAbsolute=k,p.set(g.id,g)}c(p)},[])}const rv=m.createContext(null),Z3=rv.Provider;rv.Consumer;const b_=()=>m.useContext(rv),ez=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),tz=(e,t,n)=>r=>{const{connectionClickStartHandle:i,connectionMode:s,connection:o}=r,{fromHandle:l,toHandle:c,isValid:d}=o,u=(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:u,clickConnecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.id)===t&&(i==null?void 0:i.type)===n,isPossibleEndHandle:s===Zl.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:!!i,valid:u&&d}};function nz({type:e="source",position:t=$e.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:s=!0,id:o,onConnect:l,children:c,className:d,onMouseDown:u,onTouchStart:p,...f},h){var H,z;const y=o||null,b=e==="target",S=Bt(),g=b_(),{connectOnClick:v,noPanClassName:w,rfId:k}=vt(ez,Yt),{connectingFrom:E,connectingTo:j,clickConnecting:P,isPossibleEndHandle:O,connectionInProcess:F,clickConnectionInProcess:W,valid:R}=vt(tz(g,y,e),Yt);g||(z=(H=S.getState()).onError)==null||z.call(H,"010",ks.error010());const I=Y=>{const{defaultEdgeOptions:A,onConnect:T,hasDefaultEdges:C}=S.getState(),G={...A,...Y};if(C){const{edges:Q,setEdges:M}=S.getState();M(id(G,Q))}T==null||T(G),l==null||l(G)},q=Y=>{if(!g)return;const A=UE(Y.nativeEvent);if(i&&(A&&Y.button===0||!A)){const T=S.getState();hx.onPointerDown(Y.nativeEvent,{handleDomNode:Y.currentTarget,autoPanOnConnect:T.autoPanOnConnect,connectionMode:T.connectionMode,connectionRadius:T.connectionRadius,domNode:T.domNode,nodeLookup:T.nodeLookup,lib:T.lib,isTarget:b,handleId:y,nodeId:g,flowId:T.rfId,panBy:T.panBy,cancelConnection:T.cancelConnection,onConnectStart:T.onConnectStart,onConnectEnd:(...C)=>{var G,Q;return(Q=(G=S.getState()).onConnectEnd)==null?void 0:Q.call(G,...C)},updateConnection:T.updateConnection,onConnect:I,isValidConnection:n||((...C)=>{var G,Q;return((Q=(G=S.getState()).isValidConnection)==null?void 0:Q.call(G,...C))??!0}),getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,autoPanSpeed:T.autoPanSpeed,dragThreshold:T.connectionDragThreshold})}A?u==null||u(Y):p==null||p(Y)},$=Y=>{const{onClickConnectStart:A,onClickConnectEnd:T,connectionClickStartHandle:C,connectionMode:G,isValidConnection:Q,lib:M,rfId:te,nodeLookup:ce,connection:le}=S.getState();if(!g||!C&&!i)return;if(!C){A==null||A(Y.nativeEvent,{nodeId:g,handleId:y,handleType:e}),S.setState({connectionClickStartHandle:{nodeId:g,type:e,id:y}});return}const de=BE(Y.target),ue=n||Q,{connection:se,isValid:re}=hx.isValid(Y.nativeEvent,{handle:{nodeId:g,id:y,type:e},connectionMode:G,fromNodeId:C.nodeId,fromHandleId:C.id||null,fromType:C.type,isValidConnection:ue,flowId:te,doc:de,lib:M,nodeLookup:ce});re&&se&&I(se);const fe=structuredClone(le);delete fe.inProgress,fe.toPosition=fe.toHandle?fe.toHandle.position:null,T==null||T(Y,fe),S.setState({connectionClickStartHandle:null})};return a.jsx("div",{"data-handleid":y,"data-nodeid":g,"data-handlepos":t,"data-id":`${k}-${g}-${y}-${e}`,className:Sn(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",w,d,{source:!b,target:b,connectable:r,connectablestart:i,connectableend:s,clickconnecting:P,connectingfrom:E,connectingto:j,valid:R,connectionindicator:r&&(!F||O)&&(F||W?s:i)}]),onMouseDown:q,onTouchStart:q,onClick:v?$:void 0,ref:h,...f,children:c})}const wi=m.memo(y_(nz));function rz({data:e,isConnectable:t,sourcePosition:n=$e.Bottom}){return a.jsxs(a.Fragment,{children:[e==null?void 0:e.label,a.jsx(wi,{type:"source",position:n,isConnectable:t})]})}function iz({data:e,isConnectable:t,targetPosition:n=$e.Top,sourcePosition:r=$e.Bottom}){return a.jsxs(a.Fragment,{children:[a.jsx(wi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,a.jsx(wi,{type:"source",position:r,isConnectable:t})]})}function sz(){return null}function oz({data:e,isConnectable:t,targetPosition:n=$e.Top}){return a.jsxs(a.Fragment,{children:[a.jsx(wi,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const ch={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Tk={input:rz,default:iz,output:oz,group:sz};function az(e){var t,n,r,i;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??((i=e.style)==null?void 0:i.height)}}const lz=e=>{const{width:t,height:n,x:r,y:i}=Ed(e.nodeLookup,{filter:s=>!!s.selected});return{width:Di(t)?t:null,height:Di(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${i}px)`}};function cz({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Bt(),{width:i,height:s,transformString:o,userSelectionActive:l}=vt(lz,Yt),c=v_(),d=m.useRef(null);m.useEffect(()=>{var h;n||(h=d.current)==null||h.focus({preventScroll:!0})},[n]);const u=!l&&i!==null&&s!==null;if(w_({nodeRef:d,disabled:!u}),!u)return null;const p=e?h=>{const y=r.getState().nodes.filter(b=>b.selected);e(h,y)}:void 0,f=h=>{Object.prototype.hasOwnProperty.call(ch,h.key)&&(h.preventDefault(),c({direction:ch[h.key],factor:h.shiftKey?4:1}))};return a.jsx("div",{className:Sn(["react-flow__nodesselection","react-flow__container",t]),style:{transform:o},children:a.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:p,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:i,height:s}})})}const Rk=typeof window<"u"?window:void 0,uz=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function k_({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:o,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:d,selectionOnDrag:u,selectionMode:p,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:y,panActivationKeyCode:b,zoomActivationKeyCode:S,elementsSelectable:g,zoomOnScroll:v,zoomOnPinch:w,panOnScroll:k,panOnScrollSpeed:E,panOnScrollMode:j,zoomOnDoubleClick:P,panOnDrag:O,defaultViewport:F,translateExtent:W,minZoom:R,maxZoom:I,preventScrolling:q,onSelectionContextMenu:$,noWheelClassName:H,noPanClassName:z,disableKeyboardA11y:Y,onViewportChange:A,isControlledViewport:T}){const{nodesSelectionActive:C,userSelectionActive:G}=vt(uz,Yt),Q=sd(d,{target:Rk}),M=sd(b,{target:Rk}),te=M||O,ce=M||k,le=u&&te!==!0,de=Q||G||le;return V3({deleteKeyCode:c,multiSelectionKeyCode:y}),a.jsx(q3,{onPaneContextMenu:s,elementsSelectable:g,zoomOnScroll:v,zoomOnPinch:w,panOnScroll:ce,panOnScrollSpeed:E,panOnScrollMode:j,zoomOnDoubleClick:P,panOnDrag:!Q&&te,defaultViewport:F,translateExtent:W,minZoom:R,maxZoom:I,zoomActivationKeyCode:S,preventScrolling:q,noWheelClassName:H,noPanClassName:z,onViewportChange:A,isControlledViewport:T,paneClickDistance:l,selectionOnDrag:le,children:a.jsxs(J3,{onSelectionStart:f,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:s,onPaneScroll:o,panOnDrag:te,isSelecting:!!de,selectionMode:p,selectionKeyPressed:Q,paneClickDistance:l,selectionOnDrag:le,children:[e,C&&a.jsx(cz,{onSelectionContextMenu:$,noPanClassName:z,disableKeyboardA11y:Y})]})})}k_.displayName="FlowRenderer";const dz=m.memo(k_),fz=e=>t=>e?Yw(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 pz(e){return vt(m.useCallback(fz(e),[e]),Yt)}const hz=e=>e.updateNodeInternals;function mz(){const e=vt(hz),[t]=m.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(i=>{const s=i.target.getAttribute("data-id");r.set(s,{id:s,nodeElement:i.target,force:!0})}),e(r)}));return m.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function gz({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const i=Bt(),s=m.useRef(null),o=m.useRef(null),l=m.useRef(e.sourcePosition),c=m.useRef(e.targetPosition),d=m.useRef(t),u=n&&!!e.internals.handleBounds;return m.useEffect(()=>{s.current&&!e.hidden&&(!u||o.current!==s.current)&&(o.current&&(r==null||r.unobserve(o.current)),r==null||r.observe(s.current),o.current=s.current)},[u,e.hidden]),m.useEffect(()=>()=>{o.current&&(r==null||r.unobserve(o.current),o.current=null)},[]),m.useEffect(()=>{if(s.current){const p=d.current!==t,f=l.current!==e.sourcePosition,h=c.current!==e.targetPosition;(p||f||h)&&(d.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:s.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),s}function yz({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:i,onContextMenu:s,onDoubleClick:o,nodesDraggable:l,elementsSelectable:c,nodesConnectable:d,nodesFocusable:u,resizeObserver:p,noDragClassName:f,noPanClassName:h,disableKeyboardA11y:y,rfId:b,nodeTypes:S,nodeClickDistance:g,onError:v}){const{node:w,internals:k,isParent:E}=vt(ue=>{const se=ue.nodeLookup.get(e),re=ue.parentLookup.has(e);return{node:se,internals:se.internals,isParent:re}},Yt);let j=w.type||"default",P=(S==null?void 0:S[j])||Tk[j];P===void 0&&(v==null||v("003",ks.error003(j)),j="default",P=(S==null?void 0:S.default)||Tk.default);const O=!!(w.draggable||l&&typeof w.draggable>"u"),F=!!(w.selectable||c&&typeof w.selectable>"u"),W=!!(w.connectable||d&&typeof w.connectable>"u"),R=!!(w.focusable||u&&typeof w.focusable>"u"),I=Bt(),q=DE(w),$=gz({node:w,nodeType:j,hasDimensions:q,resizeObserver:p}),H=w_({nodeRef:$,disabled:w.hidden||!O,noDragClassName:f,handleSelector:w.dragHandle,nodeId:e,isSelectable:F,nodeClickDistance:g}),z=v_();if(w.hidden)return null;const Y=Zs(w),A=az(w),T=F||O||t||n||r||i,C=n?ue=>n(ue,{...k.userNode}):void 0,G=r?ue=>r(ue,{...k.userNode}):void 0,Q=i?ue=>i(ue,{...k.userNode}):void 0,M=s?ue=>s(ue,{...k.userNode}):void 0,te=o?ue=>o(ue,{...k.userNode}):void 0,ce=ue=>{const{selectNodesOnDrag:se,nodeDragThreshold:re}=I.getState();F&&(!se||!O||re>0)&&gx({id:e,store:I,nodeRef:$}),t&&t(ue,{...k.userNode})},le=ue=>{if(!(HE(ue.nativeEvent)||y)){if(IE.includes(ue.key)&&F){const se=ue.key==="Escape";gx({id:e,store:I,unselect:se,nodeRef:$})}else if(O&&w.selected&&Object.prototype.hasOwnProperty.call(ch,ue.key)){ue.preventDefault();const{ariaLabelConfig:se}=I.getState();I.setState({ariaLiveMessage:se["node.a11yDescription.ariaLiveMessage"]({direction:ue.key.replace("Arrow","").toLowerCase(),x:~~k.positionAbsolute.x,y:~~k.positionAbsolute.y})}),z({direction:ch[ue.key],factor:ue.shiftKey?4:1})}}},de=()=>{var He;if(y||!((He=$.current)!=null&&He.matches(":focus-visible")))return;const{transform:ue,width:se,height:re,autoPanOnNodeFocus:fe,setCenter:ye}=I.getState();if(!fe)return;Yw(new Map([[e,w]]),{x:0,y:0,width:se,height:re},ue,!0).length>0||ye(w.position.x+Y.width/2,w.position.y+Y.height/2,{zoom:ue[2]})};return a.jsx("div",{className:Sn(["react-flow__node",`react-flow__node-${j}`,{[h]:O},w.className,{selected:w.selected,selectable:F,parent:E,draggable:O,dragging:H}]),ref:$,style:{zIndex:k.z,transform:`translate(${k.positionAbsolute.x}px,${k.positionAbsolute.y}px)`,pointerEvents:T?"all":"none",visibility:q?"visible":"hidden",...w.style,...A},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:C,onMouseMove:G,onMouseLeave:Q,onContextMenu:M,onClick:ce,onDoubleClick:te,onKeyDown:R?le:void 0,tabIndex:R?0:void 0,onFocus:R?de:void 0,role:w.ariaRole??(R?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${f_}-${b}`,"aria-label":w.ariaLabel,...w.domAttributes,children:a.jsx(Z3,{value:e,children:a.jsx(P,{id:e,data:w.data,type:j,positionAbsoluteX:k.positionAbsolute.x,positionAbsoluteY:k.positionAbsolute.y,selected:w.selected??!1,selectable:F,draggable:O,deletable:w.deletable??!0,isConnectable:W,sourcePosition:w.sourcePosition,targetPosition:w.targetPosition,dragging:H,dragHandle:w.dragHandle,zIndex:k.z,parentId:w.parentId,...Y})})})}var xz=m.memo(yz);const wz=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function S_(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,onError:s}=vt(wz,Yt),o=pz(e.onlyRenderVisibleElements),l=mz();return a.jsx("div",{className:"react-flow__nodes",style:nm,children:o.map(c=>a.jsx(xz,{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:i,nodeClickDistance:e.nodeClickDistance,onError:s},c))})}S_.displayName="NodeRenderer";const vz=m.memo(S_);function bz(e){return vt(m.useCallback(n=>{if(!e)return n.edges.map(i=>i.id);const r=[];if(n.width&&n.height)for(const i of n.edges){const s=n.nodeLookup.get(i.source),o=n.nodeLookup.get(i.target);s&&o&&lD({sourceNode:s,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&r.push(i.id)}return r},[e]),Yt)}const kz=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return a.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},Sz=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return a.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Lk={[zr.Arrow]:kz,[zr.ArrowClosed]:Sz};function Nz(e){const t=Bt();return m.useMemo(()=>{var i,s;return Object.prototype.hasOwnProperty.call(Lk,e)?Lk[e]:((s=(i=t.getState()).onError)==null||s.call(i,"009",ks.error009(e)),null)},[e])}const jz=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:s="strokeWidth",strokeWidth:o,orient:l="auto-start-reverse"})=>{const c=Nz(t);return c?a.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:l,refX:"0",refY:"0",children:a.jsx(c,{color:n,strokeWidth:o})}):null},N_=({defaultColor:e,rfId:t})=>{const n=vt(s=>s.edges),r=vt(s=>s.defaultEdgeOptions),i=m.useMemo(()=>mD(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return i.length?a.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:a.jsx("defs",{children:i.map(s=>a.jsx(jz,{id:s.id,type:s.type,color:s.color,width:s.width,height:s.height,markerUnits:s.markerUnits,strokeWidth:s.strokeWidth,orient:s.orient},s.id))})}):null};N_.displayName="MarkerDefinitions";var Cz=m.memo(N_);function j_({x:e,y:t,label:n,labelStyle:r,labelShowBg:i=!0,labelBgStyle:s,labelBgPadding:o=[2,4],labelBgBorderRadius:l=2,children:c,className:d,...u}){const[p,f]=m.useState({x:1,y:0,width:0,height:0}),h=Sn(["react-flow__edge-textwrapper",d]),y=m.useRef(null);return m.useEffect(()=>{if(y.current){const b=y.current.getBBox();f({x:b.x,y:b.y,width:b.width,height:b.height})}},[n]),n?a.jsxs("g",{transform:`translate(${e-p.width/2} ${t-p.height/2})`,className:h,visibility:p.width?"visible":"hidden",...u,children:[i&&a.jsx("rect",{width:p.width+2*o[0],x:-o[0],y:-o[1],height:p.height+2*o[1],className:"react-flow__edge-textbg",style:s,rx:l,ry:l}),a.jsx("text",{className:"react-flow__edge-text",y:p.height/2,dy:"0.3em",ref:y,style:r,children:n}),c]}):null}j_.displayName="EdgeText";const Ez=m.memo(j_);function rm({path:e,labelX:t,labelY:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:d=20,...u}){return a.jsxs(a.Fragment,{children:[a.jsx("path",{...u,d:e,fill:"none",className:Sn(["react-flow__edge-path",u.className])}),d?a.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,r&&Di(t)&&Di(n)?a.jsx(Ez,{x:t,y:n,label:r,labelStyle:i,labelShowBg:s,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function Ok({pos:e,x1:t,y1:n,x2:r,y2:i}){return e===$e.Left||e===$e.Right?[.5*(t+r),n]:[t,.5*(n+i)]}function C_({sourceX:e,sourceY:t,sourcePosition:n=$e.Bottom,targetX:r,targetY:i,targetPosition:s=$e.Top}){const[o,l]=Ok({pos:n,x1:e,y1:t,x2:r,y2:i}),[c,d]=Ok({pos:s,x1:r,y1:i,x2:e,y2:t}),[u,p,f,h]=VE({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:o,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${e},${t} C${o},${l} ${c},${d} ${r},${i}`,u,p,f,h]}function E_(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:o,targetPosition:l,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:h,style:y,markerEnd:b,markerStart:S,interactionWidth:g})=>{const[v,w,k]=C_({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:s,targetPosition:l}),E=e.isInternal?void 0:t;return a.jsx(rm,{id:E,path:v,labelX:w,labelY:k,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:h,style:y,markerEnd:b,markerStart:S,interactionWidth:g})})}const _z=E_({isInternal:!1}),__=E_({isInternal:!0});_z.displayName="SimpleBezierEdge";__.displayName="SimpleBezierEdgeInternal";function P_(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:p,style:f,sourcePosition:h=$e.Bottom,targetPosition:y=$e.Top,markerEnd:b,markerStart:S,pathOptions:g,interactionWidth:v})=>{const[w,k,E]=dx({sourceX:n,sourceY:r,sourcePosition:h,targetX:i,targetY:s,targetPosition:y,borderRadius:g==null?void 0:g.borderRadius,offset:g==null?void 0:g.offset,stepPosition:g==null?void 0:g.stepPosition}),j=e.isInternal?void 0:t;return a.jsx(rm,{id:j,path:w,labelX:k,labelY:E,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:p,style:f,markerEnd:b,markerStart:S,interactionWidth:v})})}const I_=P_({isInternal:!1}),A_=P_({isInternal:!0});I_.displayName="SmoothStepEdge";A_.displayName="SmoothStepEdgeInternal";function T_(e){return m.memo(({id:t,...n})=>{var i;const r=e.isInternal?void 0:t;return a.jsx(I_,{...n,id:r,pathOptions:m.useMemo(()=>{var s;return{borderRadius:0,offset:(s=n.pathOptions)==null?void 0:s.offset}},[(i=n.pathOptions)==null?void 0:i.offset])})})}const Pz=T_({isInternal:!1}),R_=T_({isInternal:!0});Pz.displayName="StepEdge";R_.displayName="StepEdgeInternal";function L_(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:p,style:f,markerEnd:h,markerStart:y,interactionWidth:b})=>{const[S,g,v]=qE({sourceX:n,sourceY:r,targetX:i,targetY:s}),w=e.isInternal?void 0:t;return a.jsx(rm,{id:w,path:S,labelX:g,labelY:v,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:p,style:f,markerEnd:h,markerStart:y,interactionWidth:b})})}const Iz=L_({isInternal:!1}),O_=L_({isInternal:!0});Iz.displayName="StraightEdge";O_.displayName="StraightEdgeInternal";function M_(e){return m.memo(({id:t,sourceX:n,sourceY:r,targetX:i,targetY:s,sourcePosition:o=$e.Bottom,targetPosition:l=$e.Top,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:h,style:y,markerEnd:b,markerStart:S,pathOptions:g,interactionWidth:v})=>{const[w,k,E]=WE({sourceX:n,sourceY:r,sourcePosition:o,targetX:i,targetY:s,targetPosition:l,curvature:g==null?void 0:g.curvature}),j=e.isInternal?void 0:t;return a.jsx(rm,{id:j,path:w,labelX:k,labelY:E,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:p,labelBgPadding:f,labelBgBorderRadius:h,style:y,markerEnd:b,markerStart:S,interactionWidth:v})})}const Az=M_({isInternal:!1}),$_=M_({isInternal:!0});Az.displayName="BezierEdge";$_.displayName="BezierEdgeInternal";const Mk={default:$_,straight:O_,step:R_,smoothstep:A_,simplebezier:__},$k={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},Tz=(e,t,n)=>n===$e.Left?e-t:n===$e.Right?e+t:e,Rz=(e,t,n)=>n===$e.Top?e-t:n===$e.Bottom?e+t:e,Fk="react-flow__edgeupdater";function Dk({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:s,onMouseOut:o,type:l}){return a.jsx("circle",{onMouseDown:i,onMouseEnter:s,onMouseOut:o,className:Sn([Fk,`${Fk}-${l}`]),cx:Tz(t,r,e),cy:Rz(n,r,e),r,stroke:"transparent",fill:"transparent"})}function Lz({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:i,targetX:s,targetY:o,sourcePosition:l,targetPosition:c,onReconnect:d,onReconnectStart:u,onReconnectEnd:p,setReconnecting:f,setUpdateHover:h}){const y=Bt(),b=(k,E)=>{if(k.button!==0)return;const{autoPanOnConnect:j,domNode:P,connectionMode:O,connectionRadius:F,lib:W,onConnectStart:R,cancelConnection:I,nodeLookup:q,rfId:$,panBy:H,updateConnection:z}=y.getState(),Y=E.type==="target",A=(G,Q)=>{f(!1),p==null||p(G,n,E.type,Q)},T=G=>d==null?void 0:d(n,G),C=(G,Q)=>{f(!0),u==null||u(k,n,E.type),R==null||R(G,Q)};hx.onPointerDown(k.nativeEvent,{autoPanOnConnect:j,connectionMode:O,connectionRadius:F,domNode:P,handleId:E.id,nodeId:E.nodeId,nodeLookup:q,isTarget:Y,edgeUpdaterType:E.type,lib:W,flowId:$,cancelConnection:I,panBy:H,isValidConnection:(...G)=>{var Q,M;return((M=(Q=y.getState()).isValidConnection)==null?void 0:M.call(Q,...G))??!0},onConnect:T,onConnectStart:C,onConnectEnd:(...G)=>{var Q,M;return(M=(Q=y.getState()).onConnectEnd)==null?void 0:M.call(Q,...G)},onReconnectEnd:A,updateConnection:z,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,dragThreshold:y.getState().connectionDragThreshold,handleDomNode:k.currentTarget})},S=k=>b(k,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),g=k=>b(k,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),v=()=>h(!0),w=()=>h(!1);return a.jsxs(a.Fragment,{children:[(e===!0||e==="source")&&a.jsx(Dk,{position:l,centerX:r,centerY:i,radius:t,onMouseDown:S,onMouseEnter:v,onMouseOut:w,type:"source"}),(e===!0||e==="target")&&a.jsx(Dk,{position:c,centerX:s,centerY:o,radius:t,onMouseDown:g,onMouseEnter:v,onMouseOut:w,type:"target"})]})}function Oz({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:i,onDoubleClick:s,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:d,reconnectRadius:u,onReconnect:p,onReconnectStart:f,onReconnectEnd:h,rfId:y,edgeTypes:b,noPanClassName:S,onError:g,disableKeyboardA11y:v}){let w=vt(ye=>ye.edgeLookup.get(e));const k=vt(ye=>ye.defaultEdgeOptions);w=k?{...k,...w}:w;let E=w.type||"default",j=(b==null?void 0:b[E])||Mk[E];j===void 0&&(g==null||g("011",ks.error011(E)),E="default",j=(b==null?void 0:b.default)||Mk.default);const P=!!(w.focusable||t&&typeof w.focusable>"u"),O=typeof p<"u"&&(w.reconnectable||n&&typeof w.reconnectable>"u"),F=!!(w.selectable||r&&typeof w.selectable>"u"),W=m.useRef(null),[R,I]=m.useState(!1),[q,$]=m.useState(!1),H=Bt(),{zIndex:z,sourceX:Y,sourceY:A,targetX:T,targetY:C,sourcePosition:G,targetPosition:Q}=vt(m.useCallback(ye=>{const Se=ye.nodeLookup.get(w.source),He=ye.nodeLookup.get(w.target);if(!Se||!He)return{zIndex:w.zIndex,...$k};const st=hD({id:e,sourceNode:Se,targetNode:He,sourceHandle:w.sourceHandle||null,targetHandle:w.targetHandle||null,connectionMode:ye.connectionMode,onError:g});return{zIndex:aD({selected:w.selected,zIndex:w.zIndex,sourceNode:Se,targetNode:He,elevateOnSelect:ye.elevateEdgesOnSelect,zIndexMode:ye.zIndexMode}),...st||$k}},[w.source,w.target,w.sourceHandle,w.targetHandle,w.selected,w.zIndex]),Yt),M=m.useMemo(()=>w.markerStart?`url('#${fx(w.markerStart,y)}')`:void 0,[w.markerStart,y]),te=m.useMemo(()=>w.markerEnd?`url('#${fx(w.markerEnd,y)}')`:void 0,[w.markerEnd,y]);if(w.hidden||Y===null||A===null||T===null||C===null)return null;const ce=ye=>{var Ke;const{addSelectedEdges:Se,unselectNodesAndEdges:He,multiSelectionActive:st}=H.getState();F&&(H.setState({nodesSelectionActive:!1}),w.selected&&st?(He({nodes:[],edges:[w]}),(Ke=W.current)==null||Ke.blur()):Se([e])),i&&i(ye,w)},le=s?ye=>{s(ye,{...w})}:void 0,de=o?ye=>{o(ye,{...w})}:void 0,ue=l?ye=>{l(ye,{...w})}:void 0,se=c?ye=>{c(ye,{...w})}:void 0,re=d?ye=>{d(ye,{...w})}:void 0,fe=ye=>{var Se;if(!v&&IE.includes(ye.key)&&F){const{unselectNodesAndEdges:He,addSelectedEdges:st}=H.getState();ye.key==="Escape"?((Se=W.current)==null||Se.blur(),He({edges:[w]})):st([e])}};return a.jsx("svg",{style:{zIndex:z},children:a.jsxs("g",{className:Sn(["react-flow__edge",`react-flow__edge-${E}`,w.className,S,{selected:w.selected,animated:w.animated,inactive:!F&&!i,updating:R,selectable:F}]),onClick:ce,onDoubleClick:le,onContextMenu:de,onMouseEnter:ue,onMouseMove:se,onMouseLeave:re,onKeyDown:P?fe:void 0,tabIndex:P?0:void 0,role:w.ariaRole??(P?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":w.ariaLabel===null?void 0:w.ariaLabel||`Edge from ${w.source} to ${w.target}`,"aria-describedby":P?`${p_}-${y}`:void 0,ref:W,...w.domAttributes,children:[!q&&a.jsx(j,{id:e,source:w.source,target:w.target,type:w.type,selected:w.selected,animated:w.animated,selectable:F,deletable:w.deletable??!0,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,sourceX:Y,sourceY:A,targetX:T,targetY:C,sourcePosition:G,targetPosition:Q,data:w.data,style:w.style,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerStart:M,markerEnd:te,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth}),O&&a.jsx(Lz,{edge:w,isReconnectable:O,reconnectRadius:u,onReconnect:p,onReconnectStart:f,onReconnectEnd:h,sourceX:Y,sourceY:A,targetX:T,targetY:C,sourcePosition:G,targetPosition:Q,setUpdateHover:I,setReconnecting:$})]})})}var Mz=m.memo(Oz);const $z=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function F_({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:i,onReconnect:s,onEdgeContextMenu:o,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:d,onEdgeClick:u,reconnectRadius:p,onEdgeDoubleClick:f,onReconnectStart:h,onReconnectEnd:y,disableKeyboardA11y:b}){const{edgesFocusable:S,edgesReconnectable:g,elementsSelectable:v,onError:w}=vt($z,Yt),k=bz(t);return a.jsxs("div",{className:"react-flow__edges",children:[a.jsx(Cz,{defaultColor:e,rfId:n}),k.map(E=>a.jsx(Mz,{id:E,edgesFocusable:S,edgesReconnectable:g,elementsSelectable:v,noPanClassName:i,onReconnect:s,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:d,onClick:u,reconnectRadius:p,onDoubleClick:f,onReconnectStart:h,onReconnectEnd:y,rfId:n,onError:w,edgeTypes:r,disableKeyboardA11y:b},E))]})}F_.displayName="EdgeRenderer";const Fz=m.memo(F_),Dz=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function zz({children:e}){const t=vt(Dz);return a.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Bz(e){const t=Ba(),n=m.useRef(!1);m.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const Hz=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function Uz(e){const t=vt(Hz),n=Bt();return m.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Vz(e){return e.connection.inProgress?{...e.connection,to:Pd(e.connection.to,e.transform)}:{...e.connection}}function Wz(e){return Vz}function Kz(e){const t=Wz();return vt(t,Yt)}const qz=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Yz({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:i,width:s,height:o,isValid:l,inProgress:c}=vt(qz,Yt);return!(s&&i&&c)?null:a.jsx("svg",{style:e,width:s,height:o,className:"react-flow__connectionline react-flow__container",children:a.jsx("g",{className:Sn(["react-flow__connection",RE(l)]),children:a.jsx(D_,{style:t,type:n,CustomComponent:r,isValid:l})})})}const D_=({style:e,type:t=So.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:i,from:s,fromNode:o,fromHandle:l,fromPosition:c,to:d,toNode:u,toHandle:p,toPosition:f,pointer:h}=Kz();if(!i)return;if(n)return a.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:o,fromHandle:l,fromX:s.x,fromY:s.y,toX:d.x,toY:d.y,fromPosition:c,toPosition:f,connectionStatus:RE(r),toNode:u,toHandle:p,pointer:h});let y="";const b={sourceX:s.x,sourceY:s.y,sourcePosition:c,targetX:d.x,targetY:d.y,targetPosition:f};switch(t){case So.Bezier:[y]=WE(b);break;case So.SimpleBezier:[y]=C_(b);break;case So.Step:[y]=dx({...b,borderRadius:0});break;case So.SmoothStep:[y]=dx(b);break;default:[y]=qE(b)}return a.jsx("path",{d:y,fill:"none",className:"react-flow__connection-path",style:e})};D_.displayName="ConnectionLine";const Gz={};function zk(e=Gz){m.useRef(e),Bt(),m.useEffect(()=>{},[e])}function Xz(){Bt(),m.useRef(!1),m.useEffect(()=>{},[])}function z_({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:i,onNodeDoubleClick:s,onEdgeDoubleClick:o,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:d,onNodeContextMenu:u,onSelectionContextMenu:p,onSelectionStart:f,onSelectionEnd:h,connectionLineType:y,connectionLineStyle:b,connectionLineComponent:S,connectionLineContainerStyle:g,selectionKeyCode:v,selectionOnDrag:w,selectionMode:k,multiSelectionKeyCode:E,panActivationKeyCode:j,zoomActivationKeyCode:P,deleteKeyCode:O,onlyRenderVisibleElements:F,elementsSelectable:W,defaultViewport:R,translateExtent:I,minZoom:q,maxZoom:$,preventScrolling:H,defaultMarkerColor:z,zoomOnScroll:Y,zoomOnPinch:A,panOnScroll:T,panOnScrollSpeed:C,panOnScrollMode:G,zoomOnDoubleClick:Q,panOnDrag:M,onPaneClick:te,onPaneMouseEnter:ce,onPaneMouseMove:le,onPaneMouseLeave:de,onPaneScroll:ue,onPaneContextMenu:se,paneClickDistance:re,nodeClickDistance:fe,onEdgeContextMenu:ye,onEdgeMouseEnter:Se,onEdgeMouseMove:He,onEdgeMouseLeave:st,reconnectRadius:Ke,onReconnect:Te,onReconnectStart:It,onReconnectEnd:pn,noDragClassName:sn,noWheelClassName:Nn,noPanClassName:xn,disableKeyboardA11y:On,nodeExtent:Ur,rfId:Jn,viewport:oe,onViewportChange:he}){return zk(e),zk(t),Xz(),Bz(n),Uz(oe),a.jsx(dz,{onPaneClick:te,onPaneMouseEnter:ce,onPaneMouseMove:le,onPaneMouseLeave:de,onPaneContextMenu:se,onPaneScroll:ue,paneClickDistance:re,deleteKeyCode:O,selectionKeyCode:v,selectionOnDrag:w,selectionMode:k,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:E,panActivationKeyCode:j,zoomActivationKeyCode:P,elementsSelectable:W,zoomOnScroll:Y,zoomOnPinch:A,zoomOnDoubleClick:Q,panOnScroll:T,panOnScrollSpeed:C,panOnScrollMode:G,panOnDrag:M,defaultViewport:R,translateExtent:I,minZoom:q,maxZoom:$,onSelectionContextMenu:p,preventScrolling:H,noDragClassName:sn,noWheelClassName:Nn,noPanClassName:xn,disableKeyboardA11y:On,onViewportChange:he,isControlledViewport:!!oe,children:a.jsxs(zz,{children:[a.jsx(Fz,{edgeTypes:t,onEdgeClick:i,onEdgeDoubleClick:o,onReconnect:Te,onReconnectStart:It,onReconnectEnd:pn,onlyRenderVisibleElements:F,onEdgeContextMenu:ye,onEdgeMouseEnter:Se,onEdgeMouseMove:He,onEdgeMouseLeave:st,reconnectRadius:Ke,defaultMarkerColor:z,noPanClassName:xn,disableKeyboardA11y:On,rfId:Jn}),a.jsx(Yz,{style:b,type:y,component:S,containerStyle:g}),a.jsx("div",{className:"react-flow__edgelabel-renderer"}),a.jsx(vz,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:d,onNodeContextMenu:u,nodeClickDistance:fe,onlyRenderVisibleElements:F,noPanClassName:xn,noDragClassName:sn,disableKeyboardA11y:On,nodeExtent:Ur,rfId:Jn}),a.jsx("div",{className:"react-flow__viewport-portal"})]})})}z_.displayName="GraphView";const Jz=m.memo(z_),Bk=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:o,fitViewOptions:l,minZoom:c=.5,maxZoom:d=2,nodeOrigin:u,nodeExtent:p,zIndexMode:f="basic"}={})=>{const h=new Map,y=new Map,b=new Map,S=new Map,g=r??t??[],v=n??e??[],w=u??[0,0],k=p??ed;XE(b,S,g);const{nodesInitialized:E}=px(v,h,y,{nodeOrigin:w,nodeExtent:k,zIndexMode:f});let j=[0,0,1];if(o&&i&&s){const P=Ed(h,{filter:R=>!!((R.width||R.initialWidth)&&(R.height||R.initialHeight))}),{x:O,y:F,zoom:W}=Gw(P,i,s,c,d,(l==null?void 0:l.padding)??.1);j=[O,F,W]}return{rfId:"1",width:i??0,height:s??0,transform:j,nodes:v,nodesInitialized:E,nodeLookup:h,parentLookup:y,edges:g,edgeLookup:S,connectionLookup:b,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:d,translateExtent:ed,nodeExtent:k,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Zl.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:w,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:l,fitViewResolver:null,connection:{...TE},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:tD,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:AE,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Qz=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:u,nodeExtent:p,zIndexMode:f})=>y3((h,y)=>{async function b(){const{nodeLookup:S,panZoom:g,fitViewOptions:v,fitViewResolver:w,width:k,height:E,minZoom:j,maxZoom:P}=y();g&&(await ZF({nodes:S,width:k,height:E,panZoom:g,minZoom:j,maxZoom:P},v),w==null||w.resolve(!0),h({fitViewResolver:null}))}return{...Bk({nodes:e,edges:t,width:i,height:s,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:u,nodeExtent:p,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:S=>{const{nodeLookup:g,parentLookup:v,nodeOrigin:w,elevateNodesOnSelect:k,fitViewQueued:E,zIndexMode:j,nodesSelectionActive:P}=y(),{nodesInitialized:O,hasSelectedNodes:F}=px(S,g,v,{nodeOrigin:w,nodeExtent:p,elevateNodesOnSelect:k,checkEquality:!0,zIndexMode:j}),W=P&&F;E&&O?(b(),h({nodes:S,nodesInitialized:O,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:W})):h({nodes:S,nodesInitialized:O,nodesSelectionActive:W})},setEdges:S=>{const{connectionLookup:g,edgeLookup:v}=y();XE(g,v,S),h({edges:S})},setDefaultNodesAndEdges:(S,g)=>{if(S){const{setNodes:v}=y();v(S),h({hasDefaultNodes:!0})}if(g){const{setEdges:v}=y();v(g),h({hasDefaultEdges:!0})}},updateNodeInternals:S=>{const{triggerNodeChanges:g,nodeLookup:v,parentLookup:w,domNode:k,nodeOrigin:E,nodeExtent:j,debug:P,fitViewQueued:O,zIndexMode:F}=y(),{changes:W,updatedInternals:R}=kD(S,v,w,k,E,j,F);R&&(xD(v,w,{nodeOrigin:E,nodeExtent:j,zIndexMode:F}),O?(b(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(W==null?void 0:W.length)>0&&(P&&console.log("React Flow: trigger node changes",W),g==null||g(W)))},updateNodePositions:(S,g=!1)=>{const v=[];let w=[];const{nodeLookup:k,triggerNodeChanges:E,connection:j,updateConnection:P,onNodesChangeMiddlewareMap:O}=y();for(const[F,W]of S){const R=k.get(F),I=!!(R!=null&&R.expandParent&&(R!=null&&R.parentId)&&(W!=null&&W.position)),q={id:F,type:"position",position:I?{x:Math.max(0,W.position.x),y:Math.max(0,W.position.y)}:W.position,dragging:g};if(R&&j.inProgress&&j.fromNode.id===R.id){const $=Ma(R,j.fromHandle,$e.Left,!0);P({...j,from:$})}I&&R.parentId&&v.push({id:F,parentId:R.parentId,rect:{...W.internals.positionAbsolute,width:W.measured.width??0,height:W.measured.height??0}}),w.push(q)}if(v.length>0){const{parentLookup:F,nodeOrigin:W}=y(),R=tv(v,k,F,W);w.push(...R)}for(const F of O.values())w=F(w);E(w)},triggerNodeChanges:S=>{const{onNodesChange:g,setNodes:v,nodes:w,hasDefaultNodes:k,debug:E}=y();if(S!=null&&S.length){if(k){const j=nv(S,w);v(j)}E&&console.log("React Flow: trigger node changes",S),g==null||g(S)}},triggerEdgeChanges:S=>{const{onEdgesChange:g,setEdges:v,edges:w,hasDefaultEdges:k,debug:E}=y();if(S!=null&&S.length){if(k){const j=g_(S,w);v(j)}E&&console.log("React Flow: trigger edge changes",S),g==null||g(S)}},addSelectedNodes:S=>{const{multiSelectionActive:g,edgeLookup:v,nodeLookup:w,triggerNodeChanges:k,triggerEdgeChanges:E}=y();if(g){const j=S.map(P=>ga(P,!0));k(j);return}k(_l(w,new Set([...S]),!0)),E(_l(v))},addSelectedEdges:S=>{const{multiSelectionActive:g,edgeLookup:v,nodeLookup:w,triggerNodeChanges:k,triggerEdgeChanges:E}=y();if(g){const j=S.map(P=>ga(P,!0));E(j);return}E(_l(v,new Set([...S]))),k(_l(w,new Set,!0))},unselectNodesAndEdges:({nodes:S,edges:g}={})=>{const{edges:v,nodes:w,nodeLookup:k,triggerNodeChanges:E,triggerEdgeChanges:j}=y(),P=S||w,O=g||v,F=[];for(const R of P){if(!R.selected)continue;const I=k.get(R.id);I&&(I.selected=!1),F.push(ga(R.id,!1))}const W=[];for(const R of O)R.selected&&W.push(ga(R.id,!1));E(F),j(W)},setMinZoom:S=>{const{panZoom:g,maxZoom:v}=y();g==null||g.setScaleExtent([S,v]),h({minZoom:S})},setMaxZoom:S=>{const{panZoom:g,minZoom:v}=y();g==null||g.setScaleExtent([v,S]),h({maxZoom:S})},setTranslateExtent:S=>{var g;(g=y().panZoom)==null||g.setTranslateExtent(S),h({translateExtent:S})},resetSelectedElements:()=>{const{edges:S,nodes:g,triggerNodeChanges:v,triggerEdgeChanges:w,elementsSelectable:k}=y();if(!k)return;const E=g.reduce((P,O)=>O.selected?[...P,ga(O.id,!1)]:P,[]),j=S.reduce((P,O)=>O.selected?[...P,ga(O.id,!1)]:P,[]);v(E),w(j)},setNodeExtent:S=>{const{nodes:g,nodeLookup:v,parentLookup:w,nodeOrigin:k,elevateNodesOnSelect:E,nodeExtent:j,zIndexMode:P}=y();S[0][0]===j[0][0]&&S[0][1]===j[0][1]&&S[1][0]===j[1][0]&&S[1][1]===j[1][1]||(px(g,v,w,{nodeOrigin:k,nodeExtent:S,elevateNodesOnSelect:E,checkEquality:!1,zIndexMode:P}),h({nodeExtent:S}))},panBy:S=>{const{transform:g,width:v,height:w,panZoom:k,translateExtent:E}=y();return SD({delta:S,panZoom:k,transform:g,translateExtent:E,width:v,height:w})},setCenter:async(S,g,v)=>{const{width:w,height:k,maxZoom:E,panZoom:j}=y();if(!j)return Promise.resolve(!1);const P=typeof(v==null?void 0:v.zoom)<"u"?v.zoom:E;return await j.setViewport({x:w/2-S*P,y:k/2-g*P,zoom:P},{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:{...TE}})},updateConnection:S=>{h({connection:S})},reset:()=>h({...Bk()})}},Object.is);function iv({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:i,initialHeight:s,initialMinZoom:o,initialMaxZoom:l,initialFitViewOptions:c,fitView:d,nodeOrigin:u,nodeExtent:p,zIndexMode:f,children:h}){const[y]=m.useState(()=>Qz({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:i,height:s,fitView:d,minZoom:o,maxZoom:l,fitViewOptions:c,nodeOrigin:u,nodeExtent:p,zIndexMode:f}));return a.jsx(x3,{value:y,children:a.jsx(z3,{children:h})})}function Zz({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:i,width:s,height:o,fitView:l,fitViewOptions:c,minZoom:d,maxZoom:u,nodeOrigin:p,nodeExtent:f,zIndexMode:h}){return m.useContext(tm)?a.jsx(a.Fragment,{children:e}):a.jsx(iv,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:i,initialWidth:s,initialHeight:o,fitView:l,initialFitViewOptions:c,initialMinZoom:d,initialMaxZoom:u,nodeOrigin:p,nodeExtent:f,zIndexMode:h,children:e})}const e4={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function t4({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:s,edgeTypes:o,onNodeClick:l,onEdgeClick:c,onInit:d,onMove:u,onMoveStart:p,onMoveEnd:f,onConnect:h,onConnectStart:y,onConnectEnd:b,onClickConnectStart:S,onClickConnectEnd:g,onNodeMouseEnter:v,onNodeMouseMove:w,onNodeMouseLeave:k,onNodeContextMenu:E,onNodeDoubleClick:j,onNodeDragStart:P,onNodeDrag:O,onNodeDragStop:F,onNodesDelete:W,onEdgesDelete:R,onDelete:I,onSelectionChange:q,onSelectionDragStart:$,onSelectionDrag:H,onSelectionDragStop:z,onSelectionContextMenu:Y,onSelectionStart:A,onSelectionEnd:T,onBeforeDelete:C,connectionMode:G,connectionLineType:Q=So.Bezier,connectionLineStyle:M,connectionLineComponent:te,connectionLineContainerStyle:ce,deleteKeyCode:le="Backspace",selectionKeyCode:de="Shift",selectionOnDrag:ue=!1,selectionMode:se=td.Full,panActivationKeyCode:re="Space",multiSelectionKeyCode:fe=rd()?"Meta":"Control",zoomActivationKeyCode:ye=rd()?"Meta":"Control",snapToGrid:Se,snapGrid:He,onlyRenderVisibleElements:st=!1,selectNodesOnDrag:Ke,nodesDraggable:Te,autoPanOnNodeFocus:It,nodesConnectable:pn,nodesFocusable:sn,nodeOrigin:Nn=h_,edgesFocusable:xn,edgesReconnectable:On,elementsSelectable:Ur=!0,defaultViewport:Jn=A3,minZoom:oe=.5,maxZoom:he=2,translateExtent:Ve=ed,preventScrolling:Xe=!0,nodeExtent:tt,defaultMarkerColor:Et="#b1b1b7",zoomOnScroll:jn=!0,zoomOnPinch:xt=!0,panOnScroll:Cn=!1,panOnScrollSpeed:Qn=.5,panOnScrollMode:Ht=ja.Free,zoomOnDoubleClick:Ut=!0,panOnDrag:on=!0,onPaneClick:jr,onPaneMouseEnter:Yi,onPaneMouseMove:bt,onPaneMouseLeave:En,onPaneScroll:vi,onPaneContextMenu:Gt,paneClickDistance:fr=1,nodeClickDistance:Zn=0,children:er,onReconnect:oi,onReconnectStart:Gi,onReconnectEnd:tr,onEdgeContextMenu:Vn,onEdgeDoubleClick:Xi,onEdgeMouseEnter:qe,onEdgeMouseMove:jt,onEdgeMouseLeave:At,reconnectRadius:$t=10,onNodesChange:De,onEdgesChange:_n,noDragClassName:Ne="nodrag",noWheelClassName:an="nowheel",noPanClassName:pr="nopan",fitView:ot,fitViewOptions:ai,connectOnClick:Mn,attributionPosition:$n,proOptions:Vr,defaultEdgeOptions:Pn,elevateNodesOnSelect:Wr=!0,elevateEdgesOnSelect:hr=!1,disableKeyboardA11y:Xt=!1,autoPanOnConnect:mr,autoPanOnNodeDrag:gr,autoPanSpeed:Kr,connectionRadius:U,isValidConnection:ge,onError:_e,style:ze,id:dt,nodeDragThreshold:Je,connectionDragThreshold:gt,viewport:nt,onViewportChange:Fn,width:bi,height:ki,colorMode:hn="light",debug:Cs,onScroll:In,ariaLabelConfig:Si,zIndexMode:Ni="basic",...Ua},Es){const _s=dt||"1",Ps=O3(hn),at=m.useCallback(Ji=>{Ji.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),In==null||In(Ji)},[In]);return a.jsx("div",{"data-testid":"rf__wrapper",...Ua,onScroll:at,style:{...ze,...e4},ref:Es,className:Sn(["react-flow",i,Ps]),id:dt,role:"application",children:a.jsxs(Zz,{nodes:e,edges:t,width:bi,height:ki,fitView:ot,fitViewOptions:ai,minZoom:oe,maxZoom:he,nodeOrigin:Nn,nodeExtent:tt,zIndexMode:Ni,children:[a.jsx(L3,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:y,onConnectEnd:b,onClickConnectStart:S,onClickConnectEnd:g,nodesDraggable:Te,autoPanOnNodeFocus:It,nodesConnectable:pn,nodesFocusable:sn,edgesFocusable:xn,edgesReconnectable:On,elementsSelectable:Ur,elevateNodesOnSelect:Wr,elevateEdgesOnSelect:hr,minZoom:oe,maxZoom:he,nodeExtent:tt,onNodesChange:De,onEdgesChange:_n,snapToGrid:Se,snapGrid:He,connectionMode:G,translateExtent:Ve,connectOnClick:Mn,defaultEdgeOptions:Pn,fitView:ot,fitViewOptions:ai,onNodesDelete:W,onEdgesDelete:R,onDelete:I,onNodeDragStart:P,onNodeDrag:O,onNodeDragStop:F,onSelectionDrag:H,onSelectionDragStart:$,onSelectionDragStop:z,onMove:u,onMoveStart:p,onMoveEnd:f,noPanClassName:pr,nodeOrigin:Nn,rfId:_s,autoPanOnConnect:mr,autoPanOnNodeDrag:gr,autoPanSpeed:Kr,onError:_e,connectionRadius:U,isValidConnection:ge,selectNodesOnDrag:Ke,nodeDragThreshold:Je,connectionDragThreshold:gt,onBeforeDelete:C,debug:Cs,ariaLabelConfig:Si,zIndexMode:Ni}),a.jsx(Jz,{onInit:d,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:v,onNodeMouseMove:w,onNodeMouseLeave:k,onNodeContextMenu:E,onNodeDoubleClick:j,nodeTypes:s,edgeTypes:o,connectionLineType:Q,connectionLineStyle:M,connectionLineComponent:te,connectionLineContainerStyle:ce,selectionKeyCode:de,selectionOnDrag:ue,selectionMode:se,deleteKeyCode:le,multiSelectionKeyCode:fe,panActivationKeyCode:re,zoomActivationKeyCode:ye,onlyRenderVisibleElements:st,defaultViewport:Jn,translateExtent:Ve,minZoom:oe,maxZoom:he,preventScrolling:Xe,zoomOnScroll:jn,zoomOnPinch:xt,zoomOnDoubleClick:Ut,panOnScroll:Cn,panOnScrollSpeed:Qn,panOnScrollMode:Ht,panOnDrag:on,onPaneClick:jr,onPaneMouseEnter:Yi,onPaneMouseMove:bt,onPaneMouseLeave:En,onPaneScroll:vi,onPaneContextMenu:Gt,paneClickDistance:fr,nodeClickDistance:Zn,onSelectionContextMenu:Y,onSelectionStart:A,onSelectionEnd:T,onReconnect:oi,onReconnectStart:Gi,onReconnectEnd:tr,onEdgeContextMenu:Vn,onEdgeDoubleClick:Xi,onEdgeMouseEnter:qe,onEdgeMouseMove:jt,onEdgeMouseLeave:At,reconnectRadius:$t,defaultMarkerColor:Et,noDragClassName:Ne,noWheelClassName:an,noPanClassName:pr,rfId:_s,disableKeyboardA11y:Xt,nodeExtent:tt,viewport:nt,onViewportChange:Fn}),a.jsx(I3,{onSelectionChange:q}),er,a.jsx(j3,{proOptions:Vr,position:$n}),a.jsx(N3,{rfId:_s,disableKeyboardA11y:Xt})]})})}var B_=y_(t4);function H_(){const e=Bt();return m.useCallback(t=>{const{domNode:n,updateNodeInternals:r}=e.getState(),i=Array.isArray(t)?t:[t],s=new Map;i.forEach(o=>{const l=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${o}"]`);l&&s.set(o,{id:o,nodeElement:l,force:!0})}),requestAnimationFrame(()=>r(s,{triggerFitView:!1}))},[])}function U_(e){const[t,n]=m.useState(e),r=m.useCallback(i=>n(s=>nv(i,s)),[]);return[t,n,r]}function V_(e){const[t,n]=m.useState(e),r=m.useCallback(i=>n(s=>g_(i,s)),[]);return[t,n,r]}function n4({dimensions:e,lineWidth:t,variant:n,className:r}){return a.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Sn(["react-flow__background-pattern",n,r])})}function r4({radius:e,className:t}){return a.jsx("circle",{cx:e,cy:e,r:e,className:Sn(["react-flow__background-pattern","dots",t])})}var $o;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})($o||($o={}));const i4={[$o.Dots]:1,[$o.Lines]:1,[$o.Cross]:6},s4=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function W_({id:e,variant:t=$o.Dots,gap:n=20,size:r,lineWidth:i=1,offset:s=0,color:o,bgColor:l,style:c,className:d,patternClassName:u}){const p=m.useRef(null),{transform:f,patternId:h}=vt(s4,Yt),y=r||i4[t],b=t===$o.Dots,S=t===$o.Cross,g=Array.isArray(n)?n:[n,n],v=[g[0]*f[2]||1,g[1]*f[2]||1],w=y*f[2],k=Array.isArray(s)?s:[s,s],E=S?[w,w]:v,j=[k[0]*f[2]||1+E[0]/2,k[1]*f[2]||1+E[1]/2],P=`${h}${e||""}`;return a.jsxs("svg",{className:Sn(["react-flow__background",d]),style:{...c,...nm,"--xy-background-color-props":l,"--xy-background-pattern-color-props":o},ref:p,"data-testid":"rf__background",children:[a.jsx("pattern",{id:P,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:b?a.jsx(r4,{radius:w/2,className:u}):a.jsx(n4,{dimensions:E,lineWidth:i,variant:t,className:u})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${P})`})]})}W_.displayName="Background";const K_=m.memo(W_);function o4(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:a.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function a4(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:a.jsx("path",{d:"M0 0h32v4.2H0z"})})}function l4(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:a.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 c4(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.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 u4(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.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 Vf({children:e,className:t,...n}){return a.jsx("button",{type:"button",className:Sn(["react-flow__controls-button",t]),...n,children:e})}const d4=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function q_({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:s,onZoomOut:o,onFitView:l,onInteractiveChange:c,className:d,children:u,position:p="bottom-left",orientation:f="vertical","aria-label":h}){const y=Bt(),{isInteractive:b,minZoomReached:S,maxZoomReached:g,ariaLabelConfig:v}=vt(d4,Yt),{zoomIn:w,zoomOut:k,fitView:E}=Ba(),j=()=>{w(),s==null||s()},P=()=>{k(),o==null||o()},O=()=>{E(i),l==null||l()},F=()=>{y.setState({nodesDraggable:!b,nodesConnectable:!b,elementsSelectable:!b}),c==null||c(!b)},W=f==="horizontal"?"horizontal":"vertical";return a.jsxs(sc,{className:Sn(["react-flow__controls",W,d]),position:p,style:e,"data-testid":"rf__controls","aria-label":h??v["controls.ariaLabel"],children:[t&&a.jsxs(a.Fragment,{children:[a.jsx(Vf,{onClick:j,className:"react-flow__controls-zoomin",title:v["controls.zoomIn.ariaLabel"],"aria-label":v["controls.zoomIn.ariaLabel"],disabled:g,children:a.jsx(o4,{})}),a.jsx(Vf,{onClick:P,className:"react-flow__controls-zoomout",title:v["controls.zoomOut.ariaLabel"],"aria-label":v["controls.zoomOut.ariaLabel"],disabled:S,children:a.jsx(a4,{})})]}),n&&a.jsx(Vf,{className:"react-flow__controls-fitview",onClick:O,title:v["controls.fitView.ariaLabel"],"aria-label":v["controls.fitView.ariaLabel"],children:a.jsx(l4,{})}),r&&a.jsx(Vf,{className:"react-flow__controls-interactive",onClick:F,title:v["controls.interactive.ariaLabel"],"aria-label":v["controls.interactive.ariaLabel"],children:b?a.jsx(u4,{}):a.jsx(c4,{})}),u]})}q_.displayName="Controls";const f4=m.memo(q_);function p4({id:e,x:t,y:n,width:r,height:i,style:s,color:o,strokeColor:l,strokeWidth:c,className:d,borderRadius:u,shapeRendering:p,selected:f,onClick:h}){const{background:y,backgroundColor:b}=s||{},S=o||y||b;return a.jsx("rect",{className:Sn(["react-flow__minimap-node",{selected:f},d]),x:t,y:n,rx:u,ry:u,width:r,height:i,style:{fill:S,stroke:l,strokeWidth:c},shapeRendering:p,onClick:h?g=>h(g,e):void 0})}const h4=m.memo(p4),m4=e=>e.nodes.map(t=>t.id),jg=e=>e instanceof Function?e:()=>e;function g4({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:s=h4,onClick:o}){const l=vt(m4,Yt),c=jg(t),d=jg(e),u=jg(n),p=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:l.map(f=>a.jsx(x4,{id:f,nodeColorFunc:c,nodeStrokeColorFunc:d,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:s,onClick:o,shapeRendering:p},f))})}function y4({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:s,shapeRendering:o,NodeComponent:l,onClick:c}){const{node:d,x:u,y:p,width:f,height:h}=vt(y=>{const b=y.nodeLookup.get(e);if(!b)return{node:void 0,x:0,y:0,width:0,height:0};const S=b.internals.userNode,{x:g,y:v}=b.internals.positionAbsolute,{width:w,height:k}=Zs(S);return{node:S,x:g,y:v,width:w,height:k}},Yt);return!d||d.hidden||!DE(d)?null:a.jsx(l,{x:u,y:p,width:f,height:h,style:d.style,selected:!!d.selected,className:r(d),color:t(d),borderRadius:i,strokeColor:n(d),strokeWidth:s,shapeRendering:o,onClick:c,id:d.id})}const x4=m.memo(y4);var w4=m.memo(g4);const v4=200,b4=150,k4=e=>!e.hidden,S4=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?FE(Ed(e.nodeLookup,{filter:k4}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},N4="react-flow__minimap-desc";function Y_({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:i="",nodeBorderRadius:s=5,nodeStrokeWidth:o,nodeComponent:l,bgColor:c,maskColor:d,maskStrokeColor:u,maskStrokeWidth:p,position:f="bottom-right",onClick:h,onNodeClick:y,pannable:b=!1,zoomable:S=!1,ariaLabel:g,inversePan:v,zoomStep:w=1,offsetScale:k=5}){const E=Bt(),j=m.useRef(null),{boundingRect:P,viewBB:O,rfId:F,panZoom:W,translateExtent:R,flowWidth:I,flowHeight:q,ariaLabelConfig:$}=vt(S4,Yt),H=(e==null?void 0:e.width)??v4,z=(e==null?void 0:e.height)??b4,Y=P.width/H,A=P.height/z,T=Math.max(Y,A),C=T*H,G=T*z,Q=k*T,M=P.x-(C-P.width)/2-Q,te=P.y-(G-P.height)/2-Q,ce=C+Q*2,le=G+Q*2,de=`${N4}-${F}`,ue=m.useRef(0),se=m.useRef();ue.current=T,m.useEffect(()=>{if(j.current&&W)return se.current=TD({domNode:j.current,panZoom:W,getTransform:()=>E.getState().transform,getViewScale:()=>ue.current}),()=>{var Se;(Se=se.current)==null||Se.destroy()}},[W]),m.useEffect(()=>{var Se;(Se=se.current)==null||Se.update({translateExtent:R,width:I,height:q,inversePan:v,pannable:b,zoomStep:w,zoomable:S})},[b,S,v,w,R,I,q]);const re=h?Se=>{var Ke;const[He,st]=((Ke=se.current)==null?void 0:Ke.pointer(Se))||[0,0];h(Se,{x:He,y:st})}:void 0,fe=y?m.useCallback((Se,He)=>{const st=E.getState().nodeLookup.get(He).internals.userNode;y(Se,st)},[]):void 0,ye=g??$["minimap.ariaLabel"];return a.jsx(sc,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof p=="number"?p*T: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 o=="number"?o:void 0},className:Sn(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:H,height:z,viewBox:`${M} ${te} ${ce} ${le}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":de,ref:j,onClick:re,children:[ye&&a.jsx("title",{id:de,children:ye}),a.jsx(w4,{onClick:fe,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:l}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${M-Q},${te-Q}h${ce+Q*2}v${le+Q*2}h${-ce-Q*2}z
66
- M${O.x},${O.y}h${O.width}v${O.height}h${-O.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Y_.displayName="MiniMap";const j4=m.memo(Y_),C4=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,E4={[rc.Line]:"right",[rc.Handle]:"bottom-right"};function _4({nodeId:e,position:t,variant:n=rc.Handle,className:r,style:i=void 0,children:s,color:o,minWidth:l=10,minHeight:c=10,maxWidth:d=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:p=!1,resizeDirection:f,autoScale:h=!0,shouldResize:y,onResizeStart:b,onResize:S,onResizeEnd:g}){const v=b_(),w=typeof e=="string"?e:v,k=Bt(),E=m.useRef(null),j=n===rc.Handle,P=vt(m.useCallback(C4(j&&h),[j,h]),Yt),O=m.useRef(null),F=t??E4[n];m.useEffect(()=>{if(!(!E.current||!w))return O.current||(O.current=KD({domNode:E.current,nodeId:w,getStoreItems:()=>{const{nodeLookup:R,transform:I,snapGrid:q,snapToGrid:$,nodeOrigin:H,domNode:z}=k.getState();return{nodeLookup:R,transform:I,snapGrid:q,snapToGrid:$,nodeOrigin:H,paneDomNode:z}},onChange:(R,I)=>{const{triggerNodeChanges:q,nodeLookup:$,parentLookup:H,nodeOrigin:z}=k.getState(),Y=[],A={x:R.x,y:R.y},T=$.get(w);if(T&&T.expandParent&&T.parentId){const C=T.origin??z,G=R.width??T.measured.width??0,Q=R.height??T.measured.height??0,M={id:T.id,parentId:T.parentId,rect:{width:G,height:Q,...zE({x:R.x??T.position.x,y:R.y??T.position.y},{width:G,height:Q},T.parentId,$,C)}},te=tv([M],$,H,z);Y.push(...te),A.x=R.x?Math.max(C[0]*G,R.x):void 0,A.y=R.y?Math.max(C[1]*Q,R.y):void 0}if(A.x!==void 0&&A.y!==void 0){const C={id:w,type:"position",position:{...A}};Y.push(C)}if(R.width!==void 0&&R.height!==void 0){const G={id:w,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:R.width,height:R.height}};Y.push(G)}for(const C of I){const G={...C,type:"position"};Y.push(G)}q(Y)},onEnd:({width:R,height:I})=>{const q={id:w,type:"dimensions",resizing:!1,dimensions:{width:R,height:I}};k.getState().triggerNodeChanges([q])}})),O.current.update({controlPosition:F,boundaries:{minWidth:l,minHeight:c,maxWidth:d,maxHeight:u},keepAspectRatio:p,resizeDirection:f,onResizeStart:b,onResize:S,onResizeEnd:g,shouldResize:y}),()=>{var R;(R=O.current)==null||R.destroy()}},[F,l,c,d,u,p,b,S,g,y]);const W=F.split("-");return a.jsx("div",{className:Sn(["react-flow__resize-control","nodrag",...W,n,r]),ref:E,style:{...i,scale:P,...o&&{[j?"backgroundColor":"borderColor"]:o}},children:s})}const P4=m.memo(_4);function I4(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const A4=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,T4=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,R4={};function Hk(e,t){return(R4.jsx?T4:A4).test(e)}const L4=/[ \t\n\f\r]/g;function O4(e){return typeof e=="object"?e.type==="text"?Uk(e.value):!1:Uk(e)}function Uk(e){return e.replace(L4,"")===""}let Id=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};Id.prototype.normal={};Id.prototype.property={};Id.prototype.space=void 0;function G_(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Id(n,r,t)}function yx(e){return e.toLowerCase()}class Hr{constructor(t,n){this.attribute=n,this.property=t}}Hr.prototype.attribute="";Hr.prototype.booleanish=!1;Hr.prototype.boolean=!1;Hr.prototype.commaOrSpaceSeparated=!1;Hr.prototype.commaSeparated=!1;Hr.prototype.defined=!1;Hr.prototype.mustUseProperty=!1;Hr.prototype.number=!1;Hr.prototype.overloadedBoolean=!1;Hr.prototype.property="";Hr.prototype.spaceSeparated=!1;Hr.prototype.space=void 0;let M4=0;const ct=Ha(),wn=Ha(),xx=Ha(),we=Ha(),Rt=Ha(),Bl=Ha(),Yr=Ha();function Ha(){return 2**++M4}const wx=Object.freeze(Object.defineProperty({__proto__:null,boolean:ct,booleanish:wn,commaOrSpaceSeparated:Yr,commaSeparated:Bl,number:we,overloadedBoolean:xx,spaceSeparated:Rt},Symbol.toStringTag,{value:"Module"})),Cg=Object.keys(wx);class sv extends Hr{constructor(t,n,r,i){let s=-1;if(super(t,n),Vk(this,"space",i),typeof r=="number")for(;++s<Cg.length;){const o=Cg[s];Vk(this,Cg[s],(r&wx[o])===wx[o])}}}sv.prototype.defined=!0;function Vk(e,t,n){n&&(e[t]=n)}function hc(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new sv(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[yx(r)]=r,n[yx(s.attribute)]=r}return new Id(t,n,e.space)}const X_=hc({properties:{ariaActiveDescendant:null,ariaAtomic:wn,ariaAutoComplete:null,ariaBusy:wn,ariaChecked:wn,ariaColCount:we,ariaColIndex:we,ariaColSpan:we,ariaControls:Rt,ariaCurrent:null,ariaDescribedBy:Rt,ariaDetails:null,ariaDisabled:wn,ariaDropEffect:Rt,ariaErrorMessage:null,ariaExpanded:wn,ariaFlowTo:Rt,ariaGrabbed:wn,ariaHasPopup:null,ariaHidden:wn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Rt,ariaLevel:we,ariaLive:null,ariaModal:wn,ariaMultiLine:wn,ariaMultiSelectable:wn,ariaOrientation:null,ariaOwns:Rt,ariaPlaceholder:null,ariaPosInSet:we,ariaPressed:wn,ariaReadOnly:wn,ariaRelevant:null,ariaRequired:wn,ariaRoleDescription:Rt,ariaRowCount:we,ariaRowIndex:we,ariaRowSpan:we,ariaSelected:wn,ariaSetSize:we,ariaSort:null,ariaValueMax:we,ariaValueMin:we,ariaValueNow:we,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function J_(e,t){return t in e?e[t]:t}function Q_(e,t){return J_(e,t.toLowerCase())}const $4=hc({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Bl,acceptCharset:Rt,accessKey:Rt,action:null,allow:null,allowFullScreen:ct,allowPaymentRequest:ct,allowUserMedia:ct,alt:null,as:null,async:ct,autoCapitalize:null,autoComplete:Rt,autoFocus:ct,autoPlay:ct,blocking:Rt,capture:null,charSet:null,checked:ct,cite:null,className:Rt,cols:we,colSpan:null,content:null,contentEditable:wn,controls:ct,controlsList:Rt,coords:we|Bl,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ct,defer:ct,dir:null,dirName:null,disabled:ct,download:xx,draggable:wn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ct,formTarget:null,headers:Rt,height:we,hidden:xx,high:we,href:null,hrefLang:null,htmlFor:Rt,httpEquiv:Rt,id:null,imageSizes:null,imageSrcSet:null,inert:ct,inputMode:null,integrity:null,is:null,isMap:ct,itemId:null,itemProp:Rt,itemRef:Rt,itemScope:ct,itemType:Rt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ct,low:we,manifest:null,max:null,maxLength:we,media:null,method:null,min:null,minLength:we,multiple:ct,muted:ct,name:null,nonce:null,noModule:ct,noValidate:ct,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:ct,optimum:we,pattern:null,ping:Rt,placeholder:null,playsInline:ct,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ct,referrerPolicy:null,rel:Rt,required:ct,reversed:ct,rows:we,rowSpan:we,sandbox:Rt,scope:null,scoped:ct,seamless:ct,selected:ct,shadowRootClonable:ct,shadowRootDelegatesFocus:ct,shadowRootMode:null,shape:null,size:we,sizes:null,slot:null,span:we,spellCheck:wn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:we,step:null,style:null,tabIndex:we,target:null,title:null,translate:null,type:null,typeMustMatch:ct,useMap:null,value:wn,width:we,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Rt,axis:null,background:null,bgColor:null,border:we,borderColor:null,bottomMargin:we,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ct,declare:ct,event:null,face:null,frame:null,frameBorder:null,hSpace:we,leftMargin:we,link:null,longDesc:null,lowSrc:null,marginHeight:we,marginWidth:we,noResize:ct,noHref:ct,noShade:ct,noWrap:ct,object:null,profile:null,prompt:null,rev:null,rightMargin:we,rules:null,scheme:null,scrolling:wn,standby:null,summary:null,text:null,topMargin:we,valueType:null,version:null,vAlign:null,vLink:null,vSpace:we,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ct,disableRemotePlayback:ct,prefix:null,property:null,results:we,security:null,unselectable:null},space:"html",transform:Q_}),F4=hc({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:Yr,accentHeight:we,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:we,amplitude:we,arabicForm:null,ascent:we,attributeName:null,attributeType:null,azimuth:we,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:we,by:null,calcMode:null,capHeight:we,className:Rt,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:we,diffuseConstant:we,direction:null,display:null,dur:null,divisor:we,dominantBaseline:null,download:ct,dx:null,dy:null,edgeMode:null,editable:null,elevation:we,enableBackground:null,end:null,event:null,exponent:we,externalResourcesRequired:null,fill:null,fillOpacity:we,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:Bl,g2:Bl,glyphName:Bl,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:we,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:we,horizOriginX:we,horizOriginY:we,id:null,ideographic:we,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:we,k:we,k1:we,k2:we,k3:we,k4:we,kernelMatrix:Yr,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:we,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:we,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:we,overlineThickness:we,paintOrder:null,panose1:null,path:null,pathLength:we,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Rt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:we,pointsAtY:we,pointsAtZ:we,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Yr,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Yr,rev:Yr,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Yr,requiredFeatures:Yr,requiredFonts:Yr,requiredFormats:Yr,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:we,specularExponent:we,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:we,strikethroughThickness:we,string:null,stroke:null,strokeDashArray:Yr,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:we,strokeOpacity:we,strokeWidth:null,style:null,surfaceScale:we,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Yr,tabIndex:we,tableValues:null,target:null,targetX:we,targetY:we,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Yr,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:we,underlineThickness:we,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:we,values:null,vAlphabetic:we,vMathematical:we,vectorEffect:null,vHanging:we,vIdeographic:we,version:null,vertAdvY:we,vertOriginX:we,vertOriginY:we,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:we,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:J_}),Z_=hc({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()}}),eP=hc({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Q_}),tP=hc({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),D4={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"},z4=/[A-Z]/g,Wk=/-[a-z]/g,B4=/^data[-\w.:]+$/i;function H4(e,t){const n=yx(t);let r=t,i=Hr;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&B4.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(Wk,V4);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!Wk.test(s)){let o=s.replace(z4,U4);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=sv}return new i(r,t)}function U4(e){return"-"+e.toLowerCase()}function V4(e){return e.charAt(1).toUpperCase()}const W4=G_([X_,$4,Z_,eP,tP],"html"),ov=G_([X_,F4,Z_,eP,tP],"svg");function K4(e){return e.join(" ").trim()}var av={},Kk=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,q4=/\n/g,Y4=/^\s*/,G4=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,X4=/^:\s*/,J4=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,Q4=/^[;\s]*/,Z4=/^\s+|\s+$/g,eB=`
67
- `,qk="/",Yk="*",ya="",tB="comment",nB="declaration";function rB(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 i(y){var b=y.match(q4);b&&(n+=b.length);var S=y.lastIndexOf(eB);r=~S?y.length-S:r+y.length}function s(){var y={line:n,column:r};return function(b){return b.position=new o(y),d(),b}}function o(y){this.start=y,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function l(y){var b=new Error(t.source+":"+n+":"+r+": "+y);if(b.reason=y,b.filename=t.source,b.line=n,b.column=r,b.source=e,!t.silent)throw b}function c(y){var b=y.exec(e);if(b){var S=b[0];return i(S),e=e.slice(S.length),b}}function d(){c(Y4)}function u(y){var b;for(y=y||[];b=p();)b!==!1&&y.push(b);return y}function p(){var y=s();if(!(qk!=e.charAt(0)||Yk!=e.charAt(1))){for(var b=2;ya!=e.charAt(b)&&(Yk!=e.charAt(b)||qk!=e.charAt(b+1));)++b;if(b+=2,ya===e.charAt(b-1))return l("End of comment missing");var S=e.slice(2,b-2);return r+=2,i(S),e=e.slice(b),r+=2,y({type:tB,comment:S})}}function f(){var y=s(),b=c(G4);if(b){if(p(),!c(X4))return l("property missing ':'");var S=c(J4),g=y({type:nB,property:Gk(b[0].replace(Kk,ya)),value:S?Gk(S[0].replace(Kk,ya)):ya});return c(Q4),g}}function h(){var y=[];u(y);for(var b;b=f();)b!==!1&&(y.push(b),u(y));return y}return d(),h()}function Gk(e){return e?e.replace(Z4,ya):ya}var iB=rB,sB=Tu&&Tu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(av,"__esModule",{value:!0});av.default=aB;const oB=sB(iB);function aB(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,oB.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:l}=s;i?t(o,l,s):l&&(n=n||{},n[o]=l)}),n}var im={};Object.defineProperty(im,"__esModule",{value:!0});im.camelCase=void 0;var lB=/^--[a-zA-Z0-9_-]+$/,cB=/-([a-z])/g,uB=/^[^-]+$/,dB=/^-(webkit|moz|ms|o|khtml)-/,fB=/^-(ms)-/,pB=function(e){return!e||uB.test(e)||lB.test(e)},hB=function(e,t){return t.toUpperCase()},Xk=function(e,t){return"".concat(t,"-")},mB=function(e,t){return t===void 0&&(t={}),pB(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(fB,Xk):e=e.replace(dB,Xk),e.replace(cB,hB))};im.camelCase=mB;var gB=Tu&&Tu.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},yB=gB(av),xB=im;function vx(e,t){var n={};return!e||typeof e!="string"||(0,yB.default)(e,function(r,i){r&&i&&(n[(0,xB.camelCase)(r,t)]=i)}),n}vx.default=vx;var wB=vx;const vB=Ko(wB),nP=rP("end"),lv=rP("start");function rP(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 bB(e){const t=lv(e),n=nP(e);if(t&&n)return{start:t,end:n}}function Eu(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?Jk(e.position):"start"in e||"end"in e?Jk(e):"line"in e||"column"in e?bx(e):""}function bx(e){return Qk(e&&e.line)+":"+Qk(e&&e.column)}function Jk(e){return bx(e&&e.start)+"-"+bx(e&&e.end)}function Qk(e){return e&&typeof e=="number"?e:1}class ur extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?s.ruleId=r:(s.source=r.slice(0,c),s.ruleId=r.slice(c+1))}if(!s.place&&s.ancestors&&s.ancestors){const c=s.ancestors[s.ancestors.length-1];c&&(s.place=c.position)}const l=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=l?l.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=l?l.line:void 0,this.name=Eu(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}ur.prototype.file="";ur.prototype.name="";ur.prototype.reason="";ur.prototype.message="";ur.prototype.stack="";ur.prototype.column=void 0;ur.prototype.line=void 0;ur.prototype.ancestors=void 0;ur.prototype.cause=void 0;ur.prototype.fatal=void 0;ur.prototype.place=void 0;ur.prototype.ruleId=void 0;ur.prototype.source=void 0;const cv={}.hasOwnProperty,kB=new Map,SB=/[A-Z]/g,NB=new Set(["table","tbody","thead","tfoot","tr"]),jB=new Set(["td","th"]),iP="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function CB(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=LB(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=RB(n,t.jsx,t.jsxs)}const i={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"?ov:W4,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=sP(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function sP(e,t,n){if(t.type==="element")return EB(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return _B(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return IB(e,t,n);if(t.type==="mdxjsEsm")return PB(e,t);if(t.type==="root")return AB(e,t,n);if(t.type==="text")return TB(e,t)}function EB(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=ov,e.schema=i),e.ancestors.push(t);const s=aP(e,t.tagName,!1),o=OB(e,t);let l=dv(e,t);return NB.has(t.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!O4(c):!0})),oP(e,o,s,t),uv(o,l),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function _B(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)}od(e,t.position)}function PB(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);od(e,t.position)}function IB(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=ov,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:aP(e,t.name,!0),o=MB(e,t),l=dv(e,t);return oP(e,o,s,t),uv(o,l),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function AB(e,t,n){const r={};return uv(r,dv(e,t)),e.create(t,e.Fragment,r,n)}function TB(e,t){return t.value}function oP(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function uv(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function RB(e,t,n){return r;function r(i,s,o,l){const d=Array.isArray(o.children)?n:t;return l?d(s,o,l):d(s,o)}}function LB(e,t){return n;function n(r,i,s,o){const l=Array.isArray(s.children),c=lv(r);return t(i,s,o,l,{columnNumber:c?c.column-1:void 0,fileName:e,lineNumber:c?c.line:void 0},void 0)}}function OB(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&cv.call(t.properties,i)){const s=$B(e,i,t.properties[i]);if(s){const[o,l]=s;e.tableCellAlignToStyle&&o==="align"&&typeof l=="string"&&jB.has(t.tagName)?r=l:n[o]=l}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function MB(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const l=o.properties[0];l.type,Object.assign(n,e.evaluater.evaluateExpression(l.argument))}else od(e,t.position);else{const i=r.name;let s;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,s=e.evaluater.evaluateExpression(l.expression)}else od(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function dv(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:kB;for(;++r<t.children.length;){const s=t.children[r];let o;if(e.passKeys){const c=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(c){const d=i.get(c)||0;o=c+"-"+d,i.set(c,d+1)}}const l=sP(e,s,o);l!==void 0&&n.push(l)}return n}function $B(e,t,n){const r=H4(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?I4(n):K4(n)),r.property==="style"){let i=typeof n=="object"?n:FB(e,String(n));return e.stylePropertyNameCase==="css"&&(i=DB(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?D4[r.property]||r.property:r.attribute,n]}}function FB(e,t){try{return vB(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new ur("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=iP+"#cannot-parse-style-attribute",i}}function aP(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const l=Hk(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:l,computed:!!(s&&l.type==="Literal"),optional:!1}:l}r=o}else r=Hk(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return cv.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);od(e)}function od(e,t){const n=new ur("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=iP+"#cannot-handle-mdx-estrees-without-createevaluater",n}function DB(e){const t={};let n;for(n in e)cv.call(e,n)&&(t[zB(n)]=e[n]);return t}function zB(e){let t=e.replace(SB,BB);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function BB(e){return"-"+e.toLowerCase()}const Eg={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"]},HB={};function UB(e,t){const n=HB,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return lP(e,r,i)}function lP(e,t,n){if(VB(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 Zk(e.children,t,n)}return Array.isArray(e)?Zk(e,t,n):""}function Zk(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=lP(e[i],t,n);return r.join("")}function VB(e){return!!(e&&typeof e=="object")}const eS=document.createElement("i");function fv(e){const t="&"+e+";";eS.innerHTML=t;const n=eS.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Ss(e,t,n,r){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function pi(e,t){return e.length>0?(Ss(e,e.length,0,t),e):t}const tS={}.hasOwnProperty;function WB(e){const t={};let n=-1;for(;++n<e.length;)KB(t,e[n]);return t}function KB(e,t){let n;for(n in t){const i=(tS.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){tS.call(i,o)||(i[o]=[]);const l=s[o];qB(i[o],Array.isArray(l)?l:l?[l]:[])}}}function qB(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Ss(e,0,0,r)}function cP(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 Hl(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const hs=Xo(/[A-Za-z]/),Zr=Xo(/[\dA-Za-z]/),YB=Xo(/[#-'*+\--9=?A-Z^-~]/);function kx(e){return e!==null&&(e<32||e===127)}const Sx=Xo(/\d/),GB=Xo(/[\dA-Fa-f]/),XB=Xo(/[!-/:-@[-`{-~]/);function et(e){return e!==null&&e<-2}function Br(e){return e!==null&&(e<0||e===32)}function Ct(e){return e===-2||e===-1||e===32}const JB=Xo(new RegExp("\\p{P}|\\p{S}","u")),QB=Xo(/\s/);function Xo(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function mc(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(s===37&&Zr(e.charCodeAt(n+1))&&Zr(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const l=e.charCodeAt(n+1);s<56320&&l>56319&&l<57344?(o=String.fromCharCode(s,l),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Ot(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(c){return Ct(c)?(e.enter(n),l(c)):t(c)}function l(c){return Ct(c)&&s++<i?(e.consume(c),l):(e.exit(n),t(c))}}const ZB={tokenize:e5};function e5(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(l){if(l===null){e.consume(l);return}return e.enter("lineEnding"),e.consume(l),e.exit("lineEnding"),Ot(e,t,"linePrefix")}function i(l){return e.enter("paragraph"),s(l)}function s(l){const c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,o(l)}function o(l){if(l===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(l);return}return et(l)?(e.consume(l),e.exit("chunkText"),s):(e.consume(l),o)}}const t5={tokenize:n5},nS={tokenize:r5};function n5(e){const t=this,n=[];let r=0,i,s,o;return l;function l(w){if(r<n.length){const k=n[r];return t.containerState=k[1],e.attempt(k[0].continuation,c,d)(w)}return d(w)}function c(w){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();const k=t.events.length;let E=k,j;for(;E--;)if(t.events[E][0]==="exit"&&t.events[E][1].type==="chunkFlow"){j=t.events[E][1].end;break}g(r);let P=k;for(;P<t.events.length;)t.events[P][1].end={...j},P++;return Ss(t.events,E+1,0,t.events.slice(k)),t.events.length=P,d(w)}return l(w)}function d(w){if(r===n.length){if(!i)return f(w);if(i.currentConstruct&&i.currentConstruct.concrete)return y(w);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(nS,u,p)(w)}function u(w){return i&&v(),g(r),f(w)}function p(w){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,y(w)}function f(w){return t.containerState={},e.attempt(nS,h,y)(w)}function h(w){return r++,n.push([t.currentConstruct,t.containerState]),f(w)}function y(w){if(w===null){i&&v(),g(0),e.consume(w);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),b(w)}function b(w){if(w===null){S(e.exit("chunkFlow"),!0),g(0),e.consume(w);return}return et(w)?(e.consume(w),S(e.exit("chunkFlow")),r=0,t.interrupt=void 0,l):(e.consume(w),b)}function S(w,k){const E=t.sliceStream(w);if(k&&E.push(null),w.previous=s,s&&(s.next=w),s=w,i.defineSkip(w.start),i.write(E),t.parser.lazy[w.start.line]){let j=i.events.length;for(;j--;)if(i.events[j][1].start.offset<o&&(!i.events[j][1].end||i.events[j][1].end.offset>o))return;const P=t.events.length;let O=P,F,W;for(;O--;)if(t.events[O][0]==="exit"&&t.events[O][1].type==="chunkFlow"){if(F){W=t.events[O][1].end;break}F=!0}for(g(r),j=P;j<t.events.length;)t.events[j][1].end={...W},j++;Ss(t.events,O+1,0,t.events.slice(P)),t.events.length=j}}function g(w){let k=n.length;for(;k-- >w;){const E=n[k];t.containerState=E[1],E[0].exit.call(t,e)}n.length=w}function v(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function r5(e,t,n){return Ot(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function rS(e){if(e===null||Br(e)||QB(e))return 1;if(JB(e))return 2}function pv(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const Nx={name:"attention",resolveAll:i5,tokenize:s5};function i5(e,t){let n=-1,r,i,s,o,l,c,d,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const p={...e[r][1].end},f={...e[n][1].start};iS(p,-c),iS(f,c),o={type:c>1?"strongSequence":"emphasisSequence",start:p,end:{...e[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},s={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:c>1?"strong":"emphasis",start:{...o.start},end:{...l.end}},e[r][1].end={...o.start},e[n][1].start={...l.end},d=[],e[r][1].end.offset-e[r][1].start.offset&&(d=pi(d,[["enter",e[r][1],t],["exit",e[r][1],t]])),d=pi(d,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),d=pi(d,pv(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),d=pi(d,[["exit",s,t],["enter",l,t],["exit",l,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,d=pi(d,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,Ss(e,r-1,n-r+3,d),n=r+d.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function s5(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=rS(r);let s;return o;function o(c){return s=c,e.enter("attentionSequence"),l(c)}function l(c){if(c===s)return e.consume(c),l;const d=e.exit("attentionSequence"),u=rS(c),p=!u||u===2&&i||n.includes(c),f=!i||i===2&&u||n.includes(r);return d._open=!!(s===42?p:p&&(i||!f)),d._close=!!(s===42?f:f&&(u||!p)),t(c)}}function iS(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const o5={name:"autolink",tokenize:a5};function a5(e,t,n){let r=0;return i;function i(h){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(h),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(h){return hs(h)?(e.consume(h),o):h===64?n(h):d(h)}function o(h){return h===43||h===45||h===46||Zr(h)?(r=1,l(h)):d(h)}function l(h){return h===58?(e.consume(h),r=0,c):(h===43||h===45||h===46||Zr(h))&&r++<32?(e.consume(h),l):(r=0,d(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 d(h){return h===64?(e.consume(h),u):YB(h)?(e.consume(h),d):n(h)}function u(h){return Zr(h)?p(h):n(h)}function p(h){return h===46?(e.consume(h),r=0,u):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||Zr(h))&&r++<63){const y=h===45?f:p;return e.consume(h),y}return n(h)}}const sm={partial:!0,tokenize:l5};function l5(e,t,n){return r;function r(s){return Ct(s)?Ot(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||et(s)?t(s):n(s)}}const uP={continuation:{tokenize:u5},exit:d5,name:"blockQuote",tokenize:c5};function c5(e,t,n){const r=this;return i;function i(o){if(o===62){const l=r.containerState;return l.open||(e.enter("blockQuote",{_container:!0}),l.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return n(o)}function s(o){return Ct(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function u5(e,t,n){const r=this;return i;function i(o){return Ct(o)?Ot(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(uP,t,n)(o)}}function d5(e){e.exit("blockQuote")}const dP={name:"characterEscape",tokenize:f5};function f5(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return XB(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const fP={name:"characterReference",tokenize:p5};function p5(e,t,n){const r=this;let i=0,s,o;return l;function l(p){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),c}function c(p){return p===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(p),e.exit("characterReferenceMarkerNumeric"),d):(e.enter("characterReferenceValue"),s=31,o=Zr,u(p))}function d(p){return p===88||p===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(p),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=GB,u):(e.enter("characterReferenceValue"),s=7,o=Sx,u(p))}function u(p){if(p===59&&i){const f=e.exit("characterReferenceValue");return o===Zr&&!fv(r.sliceSerialize(f))?n(p):(e.enter("characterReferenceMarker"),e.consume(p),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(p)&&i++<s?(e.consume(p),u):n(p)}}const sS={partial:!0,tokenize:m5},oS={concrete:!0,name:"codeFenced",tokenize:h5};function h5(e,t,n){const r=this,i={partial:!0,tokenize:E};let s=0,o=0,l;return c;function c(j){return d(j)}function d(j){const P=r.events[r.events.length-1];return s=P&&P[1].type==="linePrefix"?P[2].sliceSerialize(P[1],!0).length:0,l=j,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(j)}function u(j){return j===l?(o++,e.consume(j),u):o<3?n(j):(e.exit("codeFencedFenceSequence"),Ct(j)?Ot(e,p,"whitespace")(j):p(j))}function p(j){return j===null||et(j)?(e.exit("codeFencedFence"),r.interrupt?t(j):e.check(sS,b,k)(j)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(j))}function f(j){return j===null||et(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),p(j)):Ct(j)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ot(e,h,"whitespace")(j)):j===96&&j===l?n(j):(e.consume(j),f)}function h(j){return j===null||et(j)?p(j):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),y(j))}function y(j){return j===null||et(j)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),p(j)):j===96&&j===l?n(j):(e.consume(j),y)}function b(j){return e.attempt(i,k,S)(j)}function S(j){return e.enter("lineEnding"),e.consume(j),e.exit("lineEnding"),g}function g(j){return s>0&&Ct(j)?Ot(e,v,"linePrefix",s+1)(j):v(j)}function v(j){return j===null||et(j)?e.check(sS,b,k)(j):(e.enter("codeFlowValue"),w(j))}function w(j){return j===null||et(j)?(e.exit("codeFlowValue"),v(j)):(e.consume(j),w)}function k(j){return e.exit("codeFenced"),t(j)}function E(j,P,O){let F=0;return W;function W(H){return j.enter("lineEnding"),j.consume(H),j.exit("lineEnding"),R}function R(H){return j.enter("codeFencedFence"),Ct(H)?Ot(j,I,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):I(H)}function I(H){return H===l?(j.enter("codeFencedFenceSequence"),q(H)):O(H)}function q(H){return H===l?(F++,j.consume(H),q):F>=o?(j.exit("codeFencedFenceSequence"),Ct(H)?Ot(j,$,"whitespace")(H):$(H)):O(H)}function $(H){return H===null||et(H)?(j.exit("codeFencedFence"),P(H)):O(H)}}}function m5(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const _g={name:"codeIndented",tokenize:y5},g5={partial:!0,tokenize:x5};function y5(e,t,n){const r=this;return i;function i(d){return e.enter("codeIndented"),Ot(e,s,"linePrefix",5)(d)}function s(d){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(d):n(d)}function o(d){return d===null?c(d):et(d)?e.attempt(g5,o,c)(d):(e.enter("codeFlowValue"),l(d))}function l(d){return d===null||et(d)?(e.exit("codeFlowValue"),o(d)):(e.consume(d),l)}function c(d){return e.exit("codeIndented"),t(d)}}function x5(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):et(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Ot(e,s,"linePrefix",5)(o)}function s(o){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?t(o):et(o)?i(o):n(o)}}const w5={name:"codeText",previous:b5,resolve:v5,tokenize:k5};function v5(e){let t=e.length-4,n=3,r,i;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;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function b5(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function k5(e,t,n){let r=0,i,s;return o;function o(p){return e.enter("codeText"),e.enter("codeTextSequence"),l(p)}function l(p){return p===96?(e.consume(p),r++,l):(e.exit("codeTextSequence"),c(p))}function c(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),c):p===96?(s=e.enter("codeTextSequence"),i=0,u(p)):et(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),c):(e.enter("codeTextData"),d(p))}function d(p){return p===null||p===32||p===96||et(p)?(e.exit("codeTextData"),c(p)):(e.consume(p),d)}function u(p){return p===96?(e.consume(p),i++,u):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(s.type="codeTextData",d(p))}}class S5{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 i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Qc(this.left,r),s.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),Qc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Qc(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);Qc(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Qc(this.left,n.reverse())}}}function Qc(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 pP(e){const t={};let n=-1,r,i,s,o,l,c,d;const u=new S5(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,s=0,s<c.length&&c[s][1].type==="lineEndingBlank"&&(s+=2),s<c.length&&c[s][1].type==="content"))for(;++s<c.length&&c[s][1].type!=="content";)c[s][1].type==="chunkText"&&(c[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,N5(u,n)),n=t[n],d=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=u.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},l=u.slice(i,n),l.unshift(r),u.splice(i,n-i+1,l))}}return Ss(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!d}function N5(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const l=o.events,c=[],d={};let u,p,f=-1,h=n,y=0,b=0;const S=[b];for(;h;){for(;e.get(++i)[1]!==h;);s.push(i),h._tokenizer||(u=r.sliceStream(h),h.next||u.push(null),p&&o.defineSkip(h.start),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),p=h,h=h.next}for(h=n;++f<l.length;)l[f][0]==="exit"&&l[f-1][0]==="enter"&&l[f][1].type===l[f-1][1].type&&l[f][1].start.line!==l[f][1].end.line&&(b=f+1,S.push(b),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(o.events=[],h?(h._tokenizer=void 0,h.previous=void 0):S.pop(),f=S.length;f--;){const g=l.slice(S[f],S[f+1]),v=s.pop();c.push([v,v+g.length-1]),e.splice(v,2,g)}for(c.reverse(),f=-1;++f<c.length;)d[y+c[f][0]]=y+c[f][1],y+=c[f][1]-c[f][0]-1;return d}const j5={resolve:E5,tokenize:_5},C5={partial:!0,tokenize:P5};function E5(e){return pP(e),e}function _5(e,t){let n;return r;function r(l){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(l)}function i(l){return l===null?s(l):et(l)?e.check(C5,o,s)(l):(e.consume(l),i)}function s(l){return e.exit("chunkContent"),e.exit("content"),t(l)}function o(l){return e.consume(l),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function P5(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ot(e,s,"linePrefix")}function s(o){if(o===null||et(o))return n(o);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(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function hP(e,t,n,r,i,s,o,l,c){const d=c||Number.POSITIVE_INFINITY;let u=0;return p;function p(g){return g===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(g),e.exit(s),f):g===null||g===32||g===41||kx(g)?n(g):(e.enter(r),e.enter(o),e.enter(l),e.enter("chunkString",{contentType:"string"}),b(g))}function f(g){return g===62?(e.enter(s),e.consume(g),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(l),e.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===62?(e.exit("chunkString"),e.exit(l),f(g)):g===null||g===60||et(g)?n(g):(e.consume(g),g===92?y:h)}function y(g){return g===60||g===62||g===92?(e.consume(g),h):h(g)}function b(g){return!u&&(g===null||g===41||Br(g))?(e.exit("chunkString"),e.exit(l),e.exit(o),e.exit(r),t(g)):u<d&&g===40?(e.consume(g),u++,b):g===41?(e.consume(g),u--,b):g===null||g===32||g===40||kx(g)?n(g):(e.consume(g),g===92?S:b)}function S(g){return g===40||g===41||g===92?(e.consume(g),b):b(g)}}function mP(e,t,n,r,i,s){const o=this;let l=0,c;return d;function d(h){return e.enter(r),e.enter(i),e.consume(h),e.exit(i),e.enter(s),u}function u(h){return l>999||h===null||h===91||h===93&&!c||h===94&&!l&&"_hiddenFootnoteSupport"in o.parser.constructs?n(h):h===93?(e.exit(s),e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):et(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),p(h))}function p(h){return h===null||h===91||h===93||et(h)||l++>999?(e.exit("chunkString"),u(h)):(e.consume(h),c||(c=!Ct(h)),h===92?f:p)}function f(h){return h===91||h===92||h===93?(e.consume(h),l++,p):p(h)}}function gP(e,t,n,r,i,s){let o;return l;function l(f){return f===34||f===39||f===40?(e.enter(r),e.enter(i),e.consume(f),e.exit(i),o=f===40?41:f,c):n(f)}function c(f){return f===o?(e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):(e.enter(s),d(f))}function d(f){return f===o?(e.exit(s),c(o)):f===null?n(f):et(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Ot(e,d,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===o||f===null||et(f)?(e.exit("chunkString"),d(f)):(e.consume(f),f===92?p:u)}function p(f){return f===o||f===92?(e.consume(f),u):u(f)}}function _u(e,t){let n;return r;function r(i){return et(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Ct(i)?Ot(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const I5={name:"definition",tokenize:T5},A5={partial:!0,tokenize:R5};function T5(e,t,n){const r=this;let i;return s;function s(h){return e.enter("definition"),o(h)}function o(h){return mP.call(r,e,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function l(h){return i=Hl(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 Br(h)?_u(e,d)(h):d(h)}function d(h){return hP(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function u(h){return e.attempt(A5,p,p)(h)}function p(h){return Ct(h)?Ot(e,f,"whitespace")(h):f(h)}function f(h){return h===null||et(h)?(e.exit("definition"),r.parser.defined.push(i),t(h)):n(h)}}function R5(e,t,n){return r;function r(l){return Br(l)?_u(e,i)(l):n(l)}function i(l){return gP(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function s(l){return Ct(l)?Ot(e,o,"whitespace")(l):o(l)}function o(l){return l===null||et(l)?t(l):n(l)}}const L5={name:"hardBreakEscape",tokenize:O5};function O5(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return et(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const M5={name:"headingAtx",resolve:$5,tokenize:F5};function $5(e,t){let n=e.length-2,r=3,i,s;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&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Ss(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function F5(e,t,n){let r=0;return i;function i(u){return e.enter("atxHeading"),s(u)}function s(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(e.consume(u),o):u===null||Br(u)?(e.exit("atxHeadingSequence"),l(u)):n(u)}function l(u){return u===35?(e.enter("atxHeadingSequence"),c(u)):u===null||et(u)?(e.exit("atxHeading"),t(u)):Ct(u)?Ot(e,l,"whitespace")(u):(e.enter("atxHeadingText"),d(u))}function c(u){return u===35?(e.consume(u),c):(e.exit("atxHeadingSequence"),l(u))}function d(u){return u===null||u===35||Br(u)?(e.exit("atxHeadingText"),l(u)):(e.consume(u),d)}}const D5=["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"],aS=["pre","script","style","textarea"],z5={concrete:!0,name:"htmlFlow",resolveTo:U5,tokenize:V5},B5={partial:!0,tokenize:K5},H5={partial:!0,tokenize:W5};function U5(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 V5(e,t,n){const r=this;let i,s,o,l,c;return d;function d(M){return u(M)}function u(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),p}function p(M){return M===33?(e.consume(M),f):M===47?(e.consume(M),s=!0,b):M===63?(e.consume(M),i=3,r.interrupt?t:C):hs(M)?(e.consume(M),o=String.fromCharCode(M),S):n(M)}function f(M){return M===45?(e.consume(M),i=2,h):M===91?(e.consume(M),i=5,l=0,y):hs(M)?(e.consume(M),i=4,r.interrupt?t:C):n(M)}function h(M){return M===45?(e.consume(M),r.interrupt?t:C):n(M)}function y(M){const te="CDATA[";return M===te.charCodeAt(l++)?(e.consume(M),l===te.length?r.interrupt?t:I:y):n(M)}function b(M){return hs(M)?(e.consume(M),o=String.fromCharCode(M),S):n(M)}function S(M){if(M===null||M===47||M===62||Br(M)){const te=M===47,ce=o.toLowerCase();return!te&&!s&&aS.includes(ce)?(i=1,r.interrupt?t(M):I(M)):D5.includes(o.toLowerCase())?(i=6,te?(e.consume(M),g):r.interrupt?t(M):I(M)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(M):s?v(M):w(M))}return M===45||Zr(M)?(e.consume(M),o+=String.fromCharCode(M),S):n(M)}function g(M){return M===62?(e.consume(M),r.interrupt?t:I):n(M)}function v(M){return Ct(M)?(e.consume(M),v):W(M)}function w(M){return M===47?(e.consume(M),W):M===58||M===95||hs(M)?(e.consume(M),k):Ct(M)?(e.consume(M),w):W(M)}function k(M){return M===45||M===46||M===58||M===95||Zr(M)?(e.consume(M),k):E(M)}function E(M){return M===61?(e.consume(M),j):Ct(M)?(e.consume(M),E):w(M)}function j(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),c=M,P):Ct(M)?(e.consume(M),j):O(M)}function P(M){return M===c?(e.consume(M),c=null,F):M===null||et(M)?n(M):(e.consume(M),P)}function O(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||Br(M)?E(M):(e.consume(M),O)}function F(M){return M===47||M===62||Ct(M)?w(M):n(M)}function W(M){return M===62?(e.consume(M),R):n(M)}function R(M){return M===null||et(M)?I(M):Ct(M)?(e.consume(M),R):n(M)}function I(M){return M===45&&i===2?(e.consume(M),z):M===60&&i===1?(e.consume(M),Y):M===62&&i===4?(e.consume(M),G):M===63&&i===3?(e.consume(M),C):M===93&&i===5?(e.consume(M),T):et(M)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(B5,Q,q)(M)):M===null||et(M)?(e.exit("htmlFlowData"),q(M)):(e.consume(M),I)}function q(M){return e.check(H5,$,Q)(M)}function $(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),H}function H(M){return M===null||et(M)?q(M):(e.enter("htmlFlowData"),I(M))}function z(M){return M===45?(e.consume(M),C):I(M)}function Y(M){return M===47?(e.consume(M),o="",A):I(M)}function A(M){if(M===62){const te=o.toLowerCase();return aS.includes(te)?(e.consume(M),G):I(M)}return hs(M)&&o.length<8?(e.consume(M),o+=String.fromCharCode(M),A):I(M)}function T(M){return M===93?(e.consume(M),C):I(M)}function C(M){return M===62?(e.consume(M),G):M===45&&i===2?(e.consume(M),C):I(M)}function G(M){return M===null||et(M)?(e.exit("htmlFlowData"),Q(M)):(e.consume(M),G)}function Q(M){return e.exit("htmlFlow"),t(M)}}function W5(e,t,n){const r=this;return i;function i(o){return et(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function K5(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(sm,t,n)}}const q5={name:"htmlText",tokenize:Y5};function Y5(e,t,n){const r=this;let i,s,o;return l;function l(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),c}function c(C){return C===33?(e.consume(C),d):C===47?(e.consume(C),E):C===63?(e.consume(C),w):hs(C)?(e.consume(C),O):n(C)}function d(C){return C===45?(e.consume(C),u):C===91?(e.consume(C),s=0,y):hs(C)?(e.consume(C),v):n(C)}function u(C){return C===45?(e.consume(C),h):n(C)}function p(C){return C===null?n(C):C===45?(e.consume(C),f):et(C)?(o=p,Y(C)):(e.consume(C),p)}function f(C){return C===45?(e.consume(C),h):p(C)}function h(C){return C===62?z(C):C===45?f(C):p(C)}function y(C){const G="CDATA[";return C===G.charCodeAt(s++)?(e.consume(C),s===G.length?b:y):n(C)}function b(C){return C===null?n(C):C===93?(e.consume(C),S):et(C)?(o=b,Y(C)):(e.consume(C),b)}function S(C){return C===93?(e.consume(C),g):b(C)}function g(C){return C===62?z(C):C===93?(e.consume(C),g):b(C)}function v(C){return C===null||C===62?z(C):et(C)?(o=v,Y(C)):(e.consume(C),v)}function w(C){return C===null?n(C):C===63?(e.consume(C),k):et(C)?(o=w,Y(C)):(e.consume(C),w)}function k(C){return C===62?z(C):w(C)}function E(C){return hs(C)?(e.consume(C),j):n(C)}function j(C){return C===45||Zr(C)?(e.consume(C),j):P(C)}function P(C){return et(C)?(o=P,Y(C)):Ct(C)?(e.consume(C),P):z(C)}function O(C){return C===45||Zr(C)?(e.consume(C),O):C===47||C===62||Br(C)?F(C):n(C)}function F(C){return C===47?(e.consume(C),z):C===58||C===95||hs(C)?(e.consume(C),W):et(C)?(o=F,Y(C)):Ct(C)?(e.consume(C),F):z(C)}function W(C){return C===45||C===46||C===58||C===95||Zr(C)?(e.consume(C),W):R(C)}function R(C){return C===61?(e.consume(C),I):et(C)?(o=R,Y(C)):Ct(C)?(e.consume(C),R):F(C)}function I(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),i=C,q):et(C)?(o=I,Y(C)):Ct(C)?(e.consume(C),I):(e.consume(C),$)}function q(C){return C===i?(e.consume(C),i=void 0,H):C===null?n(C):et(C)?(o=q,Y(C)):(e.consume(C),q)}function $(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||Br(C)?F(C):(e.consume(C),$)}function H(C){return C===47||C===62||Br(C)?F(C):n(C)}function z(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function Y(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),A}function A(C){return Ct(C)?Ot(e,T,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):T(C)}function T(C){return e.enter("htmlTextData"),o(C)}}const hv={name:"labelEnd",resolveAll:Q5,resolveTo:Z5,tokenize:eH},G5={tokenize:tH},X5={tokenize:nH},J5={tokenize:rH};function Q5(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 i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&Ss(e,0,e.length,n),e}function Z5(e,t){let n=e.length,r=0,i,s,o,l;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const c={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},d={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[o-2][1].start}};return l=[["enter",c,t],["enter",d,t]],l=pi(l,e.slice(s+1,s+r+3)),l=pi(l,[["enter",u,t]]),l=pi(l,pv(t.parser.constructs.insideSpan.null,e.slice(s+r+4,o-3),t)),l=pi(l,[["exit",u,t],e[o-2],e[o-1],["exit",d,t]]),l=pi(l,e.slice(o+1)),l=pi(l,[["exit",c,t]]),Ss(e,s,e.length,l),e}function eH(e,t,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return l;function l(f){return s?s._inactive?p(f):(o=r.parser.defined.includes(Hl(r.sliceSerialize({start:s.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(G5,u,o?u:p)(f):f===91?e.attempt(X5,u,o?d:p)(f):o?u(f):p(f)}function d(f){return e.attempt(J5,u,p)(f)}function u(f){return t(f)}function p(f){return s._balanced=!0,n(f)}}function tH(e,t,n){return r;function r(p){return e.enter("resource"),e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),i}function i(p){return Br(p)?_u(e,s)(p):s(p)}function s(p){return p===41?u(p):hP(e,o,l,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(p)}function o(p){return Br(p)?_u(e,c)(p):u(p)}function l(p){return n(p)}function c(p){return p===34||p===39||p===40?gP(e,d,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(p):u(p)}function d(p){return Br(p)?_u(e,u)(p):u(p)}function u(p){return p===41?(e.enter("resourceMarker"),e.consume(p),e.exit("resourceMarker"),e.exit("resource"),t):n(p)}}function nH(e,t,n){const r=this;return i;function i(l){return mP.call(r,e,s,o,"reference","referenceMarker","referenceString")(l)}function s(l){return r.parser.defined.includes(Hl(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(l):n(l)}function o(l){return n(l)}}function rH(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const iH={name:"labelStartImage",resolveAll:hv.resolveAll,tokenize:sH};function sH(e,t,n){const r=this;return i;function i(l){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(l),e.exit("labelImageMarker"),s}function s(l){return l===91?(e.enter("labelMarker"),e.consume(l),e.exit("labelMarker"),e.exit("labelImage"),o):n(l)}function o(l){return l===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(l):t(l)}}const oH={name:"labelStartLink",resolveAll:hv.resolveAll,tokenize:aH};function aH(e,t,n){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Pg={name:"lineEnding",tokenize:lH};function lH(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ot(e,t,"linePrefix")}}const Sp={name:"thematicBreak",tokenize:cH};function cH(e,t,n){let r=0,i;return s;function s(d){return e.enter("thematicBreak"),o(d)}function o(d){return i=d,l(d)}function l(d){return d===i?(e.enter("thematicBreakSequence"),c(d)):r>=3&&(d===null||et(d))?(e.exit("thematicBreak"),t(d)):n(d)}function c(d){return d===i?(e.consume(d),r++,c):(e.exit("thematicBreakSequence"),Ct(d)?Ot(e,l,"whitespace")(d):l(d))}}const Ir={continuation:{tokenize:pH},exit:mH,name:"list",tokenize:fH},uH={partial:!0,tokenize:gH},dH={partial:!0,tokenize:hH};function fH(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return l;function l(h){const y=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:Sx(h)){if(r.containerState.type||(r.containerState.type=y,e.enter(y,{_container:!0})),y==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(Sp,n,d)(h):d(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(h)}return n(h)}function c(h){return Sx(h)&&++o<10?(e.consume(h),c):(!r.interrupt||o<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),d(h)):n(h)}function d(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(sm,r.interrupt?n:u,e.attempt(uH,f,p))}function u(h){return r.containerState.initialBlankLine=!0,s++,f(h)}function p(h){return Ct(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),f):n(h)}function f(h){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function pH(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(sm,i,s);function i(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ot(e,t,"listItemIndent",r.containerState.size+1)(l)}function s(l){return r.containerState.furtherBlankLines||!Ct(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(dH,t,o)(l))}function o(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ot(e,e.attempt(Ir,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function hH(e,t,n){const r=this;return Ot(e,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(s):n(s)}}function mH(e){e.exit(this.containerState.type)}function gH(e,t,n){const r=this;return Ot(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!Ct(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const lS={name:"setextUnderline",resolveTo:yH,tokenize:xH};function yH(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function xH(e,t,n){const r=this;let i;return s;function s(d){let u=r.events.length,p;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){p=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||p)?(e.enter("setextHeadingLine"),i=d,o(d)):n(d)}function o(d){return e.enter("setextHeadingLineSequence"),l(d)}function l(d){return d===i?(e.consume(d),l):(e.exit("setextHeadingLineSequence"),Ct(d)?Ot(e,c,"lineSuffix")(d):c(d))}function c(d){return d===null||et(d)?(e.exit("setextHeadingLine"),t(d)):n(d)}}const wH={tokenize:vH};function vH(e){const t=this,n=e.attempt(sm,r,e.attempt(this.parser.constructs.flowInitial,i,Ot(e,e.attempt(this.parser.constructs.flow,i,e.attempt(j5,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const bH={resolveAll:xP()},kH=yP("string"),SH=yP("text");function yP(e){return{resolveAll:xP(e==="text"?NH:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,l);return o;function o(u){return d(u)?s(u):l(u)}function l(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),c}function c(u){return d(u)?(n.exit("data"),s(u)):(n.consume(u),c)}function d(u){if(u===null)return!0;const p=i[u];let f=-1;if(p)for(;++f<p.length;){const h=p[f];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function xP(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function NH(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],i=t.sliceStream(r);let s=i.length,o=-1,l=0,c;for(;s--;){const d=i[s];if(typeof d=="string"){for(o=d.length;d.charCodeAt(o-1)===32;)l++,o--;if(o)break;o=-1}else if(d===-2)c=!0,l++;else if(d!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(l=0),l){const d={type:n===e.length||c||l<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-l,offset:r.end.offset-l},end:{...r.end}};r.end={...d.start},r.start.offset===r.end.offset?Object.assign(r,d):(e.splice(n,0,["enter",d,t],["exit",d,t]),n+=2)}n++}return e}const jH={42:Ir,43:Ir,45:Ir,48:Ir,49:Ir,50:Ir,51:Ir,52:Ir,53:Ir,54:Ir,55:Ir,56:Ir,57:Ir,62:uP},CH={91:I5},EH={[-2]:_g,[-1]:_g,32:_g},_H={35:M5,42:Sp,45:[lS,Sp],60:z5,61:lS,95:Sp,96:oS,126:oS},PH={38:fP,92:dP},IH={[-5]:Pg,[-4]:Pg,[-3]:Pg,33:iH,38:fP,42:Nx,60:[o5,q5],91:oH,92:[L5,dP],93:hv,95:Nx,96:w5},AH={null:[Nx,bH]},TH={null:[42,95]},RH={null:[]},LH=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:TH,contentInitial:CH,disable:RH,document:jH,flow:_H,flowInitial:EH,insideSpan:AH,string:PH,text:IH},Symbol.toStringTag,{value:"Module"}));function OH(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 i={},s=[];let o=[],l=[];const c={attempt:P(E),check:P(j),consume:v,enter:w,exit:k,interrupt:P(j,{interrupt:!0})},d={code:null,containerState:{},defineSkip:b,events:[],now:y,parser:e,previous:null,sliceSerialize:f,sliceStream:h,write:p};let u=t.tokenize.call(d,c);return t.resolveAll&&s.push(t),d;function p(R){return o=pi(o,R),S(),o[o.length-1]!==null?[]:(O(t,0),d.events=pv(s,d.events,d),d.events)}function f(R,I){return $H(h(R),I)}function h(R){return MH(o,R)}function y(){const{_bufferIndex:R,_index:I,line:q,column:$,offset:H}=r;return{_bufferIndex:R,_index:I,line:q,column:$,offset:H}}function b(R){i[R.line]=R.column,W()}function S(){let R;for(;r._index<o.length;){const I=o[r._index];if(typeof I=="string")for(R=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===R&&r._bufferIndex<I.length;)g(I.charCodeAt(r._bufferIndex));else g(I)}}function g(R){u=u(R)}function v(R){et(R)?(r.line++,r.column=1,r.offset+=R===-3?2:1,W()):R!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),d.previous=R}function w(R,I){const q=I||{};return q.type=R,q.start=y(),d.events.push(["enter",q,d]),l.push(q),q}function k(R){const I=l.pop();return I.end=y(),d.events.push(["exit",I,d]),I}function E(R,I){O(R,I.from)}function j(R,I){I.restore()}function P(R,I){return q;function q($,H,z){let Y,A,T,C;return Array.isArray($)?Q($):"tokenize"in $?Q([$]):G($);function G(le){return de;function de(ue){const se=ue!==null&&le[ue],re=ue!==null&&le.null,fe=[...Array.isArray(se)?se:se?[se]:[],...Array.isArray(re)?re:re?[re]:[]];return Q(fe)(ue)}}function Q(le){return Y=le,A=0,le.length===0?z:M(le[A])}function M(le){return de;function de(ue){return C=F(),T=le,le.partial||(d.currentConstruct=le),le.name&&d.parser.constructs.disable.null.includes(le.name)?ce():le.tokenize.call(I?Object.assign(Object.create(d),I):d,c,te,ce)(ue)}}function te(le){return R(T,C),H}function ce(le){return C.restore(),++A<Y.length?M(Y[A]):z}}}function O(R,I){R.resolveAll&&!s.includes(R)&&s.push(R),R.resolve&&Ss(d.events,I,d.events.length-I,R.resolve(d.events.slice(I),d)),R.resolveTo&&(d.events=R.resolveTo(d.events,d))}function F(){const R=y(),I=d.previous,q=d.currentConstruct,$=d.events.length,H=Array.from(l);return{from:$,restore:z};function z(){r=R,d.previous=I,d.currentConstruct=q,d.events.length=$,l=H,W()}}function W(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function MH(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,s)];else{if(o=e.slice(n,i),r>-1){const l=o[0];typeof l=="string"?o[0]=l.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function $H(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
68
- `;break}case-3:{o=`\r
69
- `;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function FH(e){const r={constructs:WB([LH,...(e||{}).extensions||[]]),content:i(ZB),defined:[],document:i(t5),flow:i(wH),lazy:{},string:i(kH),text:i(SH)};return r;function i(s){return o;function o(l){return OH(r,s,l)}}}function DH(e){for(;!pP(e););return e}const cS=/[\0\t\n\r]/g;function zH(){let e=1,t="",n=!0,r;return i;function i(s,o,l){const c=[];let d,u,p,f,h;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),p=0,t="",n&&(s.charCodeAt(0)===65279&&p++,n=void 0);p<s.length;){if(cS.lastIndex=p,d=cS.exec(s),f=d&&d.index!==void 0?d.index:s.length,h=s.charCodeAt(f),!d){t=s.slice(p);break}if(h===10&&p===f&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),p<f&&(c.push(s.slice(p,f)),e+=f-p),h){case 0:{c.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,c.push(-2);e++<u;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}p=f+1}return l&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}const BH=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function HH(e){return e.replace(BH,UH)}function UH(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return cP(n.slice(s?2:1),s?16:10)}return fv(n)||e}const wP={}.hasOwnProperty;function VH(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),WH(n)(DH(FH(n).document().write(zH()(e,t,!0))))}function WH(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(pn),autolinkProtocol:F,autolinkEmail:F,atxHeading:s(st),blockQuote:s(re),characterEscape:F,characterReference:F,codeFenced:s(fe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(fe,o),codeText:s(ye,o),codeTextData:F,data:F,codeFlowValue:F,definition:s(Se),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(He),hardBreakEscape:s(Ke),hardBreakTrailing:s(Ke),htmlFlow:s(Te,o),htmlFlowData:F,htmlText:s(Te,o),htmlTextData:F,image:s(It),label:o,link:s(pn),listItem:s(Nn),listItemValue:f,listOrdered:s(sn,p),listUnordered:s(sn),paragraph:s(xn),reference:M,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(st),strong:s(On),thematicBreak:s(Jn)},exit:{atxHeading:c(),atxHeadingSequence:E,autolink:c(),autolinkEmail:se,autolinkProtocol:ue,blockQuote:c(),characterEscapeValue:W,characterReferenceMarkerHexadecimal:ce,characterReferenceMarkerNumeric:ce,characterReferenceValue:le,characterReference:de,codeFenced:c(S),codeFencedFence:b,codeFencedFenceInfo:h,codeFencedFenceMeta:y,codeFlowValue:W,codeIndented:c(g),codeText:c(H),codeTextData:W,data:W,definition:c(),definitionDestinationString:k,definitionLabelString:v,definitionTitleString:w,emphasis:c(),hardBreakEscape:c(I),hardBreakTrailing:c(I),htmlFlow:c(q),htmlFlowData:W,htmlText:c($),htmlTextData:W,image:c(Y),label:T,labelText:A,lineEnding:R,link:c(z),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:te,resourceDestinationString:C,resourceTitleString:G,resource:Q,setextHeading:c(O),setextHeadingLineSequence:P,setextHeadingText:j,strong:c(),thematicBreak:c()}};vP(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(oe){let he={type:"root",children:[]};const Ve={stack:[he],tokenStack:[],config:t,enter:l,exit:d,buffer:o,resume:u,data:n},Xe=[];let tt=-1;for(;++tt<oe.length;)if(oe[tt][1].type==="listOrdered"||oe[tt][1].type==="listUnordered")if(oe[tt][0]==="enter")Xe.push(tt);else{const Et=Xe.pop();tt=i(oe,Et,tt)}for(tt=-1;++tt<oe.length;){const Et=t[oe[tt][0]];wP.call(Et,oe[tt][1].type)&&Et[oe[tt][1].type].call(Object.assign({sliceSerialize:oe[tt][2].sliceSerialize},Ve),oe[tt][1])}if(Ve.tokenStack.length>0){const Et=Ve.tokenStack[Ve.tokenStack.length-1];(Et[1]||uS).call(Ve,void 0,Et[0])}for(he.position={start:go(oe.length>0?oe[0][1].start:{line:1,column:1,offset:0}),end:go(oe.length>0?oe[oe.length-2][1].end:{line:1,column:1,offset:0})},tt=-1;++tt<t.transforms.length;)he=t.transforms[tt](he)||he;return he}function i(oe,he,Ve){let Xe=he-1,tt=-1,Et=!1,jn,xt,Cn,Qn;for(;++Xe<=Ve;){const Ht=oe[Xe];switch(Ht[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Ht[0]==="enter"?tt++:tt--,Qn=void 0;break}case"lineEndingBlank":{Ht[0]==="enter"&&(jn&&!Qn&&!tt&&!Cn&&(Cn=Xe),Qn=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Qn=void 0}if(!tt&&Ht[0]==="enter"&&Ht[1].type==="listItemPrefix"||tt===-1&&Ht[0]==="exit"&&(Ht[1].type==="listUnordered"||Ht[1].type==="listOrdered")){if(jn){let Ut=Xe;for(xt=void 0;Ut--;){const on=oe[Ut];if(on[1].type==="lineEnding"||on[1].type==="lineEndingBlank"){if(on[0]==="exit")continue;xt&&(oe[xt][1].type="lineEndingBlank",Et=!0),on[1].type="lineEnding",xt=Ut}else if(!(on[1].type==="linePrefix"||on[1].type==="blockQuotePrefix"||on[1].type==="blockQuotePrefixWhitespace"||on[1].type==="blockQuoteMarker"||on[1].type==="listItemIndent"))break}Cn&&(!xt||Cn<xt)&&(jn._spread=!0),jn.end=Object.assign({},xt?oe[xt][1].start:Ht[1].end),oe.splice(xt||Xe,0,["exit",jn,Ht[2]]),Xe++,Ve++}if(Ht[1].type==="listItemPrefix"){const Ut={type:"listItem",_spread:!1,start:Object.assign({},Ht[1].start),end:void 0};jn=Ut,oe.splice(Xe,0,["enter",Ut,Ht[2]]),Xe++,Ve++,Cn=void 0,Qn=!0}}}return oe[he][1]._spread=Et,Ve}function s(oe,he){return Ve;function Ve(Xe){l.call(this,oe(Xe),Xe),he&&he.call(this,Xe)}}function o(){this.stack.push({type:"fragment",children:[]})}function l(oe,he,Ve){this.stack[this.stack.length-1].children.push(oe),this.stack.push(oe),this.tokenStack.push([he,Ve||void 0]),oe.position={start:go(he.start),end:void 0}}function c(oe){return he;function he(Ve){oe&&oe.call(this,Ve),d.call(this,Ve)}}function d(oe,he){const Ve=this.stack.pop(),Xe=this.tokenStack.pop();if(Xe)Xe[0].type!==oe.type&&(he?he.call(this,oe,Xe[0]):(Xe[1]||uS).call(this,oe,Xe[0]));else throw new Error("Cannot close `"+oe.type+"` ("+Eu({start:oe.start,end:oe.end})+"): it’s not open");Ve.position.end=go(oe.end)}function u(){return UB(this.stack.pop())}function p(){this.data.expectingFirstListItemValue=!0}function f(oe){if(this.data.expectingFirstListItemValue){const he=this.stack[this.stack.length-2];he.start=Number.parseInt(this.sliceSerialize(oe),10),this.data.expectingFirstListItemValue=void 0}}function h(){const oe=this.resume(),he=this.stack[this.stack.length-1];he.lang=oe}function y(){const oe=this.resume(),he=this.stack[this.stack.length-1];he.meta=oe}function b(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function S(){const oe=this.resume(),he=this.stack[this.stack.length-1];he.value=oe.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function g(){const oe=this.resume(),he=this.stack[this.stack.length-1];he.value=oe.replace(/(\r?\n|\r)$/g,"")}function v(oe){const he=this.resume(),Ve=this.stack[this.stack.length-1];Ve.label=he,Ve.identifier=Hl(this.sliceSerialize(oe)).toLowerCase()}function w(){const oe=this.resume(),he=this.stack[this.stack.length-1];he.title=oe}function k(){const oe=this.resume(),he=this.stack[this.stack.length-1];he.url=oe}function E(oe){const he=this.stack[this.stack.length-1];if(!he.depth){const Ve=this.sliceSerialize(oe).length;he.depth=Ve}}function j(){this.data.setextHeadingSlurpLineEnding=!0}function P(oe){const he=this.stack[this.stack.length-1];he.depth=this.sliceSerialize(oe).codePointAt(0)===61?1:2}function O(){this.data.setextHeadingSlurpLineEnding=void 0}function F(oe){const Ve=this.stack[this.stack.length-1].children;let Xe=Ve[Ve.length-1];(!Xe||Xe.type!=="text")&&(Xe=Ur(),Xe.position={start:go(oe.start),end:void 0},Ve.push(Xe)),this.stack.push(Xe)}function W(oe){const he=this.stack.pop();he.value+=this.sliceSerialize(oe),he.position.end=go(oe.end)}function R(oe){const he=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Ve=he.children[he.children.length-1];Ve.position.end=go(oe.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(he.type)&&(F.call(this,oe),W.call(this,oe))}function I(){this.data.atHardBreak=!0}function q(){const oe=this.resume(),he=this.stack[this.stack.length-1];he.value=oe}function $(){const oe=this.resume(),he=this.stack[this.stack.length-1];he.value=oe}function H(){const oe=this.resume(),he=this.stack[this.stack.length-1];he.value=oe}function z(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const he=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=he,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function Y(){const oe=this.stack[this.stack.length-1];if(this.data.inReference){const he=this.data.referenceType||"shortcut";oe.type+="Reference",oe.referenceType=he,delete oe.url,delete oe.title}else delete oe.identifier,delete oe.label;this.data.referenceType=void 0}function A(oe){const he=this.sliceSerialize(oe),Ve=this.stack[this.stack.length-2];Ve.label=HH(he),Ve.identifier=Hl(he).toLowerCase()}function T(){const oe=this.stack[this.stack.length-1],he=this.resume(),Ve=this.stack[this.stack.length-1];if(this.data.inReference=!0,Ve.type==="link"){const Xe=oe.children;Ve.children=Xe}else Ve.alt=he}function C(){const oe=this.resume(),he=this.stack[this.stack.length-1];he.url=oe}function G(){const oe=this.resume(),he=this.stack[this.stack.length-1];he.title=oe}function Q(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function te(oe){const he=this.resume(),Ve=this.stack[this.stack.length-1];Ve.label=he,Ve.identifier=Hl(this.sliceSerialize(oe)).toLowerCase(),this.data.referenceType="full"}function ce(oe){this.data.characterReferenceType=oe.type}function le(oe){const he=this.sliceSerialize(oe),Ve=this.data.characterReferenceType;let Xe;Ve?(Xe=cP(he,Ve==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Xe=fv(he);const tt=this.stack[this.stack.length-1];tt.value+=Xe}function de(oe){const he=this.stack.pop();he.position.end=go(oe.end)}function ue(oe){W.call(this,oe);const he=this.stack[this.stack.length-1];he.url=this.sliceSerialize(oe)}function se(oe){W.call(this,oe);const he=this.stack[this.stack.length-1];he.url="mailto:"+this.sliceSerialize(oe)}function re(){return{type:"blockquote",children:[]}}function fe(){return{type:"code",lang:null,meta:null,value:""}}function ye(){return{type:"inlineCode",value:""}}function Se(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function He(){return{type:"emphasis",children:[]}}function st(){return{type:"heading",depth:0,children:[]}}function Ke(){return{type:"break"}}function Te(){return{type:"html",value:""}}function It(){return{type:"image",title:null,url:"",alt:null}}function pn(){return{type:"link",title:null,url:"",children:[]}}function sn(oe){return{type:"list",ordered:oe.type==="listOrdered",start:null,spread:oe._spread,children:[]}}function Nn(oe){return{type:"listItem",spread:oe._spread,checked:null,children:[]}}function xn(){return{type:"paragraph",children:[]}}function On(){return{type:"strong",children:[]}}function Ur(){return{type:"text",value:""}}function Jn(){return{type:"thematicBreak"}}}function go(e){return{line:e.line,column:e.column,offset:e.offset}}function vP(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?vP(e,r):KH(e,r)}}function KH(e,t){let n;for(n in t)if(wP.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 uS(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Eu({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Eu({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Eu({start:t.start,end:t.end})+") is still open")}function qH(e){const t=this;t.parser=n;function n(r){return VH(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function YH(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 GH(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
70
- `}]}function XH(e,t){const n=t.value?t.value+`
71
- `:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function JH(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function QH(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function ZH(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=mc(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let o,l=e.footnoteCounts.get(r);l===void 0?(l=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=s+1,l+=1,e.footnoteCounts.set(r,l);const c={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(l>1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,c);const d={type:"element",tagName:"sup",properties:{},children:[c]};return e.patch(t,d),e.applyData(t,d)}function e8(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 t8(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function bP(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 i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function n8(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return bP(e,t);const i={src:mc(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function r8(e,t){const n={src:mc(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function 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 s8(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return bP(e,t);const i={href:mc(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function o8(e,t){const n={href:mc(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function a8(e,t,n){const r=e.all(t),i=n?l8(n):kP(t),s={},o=[];if(typeof t.checked=="boolean"){const u=r[0];let p;u&&u.type==="element"&&u.tagName==="p"?p=u:(p={type:"element",tagName:"p",properties:{},children:[]},r.unshift(p)),p.children.length>0&&p.children.unshift({type:"text",value:" "}),p.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let l=-1;for(;++l<r.length;){const u=r[l];(i||l!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
72
- `}),u.type==="element"&&u.tagName==="p"&&!i?o.push(...u.children):o.push(u)}const c=r[r.length-1];c&&(i||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
73
- `});const d={type:"element",tagName:"li",properties:s,children:o};return e.patch(t,d),e.applyData(t,d)}function l8(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=kP(n[r])}return t}function kP(e){const t=e.spread;return t??e.children.length>1}function c8(e,t){const n={},r=e.all(t);let i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i<r.length;){const o=r[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,s),e.applyData(t,s)}function u8(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 p8(e,t){const n=e.all(t),r=n.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),i.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},l=lv(t.children[1]),c=nP(t.children[t.children.length-1]);l&&c&&(o.position={start:l,end:c}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,s),e.applyData(t,s)}function h8(e,t,n){const r=n?n.children:void 0,s=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,l=o?o.length:t.children.length;let c=-1;const d=[];for(;++c<l;){const p=t.children[c],f={},h=o?o[c]:void 0;h&&(f.align=h);let y={type:"element",tagName:s,properties:f,children:[]};p&&(y.children=e.all(p),e.patch(p,y),y=e.applyData(p,y)),d.push(y)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(d,!0)};return e.patch(t,u),e.applyData(t,u)}function m8(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const dS=9,fS=32;function g8(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),i=0;const s=[];for(;r;)s.push(pS(t.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return s.push(pS(t.slice(i),i>0,!1)),s.join("")}function pS(e,t,n){let r=0,i=e.length;if(t){let s=e.codePointAt(r);for(;s===dS||s===fS;)r++,s=e.codePointAt(r)}if(n){let s=e.codePointAt(i-1);for(;s===dS||s===fS;)i--,s=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function y8(e,t){const n={type:"text",value:g8(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function x8(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const w8={blockquote:YH,break:GH,code:XH,delete:JH,emphasis:QH,footnoteReference:ZH,heading:e8,html:t8,imageReference:n8,image:r8,inlineCode:i8,linkReference:s8,link:o8,listItem:a8,list:c8,paragraph:u8,root:d8,strong:f8,table:p8,tableCell:m8,tableRow:h8,text:y8,thematicBreak:x8,toml:Wf,yaml:Wf,definition:Wf,footnoteDefinition:Wf};function Wf(){}const SP=-1,om=0,Pu=1,uh=2,mv=3,gv=4,yv=5,xv=6,NP=7,jP=8,hS=typeof self=="object"?self:globalThis,v8=(e,t)=>{const n=(i,s)=>(e.set(s,i),i),r=i=>{if(e.has(i))return e.get(i);const[s,o]=t[i];switch(s){case om:case SP:return n(o,i);case Pu:{const l=n([],i);for(const c of o)l.push(r(c));return l}case uh:{const l=n({},i);for(const[c,d]of o)l[r(c)]=r(d);return l}case mv:return n(new Date(o),i);case gv:{const{source:l,flags:c}=o;return n(new RegExp(l,c),i)}case yv:{const l=n(new Map,i);for(const[c,d]of o)l.set(r(c),r(d));return l}case xv:{const l=n(new Set,i);for(const c of o)l.add(r(c));return l}case NP:{const{name:l,message:c}=o;return n(new hS[l](c),i)}case jP:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:l}=new Uint8Array(o);return n(new DataView(l),o)}}return n(new hS[s](o),i)};return r},mS=e=>v8(new Map,e)(0),al="",{toString:b8}={},{keys:k8}=Object,Zc=e=>{const t=typeof e;if(t!=="object"||!e)return[om,t];const n=b8.call(e).slice(8,-1);switch(n){case"Array":return[Pu,al];case"Object":return[uh,al];case"Date":return[mv,al];case"RegExp":return[gv,al];case"Map":return[yv,al];case"Set":return[xv,al];case"DataView":return[Pu,n]}return n.includes("Array")?[Pu,n]:n.includes("Error")?[NP,n]:[uh,n]},Kf=([e,t])=>e===om&&(t==="function"||t==="symbol"),S8=(e,t,n,r)=>{const i=(o,l)=>{const c=r.push(o)-1;return n.set(l,c),c},s=o=>{if(n.has(o))return n.get(o);let[l,c]=Zc(o);switch(l){case om:{let u=o;switch(c){case"bigint":l=jP,u=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+c);u=null;break;case"undefined":return i([SP],o)}return i([l,u],o)}case Pu:{if(c){let f=o;return c==="DataView"?f=new Uint8Array(o.buffer):c==="ArrayBuffer"&&(f=new Uint8Array(o)),i([c,[...f]],o)}const u=[],p=i([l,u],o);for(const f of o)u.push(s(f));return p}case uh:{if(c)switch(c){case"BigInt":return i([c,o.toString()],o);case"Boolean":case"Number":case"String":return i([c,o.valueOf()],o)}if(t&&"toJSON"in o)return s(o.toJSON());const u=[],p=i([l,u],o);for(const f of k8(o))(e||!Kf(Zc(o[f])))&&u.push([s(f),s(o[f])]);return p}case mv:return i([l,o.toISOString()],o);case gv:{const{source:u,flags:p}=o;return i([l,{source:u,flags:p}],o)}case yv:{const u=[],p=i([l,u],o);for(const[f,h]of o)(e||!(Kf(Zc(f))||Kf(Zc(h))))&&u.push([s(f),s(h)]);return p}case xv:{const u=[],p=i([l,u],o);for(const f of o)(e||!Kf(Zc(f)))&&u.push(s(f));return p}}const{message:d}=o;return i([l,{name:c,message:d}],o)};return s},gS=(e,{json:t,lossy:n}={})=>{const r=[];return S8(!(t||n),!!t,new Map,r)(e),r},dh=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?mS(gS(e,t)):structuredClone(e):(e,t)=>mS(gS(e,t));function N8(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 j8(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function C8(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||N8,r=e.options.footnoteBackLabel||j8,i=e.options.footnoteLabel||"Footnotes",s=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c<e.footnoteOrder.length;){const d=e.footnoteById.get(e.footnoteOrder[c]);if(!d)continue;const u=e.all(d),p=String(d.identifier).toUpperCase(),f=mc(p.toLowerCase());let h=0;const y=[],b=e.footnoteCounts.get(p);for(;b!==void 0&&++h<=b;){y.length>0&&y.push({type:"text",value:" "});let v=typeof n=="string"?n:n(c,h);typeof v=="string"&&(v={type:"text",value:v}),y.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 S=u[u.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const v=S.children[S.children.length-1];v&&v.type==="text"?v.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...y)}else u.push(...y);const g={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(u,!0)};e.patch(d,g),l.push(g)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...dh(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
74
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(l,!0)},{type:"text",value:`
75
- `}]}}const CP=function(e){if(e==null)return I8;if(typeof e=="function")return am(e);if(typeof e=="object")return Array.isArray(e)?E8(e):_8(e);if(typeof e=="string")return P8(e);throw new Error("Expected function, string, or object as test")};function E8(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=CP(e[n]);return am(r);function r(...i){let s=-1;for(;++s<t.length;)if(t[s].apply(this,i))return!0;return!1}}function _8(e){const t=e;return am(n);function n(r){const i=r;let s;for(s in e)if(i[s]!==t[s])return!1;return!0}}function P8(e){return am(t);function t(n){return n&&n.type===e}}function am(e){return t;function t(n,r,i){return!!(A8(n)&&e.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function I8(){return!0}function A8(e){return e!==null&&typeof e=="object"&&"type"in e}const EP=[],T8=!0,yS=!1,R8="skip";function L8(e,t,n,r){let i;typeof t=="function"&&typeof n!="function"?(r=n,n=t):i=t;const s=CP(i),o=r?-1:1;l(e,void 0,[])();function l(c,d,u){const p=c&&typeof c=="object"?c:{};if(typeof p.type=="string"){const h=typeof p.tagName=="string"?p.tagName:typeof p.name=="string"?p.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(c.type+(h?"<"+h+">":""))+")"})}return f;function f(){let h=EP,y,b,S;if((!t||s(c,d,u[u.length-1]||void 0))&&(h=O8(n(c,u)),h[0]===yS))return h;if("children"in c&&c.children){const g=c;if(g.children&&h[0]!==R8)for(b=(r?g.children.length:-1)+o,S=u.concat(g);b>-1&&b<g.children.length;){const v=g.children[b];if(y=l(v,b,S)(),y[0]===yS)return y;b=typeof y[1]=="number"?y[1]:b+o}}return h}}}function O8(e){return Array.isArray(e)?e:typeof e=="number"?[T8,e]:e==null?EP:[e]}function _P(e,t,n,r){let i,s,o;typeof t=="function"&&typeof n!="function"?(s=void 0,o=t,i=n):(s=t,o=n,i=r),L8(e,s,l,i);function l(c,d){const u=d[d.length-1],p=u?u.children.indexOf(c):void 0;return o(c,p,u)}}const jx={}.hasOwnProperty,M8={};function $8(e,t){const n=t||M8,r=new Map,i=new Map,s=new Map,o={...w8,...n.handlers},l={all:d,applyData:D8,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:c,options:n,patch:F8,wrap:B8};return _P(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const p=u.type==="definition"?r:i,f=String(u.identifier).toUpperCase();p.has(f)||p.set(f,u)}}),l;function c(u,p){const f=u.type,h=l.handlers[f];if(jx.call(l.handlers,f)&&h)return h(l,u,p);if(l.options.passThrough&&l.options.passThrough.includes(f)){if("children"in u){const{children:b,...S}=u,g=dh(S);return g.children=l.all(u),g}return dh(u)}return(l.options.unknownHandler||z8)(l,u,p)}function d(u){const p=[];if("children"in u){const f=u.children;let h=-1;for(;++h<f.length;){const y=l.one(f[h],u);if(y){if(h&&f[h-1].type==="break"&&(!Array.isArray(y)&&y.type==="text"&&(y.value=xS(y.value)),!Array.isArray(y)&&y.type==="element")){const b=y.children[0];b&&b.type==="text"&&(b.value=xS(b.value))}Array.isArray(y)?p.push(...y):p.push(y)}}}return p}}function F8(e,t){e.position&&(t.position=bB(e))}function D8(e,t){let n=t;if(e&&e.data){const r=e.data.hName,i=e.data.hChildren,s=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&s&&Object.assign(n.properties,dh(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function z8(e,t){const n=t.data||{},r="value"in t&&!(jx.call(n,"hProperties")||jx.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 B8(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 xS(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function wS(e,t){const n=$8(e,t),r=n.one(e,void 0),i=C8(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
79
- `},i),s}function H8(e,t){return e&&"run"in e?async function(n,r){const i=wS(n,{file:r,...t});await e.run(i,r)}:function(n,r){return wS(n,{file:r,...e||t})}}function vS(e){if(e)throw e}var Np=Object.prototype.hasOwnProperty,PP=Object.prototype.toString,bS=Object.defineProperty,kS=Object.getOwnPropertyDescriptor,SS=function(t){return typeof Array.isArray=="function"?Array.isArray(t):PP.call(t)==="[object Array]"},NS=function(t){if(!t||PP.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 i;for(i in t);return typeof i>"u"||Np.call(t,i)},jS=function(t,n){bS&&n.name==="__proto__"?bS(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},CS=function(t,n){if(n==="__proto__")if(Np.call(t,n)){if(kS)return kS(t,n).value}else return;return t[n]},U8=function e(){var t,n,r,i,s,o,l=arguments[0],c=1,d=arguments.length,u=!1;for(typeof l=="boolean"&&(u=l,l=arguments[1]||{},c=2),(l==null||typeof l!="object"&&typeof l!="function")&&(l={});c<d;++c)if(t=arguments[c],t!=null)for(n in t)r=CS(l,n),i=CS(t,n),l!==i&&(u&&i&&(NS(i)||(s=SS(i)))?(s?(s=!1,o=r&&SS(r)?r:[]):o=r&&NS(r)?r:{},jS(l,{name:n,newValue:e(u,o,i)})):typeof i<"u"&&jS(l,{name:n,newValue:i}));return l};const Ig=Ko(U8);function Cx(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 V8(){const e=[],t={run:n,use:r};return t;function n(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);l(null,...i);function l(c,...d){const u=e[++s];let p=-1;if(c){o(c);return}for(;++p<i.length;)(d[p]===null||d[p]===void 0)&&(d[p]=i[p]);i=d,u?W8(u,l)(...d):o(null,...d)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return e.push(i),t}}function W8(e,t){let n;return r;function r(...o){const l=e.length>o.length;let c;l&&o.push(i);try{c=e.apply(this,o)}catch(d){const u=d;if(l&&n)throw u;return i(u)}l||(c&&c.then&&typeof c.then=="function"?c.then(s,i):c instanceof Error?i(c):s(c))}function i(o,...l){n||(n=!0,t(o,...l))}function s(o){i(null,o)}}const cs={basename:K8,dirname:q8,extname:Y8,join:G8,sep:"/"};function K8(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ad(e);let n=0,r=-1,i=e.length,s;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,l=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),l>-1&&(e.codePointAt(i)===t.codePointAt(l--)?l<0&&(r=i):(l=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function q8(e){if(Ad(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 Y8(e){Ad(e);let t=e.length,n=-1,r=0,i=-1,s=0,o;for(;t--;){const l=e.codePointAt(t);if(l===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),l===46?i<0?i=t:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function G8(...e){let t=-1,n;for(;++t<e.length;)Ad(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":X8(n)}function X8(e){Ad(e);const t=e.codePointAt(0)===47;let n=J8(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function J8(e,t){let n="",r=0,i=-1,s=0,o=-1,l,c;for(;++o<=e.length;){if(o<e.length)l=e.codePointAt(o);else{if(l===47)break;l=47}if(l===47){if(!(i===o-1||s===1))if(i!==o-1&&s===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("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,s=0}else l===46&&s>-1?s++:s=-1}return n}function Ad(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const Q8={cwd:Z8};function Z8(){return"/"}function Ex(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function e6(e){if(typeof e=="string")e=new URL(e);else if(!Ex(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 t6(e)}function t6(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 i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(t)}const Ag=["history","path","basename","stem","extname","dirname"];class IP{constructor(t){let n;t?Ex(t)?n={path:t}:typeof t=="string"||n6(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":Q8.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Ag.length;){const s=Ag[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)Ag.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?cs.basename(this.path):void 0}set basename(t){Rg(t,"basename"),Tg(t,"basename"),this.path=cs.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?cs.dirname(this.path):void 0}set dirname(t){ES(this.basename,"dirname"),this.path=cs.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?cs.extname(this.path):void 0}set extname(t){if(Tg(t,"extname"),ES(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=cs.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ex(t)&&(t=e6(t)),Rg(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?cs.basename(this.path,this.extname):void 0}set stem(t){Rg(t,"stem"),Tg(t,"stem"),this.path=cs.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const i=this.message(t,n,r);throw i.fatal=!0,i}info(t,n,r){const i=this.message(t,n,r);return i.fatal=void 0,i}message(t,n,r){const i=new ur(t,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Tg(e,t){if(e&&e.includes(cs.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+cs.sep+"`")}function Rg(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function ES(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function n6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const r6=function(e){const r=this.constructor.prototype,i=r[e],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s},i6={}.hasOwnProperty;class wv extends r6{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=V8()}copy(){const t=new wv;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Ig(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Mg("data",this.frozen),this.namespace[t]=n,this):i6.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Mg("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(t,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=qf(t),r=this.parser||this.Parser;return Lg("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Lg("process",this.parser||this.Parser),Og("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const l=qf(t),c=r.parse(l);r.run(c,l,function(u,p,f){if(u||!p||!f)return d(u);const h=p,y=r.stringify(h,f);a6(y)?f.value=y:f.result=y,d(u,f)});function d(u,p){u||!p?o(u):s?s(p):n(void 0,p)}}}processSync(t){let n=!1,r;return this.freeze(),Lg("processSync",this.parser||this.Parser),Og("processSync",this.compiler||this.Compiler),this.process(t,i),PS("processSync","process",n),r;function i(s,o){n=!0,vS(s),r=o}}run(t,n,r){_S(t),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(o,l){const c=qf(n);i.run(t,c,d);function d(u,p,f){const h=p||t;u?l(u):o?o(h):r(void 0,h,f)}}}runSync(t,n){let r=!1,i;return this.run(t,n,s),PS("runSync","run",r),i;function s(o,l){vS(o),i=l,r=!0}}stringify(t,n){this.freeze();const r=qf(n),i=this.compiler||this.Compiler;return Og("stringify",i),_S(t),i(t,r)}use(t,...n){const r=this.attachers,i=this.namespace;if(Mg("use",this.frozen),t!=null)if(typeof t=="function")c(t,n);else if(typeof t=="object")Array.isArray(t)?l(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function s(d){if(typeof d=="function")c(d,[]);else if(typeof d=="object")if(Array.isArray(d)){const[u,...p]=d;c(u,p)}else o(d);else throw new TypeError("Expected usable value, not `"+d+"`")}function o(d){if(!("plugins"in d)&&!("settings"in d))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");l(d.plugins),d.settings&&(i.settings=Ig(!0,i.settings,d.settings))}function l(d){let u=-1;if(d!=null)if(Array.isArray(d))for(;++u<d.length;){const p=d[u];s(p)}else throw new TypeError("Expected a list of plugins, not `"+d+"`")}function c(d,u){let p=-1,f=-1;for(;++p<r.length;)if(r[p][0]===d){f=p;break}if(f===-1)r.push([d,...u]);else if(u.length>0){let[h,...y]=u;const b=r[f][1];Cx(b)&&Cx(h)&&(h=Ig(!0,b,h)),r[f]=[d,h,...y]}}}}const s6=new wv().freeze();function Lg(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Og(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Mg(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function _S(e){if(!Cx(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function PS(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function qf(e){return o6(e)?e:new IP(e)}function o6(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function a6(e){return typeof e=="string"||l6(e)}function l6(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const c6="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",IS=[],AS={allowDangerousHtml:!0},u6=/^(https?|ircs?|mailto|xmpp)$/i,d6=[{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 Td(e){const t=f6(e),n=p6(e);return h6(t.runSync(t.parse(n),n),e)}function f6(e){const t=e.rehypePlugins||IS,n=e.remarkPlugins||IS,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...AS}:AS;return s6().use(qH).use(n).use(H8,r).use(t)}function p6(e){const t=e.children||"",n=new IP;return typeof t=="string"&&(n.value=t),n}function h6(e,t){const n=t.allowedElements,r=t.allowElement,i=t.components,s=t.disallowedElements,o=t.skipHtml,l=t.unwrapDisallowed,c=t.urlTransform||m6;for(const u of d6)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+c6+u.id,void 0);return _P(e,d),CB(e,{Fragment:a.Fragment,components:i,ignoreInvalidStyle:!0,jsx:a.jsx,jsxs:a.jsxs,passKeys:!0,passNode:!0});function d(u,p,f){if(u.type==="raw"&&f&&typeof p=="number")return o?f.children.splice(p,1):f.children[p]={type:"text",value:u.value},p;if(u.type==="element"){let h;for(h in Eg)if(Object.hasOwn(Eg,h)&&Object.hasOwn(u.properties,h)){const y=u.properties[h],b=Eg[h];(b===null||b.includes(u.tagName))&&(u.properties[h]=c(String(y||""),h,u))}}if(u.type==="element"){let h=n?!n.includes(u.tagName):s?s.includes(u.tagName):!1;if(!h&&r&&typeof p=="number"&&(h=!r(u,p,f)),h&&f&&typeof p=="number")return l&&u.children?f.children.splice(p,1,...u.children):f.children.splice(p,1),p}}}function m6(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),i=e.indexOf("/");return t===-1||i!==-1&&t>i||n!==-1&&t>n||r!==-1&&t>r||u6.test(e.slice(0,t))?e:""}function g6(e){return e!=null&&typeof e=="object"&&!Array.isArray(e)}function fh(e){if(e==null)return"null";if(typeof e!="object")return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(r=>fh(r)).join(",")}]`;const t=e;return`{${Object.keys(t).sort().map(r=>`${JSON.stringify(r)}:${fh(t[r])}`).join(",")}}`}function TS(e){return fh({id:e.id,type:e.type,position:e.position,data:e.data,parentId:e.parentId,extent:e.extent,sourcePosition:e.sourcePosition,targetPosition:e.targetPosition,hidden:e.hidden})}function ad(e){const t=e.sourceHandle??"",n=e.targetHandle??"";return`${e.source}|${t}|${e.target}|${n}`}function RS(e){return fh({source:e.source,target:e.target,sourceHandle:e.sourceHandle??null,targetHandle:e.targetHandle??null,type:e.type,label:e.label,data:e.data,markerStart:e.markerStart,markerEnd:e.markerEnd,animated:e.animated,hidden:e.hidden,style:e.style})}function LS(e,t){return!g6(t)||!("selected"in t)||t.selected===e.selected?e:{...e,selected:!!t.selected}}function OS(e,t=!1){const n=new Map;for(const r of e){const i=ad(r);if(t&&n.has(i))throw new Error(`存在重复连线键: ${i}`);n.set(i,r)}return n}function y6(e,t,n,r){const i=new Map(e.map(v=>[v.id,v])),s=new Set(n.map(v=>v.id)),o=new Set,l=[],c=[],d=n.map(v=>{const w=i.get(v.id);return w?TS(w)===TS(v)?(o.add(v.id),w):(c.push(v.id),LS(v,w)):(l.push(v.id),v)}),u=OS(t),p=OS(r,!0),f=new Set,h=[],y=[],b=r.map(v=>{const w=ad(v),k=u.get(w);return k?RS(k)===RS(v)?(f.add(w),k):(y.push(w),LS(v,k)):(h.push(w),v)}),S=e.filter(v=>!s.has(v.id)).map(v=>v.id),g=t.map(v=>ad(v)).filter(v=>!p.has(v));return{nodes:d,edges:b,changes:{addedNodeIds:l,updatedNodeIds:c,removedNodeIds:S,addedEdgeKeys:h,updatedEdgeKeys:y,removedEdgeKeys:g},stats:{nodeAdded:l.length,nodeRemoved:S.length,nodeReused:o.size,edgeAdded:h.length,edgeRemoved:g.length,edgeReused:f.size,nextEdgeCount:p.size}}}/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function AP(e){return typeof e>"u"||e===null}function x6(e){return typeof e=="object"&&e!==null}function w6(e){return Array.isArray(e)?e:AP(e)?[]:[e]}function v6(e,t){var n,r,i,s;if(t)for(s=Object.keys(t),n=0,r=s.length;n<r;n+=1)i=s[n],e[i]=t[i];return e}function b6(e,t){var n="",r;for(r=0;r<t;r+=1)n+=e;return n}function k6(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var S6=AP,N6=x6,j6=w6,C6=b6,E6=k6,_6=v6,Rn={isNothing:S6,isObject:N6,toArray:j6,repeat:C6,isNegativeZero:E6,extend:_6};function TP(e,t){var n="",r=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+=`
80
-
81
- `+e.mark.snippet),r+" "+n):r}function ld(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=TP(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}ld.prototype=Object.create(Error.prototype);ld.prototype.constructor=ld;ld.prototype.toString=function(t){return this.name+": "+TP(this,t)};var br=ld;function $g(e,t,n,r,i){var s="",o="",l=Math.floor(i/2)-1;return r-t>l&&(s=" ... ",t=r-l+s.length),n-r>l&&(o=" ...",n=r+l-o.length),{str:s+e.slice(t,n).replace(/\t/g,"→")+o,pos:r-t+s.length}}function Fg(e,t){return Rn.repeat(" ",t-e.length)+e}function P6(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var n=/\r?\n|\r|\0/g,r=[0],i=[],s,o=-1;s=n.exec(e.buffer);)i.push(s.index),r.push(s.index+s[0].length),e.position<=s.index&&o<0&&(o=r.length-2);o<0&&(o=r.length-1);var l="",c,d,u=Math.min(e.line+t.linesAfter,i.length).toString().length,p=t.maxLength-(t.indent+u+3);for(c=1;c<=t.linesBefore&&!(o-c<0);c++)d=$g(e.buffer,r[o-c],i[o-c],e.position-(r[o]-r[o-c]),p),l=Rn.repeat(" ",t.indent)+Fg((e.line-c+1).toString(),u)+" | "+d.str+`
82
- `+l;for(d=$g(e.buffer,r[o],i[o],e.position,p),l+=Rn.repeat(" ",t.indent)+Fg((e.line+1).toString(),u)+" | "+d.str+`
83
- `,l+=Rn.repeat("-",t.indent+u+3+d.pos)+`^
84
- `,c=1;c<=t.linesAfter&&!(o+c>=i.length);c++)d=$g(e.buffer,r[o+c],i[o+c],e.position-(r[o]-r[o+c]),p),l+=Rn.repeat(" ",t.indent)+Fg((e.line+c+1).toString(),u)+" | "+d.str+`
85
- `;return l.replace(/\n$/,"")}var I6=P6,A6=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],T6=["scalar","sequence","mapping"];function R6(e){var t={};return e!==null&&Object.keys(e).forEach(function(n){e[n].forEach(function(r){t[String(r)]=n})}),t}function L6(e,t){if(t=t||{},Object.keys(t).forEach(function(n){if(A6.indexOf(n)===-1)throw new br('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=R6(t.styleAliases||null),T6.indexOf(this.kind)===-1)throw new br('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var Yn=L6;function MS(e,t){var n=[];return e[t].forEach(function(r){var i=n.length;n.forEach(function(s,o){s.tag===r.tag&&s.kind===r.kind&&s.multi===r.multi&&(i=o)}),n[i]=r}),n}function O6(){var e={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}},t,n;function r(i){i.multi?(e.multi[i.kind].push(i),e.multi.fallback.push(i)):e[i.kind][i.tag]=e.fallback[i.tag]=i}for(t=0,n=arguments.length;t<n;t+=1)arguments[t].forEach(r);return e}function _x(e){return this.extend(e)}_x.prototype.extend=function(t){var n=[],r=[];if(t instanceof Yn)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 br("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");n.forEach(function(s){if(!(s instanceof Yn))throw new br("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(s.loadKind&&s.loadKind!=="scalar")throw new br("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(s.multi)throw new br("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),r.forEach(function(s){if(!(s instanceof Yn))throw new br("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(_x.prototype);return i.implicit=(this.implicit||[]).concat(n),i.explicit=(this.explicit||[]).concat(r),i.compiledImplicit=MS(i,"implicit"),i.compiledExplicit=MS(i,"explicit"),i.compiledTypeMap=O6(i.compiledImplicit,i.compiledExplicit),i};var RP=_x,LP=new Yn("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),OP=new Yn("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),MP=new Yn("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),$P=new RP({explicit:[LP,OP,MP]});function M6(e){if(e===null)return!0;var t=e.length;return t===1&&e==="~"||t===4&&(e==="null"||e==="Null"||e==="NULL")}function $6(){return null}function F6(e){return e===null}var FP=new Yn("tag:yaml.org,2002:null",{kind:"scalar",resolve:M6,construct:$6,predicate:F6,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"});function D6(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 z6(e){return e==="true"||e==="True"||e==="TRUE"}function B6(e){return Object.prototype.toString.call(e)==="[object Boolean]"}var DP=new Yn("tag:yaml.org,2002:bool",{kind:"scalar",resolve:D6,construct:z6,predicate:B6,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 H6(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function U6(e){return 48<=e&&e<=55}function V6(e){return 48<=e&&e<=57}function W6(e){if(e===null)return!1;var t=e.length,n=0,r=!1,i;if(!t)return!1;if(i=e[n],(i==="-"||i==="+")&&(i=e[++n]),i==="0"){if(n+1===t)return!0;if(i=e[++n],i==="b"){for(n++;n<t;n++)if(i=e[n],i!=="_"){if(i!=="0"&&i!=="1")return!1;r=!0}return r&&i!=="_"}if(i==="x"){for(n++;n<t;n++)if(i=e[n],i!=="_"){if(!H6(e.charCodeAt(n)))return!1;r=!0}return r&&i!=="_"}if(i==="o"){for(n++;n<t;n++)if(i=e[n],i!=="_"){if(!U6(e.charCodeAt(n)))return!1;r=!0}return r&&i!=="_"}}if(i==="_")return!1;for(;n<t;n++)if(i=e[n],i!=="_"){if(!V6(e.charCodeAt(n)))return!1;r=!0}return!(!r||i==="_")}function K6(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 q6(e){return Object.prototype.toString.call(e)==="[object Number]"&&e%1===0&&!Rn.isNegativeZero(e)}var zP=new Yn("tag:yaml.org,2002:int",{kind:"scalar",resolve:W6,construct:K6,predicate:q6,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"]}}),Y6=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function G6(e){return!(e===null||!Y6.test(e)||e[e.length-1]==="_")}function X6(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 J6=/^[-+]?[0-9]+e/;function Q6(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(Rn.isNegativeZero(e))return"-0.0";return n=e.toString(10),J6.test(n)?n.replace("e",".e"):n}function Z6(e){return Object.prototype.toString.call(e)==="[object Number]"&&(e%1!==0||Rn.isNegativeZero(e))}var BP=new Yn("tag:yaml.org,2002:float",{kind:"scalar",resolve:G6,construct:X6,predicate:Z6,represent:Q6,defaultStyle:"lowercase"}),HP=$P.extend({implicit:[FP,DP,zP,BP]}),UP=HP,VP=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),WP=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 e9(e){return e===null?!1:VP.exec(e)!==null||WP.exec(e)!==null}function t9(e){var t,n,r,i,s,o,l,c=0,d=null,u,p,f;if(t=VP.exec(e),t===null&&(t=WP.exec(e)),t===null)throw new Error("Date resolve error");if(n=+t[1],r=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(n,r,i));if(s=+t[4],o=+t[5],l=+t[6],t[7]){for(c=t[7].slice(0,3);c.length<3;)c+="0";c=+c}return t[9]&&(u=+t[10],p=+(t[11]||0),d=(u*60+p)*6e4,t[9]==="-"&&(d=-d)),f=new Date(Date.UTC(n,r,i,s,o,l,c)),d&&f.setTime(f.getTime()-d),f}function n9(e){return e.toISOString()}var KP=new Yn("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:e9,construct:t9,instanceOf:Date,represent:n9});function r9(e){return e==="<<"||e===null}var qP=new Yn("tag:yaml.org,2002:merge",{kind:"scalar",resolve:r9}),vv=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
86
- \r`;function i9(e){if(e===null)return!1;var t,n,r=0,i=e.length,s=vv;for(n=0;n<i;n++)if(t=s.indexOf(e.charAt(n)),!(t>64)){if(t<0)return!1;r+=6}return r%8===0}function s9(e){var t,n,r=e.replace(/[\r\n=]/g,""),i=r.length,s=vv,o=0,l=[];for(t=0;t<i;t++)t%4===0&&t&&(l.push(o>>16&255),l.push(o>>8&255),l.push(o&255)),o=o<<6|s.indexOf(r.charAt(t));return n=i%4*6,n===0?(l.push(o>>16&255),l.push(o>>8&255),l.push(o&255)):n===18?(l.push(o>>10&255),l.push(o>>2&255)):n===12&&l.push(o>>4&255),new Uint8Array(l)}function o9(e){var t="",n=0,r,i,s=e.length,o=vv;for(r=0;r<s;r++)r%3===0&&r&&(t+=o[n>>18&63],t+=o[n>>12&63],t+=o[n>>6&63],t+=o[n&63]),n=(n<<8)+e[r];return i=s%3,i===0?(t+=o[n>>18&63],t+=o[n>>12&63],t+=o[n>>6&63],t+=o[n&63]):i===2?(t+=o[n>>10&63],t+=o[n>>4&63],t+=o[n<<2&63],t+=o[64]):i===1&&(t+=o[n>>2&63],t+=o[n<<4&63],t+=o[64],t+=o[64]),t}function a9(e){return Object.prototype.toString.call(e)==="[object Uint8Array]"}var YP=new Yn("tag:yaml.org,2002:binary",{kind:"scalar",resolve:i9,construct:s9,predicate:a9,represent:o9}),l9=Object.prototype.hasOwnProperty,c9=Object.prototype.toString;function u9(e){if(e===null)return!0;var t=[],n,r,i,s,o,l=e;for(n=0,r=l.length;n<r;n+=1){if(i=l[n],o=!1,c9.call(i)!=="[object Object]")return!1;for(s in i)if(l9.call(i,s))if(!o)o=!0;else return!1;if(!o)return!1;if(t.indexOf(s)===-1)t.push(s);else return!1}return!0}function d9(e){return e!==null?e:[]}var GP=new Yn("tag:yaml.org,2002:omap",{kind:"sequence",resolve:u9,construct:d9}),f9=Object.prototype.toString;function p9(e){if(e===null)return!0;var t,n,r,i,s,o=e;for(s=new Array(o.length),t=0,n=o.length;t<n;t+=1){if(r=o[t],f9.call(r)!=="[object Object]"||(i=Object.keys(r),i.length!==1))return!1;s[t]=[i[0],r[i[0]]]}return!0}function h9(e){if(e===null)return[];var t,n,r,i,s,o=e;for(s=new Array(o.length),t=0,n=o.length;t<n;t+=1)r=o[t],i=Object.keys(r),s[t]=[i[0],r[i[0]]];return s}var XP=new Yn("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:p9,construct:h9}),m9=Object.prototype.hasOwnProperty;function g9(e){if(e===null)return!0;var t,n=e;for(t in n)if(m9.call(n,t)&&n[t]!==null)return!1;return!0}function y9(e){return e!==null?e:{}}var JP=new Yn("tag:yaml.org,2002:set",{kind:"mapping",resolve:g9,construct:y9}),bv=UP.extend({implicit:[KP,qP],explicit:[YP,GP,XP,JP]}),Ho=Object.prototype.hasOwnProperty,ph=1,QP=2,ZP=3,hh=4,Dg=1,x9=2,$S=3,w9=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,v9=/[\x85\u2028\u2029]/,b9=/[,\[\]\{\}]/,eI=/^(?:!|!!|![a-z\-]+!)$/i,tI=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function FS(e){return Object.prototype.toString.call(e)}function ws(e){return e===10||e===13}function Ca(e){return e===9||e===32}function Or(e){return e===9||e===32||e===10||e===13}function Pl(e){return e===44||e===91||e===93||e===123||e===125}function k9(e){var t;return 48<=e&&e<=57?e-48:(t=e|32,97<=t&&t<=102?t-97+10:-1)}function S9(e){return e===120?2:e===117?4:e===85?8:0}function N9(e){return 48<=e&&e<=57?e-48:-1}function DS(e){return e===48?"\0":e===97?"\x07":e===98?"\b":e===116||e===9?" ":e===110?`
87
- `:e===118?"\v":e===102?"\f":e===114?"\r":e===101?"\x1B":e===32?" ":e===34?'"':e===47?"/":e===92?"\\":e===78?"…":e===95?" ":e===76?"\u2028":e===80?"\u2029":""}function j9(e){return e<=65535?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function nI(e,t,n){t==="__proto__"?Object.defineProperty(e,t,{configurable:!0,enumerable:!0,writable:!0,value:n}):e[t]=n}var rI=new Array(256),iI=new Array(256);for(var ll=0;ll<256;ll++)rI[ll]=DS(ll)?1:0,iI[ll]=DS(ll);function C9(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||bv,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function sI(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=I6(n),new br(t,n)}function Ue(e,t){throw sI(e,t)}function mh(e,t){e.onWarning&&e.onWarning.call(null,sI(e,t))}var zS={YAML:function(t,n,r){var i,s,o;t.version!==null&&Ue(t,"duplication of %YAML directive"),r.length!==1&&Ue(t,"YAML directive accepts exactly one argument"),i=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),i===null&&Ue(t,"ill-formed argument of the YAML directive"),s=parseInt(i[1],10),o=parseInt(i[2],10),s!==1&&Ue(t,"unacceptable YAML version of the document"),t.version=r[0],t.checkLineBreaks=o<2,o!==1&&o!==2&&mh(t,"unsupported YAML version of the document")},TAG:function(t,n,r){var i,s;r.length!==2&&Ue(t,"TAG directive accepts exactly two arguments"),i=r[0],s=r[1],eI.test(i)||Ue(t,"ill-formed tag handle (first argument) of the TAG directive"),Ho.call(t.tagMap,i)&&Ue(t,'there is a previously declared suffix for "'+i+'" tag handle'),tI.test(s)||Ue(t,"ill-formed tag prefix (second argument) of the TAG directive");try{s=decodeURIComponent(s)}catch{Ue(t,"tag prefix is malformed: "+s)}t.tagMap[i]=s}};function Fo(e,t,n,r){var i,s,o,l;if(t<n){if(l=e.input.slice(t,n),r)for(i=0,s=l.length;i<s;i+=1)o=l.charCodeAt(i),o===9||32<=o&&o<=1114111||Ue(e,"expected valid JSON character");else w9.test(l)&&Ue(e,"the stream contains non-printable characters");e.result+=l}}function BS(e,t,n,r){var i,s,o,l;for(Rn.isObject(n)||Ue(e,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(n),o=0,l=i.length;o<l;o+=1)s=i[o],Ho.call(t,s)||(nI(t,s,n[s]),r[s]=!0)}function Il(e,t,n,r,i,s,o,l,c){var d,u;if(Array.isArray(i))for(i=Array.prototype.slice.call(i),d=0,u=i.length;d<u;d+=1)Array.isArray(i[d])&&Ue(e,"nested arrays are not supported inside keys"),typeof i=="object"&&FS(i[d])==="[object Object]"&&(i[d]="[object Object]");if(typeof i=="object"&&FS(i)==="[object Object]"&&(i="[object Object]"),i=String(i),t===null&&(t={}),r==="tag:yaml.org,2002:merge")if(Array.isArray(s))for(d=0,u=s.length;d<u;d+=1)BS(e,t,s[d],n);else BS(e,t,s,n);else!e.json&&!Ho.call(n,i)&&Ho.call(t,i)&&(e.line=o||e.line,e.lineStart=l||e.lineStart,e.position=c||e.position,Ue(e,"duplicated mapping key")),nI(t,i,s),delete n[i];return t}function kv(e){var t;t=e.input.charCodeAt(e.position),t===10?e.position++:t===13?(e.position++,e.input.charCodeAt(e.position)===10&&e.position++):Ue(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function kn(e,t,n){for(var r=0,i=e.input.charCodeAt(e.position);i!==0;){for(;Ca(i);)i===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),i=e.input.charCodeAt(++e.position);if(t&&i===35)do i=e.input.charCodeAt(++e.position);while(i!==10&&i!==13&&i!==0);if(ws(i))for(kv(e),i=e.input.charCodeAt(e.position),r++,e.lineIndent=0;i===32;)e.lineIndent++,i=e.input.charCodeAt(++e.position);else break}return n!==-1&&r!==0&&e.lineIndent<n&&mh(e,"deficient indentation"),r}function lm(e){var t=e.position,n;return n=e.input.charCodeAt(t),!!((n===45||n===46)&&n===e.input.charCodeAt(t+1)&&n===e.input.charCodeAt(t+2)&&(t+=3,n=e.input.charCodeAt(t),n===0||Or(n)))}function Sv(e,t){t===1?e.result+=" ":t>1&&(e.result+=Rn.repeat(`
88
- `,t-1))}function E9(e,t,n){var r,i,s,o,l,c,d,u,p=e.kind,f=e.result,h;if(h=e.input.charCodeAt(e.position),Or(h)||Pl(h)||h===35||h===38||h===42||h===33||h===124||h===62||h===39||h===34||h===37||h===64||h===96||(h===63||h===45)&&(i=e.input.charCodeAt(e.position+1),Or(i)||n&&Pl(i)))return!1;for(e.kind="scalar",e.result="",s=o=e.position,l=!1;h!==0;){if(h===58){if(i=e.input.charCodeAt(e.position+1),Or(i)||n&&Pl(i))break}else if(h===35){if(r=e.input.charCodeAt(e.position-1),Or(r))break}else{if(e.position===e.lineStart&&lm(e)||n&&Pl(h))break;if(ws(h))if(c=e.line,d=e.lineStart,u=e.lineIndent,kn(e,!1,-1),e.lineIndent>=t){l=!0,h=e.input.charCodeAt(e.position);continue}else{e.position=o,e.line=c,e.lineStart=d,e.lineIndent=u;break}}l&&(Fo(e,s,o,!1),Sv(e,e.line-c),s=o=e.position,l=!1),Ca(h)||(o=e.position+1),h=e.input.charCodeAt(++e.position)}return Fo(e,s,o,!1),e.result?!0:(e.kind=p,e.result=f,!1)}function _9(e,t){var n,r,i;if(n=e.input.charCodeAt(e.position),n!==39)return!1;for(e.kind="scalar",e.result="",e.position++,r=i=e.position;(n=e.input.charCodeAt(e.position))!==0;)if(n===39)if(Fo(e,r,e.position,!0),n=e.input.charCodeAt(++e.position),n===39)r=e.position,e.position++,i=e.position;else return!0;else ws(n)?(Fo(e,r,i,!0),Sv(e,kn(e,!1,t)),r=i=e.position):e.position===e.lineStart&&lm(e)?Ue(e,"unexpected end of the document within a single quoted scalar"):(e.position++,i=e.position);Ue(e,"unexpected end of the stream within a single quoted scalar")}function P9(e,t){var n,r,i,s,o,l;if(l=e.input.charCodeAt(e.position),l!==34)return!1;for(e.kind="scalar",e.result="",e.position++,n=r=e.position;(l=e.input.charCodeAt(e.position))!==0;){if(l===34)return Fo(e,n,e.position,!0),e.position++,!0;if(l===92){if(Fo(e,n,e.position,!0),l=e.input.charCodeAt(++e.position),ws(l))kn(e,!1,t);else if(l<256&&rI[l])e.result+=iI[l],e.position++;else if((o=S9(l))>0){for(i=o,s=0;i>0;i--)l=e.input.charCodeAt(++e.position),(o=k9(l))>=0?s=(s<<4)+o:Ue(e,"expected hexadecimal character");e.result+=j9(s),e.position++}else Ue(e,"unknown escape sequence");n=r=e.position}else ws(l)?(Fo(e,n,r,!0),Sv(e,kn(e,!1,t)),n=r=e.position):e.position===e.lineStart&&lm(e)?Ue(e,"unexpected end of the document within a double quoted scalar"):(e.position++,r=e.position)}Ue(e,"unexpected end of the stream within a double quoted scalar")}function I9(e,t){var n=!0,r,i,s,o=e.tag,l,c=e.anchor,d,u,p,f,h,y=Object.create(null),b,S,g,v;if(v=e.input.charCodeAt(e.position),v===91)u=93,h=!1,l=[];else if(v===123)u=125,h=!0,l={};else return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=l),v=e.input.charCodeAt(++e.position);v!==0;){if(kn(e,!0,t),v=e.input.charCodeAt(e.position),v===u)return e.position++,e.tag=o,e.anchor=c,e.kind=h?"mapping":"sequence",e.result=l,!0;n?v===44&&Ue(e,"expected the node content, but found ','"):Ue(e,"missed comma between flow collection entries"),S=b=g=null,p=f=!1,v===63&&(d=e.input.charCodeAt(e.position+1),Or(d)&&(p=f=!0,e.position++,kn(e,!0,t))),r=e.line,i=e.lineStart,s=e.position,oc(e,t,ph,!1,!0),S=e.tag,b=e.result,kn(e,!0,t),v=e.input.charCodeAt(e.position),(f||e.line===r)&&v===58&&(p=!0,v=e.input.charCodeAt(++e.position),kn(e,!0,t),oc(e,t,ph,!1,!0),g=e.result),h?Il(e,l,y,S,b,g,r,i,s):p?l.push(Il(e,null,y,S,b,g,r,i,s)):l.push(b),kn(e,!0,t),v=e.input.charCodeAt(e.position),v===44?(n=!0,v=e.input.charCodeAt(++e.position)):n=!1}Ue(e,"unexpected end of the stream within a flow collection")}function A9(e,t){var n,r,i=Dg,s=!1,o=!1,l=t,c=0,d=!1,u,p;if(p=e.input.charCodeAt(e.position),p===124)r=!1;else if(p===62)r=!0;else return!1;for(e.kind="scalar",e.result="";p!==0;)if(p=e.input.charCodeAt(++e.position),p===43||p===45)Dg===i?i=p===43?$S:x9:Ue(e,"repeat of a chomping mode identifier");else if((u=N9(p))>=0)u===0?Ue(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):o?Ue(e,"repeat of an indentation width identifier"):(l=t+u-1,o=!0);else break;if(Ca(p)){do p=e.input.charCodeAt(++e.position);while(Ca(p));if(p===35)do p=e.input.charCodeAt(++e.position);while(!ws(p)&&p!==0)}for(;p!==0;){for(kv(e),e.lineIndent=0,p=e.input.charCodeAt(e.position);(!o||e.lineIndent<l)&&p===32;)e.lineIndent++,p=e.input.charCodeAt(++e.position);if(!o&&e.lineIndent>l&&(l=e.lineIndent),ws(p)){c++;continue}if(e.lineIndent<l){i===$S?e.result+=Rn.repeat(`
89
- `,s?1+c:c):i===Dg&&s&&(e.result+=`
90
- `);break}for(r?Ca(p)?(d=!0,e.result+=Rn.repeat(`
91
- `,s?1+c:c)):d?(d=!1,e.result+=Rn.repeat(`
92
- `,c+1)):c===0?s&&(e.result+=" "):e.result+=Rn.repeat(`
93
- `,c):e.result+=Rn.repeat(`
94
- `,s?1+c:c),s=!0,o=!0,c=0,n=e.position;!ws(p)&&p!==0;)p=e.input.charCodeAt(++e.position);Fo(e,n,e.position,!1)}return!0}function HS(e,t){var n,r=e.tag,i=e.anchor,s=[],o,l=!1,c;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=s),c=e.input.charCodeAt(e.position);c!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,Ue(e,"tab characters must not be used in indentation")),!(c!==45||(o=e.input.charCodeAt(e.position+1),!Or(o))));){if(l=!0,e.position++,kn(e,!0,-1)&&e.lineIndent<=t){s.push(null),c=e.input.charCodeAt(e.position);continue}if(n=e.line,oc(e,t,ZP,!1,!0),s.push(e.result),kn(e,!0,-1),c=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&c!==0)Ue(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return l?(e.tag=r,e.anchor=i,e.kind="sequence",e.result=s,!0):!1}function T9(e,t,n){var r,i,s,o,l,c,d=e.tag,u=e.anchor,p={},f=Object.create(null),h=null,y=null,b=null,S=!1,g=!1,v;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=p),v=e.input.charCodeAt(e.position);v!==0;){if(!S&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,Ue(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),s=e.line,(v===63||v===58)&&Or(r))v===63?(S&&(Il(e,p,f,h,y,null,o,l,c),h=y=b=null),g=!0,S=!0,i=!0):S?(S=!1,i=!0):Ue(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,v=r;else{if(o=e.line,l=e.lineStart,c=e.position,!oc(e,n,QP,!1,!0))break;if(e.line===s){for(v=e.input.charCodeAt(e.position);Ca(v);)v=e.input.charCodeAt(++e.position);if(v===58)v=e.input.charCodeAt(++e.position),Or(v)||Ue(e,"a whitespace character is expected after the key-value separator within a block mapping"),S&&(Il(e,p,f,h,y,null,o,l,c),h=y=b=null),g=!0,S=!1,i=!1,h=e.tag,y=e.result;else if(g)Ue(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=d,e.anchor=u,!0}else if(g)Ue(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=d,e.anchor=u,!0}if((e.line===s||e.lineIndent>t)&&(S&&(o=e.line,l=e.lineStart,c=e.position),oc(e,t,hh,!0,i)&&(S?y=e.result:b=e.result),S||(Il(e,p,f,h,y,b,o,l,c),h=y=b=null),kn(e,!0,-1),v=e.input.charCodeAt(e.position)),(e.line===s||e.lineIndent>t)&&v!==0)Ue(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return S&&Il(e,p,f,h,y,null,o,l,c),g&&(e.tag=d,e.anchor=u,e.kind="mapping",e.result=p),g}function R9(e){var t,n=!1,r=!1,i,s,o;if(o=e.input.charCodeAt(e.position),o!==33)return!1;if(e.tag!==null&&Ue(e,"duplication of a tag property"),o=e.input.charCodeAt(++e.position),o===60?(n=!0,o=e.input.charCodeAt(++e.position)):o===33?(r=!0,i="!!",o=e.input.charCodeAt(++e.position)):i="!",t=e.position,n){do o=e.input.charCodeAt(++e.position);while(o!==0&&o!==62);e.position<e.length?(s=e.input.slice(t,e.position),o=e.input.charCodeAt(++e.position)):Ue(e,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!Or(o);)o===33&&(r?Ue(e,"tag suffix cannot contain exclamation marks"):(i=e.input.slice(t-1,e.position+1),eI.test(i)||Ue(e,"named tag handle cannot contain such characters"),r=!0,t=e.position+1)),o=e.input.charCodeAt(++e.position);s=e.input.slice(t,e.position),b9.test(s)&&Ue(e,"tag suffix cannot contain flow indicator characters")}s&&!tI.test(s)&&Ue(e,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{Ue(e,"tag name is malformed: "+s)}return n?e.tag=s:Ho.call(e.tagMap,i)?e.tag=e.tagMap[i]+s:i==="!"?e.tag="!"+s:i==="!!"?e.tag="tag:yaml.org,2002:"+s:Ue(e,'undeclared tag handle "'+i+'"'),!0}function L9(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&Ue(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!Or(n)&&!Pl(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&Ue(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function O9(e){var t,n,r;if(r=e.input.charCodeAt(e.position),r!==42)return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!Or(r)&&!Pl(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&Ue(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),Ho.call(e.anchorMap,n)||Ue(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],kn(e,!0,-1),!0}function oc(e,t,n,r,i){var s,o,l,c=1,d=!1,u=!1,p,f,h,y,b,S;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,s=o=l=hh===n||ZP===n,r&&kn(e,!0,-1)&&(d=!0,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)),c===1)for(;R9(e)||L9(e);)kn(e,!0,-1)?(d=!0,l=s,e.lineIndent>t?c=1:e.lineIndent===t?c=0:e.lineIndent<t&&(c=-1)):l=!1;if(l&&(l=d||i),(c===1||hh===n)&&(ph===n||QP===n?b=t:b=t+1,S=e.position-e.lineStart,c===1?l&&(HS(e,S)||T9(e,S,b))||I9(e,b)?u=!0:(o&&A9(e,b)||_9(e,b)||P9(e,b)?u=!0:O9(e)?(u=!0,(e.tag!==null||e.anchor!==null)&&Ue(e,"alias node should not have any properties")):E9(e,b,ph===n)&&(u=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):c===0&&(u=l&&HS(e,S))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&Ue(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),p=0,f=e.implicitTypes.length;p<f;p+=1)if(y=e.implicitTypes[p],y.resolve(e.result)){e.result=y.construct(e.result),e.tag=y.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(Ho.call(e.typeMap[e.kind||"fallback"],e.tag))y=e.typeMap[e.kind||"fallback"][e.tag];else for(y=null,h=e.typeMap.multi[e.kind||"fallback"],p=0,f=h.length;p<f;p+=1)if(e.tag.slice(0,h[p].tag.length)===h[p].tag){y=h[p];break}y||Ue(e,"unknown tag !<"+e.tag+">"),e.result!==null&&y.kind!==e.kind&&Ue(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+y.kind+'", not "'+e.kind+'"'),y.resolve(e.result,e.tag)?(e.result=y.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):Ue(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||u}function M9(e){var t=e.position,n,r,i,s=!1,o;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(o=e.input.charCodeAt(e.position))!==0&&(kn(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||o!==37));){for(s=!0,o=e.input.charCodeAt(++e.position),n=e.position;o!==0&&!Or(o);)o=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),i=[],r.length<1&&Ue(e,"directive name must not be less than one character in length");o!==0;){for(;Ca(o);)o=e.input.charCodeAt(++e.position);if(o===35){do o=e.input.charCodeAt(++e.position);while(o!==0&&!ws(o));break}if(ws(o))break;for(n=e.position;o!==0&&!Or(o);)o=e.input.charCodeAt(++e.position);i.push(e.input.slice(n,e.position))}o!==0&&kv(e),Ho.call(zS,r)?zS[r](e,r,i):mh(e,'unknown document directive "'+r+'"')}if(kn(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,kn(e,!0,-1)):s&&Ue(e,"directives end mark is expected"),oc(e,e.lineIndent-1,hh,!1,!0),kn(e,!0,-1),e.checkLineBreaks&&v9.test(e.input.slice(t,e.position))&&mh(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&lm(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,kn(e,!0,-1));return}if(e.position<e.length-1)Ue(e,"end of the stream or a document separator is expected");else return}function oI(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
95
- `),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new C9(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,Ue(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)M9(n);return n.documents}function $9(e,t,n){t!==null&&typeof t=="object"&&typeof n>"u"&&(n=t,t=null);var r=oI(e,n);if(typeof t!="function")return r;for(var i=0,s=r.length;i<s;i+=1)t(r[i])}function F9(e,t){var n=oI(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new br("expected a single document in the stream, but found more")}}var D9=$9,z9=F9,aI={loadAll:D9,load:z9},lI=Object.prototype.toString,cI=Object.prototype.hasOwnProperty,Nv=65279,B9=9,cd=10,H9=13,U9=32,V9=33,W9=34,Px=35,K9=37,q9=38,Y9=39,G9=42,uI=44,X9=45,gh=58,J9=61,Q9=62,Z9=63,eU=64,dI=91,fI=93,tU=96,pI=123,nU=124,hI=125,dr={};dr[0]="\\0";dr[7]="\\a";dr[8]="\\b";dr[9]="\\t";dr[10]="\\n";dr[11]="\\v";dr[12]="\\f";dr[13]="\\r";dr[27]="\\e";dr[34]='\\"';dr[92]="\\\\";dr[133]="\\N";dr[160]="\\_";dr[8232]="\\L";dr[8233]="\\P";var rU=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],iU=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function sU(e,t){var n,r,i,s,o,l,c;if(t===null)return{};for(n={},r=Object.keys(t),i=0,s=r.length;i<s;i+=1)o=r[i],l=String(t[o]),o.slice(0,2)==="!!"&&(o="tag:yaml.org,2002:"+o.slice(2)),c=e.compiledTypeMap.fallback[o],c&&cI.call(c.styleAliases,l)&&(l=c.styleAliases[l]),n[o]=l;return n}function oU(e){var t,n,r;if(t=e.toString(16).toUpperCase(),e<=255)n="x",r=2;else if(e<=65535)n="u",r=4;else if(e<=4294967295)n="U",r=8;else throw new br("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+Rn.repeat("0",r-t.length)+t}var aU=1,ud=2;function lU(e){this.schema=e.schema||bv,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=Rn.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=sU(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType=e.quotingType==='"'?ud:aU,this.forceQuotes=e.forceQuotes||!1,this.replacer=typeof e.replacer=="function"?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function US(e,t){for(var n=Rn.repeat(" ",t),r=0,i=-1,s="",o,l=e.length;r<l;)i=e.indexOf(`
96
- `,r),i===-1?(o=e.slice(r),r=l):(o=e.slice(r,i+1),r=i+1),o.length&&o!==`
97
- `&&(s+=n),s+=o;return s}function Ix(e,t){return`
98
- `+Rn.repeat(" ",e.indent*t)}function cU(e,t){var n,r,i;for(n=0,r=e.implicitTypes.length;n<r;n+=1)if(i=e.implicitTypes[n],i.resolve(t))return!0;return!1}function yh(e){return e===U9||e===B9}function dd(e){return 32<=e&&e<=126||161<=e&&e<=55295&&e!==8232&&e!==8233||57344<=e&&e<=65533&&e!==Nv||65536<=e&&e<=1114111}function VS(e){return dd(e)&&e!==Nv&&e!==H9&&e!==cd}function WS(e,t,n){var r=VS(e),i=r&&!yh(e);return(n?r:r&&e!==uI&&e!==dI&&e!==fI&&e!==pI&&e!==hI)&&e!==Px&&!(t===gh&&!i)||VS(t)&&!yh(t)&&e===Px||t===gh&&i}function uU(e){return dd(e)&&e!==Nv&&!yh(e)&&e!==X9&&e!==Z9&&e!==gh&&e!==uI&&e!==dI&&e!==fI&&e!==pI&&e!==hI&&e!==Px&&e!==q9&&e!==G9&&e!==V9&&e!==nU&&e!==J9&&e!==Q9&&e!==Y9&&e!==W9&&e!==K9&&e!==eU&&e!==tU}function dU(e){return!yh(e)&&e!==gh}function du(e,t){var n=e.charCodeAt(t),r;return n>=55296&&n<=56319&&t+1<e.length&&(r=e.charCodeAt(t+1),r>=56320&&r<=57343)?(n-55296)*1024+r-56320+65536:n}function mI(e){var t=/^\n* /;return t.test(e)}var gI=1,Ax=2,yI=3,xI=4,fl=5;function fU(e,t,n,r,i,s,o,l){var c,d=0,u=null,p=!1,f=!1,h=r!==-1,y=-1,b=uU(du(e,0))&&dU(du(e,e.length-1));if(t||o)for(c=0;c<e.length;d>=65536?c+=2:c++){if(d=du(e,c),!dd(d))return fl;b=b&&WS(d,u,l),u=d}else{for(c=0;c<e.length;d>=65536?c+=2:c++){if(d=du(e,c),d===cd)p=!0,h&&(f=f||c-y-1>r&&e[y+1]!==" ",y=c);else if(!dd(d))return fl;b=b&&WS(d,u,l),u=d}f=f||h&&c-y-1>r&&e[y+1]!==" "}return!p&&!f?b&&!o&&!i(e)?gI:s===ud?fl:Ax:n>9&&mI(e)?fl:o?s===ud?fl:Ax:f?xI:yI}function pU(e,t,n,r,i){e.dump=function(){if(t.length===0)return e.quotingType===ud?'""':"''";if(!e.noCompatMode&&(rU.indexOf(t)!==-1||iU.test(t)))return e.quotingType===ud?'"'+t+'"':"'"+t+"'";var s=e.indent*Math.max(1,n),o=e.lineWidth===-1?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-s),l=r||e.flowLevel>-1&&n>=e.flowLevel;function c(d){return cU(e,d)}switch(fU(t,l,e.indent,o,c,e.quotingType,e.forceQuotes&&!r,i)){case gI:return t;case Ax:return"'"+t.replace(/'/g,"''")+"'";case yI:return"|"+KS(t,e.indent)+qS(US(t,s));case xI:return">"+KS(t,e.indent)+qS(US(hU(t,o),s));case fl:return'"'+mU(t)+'"';default:throw new br("impossible error: invalid scalar style")}}()}function KS(e,t){var n=mI(e)?String(t):"",r=e[e.length-1]===`
99
- `,i=r&&(e[e.length-2]===`
100
- `||e===`
101
- `),s=i?"+":r?"":"-";return n+s+`
102
- `}function qS(e){return e[e.length-1]===`
103
- `?e.slice(0,-1):e}function hU(e,t){for(var n=/(\n+)([^\n]*)/g,r=function(){var d=e.indexOf(`
104
- `);return d=d!==-1?d:e.length,n.lastIndex=d,YS(e.slice(0,d),t)}(),i=e[0]===`
105
- `||e[0]===" ",s,o;o=n.exec(e);){var l=o[1],c=o[2];s=c[0]===" ",r+=l+(!i&&!s&&c!==""?`
106
- `:"")+YS(c,t),i=s}return r}function YS(e,t){if(e===""||e[0]===" ")return e;for(var n=/ [^ ]/g,r,i=0,s,o=0,l=0,c="";r=n.exec(e);)l=r.index,l-i>t&&(s=o>i?o:l,c+=`
107
- `+e.slice(i,s),i=s+1),o=l;return c+=`
108
- `,e.length-i>t&&o>i?c+=e.slice(i,o)+`
109
- `+e.slice(o+1):c+=e.slice(i),c.slice(1)}function mU(e){for(var t="",n=0,r,i=0;i<e.length;n>=65536?i+=2:i++)n=du(e,i),r=dr[n],!r&&dd(n)?(t+=e[i],n>=65536&&(t+=e[i+1])):t+=r||oU(n);return t}function gU(e,t,n){var r="",i=e.tag,s,o,l;for(s=0,o=n.length;s<o;s+=1)l=n[s],e.replacer&&(l=e.replacer.call(n,String(s),l)),(Xs(e,t,l,!1,!1)||typeof l>"u"&&Xs(e,t,null,!1,!1))&&(r!==""&&(r+=","+(e.condenseFlow?"":" ")),r+=e.dump);e.tag=i,e.dump="["+r+"]"}function GS(e,t,n,r){var i="",s=e.tag,o,l,c;for(o=0,l=n.length;o<l;o+=1)c=n[o],e.replacer&&(c=e.replacer.call(n,String(o),c)),(Xs(e,t+1,c,!0,!0,!1,!0)||typeof c>"u"&&Xs(e,t+1,null,!0,!0,!1,!0))&&((!r||i!=="")&&(i+=Ix(e,t)),e.dump&&cd===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=s,e.dump=i||"[]"}function yU(e,t,n){var r="",i=e.tag,s=Object.keys(n),o,l,c,d,u;for(o=0,l=s.length;o<l;o+=1)u="",r!==""&&(u+=", "),e.condenseFlow&&(u+='"'),c=s[o],d=n[c],e.replacer&&(d=e.replacer.call(n,c,d)),Xs(e,t,c,!1,!1)&&(e.dump.length>1024&&(u+="? "),u+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Xs(e,t,d,!1,!1)&&(u+=e.dump,r+=u));e.tag=i,e.dump="{"+r+"}"}function xU(e,t,n,r){var i="",s=e.tag,o=Object.keys(n),l,c,d,u,p,f;if(e.sortKeys===!0)o.sort();else if(typeof e.sortKeys=="function")o.sort(e.sortKeys);else if(e.sortKeys)throw new br("sortKeys must be a boolean or a function");for(l=0,c=o.length;l<c;l+=1)f="",(!r||i!=="")&&(f+=Ix(e,t)),d=o[l],u=n[d],e.replacer&&(u=e.replacer.call(n,d,u)),Xs(e,t+1,d,!0,!0,!0)&&(p=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,p&&(e.dump&&cd===e.dump.charCodeAt(0)?f+="?":f+="? "),f+=e.dump,p&&(f+=Ix(e,t)),Xs(e,t+1,u,!0,p)&&(e.dump&&cd===e.dump.charCodeAt(0)?f+=":":f+=": ",f+=e.dump,i+=f));e.tag=s,e.dump=i||"{}"}function XS(e,t,n){var r,i,s,o,l,c;for(i=n?e.explicitTypes:e.implicitTypes,s=0,o=i.length;s<o;s+=1)if(l=i[s],(l.instanceOf||l.predicate)&&(!l.instanceOf||typeof t=="object"&&t instanceof l.instanceOf)&&(!l.predicate||l.predicate(t))){if(n?l.multi&&l.representName?e.tag=l.representName(t):e.tag=l.tag:e.tag="?",l.represent){if(c=e.styleMap[l.tag]||l.defaultStyle,lI.call(l.represent)==="[object Function]")r=l.represent(t,c);else if(cI.call(l.represent,c))r=l.represent[c](t,c);else throw new br("!<"+l.tag+'> tag resolver accepts not "'+c+'" style');e.dump=r}return!0}return!1}function Xs(e,t,n,r,i,s,o){e.tag=null,e.dump=n,XS(e,n,!1)||XS(e,n,!0);var l=lI.call(e.dump),c=r,d;r&&(r=e.flowLevel<0||e.flowLevel>t);var u=l==="[object Object]"||l==="[object Array]",p,f;if(u&&(p=e.duplicates.indexOf(n),f=p!==-1),(e.tag!==null&&e.tag!=="?"||f||e.indent!==2&&t>0)&&(i=!1),f&&e.usedDuplicates[p])e.dump="*ref_"+p;else{if(u&&f&&!e.usedDuplicates[p]&&(e.usedDuplicates[p]=!0),l==="[object Object]")r&&Object.keys(e.dump).length!==0?(xU(e,t,e.dump,i),f&&(e.dump="&ref_"+p+e.dump)):(yU(e,t,e.dump),f&&(e.dump="&ref_"+p+" "+e.dump));else if(l==="[object Array]")r&&e.dump.length!==0?(e.noArrayIndent&&!o&&t>0?GS(e,t-1,e.dump,i):GS(e,t,e.dump,i),f&&(e.dump="&ref_"+p+e.dump)):(gU(e,t,e.dump),f&&(e.dump="&ref_"+p+" "+e.dump));else if(l==="[object String]")e.tag!=="?"&&pU(e,e.dump,t,s,c);else{if(l==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new br("unacceptable kind of an object to dump "+l)}e.tag!==null&&e.tag!=="?"&&(d=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?d="!"+d:d.slice(0,18)==="tag:yaml.org,2002:"?d="!!"+d.slice(18):d="!<"+d+">",e.dump=d+" "+e.dump)}return!0}function wU(e,t){var n=[],r=[],i,s;for(Tx(e,n,r),i=0,s=r.length;i<s;i+=1)t.duplicates.push(n[r[i]]);t.usedDuplicates=new Array(s)}function Tx(e,t,n){var r,i,s;if(e!==null&&typeof e=="object")if(i=t.indexOf(e),i!==-1)n.indexOf(i)===-1&&n.push(i);else if(t.push(e),Array.isArray(e))for(i=0,s=e.length;i<s;i+=1)Tx(e[i],t,n);else for(r=Object.keys(e),i=0,s=r.length;i<s;i+=1)Tx(e[r[i]],t,n)}function vU(e,t){t=t||{};var n=new lU(t);n.noRefs||wU(e,n);var r=e;return n.replacer&&(r=n.replacer.call({"":r},"",r)),Xs(n,0,r,!0,!0)?n.dump+`
110
- `:""}var bU=vU,kU={dump:bU};function jv(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var SU=Yn,NU=RP,jU=$P,CU=HP,EU=UP,_U=bv,PU=aI.load,IU=aI.loadAll,AU=kU.dump,TU=br,RU={binary:YP,float:BP,map:MP,null:FP,pairs:XP,set:JP,timestamp:KP,bool:DP,int:zP,merge:qP,omap:GP,seq:OP,str:LP},LU=jv("safeLoad","load"),OU=jv("safeLoadAll","loadAll"),MU=jv("safeDump","dump"),wI={Type:SU,Schema:NU,FAILSAFE_SCHEMA:jU,JSON_SCHEMA:CU,CORE_SCHEMA:EU,DEFAULT_SCHEMA:_U,load:PU,loadAll:IU,dump:AU,YAMLException:TU,types:RU,safeLoad:LU,safeLoadAll:OU,safeDump:MU};const Uo=["requirement","planning","code","test","normal"],Rx={普通:"normal",技术规划:"planning",代码执行:"code",测试回归:"test",需求拆解:"requirement"},$U=["agent","control","provide","condition","jump","condition_jump","start","end"];function FU(e){return $U.includes(e)?e:"agent"}function DU(e){const t=(e||"").toLowerCase();return t.startsWith("control_")?"control":t.startsWith("agent_")?"agent":t.startsWith("provide_")?"provide":(t.startsWith("tool_"),"agent")}function zU(e){var t;if(!(e!=null&&e.trim()))return{nodes:[],edges:[],instances:{}};try{const n=wI.load(e);if(!n||typeof n!="object")return{error:"flow.yaml 格式无效:根内容不是对象"};const r=n,i=r.instances&&typeof r.instances=="object"?r.instances:{},s=Array.isArray(r.edges)?r.edges:Array.isArray((t=r.flow)==null?void 0:t.edges)?r.flow.edges:[],o=r.ui&&typeof r.ui=="object"?r.ui:{},l=o.nodePositions&&typeof o.nodePositions=="object"?o.nodePositions:{},c=typeof o.description=="string"&&o.description.trim()?o.description.trim():void 0,d=new Set(Object.keys(i));for(const f of s)f!=null&&f.source&&d.add(String(f.source)),f!=null&&f.target&&d.add(String(f.target));const u=Array.from(d).map(f=>{const h=i[f],y=l[f]&&typeof l[f].x=="number"&&typeof l[f].y=="number"?{x:l[f].x,y:l[f].y}:{x:0,y:0},b=(h==null?void 0:h.definitionId)??f,S=DU(b),g=(h==null?void 0:h.label)!=null?String(h.label):f,v=(h==null?void 0:h.role)!=null?String(h.role).trim():"",w=Rx[v]||v,k=Uo.includes(w)?w:"normal",E=(h==null?void 0:h.model)!=null?String(h.model).trim():void 0,j=(h==null?void 0:h.body)!=null?String(h.body):"",P=(h==null?void 0:h.script)!=null?String(h.script):"";return{id:f,type:FU(S),position:y,data:{label:g,definitionId:b,schemaType:S,role:k,model:E||void 0,body:j,...P.trim()!==""?{script:P}:{}}}}),p=s.filter(f=>(f==null?void 0:f.source)&&(f==null?void 0:f.target)).map((f,h)=>({id:`e-${f.source}-${f.target}-${h}`,source:String(f.source),target:String(f.target),sourceHandle:f.sourceHandle??void 0,targetHandle:f.targetHandle??void 0,markerEnd:{type:zr.ArrowClosed}}));return{nodes:u,edges:p,instances:i,description:c}}catch(n){const r=n instanceof Error?n.message:String(n);let i="";if(/bad indentation of a mapping entry|expected.*scalar|mapping values are not allowed/i.test(r)){const s=r.match(/\((\d+):/);i=`
111
-
112
- 💡 提示:通常由 ${s?`第 ${s[1]} 行附近`:""}的 \`script\` / \`body\` / \`value\` 字段裸写命令字符串引起。
113
- YAML 中含 \`: \`、\`"\`、\`'\` 等特殊字符的多行字符串必须使用 \`|\` 块标量。
114
-
115
- ✅ 正确写法:
116
- \`\`\`yaml
117
- script: |
118
- node -e "console.log('TODO: scripts/x.mjs')"
119
- \`\`\`
120
- ❌ 错误写法(当前文件):
121
- \`\`\`yaml
122
- script: node -e "console.log('TODO: scripts/x.mjs')"
123
- \`\`\``}return{error:`flow.yaml 解析失败:${r}${i}`}}}function cm(e,t){var i,s,o,l,c,d,u,p;const n=f=>{const h={type:(f==null?void 0:f.type)??"node",name:(f==null?void 0:f.name)??"",value:(f==null?void 0:f.value)??(f==null?void 0:f.default)??""};return(f==null?void 0:f.required)===!0&&(h.required=!0),(f==null?void 0:f.showOnNode)!=null&&(h.showOnNode=!!f.showOnNode),h},r={};for(const f of e){const h=t[f.id]&&typeof t[f.id]=="object"?{...t[f.id]}:{},y=((i=f.data)==null?void 0:i.definitionId)||f.id,b=((s=f.data)==null?void 0:s.inputs)??[],S=((o=f.data)==null?void 0:o.outputs)??[],g=((l=f.data)==null?void 0:l.role)!=null?String(f.data.role).trim():"",v=h.role!=null?String(h.role).trim():"",w=Rx[g]||g,k=Rx[v]||v,E=Uo.includes(w)?w:Uo.includes(k)?k:"normal",j=Array.isArray(b)?b.map(n):Array.isArray(h.input)?h.input.map(H=>n(H)):[],P=Array.isArray(S)?S.map(n):Array.isArray(h.output)?h.output.map(H=>n(H)):[],O=((c=f.data)==null?void 0:c.label)!=null?String(f.data.label):h.label!=null?String(h.label):f.id,F=(d=f.data)==null?void 0:d.body,W=F!=null?String(F):h.body!=null?String(h.body):"";let R=((u=f.data)==null?void 0:u.model)!=null&&String(f.data.model).trim()!==""?String(f.data.model).trim():h.model!=null&&String(h.model).trim()!==""?String(h.model).trim():void 0;(R===""||R==="default")&&(R=void 0);const I={...h,definitionId:y,label:O,role:E,model:R,input:j,output:P};W.trim()===""?delete I.body:I.body=W;const q=(p=f.data)==null?void 0:p.script,$=q!=null?String(q):h.script!=null?String(h.script):"";$.trim()===""?delete I.script:I.script=$,delete I.temperature,delete I.maxTokens,delete I.description,r[f.id]=I}return r}function JS(e,t,n,r){const i=cm(e,n),s=t.map(d=>({source:d.source,target:d.target,sourceHandle:d.sourceHandle??null,targetHandle:d.targetHandle??null})),o={};for(const d of e){const u=d.position??{x:0,y:0};o[d.id]={x:u.x,y:u.y}}const l={nodePositions:o};(r==null?void 0:r.description)!=null&&String(r.description).trim()!==""&&(l.description=String(r.description).trim());const c={instances:i,edges:s,ui:l};return wI.dump(c,{lineWidth:-1})}function BU(e){var i,s;const t={inputNames:[],outputNames:[]},n=Array.isArray((i=e.data)==null?void 0:i.inputs)?e.data.inputs:[],r=Array.isArray((s=e.data)==null?void 0:s.outputs)?e.data.outputs:[];for(let o=0;o<n.length;o++){const l=n[o],c=(l&&l.name!=null?String(l.name).trim():"")||`input-${o}`;t.inputNames.push(c)}for(let o=0;o<r.length;o++){const l=r[o],c=(l&&l.name!=null?String(l.name).trim():"")||`output-${o}`;t.outputNames.push(c)}return t}function HU(e,t,n){var c,d,u;const r=new Set(e.map(p=>p.id)),i={};for(const p of e)i[p.id]=BU(p);const s=new Map,o=new Map;for(const p of t)p.target&&r.has(p.target)&&(s.has(p.target)||s.set(p.target,new Set),p.targetHandle&&s.get(p.target).add(p.targetHandle)),p.source&&r.has(p.source)&&(o.has(p.source)||o.set(p.source,new Set),p.sourceHandle&&o.get(p.source).add(p.sourceHandle));const l=[];for(const p of e){const f=((c=p.data)==null?void 0:c.definitionId)!=null?String(p.data.definitionId):"",h=i[p.id]||{inputNames:[],outputNames:[]},y=h.inputNames.length,b=h.outputNames.length;if(!(f==="control_start"||f.startsWith("provide_"))&&y>0)for(let v=0;v<y;v++){const w=`input-${v}`;if(!((d=s.get(p.id))==null?void 0:d.has(w))){const E=h.inputNames[v]||w;l.push({nodeId:p.id,suffix:n("flow:validation.inputSlotNoEdge",{slotName:E,handle:w}),key:`${p.id}-${w}-in`})}}if(!(f==="control_end")&&b>0)for(let v=0;v<b;v++){const w=`output-${v}`;if(!((u=o.get(p.id))==null?void 0:u.has(w))){const E=h.outputNames[v]||w;l.push({nodeId:p.id,suffix:n("flow:validation.outputSlotNoEdge",{slotName:E,handle:w}),key:`${p.id}-${w}-out`})}}}return l}function Lx(e){const t=e.type||"node",n=e.showOnNode!=null,r={type:t,name:e.name||"",default:e.value!==void 0&&e.value!==null?String(e.value):e.default!==void 0?String(e.default):""};return e.required!=null&&(r.required=!!e.required),r.showOnNode=n?!!e.showOnNode:!!r.required||String(t).trim().toLowerCase()==="node",r._showOnNodeExplicit=n,r}const UU={agent_subAgent:["SubAgent"],control_start:["Start"],control_end:["End"],control_agent_toBool:["Agent ToBool"],control_anyOne:["Any One"],control_cancelled:["Cancelled"],control_cd_workspace:["CD Workspace"],control_deadline:["Deadline"],control_delay:["Delay"],control_if:["If Branch"],control_interval_loop:["Interval Loop"],control_load_skills:["Load Skills"],control_user_workspace:["User Workspace"],control_toBool:["To Bool"],control_wait_until:["Wait Until"],tool_git_checkout:["Git Checkout"],tool_get_env:["Get Env"],tool_load_key:["Load Key"],tool_nodejs:["Node.js Script"],tool_print:["Print"],tool_save_key:["Save Key"],tool_user_ask:["UserAsk"],tool_user_check:["User Confirm"],provide_file:["File"],provide_bool:["Boolean"],provide_text:["Text"],provide_str:["Text"],display_markdown:["Markdown Display"],display_mermaid:["Mermaid Display"],display_ascii:["ASCII Display"]};function VU(e,t,n){const r=String((n==null?void 0:n.displayName)||"").trim(),i=String(t||"").trim();return!r||!i||r===i?i:(UU[e]||[]).includes(i)?r:i}const WU={tool_git_checkout:new Set(["targetDir","pullIfExists","includeSubmodules","workspaceContext","commit","changed"]),control_load_skills:new Set(["mergeMode","workspaceContext","skillsContext","loadedCount","summary"]),agent_subAgent:new Set(["workspaceContext","skillsContext"])},KU={control_cd_workspace:new Set(["mode","label","cwd","previous"]),control_user_workspace:new Set(["cwd"]),tool_git_checkout:new Set(["branch","targetDir","pullIfExists","includeSubmodules","repoPath","commit","changed"]),tool_gitlab_create_mr:new Set(["repoPath","workspaceContext","sourceBranch","targetBranch","title","description","draft","labels","push","remote","tokenEnv","gitlabApiBase","removeSourceBranch","squash","created","mrIid","projectId","message"])};function QS(e,t,n){return!Array.isArray(t)||!Array.isArray(n)||n.length===0?t:t.map((r,i)=>{var d,u;const s=n[i],l=n.find(p=>(p==null?void 0:p.name)&&p.name===r.name)||s;if(!l)return r;const c=r.showOnNode===!1&&l.showOnNode==null&&((d=WU[e])==null?void 0:d.has(r.name));return{...r,...r.required==null&&l.required!=null?{required:!!l.required}:{},...c?{showOnNode:!0}:{},...!r._showOnNodeExplicit&&l.showOnNode!=null?{showOnNode:!!l.showOnNode}:{},...!r._showOnNodeExplicit&&l.showOnNode==null?{showOnNode:!!r.required||String(r.type||"").trim().toLowerCase()==="node"}:{},...(u=KU[e])!=null&&u.has(r.name)?{showOnNode:!1}:{}}})}function vI(e){var i,s;const t=Array.isArray((i=e==null?void 0:e.data)==null?void 0:i.inputs)?e.data.inputs:[],n=Array.isArray((s=e==null?void 0:e.data)==null?void 0:s.outputs)?e.data.outputs:[],r=o=>o.map(l=>{const c=Lx(l);return{type:String(c.type||"node"),name:String(c.name??""),default:String(c.default??""),required:!!c.required,showOnNode:c.showOnNode!=null?c.showOnNode!==!1:!!c.required||String(c.type||"").trim().toLowerCase()==="node"}});return{inputs:r(t),outputs:r(n)}}function fd(e,t,n,r,i){var $,H,z,Y,A,T,C,G,Q,M,te,ce,le,de,ue;const s=(($=e.data)==null?void 0:$.definitionId)||String(e.id).replace(/-\d+$/,""),o=n.find(se=>se.id===s),l=t[e.id];let c=[],d=[],u=((H=e.data)==null?void 0:H.label)??e.id,p,f,h,y;const b=!!l;l&&(Array.isArray(l.input)&&(c=l.input.map(Lx)),Array.isArray(l.output)&&(d=l.output.map(Lx)),l.label&&(u=String(l.label)),l.role&&typeof l.role=="string"&&(p=l.role),l.model!=null&&(f=String(l.model).trim()),l.body!=null&&(h=String(l.body)),l.script!=null&&(y=String(l.script)));const S=p??(typeof((z=e.data)==null?void 0:z.role)=="string"?e.data.role:"普通"),g=f??((Y=e.data)==null?void 0:Y.model)??void 0,v=(o==null?void 0:o.description)!=null?String(o.description).trim():"",w=v!==""?v:void 0,k=h??((A=e.data)==null?void 0:A.body)??"",E=y!==void 0?y:((T=e.data)==null?void 0:T.script)!=null?String(e.data.script):"",j=String(e.id),P=(C=r==null?void 0:r[i])==null?void 0:C[j],O=(G=P==null?void 0:P.label)==null?void 0:G.label,F=P==null?void 0:P.body,W=P==null?void 0:P.description;b||(c.length===0&&((Q=o==null?void 0:o.inputs)!=null&&Q.length)&&(c=o.inputs.map(se=>({...se}))),d.length===0&&((M=o==null?void 0:o.outputs)!=null&&M.length)&&(d=o.outputs.map(se=>({...se}))));const R=(o==null?void 0:o.id)??s;if(R==="agent_subAgent"&&!d.some(se=>(se==null?void 0:se.name)==="result")){const se=(te=o==null?void 0:o.outputs)==null?void 0:te.find(re=>(re==null?void 0:re.name)==="result");d=[...d,se?{...se}:{type:"text",name:"result",default:""}]}if((R==="display_markdown"||R==="display_mermaid"||R==="display_ascii")&&!d.some(se=>(se==null?void 0:se.name)==="next")){const se=(ce=o==null?void 0:o.outputs)==null?void 0:ce.find(re=>(re==null?void 0:re.name)==="next");d=[...d,se?{...se}:{type:"node",name:"next",default:""}]}if(R==="workspace_run"){if(!c.some(se=>(se==null?void 0:se.name)==="prev")){const se=(le=o==null?void 0:o.inputs)==null?void 0:le.find(re=>(re==null?void 0:re.name)==="prev");c=[se?{...se}:{type:"node",name:"prev",default:""},...c]}if(!d.some(se=>(se==null?void 0:se.name)==="next")){const se=(de=o==null?void 0:o.outputs)==null?void 0:de.find(re=>(re==null?void 0:re.name)==="next");d=[...d,se?{...se}:{type:"node",name:"next",default:""}]}}c=QS(R,c,o==null?void 0:o.inputs),d=QS(R,d,o==null?void 0:o.outputs);const I=VU(R,O||u,o),q=R==="tool_nodejs"||String(E).trim()!=="";return{...e,type:"flowNode",data:{...e.data,label:O||u,displayLabel:I,definitionDisplayName:o==null?void 0:o.displayName,definitionId:R,schemaType:((ue=e.data)==null?void 0:ue.schemaType)??e.type??"agent",role:S,model:g,body:F||k,script:E,inputs:c,outputs:d,description:W||w,originalLabel:u,originalBody:k,...q?{script:E}:{}}}}function bI(e,t){const n=new Map(t.map(r=>[r.id,r]));return e.filter(r=>{var u,p,f,h;const i=n.get(r.source),s=n.get(r.target),o=((p=(u=i==null?void 0:i.data)==null?void 0:u.outputs)==null?void 0:p.length)??0,l=((h=(f=s==null?void 0:s.data)==null?void 0:f.inputs)==null?void 0:h.length)??0,c=r.sourceHandle?parseInt(String(r.sourceHandle).replace("output-",""),10):0,d=r.targetHandle?parseInt(String(r.targetHandle).replace("input-",""),10):0;return i&&s&&c>=0&&c<o&&d>=0&&d<l})}function vn(e){switch(xh(e)){case"text":return"#2196f3";case"file":return"#4caf50";case"node":return"#ff9800";case"bool":return"#9c27b0";default:return"#9e9e9e"}}function xh(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 qU(e,t){const n=xh(e),r=xh(t);return!n||!r?!1:n==="any"||r==="any"?!0:n===r}const YU=new Set(["workspaceContext","skillsContext"]);function Ox(e){const t=xh(e==null?void 0:e.type),n=String((e==null?void 0:e.name)||(e==null?void 0:e.id)||"").trim();return t==="text"&&YU.has(n)?`${t}+${n}`:t}function kI(e){return Ox(e)}function ac(e,t){if(!e||!t||!qU(e.type,t.type))return!1;const n=Ox(e),r=Ox(t),i=n.includes("+"),s=r.includes("+");return i||s?n===r:!0}function GU(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 lc(e,t,n){var l;const r=n==="source"?"outputs":"inputs",s=GU(t,n==="source"?"output":"input");return s<0?null:(Array.isArray((l=e==null?void 0:e.data)==null?void 0:l[r])?e.data[r]:[])[s]||null}function Os(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function XU(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 JU(e){return["true","1","yes","on"].includes(String((e==null?void 0:e.value)??(e==null?void 0:e.default)??"").trim().toLowerCase())}function SI({data:e,selected:t,id:n,deleteNode:r,onProvideExpand:i,onProvideValueChange:s,modelLists:o,onModelChange:l}){const{t:c}=Mt(),d=(e==null?void 0:e.inputs)??[],u=(e==null?void 0:e.outputs)??[],p=((e==null?void 0:e.schemaType)??"agent").toLowerCase(),f=XU(e),h=(e==null?void 0:e.isRunMode)??!1,y=(e==null?void 0:e.isExecuting)??!1,b=(e==null?void 0:e.isDim)??!1,S=(e==null?void 0:e.nodeStatus)??null,g=(e==null?void 0:e.nodeElapsed)??null,v=(e==null?void 0:e.definitionId)||"",w=v.startsWith("provide_"),k=v==="provide_bool",E=k?JU(u[0]):!1,j=(e==null?void 0:e.displayLabel)||(e==null?void 0:e.label)||c("flow:node.fallbackLabel"),P=e!=null&&e.showBodyPreview?String((e==null?void 0:e.body)||"").trim():"",O=Array.isArray(o==null?void 0:o.cursor)?o.cursor:[],F=Array.isArray(o==null?void 0:o.opencode)?o.opencode:[],W=Array.isArray(o==null?void 0:o.claudeCode)?o.claudeCode:[],R=((e==null?void 0:e.model)??"").trim(),I=p==="agent"&&!v.startsWith("tool_nodejs"),q=new Set(O.map(Os)),$=new Set(F.map(Os)),H=new Set(W.map(Os)),z=R?R.startsWith("cursor:")||R.startsWith("opencode:")||R.startsWith("claude-code:")?R:H.has(R)?`claude-code:${R}`:$.has(R)?`opencode:${R}`:q.has(R)?`cursor:${R}`:R:"",Y=R&&!z.startsWith("cursor:")&&!z.startsWith("opencode:")&&!z.startsWith("claude-code:")&&!q.has(R)&&!$.has(R)&&!H.has(R),A=R.startsWith("cursor:")?R.slice(7):R.startsWith("opencode:")?R.slice(9):R.startsWith("claude-code:")?R.slice(12):R,T=M=>{const te=M.target.value;l&&l(n,te)},C=M=>{M.stopPropagation(),r&&r(n)},G=M=>{M.stopPropagation(),i&&i()},Q=M=>{M.stopPropagation(),s==null||s(n,E?"false":"true")};return a.jsxs("div",{className:"af-flow-node"+(t?" af-flow-node--selected":"")+(y?" af-flow-node--executing":"")+(S==="success"?" af-flow-node--done":"")+(S==="failed"?" af-flow-node--failed":"")+(S==="running"&&!y?" af-flow-node--running-disk":"")+(b?" af-flow-node--dim":"")+" af-flow-node--"+p.replace(/[^a-z0-9_-]/g,""),"data-schema":p,children:[a.jsxs("div",{className:"af-flow-node__chrome",children:[a.jsx("span",{className:"af-flow-node__type",title:f,children:f}),n&&a.jsx("span",{className:"af-flow-node__id",title:n,children:n}),!h&&I&&a.jsxs("div",{className:"af-flow-node__model-wrap",children:[a.jsxs("select",{className:"af-flow-node__model",value:z,onChange:T,"aria-label":c("flow:node.model"),title:A||c("flow:node.defaultModel"),children:[a.jsx("option",{value:"",children:c("flow:node.defaultModel")}),Y&&a.jsx("option",{value:R,children:R}),O.length>0&&a.jsx("optgroup",{label:"Cursor",children:O.map(M=>a.jsx("option",{value:`cursor:${Os(M)}`,children:Os(M)},`c-${M}`))}),F.length>0&&a.jsx("optgroup",{label:"OpenCode",children:F.map(M=>a.jsx("option",{value:`opencode:${Os(M)}`,children:Os(M)},`o-${M}`))}),W.length>0&&a.jsx("optgroup",{label:"Claude Code",children:W.map(M=>a.jsx("option",{value:`claude-code:${Os(M)}`,children:Os(M)},`cc-${M}`))})]}),a.jsx("span",{className:"af-flow-node__model-arrow material-symbols-outlined",children:"expand_more"})]}),y&&a.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--executing",children:"EXECUTING"}),S==="running"&&!y&&a.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--running-disk",title:c("flow:node.diskRunning"),children:"RUNNING"}),S==="success"&&a.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--done",children:g!=null&&String(g).trim()!==""?g:"--"}),S==="failed"&&a.jsx("span",{className:"af-flow-node__status-badge af-flow-node__status-badge--failed",children:"FAILED"}),!h&&w&&!k&&a.jsx("button",{type:"button",className:"af-flow-node__expand",onClick:G,"aria-label":c("flow:node.expandProvide"),title:c("flow:node.expandProvide"),children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})}),!h&&a.jsx("button",{type:"button",className:"af-flow-node__delete",onClick:C,"aria-label":c("flow:node.deleteNode"),title:c("flow:node.deleteNode"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("div",{className:"af-flow-node__body",children:[a.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--in",children:d.map((M,te)=>{if(M.showOnNode===!1)return null;const ce=c("flow:node.inputTooltip",{name:M.name||`#${te}`,type:M.type})+(M.default!=null&&M.default!==""?c("flow:node.defaultSuffix",{value:M.default}):""),le=M.name||`#${te+1}`;return a.jsxs("div",{className:"af-flow-node__port-row",title:ce,children:[a.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--in",children:[le,M.required?a.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),a.jsx(wi,{type:"target",position:$e.Left,id:`input-${te}`,className:"af-flow-node__handle",style:{background:vn(M.type)},title:ce})]},`in-${te}`)})}),a.jsxs("div",{className:"af-flow-node__title-wrap",children:[a.jsx("span",{className:"af-flow-node__title",children:j}),k?a.jsx("button",{type:"button",className:"af-flow-node__bool-toggle nodrag"+(E?" af-flow-node__bool-toggle--true":""),onClick:Q,"aria-pressed":E,title:E?"true":"false",children:E?"true":"false"}):null,P?a.jsx("span",{className:"af-flow-node__prompt-preview",title:P,children:P}):null]}),a.jsx("div",{className:"af-flow-node__ports af-flow-node__ports--out",children:u.map((M,te)=>{if(M.showOnNode===!1)return null;const ce=c("flow:node.outputTooltip",{name:M.name||`#${te}`,type:M.type})+(M.default!=null&&M.default!==""?c("flow:node.defaultSuffix",{value:M.default}):""),le=M.name||`#${te+1}`;return a.jsxs("div",{className:"af-flow-node__port-row",title:ce,children:[a.jsxs("span",{className:"af-flow-node__port-label af-flow-node__port-label--out",children:[le,M.required?a.jsx("span",{className:"af-flow-node__port-required",children:"*"}):null]}),a.jsx(wi,{type:"source",position:$e.Right,id:`output-${te}`,className:"af-flow-node__handle",style:{background:vn(M.type)},title:ce})]},`out-${te}`)})})]})]})}const Rd="flowNode";function NI(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 wh(e){return e.key==="?"||e.key==="/"&&e.shiftKey}function QU(){return typeof navigator>"u"?!1:/Mac|iPhone|iPod|iPad/i.test(navigator.platform||navigator.userAgent||"")}function ZU({open:e,onClose:t,flowId:n,flowSource:r,onArchived:i}){const{t:s}=Mt(),o=m.useId(),l=m.useRef(null),[c,d]=m.useState(""),[u,p]=m.useState(!1),[f,h]=m.useState("");if(m.useEffect(()=>{if(!e)return;d(""),h(""),p(!1);const g=requestAnimationFrame(()=>{var v;return(v=l.current)==null?void 0:v.focus()});return()=>cancelAnimationFrame(g)},[e,n]),!e)return null;const y=c.trim(),b=y===n;async function S(g){if(g.preventDefault(),!(!b||u)){p(!0),h("");try{const v=await fetch("/api/flow/archive",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:y})}),w=await v.json().catch(()=>({}));if(!v.ok){h(typeof w.error=="string"?w.error:s("project:archiveModal.archiveFailed"));return}i()}catch(v){h(String((v==null?void 0:v.message)||v))}finally{p(!1)}}}return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&t()},children:a.jsxs("div",{ref:l,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":o,tabIndex:-1,onMouseDown:g=>g.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:o,className:"af-shortcuts-panel__title",children:s("project:archiveModal.title")}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":s("project:archiveModal.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:S,children:[a.jsx("p",{className:"af-new-pipeline-lead",children:s("project:archiveModal.lead",{flowId:n})}),a.jsxs("label",{className:"af-new-pipeline-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:s("project:archiveModal.confirmLabel")}),a.jsx("input",{type:"text",className:"af-new-pipeline-input",value:c,onChange:g=>d(g.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":y.length>0&&!b})]}),f?a.jsx("p",{className:"af-err af-new-pipeline-err",children:f}):null,a.jsxs("div",{className:"af-new-pipeline-actions",children:[a.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:u,children:s("project:archiveModal.cancel")}),a.jsx("button",{type:"submit",className:"af-btn-primary",disabled:!b||u,children:s(u?"project:archiveModal.archiving":"project:archiveModal.confirmArchive")})]})]})]})})}function ZS({open:e,title:t,message:n,confirmLabel:r,cancelLabel:i,destructive:s=!1,secondaryLabel:o,secondaryDestructive:l=!1,onSecondary:c,onConfirm:d,onCancel:u}){const{t:p}=Mt(),f=m.useId(),h=m.useRef(null);if(m.useEffect(()=>{if(!e)return;const g=requestAnimationFrame(()=>{var w;return(w=h.current)==null?void 0:w.focus()});function v(w){w.key==="Escape"&&u(),w.key==="Enter"&&d()}return window.addEventListener("keydown",v),()=>{cancelAnimationFrame(g),window.removeEventListener("keydown",v)}},[e,u,d]),!e)return null;const y=r??p("common:common.confirm","确定"),b=i??p("common:common.cancel","取消"),S=t??p("common:common.confirmTitle","请确认");return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:g=>{g.target===g.currentTarget&&u()},children:a.jsxs("div",{ref:h,className:"af-shortcuts-panel af-new-pipeline-panel",role:"dialog","aria-modal":"true","aria-labelledby":f,tabIndex:-1,onMouseDown:g=>g.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:f,className:"af-shortcuts-panel__title",children:S}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:u,"aria-label":b,children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("div",{className:"af-shortcuts-panel__body af-new-pipeline-form",children:[a.jsx("p",{className:"af-new-pipeline-lead",children:n}),a.jsxs("div",{className:"af-new-pipeline-actions",children:[a.jsx("button",{type:"button",className:"af-btn-secondary",onClick:u,children:b}),o&&c?a.jsx("button",{type:"button",className:l?"af-btn-secondary af-btn-destructive":"af-btn-secondary",onClick:c,children:o}):null,a.jsx("button",{type:"button",className:s?"af-btn-primary af-btn-destructive":"af-btn-primary",onClick:d,autoFocus:!0,children:y})]})]})]})})}function eV({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:i=!1,onDeleted:s}){const{t:o}=Mt(),l=m.useId(),c=m.useRef(null),[d,u]=m.useState(""),[p,f]=m.useState(!1),[h,y]=m.useState("");if(m.useEffect(()=>{if(!e)return;u(""),y(""),f(!1);const v=requestAnimationFrame(()=>{var w;return(w=c.current)==null?void 0:w.focus()});return()=>cancelAnimationFrame(v)},[e,n]),!e)return null;const b=d.trim(),S=b===n;async function g(v){if(v.preventDefault(),!S||p)return;f(!0),y("");let w=null;try{const k=new AbortController;w=setTimeout(()=>k.abort(),15e3);const E=await fetch("/api/flow/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:n,flowSource:r,confirmFlowId:b,flowArchived:i}),signal:k.signal}),j=await E.json().catch(()=>({}));if(!E.ok){y(typeof j.error=="string"?j.error:o("project:deleteModal.deleteFailed"));return}try{for(let P=localStorage.length-1;P>=0;P--){const O=localStorage.key(P);O&&(O.startsWith(`af:composer-sessions:${n}:${r}`)||O.startsWith(`af:composer-active-session:${n}:${r}`)||O.startsWith(`af:workspace-composer:${n}:${r}`))&&localStorage.removeItem(O)}}catch{}await s()}catch(k){if((k==null?void 0:k.name)==="AbortError"){y(o("project:deleteModal.deleteTimeout"));return}y(String((k==null?void 0:k.message)||k))}finally{w&&clearTimeout(w),f(!1)}}return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:v=>{v.target===v.currentTarget&&t()},children:a.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:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:l,className:"af-shortcuts-panel__title",children:o("project:deleteModal.title")}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":o("project:deleteModal.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("form",{className:"af-shortcuts-panel__body af-new-pipeline-form",onSubmit:g,children:[a.jsx("p",{className:"af-new-pipeline-lead",children:o("project:deleteModal.lead",{flowId:n})}),a.jsxs("label",{className:"af-new-pipeline-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:o("project:deleteModal.confirmLabel")}),a.jsx("input",{type:"text",className:"af-new-pipeline-input",value:d,onChange:v=>u(v.target.value),placeholder:n,autoComplete:"off",spellCheck:!1,"aria-invalid":b.length>0&&!S})]}),h?a.jsx("p",{className:"af-err af-new-pipeline-err",children:h}):null,a.jsxs("div",{className:"af-new-pipeline-actions",children:[a.jsx("button",{type:"button",className:"af-btn-secondary",onClick:t,disabled:p,children:o("project:deleteModal.cancel")}),a.jsx("button",{type:"submit",className:"af-btn-primary af-btn-destructive",disabled:!S||p,children:o(p?"project:deleteModal.deleting":"project:deleteModal.confirmDelete")})]})]})]})})}function tV({children:e}){return a.jsx("kbd",{className:"af-kbd",children:e})}function yo({keys:e}){return a.jsx("span",{className:"af-shortcuts-keys",children:e.map((t,n)=>a.jsxs("span",{children:[n>0?a.jsx("span",{className:"af-shortcuts-keys__plus",children:"+"}):null,a.jsx(tV,{children:t})]},n))})}function jI({open:e,onClose:t}){const{t:n}=Mt(),r=m.useRef(null);if(m.useEffect(()=>{if(!e)return;const o=requestAnimationFrame(()=>{var l;return(l=r.current)==null?void 0:l.focus()});return()=>cancelAnimationFrame(o)},[e]),!e)return null;const s=QU()?"⌘":"Ctrl";return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:o=>{o.target===o.currentTarget&&t()},children:a.jsxs("div",{ref:r,className:"af-shortcuts-panel",role:"dialog","aria-modal":"true","aria-labelledby":"af-shortcuts-title",tabIndex:-1,onMouseDown:o=>o.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:"af-shortcuts-title",className:"af-shortcuts-panel__title",children:n("flow:shortcuts.title")}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":n("common:common.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("div",{className:"af-shortcuts-panel__body",children:[a.jsxs("section",{className:"af-shortcuts-section",children:[a.jsx("h3",{className:"af-shortcuts-cat",children:n("flow:shortcuts.general")}),a.jsxs("ul",{className:"af-shortcuts-list",children:[a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.saveDesc")}),a.jsx(yo,{keys:[s,"S"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.shortcutsLabel")}),a.jsx(yo,{keys:["?"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.jumpToNode")}),a.jsx(yo,{keys:[s,"K"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.openNodePalette")}),a.jsx(yo,{keys:["A"]})]})]})]}),a.jsxs("section",{className:"af-shortcuts-section",children:[a.jsx("h3",{className:"af-shortcuts-cat",children:n("flow:shortcuts.canvas")}),a.jsxs("ul",{className:"af-shortcuts-list",children:[a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectTool")}),a.jsx(yo,{keys:["V"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.panTool")}),a.jsx(yo,{keys:["H"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.holdSpacePan")}),a.jsx(yo,{keys:["Space"]})]}),a.jsxs("li",{className:"af-shortcuts-row",children:[a.jsx("span",{className:"af-shortcuts-row__label",children:n("flow:shortcuts.selectAll")}),a.jsx(yo,{keys:[s,"A"]})]})]})]})]})]})})}function nV(e,t){if(!t)return 1;const n=t.toLowerCase(),r=(e.id||"").toLowerCase(),i=(e.label||"").toLowerCase(),s=(e.definitionId||"").toLowerCase();return r===n?100:r.startsWith(n)?80:r.includes(n)?60:i.startsWith(n)?40:i.includes(n)?30:s.includes(n)?15:0}function rV({open:e,onClose:t,onJump:n,nodes:r}){const{t:i}=Mt(),[s,o]=m.useState(""),[l,c]=m.useState(0),d=m.useRef(null),u=m.useRef(null);m.useEffect(()=>{if(!e)return;o(""),c(0);const y=requestAnimationFrame(()=>{var b;return(b=d.current)==null?void 0:b.focus()});return()=>cancelAnimationFrame(y)},[e]);const p=m.useMemo(()=>{const y=(r||[]).map(g=>{var v,w,k;return{id:g.id,label:((v=g.data)==null?void 0:v.label)||"",definitionId:((w=g.data)==null?void 0:w.definitionId)||"",schemaType:((k=g.data)==null?void 0:k.schemaType)||""}}),b=s.trim(),S=y.map(g=>({e:g,s:nV(g,b)})).filter(g=>g.s>0);return S.sort((g,v)=>v.s-g.s||g.e.id.localeCompare(v.e.id)),S.slice(0,50).map(g=>g.e)},[r,s]);if(m.useEffect(()=>{l>=p.length&&c(0)},[p.length,l]),m.useEffect(()=>{var b;const y=(b=u.current)==null?void 0:b.querySelector(`[data-idx="${l}"]`);y&&y.scrollIntoView({block:"nearest"})},[l]),!e)return null;const f=y=>{const b=p[y];b&&(n(b.id),t())},h=y=>{if(y.key==="Escape"){y.preventDefault(),t();return}if(y.key==="ArrowDown"){y.preventDefault(),c(b=>Math.min(p.length-1,b+1));return}if(y.key==="ArrowUp"){y.preventDefault(),c(b=>Math.max(0,b-1));return}y.key==="Enter"&&(y.preventDefault(),f(l))};return a.jsx("div",{className:"af-jump-overlay",role:"presentation",onMouseDown:y=>{y.target===y.currentTarget&&t()},children:a.jsxs("div",{className:"af-jump-panel",role:"dialog","aria-modal":"true","aria-label":i("flow:jumpPalette.title"),onMouseDown:y=>y.stopPropagation(),children:[a.jsxs("div",{className:"af-jump-panel__input-wrap",children:[a.jsx("span",{className:"af-jump-panel__icon material-symbols-outlined","aria-hidden":!0,children:"search"}),a.jsx("input",{ref:d,type:"text",className:"af-jump-panel__input",placeholder:i("flow:jumpPalette.placeholder"),value:s,onChange:y=>{o(y.target.value),c(0)},onKeyDown:h,spellCheck:!1,autoComplete:"off"}),a.jsx("span",{className:"af-jump-panel__count",children:p.length})]}),p.length===0?a.jsx("div",{className:"af-jump-panel__empty",children:i("flow:jumpPalette.empty")}):a.jsx("ul",{ref:u,className:"af-jump-panel__list",role:"listbox",children:p.map((y,b)=>a.jsxs("li",{"data-idx":b,role:"option","aria-selected":b===l,className:"af-jump-panel__item"+(b===l?" af-jump-panel__item--active":""),onMouseEnter:()=>c(b),onMouseDown:S=>{S.preventDefault(),f(b)},children:[a.jsx("span",{className:"af-jump-panel__id",children:y.id}),y.label&&y.label!==y.id&&a.jsx("span",{className:"af-jump-panel__label",children:y.label}),y.definitionId&&a.jsx("span",{className:"af-jump-panel__tag",children:y.definitionId})]},y.id))}),a.jsxs("div",{className:"af-jump-panel__hint",children:[a.jsxs("span",{children:[a.jsx("kbd",{className:"af-kbd",children:"↑"}),a.jsx("kbd",{className:"af-kbd",children:"↓"})," ",i("flow:jumpPalette.hintNavigate")]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"af-kbd",children:"Enter"})," ",i("flow:jumpPalette.hintJump")]}),a.jsxs("span",{children:[a.jsx("kbd",{className:"af-kbd",children:"Esc"})," ",i("flow:jumpPalette.hintClose")]})]})]})})}function iV({open:e,onClose:t,flowId:n,flowSource:r,flowArchived:i=!1,filePath:s,fileName:o,onSaved:l,onAiEdit:c}){const{t:d}=Mt(),u=m.useId(),p=m.useRef(null),f=m.useRef(null),[h,y]=m.useState(""),[b,S]=m.useState(""),[g,v]=m.useState(!1),[w,k]=m.useState(!1),[E,j]=m.useState(!1),[P,O]=m.useState(""),[F,W]=m.useState("");if(m.useEffect(()=>{if(!e||!s)return;y(""),S(""),O(""),W(""),v(!0),k(!1),j(!1);const z=new URLSearchParams({flowId:n,flowSource:r,archived:i?"1":"0",path:s});(async()=>{try{const A=await fetch(`/api/pipeline-file-content?${z}`),T=await A.json();if(!A.ok)throw new Error(T.error||"HTTP "+A.status);y(T.content||""),S(T.content||"")}catch(A){O(A.message||String(A))}finally{v(!1)}})();const Y=requestAnimationFrame(()=>{var A;return(A=p.current)==null?void 0:A.focus()});return()=>cancelAnimationFrame(Y)},[e,s,n,r,i]),!e)return null;const R=h!==b;async function I(z){if(z.preventDefault(),!w){k(!0),O(""),W("");try{const Y=new URLSearchParams({flowId:n,flowSource:r,archived:i?"1":"0",path:s}),A=await fetch(`/api/pipeline-file-save?${Y}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:h})}),T=await A.json();if(!A.ok)throw new Error(T.error||"HTTP "+A.status);S(h),W(d("flow:fileEdit.saved")),l&&l()}catch(Y){O(Y.message||String(Y))}finally{k(!1)}}}async function q(){if(!(!c||E||!h)){j(!0),O("");try{const z=await c(h);typeof z=="string"&&z&&y(z)}catch(z){O(z.message||String(z))}finally{j(!1)}}}function $(){y(b),O(""),W("")}const H=h.length>1e5;return a.jsx("div",{className:"af-shortcuts-overlay",role:"presentation",onMouseDown:z=>{z.target===z.currentTarget&&t()},children:a.jsxs("div",{ref:p,className:"af-shortcuts-panel af-file-edit-panel",role:"dialog","aria-modal":"true","aria-labelledby":u,tabIndex:-1,onMouseDown:z=>z.stopPropagation(),children:[a.jsxs("div",{className:"af-shortcuts-panel__head",children:[a.jsx("h2",{id:u,className:"af-shortcuts-panel__title",children:o||s}),a.jsx("button",{type:"button",className:"af-shortcuts-panel__close af-icon-btn",onClick:t,"aria-label":d("flow:fileEdit.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-file-edit-body",children:g?a.jsx("div",{className:"af-file-edit-loading",children:d("flow:fileEdit.loading")}):P&&!h?a.jsx("div",{className:"af-file-edit-error",children:P}):a.jsxs(a.Fragment,{children:[H&&a.jsx("div",{className:"af-file-edit-warning",children:d("flow:fileEdit.largeFileWarning")}),a.jsx("textarea",{ref:f,className:"af-file-edit-textarea",value:h,onChange:z=>y(z.target.value),spellCheck:!1,placeholder:d("flow:fileEdit.placeholder")})]})}),(P||F)&&!g&&a.jsx("div",{className:`af-file-edit-status${F?" af-file-edit-status--success":""}`,children:F||P}),a.jsxs("div",{className:"af-file-edit-actions",children:[a.jsx("button",{type:"button",className:"af-btn-secondary",onClick:$,disabled:!R||w||E,children:d("flow:fileEdit.reset")}),c&&a.jsx("button",{type:"button",className:"af-btn-secondary af-btn-ai",onClick:q,disabled:E||w||!h,children:d(E?"flow:fileEdit.aiRunning":"flow:fileEdit.aiEdit")}),a.jsx("button",{type:"button",className:"af-btn-primary",onClick:I,disabled:!R||w||E,children:d(w?"flow:fileEdit.saving":"flow:fileEdit.save")})]})]})})}const CI=new Set(["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"]),sV=["workspaceRoot","pipelineWorkspace","cwd","flowName","runDir","flowDir"];function oV(e,t){const n=e.slice(0,t),r=n.lastIndexOf("${");if(r<0)return null;const i=n.slice(r+2);return i.includes("}")?null:{atIndex:r,query:i}}function aV(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 eN(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 EI(e,{inputNames:t,outputNames:n}){const r=e.trim();if(!r)return!1;if(r.startsWith("input.")){const i=r.slice(6).trim();return i!==""&&t.has(i)}if(r.startsWith("output.")){const i=r.slice(7).trim();return i!==""&&n.has(i)}if(CI.has(r)||t.has(r)||n.has(r))return!0;if(!r.includes(".")){const i=`${r}.md`;if(t.has(i)||n.has(i))return!0}return!1}function _I(e){return{inputNames:eN(e==null?void 0:e.inputs),outputNames:eN(e==null?void 0:e.outputs)}}function lV(e,t,n){const r=_I(t),i=aV(e),s=[];for(const o of i)if(!EI(o.key,r)){const l=o.key.trim()===""?n("flow:placeholder.empty"):o.key.trim();s.push({start:o.start,end:o.end,message:n("flow:placeholder.invalidPlaceholder",{hint:l})})}return s}function cV(e,t){const n=_I(t),r=/\$\{([^}]*)\}/g,i=[];let s=0,o;for(;(o=r.exec(e))!==null;){o.index>s&&i.push({kind:"plain",text:e.slice(s,o.index)});const l=o[0],c=EI(o[1],n);i.push({kind:c?"ph-valid":"ph-invalid",text:l}),s=o.index+l.length}return s<e.length&&i.push({kind:"plain",text:e.slice(s)}),i}function uV(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function dV(e){return e.map(t=>{const n=uV(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 fV(e,t){const n=[];for(const r of(e==null?void 0:e.inputs)??[]){const i=(r==null?void 0:r.name)!=null?String(r.name).trim():"";if(!i)continue;const s=(r==null?void 0:r.type)!=null?String(r.type):"";n.push({section:"input",insert:`input.${i}`,label:i,subtitle:s?t("flow:placeholder.inputSubtitle",{type:s}):t("flow:placeholder.inputSubtitleNoType")})}for(const r of(e==null?void 0:e.outputs)??[]){const i=(r==null?void 0:r.name)!=null?String(r.name).trim():"";if(!i)continue;const s=(r==null?void 0:r.type)!=null?String(r.type):"";n.push({section:"output",insert:`output.${i}`,label:i,subtitle:s?t("flow:placeholder.outputSubtitle",{type:s}):t("flow:placeholder.outputSubtitleNoType")})}for(const r of sV)CI.has(r)&&n.push({section:"runtime",insert:r,label:r,subtitle:t("flow:placeholder.runtimeConst")});return n}function pV(e,t){const n=t.toLowerCase();return n?e.filter(r=>[r.insert,r.label,r.subtitle??""].map(s=>String(s).toLowerCase()).some(s=>s.includes(n))):e}function hV(e,t){if(!e||t<0)return null;const n=Math.min(t,e.value.length),r=getComputedStyle(e),i=document.createElement("div");i.setAttribute("aria-hidden","true"),i.style.visibility="hidden",i.style.position="fixed",i.style.top="0",i.style.left="-99999px",i.style.whiteSpace="pre-wrap",i.style.wordWrap="break-word",i.style.overflow="hidden";const s=e.clientWidth;if(s<=0)return null;i.style.width=`${s}px`,i.style.font=r.font,i.style.lineHeight=r.lineHeight,i.style.padding=r.padding,i.style.border=r.border,i.style.boxSizing=r.boxSizing,i.style.letterSpacing=r.letterSpacing,i.style.textIndent=r.textIndent,i.style.tabSize=r.tabSize||"8",i.textContent=e.value.slice(0,n);const o=document.createElement("span");o.textContent="​",i.appendChild(o),document.body.appendChild(i);const l=o.getBoundingClientRect(),c=parseFloat(r.lineHeight),d=Number.isFinite(c)&&c>0?c:l.height||16;return document.body.removeChild(i),{top:l.top,left:l.left,bottom:l.bottom,height:d}}function Yf({value:e,onChange:t,disabled:n,placeholder:r,rows:i=8,textareaClassName:s,ioSlots:o,variant:l="drawer"}){const{t:c}=Mt(),d=m.useId(),u=m.useRef(null),p=m.useRef(null),[f,h]=m.useState(0),[y,b]=m.useState(0),[S,g]=m.useState(null),v=m.useMemo(()=>lV(e,o,c),[e,o,c]),w=v.length>0,k=m.useMemo(()=>cV(e,o),[e,o]),E=m.useMemo(()=>dV(k),[k]),j=m.useMemo(()=>n?null:oV(e,f),[e,f,n]),P=m.useMemo(()=>{if(!j)return[];const I=fV(o,c);return pV(I,j.query)},[j,o,c]);m.useEffect(()=>{b(I=>{const q=Math.max(0,P.length-1);return Math.min(Math.max(0,I),q)})},[P.length]);const O=m.useCallback(()=>{const I=u.current;if(!I||!j||P.length===0){g(null);return}const q=hV(I,f);if(!q){g(null);return}const $=4,H=44,z=13.5*16,Y=Math.min(P.length*H+8,z);let A=q.bottom+$;A+Y>window.innerHeight-8&&(A=Math.max(8,q.top-Y-$));const T=288;let C=q.left;C=Math.max(8,Math.min(C,window.innerWidth-T-8)),g({top:A,left:C})},[j,P.length,f]);m.useLayoutEffect(()=>{if(!j||P.length===0){g(null);return}const I=requestAnimationFrame(()=>O());return()=>cancelAnimationFrame(I)},[j,P.length,f,e,O]),m.useEffect(()=>{if(!j||P.length===0)return;const I=()=>O();return window.addEventListener("scroll",I,!0),window.addEventListener("resize",I),()=>{window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",I)}},[j,P.length,O]);const F=m.useCallback(I=>{if(!j)return;const{atIndex:q}=j,$=e.slice(0,q)+"${"+I+"}"+e.slice(f);t($);const H=q+I.length+3;queueMicrotask(()=>{const z=u.current;z&&(z.focus(),z.setSelectionRange(H,H)),h(H)})},[j,e,f,t]),W=m.useCallback(()=>{const I=u.current,q=p.current;!I||!q||(q.scrollTop=I.scrollTop,q.scrollLeft=I.scrollLeft,j&&P.length>0&&queueMicrotask(()=>O()))},[j,P.length,O]),R=m.useCallback(I=>{if(!n&&j&&P.length>0&&(I.key==="ArrowDown"||I.key==="ArrowUp"||I.key==="Enter")){if(I.key==="ArrowDown")I.preventDefault(),b(q=>(q+1)%P.length);else if(I.key==="ArrowUp")I.preventDefault(),b(q=>(q-1+P.length)%P.length);else if(I.key==="Enter"&&!I.shiftKey){I.preventDefault();const q=P[y];q&&F(q.insert)}}},[n,j,P,y,F]);return a.jsxs("div",{className:"af-body-prompt-editor"+(l==="expand"?" af-body-prompt-editor--expand":""),children:[a.jsxs("div",{className:"af-body-prompt-stack",children:[a.jsx("pre",{ref:p,className:"af-body-prompt-backdrop "+s,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:E+`
124
- `}}),a.jsx("textarea",{ref:u,className:"af-body-prompt-textarea "+s,rows:i,value:e,disabled:n,placeholder:r,spellCheck:!1,"aria-invalid":w,"aria-describedby":w?d:void 0,onChange:I=>{t(I.target.value),h(I.target.selectionStart??I.target.value.length)},onSelect:I=>{const q=I.target;q instanceof HTMLTextAreaElement&&h(q.selectionStart??0)},onClick:I=>{const q=I.target;q instanceof HTMLTextAreaElement&&h(q.selectionStart??0)},onKeyUp:I=>{const q=I.target;q instanceof HTMLTextAreaElement&&h(q.selectionStart??q.value.length)},onKeyDown:R,onScroll:W})]}),j&&P.length>0&&S?Tr.createPortal(a.jsx("ul",{className:"af-body-ph-menu af-body-ph-menu--pop af-composer-mention-menu",role:"listbox","aria-label":c("flow:nodeProps.placeholderSlots"),style:{position:"fixed",top:S.top,left:S.left,right:"auto",bottom:"auto",margin:0,zIndex:2e4},children:P.map((I,q)=>a.jsx("li",{role:"option","aria-selected":q===y,children:a.jsxs("button",{type:"button",className:"af-composer-mention-item"+(q===y?" af-composer-mention-item--active":""),onMouseDown:$=>$.preventDefault(),onMouseEnter:()=>b(q),onClick:()=>F(I.insert),children:[a.jsx("span",{className:"af-composer-mention-id",children:`\${${I.insert}}`}),I.subtitle?a.jsx("span",{className:"af-composer-mention-sub",children:I.subtitle}):null]})},`${I.section}-${I.insert}`))}),document.body):null,w?a.jsx("p",{id:d,className:"af-body-ph-issues",role:"status",children:v.map(I=>I.message).join(" · ")}):null]})}const PI=/^[a-zA-Z_][a-zA-Z0-9_-]*$/;function Gf(e){const t=e.indexOf(" - ");return t>=0?e.slice(0,t).trim():e.trim()}function tN({kind:e,label:t,slots:n,onSlotsChange:r,disabled:i,requiredReadonly:s=!0}){const{t:o}=Mt(),l=()=>r([...n,{type:"text",name:"",default:"",required:!1,showOnNode:!1}]),c=p=>r(n.filter((f,h)=>h!==p)),d=(p,f,h)=>{const y=n.map((b,S)=>{if(S!==p)return b;const g={...b,[f]:h};return f==="required"&&h===!0&&(g.showOnNode=!0),g});r(y)},u=e==="input"?"input":"output";return a.jsxs("div",{className:"af-node-props-field af-node-props-field--io",children:[a.jsxs("div",{className:"af-node-props-io-head",children:[a.jsx("span",{className:"af-node-props-label",children:t}),a.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-io-add",onClick:l,disabled:i,"aria-label":o("flow:nodeProps.addPinAriaLabel",{label:t}),children:o("flow:nodeProps.addPin")})]}),a.jsx("p",{className:"af-node-props-io-hint",children:o("flow:nodeProps.handleHint",{prefix:u})}),n.length===0?a.jsx("p",{className:"af-node-props-io-empty",children:o(e==="input"?"flow:nodeProps.noInputPins":"flow:nodeProps.noOutputPins")}):null,n.length>0?a.jsxs("div",{className:"af-node-props-io-table",role:"group","aria-label":t,children:[a.jsxs("div",{className:"af-node-props-io-table-head","aria-hidden":!0,children:[a.jsx("span",{children:o("flow:nodeProps.handle")}),a.jsx("span",{children:o("flow:nodeProps.type")}),a.jsx("span",{children:o("flow:nodeProps.name")}),a.jsx("span",{children:o("flow:nodeProps.defaultValue")}),a.jsx("span",{children:o("flow:nodeProps.required")}),a.jsx("span",{children:o("flow:nodeProps.showOnNode")}),a.jsx("span",{})]}),n.map((p,f)=>a.jsxs("div",{className:"af-node-props-io-row",children:[a.jsxs("span",{className:"af-node-props-io-handle",title:`${u}-${f}`,children:[u,"-",f]}),a.jsx("select",{className:"af-node-props-input af-node-props-io-cell",value:p.type,onChange:h=>d(f,"type",h.target.value),disabled:i,"aria-label":o("flow:nodeProps.pinTypeAriaLabel",{label:t,index:f}),children:["node","text","file","bool"].map(h=>a.jsx("option",{value:h,children:h},h))}),a.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:p.name,onChange:h=>d(f,"name",h.target.value),disabled:i,spellCheck:!1,autoComplete:"off","aria-label":o("flow:nodeProps.pinNameAriaLabel",{label:t,index:f})}),a.jsx("input",{type:"text",className:"af-node-props-input af-node-props-io-cell",value:p.default,onChange:h=>d(f,"default",h.target.value),disabled:i,spellCheck:!1,autoComplete:"off","aria-label":o("flow:nodeProps.pinDefaultAriaLabel",{label:t,index:f})}),a.jsx("label",{className:"af-node-props-io-flag",title:o("flow:nodeProps.requiredHint"),children:a.jsx("input",{type:"checkbox",checked:!!p.required,onChange:h=>{s||d(f,"required",h.target.checked)},disabled:i||s,"aria-label":o("flow:nodeProps.pinRequiredAriaLabel",{label:t,index:f})})}),a.jsx("label",{className:"af-node-props-io-flag",title:o("flow:nodeProps.showOnNodeHint"),children:a.jsx("input",{type:"checkbox",checked:p.showOnNode!==!1,onChange:h=>d(f,"showOnNode",h.target.checked),disabled:i,"aria-label":o("flow:nodeProps.pinShowOnNodeAriaLabel",{label:t,index:f})})}),a.jsx("button",{type:"button",className:"af-icon-btn af-node-props-io-remove",onClick:()=>c(f),disabled:i,"aria-label":o("flow:nodeProps.deletePinAriaLabel",{label:t,index:f}),title:o("flow:nodeProps.deletePin"),children:a.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]},`${u}-${f}`))]}):null]})}function II({draft:e,setDraft:t,definitionId:n,systemPromptReadonly:r,modelLists:i,disabled:s,onIdBlur:o,onClose:l,onPublishToMarketplace:c,allowEditRequiredPins:d=!1,error:u,ioSlots:p}){const{t:f}=Mt(),[h,y]=m.useState(!1),[b,S]=m.useState(!1),[g,v]=m.useState({status:"idle",message:""}),w=m.useCallback(I=>{t(q=>q&&{...q,...I})},[t]),{cursorList:k,opencodeList:E,claudeCodeList:j,currentNotInLists:P}=m.useMemo(()=>{const I=Array.isArray(i==null?void 0:i.cursor)?i.cursor:[],q=Array.isArray(i==null?void 0:i.opencode)?i.opencode:[],$=Array.isArray(i==null?void 0:i.claudeCode)?i.claudeCode:[],H=new Set([...I,...q,...$].map(Gf)),z=((e==null?void 0:e.model)??"").trim(),Y=z.startsWith("cursor:")?z.slice(7):z.startsWith("opencode:")?z.slice(9):z.startsWith("claude-code:")?z.slice(12):z,A=z&&!H.has(Y)?z:"";return{cursorList:I,opencodeList:q,claudeCodeList:$,currentNotInLists:A}},[i,e==null?void 0:e.model]);if(!e)return null;const O=String(e.script??""),F=n==="tool_nodejs"||O.trim()!=="",W=typeof c=="function"&&!s&&(e==null?void 0:e.newId),R=async()=>{if(W){v({status:"running",message:f("flow:nodeProps.publishRunning")});try{const I=await c(e,n);v({status:"success",message:I!=null&&I.definitionId?f("flow:nodeProps.publishSuccessWithId",{id:I.definitionId}):f("flow:nodeProps.publishSuccess")})}catch(I){v({status:"error",message:String((I==null?void 0:I.message)||I)})}}};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-pipeline-drawer-head af-node-props-head",children:[a.jsx("h2",{className:"af-pipeline-drawer-title",children:f("flow:nodeProps.title")}),a.jsxs("div",{className:"af-node-props-head-actions",children:[a.jsxs("button",{type:"button",className:"af-btn-ghost af-node-props-market-btn",onClick:R,disabled:!W||g.status==="running",title:f("flow:nodeProps.publishToMarketplaceHint"),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"inventory_2"}),g.status==="running"?f("flow:nodeProps.publishing"):f("flow:nodeProps.publishToMarketplace")]}),a.jsx("button",{type:"button",className:"af-btn-ghost af-node-props-close-secondary",onClick:l,children:f("common:common.close")})]})]}),a.jsxs("div",{className:"af-pipeline-drawer-body af-node-props-body",children:[u?a.jsx("p",{className:"af-err af-node-props-err",children:u}):null,g.message?a.jsx("p",{className:`af-node-props-market-status af-node-props-market-status--${g.status}`,children:g.message}):null,a.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[a.jsx("span",{className:"af-node-props-label",children:f("flow:node.nodeType")}),a.jsx("div",{className:"af-pipeline-drawer-readonly af-node-props-readonly-mono",children:n})]}),a.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[a.jsxs("span",{className:"af-node-props-label",children:[f("flow:nodeProps.instanceId"),a.jsx("span",{className:"af-node-props-hint",children:f("flow:node.displayNameHint")})]}),a.jsx("input",{type:"text",className:"af-node-props-input",value:e.newId,onChange:I=>w({newId:I.target.value}),onBlur:o,disabled:s,spellCheck:!1,autoComplete:"off","aria-label":f("flow:nodeProps.instanceId")})]}),a.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[a.jsxs("span",{className:"af-node-props-label",children:[f("flow:node.displayName"),"(LABEL)"]}),a.jsx("input",{type:"text",className:"af-node-props-input",value:e.label,onChange:I=>w({label:I.target.value}),disabled:s,spellCheck:!1})]}),a.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[a.jsxs("span",{className:"af-node-props-label",children:[f("flow:node.role"),"(ROLE)"]}),a.jsx("select",{className:"af-node-props-select",value:Uo.includes(e.role)?e.role:f("flow:roles.normal"),onChange:I=>w({role:I.target.value}),disabled:s,children:Uo.map(I=>a.jsx("option",{value:I,children:I},I))})]}),a.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[a.jsxs("span",{className:"af-node-props-label",children:[f("flow:node.model"),"(MODEL)"]}),a.jsx("span",{className:"af-node-props-sublabel",children:f("flow:node.modelHint")}),a.jsxs("select",{className:"af-node-props-select",value:(()=>{const I=(e.model||"").trim();return I?P||I:""})(),onChange:I=>w({model:I.target.value}),disabled:s,"aria-label":f("flow:nodeProps.modelAriaLabel"),children:[a.jsx("option",{value:"",children:f("flow:node.defaultModel")}),P?a.jsxs("option",{value:P,children:[P,f("flow:nodeProps.yamlValueNotInList")]}):null,k.length>0?a.jsx("optgroup",{label:"Cursor",children:k.map(I=>a.jsx("option",{value:Gf(I),children:I},`c-${I}`))}):null,E.length>0?a.jsx("optgroup",{label:"OpenCode",children:E.map(I=>a.jsx("option",{value:Gf(I),children:I},`o-${I}`))}):null,j.length>0?a.jsx("optgroup",{label:"Claude Code",children:j.map(I=>a.jsx("option",{value:`claude-code:${Gf(I)}`,children:I},`cc-${I}`))}):null]})]}),a.jsx(tN,{kind:"input",label:f("flow:nodeProps.inputPins"),slots:Array.isArray(e.inputs)?e.inputs:[],onSlotsChange:I=>w({inputs:I}),disabled:s,requiredReadonly:!d}),a.jsx(tN,{kind:"output",label:f("flow:nodeProps.outputPins"),slots:Array.isArray(e.outputs)?e.outputs:[],onSlotsChange:I=>w({outputs:I}),disabled:s,requiredReadonly:!d}),F?a.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[a.jsxs("div",{className:"af-node-props-prompt-head",children:[a.jsxs("span",{className:"af-node-props-label",children:[f("flow:node.directCommand"),"(script)",a.jsx("span",{className:"af-node-props-hint",children:f("flow:node.scriptHint")})]}),a.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>S(!0),"aria-label":f("flow:nodeProps.expandEditScript"),title:f("flow:nodeProps.expand"),disabled:s,children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),a.jsx(Yf,{value:O,onChange:I=>w({script:I}),disabled:s,placeholder:f("flow:nodeProps.scriptPlaceholder"),rows:6,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea af-node-props-script-textarea",ioSlots:p,variant:"drawer"})]}):null,a.jsxs("div",{className:"af-pipeline-drawer-field af-node-props-field af-node-props-field--prompt",children:[a.jsxs("div",{className:"af-node-props-prompt-head",children:[a.jsx("span",{className:"af-node-props-label",children:f("flow:node.userPrompt")}),a.jsx("button",{type:"button",className:"af-icon-btn af-node-props-expand",onClick:()=>y(!0),"aria-label":f("flow:nodeProps.expandEdit"),title:f("flow:nodeProps.expand"),disabled:s,children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),a.jsx(Yf,{value:e.body,onChange:I=>w({body:I}),disabled:s,placeholder:f("flow:nodeProps.bodyPlaceholder"),rows:8,textareaClassName:"af-pipeline-drawer-textarea af-node-props-body-textarea",ioSlots:p,variant:"drawer"})]}),a.jsxs("label",{className:"af-pipeline-drawer-field af-node-props-field",children:[a.jsx("span",{className:"af-node-props-label",children:f("flow:node.systemDescription")}),a.jsx("textarea",{className:"af-pipeline-drawer-textarea af-node-props-system-readonly",rows:4,readOnly:!0,value:r||f("flow:nodeProps.noDescription"),spellCheck:!1})]})]}),b?a.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":f("flow:nodeProps.editScript"),onMouseDown:I=>{I.target===I.currentTarget&&S(!1)},children:a.jsxs("div",{className:"af-node-props-expand-panel",children:[a.jsxs("div",{className:"af-node-props-expand-head",children:[a.jsx("span",{className:"af-node-props-expand-title",children:f("flow:node.directCommand")}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>S(!1),"aria-label":f("flow:nodeProps.collapse"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx(Yf,{value:O,onChange:I=>w({script:I}),disabled:s,placeholder:f("flow:nodeProps.scriptPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:p,variant:"expand"})]})}):null,h?a.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true","aria-label":f("flow:nodeProps.editUserPrompt"),onMouseDown:I=>{I.target===I.currentTarget&&y(!1)},children:a.jsxs("div",{className:"af-node-props-expand-panel",children:[a.jsxs("div",{className:"af-node-props-expand-head",children:[a.jsx("span",{className:"af-node-props-expand-title",children:f("flow:node.body")}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>y(!1),"aria-label":f("flow:nodeProps.collapse"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx(Yf,{value:e.body,onChange:I=>w({body:I}),disabled:s,placeholder:f("flow:nodeProps.bodyPlaceholderExpand"),rows:16,textareaClassName:"af-node-props-expand-textarea",ioSlots:p,variant:"expand"})]})}):null]})}function Cv(e){var n;if(e.displayKind==="image"||e.encoding==="base64"&&((n=e.mimeType)!=null&&n.startsWith("image/")))return"image";if(e.displayKind==="json"||e.mimeType==="application/json")return"json";if(e.displayKind==="markdown"||e.mimeType==="text/markdown")return"markdown";if(e.displayKind==="text")return"text";const t=(e.content||"").trim();if(t&&(t.startsWith("{")||t.startsWith("[")))try{return JSON.parse(t),"json"}catch{}return"text"}function mV(e){const t=Cv(e);if(t==="image"){const n=(e.mimeType||"image/png").split("/")[1];return n?n.toUpperCase():"IMAGE"}return t==="json"?"JSON":t==="markdown"?"MD":null}function AI(e){try{return JSON.stringify(JSON.parse(e.trim()),null,2)}catch{return e}}function nN({text:e}){const{t}=Mt(),n=e||"";return n.trim()?a.jsx("div",{className:"af-run-ctx-md",children:a.jsx(Td,{children:n})}):a.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.empty")})}function rN({o:e}){var r;const{t}=Mt(),n=Cv(e);if(n==="image"||e.encoding==="base64"&&((r=e.mimeType)!=null&&r.startsWith("image/"))){const s=`data:${e.mimeType||"image/png"};base64,${e.content||""}`;return a.jsxs("div",{className:"af-run-ctx-media",children:[a.jsx("img",{className:"af-run-ctx-img",src:s,alt:e.slot||"output",loading:"lazy"}),e.truncated?a.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.imageTruncated")}):null]})}if(n==="json")return a.jsx("pre",{className:"af-run-ctx-pre",children:AI(e.content||"")});if(n==="markdown"){const i=e.content||"";return i.trim()?a.jsx("div",{className:"af-run-ctx-md",children:a.jsx(Td,{children:i})}):a.jsx("div",{className:"af-run-ctx-hint",children:t("flow:runContext.empty")})}return a.jsx("pre",{className:"af-run-ctx-pre",children:e.content!=null&&e.content!==""?e.content:t("flow:runContext.empty")})}function iN(e){return mV(e)}function sN(e){var r;if(!e)return null;const t=Cv(e);if(t==="image"||e.encoding==="base64"&&((r=e.mimeType)!=null&&r.startsWith("image/")))return null;const n=e.content;return n==null||n===""?null:t==="json"?AI(String(n)):String(n)}function oN({text:e,title:t,copiedLabel:n}){const[r,i]=m.useState(!1);if(!e)return null;const s=async()=>{try{await navigator.clipboard.writeText(e),i(!0),window.setTimeout(()=>i(!1),1400)}catch{}};return a.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-copy-btn",onClick:s,title:r?n:t,"aria-label":r?n:t,children:a.jsx("span",{className:"material-symbols-outlined",children:r?"check":"content_copy"})})}const aN=2e4,TI="af:run-node-ctx-width";function jp(){return typeof window>"u"?416:Math.min(26*16,window.innerWidth-32)}function Co(e){const n=Math.max(280,Math.min(Math.floor(window.innerWidth*.92),1200));return Number.isFinite(e)?Math.min(Math.max(Math.round(e),200),n):Co(jp())}function gV(){try{const e=localStorage.getItem(TI);if(e==null)return Co(jp());const t=parseInt(e,10);return Number.isFinite(t)?Co(t):Co(jp())}catch{return Co(jp())}}async function lN(e,t,n,r){const i=new URLSearchParams({flowId:e,instanceId:t});n&&String(n).trim()&&i.set("runId",String(n).trim());const s=await fetch(`/api/node-exec-context?${i.toString()}`,{signal:r}),o=await s.text();let l;try{l=JSON.parse(o)}catch{throw new Error(o.startsWith("<!")||o.startsWith("<html")?"apiConnectError":"invalidJson")}if(!s.ok)throw new Error(l.error||"HTTP "+s.status);return l}function yV(e,t){const n=`flow:runContext.${t}`,r=e(n);return r!==n?r:t}function xV({instanceId:e,flowId:t,runId:n,nodeStatus:r,onClose:i}){const{t:s}=Mt(),[o,l]=m.useState(()=>typeof window<"u"&&window.matchMedia("(max-width: 960px)").matches),[c,d]=m.useState(gV),u=m.useRef({active:!1,pointerId:-1,startX:0,startW:416}),[p,f]=m.useState(!0),[h,y]=m.useState(""),[b,S]=m.useState([]),[g,v]=m.useState(null),[w,k]=m.useState(null),E=m.useRef(null),j=m.useRef(null),P=m.useRef(0),O=m.useRef(0);m.useLayoutEffect(()=>{const A=window.matchMedia("(max-width: 960px)"),T=()=>l(A.matches);return A.addEventListener("change",T),()=>A.removeEventListener("change",T)},[]),m.useEffect(()=>{function A(){d(T=>Co(T))}return window.addEventListener("resize",A),()=>window.removeEventListener("resize",A)},[]);const F=m.useCallback(()=>{d(A=>{const T=Co(A);try{localStorage.setItem(TI,String(T))}catch{}return T})},[]),W=m.useCallback(A=>{if(o||A.button!==0)return;A.preventDefault();const T=A.currentTarget;u.current={active:!0,pointerId:A.pointerId,startX:A.clientX,startW:c},T.setPointerCapture(A.pointerId)},[o,c]),R=m.useCallback(A=>{const T=u.current;if(!T.active||A.pointerId!==T.pointerId)return;const C=T.startX-A.clientX;d(Co(T.startW+C))},[]),I=m.useCallback(A=>{const T=u.current;if(!(!T.active||A.pointerId!==T.pointerId)){T.active=!1;try{A.currentTarget.releasePointerCapture(A.pointerId)}catch{}F()}},[F]),q=m.useCallback(()=>{const A=u.current;A.active&&(A.active=!1,F())},[F]),$=m.useCallback(A=>{const T=Array.isArray(A)?A:[];S(T),v(C=>C&&T.some(G=>G.execId===C)?C:T.length>0?T[T.length-1].execId:null)},[]),H=m.useCallback(()=>{if(!e||!t)return;const A=++P.current,T=new AbortController,C=window.setTimeout(()=>T.abort(),aN);(async()=>{try{const G=await lN(t,e,n,T.signal);if(A!==P.current)return;$(Array.isArray(G.rounds)?G.rounds:[])}catch{}finally{window.clearTimeout(C)}})()},[e,t,n,$]);m.useEffect(()=>{if(!e||!t){f(!1),y(""),S([]);return}const A=++O.current;f(!0),y(""),S([]),v(null);const T=new AbortController,C=window.setTimeout(()=>T.abort(),aN);return(async()=>{try{const G=await lN(t,e,n,T.signal);if(A!==O.current)return;$(Array.isArray(G.rounds)?G.rounds:[])}catch(G){if(A!==O.current)return;const Q=(G==null?void 0:G.name)==="AbortError"?"requestTimeout":G.message||String(G);y(Q)}finally{window.clearTimeout(C),A===O.current&&f(!1)}})(),()=>{T.abort(),O.current++,P.current++}},[e,t,n,$]),m.useEffect(()=>{r&&H()},[r,H]),m.useEffect(()=>{clearInterval(j.current);const A=b.length>0?b[b.length-1]:null;return(r==="running"&&b.length===0||!!(A&&A.status==="running"))&&e&&t&&(j.current=setInterval(()=>H(),2e3)),()=>clearInterval(j.current)},[b,e,t,n,r,H]),m.useEffect(()=>{E.current&&(E.current.scrollTop=0)},[g]);const z=b.find(A=>A.execId===g),Y=o?void 0:{width:`${c}px`};return a.jsxs("aside",{className:"af-run-ctx-panel",style:Y,"aria-label":s("flow:runContext.title"),children:[o?null:a.jsx("div",{className:"af-run-ctx-resize",role:"separator","aria-orientation":"vertical","aria-label":s("flow:runContext.resizeHandle"),onPointerDown:W,onPointerMove:R,onPointerUp:I,onPointerCancel:I,onLostPointerCapture:q}),a.jsxs("div",{className:"af-run-ctx-panel__main",children:[a.jsxs("div",{className:"af-run-ctx-head",children:[a.jsx("h2",{className:"af-run-ctx-title",title:e,children:e}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:i,"aria-label":s("common:common.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),p&&a.jsx("div",{className:"af-run-ctx-placeholder",children:s("common:common.loading")}),h&&a.jsx("div",{className:"af-run-ctx-error",children:yV(s,h)}),!p&&!h&&b.length===0&&a.jsx("div",{className:"af-run-ctx-placeholder",children:s(r==="running"?"flow:runContext.executingNoArtifacts":"flow:runContext.noData")}),b.length>0&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-run-ctx-rounds af-run-ctx-rounds--select af-run-ctx-round--"+vV((z==null?void 0:z.status)||""),children:[a.jsx("span",{className:"af-run-ctx-round-dot","aria-hidden":!0}),a.jsx("select",{className:"af-run-ctx-round-select",value:String(g??""),onChange:A=>{const T=A.target.value;v(T==="latest"?"latest":Number(T))},children:[...b].reverse().map(A=>{const T=A.execId==="latest"?s("flow:runContext.latest"):`#${A.execId}`,C=bV(s,A.status),G=A.finishedAt?` · ${wV(A.finishedAt)}`:"";return a.jsx("option",{value:String(A.execId),children:`${T} · ${C}${G}`},A.execId)})})]}),z&&a.jsxs("div",{className:"af-run-ctx-body",ref:E,children:[z.inputs&&z.inputs.length>0&&a.jsxs("section",{className:"af-run-ctx-section",children:[a.jsxs("h3",{className:"af-run-ctx-section-title",children:[a.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"input"}),"Inputs"]}),z.inputs.map((A,T)=>a.jsxs("div",{className:"af-run-ctx-output-slot",children:[a.jsx("div",{className:"af-run-ctx-slot-head",children:a.jsx("div",{className:"af-run-ctx-slot-name",children:A.slot})}),a.jsx("pre",{className:"af-run-ctx-slot-text",children:A.value})]},`${A.slot}-${T}`))]}),z.prompt!=null&&a.jsxs("section",{className:"af-run-ctx-section",children:[a.jsxs("h3",{className:"af-run-ctx-section-title",children:[a.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"description"}),"Prompt",a.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-section-expand",onClick:()=>k("prompt"),title:s("flow:nodeProps.expand"),children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),a.jsx(nN,{text:z.prompt})]}),z.outputs&&z.outputs.length>0&&a.jsxs("section",{className:"af-run-ctx-section",children:[a.jsxs("h3",{className:"af-run-ctx-section-title",children:[a.jsx("span",{className:"material-symbols-outlined af-run-ctx-section-icon","aria-hidden":!0,children:"output"}),"Outputs",a.jsx("button",{type:"button",className:"af-icon-btn af-run-ctx-section-expand",onClick:()=>k("output"),title:s("flow:nodeProps.expand"),children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),z.outputs.map((A,T)=>{const C=iN(A),G=sN(A);return a.jsxs("div",{className:"af-run-ctx-output-slot",children:[a.jsxs("div",{className:"af-run-ctx-slot-head",children:[a.jsx("div",{className:"af-run-ctx-slot-name",children:A.slot}),C?a.jsx("span",{className:"af-run-ctx-format-badge",title:s("flow:runContext.detectedContentType"),children:C}):null,a.jsx(oN,{text:G,title:s("common:common.copy"),copiedLabel:s("common:common.copied")})]}),a.jsx(rN,{o:A})]},`${A.slot}-${T}`)})]}),!z.prompt&&(!z.outputs||z.outputs.length===0)&&a.jsx("div",{className:"af-run-ctx-placeholder",children:s("flow:runContext.roundNoContent")})]})]})]}),w&&z&&a.jsx("div",{className:"af-node-props-expand-overlay",role:"dialog","aria-modal":"true",onClick:A=>{A.target===A.currentTarget&&k(null)},children:a.jsxs("div",{className:"af-node-props-expand-panel",children:[a.jsxs("div",{className:"af-node-props-expand-head",children:[a.jsx("span",{className:"af-node-props-expand-title",children:w==="prompt"?"Prompt":"Outputs"}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>k(null),"aria-label":s("common:common.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("div",{className:"af-node-props-expand-body af-run-ctx-expand-body",children:[w==="prompt"&&z.prompt!=null&&a.jsx(nN,{text:z.prompt}),w==="output"&&z.outputs&&z.outputs.map((A,T)=>{const C=iN(A),G=sN(A);return a.jsxs("div",{className:"af-run-ctx-output-slot",style:{marginBottom:"1rem"},children:[a.jsxs("div",{className:"af-run-ctx-slot-head",children:[a.jsx("div",{className:"af-run-ctx-slot-name",children:A.slot}),C?a.jsx("span",{className:"af-run-ctx-format-badge",children:C}):null,a.jsx(oN,{text:G,title:s("common:common.copy"),copiedLabel:s("common:common.copied")})]}),a.jsx(rN,{o:A})]},`${A.slot}-${T}`)})]})]})})]})}function wV(e){try{const t=new Date(e);if(isNaN(t.getTime()))return e;const n=r=>String(r).padStart(2,"0");return`${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}catch{return e}}function vV(e){const t=String(e||"").toLowerCase();return t==="success"||t==="completed"||t==="done"?"success":t==="failed"||t==="error"?"failed":t==="running"||t==="executing"?"running":t==="cache_not_met"?"cache":t?"unknown":"pending"}function bV(e,t){const n=String(t||"").toLowerCase();return n?n==="success"||n==="completed"||n==="done"?e("flow:runContext.statusSuccess",{defaultValue:"成功"}):n==="failed"||n==="error"?e("flow:runContext.statusFailed",{defaultValue:"失败"}):n==="running"||n==="executing"?e("flow:runContext.statusRunning",{defaultValue:"运行中"}):n==="cache_not_met"?e("flow:runContext.statusCacheMiss",{defaultValue:"缓存失效"}):t:e("flow:runContext.statusPending",{defaultValue:"等待"})}function kV({flowId:e,flowSource:t,flowArchived:n,provideNodes:r,edges:i,nodes:s,onCliInputsChange:o,onBackToEdit:l}){const{t:c}=Mt(),[d,u]=m.useState({}),[p,f]=m.useState(null),[h,y]=m.useState({}),[b,S]=m.useState(!0),[g,v]=m.useState(!1),[w,k]=m.useState(""),[E,j]=m.useState(!1),[P,O]=m.useState(null),F=m.useRef(null),W=m.useRef(!0),R=m.useRef({});m.useMemo(()=>{var C,G,Q;const T={};for(const M of r){const te=(Q=(G=(C=M.data)==null?void 0:C.outputs)==null?void 0:G[0])==null?void 0:Q.default;te!=null&&te!==""&&(T[M.id]=String(te))}return R.current=T,T},[r]);const I=m.useMemo(()=>{var C;const T={};for(const G of s){if(!((C=G.data)!=null&&C.inputs))continue;const Q=G.data.inputs;for(let M=0;M<Q.length;M++){const te=Q[M];if(!(te!=null&&te.name))continue;const ce=i.find(de=>de.target===G.id&&de.targetHandle===`input-${M}`);if(!(ce!=null&&ce.source))continue;r.find(de=>de.id===ce.source)&&(T[ce.source]=te.name)}}return T},[s,i,r]);m.useEffect(()=>(W.current=!0,()=>{W.current=!1}),[]),m.useEffect(()=>{if(!e){S(!1);return}S(!0);const T=new URLSearchParams({flowId:e,flowSource:t||"user"});n&&T.set("archived","1"),fetch(`/api/flow/run-config?${T.toString()}`).then(C=>{if(!C.ok)throw new Error(`HTTP ${C.status}`);return C.json()}).then(C=>{var Q;if(!W.current)return;u(C.presets||{}),f(C.activePreset||null);const G=C.activePreset&&((Q=C.presets)!=null&&Q[C.activePreset])?C.presets[C.activePreset]:{};y({...R.current,...G}),S(!1)}).catch(()=>{W.current&&(y(R.current),S(!1))})},[e,t,n]),m.useEffect(()=>{var C;if(!o)return;const T={};for(const[G,Q]of Object.entries(h)){const M=I[G];if(!M)continue;const te=r.find(le=>le.id===G);if(!te)continue;(((C=te.data)==null?void 0:C.definitionId)||"").startsWith("provide_file")?T[M]={type:"file",path:Q}:T[M]={type:"str",value:Q}}o(T)},[h,I,r,o]);const q=m.useCallback((T,C)=>{y(G=>({...G,[T]:C}))},[]),$=m.useCallback(T=>{T!==p&&(f(T),T&&d[T]?y({...R.current,...d[T]}):y(R.current))},[p,d]),H=m.useCallback(async()=>{if(w.trim()){v(!0);try{const T={...d,[w.trim()]:h},C={flowId:e,flowSource:t,archived:n,presets:T,activePreset:w.trim()};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(C)})).ok&&(u(T),f(w.trim()),k(""),j(!1))}finally{v(!1)}}},[e,t,n,d,h,w]),z=m.useCallback(async()=>{if(p){v(!0);try{const T={...d};delete T[p];const C=Object.keys(T)[0]||null;(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:e,flowSource:t,archived:n,presets:T,activePreset:C})})).ok&&(u(T),f(C),C&&T[C]?y({...R.current,...T[C]}):y(R.current))}finally{v(!1)}}},[e,t,n,d,p]),Y=m.useCallback(async()=>{if(p){v(!0);try{const T={...d,[p]:h};(await fetch("/api/flow/run-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:e,flowSource:t,archived:n,presets:T,activePreset:p})})).ok&&u(T)}finally{v(!1)}}},[e,t,n,d,p,h]),A=Object.keys(d);return A.length>0,b?a.jsx("aside",{className:"af-run-config-panel",children:a.jsx("div",{className:"af-run-config-loading",children:c("common.loading")})}):a.jsxs("aside",{className:"af-run-config-panel",children:[a.jsxs("div",{className:"af-run-config-preset",children:[a.jsx("label",{className:"af-run-config-preset-label",children:c("flow:runConfig.preset")}),a.jsxs("div",{className:"af-run-config-preset-row",children:[a.jsxs("select",{className:"af-run-config-preset-select",value:p||"",onChange:T=>$(T.target.value||null),disabled:g,children:[a.jsx("option",{value:"",children:c("flow:runConfig.default")}),A.map(T=>a.jsx("option",{value:T,children:T},T))]}),a.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--new",onClick:()=>j(!0),disabled:g,title:c("flow:runConfig.newPreset"),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"})}),p&&a.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--save",onClick:Y,disabled:g,title:c("flow:runConfig.savePreset"),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"})}),p&&a.jsx("button",{type:"button",className:"af-run-config-preset-btn af-run-config-preset-btn--delete",onClick:z,disabled:g,title:c("flow:runConfig.deletePreset"),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"delete"})})]})]}),E&&a.jsxs("div",{className:"af-run-config-save-dialog",children:[a.jsx("input",{type:"text",className:"af-run-config-save-input",placeholder:c("flow:runConfig.presetNamePlaceholder"),value:w,onChange:T=>k(T.target.value),disabled:g}),a.jsxs("div",{className:"af-run-config-save-actions",children:[a.jsx("button",{type:"button",className:"af-btn-primary",onClick:H,disabled:g||!w.trim(),children:c(g?"common.saving":"common.save")}),a.jsx("button",{type:"button",className:"af-btn-outline",onClick:()=>{j(!1),k("")},disabled:g,children:c("common.cancel")})]})]}),a.jsxs("div",{className:"af-run-config-inputs",children:[a.jsx("div",{className:"af-run-config-inputs-header",children:c("flow:runConfig.inputParams")}),r.length===0?a.jsx("div",{className:"af-run-config-empty",children:c("flow:runConfig.noProvideNodes")}):a.jsx("div",{className:"af-run-config-input-list",children:r.map(T=>{var de,ue;const C=((de=T.data)==null?void 0:de.definitionId)||"",G=C.startsWith("provide_file"),Q=C==="provide_bool",M=((ue=T.data)==null?void 0:ue.label)||T.id,te=T.id,ce=h[te]||"",le=["true","1","yes","on"].includes(String(ce).trim().toLowerCase());return a.jsxs("div",{className:"af-run-config-input-item",children:[a.jsxs("div",{className:"af-run-config-input-head",children:[a.jsx("span",{className:"af-run-config-input-icon material-symbols-outlined"+(G?" af-run-config-input-icon--file":""),"aria-hidden":!0,children:G?"description":Q?"toggle_on":"text_fields"}),a.jsx("span",{className:"af-run-config-input-label",children:M}),Q?null:a.jsx("button",{type:"button",className:"af-run-config-input-expand",onClick:()=>O({instanceId:te,label:M,content:ce}),"aria-label":c("flow:runConfig.expandInput"),title:c("flow:runConfig.expandInput"),children:a.jsx("span",{className:"material-symbols-outlined",children:"open_in_full"})})]}),a.jsx("div",{className:"af-run-config-input-id",children:te}),Q?a.jsx("button",{type:"button",className:"af-run-config-bool-toggle"+(le?" af-run-config-bool-toggle--true":""),onClick:()=>q(te,le?"false":"true"),"aria-pressed":le,children:le?"true":"false"}):a.jsx("input",{type:"text",className:"af-run-config-input-field",value:ce,onChange:se=>q(te,se.target.value),placeholder:c(G?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},te)})})]}),P&&Tr.createPortal(a.jsx("div",{className:"af-provide-edit-overlay",children:a.jsxs("div",{className:"af-provide-edit-modal",role:"dialog","aria-modal":"true",children:[a.jsxs("div",{className:"af-provide-edit-modal__head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit_document"}),a.jsx("span",{className:"af-provide-edit-modal__title",children:P.label}),a.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>O(null),"aria-label":c("common:close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-provide-edit-modal__body",children:a.jsx("textarea",{ref:F,className:"af-provide-edit-modal__textarea",defaultValue:P.content,autoFocus:!0})}),a.jsxs("div",{className:"af-provide-edit-modal__foot",children:[a.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn af-provide-edit-modal__btn--save",onClick:()=>{!P||!F.current||(q(P.instanceId,F.current.value),O(null))},children:[a.jsx("span",{className:"material-symbols-outlined",children:"save"}),c("flow:provideEdit.save")]}),a.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn",onClick:()=>O(null),children:[a.jsx("span",{className:"material-symbols-outlined",children:"close"}),c("flow:provideEdit.cancel")]})]})]})}),document.body)]})}const RI={ai:["planner-system","planner-user","planner-response","agent-step-prompt","repair-prompt","ai-thinking","ai-assistant","ai-result","ai-tool"],flow:["composer-start","classify","plan","phase-plan","phase-complete","phase-auto-continue","composer-done"],step:["step-start","step-progress","step-done","validation"],output:["natural","status"],error:["error"]},SV={"planner-system":"#9ecaff","planner-user":"#9ecaff","planner-response":"#7c4dff","agent-step-prompt":"#7c4dff","repair-prompt":"#ff6b6b","ai-thinking":"#a8b9d4","ai-assistant":"#e8deff","ai-result":"#00e475","ai-tool":"#9ecaff","composer-start":"#00e475","composer-done":"#00e475","step-start":"#e8deff","step-done":"#e8deff","step-progress":"#e8deff",natural:"#a8a8a8",status:"#a8a8a8",error:"#ff6b6b","phase-plan":"#00e475","phase-complete":"#00e475"};function NV(e){return!e||e<1024?`${e||0} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(2)} MB`}function jV(e){if(!e)return"";const t=new Date(e);return isNaN(t.getTime())?e:`${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}:${t.getSeconds().toString().padStart(2,"0")}.${t.getMilliseconds().toString().padStart(3,"0")}`}function CV(e){if(!e)return"";const t=new Date(e);return isNaN(t.getTime())?e:`${t.getMonth()+1}/${t.getDate()} ${t.getHours().toString().padStart(2,"0")}:${t.getMinutes().toString().padStart(2,"0")}`}function cN(e,t){if(e==="natural"&&t&&typeof t=="object"){const n=t.kind;if(n==="thinking"||n==="assistant"||n==="result"||n==="tool")return"ai";if(n==="error")return"error"}for(const[n,r]of Object.entries(RI))if(r.includes(e))return n;return"other"}function EV({event:e,defaultExpanded:t}){const[n,r]=m.useState(!!t),i=SV[e.tag]||"#a8a8a8",s=e.payload,o=s&&typeof s=="object",l=o?typeof s.text=="string"?s.text:"":String(s||""),c=o?s.meta:null,d=m.useMemo(()=>l?l.slice(0,140).replace(/\s+/g," "):o?Object.keys(s).filter(h=>h!=="text"&&h!=="meta").slice(0,3).map(h=>{const y=s[h];return y==null?`${h}:null`:typeof y=="object"?`${h}:{…}`:`${h}:${String(y).slice(0,30)}`}).join(" "):"",[s,l,o]),u=m.useCallback(p=>{p.stopPropagation();const f=o?JSON.stringify(s,null,2):String(s);try{navigator.clipboard.writeText(f)}catch{}},[s,o]);return a.jsxs("div",{style:{borderLeft:`3px solid ${i}`,background:n?"#1c1b1b":"#131313",marginBottom:4,borderRadius:4,cursor:"pointer",transition:"background 120ms"},onClick:()=>r(p=>!p),children:[a.jsxs("div",{style:{padding:"6px 10px",display:"flex",alignItems:"center",gap:10,fontSize:12},children:[a.jsx("span",{style:{color:"#9a9a9a",fontFamily:"monospace",flexShrink:0},children:jV(e.ts)}),a.jsx("span",{style:{color:i,fontWeight:600,fontFamily:"monospace",flexShrink:0,padding:"1px 6px",background:"rgba(255,255,255,0.04)",borderRadius:3},children:e.tag}),a.jsx("span",{style:{color:"#c5c2c1",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"monospace"},children:d}),n&&a.jsx("button",{type:"button",onClick:u,style:{background:"rgba(124,77,255,0.15)",color:"#e8deff",border:"none",borderRadius:3,padding:"2px 8px",fontSize:11,cursor:"pointer"},children:"Copy"})]}),n&&a.jsxs("div",{style:{padding:"0 10px 10px 10px",borderTop:"1px solid rgba(255,255,255,0.04)"},children:[c&&Object.keys(c).length>0&&a.jsx("div",{style:{marginTop:8,padding:8,background:"#0e0e0e",borderRadius:4,fontSize:11,fontFamily:"monospace",color:"#9ecaff",whiteSpace:"pre-wrap",wordBreak:"break-all"},children:JSON.stringify(c,null,2)}),l?a.jsx("pre",{style:{marginTop:8,padding:10,background:"#0e0e0e",borderRadius:4,fontSize:12,color:"#e5e2e1",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:600,overflowY:"auto",margin:"8px 0 0 0",fontFamily:"ui-monospace, SF Mono, Menlo, monospace"},children:l}):o?a.jsx("pre",{style:{marginTop:8,padding:10,background:"#0e0e0e",borderRadius:4,fontSize:12,color:"#e5e2e1",whiteSpace:"pre-wrap",wordBreak:"break-all",maxHeight:400,overflowY:"auto",margin:"8px 0 0 0",fontFamily:"ui-monospace, SF Mono, Menlo, monospace"},children:JSON.stringify(s,null,2)}):null]})]})}function _V({open:e,onClose:t,flowId:n}){var O;const[r,i]=m.useState([]),[s,o]=m.useState(!1),[l,c]=m.useState(null),[d,u]=m.useState(null),[p,f]=m.useState(!1),[h,y]=m.useState(!0),[b,S]=m.useState({ai:!0,flow:!0,step:!0,output:!0,error:!0}),[g,v]=m.useState(""),w=m.useRef(null),k=m.useCallback(async()=>{o(!0);try{const F=h&&n?`?flowId=${encodeURIComponent(n)}`:"",R=await(await fetch(`/api/composer-logs${F}`)).json();i(Array.isArray(R.sessions)?R.sessions:[])}catch{i([])}finally{o(!1)}},[n,h]),E=m.useCallback(async F=>{if(!F){u(null);return}f(!0);try{const R=await(await fetch(`/api/composer-logs/${encodeURIComponent(F)}`)).json();u(R)}catch{u(null)}finally{f(!1)}},[]);m.useEffect(()=>{e&&k()},[e,k]),m.useEffect(()=>{if(!(!e||!l))return E(l),w.current=setInterval(()=>E(l),2e3),()=>{w.current&&clearInterval(w.current),w.current=null}},[e,l,E]);const j=m.useMemo(()=>{const F=(d==null?void 0:d.events)||[],W=g.trim().toLowerCase();return F.filter(R=>{const I=cN(R.tag,R.payload);return!b[I]&&I!=="other"?!1:W?[R.tag,JSON.stringify(R.payload||"")].join(" ").toLowerCase().includes(W):!0})},[d,b,g]),P=m.useMemo(()=>{const F=(d==null?void 0:d.events)||[],W={};for(const R of F){const I=cN(R.tag,R.payload);W[I]=(W[I]||0)+1}return W},[d]);return e?a.jsxs("div",{style:{position:"fixed",top:0,right:0,bottom:0,width:"min(1100px, 80vw)",background:"#131313",borderLeft:"1px solid rgba(255,255,255,0.08)",display:"flex",flexDirection:"column",zIndex:9999,boxShadow:"-8px 0 32px rgba(0,0,0,0.5)",color:"#e5e2e1",fontFamily:"Inter, system-ui, sans-serif"},children:[a.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid rgba(255,255,255,0.06)",display:"flex",alignItems:"center",gap:12,flexShrink:0,background:"#1c1b1b"},children:[a.jsx("span",{style:{fontWeight:600,fontSize:14},children:"Composer Logs"}),a.jsx("span",{style:{fontSize:11,color:"#9a9a9a"},children:n?`flowId: ${n}`:"no flow selected"}),a.jsxs("label",{style:{fontSize:11,color:"#9a9a9a",display:"flex",alignItems:"center",gap:4,cursor:"pointer"},children:[a.jsx("input",{type:"checkbox",checked:h,onChange:F=>y(F.target.checked),disabled:!n}),"仅显示当前 flow"]}),a.jsx("button",{type:"button",onClick:k,style:{background:"rgba(124,77,255,0.15)",color:"#e8deff",border:"none",borderRadius:4,padding:"4px 10px",fontSize:12,cursor:"pointer"},children:"Refresh"}),a.jsx("span",{style:{flex:1}}),a.jsx("button",{type:"button",onClick:t,style:{background:"transparent",color:"#e5e2e1",border:"1px solid rgba(255,255,255,0.12)",borderRadius:4,padding:"4px 12px",fontSize:12,cursor:"pointer"},children:"Close"})]}),a.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden",minHeight:0},children:[a.jsxs("div",{style:{width:280,borderRight:"1px solid rgba(255,255,255,0.06)",overflowY:"auto",background:"#0e0e0e",flexShrink:0},children:[s&&a.jsx("div",{style:{padding:12,fontSize:12,color:"#9a9a9a"},children:"Loading…"}),!s&&r.length===0&&a.jsx("div",{style:{padding:12,fontSize:12,color:"#9a9a9a"},children:h&&n?"no sessions for this flow":"no sessions"}),r.map(F=>{const W=l===F.sessionId;return a.jsxs("div",{onClick:()=>c(F.sessionId),style:{padding:"10px 12px",borderBottom:"1px solid rgba(255,255,255,0.04)",cursor:"pointer",background:W?"rgba(124,77,255,0.18)":"transparent",borderLeft:W?"3px solid #7c4dff":"3px solid transparent"},children:[a.jsx("div",{style:{fontSize:12,fontWeight:600,color:"#e5e2e1"},children:CV(F.mtime)}),a.jsx("div",{style:{fontSize:11,color:"#9ecaff",marginTop:2,fontFamily:"monospace"},children:F.flowId||"(no flow)"}),F.promptPreview&&a.jsx("div",{style:{fontSize:11,color:"#9a9a9a",marginTop:4,overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical"},children:F.promptPreview}),a.jsxs("div",{style:{fontSize:10,color:"#6a6a6a",marginTop:4},children:[NV(F.size)," · ",F.model||"default"]})]},F.sessionId)})]}),a.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minHeight:0},children:[a.jsxs("div",{style:{padding:"10px 16px",borderBottom:"1px solid rgba(255,255,255,0.06)",display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",flexShrink:0,background:"#1c1b1b"},children:[Object.keys(RI).map(F=>a.jsxs("button",{type:"button",onClick:()=>S(W=>({...W,[F]:!W[F]})),style:{background:b[F]?"rgba(124,77,255,0.25)":"transparent",color:b[F]?"#e8deff":"#6a6a6a",border:`1px solid ${b[F]?"rgba(124,77,255,0.4)":"rgba(255,255,255,0.08)"}`,borderRadius:999,padding:"3px 12px",fontSize:11,cursor:"pointer",fontFamily:"monospace",textTransform:"uppercase"},children:[F," ",P[F]!=null?`(${P[F]})`:""]},F)),a.jsx("input",{type:"text",placeholder:"search…",value:g,onChange:F=>v(F.target.value),style:{marginLeft:8,flex:1,minWidth:120,background:"#0e0e0e",border:"1px solid rgba(255,255,255,0.08)",borderRadius:4,color:"#e5e2e1",padding:"4px 8px",fontSize:12}})]}),a.jsxs("div",{style:{flex:1,overflowY:"auto",padding:12,minHeight:0},children:[!l&&a.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20,textAlign:"center"},children:"Select a session on the left to view events"}),p&&!d&&a.jsx("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:"Loading…"}),d&&j.length===0&&a.jsxs("div",{style:{color:"#9a9a9a",fontSize:12,padding:20},children:["No events match current filter (",((O=d.events)==null?void 0:O.length)||0," total)"]}),j.map((F,W)=>a.jsx(EV,{event:F,defaultExpanded:F.tag==="error"},`${F.ts}_${W}`))]})]})]})]}):null}const PV="0.1.33";function uN(e){const t=Math.max(0,Number(e)||0),n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4),i=Math.floor(t%6e4/1e3);return`${String(n).padStart(2,"0")}:${String(r).padStart(2,"0")}:${String(i).padStart(2,"0")}`}function zg(e,t){return t==="running"?uN(e):e==null||!Number.isFinite(e)||e<=0?"--":uN(e)}const LI=m.createContext({modelLists:{cursor:[],opencode:[]},onModelChange:()=>{}});function IV(e){const{setNodes:t}=Ba(),{modelLists:n,onModelChange:r}=m.useContext(LI),i=m.useCallback(l=>{t(c=>c.filter(d=>d.id!==l))},[t]),s=m.useCallback(()=>{var u,p,f,h,y,b,S,g;const l=((u=e.data)==null?void 0:u.definitionId)||"",c=((p=e.data)==null?void 0:p.label)||e.id,d=((y=(h=(f=e.data)==null?void 0:f.outputs)==null?void 0:h[0])==null?void 0:y.value)||((g=(S=(b=e.data)==null?void 0:b.outputs)==null?void 0:S[0])==null?void 0:g.default)||"";window.__provideEditContent={instanceId:e.id,label:c,definitionId:l,content:d},window.dispatchEvent(new CustomEvent("provide-expand"))},[e.id,e.data]),o=m.useCallback((l,c)=>{t(d=>d.map(u=>{var f;if(u.id!==l)return u;const p=Array.isArray((f=u.data)==null?void 0:f.outputs)&&u.data.outputs.length?u.data.outputs.map((h,y)=>y===0?{...h,default:c,value:c}:h):[{type:"bool",name:"value",default:c,value:c}];return{...u,data:{...u.data,body:c,outputs:p}}}))},[t]);return a.jsx(SI,{...e,deleteNode:i,onProvideExpand:s,onProvideValueChange:o,modelLists:n,onModelChange:r})}const AV={[Rd]:IV},fu=["CONTROL","TOOL","PROVIDE","AGENT"],TV=1200,dN="af-flow-node--sync-flash",fN="af-flow-edge--sync-flash";function pN(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).includes(t)?n:`${n} ${t}`:t}function hN(e,t){const n=String(e||"").trim();return n?n.split(/\s+/).filter(r=>r&&r!==t).join(" "):""}function Ev(e){const t=((e==null?void 0:e.id)??"").trim();return/^control/i.test(t)?"CONTROL":/^tool/i.test(t)?"TOOL":/^provide/i.test(t)?"PROVIDE":"AGENT"}function RV(e){const t=Ev(e);return t==="CONTROL"?"control":t==="PROVIDE"?"provide":t==="TOOL"?"tool":"agent"}function Xf(e){return(Array.isArray(e)?e:[]).map(n=>{const r=String((n==null?void 0:n.name)||(n==null?void 0:n.id)||"").trim(),i=String((n==null?void 0:n.type)||"").trim();return!r&&!i?"":i?`${r||"-"}: ${i}`:r}).filter(Boolean)}function OI(e){return String((e==null?void 0:e.label)||"").trim()||String((e==null?void 0:e.id)||"").trim()}function MI(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function Bg(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 mN(e,t,n){const r=String((t==null?void 0:t.name)||(t==null?void 0:t.id)||`#${n+1}`).trim(),i=String((t==null?void 0:t.type)||"").trim(),s=String((t==null?void 0:t.default)??(t==null?void 0:t.value)??"").trim();return[e,r,i?`type: ${i}`:"",s?`default: ${s}`:""].filter(Boolean).join(" · ")}function gN(e,t){const n=Array.isArray(e)?e:[],r=n.slice(0,4),i=Math.max(0,n.length-r.length);return{list:n,shown:r,hidden:i,kind:t}}function LV(e){return e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function OV(e,t){return t?[e==null?void 0:e.id,e==null?void 0:e.label,e==null?void 0:e.description].filter(Boolean).some(r=>String(r).toLowerCase().includes(t)):!0}function $I(e,t,n,r,i){const s=RV(e),o={id:t,type:Rd,position:n,data:{label:e.label??e.id,definitionId:e.id,schemaType:s,inputs:Array.isArray(e.inputs)?e.inputs.map(l=>({...l})):[],outputs:Array.isArray(e.outputs)?e.outputs.map(l=>({...l})):[]}};return fd(o,r,i)}function yN(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 i=new Map(t.map(d=>[d.id,d])),s=i.get(n),o=i.get(r),l=lc(s,e.sourceHandle||"output-0","source"),c=lc(o,e.targetHandle||"input-0","target");return!l||!c?!1:ac(l,c)}function MV(e,t){const n=String((e==null?void 0:e.nodeId)||""),r=String((e==null?void 0:e.handleId)||""),i=(e==null?void 0:e.handleType)==="target"?"target":(e==null?void 0:e.handleType)==="source"?"source":"";if(!n||!r||!i)return null;const s=t.find(l=>l.id===n),o=lc(s,r,i);return o?{nodeId:n,handleId:r,handleType:i,slot:o,slotType:kI(o)}:null}function $V(e,t,n){var o;const r=$I(e,`__candidate_${e.id}`,{x:0,y:0},{},t),i=n.handleType==="source"?"inputs":"outputs",s=Array.isArray((o=r.data)==null?void 0:o[i])?r.data[i]:[];for(let l=0;l<s.length;l+=1){const c=s[l];if(n.handleType==="source"?ac(n.slot,c):ac(c,n.slot))return{slot:c,slotIndex:l,hydrated:r}}return null}function FV(e,t){return t?e.map((n,r)=>{const i=$V(n,e,t);if(!i)return null;const s=Ev(n);return{def:n,order:r,category:s,categoryRank:fu.indexOf(s),slot:i.slot,slotIndex:i.slotIndex,displayLabel:OI(i.hydrated.data||n),description:MI(n)}}).filter(Boolean).sort((n,r)=>{var o,l;const i=(o=n.slot)!=null&&o.required?0:1,s=(l=r.slot)!=null&&l.required?0:1;return i-s||n.slotIndex-r.slotIndex||n.categoryRank-r.categoryRank||n.order-r.order}):[]}const DV=/@([a-zA-Z_][a-zA-Z0-9_]*)/g;function zV(e){const t=new Set,n=[];let r;const i=new RegExp(DV.source,"g");for(;(r=i.exec(e))!==null;){const s=r[1];t.has(s)||(t.add(s),n.push(s))}return n}function xN(e,t){const n=e.slice(0,t),r=n.lastIndexOf("@");if(r<0)return null;const i=n.slice(r+1);return/[\s\n]/.test(i)?null:{atIndex:r,query:i}}function Fs(e){const t=String(e||"").indexOf(" - ");return t>=0?e.slice(0,t).trim():String(e||"").trim()}function Jf(e,t,n,r){const i=(e||"").trim();if(!i)return"";if(i.startsWith("opencode:")||i.startsWith("claude-code:"))return i;const s=Array.isArray(t)?t:[],o=Array.isArray(n)?n:[],l=Array.isArray(r)?r:[],c=s.map(Fs),d=o.map(Fs);return l.map(Fs).includes(i)&&!c.includes(i)&&!d.includes(i)?`claude-code:${i}`:d.includes(i)&&!c.includes(i)?`opencode:${i}`:i}function BV(e){if(e==null)return"";const t=String(e).trim();return t?t.length<=26?t:`${t.slice(0,12)}…${t.slice(-10)}`:""}function Hg(e){if(!Array.isArray(e)||e.length===0)return 0;let t=0;for(const n of e){const r=/^(?:对话|Conversation|Chat)\s*(\d+)\s*$/.exec(String((n==null?void 0:n.label)??"").trim());r&&(t=Math.max(t,parseInt(r[1],10)))}return t}function HV({steps:e}){const{t}=Mt();return!e||e.length===0?null:a.jsx("div",{className:"af-composer-steps-track",role:"list","aria-label":t("flow:composer.stepsAriaLabel"),children:e.map(n=>{const r=String(n.description||n.type||"").trim(),i=n.model||n.executorModel,s=[`${n.index+1}. ${r||"—"}`,n.nodeRole?t("flow:composer.stepRoleLabel",{role:n.nodeRole}):"",n.instanceId?t("flow:composer.stepInstanceLabel",{instanceId:n.instanceId}):"",i?`${t("flow:palette.model")}:${i}`:""].filter(Boolean).join(`
125
- `),o=n.status||"pending";return a.jsxs("div",{className:"af-composer-step-chip"+(o==="done"?" af-composer-step-chip--done":"")+(o==="running"?" af-composer-step-chip--running":"")+(o==="error"?" af-composer-step-chip--error":"")+(o==="pending"?" af-composer-step-chip--pending":""),role:"listitem",title:s,children:[a.jsx("span",{className:"af-composer-step-chip-idx",children:n.index+1}),a.jsx("span",{className:"af-composer-step-chip-main",children:n.nodeRole||i?a.jsxs("span",{className:"af-composer-step-chip-meta",children:[n.nodeRole?a.jsx("span",{className:"af-composer-step-chip-role",children:n.nodeRole}):null,i?a.jsx("span",{className:"af-composer-step-chip-model",children:BV(i)}):null]}):null})]},n.index)})})}function UV(e,t){const n=e.trim(),r=t.trim();return r?n?!!(n===r||n.endsWith(r)||r.length>=8&&n.includes(r)):!1:!0}function VV(e){const t=[];for(const n of e){if(!n||typeof n.text!="string"||!n.text.trim())continue;const i=typeof n.kind=="string"&&n.kind?n.kind:"assistant",s=t[t.length-1];s&&s.kind===i?s.text+=i==="error"||i==="result"?`
126
- ${n.text}`:n.text:t.push({kind:i,text:n.text})}return t}function WV(e,t){return e==="thinking"?t("flow:composer.thinking"):e==="result"?t("flow:composer.result"):e==="assistant"?t("flow:composer.reply"):e==="error"?t("flow:composer.error"):String(e)}function KV(e){return e==="thinking"?"af-composer-ai-block af-composer-ai-block--thinking":e==="result"?"af-composer-ai-block af-composer-ai-block--result":e==="assistant"?"af-composer-ai-block af-composer-ai-block--reply":e==="error"?"af-composer-ai-block af-composer-ai-block--error":"af-composer-ai-block af-composer-ai-block--reply"}function wN({thread:e,liveSegments:t,running:n,className:r="",autoScroll:i=!0}){const{t:s}=Mt(),o=m.useRef(null),l=["af-composer-ai-stack","af-composer-ai-stack--in-panel","af-composer-thread-stack",r].filter(Boolean).join(" ");return m.useEffect(()=>{if(!i||!o.current)return;const c=o.current;requestAnimationFrame(()=>{c.scrollTop=c.scrollHeight})},[e,t,i]),a.jsxs("div",{ref:o,className:l,children:[e.map((c,d)=>c.type==="user"?a.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--user-msg",children:[a.jsx("div",{className:"af-composer-ai-block-label",children:s("flow:composer.yourQuestion")}),a.jsx("div",{className:"af-composer-ai-block-body",children:c.text})]},`composer-u-${d}-${c.text.slice(0,48)}`):a.jsx("div",{className:"af-composer-thread-assistant",children:a.jsx(vN,{segments:c.segments,running:!1})},`composer-a-${d}`)),a.jsx("div",{className:"af-composer-thread-assistant",children:a.jsx(vN,{segments:t,running:n})})]})}function vN({segments:e,running:t=!1}){const{t:n}=Mt(),r=e.filter(p=>p.kind==="assistant").map(p=>p.text).join(""),i=e.filter(p=>p.kind==="result").map(p=>p.text).join(""),s=UV(r,i),o=e.filter(p=>p.kind==="error").map(p=>p.text).join(`
127
- `),l=e.filter(p=>p.kind!=="error"),c=s?l.filter(p=>p.kind!=="result"):l,d=VV(c),u=!!(d.length>0||o);return a.jsxs(a.Fragment,{children:[d.map((p,f)=>a.jsxs("section",{className:KV(p.kind),children:[a.jsx("div",{className:"af-composer-ai-block-label",children:WV(p.kind,n)}),a.jsx("div",{className:"af-composer-ai-block-body",children:p.text})]},`${p.kind}-${f}`)),t&&!u?a.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--reply af-composer-ai-block--pending",children:[a.jsx("div",{className:"af-composer-ai-block-label",children:n("flow:composer.reply")}),a.jsx("div",{className:"af-composer-ai-block-body",children:n("flow:composer.waiting")})]}):null,o?a.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--error",children:[a.jsx("div",{className:"af-composer-ai-block-label",children:n("flow:composer.error")}),a.jsx("div",{className:"af-composer-ai-block-body",children:o})]}):null]})}function qV({fitViewEpoch:e}){const{fitView:t}=Ba(),n=m.useRef(t);return n.current=t,m.useEffect(()=>{if(e>0){const r=requestAnimationFrame(()=>n.current({padding:.2,duration:200,maxZoom:1}));return()=>cancelAnimationFrame(r)}},[e]),null}function YV({onReady:e}){const t=H_();return m.useEffect(()=>(e(t),()=>e(null)),[e,t]),null}function bN(e){const t=Number.isFinite(e)?e:1;return Math.min(Math.max(t,.75),1)}const Cp=1500,kN=500,GV=262144,XV=2e3;function Ug(e){return typeof e!="string"?"":e.length<=XV?e:`[log line truncated, ${e.length} chars]`}const JV=Cp;function QV(e){const t=e.match(/^\[([^\]]+)\]\s+\[([^\]]+)\]\s+([\s\S]*)$/);if(!t)return null;const[,n,r,i]=t;if(r==="cli")try{const s=JSON.parse(i);return s&&s.event==="node-start"?{ts:n,type:"node-start",text:`节点 ${s.instanceId||""}${s.label?` · ${s.label}`:""} 开始`}:s&&s.event==="node-done"?{ts:n,type:"node-done",text:`节点 ${s.instanceId||""} 完成${s.elapsed?` (${s.elapsed})`:""}`}:s&&s.event==="node-failed"?{ts:n,type:"node-failed",text:`节点 ${s.instanceId||""} 失败${s.error?`: ${s.error}`:""}`}:s&&s.event==="apply-start"?{ts:n,type:"info",text:`[apply-start] uuid=${s.uuid||""}`}:{ts:n,type:"info",text:Ug(i)}}catch{return{ts:n,type:"info",text:Ug(i)}}return{ts:n,type:"log",text:Ug(`[${r}] ${i}`)}}function SN(e){if(!e)return[];const t=[],n=e.split(`
128
- `);for(let r=n.length-1;r>=0&&t.length<JV;r--){const i=n[r];if(!i)continue;const s=QV(i);s&&t.push(s)}return t.reverse(),t}function ZV(e,t){if(e===t)return!0;if(!e||!t)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const i of n){const s=e[i],o=t[i];if(!o)return!1;if(s!==o&&(s.status!==o.status||(s.elapsed??null)!==(o.elapsed??null)))return!1}return!0}function eW(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function tW({fitViewEpoch:e,canvasTool:t,nodes:n,edges:r,onNodesChange:i,onEdgesChange:s,onConnect:o,onConnectStart:l,onConnectEnd:c,isValidConnection:d,onNodesDelete:u,onNodeClick:p,onNodeDoubleClick:f,onEdgeClick:h,onFlowInit:y,onDrop:b,onDragOver:S,hideMinimapAndControls:g,bottomSlot:v}){const{t:w}=Mt(),k=!i,E=k||t==="pan"?!0:[1,2],j=k?!1:t==="select",P="af-flow-canvas"+(k?" af-flow-canvas--run-mode":"")+(t==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select"),O=m.useCallback(()=>{},[]),F=m.useMemo(()=>{const W=new Map(n.map(H=>[H.id,H])),R=new Set(n.filter(H=>H.selected).map(H=>H.id)),I=R.size>0,q=(H,z)=>{const Y=/^#([0-9a-f]{6})$/i.exec(H);if(!Y)return H;const A=parseInt(Y[1],16);return`rgba(${A>>16&255}, ${A>>8&255}, ${A&255}, ${z})`},$="#ff5169";return r.map(H=>{var fe,ye,Se,He;const z=W.get(H.source),Y=W.get(H.target),A=/^output-(\d+)$/.exec(H.sourceHandle||""),T=/^input-(\d+)$/.exec(H.targetHandle||""),C=z&&A?(ye=(fe=z.data)==null?void 0:fe.outputs)==null?void 0:ye[parseInt(A[1],10)]:null,G=Y&&T?(He=(Se=Y.data)==null?void 0:Se.inputs)==null?void 0:He[parseInt(T[1],10)]:null,Q=C!=null&&C.type?vn(C.type):null,M=G!=null&&G.type?vn(G.type):null,te=Q&&M&&Q!==M,ce=I&&(R.has(H.source)||R.has(H.target)),le=H.style||{};if(te){const st=H.selected?.95:ce?.85:.78,Ke=q($,st);return{...H,className:((H.className||"")+" af-flow-edge--type-mismatch"+(ce?" af-flow-edge--adjacent":"")).trim(),style:{...le,stroke:Ke,strokeWidth:ce?2.75:2.5,strokeDasharray:"6 4"},markerEnd:H.markerEnd&&typeof H.markerEnd=="object"?{...H.markerEnd,color:Ke}:{type:zr.ArrowClosed,color:Ke}}}const de=Q||M;if(!de)return ce?{...H,className:((H.className||"")+" af-flow-edge--adjacent").trim(),style:{...le,strokeWidth:2.5}}:H;const ue=ce||H.selected?.7:.38,se=q(de,ue),re=ce?2.5:le.strokeWidth??2;return{...H,className:((H.className||"")+(ce?" af-flow-edge--adjacent":"")).trim(),style:{...le,stroke:se,strokeWidth:re},markerEnd:H.markerEnd&&typeof H.markerEnd=="object"?{...H.markerEnd,color:se}:{type:zr.ArrowClosed,color:se}}})},[n,r]);return a.jsxs(B_,{className:P,nodes:n,edges:F,onNodesChange:i||O,onEdgesChange:s||O,onConnect:k?void 0:o,onConnectStart:k?void 0:l,onConnectEnd:k?void 0:c,isValidConnection:k?void 0:d,onNodesDelete:k?void 0:u,onNodeClick:p,onNodeDoubleClick:k?void 0:f,onEdgeClick:k?void 0:h,onInit:y,onDrop:k?void 0:b,onDragOver:k?void 0:S,nodeTypes:AV,selectionOnDrag:j,panOnDrag:E,nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k,edgesFocusable:!k,panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,defaultEdgeOptions:{style:{stroke:"rgba(205, 189, 255, 0.45)",strokeWidth:2}},connectionLineStyle:{stroke:"rgba(205, 189, 255, 0.65)",strokeWidth:2},children:[a.jsx(K_,{gap:20,size:1,color:"rgba(28, 27, 27, 0.9)"}),a.jsx(sc,{position:"bottom-center",className:"af-flow-bottom-unified-panel"+(g?" af-flow-bottom-unified-panel--solo":""),children:a.jsxs("div",{className:"af-flow-bottom-unified-row"+(g?" af-flow-bottom-unified-row--solo":""),children:[g?null:a.jsx("div",{className:"af-flow-bottom-unified__side af-flow-bottom-unified__side--minimap",children:a.jsx(j4,{zoomable:!0,pannable:!0,position:"bottom-left",className:"af-flow-bottom-minimap",style:{width:152,height:104},maskColor:"rgba(14, 14, 14, 0.85)",nodeColor:W=>{var I;const R=(((I=W.data)==null?void 0:I.schemaType)??"agent").toLowerCase();return R==="control"?"rgba(237, 108, 2, 0.85)":R==="provide"?"rgba(0, 228, 117, 0.35)":R==="tool"?"rgba(124, 77, 255, 0.75)":"rgba(158, 202, 255, 0.5)"}})}),a.jsx("div",{className:"af-flow-bottom-unified__center",children:v}),g?null:a.jsx("div",{className:"af-flow-bottom-unified__side af-flow-bottom-unified__side--zoom",children:a.jsx(f4,{position:"bottom-right",showInteractive:!1,className:"af-flow-bottom-controls"})})]})}),!g&&a.jsx(sc,{position:"bottom-left",className:"af-pin-legend",children:[{type:"node",color:"#ff9800"},{type:"text",color:"#2196f3"},{type:"file",color:"#4caf50"},{type:"bool",color:"#9c27b0"}].map(({type:W,color:R})=>a.jsxs("span",{className:"af-pin-legend__item",children:[a.jsx("span",{className:"af-pin-legend__dot",style:{background:R}}),a.jsx("span",{className:"af-pin-legend__label",children:W})]},W))}),a.jsx(qV,{fitViewEpoch:e}),!k&&n.length===0?a.jsxs("div",{className:"af-flow-empty-hint",children:[a.jsx("span",{className:"af-flow-empty-hint-icon material-symbols-outlined",children:"account_tree"}),a.jsx("p",{className:"af-flow-empty-hint-text",children:w("flow:emptyCanvas.composerHint")}),a.jsx("p",{className:"af-flow-empty-hint-sub",dangerouslySetInnerHTML:{__html:w("flow:emptyCanvas.composerSub")}})]}):null]})}function NN(e){if(!window.location.pathname.startsWith("/flow"))return;if(!e){window.history.replaceState({},"","/flow");return}const t=new URLSearchParams({flowId:e.id,flowSource:e.source??"user"});e.archived&&t.set("flowArchived","1"),window.history.replaceState({},"","/flow?"+t.toString())}function nW(e){return e==="builtin"?"workspace":e??"user"}function cl(e,t){return t(e==="builtin"?"flow:settings.builtin":e==="workspace"?"flow:palette.workspace":"flow:palette.userDir")}const FI="af:run-console-height",Iu=230,eu={enabled:!1,cron:"",timezone:"Asia/Shanghai",preset:"",overlapPolicy:"skip",misfirePolicy:"skip",nextRunAt:null},Qf={};function Ep(e){if(!Number.isFinite(e))return Iu;const t=Math.max(240,Math.floor(window.innerHeight*.88));return Math.min(Math.max(Math.round(e),96),t)}function rW(){try{const e=localStorage.getItem(FI);if(e==null)return Iu;const t=parseInt(e,10);return Number.isFinite(t)?Ep(t):Iu}catch{return Iu}}function iW(){var k0,S0;const{t:e,i18n:t}=Mt(),{navigate:n,path:r}=za(),i=m.useRef(null),s=m.useCallback(x=>{i.current=typeof x=="function"?x:null},[]),[o,l]=m.useState([]),[c,d]=m.useState(""),[u,p]=m.useState(null),[f,h]=m.useState(0),[y,b]=m.useState(""),[S,g]=m.useState(""),[v,w]=m.useState(""),[k,E]=m.useState(""),[j,P]=m.useState(!1),[O,F]=m.useState(""),[W,R]=m.useState(!1),[I,q]=m.useState(""),[$,H]=m.useState(!1),[z,Y]=m.useState(!1),[A,T]=m.useState(!1),[C,G]=m.useState(null),[Q,M]=m.useState(!1),[te,ce]=m.useState(!1),le=m.useRef(!1),[de,ue]=m.useState([]),[se,re]=m.useState(""),[fe,ye]=m.useState("nodes"),Se=m.useRef(null),[He,st]=m.useState([]),[Ke,Te]=m.useState(!1),[It,pn]=m.useState(""),[sn,Nn]=m.useState(!1),[xn,On]=m.useState({name:"",id:"",description:""}),[Ur,Jn]=m.useState(!1),[oe,he]=m.useState(""),[Ve,Xe]=m.useState(""),tt=m.useRef(null),[Et,jn]=m.useState([]),[xt,Cn]=m.useState(!1),[Qn,Ht]=m.useState(""),[Ut,on]=m.useState(""),[jr,Yi]=m.useState(null),[bt,En]=m.useState(null),[vi,Gt]=m.useState([]),[fr,Zn]=m.useState(""),[er,oi]=m.useState(!1),Gi=m.useCallback(x=>{tt.current&&window.clearTimeout(tt.current),Xe(x),tt.current=window.setTimeout(()=>{Xe(""),tt.current=null},3800)},[]),tr=m.useCallback(x=>{const N=String(x||"").trim();N&&window.requestAnimationFrame(()=>{var L;(L=i.current)==null||L.call(i,N)})},[]);m.useEffect(()=>()=>{tt.current&&window.clearTimeout(tt.current)},[]);const[Vn,Xi]=m.useState(!1),[qe,jt]=m.useState({files:[]}),[At,$t]=m.useState(!1),[De,_n]=m.useState(!0);m.useEffect(()=>{let x=!1;const N=()=>{fetch("/api/flows",{method:"HEAD"}).then(D=>{x||_n(D.ok)}).catch(()=>{x||_n(!1)})};N();const L=window.setInterval(N,5e3);return()=>{x=!0,window.clearInterval(L)}},[]),m.useEffect(()=>{let x=!1;return fetch("/api/dev-info").then(N=>N.json()).then(N=>{x||ge(!!(N!=null&&N.isDev))}).catch(()=>{}),()=>{x=!0}},[]),m.useEffect(()=>{u!=null&&u.id&&qC(u.id,u.source??"user","pipeline",!!u.archived)},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived]);const[Ne,an]=m.useState("edit"),[pr,ot]=m.useState([]),ai=m.useRef(0),[Mn,$n]=m.useState(new Set),[Vr,Pn]=m.useState({}),[Wr,hr]=m.useState(null),[Xt,mr]=m.useState(0),[gr,Kr]=m.useState(!1),[U,ge]=m.useState(!1),[_e,ze]=m.useState(!1),[dt,Je]=m.useState(rW),gt=m.useRef({active:!1,pointerId:-1,startY:0,startH:Iu}),[nt,Fn]=m.useState(null),[bi,ki]=m.useState(null),[hn,Cs]=m.useState({}),In=m.useRef(hn);m.useEffect(()=>{In.current=hn},[hn]);const[Si,Ni]=m.useState(!1),[Ua,Es]=m.useState(!1),[_s,Ps]=m.useState({}),[at,Ji]=m.useState({}),[Va,Qo]=m.useState(null),[Jt,ji]=m.useState(eu),[Dd,zd]=m.useState(!1),[qr,Zo]=m.useState(!1),[ln,Qi]=m.useState(""),[Wa,to]=m.useState(""),[kt,Ka]=m.useState(Qf),[Vt,Is]=m.useState(null),qa=m.useRef(0),Zi=m.useRef(null),Ya=m.useRef(null),es=m.useRef(!0),ea=m.useRef(!1),[Qt,As]=m.useState(null),[yr,Ga]=m.useState(null),[Bd,ta]=m.useState(!1),[Xa,Ja]=m.useState(""),[Qa,na]=m.useState(!1),gm=m.useRef(null),[Ci,bc]=m.useState(null),[ra,ia]=m.useState(!1),[kc,Hd]=m.useState(null),[sa,Sc]=m.useState(!1),[no,oa]=m.useState(null),Za=m.useRef(null),[xr,_]=m.useState(""),[V,X]=m.useState(0),[Z,ne]=m.useState(0),[ae,me]=m.useState("pan"),[be,Pe]=m.useState(!1),[Ye,nr]=m.useState(!1),Zt=m.useRef(null),rr=m.useRef(null),Dn=m.useRef(null),[Be,yt]=m.useState(0),[Ee,Ze]=m.useState(null),[Fe,Ei]=m.useState(""),[je,cn]=m.useState({cursor:[],opencode:[],claudeCode:[]}),[aa,Bv]=m.useState(""),[ym,Wte]=m.useState(""),[Ts,CA]=m.useState([]),[la,Nc]=m.useState([]),[Hv,EA]=m.useState(!1),[Ud,_A]=m.useState([]),[Uv,PA]=m.useState(!1),[IA,AA]=m.useState(()=>new Set),[Vd,xm]=m.useState(!1),wm=m.useRef(null),Vv=m.useRef(null),[TA,RA]=m.useState({}),Wd=m.useCallback(x=>{if(!x)return null;const N=x.id,L=x.source??"user",D=x.archived?"archived":"";return{sessionsKey:`af:composer-sessions:${N}:${L}${D?":"+D:""}`,activeKey:`af:composer-active-session:${N}:${L}${D?":"+D:""}`}},[]),Wv=m.useCallback(x=>{if(!x)return"";const N=x.id,L=x.source??"user",D=x.archived?"archived":"";return`af:composer-skills:pipeline:${N}:${L}${D?":"+D:""}`},[]),Kv=m.useCallback(x=>{const N=Wd(x);if(!N)return{sessions:[],activeSessionId:null};try{const L=localStorage.getItem(N.sessionsKey);if(!L)return{sessions:[],activeSessionId:null};const D=JSON.parse(L);if(!Array.isArray(D))return{sessions:[],activeSessionId:null};const B=D.filter(J=>J&&typeof J.id=="string").map(J=>({...J,running:!1,statusLine:J.running?e("flow:composer.pageRefreshReset"):J.statusLine,steps:[]}));let K=null;try{K=localStorage.getItem(N.activeKey),K&&!B.some(J=>J.id===K)&&(K=null)}catch{K=null}return{sessions:B,activeSessionId:K}}catch{return{sessions:[],activeSessionId:null}}},[Wd]),Kd=m.useCallback((x,N,L)=>{const D=Wd(x);if(D)try{localStorage.setItem(D.sessionsKey,JSON.stringify(N)),L?localStorage.setItem(D.activeKey,L):localStorage.removeItem(D.activeKey)}catch{}},[Wd]),ca=m.useRef(0),qd=m.useRef({sessions:[],activeSessionId:null,flowKey:null}),[_i,ts]=m.useState([]),[ir,ro]=m.useState(null),io=m.useMemo(()=>Wv(u),[Wv,u]),[qv,Yv]=m.useState(""),Yd=m.useMemo(()=>{if(!u)return null;const x=u.id,N=u.source??"user",L=u.archived?"archived":"";return`${x}:${N}${L?":"+L:""}`},[u]),vm=m.useRef(!1);m.useEffect(()=>{if(!Yd){ts([]),ro(null),qd.current={sessions:[],activeSessionId:null,flowKey:null};return}const x=qd.current;if(x.flowKey===Yd)return;x.flowKey=Yd,vm.current&&x.sessions.length>0&&Kd(u,x.sessions,x.activeSessionId);const{sessions:N,activeSessionId:L}=Kv(u);if(N.length===0){const D=`session-1-${Date.now()}`,B={id:D,label:e("flow:composer.conversationLabel",{n:1}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};x.sessions=[B],x.activeSessionId=D,ts([B]),ro(D)}else{const D=N[N.length-1];if(D&&(!D.thread||D.thread.length===0))ca.current=Hg(N),x.sessions=N,x.activeSessionId=D.id,ts(N),ro(D.id);else{const K=Hg(N)+1;ca.current=K;const J=`session-${K}-${Date.now()}`,ee={id:J,label:e("flow:composer.conversationLabel",{n:K}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null},pe=[...N,ee];x.sessions=pe,x.activeSessionId=J,ts(pe),ro(J)}}vm.current=!0},[Yd,u,Kv,Kd]);const mn=m.useMemo(()=>_i.find(x=>x.id===ir)||null,[_i,ir]),un=(mn==null?void 0:mn.running)??!1,jc=(mn==null?void 0:mn.statusLine)??"",Cc=(mn==null?void 0:mn.segments)??[],Ec=(mn==null?void 0:mn.thread)??[],Gv=(mn==null?void 0:mn.steps)??[];mn==null||mn.outputDismissed;const lt=(mn==null?void 0:mn.phaseContext)??null,Xv=m.useRef([]),[bm,Gd]=m.useState(!1),Xd=m.useRef(null),Jv=m.useRef(null);m.useEffect(()=>{const x=Jv.current;x&&requestAnimationFrame(()=>{x.scrollTop=x.scrollHeight})},[Ec,Cc]);const km=m.useRef(null),Sm=m.useRef(!1),LA=m.useRef(null),Qv=m.useCallback(x=>{const N=++ca.current,L=`session-${N}-${Date.now()}`,D={id:L,label:x||e("flow:composer.conversationLabel",{n:N}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};return ts(B=>[...B,D]),ro(L),L},[]);m.useEffect(()=>{!u||!vm.current||(qd.current.sessions=_i,qd.current.activeSessionId=ir,Kd(u,_i,ir))},[_i,ir,u,Kd]),m.useEffect(()=>{ca.current=Math.max(ca.current,Hg(_i))},[_i]);const Zv=m.useCallback(x=>{var N;km.current===x&&((N=Xd.current)==null||N.abort()),ts(L=>{const D=L.filter(K=>K.id!==x);if(L.some((K,J)=>K.id===x&&L.findIndex(ee=>ee.id===ir)===J)||ir===x){const K=D;K.length>0?ro(K[K.length-1].id):setTimeout(()=>{ca.current=0;const J=++ca.current,ee=`session-${J}-${Date.now()}`,pe={id:ee,label:e("flow:composer.conversationLabel",{n:J}),thread:[],segments:[],running:!1,statusLine:"",steps:[],outputDismissed:!1,createdAt:Date.now(),phaseContext:null};ts(ve=>[...ve,pe]),ro(ee)},0)}return D})},[ir]),Cr=m.useCallback(x=>{ts(N=>{const L=N.findIndex(K=>K.id===ir);if(L<0)return N;const D={...N[L]};x(D);const B=[...N];return B[L]=D,B})},[ir]),e0=m.useCallback(x=>{Cr(N=>{N.running=x})},[Cr]),ns=m.useCallback(x=>{Cr(N=>{N.statusLine=x})},[Cr]),rs=m.useCallback(x=>{Cr(N=>{typeof x=="function"?N.segments=x(N.segments):N.segments=x})},[Cr]),t0=m.useCallback(x=>{Cr(N=>{typeof x=="function"?N.thread=x(N.thread):N.thread=x})},[Cr]),_c=m.useCallback(x=>{Cr(N=>{typeof x=="function"?N.steps=x(N.steps):N.steps=x})},[Cr]),n0=m.useCallback(x=>{Cr(N=>{N.outputDismissed=x})},[Cr]),Pc=m.useCallback(x=>{Cr(N=>{N.phaseContext=typeof x=="function"?x(N.phaseContext):x})},[Cr]),r0=m.useCallback(x=>{ro(x),ts(N=>{const L=N.findIndex(B=>B.id===x);if(L<0||!N[L].outputDismissed)return N;const D=[...N];return D[L]={...N[L],outputDismissed:!1},D})},[]);m.useEffect(()=>{Xv.current=Cc},[Cc]);const li=m.useRef({}),i0=m.useRef(!1),ua=m.useRef(null),so=m.useRef(null),Ic=m.useRef(!1),Nm=m.useRef(0),Jd=m.useRef(""),[wt,ft,OA]=U_([]),[en,Wt,MA]=V_([]),oo=m.useRef(wt),Qd=m.useRef(en),jm=m.useRef(null),s0=m.useRef(null),Zd=m.useRef(null),[Er,ao]=m.useState(null),Pi=m.useMemo(()=>wt.filter(x=>{var N;return(((N=x.data)==null?void 0:N.definitionId)||"").startsWith("provide_")}),[wt]),el=m.useMemo(()=>{var N;const x={};for(const L of wt){if(!((N=L.data)!=null&&N.inputs))continue;const D=L.data.inputs;for(let B=0;B<D.length;B++){const K=D[B];if(!(K!=null&&K.name))continue;const J=en.find(pe=>pe.target===L.id&&pe.targetHandle===`input-${B}`);if(!(J!=null&&J.source))continue;Pi.find(pe=>pe.id===J.source)&&(x[J.source]=K.name)}}return x},[wt,en,Pi]),Ac=m.useMemo(()=>{if(Ne==="edit"||Mn.size===0)return null;const x=new Set(Mn);for(const N of en)Mn.has(N.source)&&x.add(N.target),Mn.has(N.target)&&x.add(N.source);return x},[Ne,Mn,en]),$A=m.useMemo(()=>Ne==="edit"?wt:wt.map(x=>{var N,L;return{...x,draggable:!1,connectable:!1,data:{...x.data,isRunMode:!0,isExecuting:Mn.has(x.id),nodeStatus:((N=Vr[x.id])==null?void 0:N.status)??null,nodeElapsed:((L=Vr[x.id])==null?void 0:L.elapsed)??null,isDim:Ac?!Ac.has(x.id):!1}}}),[Ne,wt,Mn,Vr,Ac]),FA=m.useMemo(()=>Ac?en.map(x=>{const N=Mn.has(x.source)||Mn.has(x.target),L=x.className?x.className.replace(/\s?af-flow-edge--(dim|focus)\b/g,""):"",D=N?"af-flow-edge--focus":"af-flow-edge--dim";return{...x,className:(L?L+" ":"")+D}}):en,[en,Mn,Ac]);m.useEffect(()=>{if(!u){Ji({}),Qo(null),ji(eu),Ka(Qf),Is(null),Qi(""),to("");return}const x=new URLSearchParams({flowId:u.id,flowSource:u.source||"user"});u.archived&&x.set("archived","1"),fetch(`/api/flow/run-config?${x.toString()}`).then(N=>N.json()).then(N=>{Ji(N.presets||{}),Qo(N.activePreset||null)}).catch(()=>{Ji({}),Qo(null)})},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived]);const lo=m.useCallback(x=>{qa.current+=1,ji(x)},[]),co=m.useCallback(async(x,N={})=>{if(!x)return;const L=!!N.quiet,D=!!N.force,B=qa.current;L||(zd(!0),Qi(""),to(""));const K=new URLSearchParams({flowId:x.id,flowSource:x.source||"user"});x.archived&&K.set("archived","1");try{const J=await fetch(`/api/flow/schedule?${K.toString()}`),ee=await J.json().catch(()=>({}));if(!J.ok)throw new Error(ee.error||`HTTP ${J.status}`);if(!D&&qa.current!==B)return;ji({...eu,...ee.schedule||{}}),Ka(ee.state&&typeof ee.state=="object"?ee.state:Qf),Is(ee.status||null)}catch(J){if(!D&&qa.current!==B)return;ji(eu),Ka(Qf),Is(null),Qi(String(J.message||J))}finally{zd(!1)}},[]);m.useEffect(()=>{if(!u)return;let x=!1;return(async()=>{await co(u)})(),()=>{x=!0}},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,co]),m.useEffect(()=>{var L,D,B,K;if(!Va||!at[Va]||Pi.length===0)return;const x=at[Va],N={};for(const J of Pi){const ee=el[J.id];if(!ee)continue;const pe=((L=J.data)==null?void 0:L.definitionId)||"",ve=x[J.id]??((K=(B=(D=J.data)==null?void 0:D.outputs)==null?void 0:B[0])==null?void 0:K.default)??"";pe.startsWith("provide_file")?N[ee]={type:"file",path:ve}:N[ee]={type:"str",value:ve}}Object.keys(N).length>0&&Cs(N)},[Va,at,Pi,el]);const DA=m.useCallback(()=>{if(!no||!Za.current)return;const x=Za.current.value;ft(N=>N.map(L=>{var D,B;return L.id!==no.instanceId?L:{...L,data:{...L.data,outputs:((B=(D=L.data)==null?void 0:D.outputs)==null?void 0:B.map((K,J)=>J===0?{...K,default:x}:K))||[{type:"text",name:"value",default:x}]}}})),oa(null)},[no,ft]),it=m.useMemo(()=>{const x=wt.filter(N=>N.selected);return x.length===1?x[0]:null},[wt]),is=m.useMemo(()=>u?HU(wt,en,e):[],[u,wt,en,e]),zA=m.useMemo(()=>is.map(x=>x.key).join("|"),[is]),o0=m.useMemo(()=>is.some(x=>String((x==null?void 0:x.level)||"warning").toLowerCase()==="error"),[is]);m.useLayoutEffect(()=>{M(is.length>0&&!o0)},[zA,u==null?void 0:u.id,u==null?void 0:u.source,is.length,o0]),Dn.current=it,m.useEffect(()=>{oo.current=wt},[wt]),m.useEffect(()=>{Qd.current=en},[en]),m.useEffect(()=>{s0.current=Er},[Er]),m.useEffect(()=>{if(!Er)return;const x=L=>{L.key==="Escape"&&ao(null)},N=L=>{var D,B;(B=(D=L.target)==null?void 0:D.closest)!=null&&B.call(D,".af-connect-node-menu")||ao(null)};return document.addEventListener("keydown",x),document.addEventListener("pointerdown",N),()=>{document.removeEventListener("keydown",x),document.removeEventListener("pointerdown",N)}},[Er]),m.useEffect(()=>()=>{so.current!=null&&(clearTimeout(so.current),so.current=null)},[]);const Cm=m.useMemo(()=>{var N;if(!it)return null;const x=(N=it.data)==null?void 0:N.definitionId;return de.find(L=>L.id===x)??null},[it,de]),Em=m.useMemo(()=>{const x={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const N of de){const L=Ev(N);x[L].push(N)}for(const N of fu)x[N].sort((L,D)=>L.id.localeCompare(D.id));return x},[de]),ef=m.useMemo(()=>{const x=se.trim().toLowerCase();if(!x)return Em;const N={CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const L of fu)N[L]=Em[L].filter(D=>OV(D,x));return N},[Em,se]),BA=m.useMemo(()=>fu.reduce((x,N)=>x+ef[N].length,0),[ef]),tf=m.useMemo(()=>de.filter(x=>{const N=String(x.id??""),L=String(x.source??"");return N.startsWith("marketplace:")||L==="marketplace"||L==="collection"}),[de]),a0=m.useMemo(()=>{const x=new Set;for(const N of tf){const L=String(N.id??"");if(L&&(x.add(L),L.startsWith("marketplace:"))){const D=L.slice(12),[B]=D.split("@");B&&x.add(`marketplace:${B}`)}}return x},[tf]),nf=m.useCallback(async()=>{d("");try{const x=await fetch("/api/flows");if(!x.ok)throw new Error("HTTP "+x.status);l(await x.json())}catch(x){d(String(x.message||x))}},[]);m.useEffect(()=>{nf()},[nf]),m.useEffect(()=>{if(r!=="/flow")return;const x=new URLSearchParams(window.location.search);x.get("new")==="1"&&!x.get("flowId")&&n("/projects?new=1")},[r,n]),m.useEffect(()=>{let x=!1;const N=()=>{fetch("/api/model-lists").then(D=>D.json()).then(D=>{x||cn({cursor:Array.isArray(D.cursor)?D.cursor.map(String):[],opencode:Array.isArray(D.opencode)?D.opencode.map(String):[],claudeCode:Array.isArray(D.claudeCode)?D.claudeCode.map(String):[]})}).catch(()=>{})};N();const L=setTimeout(N,4e3);return()=>{x=!0,clearTimeout(L)}},[]),m.useEffect(()=>{let x=!1;return fetch("/api/skills").then(N=>N.json()).then(N=>{if(x)return;const L=Array.isArray(N.skills)?N.skills.filter(D=>D&&typeof D.key=="string"&&D.key.trim()).map(D=>({key:String(D.key),name:String(D.name||D.id||D.key),description:D.description?String(D.description):"",sourceLabel:D.sourceLabel?String(D.sourceLabel):""})):[];CA(L),EA(!0)}).catch(()=>{}),()=>{x=!0}},[]),m.useEffect(()=>{let x=!1;return fetch("/api/skill-collections").then(N=>N.json()).then(N=>{x||(_A(Mo(N)),PA(!0))}).catch(()=>{}),()=>{x=!0}},[]),m.useEffect(()=>{if(Yv(""),!(!Hv||!Uv)){if(!io){Nc([]);return}Nc(JC(io,"pipeline",Ts,Ud)),Yv(io)}},[Ud,Uv,Ts,Hv,io]),m.useEffect(()=>{if(!(qv!==io||!io))try{localStorage.setItem(io,JSON.stringify(la))}catch{}},[la,io,qv]);const l0=m.useCallback(async x=>{const N=x.source??"user",L=!!x.archived,D=new URLSearchParams({flowId:x.id,flowSource:N});L&&D.set("archived","1");const B=new URLSearchParams({flowId:x.id,flowSource:N});L&&B.set("archived","1"),B.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const[K,J]=await Promise.all([fetch("/api/flow?"+D.toString()),fetch("/api/nodes?"+B.toString())]),ee=await K.json();if(!K.ok||ee.error)throw new Error(ee.error||e("flow:nodePropsError.loadFlowFailed"));const pe=await J.json();if(!J.ok)throw new Error(e("flow:nodePropsError.loadNodesFailed"));const ve=Array.isArray(pe)?pe:Array.isArray(pe==null?void 0:pe.nodes)?pe.nodes:[],Ie=!Array.isArray(pe)&&(pe==null?void 0:pe.pipelineTranslations)||{},ie=zU(ee.flowYaml||"");if(ie.error)throw new Error(ie.error);const Ce={...ie.instances||{}},ke=ie.nodes.map(Qe=>fd(Qe,Ce,ve,Ie,x.id)),Me=bI(ie.edges,ke);return{flowSource:N,paletteList:ve,instances:Ce,flowDescriptionText:ie.description??"",nodes:ke,edges:Me}},[t.language,e]),ci=m.useCallback(async(x,N={})=>{const L=!!N.preserveComposer,D=L&&!!N.incrementalSync;Ic.current=!1,Nm.current+=1,p(x),g(""),L||(w(""),re(""),En(null),b(""),F(""),q(""),_(""),t0([]),rs([]),_c([]),n0(!1),Pc(null),me("pan")),D||(li.current={},ft([]),Wt([])),NN(x);try{const B=await l0(x);if(ue(B.paletteList),li.current=B.instances,b(B.flowDescriptionText),F(x.id||""),D){const K=oo.current,J=Qd.current;try{const ee=y6(K,J,B.nodes,B.edges),pe=new Set([...ee.changes.addedNodeIds,...ee.changes.updatedNodeIds]),ve=new Set([...ee.changes.addedEdgeKeys,...ee.changes.updatedEdgeKeys]),Ie=pe.size>0?ee.nodes.map(Ce=>pe.has(Ce.id)?{...Ce,className:pN(Ce.className,dN)}:Ce):ee.nodes,ie=ve.size>0?ee.edges.map(Ce=>ve.has(ad(Ce))?{...Ce,className:pN(Ce.className,fN)}:Ce):ee.edges;ft(Ie),Wt(ie),so.current!=null&&(clearTimeout(so.current),so.current=null),(pe.size>0||ve.size>0)&&(so.current=window.setTimeout(()=>{so.current=null,pe.size>0&&ft(Ce=>Ce.map(ke=>{if(!pe.has(ke.id))return ke;const Me=hN(ke.className,dN);return Me===String(ke.className||"")?ke:{...ke,className:Me}})),ve.size>0&&Wt(Ce=>Ce.map(ke=>{if(!ve.has(ad(ke)))return ke;const Me=hN(ke.className,fN);return Me===String(ke.className||"")?ke:{...ke,className:Me}}))},TV))}catch{ft(B.nodes),Wt(B.edges)}}else ft(B.nodes),Wt(B.edges),h(K=>K+1);Rf(x.id,B.flowSource),yt(K=>K+1);try{Jd.current=JS(B.nodes,B.edges,B.instances,{description:B.flowDescriptionText})}catch{Jd.current=""}Ic.current=!0}catch(B){g(String(B.message||B))}},[l0,ft,Wt]),rf=m.useCallback(async()=>{if(!(u!=null&&u.id))return;const x=u.source??"user",N=new URLSearchParams({flowId:u.id,flowSource:x});u.archived&&N.set("archived","1"),N.set("lang",String(t.language||"zh").startsWith("zh")?"zh":"en");const L=await fetch("/api/nodes?"+N.toString()),D=await L.json();if(!L.ok)throw new Error((D==null?void 0:D.error)||e("flow:nodePropsError.loadNodesFailed"));const B=Array.isArray(D)?D:Array.isArray(D==null?void 0:D.nodes)?D.nodes:[];ue(B)},[u,e,t.language]),_m=m.useCallback(async()=>{Cn(!0),Ht("");try{const x=await fetch("/api/marketplace/nodes"),N=await x.json().catch(()=>({}));if(!x.ok)throw new Error((N==null?void 0:N.error)||"Failed to load marketplace nodes");jn(Array.isArray(N==null?void 0:N.nodes)?N.nodes:[])}catch(x){Ht(String(x.message||x)),jn([])}finally{Cn(!1)}},[]),sf=m.useCallback(async()=>{Te(!0),pn("");try{const x=await fetch("/api/marketplace/flow-snippets"),N=await x.json().catch(()=>({}));if(!x.ok)throw new Error((N==null?void 0:N.error)||"Failed to load flow snippets");st(Array.isArray(N==null?void 0:N.snippets)?N.snippets:[])}catch(x){pn(String(x.message||x)),st([])}finally{Te(!1)}},[]);m.useEffect(()=>{u&&(_m(),sf())},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,_m,sf]);const HA=m.useCallback(async x=>{if(!u||!x)return;const N=x.definitionId||`marketplace:${x.id}${x.version?`@${x.version}`:""}`;if(N){on(N),Ht("");try{const L=await fetch("/api/marketplace/install-node",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user",archived:!!u.archived,nodeSpec:N})}),D=await L.json().catch(()=>({}));if(!L.ok||(D==null?void 0:D.ok)===!1)throw new Error((D==null?void 0:D.error)||"Failed to install marketplace node");await rf()}catch(L){Ht(String(L.message||L))}finally{on("")}}},[u,rf]),UA=m.useCallback(async(x,N)=>{const L={packageId:(x==null?void 0:x.newId)||(x==null?void 0:x.id)||(x==null?void 0:x.label),label:(x==null?void 0:x.label)||(x==null?void 0:x.newId)||(x==null?void 0:x.id),version:"1.0.0",definitionId:N,body:(x==null?void 0:x.body)||"",script:(x==null?void 0:x.script)||"",inputs:Array.isArray(x==null?void 0:x.inputs)?x.inputs:[],outputs:Array.isArray(x==null?void 0:x.outputs)?x.outputs:[],flowId:u==null?void 0:u.id,flowSource:(u==null?void 0:u.source)||"user"},D=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(L)}),B=await D.json();if(!D.ok||(B==null?void 0:B.ok)===!1)throw new Error((B==null?void 0:B.error)||"Publish failed");return await rf(),B},[rf,u]),c0=m.useCallback(async()=>{var D;if(!u||le.current)return;const x=u.id,N=u.source??"user",L=((D=Dn.current)==null?void 0:D.id)??null;le.current=!0,ce(!0);try{await ci({id:x,source:N,archived:u.archived},{preserveComposer:!0,incrementalSync:!0}),L&&ft(B=>B.map(K=>({...K,selected:K.id===L})))}finally{le.current=!1,ce(!1)}},[u,u==null?void 0:u.archived,ci,ft]);m.useEffect(()=>{if(i0.current||o.length===0)return;const x=new URLSearchParams(window.location.search),N=x.get("flowId");if(!N)return;const L=x.get("flowSource")??"user",D=x.get("flowArchived")==="1",B=o.find(K=>K.id===N&&(K.source??"user")===L&&!!K.archived===D);B&&(i0.current=!0,ci(B))},[o,ci]);const of=m.useRef(0);m.useEffect(()=>{if(!u)return;const x=u.id,N=u.source??"user",L=!!u.archived;of.current=0;let D=!1;const B=async()=>{var ee;if(D)return;const J=new URLSearchParams({flowId:x,flowSource:N,v:String(of.current)});L&&J.set("archived","1");try{const pe=await fetch("/api/flow-editor-sync-poll?"+J.toString());if(!pe.ok||D)return;const ve=await pe.json();if(D)return;if(ve.changed){of.current=ve.version;const Ie=((ee=Dn.current)==null?void 0:ee.id)??null;await ci({id:x,source:N,archived:L},{preserveComposer:!0,incrementalSync:!0}),await co({id:x,source:N,archived:L},{quiet:!0,force:!0}),Ie&&ft(ie=>ie.map(Ce=>({...Ce,selected:Ce.id===Ie})))}else of.current=ve.version}catch{}},K=window.setInterval(B,2e3);return B(),()=>{D=!0,window.clearInterval(K)}},[u==null?void 0:u.id,u==null?void 0:u.source,u==null?void 0:u.archived,ci,co,ft]);const VA=m.useMemo(()=>v?v.startsWith(e("flow:status.saveFailed"))?" af-palette-tip--error":v===e("flow:status.saved")?" af-palette-tip--success":" af-palette-tip--info":"",[v]);m.useEffect(()=>{if(!v)return;v===e("flow:status.saved")||v.startsWith(e("flow:status.runInTerminal"));const x=v.startsWith(e("flow:status.runInTerminal"))?5200:2800,N=window.setTimeout(()=>w(""),x);return()=>clearTimeout(N)},[v,e]),m.useEffect(()=>{E("")},[u==null?void 0:u.id,u==null?void 0:u.source]),m.useEffect(()=>{const x=()=>{window.__provideEditContent&&(oa(window.__provideEditContent),window.__provideEditContent=null)};return window.addEventListener("provide-expand",x),()=>window.removeEventListener("provide-expand",x)},[]),m.useEffect(()=>{var ee,pe,ve,Ie,ie,Ce;if(!it){Ze(null);return}const x=li.current[it.id]||{},{inputs:N,outputs:L}=vI(it),D=String(((ee=it.data)==null?void 0:ee.definitionId)??it.id??""),B=((pe=it.data)==null?void 0:pe.script)!=null?String(it.data.script):void 0,K=x.script!=null?String(x.script):void 0,J=D==="tool_nodejs"||B&&B.trim()!==""||K&&K.trim()!==""?String(B??K??""):"";Ze({id:it.id,newId:it.id,label:String(((ve=it.data)==null?void 0:ve.label)??it.id),role:((Ie=it.data)==null?void 0:Ie.role)??"普通",model:String(((ie=it.data)==null?void 0:ie.model)??x.model??""),body:String(((Ce=it.data)==null?void 0:Ce.body)??x.body??""),script:J,inputs:N,outputs:L})},[it==null?void 0:it.id,Be]),m.useEffect(()=>{u&&(it||(rr.current=null,En(x=>x==="node"?null:x)))},[u,it==null?void 0:it.id]);const af=m.useCallback(()=>{rr.current=null,En(x=>x==="settings"||x==="history"?x:"node")},[]),WA=m.useCallback((x,N)=>{x.metaKey||x.ctrlKey||x.shiftKey||Ne!=="edit"&&ki((N==null?void 0:N.id)??null)},[Ne]),KA=m.useCallback((x,N)=>{Ne==="edit"&&(x.preventDefault(),ft(L=>L.map(D=>({...D,selected:D.id===N.id}))),Wt(L=>L.map(D=>({...D,selected:!1}))),af())},[af,Ne,Wt,ft]),qA=m.useCallback((x,N)=>{if(Ne!=="edit")return;const L=x.metaKey||x.ctrlKey||x.shiftKey;Wt(D=>D.map(B=>B.id===N.id?{...B,selected:!B.selected||!L}:L?B:{...B,selected:!1})),L||ft(D=>D.map(B=>({...B,selected:!1})))},[Ne,Wt,ft]),YA=m.useCallback(x=>yN(x,oo.current),[]),GA=m.useCallback(x=>{if(!yN(x,oo.current)){w("端口类型不匹配,已取消连线");return}ao(null),Wt(N=>{const L=N.filter(D=>!(D.target===x.target&&D.targetHandle===x.targetHandle));return id({...x,markerEnd:{type:zr.ArrowClosed}},L)})},[Wt]),XA=m.useCallback((x,N)=>{jm.current=MV(N,oo.current),ao(null)},[]),JA=m.useCallback((x,N)=>{var ke,Me,Qe,Ge;const L=jm.current;if(jm.current=null,!u||!L||N!=null&&N.toNode)return;const D=FV(de,L);if(D.length===0){w(`没有匹配 ${L.slotType} 端口的节点`);return}const B=((Me=(ke=x==null?void 0:x.changedTouches)==null?void 0:ke[0])==null?void 0:Me.clientX)??(x==null?void 0:x.clientX),K=((Ge=(Qe=x==null?void 0:x.changedTouches)==null?void 0:Qe[0])==null?void 0:Ge.clientY)??(x==null?void 0:x.clientY);if(!Number.isFinite(B)||!Number.isFinite(K))return;const J=ua.current,ee=document.querySelector(".af-pipeline-flow .react-flow");if(!J||!ee)return;const pe=ee.getBoundingClientRect(),ve=320,Ie=Math.min(440,104+D.length*58),ie=Math.max(12,Math.min(B-pe.left,pe.width-ve-12)),Ce=Math.max(12,Math.min(K-pe.top,pe.height-Ie-12));ao({left:ie,top:Ce,flowPosition:J.screenToFlowPosition({x:B,y:K}),draft:L,candidates:D,query:""})},[de,u]),QA=m.useCallback(x=>{for(const N of x)delete li.current[N.id]},[]),ZA=m.useCallback(x=>{ua.current=x},[]),eT=m.useCallback(x=>{ft(L=>L.map(D=>({...D,selected:D.id===x}))),Wt(L=>L.map(D=>({...D,selected:!1}))),af();const N=()=>{var pe,ve,Ie;const L=ua.current;if(!(L!=null&&L.getNode))return;const D=L.getNode(x);if(!D)return;const B=(pe=L.getInternalNode)==null?void 0:pe.call(L,x),K=((ve=B==null?void 0:B.measured)==null?void 0:ve.width)??(B==null?void 0:B.width)??D.width??200,J=((Ie=B==null?void 0:B.measured)==null?void 0:Ie.height)??(B==null?void 0:B.height)??D.height??88,{zoom:ee}=L.getViewport();L.setCenter(D.position.x+K/2,D.position.y+J/2,{zoom:bN(ee),duration:220})};requestAnimationFrame(()=>requestAnimationFrame(N))},[ft,Wt,af]),tT=m.useCallback(x=>{ft(L=>L.map(D=>({...D,selected:D.id===x}))),Wt(L=>L.map(D=>({...D,selected:!1})));const N=()=>{var ve,Ie,ie;const L=ua.current;if(!(L!=null&&L.getNode))return;const D=L.getNode(x);if(!D)return;const B=(ve=L.getInternalNode)==null?void 0:ve.call(L,x),K=((Ie=B==null?void 0:B.measured)==null?void 0:Ie.width)??(B==null?void 0:B.width)??D.width??200,J=((ie=B==null?void 0:B.measured)==null?void 0:ie.height)??(B==null?void 0:B.height)??D.height??88,{zoom:ee}=L.getViewport(),pe=bN(ee);L.setCenter(D.position.x+K/2,D.position.y+J/2,{zoom:pe,duration:260})};requestAnimationFrame(()=>requestAnimationFrame(N))},[ft,Wt]),tl=m.useCallback((x,N)=>{const L=`node-${Date.now()}`;return $I(x,L,N,li.current,de)},[de]),u0=m.useCallback(x=>{if(!u||!x)return;let N={x:180,y:160};const L=ua.current,D=document.querySelector(".af-pipeline-flow .react-flow");if(L&&D){const B=D.getBoundingClientRect();N=L.screenToFlowPosition({x:B.left+B.width*.45,y:B.top+B.height*.38})}ft(B=>[...B,tl(x,N)])},[u,ft,tl]),nT=m.useCallback(x=>{const N=s0.current;if(!u||!N||!(x!=null&&x.def))return;const L=tl(x.def,N.flowPosition),D=N.draft.handleType==="source"?{source:N.draft.nodeId,sourceHandle:N.draft.handleId,target:L.id,targetHandle:`input-${x.slotIndex}`}:{source:L.id,sourceHandle:`output-${x.slotIndex}`,target:N.draft.nodeId,targetHandle:N.draft.handleId};ft(B=>[...B,L]),Wt(B=>{const K=B.filter(J=>!(J.target===D.target&&J.targetHandle===D.targetHandle));return id({...D,markerEnd:{type:zr.ArrowClosed}},K)}),ao(null)},[u,tl,ft,Wt]),rT=m.useCallback(x=>{x.preventDefault(),x.dataTransfer.dropEffect="move"},[]),iT=m.useCallback(x=>{var J;if(x.preventDefault(),!u)return;const N=ua.current;if(!N)return;const L=N.screenToFlowPosition({x:x.clientX,y:x.clientY}),D=x.dataTransfer.getData("application/agentflow-snippet");if(D){const ee=He.find(pe=>`${pe.id}@${pe.version}`===D);ee&&((J=Zd.current)==null||J.call(Zd,ee,L));return}const B=x.dataTransfer.getData("application/agentflow-node");if(!B)return;const K=de.find(ee=>ee.id===B);K&&ft(ee=>[...ee,tl(K,L)])},[u,de,He,ft,tl]),ss=m.useCallback(async(x,N)=>{if(!u)return;const L=JS(x,N,li.current,{description:y});if(L!==Jd.current){w(e("flow:status.saving"));try{const D=nW(u.source),B=await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:D,flowYaml:L,...u.archived?{flowArchived:!0}:{}})}),K=await B.json();if(!B.ok||!K.success)throw new Error(K.error||e("flow:status.saveFailed"));if(Jd.current=L,w(e("flow:status.saved")),u.source==="builtin"&&D==="workspace"){const J={id:u.id,source:"workspace",path:void 0};p(J),NN(J),Rf(u.id,"workspace")}}catch(D){w(e("flow:status.saveFailed")+": "+(D.message||D))}}},[u,y]);m.useEffect(()=>{if(!u||!Ic.current||Ne!=="edit"||u.archived)return;const x=Nm.current,N=setTimeout(()=>{x===Nm.current&&Ic.current&&ss(oo.current,Qd.current)},400);return()=>clearTimeout(N)},[wt,en,y,Ne,u,ss]);const lf=m.useCallback(async x=>{if(!u||u.archived)return;const N=u.source??"user";if(!(N!=="user"&&N!=="workspace")&&N!==x){P(!0),E("");try{const L=await fetch("/api/flow/move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,fromSource:N,toSource:x})}),D=await L.json().catch(()=>({}));if(!L.ok)throw new Error(typeof D.error=="string"?D.error:e("flow:composer.requestFailed"));const B=D.flowSource==="workspace"||D.flowSource==="user"?D.flowSource:x;let K={id:u.id,source:B,archived:u.archived};try{const J=await fetch("/api/flows");if(J.ok){const ee=await J.json(),pe=Array.isArray(ee)?ee.find(ve=>ve.id===u.id&&(ve.source??"user")===B&&!!ve.archived==!!u.archived):null;pe&&(K=pe)}}catch{}await ci(K,{preserveComposer:!0}),Rf(u.id,B)}catch(L){E(String(L.message||L))}finally{P(!1)}}},[u,ci]),Pm=m.useCallback(async()=>{if(u){Zo(!0),Qi(""),to("");try{const x=await fetch("/api/flow/schedule",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user",archived:!!u.archived,schedule:Jt})}),N=await x.json().catch(()=>({}));if(!x.ok||!N.success)throw new Error(N.error||"Failed to save schedule");ji({...eu,...N.schedule||{}}),to(e("flow:schedule.saved")),await co(u,{quiet:!0,force:!0})}catch(x){Qi(String(x.message||x))}finally{Zo(!1)}}},[u,Jt,co,e]),sT=m.useCallback(async()=>{u&&(await ss(oo.current,Qd.current),!u.archived&&u.source!=="builtin"&&await Pm())},[u,ss,Pm]),cf=m.useCallback(async()=>{if(!u||!O.trim())return;const x=O.trim();if(x===u.id){q("");return}R(!0),q("");try{const N=await fetch("/api/flow/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",newFlowId:x})}),L=await N.json().catch(()=>({}));if(!N.ok)throw new Error(typeof L.error=="string"?L.error:e("flow:composer.requestFailed"));let D={id:L.flowId,source:L.flowSource??u.source,archived:u.archived};try{const B=await fetch("/api/flows");if(B.ok){const K=await B.json(),J=Array.isArray(K)?K.find(ee=>ee.id===L.flowId&&(ee.source??"user")===(L.flowSource??u.source)):null;J&&(D=J)}}catch{}await ci(D,{preserveComposer:!0}),Rf(L.flowId,L.flowSource??u.source)}catch(N){q(String(N.message||N))}finally{R(!1)}},[u,O,ci]),d0=m.useCallback(x=>{navigator.clipboard.writeText(x).then(()=>{H(!0),setTimeout(()=>H(!1),2e3)}).catch(()=>{})},[]),Im=m.useCallback(()=>{ss(wt,en)},[ss,wt,en]),oT=m.useCallback((x,N)=>{const L=N.trim()===""||N==="default"?void 0:N.trim(),D=wt.map(B=>B.id===x?{...B,data:{...B.data,model:L}}:B);ft(D),ss(D,en)},[wt,en,ft,ss]),uf=m.useCallback(()=>{var ke;if(!Ee||!u||!it)return!1;const x=it.id,N=Ee.newId.trim();if(Ei(""),!PI.test(N))return Ei(e("flow:nodePropsError.invalidInstanceId")),!1;if(wt.some(Me=>Me.id===N&&Me.id!==x))return Ei(e("flow:nodePropsError.duplicateInstanceId")),!1;const L=Ee.role.trim(),D=Uo.includes(L)?L:"普通",B=Ee.model.trim(),K=Me=>(Array.isArray(Me)?Me:[]).map(Qe=>({type:String((Qe==null?void 0:Qe.type)??"节点").trim()||"节点",name:String((Qe==null?void 0:Qe.name)??""),default:String((Qe==null?void 0:Qe.default)??""),required:!!(Qe!=null&&Qe.required),showOnNode:(Qe==null?void 0:Qe.showOnNode)!=null?Qe.showOnNode!==!1:!!(Qe!=null&&Qe.required)||String((Qe==null?void 0:Qe.type)??"节点").trim().toLowerCase()==="node"})),J=K(Ee.inputs),ee=K(Ee.outputs),pe=String(((ke=it.data)==null?void 0:ke.definitionId)??N),ve={...it.data,label:Ee.label.trim()||N,role:D,model:B===""||B==="default"?void 0:B,body:Ee.body,inputs:J,outputs:ee},Ie=String(Ee.script??"").trim();pe==="tool_nodejs"||Ie!==""?ve.script=String(Ee.script??""):delete ve.script;let ie,Ce=en;if(N!==x){const Me={...li.current},Qe={...Me[x]||{}};delete Me[x],Me[N]=Qe,li.current=Me,ie=wt.map(Ge=>Ge.id!==x?Ge:{...Ge,id:N,selected:!0,data:ve}),Ce=en.map((Ge,Mc)=>({...Ge,source:Ge.source===x?N:Ge.source,target:Ge.target===x?N:Ge.target,id:`e-${Ge.source===x?N:Ge.source}-${Ge.target===x?N:Ge.target}-${Mc}`}))}else ie=wt.map(Me=>Me.id===x?{...Me,data:ve}:Me);return ft(ie),Wt(Ce),tr(N),ss(ie,Ce),!0},[Ee,u,it,wt,en,ft,Wt,tr,ss]),Am=m.useCallback(()=>{var Me;if(!Ee||!u||!it)return!1;const x=it.id,N=Ee.role.trim(),L=Uo.includes(N)?N:"普通",D=Ee.model.trim(),B=Qe=>(Array.isArray(Qe)?Qe:[]).map(Ge=>({type:String((Ge==null?void 0:Ge.type)??"节点").trim()||"节点",name:String((Ge==null?void 0:Ge.name)??""),default:String((Ge==null?void 0:Ge.default)??""),required:!!(Ge!=null&&Ge.required),showOnNode:(Ge==null?void 0:Ge.showOnNode)!=null?Ge.showOnNode!==!1:!!(Ge!=null&&Ge.required)||String((Ge==null?void 0:Ge.type)??"节点").trim().toLowerCase()==="node"})),K=B(Ee.inputs),J=B(Ee.outputs),ee=String(((Me=it.data)==null?void 0:Me.definitionId)??x),pe=Ee.label.trim()||x,ve=D===""||D==="default"?void 0:D,Ie={...it.data,label:pe,role:L,model:ve,body:Ee.body,inputs:K,outputs:J},ie=String(Ee.script??"").trim();ee==="tool_nodejs"||ie!==""?Ie.script=String(Ee.script??""):delete Ie.script;const Ce=it.data||{};return(Ce.label!==Ie.label||Ce.role!==Ie.role||Ce.model!==Ie.model||Ce.body!==Ie.body||(Ce.script??void 0)!==(Ie.script??void 0)||JSON.stringify(Ce.inputs||[])!==JSON.stringify(K)||JSON.stringify(Ce.outputs||[])!==JSON.stringify(J))&&(ft(Qe=>Qe.map(Ge=>Ge.id===x?{...Ge,data:Ie}:Ge)),tr(x)),!0},[Ee,u,it,ft,tr]),f0=m.useRef(Am);m.useEffect(()=>{f0.current=Am},[Am]),m.useEffect(()=>{if(!Ee||!u||!Ic.current||Ne!=="edit")return;const x=setTimeout(()=>{f0.current()},400);return()=>clearTimeout(x)},[Ee,u,Ne]);const aT=m.useCallback(()=>{if(!(!Ee||!it)){if(Ee.newId.trim()===it.id){Ei("");return}uf()}},[Ee,it,uf]);m.useEffect(()=>{const x=N=>{var D,B,K;if(Ne!=="edit")return;const L=NI(N.target);if((N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="s"){if(bt==="node"&&it&&Ee){N.preventDefault(),N.stopPropagation(),uf()||Im();return}if(L)return;N.preventDefault(),N.stopPropagation(),Im();return}if((N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="k"){N.preventDefault(),N.stopPropagation(),nr(J=>!J);return}if(!Ye){if(be){if(N.key==="Escape"){N.preventDefault(),Pe(!1);return}if(wh(N)&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),Pe(!1);return}(N.key==="v"||N.key==="V"||N.key==="h"||N.key==="H")&&!N.metaKey&&!N.ctrlKey&&!N.altKey&&N.preventDefault();return}if(!L){if((N.key==="a"||N.key==="A")&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),N.stopPropagation(),(D=Se.current)==null||D.focus(),(K=(B=Se.current)==null?void 0:B.select)==null||K.call(B);return}if((N.metaKey||N.ctrlKey)&&N.key.toLowerCase()==="a"){N.preventDefault(),N.stopPropagation(),ft(J=>J.map(ee=>({...ee,selected:!0}))),Wt(J=>J.map(ee=>({...ee,selected:!1})));return}if(wh(N)&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),Pe(J=>!J);return}if((N.key==="v"||N.key==="V")&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),me("select");return}if((N.key==="h"||N.key==="H")&&!N.metaKey&&!N.ctrlKey&&!N.altKey){N.preventDefault(),me("pan");return}}}};return window.addEventListener("keydown",x,!0),()=>window.removeEventListener("keydown",x,!0)},[Im,be,Ye,bt,it,Ee,uf,Ne]),m.useEffect(()=>{if(Ne!=="running"||Wr==null)return;let x=Math.floor((Date.now()-Wr)/1e3);const N=setInterval(()=>{const L=Date.now()-Wr,D=Math.floor(L/1e3);D!==x&&(x=D,mr(L))},500);return()=>clearInterval(N)},[Ne,Wr]),m.useEffect(()=>{const x=Ya.current;!x||!x.parentElement||es.current&&(ea.current=!0,x.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{ea.current=!1}))},[pr]),m.useEffect(()=>{const x=Ya.current;if(!x)return;const N=x.parentElement;if(!N)return;const L=()=>{if(ea.current)return;const D=N.scrollHeight-N.scrollTop-N.clientHeight;es.current=D<40};return N.addEventListener("scroll",L,{passive:!0}),()=>N.removeEventListener("scroll",L)},[gr,Ne]),m.useEffect(()=>{if(Ne==="edit"||!gr)return;es.current=!0;const x=Ya.current;x&&(ea.current=!0,x.scrollIntoView({behavior:"auto",block:"end"}),requestAnimationFrame(()=>{ea.current=!1}))},[Ne,gr]),m.useEffect(()=>{pr.length>Cp+kN&&ot(x=>x.length>Cp+kN?x.slice(-Cp):x)},[pr]);const lT=m.useCallback(x=>{if(x.button!==0)return;x.preventDefault();const N=x.currentTarget;gt.current={active:!0,pointerId:x.pointerId,startY:x.clientY,startH:dt},N.setPointerCapture(x.pointerId)},[dt]),cT=m.useCallback(x=>{const N=gt.current;if(!N.active||x.pointerId!==N.pointerId)return;const L=N.startY-x.clientY;Je(Ep(N.startH+L))},[]),df=m.useCallback(()=>{Je(x=>{const N=Ep(x);try{localStorage.setItem(FI,String(N))}catch{}return N})},[]),p0=m.useCallback(x=>{const N=gt.current;if(!(!N.active||x.pointerId!==N.pointerId)){N.active=!1;try{x.currentTarget.releasePointerCapture(x.pointerId)}catch{}df()}},[df]),uT=m.useCallback(()=>{const x=gt.current;x.active&&(x.active=!1,df())},[df]);m.useEffect(()=>{function x(){Je(N=>Ep(N))}return window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]);const os=m.useCallback(async(x={})=>{if(!u)return;const N=x.runUuid!=null&&String(x.runUuid).trim()?String(x.runUuid).trim():null,L=x.cliInputsOverride??In.current,D=!!x.prepareOnly;if(an(D?"ready":"running"),ot(D?[]:[{ts:new Date().toISOString(),type:"info",text:N?e("flow:run.connectingApiResume",{uuid:N}):e("flow:run.connectingApi")}]),$n(new Set),Pn({}),Kr(!D),En(null),N||Fn(null),D)return;if(!N){const K=Date.now();hr(K),mr(0)}const B=new AbortController;Zi.current=B;try{const K=await fetch("/api/flow/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user",...N?{uuid:N}:{},cliInputs:L}),signal:B.signal});if(!K.ok){const ie=await K.json().catch(()=>({error:e("flow:composer.requestFailed")}));ot(Ce=>[...Ce,{ts:new Date().toISOString(),type:"error",text:ie.error||e("flow:composer.requestFailed")}]),an("error");return}if(ot(ie=>[...ie,{ts:new Date().toISOString(),type:"info",text:e("flow:run.connectedReceiving")}]),!K.body){ot(ie=>[...ie,{ts:new Date().toISOString(),type:"error",text:e("flow:run.noBody")}]),an("error");return}const J=K.body.getReader(),ee=new TextDecoder;let pe="";const ve=ie=>{const Ce=ie.ts||new Date().toISOString();if(ie.type==="event")if(ie.event==="node-start")$n(ke=>new Set(ke).add(ie.instanceId)),Pn(ke=>({...ke,[ie.instanceId]:{status:"running",startMs:Date.now()}})),ot(ke=>[...ke,{ts:Ce,type:"node-start",text:ie.label?e("flow:run.nodeStartWithLabel",{instanceId:ie.instanceId,label:ie.label}):e("flow:run.nodeStart",{instanceId:ie.instanceId})}]);else if(ie.event==="node-done"){$n(Me=>{const Qe=new Set(Me);return Qe.delete(ie.instanceId),Qe});const ke=ie.elapsed??null;Pn(Me=>({...Me,[ie.instanceId]:{status:"success",elapsed:ke}})),ot(Me=>[...Me,{ts:Ce,type:"node-done",text:ke?e("flow:run.nodeDoneWithElapsed",{instanceId:ie.instanceId,elapsed:ke}):e("flow:run.nodeDone",{instanceId:ie.instanceId})}])}else if(ie.event==="node-failed")$n(ke=>{const Me=new Set(ke);return Me.delete(ie.instanceId),Me}),Pn(ke=>({...ke,[ie.instanceId]:{status:"failed",elapsed:ie.elapsed??null}})),ot(ke=>[...ke,{ts:Ce,type:"node-failed",text:e("flow:run.nodeFailed",{instanceId:ie.instanceId})}]);else if(ie.event==="apply-start"){if(ie.uuid&&Fn(String(ie.uuid)),typeof ie.runStartTime=="number"&&ie.runStartTime>0)hr(ie.runStartTime),mr(Math.max(0,Date.now()-ie.runStartTime));else if(typeof ie.totalExecutedMs=="number"&&ie.totalExecutedMs>0){const ke=Date.now()-ie.totalExecutedMs;hr(ke),mr(ie.totalExecutedMs)}ot(ke=>[...ke,{ts:Ce,type:"info",text:e("flow:run.pipelineStart",{uuid:ie.uuid||"?"})}])}else ie.event==="apply-done"?ot(ke=>[...ke,{ts:Ce,type:"info",text:ie.totalElapsed?e("flow:run.pipelineDoneWithElapsed",{elapsed:ie.totalElapsed}):e("flow:run.pipelineDone")}]):ie.event==="apply-paused"?ot(ke=>[...ke,{ts:Ce,type:"warn",text:e("flow:run.pipelinePaused",{nodes:(ie.pendingNodes||[]).join(", ")})}]):ot(ke=>[...ke,{ts:Ce,type:"event",text:`[${ie.event}] ${JSON.stringify(ie)}`}]);else ie.type==="user-check-content"?(As({instanceId:ie.instanceId,execId:ie.execId??1,inputPath:ie.inputPath,outputPath:ie.outputPath,content:ie.content||""}),Ga(ie.content||""),ta(!1),Ja(""),na(!1),ot(ke=>[...ke,{ts:Ce,type:"user-check",text:e("flow:run.userCheckContent",{instanceId:ie.instanceId})}])):ie.type==="user-ask-prompt"?(bc({instanceId:ie.instanceId,execId:ie.execId??1,question:ie.question||"",options:Array.isArray(ie.options)?ie.options:[]}),ia(!1),ot(ke=>[...ke,{ts:Ce,type:"user-ask",text:e("flow:run.userAskPrompt",{instanceId:ie.instanceId,defaultValue:`等待用户选择 (${ie.instanceId})`})}])):ie.type==="tool-print-content"?(Hd({instanceId:ie.instanceId,execId:ie.execId??1,content:ie.content||"",createdAt:Date.now()}),Sc(!1)):ie.type==="log"?ot(ke=>[...ke,{ts:Ce,type:"log",text:ie.text!=null?String(ie.text):""}]):ie.type==="error"?ot(ke=>[...ke,{ts:Ce,type:"error",text:ie.message||e("flow:run.unknownError")}]):ie.type==="done"?ot(ke=>[...ke,{ts:Ce,type:"done",text:e("flow:run.executionEnd",{exitCode:ie.exitCode??"?"})}]):ot(ke=>[...ke,{ts:Ce,type:"log",text:JSON.stringify(ie)}])},Ie=ie=>{if(ie.trim())try{ve(JSON.parse(ie))}catch{ot(Ce=>[...Ce,{ts:new Date().toISOString(),type:"log",text:ie}])}};for(;;){const{done:ie,value:Ce}=await J.read();pe+=ee.decode(Ce??new Uint8Array,{stream:!ie});const ke=pe.split(`
129
- `);pe=ke.pop()??"";for(const Me of ke)Ie(Me);if(ie)break}pe.trim()&&Ie(pe),an("done")}catch(K){K.name==="AbortError"?(ot(J=>[...J,{ts:new Date().toISOString(),type:"warn",text:e("flow:run.executionStopped")}]),an("stopped")):(ot(J=>[...J,{ts:new Date().toISOString(),type:"error",text:K.message||e("flow:run.unknownError")}]),an("error"))}finally{Zi.current=null,$n(new Set)}},[u]),[dT,Tm]=m.useState(!1),fT=m.useCallback(()=>{Tm(!0)},[]),pT=m.useCallback(async()=>{if(Tm(!1),Zi.current&&(Zi.current.abort(),Zi.current=null),u)try{await fetch("/api/flow/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user"})})}catch{}an("stopped"),$n(new Set)},[u]),da=m.useCallback(()=>{an("edit"),$n(new Set),Pn({}),ki(null),Fn(null)},[]),[hT,ff]=m.useState(!1),mT=m.useCallback(async()=>{if(ff(!1),Zi.current&&(Zi.current.abort(),Zi.current=null),u)try{await fetch("/api/flow/run/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source||"user"})})}catch{}da()},[u,da]),gT=m.useCallback(()=>{ff(!1),n("/projects")},[n]),yT=m.useCallback(x=>{const N=x.runId!=null&&String(x.runId).trim()?String(x.runId).trim():null,L=x.flowId!=null&&String(x.flowId).trim()?String(x.flowId).trim():(u==null?void 0:u.id)!=null?String(u.id):null;Fn(N);const D=x.status||"unknown";let B="stopped";D==="success"?B="done":D==="failed"?B="error":D==="running"?B="running":B="stopped",an(B);const K=typeof x.at=="number"?x.at:null;if(B==="running"&&K!=null?(hr(K),mr(Math.max(0,Date.now()-K))):K!=null&&typeof x.endedAt=="number"&&x.endedAt>K?(hr(null),mr(x.endedAt-K)):(hr(null),mr(Math.max(0,x.durationMs??0))),ot([]),$n(new Set),Pn({}),ki(null),En(null),Kr(!1),N&&L){const J=new URLSearchParams({flowId:L,runId:N});fetch(`/api/run-node-statuses?${J}`).then(ee=>ee.json()).then(ee=>{const pe=ee.statuses&&typeof ee.statuses=="object"?ee.statuses:{},ve={};for(const[Ie,ie]of Object.entries(pe))ie&&typeof ie=="object"&&typeof ie.status=="string"&&(ve[Ie]={status:ie.status,...ie.elapsed!=null&&String(ie.elapsed).trim()!==""?{elapsed:String(ie.elapsed)}:{}});Pn(ve)}).catch(()=>{})}},[u==null?void 0:u.id]);m.useEffect(()=>{if(!(u!=null&&u.id)||Ne!=="edit")return;let x=!1;return(async()=>{try{const N=await fetch("/api/pipeline-recent-runs"),L=await N.json();if(x||!N.ok)return;const B=(Array.isArray(L.runs)?L.runs:[]).find(ee=>ee.flowId===u.id&&ee.status==="running");if(!B||x)return;const K=B.runId||null;Fn(K),an("running"),Kr(!0),hr(B.at||Date.now()),ai.current=0;const J=[{ts:new Date().toISOString(),type:"info",text:`[resume] 检测到活跃 run ${K},已恢复运行视图`}];if(K){const ee=new URLSearchParams({flowId:u.id,runId:K}),ve=await(await fetch(`/api/run-node-statuses?${ee}`)).json();if(x)return;const Ie=ve.statuses&&typeof ve.statuses=="object"?ve.statuses:{},ie={},Ce=new Set;for(const[ke,Me]of Object.entries(Ie))Me&&typeof Me=="object"&&typeof Me.status=="string"&&(ie[ke]={status:Me.status,...Me.elapsed!=null&&String(Me.elapsed).trim()!==""?{elapsed:String(Me.elapsed)}:{}},Me.status==="running"&&Ce.add(ke));Pn(ie),$n(Ce);try{const ke=new URLSearchParams({flowId:u.id,runId:K,sinceBytes:"0",tailBytes:"262144"}),Me=await fetch(`/api/run-log?${ke}`);if(Me.ok){const Qe=await Me.json();if(!x){ai.current=Number(Qe.bytes||0);const Ge=SN(typeof Qe.text=="string"?Qe.text:"");ot([...Ge,...J]);return}}}catch{}}ot(J)}catch{}})(),()=>{x=!0}},[u==null?void 0:u.id]),m.useEffect(()=>{if(Ne==="edit"||!(u!=null&&u.id)||!nt)return;let x=!1,N=null;const L=async()=>{try{const D=new URLSearchParams({flowId:u.id,runId:nt}),B=await fetch(`/api/run-node-statuses?${D}`);if(!B.ok)return;const K=await B.json();if(x)return;const J=K.statuses&&typeof K.statuses=="object"?K.statuses:{},ee={},pe=new Set;for(const[ve,Ie]of Object.entries(J))Ie&&typeof Ie=="object"&&typeof Ie.status=="string"&&(ee[ve]={status:Ie.status,...Ie.elapsed!=null&&String(Ie.elapsed).trim()!==""?{elapsed:String(Ie.elapsed)}:{}},Ie.status==="running"&&pe.add(ve));Pn(ve=>ZV(ve,ee)?ve:ee),$n(ve=>eW(ve,pe)?ve:pe);try{const ve=new URLSearchParams({flowId:u.id,runId:nt,sinceBytes:String(ai.current||0),tailBytes:String(GV)}),Ie=await fetch(`/api/run-log?${ve}`);if(Ie.ok){const ie=await Ie.json();if(x)return;const Ce=Number(ie.bytes||0),ke=typeof ie.text=="string"?ie.text:"";if(ke){const Me=SN(ke);Me.length>0&&ot(Qe=>[...Qe,...Me])}ai.current=Ce}}catch{}try{const ve=await fetch("/api/pipeline-recent-runs");if(!ve.ok)return;const Ie=await ve.json();if(x)return;const Ce=(Array.isArray(Ie.runs)?Ie.runs:[]).find(ke=>ke.flowId===u.id&&ke.runId===nt);if(Ce&&Ce.status){const ke=Ce.status;ke==="running"?an(Me=>Me==="running"?Me:"running"):ke==="success"?an("done"):ke==="failed"?an("error"):(ke==="stopped"||ke==="interrupted")&&an("stopped")}}catch{}}catch{}};return L(),N=window.setInterval(L,2500),()=>{x=!0,N&&window.clearInterval(N)}},[Ne,u==null?void 0:u.id,nt]),m.useEffect(()=>{if(bt!=="history"||!u)return;let x=!1;return(async()=>{oi(!0),Zn("");try{const N=await fetch("/api/pipeline-recent-runs"),L=await N.json();if(!N.ok)throw new Error(L.error||"HTTP "+N.status);x||Gt(Array.isArray(L.runs)?L.runs:[])}catch(N){x||(Zn(String(N.message||N)),Gt([]))}finally{x||oi(!1)}})(),()=>{x=!0}},[bt,u]),m.useEffect(()=>{if(!u){jt({files:[]});return}let x=!1;return(async()=>{$t(!0);try{const N=new URLSearchParams({flowId:u.id,flowSource:u.source||"user",archived:u.archived?"1":"0"}),L=await fetch(`/api/pipeline-files?${N}`),D=await L.json();if(!L.ok)throw new Error(D.error||"HTTP "+L.status);x||jt({files:Array.isArray(D.files)?D.files:[],path:D.path,error:D.error})}catch(N){x||jt({files:[],error:N.message||String(N)})}finally{x||$t(!1)}})(),()=>{x=!0}},[u]);const Tc=m.useMemo(()=>u?vi.filter(x=>x&&x.flowId===u.id).sort((x,N)=>N.at-x.at):[],[vi,u]),wr=m.useMemo(()=>{let x=0,N=0,L=0,D=0,B=0;for(const K of Tc){const J=K.status||"unknown";J==="success"?x+=1:J==="failed"?N+=1:J==="running"?L+=1:J==="stopped"?D+=1:J==="interrupted"&&(B+=1)}return{success:x,failed:N,running:L,stopped:D,interrupted:B}},[Tc]),Rc=m.useMemo(()=>u?xN(xr,V):null,[u,xr,V]),Ii=m.useMemo(()=>{if(!Rc||!u)return[];const x=Rc.query.toLowerCase(),N=B=>x?B.some(K=>K&&String(K).toLowerCase().includes(x)):!0,L=wt.map(B=>{var ve,Ie;const K=B.id,J=String(((ve=B.data)==null?void 0:ve.label)??K),ee=(Ie=B.data)!=null&&Ie.definitionId?String(B.data.definitionId):"",pe=[J!==K?J:"",ee&&ee!==K?ee:""].filter(Boolean);return{id:K,label:J,defId:ee,subs:pe}}).filter(({id:B,label:K,defId:J})=>N([B,K,J])).sort((B,K)=>B.id.localeCompare(K.id)).slice(0,18).map(({id:B,label:K,defId:J})=>{const ee=[K!==B?K:null,J||null].filter(Boolean).join(" · ")||void 0;return{kind:"instance",id:B,title:B,subtitle:ee}}),D=de.filter(B=>B&&B.id&&N([B.id,B.label,B.description])).sort((B,K)=>B.id.localeCompare(K.id)).slice(0,22).map(B=>({kind:"definition",id:B.id,title:B.id,subtitle:B.label&&B.label!==B.id?String(B.label):String(B.type||"")}));return[...L,...D]},[Rc,wt,de,u]),Lc=m.useMemo(()=>{const x=Ii.filter(L=>L.kind==="instance"),N=Ii.filter(L=>L.kind==="definition");return{instances:x,definitions:N}},[Ii]);m.useEffect(()=>{ne(x=>{const N=Math.max(0,Ii.length-1);return Math.min(Math.max(0,x),N)})},[Ii]);const h0=m.useMemo(()=>zV(xr),[xr]),Wn=m.useMemo(()=>wt.filter(x=>x.selected),[wt]),Rm=m.useMemo(()=>new Set(Wn.map(x=>x.id)),[Wn]),pf=m.useMemo(()=>en.filter(x=>Rm.has(x.source)&&Rm.has(x.target)),[en,Rm]),m0=m.useMemo(()=>{const x=se.trim().toLowerCase();return x?He.filter(N=>[N.id,N.version,N.displayName,N.name,N.description,...Array.isArray(N.tags)?N.tags:[]].filter(Boolean).some(L=>String(L).toLowerCase().includes(x))):He},[He,se]),g0=m.useCallback((x,N)=>{const L=String(x||"snippet-node").trim().replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")||"snippet-node",D=Date.now().toString(36);let B=`${L}-${D}`,K=2;for(;N.has(B);)B=`${L}-${D}-${K}`,K+=1;return N.add(B),B},[]),y0=m.useCallback((x,N)=>{var $c;if(!u||!x)return;const L=x.snippet&&typeof x.snippet=="object"?x.snippet:{},D=L.instances&&typeof L.instances=="object"?L.instances:{},B=Object.keys(D);if(B.length===0)return;const K=new Set(oo.current.map(Ae=>Ae.id)),J={};for(const Ae of B)J[Ae]=g0(Ae,K);const ee=($c=L.ui)!=null&&$c.nodePositions&&typeof L.ui.nodePositions=="object"?L.ui.nodePositions:{},pe=B.map(Ae=>{const St=ee[Ae];return{id:Ae,x:typeof(St==null?void 0:St.x)=="number"?St.x:0,y:typeof(St==null?void 0:St.y)=="number"?St.y:0}}),ve=Math.min(...pe.map(Ae=>Ae.x)),Ie=Math.min(...pe.map(Ae=>Ae.y));let ie=N||{x:180,y:160};const Ce=ua.current,ke=document.querySelector(".af-pipeline-flow .react-flow");if(!N&&Ce&&ke){const Ae=ke.getBoundingClientRect();ie=Ce.screenToFlowPosition({x:Ae.left+Ae.width*.48,y:Ae.top+Ae.height*.32})}const Me={};for(const Ae of B)Me[J[Ae]]={...D[Ae]||{}};li.current={...li.current,...Me};const Qe=B.map(Ae=>{const St=D[Ae]||{},An=pe.find(Rs=>Rs.id===Ae)||{x:0,y:0},uo={id:J[Ae],type:"flowNode",selected:!0,position:{x:ie.x+(An.x-ve),y:ie.y+(An.y-Ie)},data:{label:St.label||J[Ae],definitionId:St.definitionId||Ae,role:St.role||"normal",body:St.body||"",script:St.script||""}};return fd(uo,li.current,de,{},u.id)}),Ge=new Set(B),Mc=(Array.isArray(L.edges)?L.edges:[]).filter(Ae=>Ge.has(Ae==null?void 0:Ae.source)&&Ge.has(Ae==null?void 0:Ae.target)).map((Ae,St)=>({id:`e-${J[Ae.source]}-${J[Ae.target]}-${Date.now()}-${St}`,source:J[Ae.source],target:J[Ae.target],sourceHandle:Ae.sourceHandle??void 0,targetHandle:Ae.targetHandle??void 0,markerEnd:{type:zr.ArrowClosed}}));ft(Ae=>[...Ae.map(St=>({...St,selected:!1})),...Qe]),Wt(Ae=>[...Ae.map(St=>({...St,selected:!1})),...Mc]),w(`已添加流程片段:${x.displayName||x.id}`)},[g0,de,u,Wt,ft]);Zd.current=y0;const xT=m.useCallback(()=>{var L,D;if(Wn.length<2){pn("请先在画布上选择至少两个节点。"),ye("flows");return}const x=Wn[0],N=Wn.length===2?`${((L=x.data)==null?void 0:L.label)||x.id} 片段`:`${((D=x.data)==null?void 0:D.label)||x.id} 等 ${Wn.length} 个节点`;On({name:N,id:N.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),he(""),Nn(!0),ye("flows")},[Wn]),wT=m.useCallback(async()=>{var B,K;if(!u||Wn.length<2)return;const x=xn.name.trim();if(!x){he("请填写片段名称。");return}const N=cm(Wn,li.current),L={};for(const J of Wn)L[J.id]={x:((B=J.position)==null?void 0:B.x)||0,y:((K=J.position)==null?void 0:K.y)||0};const D=pf.map(J=>({source:J.source,target:J.target,sourceHandle:J.sourceHandle??null,targetHandle:J.targetHandle??null}));Jn(!0),he("");try{const J=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:xn.id,name:x,displayName:x,version:"1.0.0",description:xn.description,snippet:{instances:N,edges:D,ui:{nodePositions:L}}})}),ee=await J.json().catch(()=>({}));if(!J.ok||(ee==null?void 0:ee.ok)===!1)throw new Error((ee==null?void 0:ee.error)||"Publish failed");Nn(!1),w(`流程片段已发布:${ee.id||x}`),Gi(`流程片段已发布:${ee.id||x}`),await sf(),ye("flows")}catch(J){he(String(J.message||J))}finally{Jn(!1)}},[u,Wn,pf,xn,sf,Gi]),hf=m.useMemo(()=>{const x=[],N=new Set;for(const B of Wn)N.add(B.id),x.push({node:B,kind:"canvas"});const L=new Map(wt.map(B=>[B.id,B])),D=new Map(de.map(B=>[B.id,B]));for(const B of h0){if(N.has(B))continue;const K=L.get(B);if(K){N.add(B),x.push({node:K,kind:"mention"});continue}const J=D.get(B);J&&(N.add(B),x.push({definition:J,kind:"definition"}))}return x},[Wn,h0,wt,de]),_r=m.useMemo(()=>{const x=Array.isArray(je==null?void 0:je.cursor)?je.cursor:[],N=Array.isArray(je==null?void 0:je.opencode)?je.opencode:[],L=Array.isArray(je==null?void 0:je.claudeCode)?je.claudeCode:[],D=N.map(ve=>`opencode:${Fs(ve)}`),B=L.map(ve=>`claude-code:${Fs(ve)}`),K=new Set([...x,...N,...L].map(Fs).concat(D).concat(B)),J=(aa||"").trim(),ee=Jf(aa,x,N,L),pe=ee&&!K.has(ee)&&!K.has(J)?J:"";return{cursorList:x,opencodeList:N,claudeCodeList:L,currentNotInLists:pe}},[je,aa]),Lm=m.useMemo(()=>new Set(la),[la]),Om=la.length,mf=m.useMemo(()=>{const x=new Map(Ts.map(K=>[K.key,K])),N=new Set,L=new Set,D=Ud.map(K=>{const J=Bo(K,Ts).map(ee=>x.get(ee)).filter(Boolean);for(const ee of J)N.add(ee.key),L.add(String(ee.name||ee.id||ee.key||"").trim());return{...K,skills:J}}).filter(K=>K.skills.length>0),B=Ts.filter(K=>{const J=String(K.name||K.id||K.key||"").trim();return!N.has(K.key)&&!L.has(J)});return{groups:D,ungrouped:B}},[Ud,Ts]),nl=m.useCallback(()=>{const x=wm.current;if(!x)return;const N=x.getBoundingClientRect(),L=Math.min(400,Math.max(300,window.innerWidth-24)),D=Math.min(Math.max(12,N.right-L),window.innerWidth-L-12),B=Math.max(140,N.top-22),K=Math.min(360,B);RA({position:"fixed",left:`${D}px`,top:`${Math.max(12,N.top-K-10)}px`,width:`${L}px`,maxHeight:`${K}px`})},[]);m.useEffect(()=>{const x=Array.isArray(je==null?void 0:je.cursor)?je.cursor:[],N=Array.isArray(je==null?void 0:je.opencode)?je.opencode:[],L=Array.isArray(je==null?void 0:je.claudeCode)?je.claudeCode:[];Bv(D=>{const B=Jf(D,x,N,L);return B===D?D:B})},[je.cursor,je.opencode,je.claudeCode]),m.useEffect(()=>{if(!Vd)return;nl();const x=L=>{var B,K;const D=L.target;(B=wm.current)!=null&&B.contains(D)||(K=Vv.current)!=null&&K.contains(D)||xm(!1)},N=L=>{L.key==="Escape"&&xm(!1)};return window.addEventListener("resize",nl),window.addEventListener("scroll",nl,!0),document.addEventListener("pointerdown",x),document.addEventListener("keydown",N),()=>{window.removeEventListener("resize",nl),window.removeEventListener("scroll",nl,!0),document.removeEventListener("pointerdown",x),document.removeEventListener("keydown",N)}},[Vd,nl]);const fa=m.useCallback(async(x,N={})=>{var $c;if(!u||Sm.current)return;const L=N.phaseContextSnapshot,D=(typeof x=="string"?x:xr).trim();if(!D)return;const B=Xv.current;Sm.current=!0,e0(!0),ns(e("flow:composer.connecting")),En(Ae=>Ae!=="composer"?"composer":Ae);const K=[...Ec];if(B.length>0&&K.push({type:"assistant",segments:[...B]}),t0([...K,{type:"user",text:D}]),K.filter(Ae=>Ae.type==="user").length===0){const Ae=D.replace(/\s+/g," ").slice(0,30)+(D.length>30?"…":"");ts(St=>St.map(An=>An.id===ir?{...An,label:Ae}:An))}const J=K.map(Ae=>Ae.type==="user"?{role:"user",text:Ae.text}:{role:"assistant",text:(Ae.segments||[]).filter(An=>An.kind==="assistant"||An.kind==="result").map(An=>An.text).join(`
130
- `)}).filter(Ae=>Ae.text),ee=L??lt;_(""),rs([]),_c([]),n0(!1);const pe=new AbortController;Xd.current=pe,km.current=ir;let ve=null;const Ie=Array.isArray(je==null?void 0:je.cursor)?je.cursor:[],ie=Array.isArray(je==null?void 0:je.opencode)?je.opencode:[],Ce=Array.isArray(je==null?void 0:je.claudeCode)?je.claudeCode:[],ke=Jf(aa,Ie,ie,Ce),Me=hf.filter(Ae=>Ae.kind!=="definition"&&Ae.node).map(Ae=>Ae.node.id),Qe=u;let Ge=!1,Mc=!1;try{ve=setTimeout(()=>pe.abort(),12e4);const Ae={prompt:D,model:ke,flowId:u.id,flowSource:u.source??"user",...u.archived?{flowArchived:!0}:{},contextInstanceIds:Me,thread:J,selectedSkills:la};ee&&ee.nextPhase&&!ee.isLastPhase&&(Ae.phaseContext={phaseIndex:ee.nextPhase.index,phases:ee.phases,userPromptOriginal:ee.userPromptOriginal||D}),ym&&(Ae.phaseRole=ym);const St=await fetch("/api/composer-agent",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ae),signal:pe.signal});if(ve&&(clearTimeout(ve),ve=null),!St.ok){let Fc=St.statusText||e("flow:composer.requestFailed");try{const Dc=await St.json();Dc&&Dc.error&&(Fc=String(Dc.error))}catch{}ns(Fc),rs([{kind:"error",text:Fc}]);return}const An=($c=St.body)==null?void 0:$c.getReader();if(!An){ns(e("flow:composer.cannotReadStream"));return}const uo=new TextDecoder;let Rs="";for(;;){const{done:Fc,value:Dc}=await An.read();if(Fc)break;for(Rs+=uo.decode(Dc,{stream:!0});;){const Fm=Rs.indexOf(`
131
- `);if(Fm<0)break;const N0=Rs.slice(0,Fm).trim();if(Rs=Rs.slice(Fm+1),!N0)continue;let Oe;try{Oe=JSON.parse(N0)}catch{continue}if(Oe.type==="status"&&typeof Oe.line=="string"&&ns(Oe.line),Oe.type==="natural"&&typeof Oe.text=="string"&&Oe.text){const Tt=typeof Oe.kind=="string"&&Oe.kind?Oe.kind:"assistant";rs(Pt=>[...Pt,{kind:Tt,text:Oe.text}])}if(Oe.type==="error"&&Oe.message){Mc=!0;const Tt=Oe.code?` [${Oe.code}]`:"",Pt=String(Oe.message)+Tt;ns(Pt),rs(Pr=>[...Pr,{kind:"error",text:Pt}])}if(Oe.type==="plan"&&Array.isArray(Oe.steps)){_c(Oe.steps.map(Pt=>({...Pt,status:"pending"})));const Tt=Oe.steps.map((Pt,Pr)=>`${Pr+1}. ${Pt.description||Pt.type}`).join(`
132
- `);rs(Pt=>[...Pt,{kind:"assistant",text:e("flow:composer.taskPlan",{count:Oe.steps.length,summary:Tt})}])}if(Oe.type==="step-start"){const Tt=Oe.index??0,Pt=Oe.total??0,Pr=Oe.tier?` [${Oe.tier}]`:"",jT=Oe.model?` (${Oe.model})`:"";ns(e("flow:composer.step",{current:Tt+1,total:Pt,description:(Oe.description||"")+Pr+jT})),_c(CT=>CT.map(rl=>rl.index===Tt?{...rl,status:"running",model:Oe.model,tier:Oe.tier,nodeRole:Oe.nodeRole??rl.nodeRole,instanceId:Oe.instanceId??rl.instanceId,instanceLabel:Oe.instanceLabel??rl.instanceLabel}:rl))}if(Oe.type==="step-progress"){const Tt=Oe.index??0,Pt=Oe.total??0;ns(e("flow:composer.step",{current:Tt+1,total:Pt,description:Oe.description||""}))}if(Oe.type==="step-done"){const Tt=Oe.index??0;_c(Pt=>Pt.map(Pr=>Pr.index===Tt?{...Pr,status:Oe.success?"done":"error"}:Pr))}if(Oe.type==="phase-plan"&&Array.isArray(Oe.phases)){Pc(Pt=>({...Pt||{},phases:Oe.phases,currentPhase:Oe.currentPhase??0,phaseTotal:Oe.phaseTotal??Oe.phases.length,phaseName:Oe.phaseName||"",isLastPhase:!1,nextPhase:null,userPromptOriginal:(Pt==null?void 0:Pt.userPromptOriginal)||D}));const Tt=Oe.phases.map((Pt,Pr)=>`${Pr+1}. ${Pt.label}`).join(" → ");rs(Pt=>[...Pt,{kind:"assistant",text:e("flow:composer.phaseGeneration",{count:Oe.phases.length,labels:Tt,current:Oe.phaseName||""})}])}Oe.type==="phase-complete"&&(Pc(Tt=>{var Pr;return{...Tt||{},phases:Oe.phases||(Tt==null?void 0:Tt.phases)||[],currentPhase:Oe.phaseIndex??0,phaseTotal:Oe.phaseTotal??((Pr=Oe.phases)==null?void 0:Pr.length)??0,phaseName:Oe.phaseName||"",isLastPhase:!!Oe.isLastPhase,nextPhase:Oe.nextPhase||null,userPromptOriginal:Oe.userPromptOriginal||(Tt==null?void 0:Tt.userPromptOriginal)||D}}),!Oe.isLastPhase&&Oe.nextPhase&&rs(Tt=>[...Tt,{kind:"assistant",text:e("flow:composer.phaseComplete",{phaseName:Oe.phaseName||e("flow:composer.nextPhase"),nextPhase:Oe.nextPhase.label})}])),Oe.type==="done"&&(Ge=!0,ns(Tt=>Tt||e("flow:composer.done")))}}}catch(Ae){const St=Ae;if(St.name==="AbortError"){const An=e(ve?"flow:composer.connectTimeout":"flow:composer.aborted");ns(An),rs(uo=>[...uo,{kind:"error",text:An}])}else{const An=St.code||St.name||"UNKNOWN",uo=`${St.message||String(Ae)} [${An}]`;ns(uo),rs(Rs=>[...Rs,{kind:"error",text:uo}])}}finally{if(Sm.current=!1,e0(!1),Xd.current=null,km.current=null,ve&&clearTimeout(ve),Ge&&Qe){const Ae={id:Qe.id,source:Qe.source??"user",archived:Qe.archived};(async()=>(await ci(Ae,{preserveComposer:!0,incrementalSync:!0}),await co(Ae,{quiet:!0,force:!0})))()}}},[u,xr,aa,je,hf,ci,co,Ec,ir,lt,ym,la]);LA.current=fa;const x0=m.useCallback(()=>{!lt||lt.isLastPhase||(Pc(null),fa(e("flow:composer.skipRemainingPhases")))},[lt,fa]),w0=m.useCallback(()=>{if(!lt||lt.isLastPhase||!lt.nextPhase)return;const x=String(lt.nextPhase.label||"").trim()||e("flow:composer.nextPhase");fa(e("flow:composer.continuePhase",{label:x}),{phaseContextSnapshot:lt})},[lt,fa]);m.useEffect(()=>{if(!bm)return;const x=N=>{N.key==="Escape"&&Gd(!1)};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[bm]),m.useEffect(()=>{Ne!=="edit"&&Gd(!1)},[Ne]),m.useLayoutEffect(()=>{const x=Zt.current;if(!x)return;if(!u){x.style.height="";return}x.style.height="0px";const N=getComputedStyle(x),L=parseFloat(N.lineHeight),D=(parseFloat(N.paddingTop)||0)+(parseFloat(N.paddingBottom)||0),B=Number.isFinite(L)&&L>0?L:13*1.45,K=D+B*2,J=D+B*10,ee=Math.min(Math.max(x.scrollHeight,K),J);x.style.height=`${ee}px`},[xr,u]);const Mm=m.useCallback(x=>{const N=xr,L=V,D=xN(N,L);if(!D)return;const B=N.slice(0,D.atIndex)+`@${x} `+N.slice(L);_(B);const K=D.atIndex+x.length+2;queueMicrotask(()=>{const J=Zt.current;J&&(J.focus(),J.setSelectionRange(K,K)),X(K)})},[xr,V]),$m=m.useCallback(x=>{_(N=>{const L=`@${x}`,D=N.indexOf(L);return D<0?N:N.slice(0,D)+N.slice(D+L.length)})},[]),v0=m.useCallback(x=>{x.kind==="canvas"?ft(N=>N.map(L=>L.id===x.node.id?{...L,selected:!1}:L)):x.kind==="mention"?$m(x.node.id):$m(x.definition.id)},[ft,$m]),vT=m.useCallback(()=>{En(x=>x==="history"?null:"history")},[]),bT=m.useCallback(()=>{En(x=>x==="settings"?null:"settings")},[]),kT=m.useCallback(()=>{En(x=>x==="composer"?null:"composer")},[]),Oc=m.useCallback(()=>{En(x=>(x==="node"&&Dn.current&&(rr.current=Dn.current.id),null))},[]),b0=m.useCallback(()=>{Pe(x=>!x)},[]),ST=()=>{if(!u)return null;const x=qr||u.archived||u.source==="builtin",N=Vt!=null&&Vt.running?e("flow:schedule.running"):Jt.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled"),L=Vt!=null&&Vt.running?"running":Jt.enabled?"waiting":"disabled",D=Et.slice(0,12),B=u.archived||u.source==="builtin";return a.jsxs("section",{className:"af-pipeline-settings-page","aria-label":e("flow:settings.title"),children:[a.jsxs("aside",{className:"af-pipeline-settings-nav","aria-label":e("flow:settings.sectionNav"),children:[a.jsx("div",{className:"af-pipeline-settings-nav-title",children:e("flow:settings.title")}),a.jsxs("a",{href:"#pipeline-basic",className:"af-pipeline-settings-nav-item af-pipeline-settings-nav-item--active",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"badge"}),e("flow:settings.basicInfo")]}),a.jsxs("a",{href:"#pipeline-storage",className:"af-pipeline-settings-nav-item",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder_open"}),e("flow:settings.storageAndPath")]}),a.jsxs("a",{href:"#pipeline-marketplace",className:"af-pipeline-settings-nav-item",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"deployed_code"}),e("flow:settings.nodeMarketplace")]}),a.jsxs("a",{href:"#pipeline-schedule",className:"af-pipeline-settings-nav-item",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"schedule"}),e("flow:schedule.title")]}),a.jsxs("a",{href:"#pipeline-metadata",className:"af-pipeline-settings-nav-item",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"dataset"}),e("flow:pipeline.metadata")]}),a.jsxs("button",{type:"button",className:"af-pipeline-settings-nav-link",onClick:()=>n("/settings"),children:[e("flow:settings.globalSettings"),a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_new"})]})]}),a.jsxs("main",{className:"af-pipeline-settings-main",children:[a.jsxs("div",{className:"af-pipeline-settings-main-head",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"af-pipeline-settings-title",children:e("flow:settings.title")}),a.jsx("p",{className:"af-pipeline-settings-subtitle",children:e("flow:settings.subtitle")})]}),a.jsxs("button",{type:"button",className:"af-btn-secondary",onClick:Oc,children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),e("flow:settings.backToCanvas")]})]}),a.jsxs("section",{id:"pipeline-basic",className:"af-pipeline-settings-section",children:[a.jsxs("div",{className:"af-pipeline-settings-section-head",children:[a.jsx("span",{className:"af-pipeline-settings-section-index",children:"1."}),a.jsx("h2",{children:e("flow:settings.basicInfo")})]}),a.jsxs("div",{className:"af-pipeline-settings-grid af-pipeline-settings-grid--two",children:[a.jsxs("div",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.pipelineId")}),(u.source==="user"||u.source==="workspace")&&!u.archived?a.jsxs("div",{className:"af-pipeline-rename-row",children:[a.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:O,onChange:K=>{F(K.target.value),q("")},onKeyDown:K=>{K.key==="Enter"&&(K.preventDefault(),cf())},onBlur:()=>{O.trim()&&O.trim()!==u.id&&cf()},placeholder:u.id,disabled:W,spellCheck:!1}),a.jsx("span",{className:"af-pipeline-drawer-badge",children:cl(u.source??"user",e)})]}):a.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[u.id,a.jsx("span",{className:"af-pipeline-drawer-badge",children:cl(u.source??"user",e)}),u.archived?a.jsx("span",{className:"af-pipeline-drawer-badge af-pipeline-drawer-badge--muted",children:e("flow:settings.archived")}):null]}),I?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:I}):null]}),a.jsxs("div",{className:"af-pipeline-settings-kv-block",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:settings.owner")}),a.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"person"}),u.owner||"bigo"]})]})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.introduction")}),a.jsx("textarea",{className:"af-pipeline-drawer-textarea af-pipeline-settings-textarea",value:y,onChange:K=>b(K.target.value),placeholder:e("flow:pipeline.introductionPlaceholder"),rows:4,spellCheck:!1})]})]}),a.jsxs("section",{id:"pipeline-storage",className:"af-pipeline-settings-section",children:[a.jsxs("div",{className:"af-pipeline-settings-section-head",children:[a.jsx("span",{className:"af-pipeline-settings-section-index",children:"2."}),a.jsx("h2",{children:e("flow:settings.storageAndPath")})]}),typeof u.path=="string"&&u.path?a.jsxs("div",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.diskPath")}),a.jsxs("div",{className:"af-pipeline-drawer-readonly af-pipeline-drawer-readonly--mono af-pipeline-path-row",children:[a.jsx("span",{className:"af-pipeline-path-text",children:u.path}),a.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-copy-btn",onClick:()=>d0(u.path),title:e("flow:settings.copyPath"),children:a.jsx("span",{className:"material-symbols-outlined",children:$?"check":"content_copy"})})]})]}):null,u.source==="user"||u.source==="workspace"?u.archived?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.archivedNote")}):a.jsxs("div",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.storageLocation")}),a.jsx("div",{className:"af-pipeline-move-actions",children:u.source==="user"?a.jsx("button",{type:"button",className:"af-btn-secondary",disabled:j,onClick:()=>lf("workspace"),children:e(j?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):a.jsx("button",{type:"button",className:"af-btn-secondary",disabled:j,onClick:()=>lf("user"),children:e(j?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),k?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:k}):null]}):a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.builtinNote")})]}),a.jsxs("section",{id:"pipeline-marketplace",className:"af-pipeline-settings-section",children:[a.jsxs("div",{className:"af-pipeline-settings-section-head",children:[a.jsx("span",{className:"af-pipeline-settings-section-index",children:"3."}),a.jsx("h2",{children:e("flow:settings.nodeMarketplace")})]}),a.jsxs("div",{className:"af-pipeline-market-row",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"af-pipeline-market-count",children:[Et.length," ",e("flow:settings.marketNodesUnit")]}),a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.marketplaceHint")})]}),a.jsxs("button",{type:"button",className:"af-btn-secondary",onClick:_m,disabled:xt,children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"}),e(xt?"common:common.loading":"common:common.refresh")]})]}),Qn?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:Qn}):null,xt?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):D.length>0?a.jsx("div",{className:"af-pipeline-market-list",children:D.map(K=>{const J=K.definitionId||`marketplace:${K.id}${K.version?`@${K.version}`:""}`,ee=a0.has(J)||a0.has(`marketplace:${K.id}`),pe=tf.find(Ce=>String(Ce.id)===J||String(Ce.id)===`marketplace:${K.id}`),ve=Ut===J,Ie=Xf(K.inputs||K.input),ie=Xf(K.outputs||K.output);return a.jsxs("div",{className:"af-pipeline-market-item",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:ee?"check_circle":"extension"}),a.jsxs("div",{className:"af-pipeline-market-main",children:[a.jsxs("div",{className:"af-pipeline-market-title-row",children:[a.jsx("strong",{children:K.displayName||K.label||K.id}),a.jsx("span",{children:K.version?`v${K.version}`:J})]}),a.jsx("p",{className:"af-pipeline-market-purpose",children:K.description||e("flow:settings.marketplaceNoDescription")}),a.jsxs("div",{className:"af-pipeline-market-io",children:[a.jsxs("div",{children:[a.jsx("span",{className:"af-pipeline-market-io-label",children:"Inputs"}),a.jsx("div",{className:"af-pipeline-market-chips",children:Ie.length>0?Ie.map(Ce=>a.jsx("span",{className:"af-pipeline-market-chip",children:Ce},`in-${J}-${Ce}`)):a.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noInputs")})})]}),a.jsxs("div",{children:[a.jsx("span",{className:"af-pipeline-market-io-label",children:"Outputs"}),a.jsx("div",{className:"af-pipeline-market-chips",children:ie.length>0?ie.map(Ce=>a.jsx("span",{className:"af-pipeline-market-chip",children:Ce},`out-${J}-${Ce}`)):a.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noOutputs")})})]})]})]}),a.jsxs("div",{className:"af-pipeline-market-actions",children:[a.jsx("button",{type:"button",className:"af-btn-secondary af-pipeline-market-action",onClick:()=>Yi(K),children:e("flow:settings.previewNode")}),a.jsx("button",{type:"button",className:ee?"af-btn-secondary af-pipeline-market-action":"af-btn-primary af-pipeline-market-action",disabled:B||ve,onClick:()=>{ee&&pe?(u0(pe),En(null)):HA(K)},children:e(ve?"flow:settings.installingNode":ee?"flow:settings.addInstalledNode":"flow:settings.installNode")})]})]},J)})}):a.jsx("div",{className:"af-pipeline-settings-empty",children:e("flow:settings.marketplaceEmpty")})]}),a.jsxs("section",{id:"pipeline-schedule",className:"af-pipeline-settings-section",children:[a.jsxs("div",{className:"af-pipeline-settings-section-head",children:[a.jsx("span",{className:"af-pipeline-settings-section-index",children:"4."}),a.jsx("h2",{children:e("flow:schedule.title")})]}),Dd?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-pipeline-settings-schedule-grid",children:[a.jsxs("label",{className:"af-new-pipeline-radio af-pipeline-settings-checkbox",children:[a.jsx("input",{type:"checkbox",checked:!!Jt.enabled,disabled:x,onChange:K=>lo(J=>({...J,enabled:K.target.checked}))}),a.jsx("span",{children:e("flow:schedule.enabled")})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.cron")}),a.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:Jt.cron||"",disabled:x,onChange:K=>lo(J=>({...J,cron:K.target.value})),placeholder:"0 9 * * *",spellCheck:!1})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.timezone")}),a.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:Jt.timezone||"",disabled:x,onChange:K=>lo(J=>({...J,timezone:K.target.value})),placeholder:"Asia/Shanghai",spellCheck:!1})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.preset")}),a.jsxs("select",{className:"af-pipeline-flow-select",value:Jt.preset||"",disabled:x,onChange:K=>lo(J=>({...J,preset:K.target.value})),children:[a.jsx("option",{value:"",children:e("flow:schedule.defaultPreset")}),Object.keys(at).map(K=>a.jsx("option",{value:K,children:K},K))]})]})]}),a.jsxs("div",{className:"af-pipeline-settings-schedule-status",children:[a.jsx("span",{className:`af-pipeline-settings-status-dot af-pipeline-settings-status-dot--${L}`}),a.jsx("span",{children:Jt.nextRunAt?e("flow:schedule.nextRun",{time:new Date(Jt.nextRunAt).toLocaleString()}):e("flow:schedule.noNextRun")}),a.jsxs("span",{children:[e("flow:schedule.runtime"),":",N]})]}),a.jsxs("dl",{className:"af-pipeline-meta-dl af-pipeline-settings-dl",children:[kt.lastTriggeredAt?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),a.jsx("dd",{children:new Date(kt.lastTriggeredAt).toLocaleString()})]}):null,kt.lastSkippedAt?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),a.jsxs("dd",{children:[new Date(kt.lastSkippedAt).toLocaleString(),kt.lastSkipReason?` · ${kt.lastSkipReason}`:""]})]}):null,kt.lastRunUuid?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastRun")}),a.jsx("dd",{children:kt.lastRunUuid})]}):null,kt.lastExitCode!=null?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastExit")}),a.jsx("dd",{children:String(kt.lastExitCode)})]}):null,kt.lastFinishedAt?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),a.jsx("dd",{children:new Date(kt.lastFinishedAt).toLocaleString()})]}):null]}),Vt!=null&&Vt.lastError||kt.lastError?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(Vt==null?void 0:Vt.lastError)||kt.lastError}):null,u.archived||u.source==="builtin"?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,ln?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:ln}):null,Wa?a.jsx("p",{className:"af-pipeline-drawer-muted",children:Wa}):null]})]}),a.jsxs("section",{id:"pipeline-metadata",className:"af-pipeline-settings-section",children:[a.jsxs("div",{className:"af-pipeline-settings-section-head",children:[a.jsx("span",{className:"af-pipeline-settings-section-index",children:"5."}),a.jsx("h2",{children:e("flow:pipeline.metadata")})]}),a.jsxs("dl",{className:"af-pipeline-meta-dl af-pipeline-settings-dl",children:[a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:pipeline.nodeCount")}),a.jsxs("dd",{children:[wt.length," ",e("flow:pipeline.nodesUnit")]})]}),a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:settings.marketplaceNodes")}),a.jsx("dd",{children:tf.length})]}),a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:settings.source")}),a.jsx("dd",{children:cl(u.source??"user",e)})]})]})]})]}),a.jsxs("aside",{className:"af-pipeline-settings-side","aria-label":e("flow:settings.overview"),children:[a.jsxs("section",{className:"af-pipeline-settings-side-card",children:[a.jsxs("div",{className:"af-pipeline-settings-overview-head",children:[a.jsx("span",{className:"af-pipeline-settings-overview-icon material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),a.jsxs("div",{children:[a.jsx("h2",{children:u.id}),a.jsx("span",{className:`af-pipeline-settings-status af-pipeline-settings-status--${L}`,children:N})]})]}),a.jsxs("dl",{className:"af-pipeline-settings-side-dl",children:[a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:pipeline.nodeCount")}),a.jsx("dd",{children:wt.length})]}),a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:settings.owner")}),a.jsx("dd",{children:u.owner||"bigo"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:settings.source")}),a.jsx("dd",{children:cl(u.source??"user",e)})]})]})]}),a.jsxs("section",{className:"af-pipeline-settings-side-card",children:[a.jsx("h2",{children:e("flow:settings.quickActions")}),a.jsxs("button",{type:"button",className:"af-btn-primary af-pipeline-settings-side-action",onClick:()=>void sT(),disabled:qr,children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"save"}),e(qr?"flow:settings.savingChanges":"flow:settings.saveChanges")]}),a.jsxs("button",{type:"button",className:"af-btn-secondary af-pipeline-settings-side-action",onClick:Oc,children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"arrow_back"}),e("flow:settings.backToCanvas")]})]}),a.jsxs("section",{className:"af-pipeline-settings-side-card",children:[a.jsx("h2",{children:e("flow:settings.help")}),a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.helpText")}),a.jsx("button",{type:"button",className:"af-pipeline-drawer-link",onClick:()=>n("/settings"),children:e("flow:settings.globalSettings")})]})]})]})},NT=()=>{const x=jr;if(!x)return null;const N=x.definitionId||`marketplace:${x.id}${x.version?`@${x.version}`:""}`,L=x.displayName||x.label||x.id,D=Xf(x.inputs||x.input),B=Xf(x.outputs||x.output);return Tr.createPortal(a.jsx("div",{className:"af-market-preview-overlay",role:"dialog","aria-modal":"true","aria-label":e("flow:settings.nodePreviewTitle"),onMouseDown:K=>{K.target===K.currentTarget&&Yi(null)},children:a.jsxs("div",{className:"af-market-preview-dialog",children:[a.jsxs("div",{className:"af-market-preview-head",children:[a.jsxs("div",{children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:settings.nodePreviewTitle")}),a.jsx("h2",{children:L})]}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Yi(null),"aria-label":e("flow:settings.closePreview"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("div",{className:"af-market-preview-body",children:[a.jsx("section",{className:"af-market-preview-visual","aria-label":e("flow:settings.nodeStylePreview"),children:a.jsxs("div",{className:"af-market-preview-node",children:[a.jsx("div",{className:"af-market-preview-node-ports af-market-preview-node-ports--left",children:(D.length>0?D:[""]).slice(0,4).map((K,J)=>a.jsx("span",{title:K},`preview-in-${J}`))}),a.jsxs("div",{className:"af-market-preview-node-main",children:[a.jsx("span",{className:"af-market-preview-node-icon material-symbols-outlined","aria-hidden":!0,children:"extension"}),a.jsx("strong",{children:L}),a.jsx("span",{children:N})]}),a.jsx("div",{className:"af-market-preview-node-ports af-market-preview-node-ports--right",children:(B.length>0?B:[""]).slice(0,4).map((K,J)=>a.jsx("span",{title:K},`preview-out-${J}`))})]})}),a.jsxs("section",{className:"af-market-preview-section",children:[a.jsx("h3",{children:e("flow:settings.nodeFunction")}),a.jsx("p",{children:x.description||e("flow:settings.marketplaceNoDescription")})]}),a.jsxs("div",{className:"af-market-preview-io-grid",children:[a.jsxs("section",{className:"af-market-preview-section",children:[a.jsx("h3",{children:"Inputs"}),a.jsx("div",{className:"af-pipeline-market-chips af-market-preview-chips",children:D.length>0?D.map(K=>a.jsx("span",{className:"af-pipeline-market-chip",children:K},`preview-input-${K}`)):a.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noInputs")})})]}),a.jsxs("section",{className:"af-market-preview-section",children:[a.jsx("h3",{children:"Outputs"}),a.jsx("div",{className:"af-pipeline-market-chips af-market-preview-chips",children:B.length>0?B.map(K=>a.jsx("span",{className:"af-pipeline-market-chip",children:K},`preview-output-${K}`)):a.jsx("span",{className:"af-pipeline-market-chip af-pipeline-market-chip--muted",children:e("flow:settings.noOutputs")})})]})]}),a.jsxs("section",{className:"af-market-preview-section",children:[a.jsx("h3",{children:e("flow:settings.nodePackageInfo")}),a.jsxs("dl",{className:"af-market-preview-dl",children:[a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:settings.definitionId")}),a.jsx("dd",{children:N})]}),a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:settings.version")}),a.jsx("dd",{children:x.version||"-"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:settings.packagePath")}),a.jsx("dd",{children:x.packageDir||"-"})]}),a.jsxs("div",{children:[a.jsx("dt",{children:e("flow:settings.packagedFiles")}),a.jsx("dd",{children:Array.isArray(x.packagedFiles)&&x.packagedFiles.length>0?x.packagedFiles.map(K=>K.to||K).join(", "):"-"})]})]})]})]})]})}),document.body)};return a.jsxs(iv,{children:[a.jsx(YV,{onReady:s}),a.jsxs(LI.Provider,{value:{modelLists:je,onModelChange:oT},children:[a.jsxs("div",{className:"af-pipeline-page"+(Ne!=="edit"?" af-pipeline-page--run-mode":""),children:[a.jsxs("header",{className:"af-pipeline-top",children:[a.jsxs("div",{className:"af-pipeline-top-left",children:[a.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-back",onClick:()=>{Ne==="running"?ff(!0):Ne!=="edit"?da():n("/projects")},"aria-label":e(Ne!=="edit"?"flow:topbar.backToEdit":"flow:topbar.backToProjects"),title:e(Ne!=="edit"?"flow:topbar.backToEdit":"flow:topbar.backToProjects"),children:a.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),a.jsxs("div",{className:"af-pipeline-brand",children:[a.jsx("span",{className:"af-pipeline-brand-name",children:"PIPELINE"}),a.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",PV,"-STABLE"]})]}),a.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[a.jsx("button",{type:"button",className:"af-view-switch__active",children:"Pipeline"}),a.jsx("button",{type:"button",onClick:()=>n(Dw(u,"workspace")),children:"Workspace"})]})]}),a.jsxs("div",{className:"af-pipeline-top-right af-flow-toolbar-actions",children:[U&&a.jsx("button",{type:"button",className:"af-icon-btn"+(_e?" af-icon-btn--active":""),"aria-label":"Composer Logs (dev)",title:"Composer Logs (dev)",onClick:()=>ze(x=>!x),children:a.jsx("span",{className:"material-symbols-outlined",children:"description"})}),Ne==="running"&&a.jsxs("div",{className:"af-run-timer",children:[a.jsx("span",{className:"af-run-timer__dot"}),a.jsx("span",{className:"af-run-timer__label",children:"RUNTIME"}),a.jsx("span",{className:"af-run-timer__value",children:zg(Xt,"running")})]}),Ne==="stopped"&&a.jsxs("div",{className:"af-run-timer af-run-timer--stopped",children:[a.jsx("span",{className:"af-run-timer__label",children:"PAUSED"}),a.jsx("span",{className:"af-run-timer__value",children:zg(Xt,"stopped")})]}),(Ne==="done"||Ne==="error")&&a.jsxs("div",{className:"af-run-timer"+(Ne==="error"?" af-run-timer--error":" af-run-timer--done"),children:[a.jsx("span",{className:"af-run-timer__label",children:Ne==="error"?"FAILED":"COMPLETED"}),a.jsx("span",{className:"af-run-timer__value",children:zg(Xt,Ne)})]}),Ne!=="edit"&&a.jsx("button",{type:"button",className:"af-icon-btn"+(gr?" af-icon-btn--active":""),"aria-label":e("flow:topbar.executionLog"),title:e("flow:topbar.executionLog"),onClick:()=>Kr(x=>!x),children:a.jsx("span",{className:"material-symbols-outlined",children:"terminal"})}),Ne==="edit"&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"af-icon-btn"+(bt==="history"?" af-icon-btn--active":""),"aria-label":e("flow:topbar.history"),title:e("flow:topbar.history"),disabled:!u,onClick:vT,children:a.jsx("span",{className:"material-symbols-outlined",children:"history"})}),a.jsx("button",{type:"button",className:"af-icon-btn"+(bt==="settings"?" af-icon-btn--active":""),onClick:bT,"aria-label":e("flow:topbar.pipelineSettings"),title:e("flow:topbar.pipelineSettings"),disabled:!u,children:a.jsx("span",{className:"material-symbols-outlined",children:"settings"})}),a.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(bt==="composer"?" af-composer-topbar-btn--active":"")+(un?" af-composer-topbar-btn--running":""),onClick:kT,"aria-label":"AI Composer",title:"AI Composer",disabled:!u,children:"AI"}),a.jsx("button",{type:"button",className:"af-icon-btn af-shortcuts-trigger"+(be?" af-icon-btn--active":""),onClick:b0,"aria-label":e("flow:topbar.shortcutsLabel"),title:e("flow:topbar.shortcutsTitle"),disabled:!u,children:a.jsx("span",{className:"af-shortcuts-trigger__mark","aria-hidden":!0,children:"?"})}),a.jsx("button",{type:"button",className:"af-icon-btn af-icon-btn--danger","aria-label":e("flow:topbar.deletePipeline"),title:e("flow:topbar.deletePipeline"),disabled:!u||u.source==="builtin"||u.source!=="user"&&u.source!=="workspace",onClick:()=>T(!0),children:a.jsx("span",{className:"material-symbols-outlined",children:"delete_forever"})}),a.jsx("button",{type:"button",className:"af-btn-pipeline-archive",disabled:!u||u.source==="builtin"||u.archived||u.source!=="user"&&u.source!=="workspace",onClick:()=>Y(!0),children:"Archive"})]}),Ne==="running"?a.jsxs("button",{type:"button",className:"af-btn-run-stop",onClick:fT,title:e("flow:run.pauseRun"),children:[a.jsx("span",{className:"material-symbols-outlined",children:"pause"}),"Pause"]}):Ne==="ready"?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void os(),title:e("flow:topbar.startRun"),children:e("flow:topbar.startRun")}),a.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:da,children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):Ne==="stopped"?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void os({runUuid:nt}),title:nt?e("flow:topbar.resumeTitle",{uuid:nt}):e("flow:topbar.resumeTitleNoUuid"),children:"Resume"}),a.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:da,children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):Ne==="done"||Ne==="error"?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",disabled:!u,onClick:()=>void os(),title:e("flow:topbar.rerunTitle"),children:"Run"}),a.jsxs("button",{type:"button",className:"af-btn-pipeline-save",onClick:da,children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit"}),"Edit"]})]}):a.jsxs("div",{className:"af-run-btn-group",children:[a.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg af-run-btn-main",disabled:!u,onClick:()=>void os(),children:"Run"}),a.jsx("button",{type:"button",className:"af-run-btn-dropdown",disabled:!u,onClick:()=>Ni(x=>!x),"aria-label":e("flow:topbar.runOptions"),"aria-expanded":Si,children:a.jsx("span",{className:"material-symbols-outlined",children:"arrow_drop_down"})}),Si&&u&&a.jsxs("div",{className:"af-run-dropdown-menu",children:[a.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var N,L,D,B,K;Ni(!1);const x={};for(const J of Pi){const ee=el[J.id];ee&&(x[ee]=((N=hn[ee])==null?void 0:N.value)??((L=hn[ee])==null?void 0:L.path)??((K=(B=(D=J.data)==null?void 0:D.outputs)==null?void 0:B[0])==null?void 0:K.default)??"")}Ps(x),Es(!0)},children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit_note"}),e("flow:topbar.runWithParams")]}),a.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{Ni(!1),os({prepareOnly:!0})},children:[a.jsx("span",{className:"material-symbols-outlined",children:"tune"}),e("flow:topbar.editRun")]}),a.jsx("div",{className:"af-run-dropdown-divider"}),a.jsxs("div",{className:"af-run-dropdown-section",children:[a.jsx("span",{className:"af-run-dropdown-section-label",children:e("flow:topbar.runWithPreset")}),a.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{Ni(!1),os()},children:[a.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:runPreset.default")]}),Object.keys(at).map(x=>a.jsxs("button",{type:"button",className:"af-run-dropdown-item",onClick:()=>{var D;Ni(!1);const N=at[x]||{},L={};for(const B of Pi){const K=el[B.id];if(!K)continue;const J=((D=B.data)==null?void 0:D.definitionId)||"",ee=N[B.id]??"";J.startsWith("provide_file")?L[K]={type:"file",path:ee}:L[K]={type:"str",value:ee}}os({cliInputsOverride:L})},children:[a.jsx("span",{className:"material-symbols-outlined",children:"bookmark"}),x]},x))]})]})]})]})]}),Ve?a.jsxs("div",{className:"af-flow-snippet-toast",role:"status","aria-live":"polite",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"check_circle"}),a.jsx("span",{children:Ve}),a.jsx("button",{type:"button",onClick:()=>Xe(""),"aria-label":"关闭发布提示",children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,a.jsxs("div",{className:"af-pipeline-body"+(Ne!=="edit"?" af-pipeline-body--run-mode":""),children:[Ne==="edit"&&bt!=="settings"?a.jsxs("aside",{className:"af-node-palette af-flow-left-panel",id:"af-node-palette","aria-label":e("flow:palette2.nodePalette"),children:[a.jsxs("div",{className:`af-palette-workspace${Vn?" af-palette-workspace--expanded":""}`,children:[a.jsxs("button",{type:"button",className:"af-palette-workspace-head",onClick:()=>Xi(x=>!x),"aria-expanded":Vn,children:[a.jsx("span",{className:"af-palette-workspace-icon material-symbols-outlined","aria-hidden":!0,children:"folder_open"}),a.jsx("span",{className:"af-palette-workspace-label",children:e("flow:palette.workspace")}),a.jsx("span",{className:"af-palette-workspace-chevron material-symbols-outlined","aria-hidden":!0,children:Vn?"expand_less":"expand_more"})]}),a.jsx("div",{className:"af-palette-workspace-path",title:u&&(u.path||qe.path)||"",children:u?u.id:e("flow:palette2.noPipelineSelected")}),Vn&&a.jsx("div",{className:"af-palette-workspace-tree",children:At?a.jsx("div",{className:"af-palette-workspace-loading",children:e("flow:palette.loading")}):qe.error?a.jsx("div",{className:"af-palette-workspace-empty",children:qe.error}):u?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-palette-workspace-group",children:[a.jsxs("div",{className:"af-palette-workspace-group-head",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder"}),a.jsx("span",{children:u.id}),a.jsxs("span",{className:"af-palette-workspace-count",children:["(",qe.files.length,")"]})]}),qe.files.length>0?a.jsx("ul",{className:"af-palette-workspace-list",children:qe.files.filter(x=>x.type==="file").map(x=>a.jsxs("li",{className:"af-palette-workspace-item af-palette-workspace-item--clickable",title:x.path,onClick:()=>G({filePath:x.path,fileName:x.name}),children:[a.jsx("span",{className:"material-symbols-outlined af-palette-workspace-item-icon","aria-hidden":!0,children:x.icon}),a.jsx("span",{className:"af-palette-workspace-item-label",children:x.name}),x.size!=null&&a.jsx("span",{className:"af-palette-workspace-item-size",children:x.size<1024?`${x.size}B`:x.size<1024*1024?`${(x.size/1024).toFixed(1)}KB`:`${(x.size/1024/1024).toFixed(1)}MB`})]},x.path))}):qe.files.filter(x=>x.type==="directory").length===0?a.jsx("div",{className:"af-palette-workspace-empty",children:"暂无文件"}):null]}),qe.files.filter(x=>{var N;return x.type==="directory"&&((N=x.children)==null?void 0:N.length)>0}).map(x=>a.jsxs("div",{className:"af-palette-workspace-group af-palette-workspace-group--sub",children:[a.jsxs("div",{className:"af-palette-workspace-group-head",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:x.icon}),a.jsxs("span",{children:[x.name,"/"]}),a.jsxs("span",{className:"af-palette-workspace-count",children:["(",x.children.length,")"]})]}),a.jsx("ul",{className:"af-palette-workspace-list",children:x.children.map(N=>a.jsxs("li",{className:`af-palette-workspace-item${N.type==="file"?" af-palette-workspace-item--clickable":""}`,title:N.path,onClick:N.type==="file"?()=>G({filePath:N.path,fileName:N.name}):void 0,children:[a.jsx("span",{className:"material-symbols-outlined af-palette-workspace-item-icon","aria-hidden":!0,children:N.icon}),a.jsx("span",{className:"af-palette-workspace-item-label",children:N.name}),N.type==="file"&&N.size!=null&&a.jsx("span",{className:"af-palette-workspace-item-size",children:N.size<1024?`${N.size}B`:N.size<1024*1024?`${(N.size/1024).toFixed(1)}KB`:`${(N.size/1024/1024).toFixed(1)}MB`})]},N.path))})]},x.path))]}):a.jsx("div",{className:"af-palette-workspace-empty",children:e("flow:palette2.noPipelineSelected")})})]}),a.jsxs("div",{className:"af-node-palette-head",children:[a.jsxs("h2",{className:"af-node-palette-title",children:[a.jsx("span",{children:"Palette"}),a.jsx("span",{className:"af-node-palette-title-kbd","aria-label":"快捷键 A",children:"A"})]}),a.jsxs("label",{className:"af-palette-search-wrap",children:[a.jsx("span",{className:"af-visually-hidden",children:fe==="flows"?"搜索流程片段":e("flow:palette.searchNodes")}),a.jsx("span",{className:"af-palette-search-icon material-symbols-outlined","aria-hidden":!0,children:"search"}),a.jsx("input",{ref:Se,type:"search",className:"af-palette-search-input",value:se,onChange:x=>re(x.target.value),placeholder:(fe==="flows"?"搜索流程片段":e("flow:palette.searchNodes"))+"…","aria-label":fe==="flows"?"搜索流程片段":e("flow:palette.searchNodes")})]}),a.jsxs("div",{className:"af-palette-tabs",role:"tablist","aria-label":"Palette 类型",children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":fe==="nodes",className:"af-palette-tab"+(fe==="nodes"?" af-palette-tab--active":""),onClick:()=>ye("nodes"),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),a.jsxs("button",{type:"button",role:"tab","aria-selected":fe==="flows",className:"af-palette-tab"+(fe==="flows"?" af-palette-tab--active":""),onClick:()=>ye("flows"),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),"流程"]})]})]}),c?a.jsx("p",{className:"af-err af-palette-list-err",children:c}):null,a.jsx("div",{className:"af-node-palette-scroll",children:fe==="flows"?a.jsxs(a.Fragment,{children:[a.jsx("section",{className:"af-palette-section af-flow-palette-section--snippets",children:a.jsxs("div",{className:"af-flow-snippet-actions",children:[a.jsxs("button",{type:"button",className:"af-flow-snippet-publish-btn",onClick:xT,disabled:!u||Wn.length<2,title:Wn.length<2?"选择至少两个节点后发布流程片段":"发布选中的流程片段",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"ios_share"}),"发布选中片段"]}),a.jsxs("span",{className:"af-flow-snippet-selection",children:["已选 ",Wn.length," 节点 / ",pf.length," 连线"]})]})}),It?a.jsx("p",{className:"af-err af-palette-list-err",children:It}):null,Ke?a.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段…"}):m0.length>0?a.jsxs("section",{className:"af-palette-section af-flow-palette-section--snippets",children:[a.jsx("h3",{className:"af-palette-cat",children:"FLOW SNIPPETS"}),a.jsx("div",{className:"af-palette-cards",children:m0.map(x=>{const N=`${x.id}@${x.version}`,L=x.displayName||x.name||x.id,D=x.description||`${x.nodeCount||0} 个节点,${x.edgeCount||0} 条连线`;return a.jsxs("button",{type:"button",className:"af-palette-card af-flow-snippet-card",onClick:()=>y0(x),draggable:!!u,onDragStart:B=>{B.dataTransfer.setData("application/agentflow-snippet",N),B.dataTransfer.effectAllowed="move"},disabled:!u,title:D,children:[a.jsxs("span",{className:"af-palette-card-head",children:[a.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:a.jsx("span",{className:"material-symbols-outlined",children:"account_tree"})}),a.jsxs("span",{className:"af-palette-card-main",children:[a.jsx("span",{className:"af-palette-card-label",children:L}),a.jsxs("span",{className:"af-palette-card-id",children:[x.id,"@",x.version]})]})]}),D?a.jsx("span",{className:"af-palette-card-desc",children:D}):null,a.jsxs("span",{className:"af-flow-snippet-meta","aria-hidden":!0,children:[a.jsxs("span",{children:[x.nodeCount||0," nodes"]}),a.jsxs("span",{children:[x.edgeCount||0," edges"]})]})]},N)})})]}):a.jsx("p",{className:"af-palette-empty",children:se.trim()?"无匹配流程片段":"暂无流程片段。选择多个节点后发布。"})]}):a.jsxs(a.Fragment,{children:[fu.filter(x=>ef[x].length>0).map(x=>a.jsxs("section",{className:`af-palette-section af-flow-palette-section--${x}`,children:[a.jsx("h3",{className:"af-palette-cat",children:x}),a.jsx("div",{className:"af-palette-cards",children:ef[x].map(N=>{const L=gN(N.inputs,"input"),D=gN(N.outputs,"output"),K=N.id==="control_load_skills"?"从当前 Skills collection 或上游上下文自动注入 Skills,通常无需手填参数。":MI(N),J=OI(N);return a.jsxs("button",{type:"button",className:"af-palette-card",onClick:()=>u0(N),draggable:!!u,onDragStart:ee=>{ee.dataTransfer.setData("application/agentflow-node",N.id),ee.dataTransfer.effectAllowed="move"},disabled:!u,title:K||N.id,children:[a.jsxs("span",{className:"af-palette-card-head",children:[a.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:a.jsx("span",{className:"material-symbols-outlined",children:LV(x)})}),a.jsxs("span",{className:"af-palette-card-main",children:[a.jsx("span",{className:"af-palette-card-label",children:J}),J!==N.id?a.jsx("span",{className:"af-palette-card-id",children:N.id}):null]})]}),K?a.jsx("span",{className:"af-palette-card-desc",children:K}):null,a.jsxs("span",{className:"af-palette-card-ports","aria-hidden":!0,children:[a.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--in",children:[a.jsxs("span",{className:"af-palette-card-port-count",children:[L.list.length," IN"]}),a.jsxs("span",{className:"af-palette-card-port-list",children:[L.shown.map((ee,pe)=>a.jsxs("span",{className:"af-palette-card-port",title:mN("input",ee,pe),children:[a.jsx("span",{className:"af-palette-card-port-dot",style:{background:vn(ee==null?void 0:ee.type)}}),a.jsx("span",{className:"af-palette-card-port-name",children:Bg(ee,pe)})]},`in-${pe}`)),L.hidden>0?a.jsxs("span",{className:"af-palette-card-port-more",children:["+",L.hidden]}):null]})]}),a.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--out",children:[a.jsxs("span",{className:"af-palette-card-port-count",children:[D.list.length," OUT"]}),a.jsxs("span",{className:"af-palette-card-port-list",children:[D.shown.map((ee,pe)=>a.jsxs("span",{className:"af-palette-card-port",title:mN("output",ee,pe),children:[a.jsx("span",{className:"af-palette-card-port-name",children:Bg(ee,pe)}),a.jsx("span",{className:"af-palette-card-port-dot",style:{background:vn(ee==null?void 0:ee.type)}})]},`out-${pe}`)),D.hidden>0?a.jsxs("span",{className:"af-palette-card-port-more",children:["+",D.hidden]}):null]})]})]})]},N.id)})})]},x)),u&&de.length===0?a.jsx("p",{className:"af-palette-empty",children:e("flow:palette.noComponents")}):null,u&&de.length>0&&se.trim()&&BA===0?a.jsx("p",{className:"af-palette-empty",children:e("flow:palette.noMatch")}):null,u?null:a.jsx("p",{className:"af-palette-empty",children:e("flow:palette.selectPipeline")})]})}),a.jsxs("footer",{className:"af-palette-engine",children:[a.jsxs("div",{className:"af-palette-engine-head",children:[a.jsx("span",{className:"af-palette-engine-dot"+(De?"":" af-palette-engine-dot--offline"),"aria-hidden":!0}),a.jsx("span",{className:"af-palette-engine-label",children:e(De?"common:engine.online":"common:engine.offline")})]}),v?a.jsx("div",{className:"af-palette-tip"+VA,role:"status","aria-live":"polite",children:v}):null]})]}):Ne!=="edit"&&u?a.jsx(kV,{flowId:u.id,flowSource:u.source||"user",flowArchived:u.archived,provideNodes:Pi,edges:en,nodes:wt,onCliInputsChange:Cs,onBackToEdit:da}):null,a.jsxs("div",{className:"af-pipeline-main-stack",children:[a.jsxs("div",{className:"af-pipeline-canvas-col",children:[S?a.jsx("div",{className:"af-banner af-banner--err af-pipeline-banner",children:S}):null,u&&is.length>0&&!Q?a.jsxs("div",{className:"af-banner af-banner--warn af-flow-slot-warnings",role:"region","aria-label":e("flow:validation.flowWarningAriaLabel"),children:[a.jsxs("div",{className:"af-flow-slot-warnings-head",children:[a.jsx("div",{className:"af-flow-slot-warnings-title",children:e("flow:palette.validationWarnings")}),a.jsxs("div",{className:"af-flow-slot-warnings-head-actions",children:[a.jsx("button",{type:"button",className:"af-icon-btn",disabled:te,"aria-label":e("flow:validation.reloadFromServer"),title:e("flow:validation.reloadFromServerShort"),onClick:()=>void c0(),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"refresh"})}),a.jsx("button",{type:"button",className:"af-icon-btn","aria-label":e("flow:validation.closeBanner"),title:e("common:common.close"),onClick:()=>M(!0),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]})]}),a.jsx("ul",{className:"af-flow-slot-warnings-list",children:is.map(x=>a.jsxs("li",{children:[e("flow:validation.nodePrefix"),' "',a.jsx("a",{href:"#",className:"af-flow-slot-warning-node-link","aria-label":e("flow:validation.focusNodeAriaLabel",{nodeId:x.nodeId}),onClick:N=>{N.preventDefault(),eT(x.nodeId)},children:x.nodeId}),'"',x.suffix]},x.key))})]}):null,u&&is.length>0&&Q?a.jsxs("div",{className:"af-banner af-banner--warn af-flow-slot-warnings af-flow-slot-warnings--collapsed",role:"status","aria-live":"polite",children:[a.jsx("span",{className:"af-flow-slot-warnings-collapsed-text",children:e("flow:validation.slotWarningCount",{count:is.length})}),a.jsxs("button",{type:"button",className:"af-flow-slot-warnings-kbd-hint",onClick:b0,title:e("flow:validation.shortcutHint"),children:[a.jsx("kbd",{children:"?"})," ",e("flow:validation.shortcutHintLabel")]}),a.jsxs("div",{className:"af-flow-slot-warnings-collapsed-actions",children:[a.jsx("button",{type:"button",className:"af-flow-slot-warnings-collapsed-btn",onClick:()=>M(!1),children:e("flow:validation.show")}),a.jsx("button",{type:"button",className:"af-flow-slot-warnings-collapsed-btn",disabled:te,onClick:()=>void c0(),children:e("common:common.refresh")})]})]}):null,bt==="settings"&&u&&Ne==="edit"?ST():a.jsx("div",{className:"af-react-flow-wrap af-pipeline-flow",children:u?a.jsxs(a.Fragment,{children:[a.jsx(tW,{fitViewEpoch:f,canvasTool:ae,nodes:$A,edges:FA,onNodesChange:Ne!=="edit"?void 0:OA,onEdgesChange:Ne!=="edit"?void 0:MA,onConnect:Ne!=="edit"?void 0:GA,onConnectStart:Ne!=="edit"?void 0:XA,onConnectEnd:Ne!=="edit"?void 0:JA,isValidConnection:Ne!=="edit"?void 0:YA,onNodesDelete:Ne!=="edit"?void 0:QA,onNodeClick:WA,onNodeDoubleClick:KA,onEdgeClick:qA,onFlowInit:ZA,onDrop:iT,onDragOver:rT,hideMinimapAndControls:!!(u&&bt),bottomSlot:Ne==="edit"?a.jsx("div",{className:"af-bottom-composer-stack af-flow-bottom-composer",children:a.jsxs("div",{className:"af-pipeline-composer-inner",children:[a.jsx("div",{className:"af-composer-selected","aria-label":e("flow:composer.selectedNodesAriaLabel"),children:hf.length===0?a.jsx("span",{className:"af-composer-selected-empty",children:e("flow:composer.selectedNodesEmpty")}):hf.map((x,N)=>{var pe,ve;if(x.kind==="definition"){const Ie=x.definition,ie=String(Ie.label??Ie.id),Ce=[Ie.id,Ie.description?String(Ie.description).slice(0,120):""].filter(Boolean).join(" — ");return a.jsxs("div",{className:"af-composer-node-chip af-composer-node-chip--definition",title:Ce,children:[a.jsx("span",{className:"af-composer-node-chip-label",children:ie}),a.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>v0(x),"aria-label":e("flow:composer.removeFromInput",{id:Ie.id}),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},`def-${Ie.id}`)}const L=x.node,D=x.kind,B=String(((pe=L.data)==null?void 0:pe.label)??L.id),K=(ve=L.data)!=null&&ve.definitionId?String(L.data.definitionId):"",J=K&&K!==B?`${B} · ${L.id} · ${K}`:`${B} · ${L.id}`,ee=D==="canvas"?e("flow:composer.deselectNode",{id:L.id}):e("flow:composer.removeFromInput",{id:L.id});return a.jsxs("div",{className:"af-composer-node-chip"+(D==="mention"?" af-composer-node-chip--mention":""),title:J,children:[a.jsx("span",{className:"af-composer-node-chip-label",children:B}),a.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>v0(x),"aria-label":ee,children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},L.id)})}),a.jsxs("div",{className:"af-composer-card af-composer-card--input-only",children:[a.jsxs("div",{className:"af-composer-input-wrap",children:[a.jsx("textarea",{ref:Zt,className:"af-composer-textarea",placeholder:e("flow:composer.inputPlaceholder"),disabled:!u,value:xr,rows:2,onChange:x=>{_(x.target.value),X(x.target.selectionStart??x.target.value.length)},onSelect:x=>{const N=x.target;N instanceof HTMLTextAreaElement&&X(N.selectionStart??0)},onKeyDown:x=>{if((x.metaKey||x.ctrlKey)&&x.key==="Enter"){x.preventDefault(),fa();return}if(Rc&&Ii.length>0&&(x.key==="ArrowDown"||x.key==="ArrowUp"||x.key==="Enter")){if(x.key==="ArrowDown")x.preventDefault(),ne(N=>(N+1)%Ii.length);else if(x.key==="ArrowUp")x.preventDefault(),ne(N=>(N-1+Ii.length)%Ii.length);else if(x.key==="Enter"){x.preventDefault();const N=Ii[Z];N&&Mm(N.id)}}},onKeyUp:x=>{const N=x.target;N instanceof HTMLTextAreaElement&&X(N.selectionStart??N.value.length)},onClick:x=>{const N=x.target;N instanceof HTMLTextAreaElement&&X(N.selectionStart??0)},"aria-label":e("flow:composer.inputAriaLabel"),autoComplete:"off",spellCheck:!1}),Rc&&u&&Ii.length>0?a.jsxs("ul",{className:"af-composer-mention-menu",role:"listbox","aria-label":e("flow:composer.mentionAriaLabel"),children:[Lc.instances.length>0?a.jsx("li",{className:"af-composer-mention-section",role:"presentation",children:a.jsx("div",{className:"af-composer-mention-section-title",children:"Instances"})}):null,Lc.instances.map((x,N)=>{const L=N;return a.jsx("li",{role:"option","aria-selected":L===Z,children:a.jsxs("button",{type:"button",className:"af-composer-mention-item"+(L===Z?" af-composer-mention-item--active":""),onMouseDown:D=>D.preventDefault(),onMouseEnter:()=>ne(L),onClick:()=>Mm(x.id),children:[a.jsx("span",{className:"af-composer-mention-id",children:x.title}),x.subtitle?a.jsx("span",{className:"af-composer-mention-sub",children:x.subtitle}):null]})},`i-${x.id}`)}),Lc.definitions.length>0?a.jsx("li",{className:"af-composer-mention-section",role:"presentation",children:a.jsx("div",{className:"af-composer-mention-section-title",children:"Node"})}):null,Lc.definitions.map((x,N)=>{const L=Lc.instances.length+N;return a.jsx("li",{role:"option","aria-selected":L===Z,children:a.jsxs("button",{type:"button",className:"af-composer-mention-item"+(L===Z?" af-composer-mention-item--active":""),onMouseDown:D=>D.preventDefault(),onMouseEnter:()=>ne(L),onClick:()=>Mm(x.id),children:[a.jsx("span",{className:"af-composer-mention-id",children:x.title}),x.subtitle?a.jsx("span",{className:"af-composer-mention-sub",children:x.subtitle}):null]})},`d-${x.id}`)})]}):null]}),a.jsxs("div",{className:"af-composer-toolbar",children:[_i.length>0&&a.jsx("label",{className:"af-composer-session-field",children:a.jsxs("select",{className:"af-composer-session-select",value:ir||"",onChange:x=>{x.target.value==="__new__"?Qv():r0(x.target.value)},disabled:un,"aria-label":e("flow:composer.switchConversation"),children:[_i.map(x=>a.jsxs("option",{value:x.id,children:[x.label,x.running?" ⏳":""]},x.id)),a.jsxs("option",{value:"__new__",children:["+ ",e("flow:composer.newConversation")]})]})}),a.jsxs("div",{className:"af-composer-skills-field",children:[a.jsxs("button",{ref:wm,type:"button",className:"af-composer-skills-button"+(Om>0?" af-composer-skills-button--active":""),disabled:!u||un,"aria-haspopup":"listbox","aria-expanded":Vd,onClick:()=>xm(x=>!x),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),a.jsx("span",{children:Om>0?`Skills ${Om}`:"Skills"})]}),Vd&&!un?Tr.createPortal(a.jsx("div",{ref:Vv,className:"af-composer-skills-menu",role:"listbox","aria-label":"Composer skills",style:TA,children:Ts.length===0?a.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):a.jsxs(a.Fragment,{children:[mf.groups.map(x=>{const N=Bo(x,Ts),L=XC(x,Lm,Ts),D=IA.has(x.id);return a.jsxs("div",{className:"af-composer-skill-group af-composer-skill-group--framed"+(D?" af-composer-skill-group--collapsed":""),children:[a.jsxs("div",{className:"af-composer-skill-group-title af-composer-skill-group-title--selectable",children:[a.jsxs("label",{className:"af-composer-skill-group-check",children:[a.jsx("input",{type:"checkbox",checked:L==="all",disabled:N.length===0,onChange:B=>{const K=B.target.checked;Nc(J=>K?YC(J,N):GC(J,N))}}),a.jsxs("span",{className:"af-composer-skill-group-title-main",children:[a.jsx("span",{children:x.name}),x.builtin?a.jsx("em",{children:"built-in"}):null,L==="partial"?a.jsx("em",{children:"partial"}):null]})]}),a.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":D?`展开 ${x.name}`:`收起 ${x.name}`,onClick:()=>{AA(B=>{const K=new Set(B);return K.has(x.id)?K.delete(x.id):K.add(x.id),K})},children:[a.jsx("span",{children:x.skills.length}),a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:D?"expand_more":"expand_less"})]})]}),D?null:a.jsx("div",{className:"af-composer-skill-group-items",children:x.skills.map(B=>a.jsxs("label",{className:"af-composer-skill-option",children:[a.jsx("input",{type:"checkbox",checked:Lm.has(B.key),onChange:K=>{const J=K.target.checked;Nc(ee=>J?ee.includes(B.key)?ee:[...ee,B.key]:ee.filter(pe=>pe!==B.key))}}),a.jsxs("span",{className:"af-composer-skill-option-main",children:[a.jsx("span",{className:"af-composer-skill-option-title",children:B.name}),B.description?a.jsx("span",{className:"af-composer-skill-option-desc",children:B.description}):null]})]},`${x.id}:${B.key}`))})]},x.id)}),mf.ungrouped.length>0?a.jsxs("div",{className:"af-composer-skill-group",children:[a.jsxs("div",{className:"af-composer-skill-group-title",children:[a.jsx("span",{children:"Ungrouped"}),a.jsx("span",{children:mf.ungrouped.length})]}),mf.ungrouped.map(x=>a.jsxs("label",{className:"af-composer-skill-option",children:[a.jsx("input",{type:"checkbox",checked:Lm.has(x.key),onChange:N=>{const L=N.target.checked;Nc(D=>L?D.includes(x.key)?D:[...D,x.key]:D.filter(B=>B!==x.key))}}),a.jsxs("span",{className:"af-composer-skill-option-main",children:[a.jsx("span",{className:"af-composer-skill-option-title",children:x.name}),x.description?a.jsx("span",{className:"af-composer-skill-option-desc",children:x.description}):null]})]},`ungrouped:${x.key}`))]}):null]})}),document.body):null]}),a.jsxs("label",{className:"af-composer-model-field",children:[a.jsx("span",{className:"af-visually-hidden",children:e("flow:composer.modelLabel")}),a.jsxs("select",{className:"af-composer-model-select",value:(aa||"").trim()?_r.currentNotInLists?_r.currentNotInLists:Jf(aa,_r.cursorList,_r.opencodeList,_r.claudeCodeList):"",onChange:x=>Bv(x.target.value),disabled:!u||un,"aria-label":e("flow:composer.modelAriaLabel"),children:[a.jsx("option",{value:"",children:e("flow:composer.modelDefault")}),_r.currentNotInLists?a.jsxs("option",{value:_r.currentNotInLists,children:[_r.currentNotInLists,e("flow:composer.modelNotInList")]}):null,_r.cursorList.length>0?a.jsx("optgroup",{label:"Cursor",children:_r.cursorList.map(x=>a.jsx("option",{value:Fs(x),children:x},`composer-c-${x}`))}):null,_r.opencodeList.length>0?a.jsx("optgroup",{label:"OpenCode",children:_r.opencodeList.map(x=>a.jsx("option",{value:`opencode:${Fs(x)}`,children:x},`composer-o-${x}`))}):null,_r.claudeCodeList.length>0?a.jsx("optgroup",{label:"Claude Code",children:_r.claudeCodeList.map(x=>a.jsx("option",{value:`claude-code:${Fs(x)}`,children:x},`composer-cc-${x}`))}):null]})]}),a.jsx("button",{type:"button",className:"af-composer-send"+(u&&xr.trim()&&!un?" af-composer-send--active":"")+(un?" af-composer-send--stop":""),disabled:!u||!un&&!xr.trim(),"aria-label":e(un?"flow:composer.stopGeneration":"flow:composer.send"),title:un?e("flow:composer.stopGeneration"):void 0,onClick:()=>{var x;if(un){(x=Xd.current)==null||x.abort();return}fa()},children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:un?"stop":"arrow_upward"})})]})]}),bm?Tr.createPortal(a.jsx("div",{className:"af-node-props-expand-overlay af-composer-thread-dialog-overlay",role:"dialog","aria-modal":"true","aria-label":e("flow:composer.conversationOutput"),onMouseDown:x=>{x.target===x.currentTarget&&Gd(!1)},children:a.jsxs("div",{className:"af-node-props-expand-panel af-composer-thread-dialog-panel",children:[a.jsxs("div",{className:"af-node-props-expand-head af-composer-thread-dialog-head",children:[a.jsxs("div",{className:"af-composer-thread-dialog-head-main",children:[a.jsx("span",{className:"af-node-props-expand-title",children:e("flow:nodeProps.conversationOutput")}),a.jsx("div",{className:"af-composer-thread-dialog-status"+(un?" af-composer-thread-dialog-status--running":""),role:"status","aria-live":"polite",title:jc||void 0,children:un&&!jc?e("flow:composer.executing"):jc||e("flow:composer.ready")})]}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Gd(!1),"aria-label":e("flow:composer.collapseAriaLabel"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),Gv.length>1&&!(lt&&Array.isArray(lt.phases)&&lt.phases.length>1)?a.jsx("div",{className:"af-composer-steps-track-wrap",children:a.jsx(HV,{steps:Gv})}):null,lt&&Array.isArray(lt.phases)&&lt.phases.length>1?a.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:lt.phases.map((x,N)=>{const L=x.status||(N<(lt.currentPhase??0)?"done":N===(lt.currentPhase??0)?un?"running":lt.nextPhase||lt.isLastPhase?"done":"running":"pending");return a.jsxs("div",{className:"af-composer-phase-item"+(L==="done"?" af-composer-phase-item--done":"")+(L==="running"?" af-composer-phase-item--running":"")+(L==="pending"?" af-composer-phase-item--pending":""),title:`${x.label}${x.description?":"+x.description:""}`,children:[a.jsx("span",{className:"af-composer-phase-dot","aria-hidden":!0,children:L==="done"?a.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.85rem"},children:"check"}):a.jsx("span",{children:N+1})}),a.jsx("span",{className:"af-composer-phase-label",children:x.label})]},x.name||N)})}):null,a.jsx("div",{className:"af-composer-thread-dialog-scroll",children:a.jsx(wN,{thread:Ec,liveSegments:Cc,running:un})}),lt&&!lt.isLastPhase&&lt.nextPhase&&!un?a.jsxs("div",{className:"af-composer-phase-review af-composer-phase-review--minimal","aria-label":e("flow:composer.phaseReviewLabel"),children:[a.jsx("span",{className:"af-composer-phase-auto-hint",children:e("flow:composer.phaseReviewHint",{nextPhase:lt.nextPhase.label})}),a.jsxs("div",{className:"af-composer-phase-review-buttons",children:[a.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--continue",onClick:w0,children:e("flow:composer.phaseReviewContinue",{label:lt.nextPhase.label})}),a.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:x0,children:e("flow:composer.phaseReviewSkip")})]})]}):null]})}),document.body):null]})}):null}),Er&&Ne==="edit"?(()=>{var D;const x=String(Er.query||"").trim().toLowerCase(),N=x?Er.candidates.filter(B=>{var K,J,ee;return[(K=B.def)==null?void 0:K.id,B.displayLabel,B.description,(J=B.slot)==null?void 0:J.name,(ee=B.slot)==null?void 0:ee.type].filter(Boolean).some(pe=>String(pe).toLowerCase().includes(x))}):Er.candidates,L=Er.draft.handleType==="source"?"IN":"OUT";return a.jsxs("div",{className:"af-connect-node-menu",style:{left:Er.left,top:Er.top},role:"dialog","aria-label":"选择匹配节点",children:[a.jsxs("div",{className:"af-connect-node-menu__head",children:[a.jsxs("div",{className:"af-connect-node-menu__title",children:[a.jsx("span",{className:"af-connect-node-menu__dot",style:{background:vn((D=Er.draft.slot)==null?void 0:D.type)},"aria-hidden":!0}),a.jsxs("span",{children:["匹配 ",Er.draft.slotType," 节点"]})]}),a.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>ao(null),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),a.jsxs("label",{className:"af-connect-node-menu__search",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),a.jsx("input",{type:"search",value:Er.query,onChange:B=>ao(K=>K&&{...K,query:B.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),a.jsxs("div",{className:"af-connect-node-menu__list",children:[N.map(B=>{var ee,pe;const K=B.displayLabel||((ee=B.def)==null?void 0:ee.id),J=Bg(B.slot,B.slotIndex);return a.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>nT(B),title:B.description||B.def.id,children:[a.jsxs("span",{className:"af-connect-node-menu__item-main",children:[a.jsx("span",{className:"af-connect-node-menu__item-label",children:K}),K!==B.def.id?a.jsx("span",{className:"af-connect-node-menu__item-id",children:B.def.id}):null]}),a.jsxs("span",{className:"af-connect-node-menu__port",children:[a.jsx("span",{children:L}),a.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:vn((pe=B.slot)==null?void 0:pe.type)},"aria-hidden":!0}),a.jsx("span",{className:"af-connect-node-menu__port-name",children:J})]})]},`${B.def.id}-${B.slotIndex}`)}),N.length===0?a.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null]}):a.jsx("div",{className:"af-placeholder af-pipeline-placeholder",children:e("flow:pipeline.selectPipeline")})})]}),Ne!=="edit"&&gr&&a.jsxs("div",{className:"af-run-console",style:{height:dt},children:[a.jsx("div",{className:"af-run-console__resize",role:"separator","aria-orientation":"horizontal","aria-label":e("flow:run.resizeConsole"),onPointerDown:lT,onPointerMove:cT,onPointerUp:p0,onPointerCancel:p0,onLostPointerCapture:uT}),a.jsxs("div",{className:"af-run-console__head",children:[a.jsxs("span",{className:"af-run-console__title",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"terminal"}),"EXECUTION CONSOLE"]}),a.jsxs("div",{className:"af-run-console__head-right",children:[Ne==="running"&&a.jsx("span",{className:"af-run-console__live-badge",children:"LIVE"}),a.jsx("button",{type:"button",className:"af-icon-btn af-run-console__close",onClick:()=>Kr(!1),"aria-label":e("flow:run.closeLog"),children:a.jsx("span",{className:"material-symbols-outlined",children:"expand_more"})})]})]}),a.jsxs("div",{className:"af-run-console__body",children:[pr.map((x,N)=>a.jsxs("div",{className:"af-run-console__line"+(x.type==="error"?" af-run-console__line--error":"")+(x.type==="warn"?" af-run-console__line--warn":"")+(x.type==="node-start"?" af-run-console__line--start":"")+(x.type==="node-done"?" af-run-console__line--done":"")+(x.type==="node-failed"?" af-run-console__line--error":"")+(x.type==="done"?" af-run-console__line--done":""),children:[a.jsxs("span",{className:"af-run-console__ts",children:["[",x.ts?new Date(x.ts).toLocaleTimeString():"--:--:--","]"]}),a.jsx("span",{className:"af-run-console__text",children:x.text!=null?String(x.text):""})]},N)),a.jsx("div",{ref:Ya})]})]})]}),Ne!=="edit"&&bi&&u?a.jsx(xV,{instanceId:bi,flowId:u.id,runId:nt,nodeStatus:((k0=Vr[bi])==null?void 0:k0.status)??null,onClose:()=>ki(null)}):null,bt&&bt!=="settings"&&u&&Ne==="edit"?a.jsx("aside",{className:"af-pipeline-drawer"+(bt==="node"?" af-pipeline-drawer--wide":"")+(bt==="composer"?" af-pipeline-drawer--wide":""),"aria-label":bt==="settings"?e("flow:settings.title"):bt==="history"?e("flow:history.title"):bt==="composer"?"AI Composer":e("flow:nodeProps.title"),children:bt==="composer"?a.jsxs("div",{className:"af-composer-sidebar",children:[a.jsxs("div",{className:"af-pipeline-drawer-head",children:[a.jsx("h2",{className:"af-pipeline-drawer-title",children:"AI Composer"}),a.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:Oc,"aria-label":e("flow:composer.closeSidebar"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),_i.length>0&&a.jsxs("div",{className:"af-composer-session-tabs",children:[_i.map(x=>a.jsxs("button",{type:"button",ref:N=>{N&&x.id===ir&&N.scrollIntoView({block:"nearest",inline:"nearest"})},className:["af-composer-session-tab",x.id===ir?"af-composer-session-tab--active":"",x.running?"af-composer-session-tab--running":""].filter(Boolean).join(" "),onClick:()=>r0(x.id),title:x.label,children:[a.jsx("span",{className:"af-composer-session-label",children:x.label}),a.jsx("span",{className:"af-composer-session-close",role:"button",tabIndex:0,onClick:N=>{N.stopPropagation(),Zv(x.id)},onKeyDown:N=>{N.key!=="Enter"&&N.key!==" "||(N.preventDefault(),N.stopPropagation(),Zv(x.id))},title:x.running?e("flow:composer.endConversation"):e("flow:composer.closeConversation"),children:a.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.75rem"},children:"close"})})]},x.id)),a.jsx("button",{type:"button",className:"af-composer-session-add",onClick:()=>Qv(),title:e("flow:composer.newConversation"),children:a.jsx("span",{className:"material-symbols-outlined",children:"add"})})]}),a.jsx("div",{className:"af-composer-sidebar-status"+(un?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:un&&!jc?e("flow:composer.executing"):jc||e("flow:composer.ready")}),lt&&Array.isArray(lt.phases)&&lt.phases.length>1?a.jsx("div",{className:"af-composer-phase-bar","aria-label":e("flow:composer.phaseProgress"),children:lt.phases.map((x,N)=>{const L=x.status||(N<(lt.currentPhase??0)?"done":N===(lt.currentPhase??0)?un?"running":lt.isLastPhase&&N===lt.phases.length-1||lt.nextPhase?"done":"running":"pending");return a.jsxs("div",{className:"af-composer-phase-item"+(L==="done"?" af-composer-phase-item--done":"")+(L==="running"?" af-composer-phase-item--running":"")+(L==="pending"?" af-composer-phase-item--pending":""),title:`${x.label}${x.description?":"+x.description:""}`,children:[a.jsx("span",{className:"af-composer-phase-dot","aria-hidden":!0,children:L==="done"?a.jsx("span",{className:"material-symbols-outlined",style:{fontSize:"0.85rem"},children:"check"}):a.jsx("span",{children:N+1})}),a.jsx("span",{className:"af-composer-phase-label",children:x.label})]},x.name||N)})}):null,a.jsx("div",{className:"af-composer-sidebar-thread",ref:Jv,children:a.jsx(wN,{thread:Ec,liveSegments:Cc,running:un})}),lt&&!lt.isLastPhase&&lt.nextPhase&&!un?a.jsxs("div",{className:"af-composer-phase-review af-composer-phase-review--minimal","aria-label":e("flow:composer.phaseReviewLabel"),children:[a.jsx("span",{className:"af-composer-phase-auto-hint",children:e("flow:composer.phaseReviewHint",{nextPhase:lt.nextPhase.label})}),a.jsxs("div",{className:"af-composer-phase-review-buttons",children:[a.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--continue",onClick:w0,children:e("flow:composer.phaseReviewContinue",{label:lt.nextPhase.label})}),a.jsx("button",{type:"button",className:"af-composer-phase-btn af-composer-phase-btn--skip",onClick:x0,children:e("flow:composer.phaseReviewSkip")})]})]}):null]}):bt==="node"&&it?Ee?a.jsx(II,{draft:Ee,setDraft:Ze,definitionId:String(((S0=it.data)==null?void 0:S0.definitionId)??it.id),systemPromptReadonly:String((Cm==null?void 0:Cm.description)??""),modelLists:je,disabled:!u,onIdBlur:aT,onClose:Oc,onPublishToMarketplace:UA,error:Fe,ioSlots:{inputs:Array.isArray(Ee==null?void 0:Ee.inputs)?Ee.inputs:[],outputs:Array.isArray(Ee==null?void 0:Ee.outputs)?Ee.outputs:[]}}):a.jsx("div",{className:"af-pipeline-drawer-body",children:a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:pipeline.loadingProps")})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-pipeline-drawer-head",children:[a.jsx("h2",{className:"af-pipeline-drawer-title",children:e(bt==="settings"?"flow:settings.title":"flow:history.title")}),a.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:Oc,"aria-label":e("flow:composer.closeSidebar"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-pipeline-drawer-body",children:bt==="settings"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.pipelineId")}),(u.source==="user"||u.source==="workspace")&&!u.archived?a.jsxs("div",{className:"af-pipeline-rename-row",children:[a.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:O,onChange:x=>{F(x.target.value),q("")},onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),cf())},onBlur:()=>{O.trim()&&O.trim()!==u.id&&cf()},placeholder:u.id,disabled:W,spellCheck:!1}),a.jsx("span",{className:"af-pipeline-drawer-badge",children:cl(u.source??"user",e)})]}):a.jsxs("div",{className:"af-pipeline-drawer-readonly",children:[u.id,a.jsx("span",{className:"af-pipeline-drawer-badge",children:cl(u.source??"user",e)}),u.archived?a.jsx("span",{className:"af-pipeline-drawer-badge af-pipeline-drawer-badge--muted",children:e("flow:settings.archived")}):null]}),I?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:I}):null]}),typeof u.path=="string"&&u.path?a.jsxs("div",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.diskPath")}),a.jsxs("div",{className:"af-pipeline-drawer-readonly af-pipeline-drawer-readonly--mono af-pipeline-path-row",children:[a.jsx("span",{className:"af-pipeline-path-text",children:u.path}),a.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-copy-btn",onClick:()=>d0(u.path),title:e("flow:settings.copyPath"),children:a.jsx("span",{className:"material-symbols-outlined",children:$?"check":"content_copy"})})]})]}):null,u.source==="user"||u.source==="workspace"?u.archived?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.archivedNote")}):a.jsxs("div",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.storageLocation")}),a.jsx("div",{className:"af-pipeline-move-actions",children:u.source==="user"?a.jsx("button",{type:"button",className:"af-btn-secondary",disabled:j,onClick:()=>lf("workspace"),children:e(j?"flow:settings.moveBusy":"flow:settings.moveToWorkspace")}):a.jsx("button",{type:"button",className:"af-btn-secondary",disabled:j,onClick:()=>lf("user"),children:e(j?"flow:settings.moveBusy":"flow:settings.moveToUserDir")})}),k?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:k}):null]}):a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:settings.builtinNote")}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:pipeline.introduction")}),a.jsx("textarea",{className:"af-pipeline-drawer-textarea",value:y,onChange:x=>b(x.target.value),placeholder:e("flow:pipeline.introductionPlaceholder"),rows:5,spellCheck:!1})]}),a.jsxs("div",{className:"af-pipeline-meta-card",children:[a.jsx("h3",{className:"af-pipeline-meta-title",children:e("flow:schedule.title")}),Dd?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):a.jsxs(a.Fragment,{children:[a.jsxs("label",{className:"af-new-pipeline-radio",children:[a.jsx("input",{type:"checkbox",checked:!!Jt.enabled,disabled:qr||u.archived||u.source==="builtin",onChange:x=>lo(N=>({...N,enabled:x.target.checked}))}),a.jsx("span",{children:e("flow:schedule.enabled")})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.cron")}),a.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:Jt.cron||"",disabled:qr||u.archived||u.source==="builtin",onChange:x=>lo(N=>({...N,cron:x.target.value})),placeholder:"0 9 * * *",spellCheck:!1})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.timezone")}),a.jsx("input",{type:"text",className:"af-pipeline-rename-input",value:Jt.timezone||"",disabled:qr||u.archived||u.source==="builtin",onChange:x=>lo(N=>({...N,timezone:x.target.value})),placeholder:"Asia/Shanghai",spellCheck:!1})]}),a.jsxs("label",{className:"af-pipeline-drawer-field",children:[a.jsx("span",{className:"af-pipeline-drawer-label",children:e("flow:schedule.preset")}),a.jsxs("select",{className:"af-pipeline-flow-select",value:Jt.preset||"",disabled:qr||u.archived||u.source==="builtin",onChange:x=>lo(N=>({...N,preset:x.target.value})),children:[a.jsx("option",{value:"",children:e("flow:schedule.defaultPreset")}),Object.keys(at).map(x=>a.jsx("option",{value:x,children:x},x))]})]}),a.jsx("div",{className:"af-pipeline-drawer-readonly",children:a.jsx("span",{children:e("flow:schedule.overlapSkip")})}),Jt.nextRunAt?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.nextRun",{time:new Date(Jt.nextRunAt).toLocaleString()})}):a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.noNextRun")}),a.jsxs("dl",{className:"af-pipeline-meta-dl",children:[a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.runtime")}),a.jsx("dd",{children:Vt!=null&&Vt.running?e("flow:schedule.running"):Jt.enabled?e("flow:schedule.waiting"):e("flow:schedule.disabled")})]}),kt.lastTriggeredAt?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastTriggeredAt")}),a.jsx("dd",{children:new Date(kt.lastTriggeredAt).toLocaleString()})]}):null,kt.lastSkippedAt?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastSkippedAt")}),a.jsxs("dd",{children:[new Date(kt.lastSkippedAt).toLocaleString(),kt.lastSkipReason?` · ${kt.lastSkipReason}`:""]})]}):null,kt.lastRunUuid?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastRun")}),a.jsx("dd",{children:kt.lastRunUuid})]}):null,kt.lastExitCode!=null?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastExit")}),a.jsx("dd",{children:String(kt.lastExitCode)})]}):null,kt.lastFinishedAt?a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:schedule.lastFinishedAt")}),a.jsx("dd",{children:new Date(kt.lastFinishedAt).toLocaleString()})]}):null]}),Vt!=null&&Vt.lastError||kt.lastError?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:(Vt==null?void 0:Vt.lastError)||kt.lastError}):null,u.archived||u.source==="builtin"?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:schedule.readonlyNote")}):null,ln?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:ln}):null,Wa?a.jsx("p",{className:"af-pipeline-drawer-muted",children:Wa}):null,a.jsx("button",{type:"button",className:"af-btn-secondary",disabled:qr||u.archived||u.source==="builtin",onClick:Pm,children:e(qr?"flow:schedule.saving":"flow:schedule.save")})]})]}),a.jsxs("div",{className:"af-pipeline-meta-card",children:[a.jsx("h3",{className:"af-pipeline-meta-title",children:e("flow:pipeline.metadata")}),a.jsx("dl",{className:"af-pipeline-meta-dl",children:a.jsxs("div",{className:"af-pipeline-meta-row",children:[a.jsx("dt",{children:e("flow:pipeline.nodeCount")}),a.jsxs("dd",{children:[wt.length," ",e("flow:pipeline.nodesUnit")]})]})})]}),a.jsx("button",{type:"button",className:"af-pipeline-drawer-link",onClick:()=>n("/settings"),children:e("flow:settings.globalSettings")})]}):a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"af-pipeline-drawer-lead",children:[e("flow:settings.currentPipeline"),a.jsx("strong",{children:u.id})]}),er?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("common:common.loading")}):fr?a.jsx("p",{className:"af-err af-pipeline-drawer-err",children:fr}):Tc.length===0?a.jsx("p",{className:"af-pipeline-drawer-muted",children:e("flow:pipeline.noRuns")}):a.jsxs(a.Fragment,{children:[wr.success+wr.failed+wr.running+wr.stopped+wr.interrupted>0?a.jsxs("div",{className:"af-exec-history-summary","aria-label":e("flow:history.summary"),children:[wr.success>0?a.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--success",children:e("flow:history.successCount",{count:wr.success})}):null,wr.failed>0?a.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--failed",children:e("flow:history.failedCount",{count:wr.failed})}):null,wr.stopped>0?a.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--stopped",children:e("flow:history.stoppedCount",{count:wr.stopped})}):null,wr.interrupted>0?a.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--interrupted",children:e("flow:history.interruptedCount",{count:wr.interrupted})}):null,wr.running>0?a.jsx("span",{className:"af-exec-history-pill af-exec-history-pill--running",children:e("flow:history.runningCount",{count:wr.running})}):null]}):null,a.jsx("ul",{className:"af-exec-history-list",children:Tc.map((x,N)=>{const L=x.status||"unknown",D=L==="success"?"af-exec-history-card--success":L==="failed"?"af-exec-history-card--failed":L==="stopped"?"af-exec-history-card--stopped":L==="interrupted"?"af-exec-history-card--interrupted":L==="running"?"af-exec-history-card--running":"af-exec-history-card--unknown",B=e(L==="success"?"flow:history.success":L==="failed"?"flow:history.failed":L==="stopped"?"flow:history.stopped":L==="interrupted"?"flow:history.interrupted":L==="running"?"flow:history.running":"flow:history.unknown"),K=L==="success"?"check_circle":L==="failed"?"error":L==="stopped"?"stop_circle":L==="interrupted"?"sync_disabled":L==="running"?"progress_activity":"help",J=x.runId||`${x.at}-${N}`,ee=x.runId!=null&&x.runId.length>=6?e("flow:history.runLabel",{id:x.runId.length>8?x.runId.slice(-8):x.runId}):e("flow:history.runLabel",{id:Tc.length-N});return a.jsx("li",{className:"af-exec-history-list-item",children:a.jsxs("button",{type:"button",className:`af-exec-history-card ${D}`,onClick:()=>yT(x),title:e("flow:history.enterRunView"),children:[a.jsxs("div",{className:"af-exec-history-card-top",children:[a.jsx("span",{className:"af-exec-history-card-title",children:ee}),a.jsx("span",{className:"af-exec-history-card-time",children:Qy(x.at,e)})]}),a.jsxs("div",{className:"af-exec-history-card-bottom",children:[a.jsxs("span",{className:"af-exec-history-card-status",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:K}),B]}),a.jsxs("span",{className:"af-exec-history-card-duration",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"timer"}),jL(x.durationMs,e)]})]})]})},`${u.id}-${J}`)})})]})]})})]})}):null]}),a.jsx(ZS,{open:dT,title:e("flow:run.pauseTitle",{defaultValue:"暂停运行"}),message:e("flow:run.pauseConfirm"),confirmLabel:e("flow:run.pauseConfirmOk",{defaultValue:"暂停"}),onConfirm:pT,onCancel:()=>Tm(!1)}),a.jsx(ZS,{open:hT,title:e("flow:run.backPromptTitle",{defaultValue:"返回项目列表"}),message:e("flow:run.backPromptMessage",{defaultValue:"流水线仍在运行,请选择处理方式:后台继续运行并退出,或停止后返回编辑。"}),confirmLabel:e("flow:run.backBackground",{defaultValue:"后台运行并退出"}),secondaryLabel:e("flow:run.backStopEdit",{defaultValue:"停止并进入编辑"}),secondaryDestructive:!0,onConfirm:gT,onSecondary:mT,onCancel:()=>ff(!1)}),a.jsx(jI,{open:be,onClose:()=>Pe(!1)}),NT(),a.jsx(rV,{open:Ye,onClose:()=>nr(!1),onJump:tT,nodes:wt}),a.jsx(_V,{open:_e,onClose:()=>ze(!1),flowId:(u==null?void 0:u.id)??""}),a.jsx(ZU,{open:z,onClose:()=>Y(!1),flowId:(u==null?void 0:u.id)??"",flowSource:(u==null?void 0:u.source)??"user",onArchived:async()=>{Y(!1),await nf(),n("/projects?tab=archived")}}),a.jsx(eV,{open:A&&!!(u!=null&&u.id),onClose:()=>T(!1),flowId:(u==null?void 0:u.id)??"",flowSource:(u==null?void 0:u.source)??"user",flowArchived:!!(u!=null&&u.archived),onDeleted:async()=>{T(!1),p(null),ft([]),Wt([]),Pc(null),await nf(),n("/projects")}}),sn&&Tr.createPortal(a.jsx("div",{className:"af-flow-snippet-modal-overlay",children:a.jsxs("div",{className:"af-flow-snippet-modal",role:"dialog","aria-modal":"true","aria-label":"发布流程片段",children:[a.jsxs("div",{className:"af-flow-snippet-modal__head",children:[a.jsxs("span",{className:"af-flow-snippet-modal__title",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"ios_share"}),"发布流程片段"]}),a.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>Nn(!1),"aria-label":e("common:common.close"),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),a.jsxs("div",{className:"af-flow-snippet-modal__body",children:[a.jsxs("label",{className:"af-flow-snippet-field",children:[a.jsx("span",{children:"名称"}),a.jsx("input",{type:"text",value:xn.name,onChange:x=>{const N=x.target.value;On(L=>({...L,name:N,id:L.id?L.id:N.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")}))},placeholder:"例如:PR 检查片段",autoFocus:!0})]}),a.jsxs("label",{className:"af-flow-snippet-field",children:[a.jsx("span",{children:"ID"}),a.jsx("input",{type:"text",value:xn.id,onChange:x=>On(N=>({...N,id:x.target.value})),placeholder:"pr-check-snippet"})]}),a.jsxs("label",{className:"af-flow-snippet-field",children:[a.jsx("span",{children:"说明"}),a.jsx("textarea",{value:xn.description,onChange:x=>On(N=>({...N,description:x.target.value})),placeholder:"这段流程适合什么场景、需要接哪些上下游。",rows:4})]}),a.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",Wn.length," 个节点和 ",pf.length," 条内部连线。"]}),oe?a.jsx("div",{className:"af-flow-snippet-error",children:oe}):null]}),a.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[a.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>Nn(!1),children:"取消"}),a.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:Ur||!xn.name.trim(),onClick:()=>void wT(),children:Ur?"发布中…":"发布"})]})]})}),document.body),a.jsx(iV,{open:!!C,onClose:()=>G(null),flowId:(u==null?void 0:u.id)??"",flowSource:(u==null?void 0:u.source)??"user",flowArchived:!!(u!=null&&u.archived),filePath:(C==null?void 0:C.filePath)??"",fileName:(C==null?void 0:C.fileName)??"",onSaved:()=>{jt(x=>({...x}))}})]}),Qt&&Ne!=="edit"&&Tr.createPortal(a.jsx("div",{className:"af-user-check-modal-overlay",children:a.jsxs("div",{className:"af-user-check-modal",role:"dialog","aria-modal":"true",children:[a.jsxs("div",{className:"af-user-check-modal__head",children:[a.jsxs("span",{className:"af-user-check-modal__title",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"fact_check"}),e("flow:userCheck.title",{instanceId:Qt.instanceId})]}),a.jsx("div",{className:"af-user-check-modal__actions",children:Bd?a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--save",onClick:async()=>{if(!Qt||!u||!nt)return;const x=yr||Qt.content;try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",action:"save-user-check-content",runUuid:nt,instanceId:Qt.instanceId,content:x})})).ok?(As(L=>L&&{...L,content:x}),ta(!1),ot(L=>[...L,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.contentSaved")}])):ot(L=>[...L,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{ot(N=>[...N,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}},children:[a.jsx("span",{className:"material-symbols-outlined",children:"save"}),e("flow:userCheck.save")]}),a.jsxs("button",{type:"button",className:"af-user-check-modal__btn",onClick:()=>{Ga(Qt.content),ta(!1)},children:[a.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:userCheck.cancel")]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",className:"af-user-check-modal__btn",onClick:()=>ta(!0),children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit"}),e("flow:userCheck.edit")]}),a.jsx("button",{type:"button",className:"af-user-check-modal__btn",onClick:()=>As(null),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]})})]}),a.jsx("div",{className:"af-user-check-modal__body",children:Bd?a.jsx("textarea",{ref:gm,className:"af-user-check-modal__textarea",value:yr||Qt.content,onChange:x=>Ga(x.target.value)}):a.jsx("div",{className:"af-user-check-modal__preview",children:a.jsx("pre",{children:yr||Qt.content})})}),a.jsxs("div",{className:"af-user-check-modal__ai-bar",children:[a.jsx("input",{type:"text",className:"af-user-check-modal__ai-input",placeholder:e("flow:userCheck.aiEditPlaceholder"),value:Xa,onChange:x=>Ja(x.target.value),disabled:Qa}),a.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--ai",disabled:Qa||!Xa.trim(),onClick:()=>{!Qt||!u||!nt||!Xa.trim()||(na(!0),ot(x=>[...x,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.aiEditStarted")}]),fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",action:"ai-edit-user-check-content",runUuid:nt,instanceId:Qt.instanceId,content:yr||Qt.content,prompt:Xa})}).then(x=>x.json()).then(x=>{na(!1),x.ok&&x.content?(Ga(x.content),ta(!0),Ja(""),ot(N=>[...N,{ts:new Date().toISOString(),type:"info",text:e("flow:userCheck.aiEditDone")}])):ot(N=>[...N,{ts:new Date().toISOString(),type:"error",text:x.error||e("flow:userCheck.aiEditFailed")}])}).catch(()=>{na(!1),ot(x=>[...x,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.aiEditFailed")}])}))},children:[Qa?a.jsx("span",{className:"material-symbols-outlined af-spin",children:"sync"}):a.jsx("span",{className:"material-symbols-outlined",children:"auto_fix_high"}),e("flow:userCheck.aiEditBtn")]})]}),a.jsxs("div",{className:"af-user-check-modal__foot",children:[a.jsx("span",{className:"af-user-check-modal__hint",children:e("flow:userCheck.hint")}),a.jsxs("button",{type:"button",className:"af-user-check-modal__btn af-user-check-modal__btn--continue",onClick:async()=>{if(!Qt||!u||!nt)return;const x=yr||Qt.content;try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",action:"save-user-check-content",runUuid:nt,instanceId:Qt.instanceId,content:x})})).ok?(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",action:"confirm-user-check",runUuid:nt,instanceId:Qt.instanceId,execId:Qt.execId})}),As(null),Ja(""),os({runUuid:nt})):ot(L=>[...L,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}catch{ot(N=>[...N,{ts:new Date().toISOString(),type:"error",text:e("flow:userCheck.saveFailed")}])}},children:[a.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:userCheck.continue")]})]})]})}),document.body),Ci&&Ne!=="edit"&&Tr.createPortal(a.jsx("div",{className:"af-user-ask-modal-overlay",children:a.jsxs("div",{className:"af-user-ask-modal",role:"dialog","aria-modal":"true",children:[a.jsxs("div",{className:"af-user-ask-modal__head",children:[a.jsxs("span",{className:"af-user-ask-modal__title",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"help"}),e("flow:userAsk.title",{instanceId:Ci.instanceId})]}),a.jsx("div",{className:"af-user-ask-modal__actions",children:a.jsx("button",{type:"button",className:"af-user-ask-modal__btn",onClick:()=>bc(null),"aria-label":e("flow:userAsk.close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})})]}),a.jsxs("div",{className:"af-user-ask-modal__body",children:[Ci.question.trim()?a.jsx("div",{className:"af-user-ask-modal__question",children:a.jsx("pre",{children:Ci.question})}):null,Ci.options.length===0?a.jsx("div",{className:"af-user-ask-modal__empty",children:e("flow:userAsk.noOptions")}):a.jsx("div",{className:"af-user-ask-modal__options",children:Ci.options.map(x=>a.jsxs("button",{type:"button",className:"af-user-ask-option",disabled:ra,onClick:async()=>{if(!(!Ci||!u||!nt)){ia(!0);try{(await fetch("/api/flow",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flowId:u.id,flowSource:u.source??"user",action:"confirm-user-ask",runUuid:nt,instanceId:Ci.instanceId,execId:Ci.execId,branch:x.name,selectedIndex:x.index,selectedLabel:x.label})})).ok?(bc(null),ia(!1),os({runUuid:nt})):(ia(!1),ot(L=>[...L,{ts:new Date().toISOString(),type:"error",text:e("flow:userAsk.submitFailed")}]))}catch{ia(!1),ot(N=>[...N,{ts:new Date().toISOString(),type:"error",text:e("flow:userAsk.submitFailed")}])}}},children:[a.jsxs("span",{className:"af-user-ask-option__index",children:["[",x.index,"]"]}),a.jsx("span",{className:"af-user-ask-option__label",children:x.label})]},x.name))})]}),a.jsx("div",{className:"af-user-ask-modal__foot",children:a.jsx("span",{className:"af-user-ask-modal__hint",children:e(ra?"flow:userAsk.submitting":"flow:userAsk.hint")})})]})}),document.body),kc&&Ne!=="edit"&&a.jsxs("div",{className:"af-tool-print-toast"+(sa?" af-tool-print-toast--expanded":""),role:"status","aria-live":"polite",children:[a.jsxs("div",{className:"af-tool-print-toast__head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"print"}),a.jsx("span",{className:"af-tool-print-toast__title",children:e("flow:toolPrint.title",{instanceId:kc.instanceId})}),a.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>Sc(x=>!x),"aria-label":e(sa?"flow:toolPrint.restore":"flow:toolPrint.expand"),title:e(sa?"flow:toolPrint.restore":"flow:toolPrint.expand"),children:a.jsx("span",{className:"material-symbols-outlined",children:sa?"close_fullscreen":"open_in_full"})}),a.jsx("button",{type:"button",className:"af-tool-print-toast__close",onClick:()=>Hd(null),"aria-label":e("common:close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-tool-print-toast__body",children:a.jsx("div",{className:"af-tool-print-toast__markdown",children:a.jsx(Td,{children:kc.content})})})]}),no&&a.jsx("div",{className:"af-provide-edit-overlay",children:a.jsxs("div",{className:"af-provide-edit-modal",role:"dialog","aria-modal":"true",children:[a.jsxs("div",{className:"af-provide-edit-modal__head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit_document"}),a.jsx("span",{className:"af-provide-edit-modal__title",children:no.label}),a.jsx("button",{type:"button",className:"af-provide-edit-modal__close",onClick:()=>oa(null),"aria-label":e("common:close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-provide-edit-modal__body",children:a.jsx("textarea",{ref:Za,className:"af-provide-edit-modal__textarea",defaultValue:no.content,autoFocus:!0})}),a.jsxs("div",{className:"af-provide-edit-modal__foot",children:[a.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn af-provide-edit-modal__btn--save",onClick:DA,children:[a.jsx("span",{className:"material-symbols-outlined",children:"save"}),e("flow:provideEdit.save")]}),a.jsxs("button",{type:"button",className:"af-provide-edit-modal__btn",onClick:()=>oa(null),children:[a.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:provideEdit.cancel")]})]})]})}),Ua&&a.jsx("div",{className:"af-run-params-overlay",children:a.jsxs("div",{className:"af-run-params-modal",role:"dialog","aria-modal":"true",children:[a.jsxs("div",{className:"af-run-params-modal__head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"edit_note"}),a.jsx("span",{className:"af-run-params-modal__title",children:e("flow:runParams.title")}),a.jsx("button",{type:"button",className:"af-run-params-modal__close",onClick:()=>Es(!1),"aria-label":e("common:close"),children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-run-params-modal__body",children:Pi.length===0?a.jsx("div",{className:"af-run-params-empty",children:e("flow:runParams.noParams")}):a.jsx("div",{className:"af-run-params-list",children:Pi.map(x=>{var pe,ve;const N=el[x.id];if(!N)return null;const L=((pe=x.data)==null?void 0:pe.definitionId)||"",D=L.startsWith("provide_file"),B=L==="provide_bool",K=((ve=x.data)==null?void 0:ve.label)||x.id,J=_s[N]??"",ee=["true","1","yes","on"].includes(String(J).trim().toLowerCase());return a.jsxs("div",{className:"af-run-params-item",children:[a.jsxs("div",{className:"af-run-params-item__head",children:[a.jsx("span",{className:"af-run-params-item__icon material-symbols-outlined"+(D?" af-run-params-item__icon--file":""),children:D?"description":B?"toggle_on":"text_fields"}),a.jsx("span",{className:"af-run-params-item__label",children:K}),a.jsx("span",{className:"af-run-params-item__slot",children:N})]}),B?a.jsx("button",{type:"button",className:"af-run-config-bool-toggle"+(ee?" af-run-config-bool-toggle--true":""),onClick:()=>Ps(Ie=>({...Ie,[N]:ee?"false":"true"})),"aria-pressed":ee,children:ee?"true":"false"}):a.jsx("input",{type:"text",className:"af-run-params-item__input",value:J,onChange:Ie=>Ps(ie=>({...ie,[N]:Ie.target.value})),placeholder:e(D?"flow:runConfig.filePathPlaceholder":"flow:runConfig.stringValuePlaceholder")})]},x.id)})})}),a.jsxs("div",{className:"af-run-params-modal__foot",children:[a.jsxs("button",{type:"button",className:"af-run-params-modal__btn af-run-params-modal__btn--run",onClick:()=>{var N;const x={};for(const L of Pi){const D=el[L.id];if(!D)continue;const B=((N=L.data)==null?void 0:N.definitionId)||"",K=_s[D]??"";B.startsWith("provide_file")?x[D]={type:"file",path:K}:x[D]={type:"str",value:K}}Es(!1),Ni(!1),os({cliInputsOverride:x})},children:[a.jsx("span",{className:"material-symbols-outlined",children:"play_arrow"}),e("flow:runParams.run")]}),a.jsxs("button",{type:"button",className:"af-run-params-modal__btn",onClick:()=>Es(!1),children:[a.jsx("span",{className:"material-symbols-outlined",children:"close"}),e("flow:runParams.cancel")]})]})]})})]})]})}const sW="af:workspace-graph:v2",pl=["DISPLAY","CONTROL","TOOL","PROVIDE","AGENT"],oW=new Set(["control_start","control_end","control_load_skills"]),aW={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:""}]},lW={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:""}],outputs:[{type:"node",name:"next",default:""},{type:"text",name:"skillsContext",default:""}]},cW="0.1.33";function uW(){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 Zf(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 dW(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:workspace-composer:${t}:${n}${e!=null&&e.archived?":archived":""}`}function fW(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 pW(e){return!e||typeof e.closest!="function"?!1:!!e.closest("input, textarea, select, [contenteditable='true']")}function jN(e){return(Array.isArray(e)?e:[]).filter(t=>t&&(t.role==="user"||t.role==="assistant")&&typeof t.text=="string").map(t=>({role:t.role,text:t.text,...t.error?{error:!0}:{},...typeof t.at=="number"?{at:t.at}:{}})).slice(-80)}function DI(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 pu(e){const t=String((e==null?void 0:e.id)||"");return t==="workspace_run"?"CONTROL":t.startsWith("display_")?"DISPLAY":/^control/i.test(t)?"CONTROL":/^tool/i.test(t)?"TOOL":/^provide/i.test(t)?"PROVIDE":"AGENT"}function CN(e){return e==="DISPLAY"?"preview":e==="CONTROL"?"account_tree":e==="TOOL"?"build":e==="PROVIDE"?"database":"smart_toy"}function _v(e){return String((e==null?void 0:e.displayName)||(e==null?void 0:e.label)||(e==null?void 0:e.id)||"Node")}function hu(e){return _v(e)}function Mx(e){return String((e==null?void 0:e.description)||(e==null?void 0:e.body)||"").replace(/\s+/g," ").trim()}function Vg(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 EN(e,t,n){const r=String((t==null?void 0:t.name)||(t==null?void 0:t.id)||`#${n+1}`).trim(),i=String((t==null?void 0:t.type)||"").trim(),s=String((t==null?void 0:t.default)??(t==null?void 0:t.value)??"").trim();return[e,r,i?`type: ${i}`:"",s?`default: ${s}`:""].filter(Boolean).join(" · ")}function _N(e,t){const n=Array.isArray(e)?e:[],r=n.slice(0,4),i=Math.max(0,n.length-r.length);return{list:n,shown:r,hidden:i,kind:t}}function PN(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 i=new Map(t.map(l=>[l.id,l])),s=lc(i.get(n),e.sourceHandle||"output-0","source"),o=lc(i.get(r),e.targetHandle||"input-0","target");return!!(s&&o&&ac(s,o))}function hW(e,t){const n=String((e==null?void 0:e.nodeId)||""),r=String((e==null?void 0:e.handleId)||""),i=(e==null?void 0:e.handleType)==="target"?"target":(e==null?void 0:e.handleType)==="source"?"source":"";if(!n||!r||!i)return null;const s=t.find(l=>l.id===n),o=lc(s,r,i);return o?{nodeId:n,handleId:r,handleType:i,slot:o,slotType:kI(o)}:null}function mW(e,t){return t?e.map((n,r)=>{const i=Array.isArray(t.handleType==="source"?n.inputs:n.outputs)?t.handleType==="source"?n.inputs:n.outputs:[];for(let s=0;s<i.length;s+=1){const o=i[s];if(!(t.handleType==="source"?ac(t.slot,o):ac(o,t.slot)))continue;const c=pu(n);return{def:n,order:r,category:c,categoryRank:pl.indexOf(c),slot:o,slotIndex:s,displayLabel:hu(n),description:Mx(n)}}return null}).filter(Boolean).sort((n,r)=>{var o,l;const i=(o=n.slot)!=null&&o.required?0:1,s=(l=r.slot)!=null&&l.required?0:1;return i-s||n.slotIndex-r.slotIndex||n.categoryRank-r.categoryRank||n.order-r.order}):[]}function gW(e,t=!1){if(t)return"folder";const n=String(e||"").toLowerCase().split(".").pop();return n==="md"||n==="markdown"?"article":["js","jsx","ts","tsx","mjs","cjs"].includes(n)?"code":["yaml","yml","json"].includes(n)?"data_object":"draft"}function yW(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(i=>i.id));for(let i=1;i<1e4;i++){const s=`${n}_${i}`;if(!r.has(s))return s}return`${n}_${Date.now().toString(36)}`}function xW(e){return(e==null?void 0:e.default)!=null?String(e.default):(e==null?void 0:e.value)!=null?String(e.value):""}function ep(e){return(Array.isArray(e)?e:[]).map(t=>({type:(t==null?void 0:t.type)||"node",name:(t==null?void 0:t.name)||"",default:xW(t),required:!!(t!=null&&t.required),showOnNode:(t==null?void 0:t.showOnNode)!=null?t.showOnNode!==!1:!!(t!=null&&t.required)||String((t==null?void 0:t.type)||"node").trim().toLowerCase()==="node"}))}function Wg(e,t){var u,p;const n=e!=null&&e.instances&&typeof e.instances=="object"?e.instances:{},r=Array.isArray(e==null?void 0:e.edges)?e.edges:[],i=(u=e==null?void 0:e.ui)!=null&&u.nodePositions&&typeof e.ui.nodePositions=="object"?e.ui.nodePositions:{},s=(p=e==null?void 0:e.ui)!=null&&p.nodeSizes&&typeof e.ui.nodeSizes=="object"?e.ui.nodeSizes:{},o=new Set(Object.keys(n));for(const f of r)f!=null&&f.source&&o.add(String(f.source)),f!=null&&f.target&&o.add(String(f.target));const c=Array.from(o).map(f=>{const h=n[f]||{},y=h.definitionId||f,b=t.find(w=>w.id===y),S=i[f]&&typeof i[f].x=="number"&&typeof i[f].y=="number"?i[f]:{x:320+o.size*20,y:180+o.size*12},g=s[f]&&typeof s[f].width=="number"&&typeof s[f].height=="number"?{width:s[f].width,height:s[f].height}:null,v=!!Jo(y);return{id:f,type:Rd,position:S,...v&&g?{width:g.width,height:g.height}:{},data:{label:h.label||_v(b)||f,definitionId:y,schemaType:DI(y,b),role:h.role||"normal",model:h.model||void 0,body:h.body||"",script:h.script||"",...v&&g?{displaySize:g}:{}}}}).map(f=>fd(f,n,t)),d=r.filter(f=>(f==null?void 0:f.source)&&(f==null?void 0:f.target)).map((f,h)=>({id:f.id||`we-${f.source}-${f.target}-${h}`,source:String(f.source),target:String(f.target),sourceHandle:f.sourceHandle??void 0,targetHandle:f.targetHandle??void 0,markerEnd:{type:zr.ArrowClosed}}));return{nodes:c,edges:bI(d,c),instances:n}}function Kg(e,t,n){var l,c,d,u,p,f,h,y,b;const r=cm(e,n||{}),i=t.map(S=>({source:S.source,target:S.target,sourceHandle:S.sourceHandle??null,targetHandle:S.targetHandle??null})),s={},o={};for(const S of e)if(s[S.id]={x:((l=S.position)==null?void 0:l.x)||0,y:((c=S.position)==null?void 0:c.y)||0},Jo((d=S.data)==null?void 0:d.definitionId)){const g=Number(((p=(u=S.data)==null?void 0:u.displaySize)==null?void 0:p.width)||S.width||((f=S.measured)==null?void 0:f.width)||0),v=Number(((y=(h=S.data)==null?void 0:h.displaySize)==null?void 0:y.height)||S.height||((b=S.measured)==null?void 0:b.height)||0);g>0&&v>0&&(o[S.id]={width:g,height:v})}return{version:1,instances:r,edges:i,ui:{nodePositions:s,nodeSizes:o}}}function Jo(e){const t=String(e||"");return t==="display_markdown"?"markdown":t==="display_mermaid"?"mermaid":t==="display_ascii"?"ascii":t==="display_html"?"html":t==="display_image"?"image":""}function zI(e){const t=[...(e==null?void 0:e.inputs)||[],...(e==null?void 0:e.outputs)||[]],r=Jo(e==null?void 0:e.definitionId)==="image"?"src":"content",i=t.find(s=>(s==null?void 0:s.name)===r&&String((s==null?void 0:s.default)||"").trim())||t.find(s=>(s==null?void 0:s.name)==="filePath"&&String((s==null?void 0:s.default)||"").trim())||t.find(s=>(s==null?void 0:s.type)==="text"&&String((s==null?void 0:s.default)||"").trim());return String((e==null?void 0:e.body)||(i==null?void 0:i.default)||"")}function wW(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.default)||(e==null?void 0:e.label)||"Image preview")}function vW(e){return e==="mermaid"?"account_tree":e==="ascii"?"notes":e==="html"?"html":e==="image"?"image":"article"}function Al(e){let t=String(e||"").trim();return t.includes("|")?(t.startsWith("|")&&(t=t.slice(1)),t.endsWith("|")&&(t=t.slice(0,-1)),t.split("|").map(n=>n.trim())):[]}function bW(e){const t=Al(e);return t.length>1&&t.every(n=>/^:?-{3,}:?$/.test(n))}function kW(e){return Al(e).map(t=>t.startsWith(":")&&t.endsWith(":")?"center":t.endsWith(":")?"right":"left")}function SW(e){const t=String(e||"").replace(/\r\n/g,`
133
- `).split(`
134
- `),n=[];let r=[],i=!1;const s=()=>{r.length&&(n.push({type:"markdown",text:r.join(`
135
- `)}),r=[])};for(let o=0;o<t.length;){const l=t[o]||"";if(/^\s*```/.test(l)){i=!i,r.push(l),o++;continue}if(!i&&o+1<t.length&&Al(l).length>1&&bW(t[o+1])){s();const c=Al(l),d=kW(t[o+1]),u=[];for(o+=2;o<t.length&&t[o].trim()&&Al(t[o]).length>1;)u.push(Al(t[o])),o++;n.push({type:"table",headers:c,align:d,rows:u});continue}r.push(l),o++}return s(),n}function IN({children:e}){return a.jsx(Td,{components:{p:({children:t})=>a.jsx(a.Fragment,{children:t})},children:String(e||"")})}function NW({content:e}){const t=m.useMemo(()=>SW(e),[e]);return a.jsx(a.Fragment,{children:t.map((n,r)=>n.type!=="table"?a.jsx(Td,{children:n.text},`md-${r}`):a.jsx("div",{className:"af-work-display-table-wrap",children:a.jsxs("table",{className:"af-work-display-table",children:[a.jsx("thead",{children:a.jsx("tr",{children:n.headers.map((i,s)=>a.jsx("th",{style:{textAlign:n.align[s]||"left"},children:a.jsx(IN,{children:i})},s))})}),a.jsx("tbody",{children:n.rows.map((i,s)=>a.jsx("tr",{children:n.headers.map((o,l)=>a.jsx("td",{style:{textAlign:n.align[l]||"left"},children:a.jsx(IN,{children:i[l]||""})},l))},s))})]})},`table-${r}`))})}function jW(e){const t=String(e||"").split(/\r?\n/).map(l=>l.replace(/%%.*$/,"").trim()).filter(Boolean),n=new Map,r=[];let i="TD";const s=(l,c="")=>{const d=String(l||"").replace(/[^A-Za-z0-9_]/g,"_")||`N${n.size+1}`;return n.has(d)?c&&(n.get(d).label=c):n.set(d,{id:d,label:c||d}),d},o=l=>{const c=String(l||"").trim().replace(/[;,]+$/,""),d=c.match(/^([A-Za-z][A-Za-z0-9_]*)(?:\[(.+?)\]|\((.+?)\)|\{(.+?)\})?$/);return d?s(d[1],d[2]||d[3]||d[4]||d[1]):s(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){i=c[2].toUpperCase();continue}const d=l.match(/^(.+?)\s*-{1,2}>+\s*(.+)$/);if(d){r.push({from:o(d[1]),to:o(d[2])});continue}o(l)}return{nodes:Array.from(n.values()),edges:r,direction:i}}function CW({code:e}){const t=m.useMemo(()=>jW(e),[e]);if(!String(e||"").trim())return null;const n=t.direction==="LR"||t.direction==="RL",r=142,i=44,s=n?96:32,o=n?30:68,l=new Map;t.nodes.forEach((u,p)=>{l.set(u.id,{x:24+(n?p*(r+s):p%3*(r+s)),y:24+(n?p%3*(i+o):p*(i+o))})});const c=Math.max(360,...Array.from(l.values()).map(u=>u.x+r+24)),d=Math.max(180,...Array.from(l.values()).map(u=>u.y+i+24));return a.jsx("div",{className:"af-work-node__mermaid-preview",children:a.jsxs("svg",{viewBox:`0 0 ${c} ${d}`,role:"img","aria-label":"Mermaid preview",children:[a.jsx("defs",{children:a.jsx("marker",{id:"af-work-arrow",viewBox:"0 0 10 10",refX:"9",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:a.jsx("path",{d:"M 0 0 L 10 5 L 0 10 z"})})}),t.edges.map((u,p)=>{const f=l.get(u.from),h=l.get(u.to);if(!f||!h)return null;const y=n?`M ${f.x+r} ${f.y+i/2} C ${(f.x+h.x+r)/2} ${f.y+i/2}, ${(f.x+h.x+r)/2} ${h.y+i/2}, ${h.x} ${h.y+i/2}`:`M ${f.x+r/2} ${f.y+i} C ${f.x+r/2} ${f.y+i+28}, ${h.x+r/2} ${h.y-28}, ${h.x+r/2} ${h.y}`;return a.jsx("path",{className:"af-work-node__mermaid-edge",d:y,markerEnd:"url(#af-work-arrow)"},`${u.from}-${u.to}-${p}`)}),t.nodes.map(u=>{const p=l.get(u.id);return a.jsxs("g",{children:[a.jsx("rect",{className:"af-work-node__mermaid-box",x:p.x,y:p.y,width:r,height:i,rx:"8"}),a.jsx("text",{className:"af-work-node__mermaid-text",x:p.x+r/2,y:p.y+i/2+5,textAnchor:"middle",children:u.label.slice(0,22)})]},u.id)})]})})}function EW({data:e}){const t=Jo(e==null?void 0:e.definitionId);if(!t)return null;const n=zI(e);return n.trim()?t==="html"?a.jsx("div",{className:"af-work-display-body af-work-display-body--html",children:a.jsx("iframe",{className:"af-work-display-html-frame",title:(e==null?void 0:e.label)||"HTML preview",sandbox:"",srcDoc:n})}):t==="image"?a.jsx("div",{className:"af-work-display-body af-work-display-body--image",children:a.jsx("img",{className:"af-work-display-image",src:n,alt:wW(e),loading:"lazy"})}):t==="markdown"?a.jsx("div",{className:"af-work-display-body af-work-display-body--markdown",children:a.jsx(NW,{content:n})}):t==="mermaid"?a.jsxs("div",{className:"af-work-display-body",children:[a.jsx(CW,{code:n}),a.jsx("pre",{className:"af-work-node__diagram af-work-node__diagram--mermaid",children:n})]}):a.jsx("pre",{className:"af-work-display-body af-work-node__diagram af-work-node__diagram--ascii",children:n}):a.jsx("div",{className:"af-work-display-empty",children:"No display content"})}function _W(e){return e==="mermaid"?"mmd":e==="ascii"?"txt":e==="html"?"html":e==="image"?"txt":"md"}function PW(e){return String(e).trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)||"display"}function IW(e,t){const n=Jo(t==null?void 0:t.definitionId)||"markdown";return`outputs/${PW((t==null?void 0:t.label)||e||n)}.${_W(n)}`}function AW({id:e,data:t,selected:n,deleteNode:r}){const i=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],o=(Array.isArray(t==null?void 0:t.outputs)?t.outputs:[]).map((u,p)=>({slot:u,idx:p})).sort((u,p)=>{var S,g,v,w;const f=String(((S=u.slot)==null?void 0:S.name)||"").trim(),h=String(((g=p.slot)==null?void 0:g.name)||"").trim();if(f==="next"&&h!=="next")return-1;if(h==="next"&&f!=="next")return 1;const y=String(((v=u.slot)==null?void 0:v.type)||"").trim(),b=String(((w=p.slot)==null?void 0:w.type)||"").trim();return y==="node"&&b!=="node"?-1:b==="node"&&y!=="node"?1:u.idx-p.idx}),l=Jo(t==null?void 0:t.definitionId),c=(t==null?void 0:t.label)||(l==="mermaid"?"Mermaid":l==="ascii"?"ASCII":l==="html"?"HTML":l==="image"?"Image":"Markdown"),d=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;return a.jsxs("div",{className:"af-work-display-card"+(d?" af-work-display-card--sized":"")+(n?" af-work-display-card--selected":"")+(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:d?{width:d.width,height:d.height}:void 0,children:[a.jsx(P4,{className:"af-work-display-resize nodrag",position:"bottom-right",minWidth:320,minHeight:180,maxWidth:1200,maxHeight:1e3,children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"open_in_full"})}),i.map((u,p)=>{if(u.showOnNode===!1)return null;const f=`${4.15+p*1.75}rem`,h=u.name||`#${p+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:f},children:h}),a.jsx(wi,{type:"target",position:$e.Left,id:`input-${p}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:f,background:vn(u.type)},title:`${h} · ${u.type}`})]},`in-${p}`)}),o.map(({slot:u,idx:p},f)=>{if(u.showOnNode===!1)return null;const h=`${4.15+f*1.75}rem`,y=u.name||`#${p+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:h},children:y}),a.jsx(wi,{type:"source",position:$e.Right,id:`output-${p}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:h,background:vn(u.type)},title:`${y} · ${u.type}`})]},`out-${p}`)}),a.jsxs("div",{className:"af-work-display-card__head",children:[a.jsxs("div",{className:"af-work-display-card__title",children:[a.jsx("span",{className:"material-symbols-outlined",children:vW(l)}),a.jsx("strong",{children:c}),a.jsx("span",{children:(t==null?void 0:t.definitionId)||"display"})]}),a.jsx("button",{type:"button",className:"af-work-display-card__action nodrag",onClick:()=>{var u;return(u=t==null?void 0:t.onSaveDisplayNodeToFile)==null?void 0:u.call(t,e,t)},"aria-label":"另存为文件",title:"另存为文件",children:a.jsx("span",{className:"material-symbols-outlined",children:"save"})}),a.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx(EW,{data:t})]})}function TW({id:e,data:t,selected:n,deleteNode:r}){const i=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],s=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],o=(t==null?void 0:t.runningRunNodeId)===e;return a.jsxs("div",{className:"af-work-run-card"+(n?" af-work-run-card--selected":"")+(o?" 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":""),children:[i.map((l,c)=>{if(l.showOnNode===!1)return null;const d=`${2.25+c*1.75}rem`,u=l.name||`#${c+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:d},children:u}),a.jsx(wi,{type:"target",position:$e.Left,id:`input-${c}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:d,background:vn(l.type)},title:`${u} · ${l.type}`})]},`in-${c}`)}),s.map((l,c)=>{if(l.showOnNode===!1)return null;const d=`${2.25+c*1.75}rem`,u=l.name||`#${c+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:d},children:u}),a.jsx(wi,{type:"source",position:$e.Right,id:`output-${c}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:d,background:vn(l.type)},title:`${u} · ${l.type}`})]},`out-${c}`)}),a.jsxs("div",{className:"af-work-run-card__head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"play_circle"}),a.jsx("strong",{children:(t==null?void 0:t.label)||"Run"}),a.jsx("span",{children:(t==null?void 0:t.definitionId)||"workspace_run"}),a.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("button",{type:"button",className:"af-work-run-card__button nodrag",disabled:o,onClick:l=>{var c;l.stopPropagation(),(c=t==null?void 0:t.onRunWorkspaceNode)==null||c.call(t,e)},children:[a.jsx("span",{className:"material-symbols-outlined"+(o?" af-spin":""),children:o?"sync":"play_arrow"}),a.jsx("span",{children:o?"Running":"Run line"})]})]})}function RW(e){var o,l,c,d,u,p,f;const{setEdges:t,setNodes:n}=Ba(),r=m.useCallback(h=>{n(y=>y.filter(b=>b.id!==h)),t(y=>y.filter(b=>b.source!==h&&b.target!==h))},[t,n]),i=m.useCallback((h,y)=>{n(b=>b.map(S=>S.id===h?{...S,data:{...S.data,model:y}}:S))},[n]),s=m.useCallback((h,y)=>{n(b=>b.map(S=>{var v;if(S.id!==h)return S;const g=Array.isArray((v=S.data)==null?void 0:v.outputs)&&S.data.outputs.length?S.data.outputs.map((w,k)=>k===0?{...w,default:y,value:y}:w):[{type:"bool",name:"value",default:y,value:y}];return{...S,data:{...S.data,body:y,outputs:g}}}))},[n]);return Jo((o=e.data)==null?void 0:o.definitionId)?a.jsx(AW,{...e,deleteNode:r}):((l=e.data)==null?void 0:l.definitionId)==="workspace_run"?a.jsx(TW,{...e,deleteNode:r}):((c=e.data)==null?void 0:c.definitionId)==="control_load_skills"?a.jsx(FW,{...e,deleteNode:r,skills:(d=e.data)==null?void 0:d.skills,skillCollections:(u=e.data)==null?void 0:u.skillCollections,onChangeSkillKeys:(p=e.data)==null?void 0:p.onChangeLoadSkillKeys}):a.jsx("div",{className:"af-work-flow-node",children:a.jsx(SI,{...e,deleteNode:r,modelLists:(f=e.data)==null?void 0:f.modelLists,onModelChange:i,onProvideValueChange:s})})}const LW={[Rd]:RW};function BI(e,t=[]){for(const n of e||[])n.type==="file"&&t.push(n),Array.isArray(n.children)&&BI(n.children,t);return t}function HI(e,t=[]){for(const n of e||[])n.type==="directory"&&(t.push(n.path),Array.isArray(n.children)&&HI(n.children,t));return t}function UI({items:e,onOpen:t,collapsedDirs:n,onToggleDir:r,onCreateFile:i,onCreateFolder:s,onDelete:o,onFileDragStart:l}){return a.jsx("ul",{className:"af-work-files",children:(e||[]).map(c=>{var p;const d=c.type==="directory",u=d&&(n==null?void 0:n.has(c.path));return a.jsxs("li",{children:[a.jsxs("div",{className:"af-work-file-row",children:[a.jsxs("button",{type:"button",className:"af-work-file af-work-file--"+c.type,draggable:!d,onDragStart:f=>{d||l==null||l(f,c)},onClick:()=>d?r==null?void 0:r(c.path):t(c),title:c.path,children:[d?a.jsx("span",{className:"material-symbols-outlined af-work-file__chevron",children:u?"chevron_right":"expand_more"}):null,a.jsx("span",{className:"material-symbols-outlined",children:c.icon||gW(c.name,d)}),a.jsx("span",{children:c.name})]}),d?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",className:"af-work-file-action",onClick:()=>i==null?void 0:i(c.path),title:"新增文件","aria-label":`在 ${c.name} 新增文件`,children:a.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),a.jsx("button",{type:"button",className:"af-work-file-action",onClick:()=>s==null?void 0:s(c.path),title:"新增文件夹","aria-label":`在 ${c.name} 新增文件夹`,children:a.jsx("span",{className:"material-symbols-outlined",children:"create_new_folder"})})]}):null,a.jsx("button",{type:"button",className:"af-work-file-action af-work-file-action--danger",onClick:()=>o==null?void 0:o(c),title:"删除","aria-label":`删除 ${c.name}`,children:a.jsx("span",{className:"material-symbols-outlined",children:"delete"})})]}),d&&!u&&((p=c.children)!=null&&p.length)?a.jsx(UI,{items:c.children,onOpen:t,collapsedDirs:n,onToggleDir:r,onCreateFile:i,onCreateFolder:s,onDelete:o,onFileDragStart:l}):null]},c.path)})})}function OW({messages:e,running:t}){const n=e.length>0;return a.jsxs("div",{className:"af-composer-ai-stack af-composer-ai-stack--in-panel af-composer-thread-stack",children:[e.map((r,i)=>{const s=r.kind==="run-log"?"reply":r.role==="user"?"user-msg":r.error?"error":"reply",o=r.kind==="run-log"?"Run":r.role==="user"?"You":r.error?"Error":"Reply";return a.jsxs("section",{className:`af-composer-ai-block af-composer-ai-block--${s}`,children:[a.jsx("div",{className:"af-composer-ai-block-label",children:o}),a.jsx("div",{className:"af-composer-ai-block-body",children:r.text})]},`${i}-${r.role}-${String(r.text||"").slice(0,24)}`)}),t&&!n?a.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--reply af-composer-ai-block--pending",children:[a.jsx("div",{className:"af-composer-ai-block-label",children:"Reply"}),a.jsx("div",{className:"af-composer-ai-block-body",children:"Waiting..."})]}):null,t&&n?a.jsxs("section",{className:"af-composer-ai-block af-composer-ai-block--thinking",children:[a.jsx("div",{className:"af-composer-ai-block-label",children:"Thinking"}),a.jsx("div",{className:"af-composer-ai-block-body",children:"Workspace agent is running..."})]}):null]})}function AN(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 MW(e){const t=AN((e==null?void 0:e.body)||"");if(t.length>0)return t;const n=Array.isArray(e==null?void 0:e.outputs)?e.outputs:[],r=Array.isArray(e==null?void 0:e.inputs)?e.inputs:[],i=[...n,...r].find(s=>(s==null?void 0:s.name)==="skillsContext"||(s==null?void 0:s.type)==="text");return AN((i==null?void 0:i.default)||(i==null?void 0:i.value)||"")}function $W(e){return JSON.stringify(Array.from(new Set((e||[]).map(String).filter(Boolean))))}function FW({id:e,data:t,selected:n,deleteNode:r,skills:i,skillCollections:s,onChangeSkillKeys:o}){const l=Array.isArray(t==null?void 0:t.inputs)?t.inputs:[],c=Array.isArray(t==null?void 0:t.outputs)?t.outputs:[],d=Array.isArray(i)?i:[],u=Array.isArray(s)?s:[],[p,f]=m.useState(!1),h=m.useMemo(()=>new Set(MW(t)),[t]),y=m.useMemo(()=>new Map(d.map(g=>[g.key,g])),[d]),b=m.useMemo(()=>{const g=new Set,v=u.map(k=>{const E=Bo(k,d).map(j=>y.get(j)).filter(Boolean);for(const j of E)g.add(j.key);return{...k,skills:E}}).filter(k=>k.skills.length>0),w=d.filter(k=>!g.has(k.key));return{collectionGroups:v,ungrouped:w}},[y,u,d]),S=m.useCallback((g,v)=>{const w=new Set(h);for(const k of g)v?w.add(k):w.delete(k);o==null||o(e,Array.from(w))},[e,h,o]);return a.jsxs("div",{className:"af-work-load-skills-card"+(n?" af-work-load-skills-card--selected":""),children:[l.map((g,v)=>{if(g.showOnNode===!1)return null;const w=`${2.6+v*1.7}rem`,k=g.name||`#${v+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--in",style:{top:w},children:k}),a.jsx(wi,{type:"target",position:$e.Left,id:`input-${v}`,className:"af-work-display-handle af-work-display-handle--in",style:{top:w,background:vn(g.type)},title:`${k} · ${g.type}`})]},`in-${v}`)}),c.map((g,v)=>{if(g.showOnNode===!1)return null;const w=`${2.6+v*1.7}rem`,k=g.name||`#${v+1}`;return a.jsxs(m.Fragment,{children:[a.jsx("span",{className:"af-work-port-label af-work-port-label--out",style:{top:w},children:k}),a.jsx(wi,{type:"source",position:$e.Right,id:`output-${v}`,className:"af-work-display-handle af-work-display-handle--out",style:{top:w,background:vn(g.type)},title:`${k} · ${g.type}`})]},`out-${v}`)}),a.jsxs("div",{className:"af-work-load-skills-card__head",children:[a.jsx("span",{className:"material-symbols-outlined",children:"extension"}),a.jsx("strong",{children:(t==null?void 0:t.label)||"Load Skills"}),a.jsx("span",{children:(t==null?void 0:t.definitionId)||"control_load_skills"}),a.jsx("button",{type:"button",className:"af-work-display-card__close nodrag",onClick:()=>r==null?void 0:r(e),"aria-label":"删除节点",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsxs("div",{className:"af-work-load-skills-card__body nodrag",children:[a.jsxs("button",{type:"button",className:"af-work-load-skills-card__select",onClick:g=>{g.stopPropagation(),f(v=>!v)},children:[a.jsx("span",{children:h.size>0?`${h.size} skills selected`:"选择 Skills"}),a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:p?"expand_less":"expand_more"})]}),p?a.jsxs("div",{className:"af-work-load-skills-menu",onClick:g=>g.stopPropagation(),children:[b.collectionGroups.map(g=>{const v=g.skills.map(E=>E.key),w=v.filter(E=>h.has(E)).length,k=v.length>0&&w===v.length;return a.jsxs("section",{className:"af-work-load-skills-menu__group",children:[a.jsxs("label",{className:"af-work-load-skills-menu__group-head",children:[a.jsx("input",{type:"checkbox",checked:k,onChange:E=>S(v,E.target.checked)}),a.jsx("span",{children:g.name}),a.jsxs("small",{children:[w,"/",v.length]})]}),a.jsx("div",{className:"af-work-load-skills-menu__options",children:g.skills.map(E=>a.jsxs("label",{className:"af-work-load-skills-menu__option",children:[a.jsx("input",{type:"checkbox",checked:h.has(E.key),onChange:j=>S([E.key],j.target.checked)}),a.jsx("span",{children:E.name})]},`${g.id}:${E.key}`))})]},g.id)}),b.ungrouped.length>0?a.jsxs("section",{className:"af-work-load-skills-menu__group",children:[a.jsxs("div",{className:"af-work-load-skills-menu__group-head af-work-load-skills-menu__group-head--plain",children:[a.jsx("span",{children:"Ungrouped"}),a.jsx("small",{children:b.ungrouped.length})]}),a.jsx("div",{className:"af-work-load-skills-menu__options",children:b.ungrouped.map(g=>a.jsxs("label",{className:"af-work-load-skills-menu__option",children:[a.jsx("input",{type:"checkbox",checked:h.has(g.key),onChange:v=>S([g.key],v.target.checked)}),a.jsx("span",{children:g.name})]},`ungrouped:${g.key}`))})]}):null,a.jsx("button",{type:"button",className:"af-work-load-skills-menu__clear",onClick:()=>o==null?void 0:o(e,[]),children:"清空"})]}):null]})]})}function DW(){var Za,xr;const{i18n:e}=Mt(),{navigate:t}=za(),n=Ba(),r=H_(),i=m.useMemo(uW,[]),[s,o]=U_([]),[l,c,d]=V_([]),u=m.useRef([]),p=m.useRef(null),f=m.useRef(null),[h,y]=m.useState(null),[b,S]=m.useState({}),g=m.useRef({}),v=m.useRef(!1),w=m.useRef(null),[k,E]=m.useState([]),[j,P]=m.useState(""),[O,F]=m.useState("nodes"),[W,R]=m.useState([]),[I,q]=m.useState(!1),[$,H]=m.useState(""),[z,Y]=m.useState(!1),[A,T]=m.useState({name:"",id:"",description:""}),[C,G]=m.useState(!1),[Q,M]=m.useState(""),[te,ce]=m.useState(""),le=m.useRef(null),[de,ue]=m.useState(!1),[se,re]=m.useState("nodes"),[fe,ye]=m.useState(""),[Se,He]=m.useState(0),[st,Ke]=m.useState(""),[Te,It]=m.useState(null),[pn,sn]=m.useState(""),[Nn,xn]=m.useState([]),[On,Ur]=m.useState(""),[Jn,oe]=m.useState(""),[he,Ve]=m.useState(()=>new Set),[Xe,tt]=m.useState({cursor:[],opencode:[],claudeCode:[]}),[Et,jn]=m.useState(""),[xt,Cn]=m.useState([]),[Qn,Ht]=m.useState(!1),[Ut,on]=m.useState([]),[jr,Yi]=m.useState([]),[bt,En]=m.useState(!1),vi=m.useCallback(_=>{le.current&&window.clearTimeout(le.current),ce(_),le.current=window.setTimeout(()=>{ce(""),le.current=null},3800)},[]),Gt=m.useCallback(_=>{const V=String(_||"").trim();V&&window.requestAnimationFrame(()=>{r(V)})},[r]);m.useEffect(()=>()=>{le.current&&window.clearTimeout(le.current)},[]);const[fr,Zn]=m.useState(()=>new Set),[er,oi]=m.useState(!1),Gi=m.useRef(null),tr=m.useRef(null),Vn=m.useRef(null),[Xi,qe]=m.useState({}),[jt,At]=m.useState(""),[$t,De]=m.useState(!1),[_n,Ne]=m.useState([]),[an,pr]=m.useState(!1),[ot,ai]=m.useState(!1),[Mn,$n]=m.useState(!1),[Vr,Pn]=m.useState(!1),[Wr,hr]=m.useState("pan"),[Xt,mr]=m.useState(null),[gr,Kr]=m.useState(""),[U,ge]=m.useState(()=>new Set),[_e,ze]=m.useState({}),[dt,Je]=m.useState(""),gt=m.useMemo(()=>dW(i),[i]),nt=m.useMemo(()=>fW(i),[i]),Fn=m.useRef(!1),[bi,ki]=m.useState("");m.useEffect(()=>{i.flowId&&qC(i.flowId,i.flowSource||"user","workspace",!!i.archived)},[i]),m.useEffect(()=>{if(Fn.current=!1,!gt){Ne([]),Fn.current=!0;return}try{const _=localStorage.getItem(gt);Ne(_?jN(JSON.parse(_)):[])}catch{Ne([])}finally{Fn.current=!0}},[gt]),m.useEffect(()=>{if(!(!Fn.current||!gt))try{localStorage.setItem(gt,JSON.stringify(jN(_n)))}catch{}},[_n,gt]);const hn=m.useCallback(async()=>{const _=Zf(i),V=await fetch(`/api/workspace/files?${_.toString()}`),X=await V.json();if(!V.ok)throw new Error(X.error||"读取 workspace 失败");const Z=X.files||[];xn(Z),Ve(new Set(HI(Z))),Ur(X.root||"")},[i]),Cs=m.useCallback(async()=>{q(!0),H("");try{const _=await fetch("/api/marketplace/flow-snippets"),V=await _.json().catch(()=>({}));if(!_.ok)throw new Error(V.error||"读取流程片段失败");R(Array.isArray(V.snippets)?V.snippets:[])}catch(_){H(String(_.message||_)),R([])}finally{q(!1)}},[]),In=m.useCallback(async(_=s,V=l)=>{var ae;if(!v.current)return;const X=Kg(_,V,g.current),Z=await fetch("/api/workspace/graph",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,graph:X})}),ne=await Z.json();if(!Z.ok)throw new Error(ne.error||"保存 workspace graph 失败");g.current=((ae=ne.graph)==null?void 0:ae.instances)||X.instances,S(g.current),Je("Workspace graph saved")},[l,i,s]),Si=m.useCallback(async()=>{v.current=!1;const _=Zf(i),V=Zf(i);V.set("lang",String(e.language||"zh").startsWith("zh")?"zh":"en");const[X,Z]=await Promise.all([fetch(`/api/nodes?${V.toString()}`),fetch(`/api/workspace/graph?${_.toString()}`),hn()]),ne=await X.json(),ae=await Z.json();if(!X.ok)throw new Error(ne.error||"读取节点定义失败");if(!Z.ok)throw new Error(ae.error||"读取 workspace graph 失败");const me=[...(Array.isArray(ne)?ne:ne.nodes||[]).filter(Ye=>!oW.has(Ye.id)),lW,aW];E(me);const be=ae.graph||JSON.parse(localStorage.getItem(sW)||"null")||{},Pe=Wg(be,me);g.current=Pe.instances,S(Pe.instances),o(Pe.nodes),c(Pe.edges),Je(ae.writable?"Workspace ready":"Readonly workspace"),v.current=!0},[i,e.language,hn,c,o]),Ni=m.useCallback(async(_,V)=>{const X={packageId:(_==null?void 0:_.newId)||(_==null?void 0:_.id)||(_==null?void 0:_.label),label:(_==null?void 0:_.label)||(_==null?void 0:_.newId)||(_==null?void 0:_.id),version:"1.0.0",definitionId:V,body:(_==null?void 0:_.body)||"",script:(_==null?void 0:_.script)||"",inputs:Array.isArray(_==null?void 0:_.inputs)?_.inputs:[],outputs:Array.isArray(_==null?void 0:_.outputs)?_.outputs:[],flowId:i.flowId,flowSource:i.flowSource||"user",archived:!!i.archived},Z=await fetch("/api/marketplace/publish-node-from-instance",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(X)}),ne=await Z.json().catch(()=>({}));if(!Z.ok||(ne==null?void 0:ne.ok)===!1)throw new Error((ne==null?void 0:ne.error)||"Publish failed");return await Si(),Je(`Published node ${ne.definitionId||ne.id||X.packageId}`),ne},[i,Si]),Ua=m.useCallback(async _=>{if(!_||gr)return;const V=Kg(s,l,g.current);Kr(_),ge(new Set([_])),ze({[_]:{status:"running"}}),Je(`Running ${_}...`),pr(!0),Ne(X=>[...X,{role:"assistant",kind:"run-log",text:`Run started: ${_}`,at:Date.now()}]);try{await In(s,l);const X=await fetch("/api/workspace/run",{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/x-ndjson"},body:JSON.stringify({...i,graph:V,runNodeId:_,model:Et,selectedSkills:Ut,stream:!0})});if(!X.ok){const Be=await X.json().catch(()=>({}));throw new Error(Be.error||"Workspace run failed")}if(!X.body)throw new Error("Workspace run stream unavailable");const Z=X.body.getReader(),ne=new TextDecoder;let ae="",me=[],be=[],Pe=_;const Ye=Be=>{const yt=String(Be||"").trim();yt&&Ne(Ee=>[...Ee,{role:"assistant",kind:"run-log",text:yt,at:Date.now()}])},nr=Be=>{const yt=String(Be||"").trim();if(!yt)return;const Ee=Pe;Pe=yt,ge(new Set([yt])),ze(Ze=>{var Fe;return{...Ze,...Ee&&Ee!==yt&&((Fe=Ze[Ee])==null?void 0:Fe.status)==="running"?{[Ee]:{status:"success"}}:{},[yt]:{status:"running"}}})},Zt=Be=>{const yt=String(Be||"").trim();yt&&(ge(Ee=>{const Ze=new Set(Ee);return Ze.delete(yt),Ze}),ze(Ee=>({...Ee,[yt]:{status:"success"}})))},rr=Be=>{const yt=String(Be||"");yt.trim()&&Ne(Ee=>{const Ze=[...Ee],Fe=Ze[Ze.length-1];return Fe&&Fe.role==="assistant"&&!Fe.kind&&!Fe.error?Ze[Ze.length-1]={...Fe,text:`${Fe.text||""}${Fe.text?`
136
- `:""}${yt}`}:Ze.push({role:"assistant",text:yt,at:Date.now()}),Ze})},Dn=Be=>{const yt=Wg(Be||V,k);g.current=yt.instances,S(yt.instances),o(yt.nodes),c(yt.edges)};for(;;){const{value:Be,done:yt}=await Z.read();if(yt)break;ae+=ne.decode(Be,{stream:!0});const Ee=ae.split(`
137
- `);ae=Ee.pop()||"";for(const Ze of Ee){if(!Ze.trim())continue;const Fe=JSON.parse(Ze);if(Fe.type==="error")throw new Error(Fe.error||"Workspace run failed");if(Fe.type==="node-start"&&(Je(`Running ${Fe.nodeId}...`),nr(Fe.nodeId),Ye(`Started ${Fe.nodeId}${Fe.definitionId?` (${Fe.definitionId})`:""}`)),Fe.type==="node-done"&&(Zt(Fe.nodeId),Ye(`Completed ${Fe.nodeId}${Fe.definitionId?` (${Fe.definitionId})`:""}`)),Fe.type==="status"&&Ye(Fe.line||Fe.message||""),Fe.type==="paused"&&(be=Array.isArray(Fe.nodeIds)?Fe.nodeIds:[],Ye(Fe.message||(be.length?`Paused at ${be.join(", ")}`:"Paused"))),Fe.type==="natural"&&Fe.kind==="assistant"&&rr(Fe.text||""),Fe.type==="graph"&&Fe.graph&&Dn(Fe.graph),Fe.type==="done"){Fe.graph&&Dn(Fe.graph),me=Array.isArray(Fe.order)?Fe.order:[];const Ei=be.length>0;be=Array.isArray(Fe.pauseNodeIds)?Fe.pauseNodeIds:be,be.length?Ei||Ye(`Run paused at ${be.join(", ")}`):Ye(`Run finished${me.length?`: ${me.join(" -> ")}`:""}`)}}}if(ae.trim()){const Be=JSON.parse(ae);if(Be.type==="error")throw new Error(Be.error||"Workspace run failed");if(Be.type==="node-start"&&(Je(`Running ${Be.nodeId}...`),nr(Be.nodeId),Ye(`Started ${Be.nodeId}${Be.definitionId?` (${Be.definitionId})`:""}`)),Be.type==="node-done"&&(Zt(Be.nodeId),Ye(`Completed ${Be.nodeId}${Be.definitionId?` (${Be.definitionId})`:""}`)),Be.type==="status"&&Ye(Be.line||Be.message||""),Be.type==="paused"&&(be=Array.isArray(Be.nodeIds)?Be.nodeIds:[],Ye(Be.message||(be.length?`Paused at ${be.join(", ")}`:"Paused"))),Be.type==="natural"&&Be.kind==="assistant"&&rr(Be.text||""),Be.type==="graph"&&Be.graph&&Dn(Be.graph),Be.type==="done"){Be.graph&&Dn(Be.graph),me=Array.isArray(Be.order)?Be.order:[];const yt=be.length>0;be=Array.isArray(Be.pauseNodeIds)?Be.pauseNodeIds:be,be.length?yt||Ye(`Run paused at ${be.join(", ")}`):Ye(`Run finished${me.length?`: ${me.join(" -> ")}`:""}`)}}Je(be.length?`Workspace run paused at ${be.join(", ")}`:`Workspace run done: ${me.length?me.join(" -> "):_}`),await hn()}catch(X){ge(new Set),ze(Z=>{var ae;const ne=(ae=Object.entries(Z).find(([,me])=>(me==null?void 0:me.status)==="running"))==null?void 0:ae[0];return ne?{...Z,[ne]:{status:"failed"}}:Z}),Je(String(X.message||X)),Ne(Z=>[...Z,{role:"assistant",error:!0,text:String(X.message||X),at:Date.now()}])}finally{Kr(""),ge(new Set)}},[Et,l,i,hn,s,k,gr,In,Ut,c,o]);m.useEffect(()=>{Si().catch(_=>Je(String(_.message||_))),Cs(),fetch("/api/model-lists").then(_=>_.json()).then(_=>tt({cursor:Array.isArray(_.cursor)?_.cursor.map(String):[],opencode:Array.isArray(_.opencode)?_.opencode.map(String):[],claudeCode:Array.isArray(_.claudeCode)?_.claudeCode.map(String):[]})).catch(()=>{}),fetch("/api/skills").then(_=>_.json()).then(_=>{const V=Array.isArray(_.skills)?_.skills.map(X=>({key:String(X.key),name:String(X.name||X.id||X.key),description:X.description?String(X.description):"",sourceLabel:X.sourceLabel?String(X.sourceLabel):""})):[];Cn(V),Ht(!0)}).catch(()=>{}),fetch("/api/skill-collections").then(_=>_.json()).then(_=>{Yi(Mo(_)),En(!0)}).catch(()=>{}),fetch("/api/auth/me").then(_=>_.json()).then(_=>mr(_.user||null)).catch(()=>mr(null))},[Si,Cs,nt]),m.useEffect(()=>{if(ki(""),!(!Qn||!bt)){if(!nt){on([]);return}on(JC(nt,"workspace",xt,jr)),ki(nt)}},[jr,bt,xt,Qn,nt]),m.useEffect(()=>{if(!(bi!==nt||!nt))try{localStorage.setItem(nt,JSON.stringify(Ut))}catch{}},[Ut,nt,bi]),m.useEffect(()=>{g.current=b},[b]),m.useEffect(()=>{u.current=s},[s]),m.useEffect(()=>{f.current=h},[h]),m.useEffect(()=>{if(!h)return;const _=X=>{X.key==="Escape"&&y(null)},V=X=>{var Z,ne;(ne=(Z=X.target)==null?void 0:Z.closest)!=null&&ne.call(Z,".af-connect-node-menu")||y(null)};return document.addEventListener("keydown",_),document.addEventListener("pointerdown",V),()=>{document.removeEventListener("keydown",_),document.removeEventListener("pointerdown",V)}},[h]),m.useEffect(()=>{if(v.current)return w.current&&window.clearTimeout(w.current),w.current=window.setTimeout(()=>{In().catch(_=>Je(String(_.message||_)))},650),()=>{w.current&&window.clearTimeout(w.current)}},[s,l,In]);const Es=m.useCallback((_,V)=>{const X=$W(V),Z=Pe=>Array.isArray(Pe)?Pe.map(Ye=>(Ye==null?void 0:Ye.name)!=="skillsContext"&&(Ye==null?void 0:Ye.type)!=="text"?Ye:{...Ye,default:X,value:X}):[],ne=s.map(Pe=>{var Ye,nr;return Pe.id!==_?Pe:{...Pe,data:{...Pe.data,body:X,inputs:Z((Ye=Pe.data)==null?void 0:Ye.inputs),outputs:Z((nr=Pe.data)==null?void 0:nr.outputs)}}}),ae=g.current||{},me=ae[_]&&typeof ae[_]=="object"?ae[_]:{},be={...ae,[_]:{...me,body:X,input:Z(me.input),output:Z(me.output)}};g.current=be,o(ne),S(be),In(ne,l).catch(Pe=>Je(String(Pe.message||Pe)))},[l,s,In,o]),_s=m.useCallback(async(_,V)=>{const X=zI(V);if(!String(X||"").trim()){Je("展示节点没有可保存内容");return}const Z=IW(_,V),ne=window.prompt("保存到 workspace 相对路径",Z);if(ne)try{const ae=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:ne,content:X})}),me=await ae.json().catch(()=>({}));if(!ae.ok)throw new Error(me.error||"保存文件失败");Je(`已保存 ${me.path||ne}`),await hn()}catch(ae){Je(String(ae.message||ae))}},[i,hn]),Ps=m.useMemo(()=>s.map(_=>{var V,X;return{..._,data:{..._.data,modelLists:Xe,showBodyPreview:!0,isExecuting:U.has(_.id),nodeStatus:((V=_e[_.id])==null?void 0:V.status)??null,nodeElapsed:((X=_e[_.id])==null?void 0:X.elapsed)??null,onRunWorkspaceNode:Ua,runningRunNodeId:gr,skills:xt,skillCollections:jr,onChangeLoadSkillKeys:Es,onSaveDisplayNodeToFile:_s}}}),[Es,Xe,s,Ua,gr,_s,jr,xt,U,_e]),at=m.useMemo(()=>s.find(_=>_.id===st)||null,[s,st]);m.useEffect(()=>{var X,Z,ne,ae,me;if(!at){It(null),sn("");return}const{inputs:_,outputs:V}=vI(at);It({id:at.id,newId:at.id,label:String(((X=at.data)==null?void 0:X.label)??at.id),role:String(((Z=at.data)==null?void 0:Z.role)??"normal"),model:String(((ne=at.data)==null?void 0:ne.model)??""),body:String(((ae=at.data)==null?void 0:ae.body)??""),script:String(((me=at.data)==null?void 0:me.script)??""),inputs:_,outputs:V}),sn("")},[at==null?void 0:at.id]);const Ji=m.useCallback((_=!1)=>{var yt;if(!Te||!at)return!1;const V=at.id,X=String(Te.newId||"").trim(),Z=_?X:V;if(sn(""),_){if(!PI.test(Z))return sn("Invalid instance id"),!1;if(s.some(Ee=>Ee.id===Z&&Ee.id!==V))return sn("Duplicate instance id"),!1}const ne=String(Te.role||"").trim(),ae=Uo.includes(ne)?ne:"normal",me=String(Te.model||"").trim(),be=Ee=>(Array.isArray(Ee)?Ee:[]).map(Ze=>({type:String((Ze==null?void 0:Ze.type)??"node").trim()||"node",name:String((Ze==null?void 0:Ze.name)??""),default:String((Ze==null?void 0:Ze.default)??""),required:!!(Ze!=null&&Ze.required),showOnNode:(Ze==null?void 0:Ze.showOnNode)!=null?Ze.showOnNode!==!1:!!(Ze!=null&&Ze.required)||String((Ze==null?void 0:Ze.type)??"node").trim().toLowerCase()==="node"})),Pe={...at.data,label:String(Te.label||"").trim()||Z,role:ae,model:me===""||me==="default"?void 0:me,body:String(Te.body??""),inputs:be(Te.inputs),outputs:be(Te.outputs)},Ye=String(Te.script??"").trim();String(((yt=at.data)==null?void 0:yt.definitionId)??Z)==="tool_nodejs"||Ye!==""?Pe.script=String(Te.script??""):delete Pe.script;const Zt=at.data||{};if(!(Z!==V||Zt.label!==Pe.label||Zt.role!==Pe.role||Zt.model!==Pe.model||Zt.body!==Pe.body||(Zt.script??void 0)!==(Pe.script??void 0)||JSON.stringify(Zt.inputs||[])!==JSON.stringify(Pe.inputs||[])||JSON.stringify(Zt.outputs||[])!==JSON.stringify(Pe.outputs||[])))return!0;let Dn=s.map(Ee=>Ee.id===V?{...Ee,id:Z,selected:!0,data:Pe}:Ee),Be=l;if(Z!==V){const Ee={...g.current},Ze={...Ee[V]||{}};delete Ee[V],Ee[Z]=Ze,g.current=Ee,S(Ee),Be=l.map((Fe,Ei)=>({...Fe,source:Fe.source===V?Z:Fe.source,target:Fe.target===V?Z:Fe.target,id:`we-${Fe.source===V?Z:Fe.source}-${Fe.target===V?Z:Fe.target}-${Ei}`})),Ke(Z)}return o(Dn),c(Be),Gt(Z),!0},[l,Te,s,at,c,o,Gt]);m.useEffect(()=>{if(!Te||!at)return;const _=window.setTimeout(()=>{Ji(!1)},350);return()=>window.clearTimeout(_)},[Te==null?void 0:Te.label,Te==null?void 0:Te.role,Te==null?void 0:Te.model,Te==null?void 0:Te.body,Te==null?void 0:Te.script,JSON.stringify((Te==null?void 0:Te.inputs)||[]),JSON.stringify((Te==null?void 0:Te.outputs)||[]),Ji,at==null?void 0:at.id]);const Va=m.useMemo(()=>{const _=new Map(Ps.map(V=>[V.id,V]));return l.map(V=>{var Ye,nr,Zt,rr;const X=_.get(V.source),Z=_.get(V.target),ne=/^output-(\d+)$/.exec(V.sourceHandle||""),ae=/^input-(\d+)$/.exec(V.targetHandle||""),me=X&&ne?(nr=(Ye=X.data)==null?void 0:Ye.outputs)==null?void 0:nr[parseInt(ne[1],10)]:null,be=Z&&ae?(rr=(Zt=Z.data)==null?void 0:Zt.inputs)==null?void 0:rr[parseInt(ae[1],10)]:null,Pe=me!=null&&me.type?vn(me.type):be!=null&&be.type?vn(be.type):"";return Pe?{...V,style:{...V.style||{},stroke:Pe,strokeWidth:2},markerEnd:{type:zr.ArrowClosed,color:Pe}}:V})},[l,Ps]),Qo=m.useMemo(()=>{const _=j.trim().toLowerCase(),V={DISPLAY:[],CONTROL:[],TOOL:[],PROVIDE:[],AGENT:[]};for(const X of k)_&&![X.id,X.label,X.displayName,X.description].some(Z=>String(Z||"").toLowerCase().includes(_))||V[pu(X)].push(X);for(const X of pl)V[X].sort((Z,ne)=>Z.id.localeCompare(ne.id));return V},[k,j]),Jt=m.useMemo(()=>{const _=fe.trim().toLowerCase();return k.filter(V=>!_||[V.id,V.label,V.displayName,V.description].some(X=>String(X||"").toLowerCase().includes(_))).sort((V,X)=>{const Z=pl.indexOf(pu(V)),ne=pl.indexOf(pu(X));return Z!==ne?Z-ne:hu(V).localeCompare(hu(X))}).slice(0,30)},[k,fe]),ji=m.useMemo(()=>{const _=fe.trim().toLowerCase();return W.filter(V=>!_||[V.id,V.version,V.displayName,V.name,V.description,...Array.isArray(V.tags)?V.tags:[]].some(X=>String(X||"").toLowerCase().includes(_))).sort((V,X)=>String(V.displayName||V.name||V.id).localeCompare(String(X.displayName||X.name||X.id))).slice(0,30)},[W,fe]);m.useEffect(()=>{He(0)},[fe,de,se]),m.useEffect(()=>{if(!de)return;const _=window.setTimeout(()=>{var V;return(V=Vn.current)==null?void 0:V.focus()},0);return()=>window.clearTimeout(_)},[de]);const Dd=m.useMemo(()=>{const _=Jn.trim().toLowerCase();return _?BI(Nn).filter(V=>V.path.toLowerCase().includes(_)):Nn},[Jn,Nn]),zd=[...(Xe.cursor||[]).map(_=>({label:`Cursor · ${_.split(" - ")[0]}`,value:`cursor:${_.split(" - ")[0]}`})),...(Xe.opencode||[]).map(_=>({label:`OpenCode · ${_.split(" - ")[0]}`,value:`opencode:${_.split(" - ")[0]}`})),...(Xe.claudeCode||[]).map(_=>({label:`Claude · ${_.split(" - ")[0]}`,value:`claude-code:${_.split(" - ")[0]}`}))],qr=m.useMemo(()=>new Set(Ut),[Ut]),Zo=m.useMemo(()=>{const _=new Map(xt.map(ae=>[ae.key,ae])),V=new Set,X=new Set,Z=jr.map(ae=>{const me=Bo(ae,xt).map(be=>_.get(be)).filter(Boolean);for(const be of me)V.add(be.key),X.add(String(be.name||be.id||be.key||"").trim());return{...ae,skills:me}}).filter(ae=>ae.skills.length>0),ne=xt.filter(ae=>{const me=String(ae.name||ae.id||ae.key||"").trim();return!V.has(ae.key)&&!X.has(me)});return{groups:Z,ungrouped:ne}},[jr,xt]),ln=m.useMemo(()=>{const _=s.filter(V=>V.selected);return _.length>0?_:st?s.filter(V=>V.id===st):[]},[s,st]),Qi=m.useMemo(()=>ln.map(_=>_.id),[ln]),Wa=m.useMemo(()=>{const _=String((Xt==null?void 0:Xt.username)||(Xt==null?void 0:Xt.userId)||"").trim();return _?_.slice(0,1).toUpperCase():"?"},[Xt]),to=m.useMemo(()=>new Set(Qi),[Qi]),kt=m.useMemo(()=>l.filter(_=>to.has(_.source)&&to.has(_.target)),[l,to]),Ka=m.useMemo(()=>{const _=j.trim().toLowerCase();return _?W.filter(V=>[V.id,V.version,V.displayName,V.name,V.description,...Array.isArray(V.tags)?V.tags:[]].filter(Boolean).some(X=>String(X).toLowerCase().includes(_))):W},[W,j]),Vt=m.useCallback((_,V)=>{const X=String(_||"snippet_node").trim().replace(/[^a-zA-Z0-9_]+/g,"_").replace(/^_+|_+$/g,"")||"snippet_node";let Z=`${X}_${Date.now().toString(36)}`,ne=2;for(;V.has(Z);)Z=`${X}_${Date.now().toString(36)}_${ne}`,ne+=1;return V.add(Z),Z},[]),Is=m.useCallback((_,V)=>{var Fe,Ei;const X=_!=null&&_.snippet&&typeof _.snippet=="object"?_.snippet:{},Z=X.instances&&typeof X.instances=="object"?X.instances:{},ne=Object.keys(Z);if(ne.length===0)return;const ae=new Set(u.current.map(je=>je.id)),me={};for(const je of ne)me[je]=Vt(je,ae);const be=(Fe=X.ui)!=null&&Fe.nodePositions&&typeof X.ui.nodePositions=="object"?X.ui.nodePositions:{},Pe=ne.map(je=>{const cn=be[je];return{id:je,x:typeof(cn==null?void 0:cn.x)=="number"?cn.x:0,y:typeof(cn==null?void 0:cn.y)=="number"?cn.y:0}}),Ye=Math.min(...Pe.map(je=>je.x)),nr=Math.min(...Pe.map(je=>je.y));let Zt=V||{x:360+u.current.length*24,y:180+u.current.length*18};if(!V){const je=document.querySelector(".af-workspace-canvas .react-flow");if(je){const cn=je.getBoundingClientRect();Zt=n.screenToFlowPosition({x:cn.left+cn.width*.48,y:cn.top+cn.height*.32})}}const rr={},Dn={};for(const je of Pe){const cn=me[je.id];rr[cn]={...Z[je.id]||{}},Dn[cn]={x:Zt.x+(je.x-Ye),y:Zt.y+(je.y-nr)}}const Be=new Set(ne),yt=(Array.isArray(X.edges)?X.edges:[]).filter(je=>Be.has(je==null?void 0:je.source)&&Be.has(je==null?void 0:je.target)).map(je=>({source:me[je.source],target:me[je.target],sourceHandle:je.sourceHandle??null,targetHandle:je.targetHandle??null})),Ee=Wg({instances:rr,edges:yt,ui:{nodePositions:Dn}},k),Ze=Ee.nodes.map(je=>({...je,selected:!0}));g.current={...g.current,...Ee.instances},S(g.current),o(je=>[...je.map(cn=>({...cn,selected:!1})),...Ze]),c(je=>[...je.map(cn=>({...cn,selected:!1})),...Ee.edges]),Ke(((Ei=Ze[0])==null?void 0:Ei.id)||""),Je(`已添加流程片段:${_.displayName||_.id}`)},[Vt,k,n,c,o]),qa=m.useCallback(()=>{var X,Z;if(ln.length<2){H("请先在 workspace 画布上选择至少两个节点。"),F("flows");return}const _=ln[0],V=ln.length===2?`${((X=_.data)==null?void 0:X.label)||_.id} 片段`:`${((Z=_.data)==null?void 0:Z.label)||_.id} 等 ${ln.length} 个节点`;T({name:V,id:V.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),description:""}),M(""),Y(!0),F("flows")},[ln]),Zi=m.useCallback(async()=>{var Z,ne;if(ln.length<2)return;const _=A.name.trim();if(!_){M("请填写片段名称。");return}const V={};for(const ae of ln)V[ae.id]={x:((Z=ae.position)==null?void 0:Z.x)||0,y:((ne=ae.position)==null?void 0:ne.y)||0};const X=kt.map(ae=>({source:ae.source,target:ae.target,sourceHandle:ae.sourceHandle??null,targetHandle:ae.targetHandle??null}));G(!0),M("");try{const ae=await fetch("/api/marketplace/publish-flow-snippet",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:A.id,name:_,displayName:_,version:"1.0.0",description:A.description,snippet:{instances:cm(ln,g.current),edges:X,ui:{nodePositions:V}}})}),me=await ae.json().catch(()=>({}));if(!ae.ok||me.ok===!1)throw new Error(me.error||"发布流程片段失败");Y(!1),Je(`流程片段已发布:${me.id||_}`),vi(`流程片段已发布:${me.id||_}`),await Cs(),F("flows")}catch(ae){M(String(ae.message||ae))}finally{G(!1)}},[Cs,A,kt,ln,vi]),Ya=m.useCallback(_=>{o(V=>V.map(X=>X.id===_?{...X,selected:!1}:X)),Ke(V=>V===_?"":V)},[o]),es=m.useCallback(()=>{const _=Gi.current;if(!_)return;const V=_.getBoundingClientRect(),X=Math.min(420,Math.max(320,V.width+160)),Z=12,ne=Math.max(180,V.top-Z*2),ae=Math.min(560,ne);qe({position:"fixed",left:Math.max(12,Math.min(window.innerWidth-X-12,V.left)),top:Math.max(Z,V.top-ae-Z),width:X,maxHeight:ae,zIndex:1e4})},[]);m.useEffect(()=>{if(!er)return;es();const _=X=>{var ne,ae;const Z=X.target;(ne=Gi.current)!=null&&ne.contains(Z)||(ae=tr.current)!=null&&ae.contains(Z)||oi(!1)},V=X=>{X.key==="Escape"&&oi(!1)};return window.addEventListener("pointerdown",_),window.addEventListener("keydown",V),window.addEventListener("resize",es),window.addEventListener("scroll",es,!0),()=>{window.removeEventListener("pointerdown",_),window.removeEventListener("keydown",V),window.removeEventListener("resize",es),window.removeEventListener("scroll",es,!0)}},[er,es]);const ea=m.useCallback(_=>{var X,Z;const V=new Map;for(const ne of _||[])(ne==null?void 0:ne.type)==="dimensions"&&((X=ne.dimensions)!=null&&X.width)&&((Z=ne.dimensions)!=null&&Z.height)&&V.set(ne.id,{width:Math.round(Number(ne.dimensions.width)),height:Math.round(Number(ne.dimensions.height))});o(ne=>nv(_,ne).map(ae=>{var be;const me=V.get(ae.id);return!me||!Jo((be=ae.data)==null?void 0:be.definitionId)?ae:{...ae,data:{...ae.data,displaySize:me}}}))},[o]),Qt=m.useCallback(()=>{const _=document.querySelector(".af-workspace-canvas .react-flow");if(_){const V=_.getBoundingClientRect();return n.screenToFlowPosition({x:V.left+V.width*.48,y:V.top+V.height*.32})}return{x:360+s.length*36,y:180+s.length*28}},[s.length,n]),As=m.useCallback(()=>{var _,V,X;if(at){const Z=Number(((_=at.measured)==null?void 0:_.width)||at.width||260);return{x:Number(((V=at.position)==null?void 0:V.x)||0)+Z+140,y:Number(((X=at.position)==null?void 0:X.y)||0)}}return Qt()},[Qt,at]),yr=m.useCallback((_,V={})=>{if(!_)return null;const X=V.id||yW(_.id,s),Z=ep(_.inputs),ne=ep(_.outputs),ae={definitionId:_.id,label:V.label||_v(_),role:"normal",body:V.body||"",input:V.inputs||Z,output:V.outputs||ne},me={id:X,type:Rd,position:V.position||Qt(),data:{label:ae.label,definitionId:_.id,schemaType:DI(_.id,_),role:"normal",body:ae.body,inputs:ae.input,outputs:ae.output}},be={...fd(me,{...g.current,[X]:ae},k),selected:!0};return o(Pe=>[...Pe.map(Ye=>({...Ye,selected:!1})),be]),Ke(X),X},[Qt,s,k,o]),Ga=m.useCallback(_=>PN(_,u.current),[]),Bd=m.useCallback(_=>{if(!PN(_,u.current)){Je("端口类型不匹配,已取消连线");return}y(null),c(V=>{const X=V.filter(Z=>!(Z.target===_.target&&Z.targetHandle===_.targetHandle));return id({..._,markerEnd:{type:zr.ArrowClosed}},X)})},[c]),ta=m.useCallback((_,V)=>{p.current=hW(V,u.current),y(null)},[]),Xa=m.useCallback((_,V)=>{var rr,Dn,Be,yt;const X=p.current;if(p.current=null,!X||V!=null&&V.toNode)return;const Z=mW(k,X);if(Z.length===0){Je(`没有匹配 ${X.slotType} 端口的节点`);return}const ne=((Dn=(rr=_==null?void 0:_.changedTouches)==null?void 0:rr[0])==null?void 0:Dn.clientX)??(_==null?void 0:_.clientX),ae=((yt=(Be=_==null?void 0:_.changedTouches)==null?void 0:Be[0])==null?void 0:yt.clientY)??(_==null?void 0:_.clientY);if(!Number.isFinite(ne)||!Number.isFinite(ae))return;const me=document.querySelector(".af-workspace-canvas .react-flow");if(!me)return;const be=me.getBoundingClientRect(),Pe=320,Ye=Math.min(440,104+Z.length*58),nr=Math.max(12,Math.min(ne-be.left,be.width-Pe-12)),Zt=Math.max(12,Math.min(ae-be.top,be.height-Ye-12));y({left:nr,top:Zt,flowPosition:n.screenToFlowPosition({x:ne,y:ae}),draft:X,candidates:Z,query:""})},[k,n]),Ja=m.useCallback(_=>{const V=f.current;if(!V||!(_!=null&&_.def))return;const X=yr(_.def,{position:V.flowPosition});if(!X)return;const Z=V.draft.handleType==="source"?{source:V.draft.nodeId,sourceHandle:V.draft.handleId,target:X,targetHandle:`input-${_.slotIndex}`}:{source:X,sourceHandle:`output-${_.slotIndex}`,target:V.draft.nodeId,targetHandle:V.draft.handleId};c(ne=>{const ae=ne.filter(me=>!(me.target===Z.target&&me.targetHandle===Z.targetHandle));return id({...Z,markerEnd:{type:zr.ArrowClosed}},ae)}),y(null)},[yr,c]),Qa=m.useCallback(_=>{_&&(yr(_,{position:As()}),ue(!1),ye(""))},[yr,As]),na=m.useCallback(_=>{_&&(Is(_,As()),ue(!1),ye(""))},[Is,As]);m.useEffect(()=>{const _=V=>{if(V.defaultPrevented)return;const X=NI(V.target)||pW(V.target);if((V.metaKey||V.ctrlKey)&&V.key.toLowerCase()==="s"){V.preventDefault(),In().catch(Z=>Je(String(Z.message||Z)));return}if(Vr){(V.key==="Escape"||wh(V))&&(V.preventDefault(),Pn(!1));return}if(!X){if(wh(V)&&!V.metaKey&&!V.ctrlKey&&!V.altKey){V.preventDefault(),Pn(!0);return}if(V.key==="a"||V.key==="A"){if(V.metaKey||V.ctrlKey){V.preventDefault(),o(Z=>Z.map(ne=>({...ne,selected:!0}))),c(Z=>Z.map(ne=>({...ne,selected:!1})));return}if(V.altKey)return;V.preventDefault(),ue(!0);return}if((V.key==="v"||V.key==="V")&&!V.metaKey&&!V.ctrlKey&&!V.altKey){V.preventDefault(),hr("select");return}(V.key==="h"||V.key==="H")&&!V.metaKey&&!V.ctrlKey&&!V.altKey&&(V.preventDefault(),hr("pan"))}};return window.addEventListener("keydown",_,!0),()=>window.removeEventListener("keydown",_,!0)},[In,Vr,c,o]);const gm=m.useCallback(_=>{Ve(V=>{const X=new Set(V);return X.has(_)?X.delete(_):X.add(_),X})},[]),Ci=m.useCallback((_,V)=>{_.dataTransfer.effectAllowed="copy",_.dataTransfer.setData("application/x-agentflow-workspace-file",JSON.stringify({path:V.path,name:V.name,type:V.type})),_.dataTransfer.setData("text/plain",V.path)},[]),bc=m.useCallback((_,V)=>{_.dataTransfer.effectAllowed="move",_.dataTransfer.setData("application/agentflow-node",V.id),_.dataTransfer.setData("text/plain",V.id)},[]),ra=m.useCallback(async(_,V)=>{const X=k.find(Ye=>Ye.id==="display_markdown");if(!X){Je("Markdown Display 节点不可用");return}const Z=Zf(i);Z.set("path",_.path);const ne=await fetch(`/api/workspace/file?${Z.toString()}`),ae=await ne.json();if(!ne.ok)throw new Error(ae.error||"读取文件失败");const me=String(ae.content||""),be=ep(X.inputs).map(Ye=>Ye.name==="content"?{...Ye,default:me}:Ye),Pe=ep(X.outputs).map(Ye=>Ye.name==="content"?{...Ye,default:me}:Ye);yr(X,{label:_.name||"Markdown",body:me,inputs:be,outputs:Pe,position:V}),Je(`已创建 Markdown 展示:${_.path}`)},[yr,i,k]),ia=m.useCallback(_=>{ra(_,Qt()).catch(V=>Je(String(V.message||V)))},[ra,Qt]),kc=m.useCallback(_=>{const V=_.dataTransfer.getData("application/x-agentflow-workspace-file");if(V){_.preventDefault();let me;try{me=JSON.parse(V)}catch{return}if(!(me!=null&&me.path))return;const be=n.screenToFlowPosition({x:_.clientX,y:_.clientY});ra(me,be).catch(Pe=>Je(String(Pe.message||Pe)));return}const X=_.dataTransfer.getData("application/agentflow-snippet");if(X){const me=W.find(Pe=>`${Pe.id}@${Pe.version}`===X);if(!me)return;_.preventDefault();const be=n.screenToFlowPosition({x:_.clientX,y:_.clientY});Is(me,be);return}const Z=_.dataTransfer.getData("application/agentflow-node");if(!Z)return;const ne=k.find(me=>me.id===Z);if(!ne)return;_.preventDefault();const ae=n.screenToFlowPosition({x:_.clientX,y:_.clientY});yr(ne,{position:ae})},[ra,yr,W,Is,k,n]),Hd=m.useCallback(_=>{const V=Array.from(_.dataTransfer.types||[]);!V.includes("application/x-agentflow-workspace-file")&&!V.includes("application/agentflow-node")&&!V.includes("application/agentflow-snippet")||(_.preventDefault(),_.dataTransfer.dropEffect=V.includes("application/agentflow-node")||V.includes("application/agentflow-snippet")?"move":"copy")},[]),sa=m.useCallback(async(_="")=>{const V=window.prompt("新文件名",_?`${_}/notes.md`:"notes.md");if(!V)return;const X=_&&!V.includes("/")?`${_}/${V}`:V;try{const Z=await fetch("/api/workspace/file",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:X,content:""})}),ne=await Z.json();if(!Z.ok)throw new Error(ne.error||"创建文件失败");Je(`已创建 ${ne.path}`),await hn()}catch(Z){Je(String(Z.message||Z))}},[i,hn]),Sc=m.useCallback(async(_="")=>{const V=window.prompt("新文件夹名",_?`${_}/docs`:"docs");if(!V)return;const X=_&&!V.includes("/")?`${_}/${V}`:V;try{const Z=await fetch("/api/workspace/folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:X})}),ne=await Z.json();if(!Z.ok)throw new Error(ne.error||"创建文件夹失败");Ve(ae=>{const me=new Set(ae);return _&&me.delete(_),me}),Je(`已创建 ${ne.path}`),await hn()}catch(Z){Je(String(Z.message||Z))}},[i,hn]),no=m.useCallback(async _=>{if(!(!(_!=null&&_.path)||!window.confirm(`删除 ${_.path}?`)))try{const V=await fetch("/api/workspace/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,path:_.path})}),X=await V.json();if(!V.ok)throw new Error(X.error||"删除失败");Je(`已删除 ${X.path}`),await hn()}catch(V){Je(String(V.message||V))}},[i,hn]),oa=m.useCallback(async()=>{const _=jt.trim();if(!_||$t)return;const V=Kg(s,l,g.current);At(""),De(!0),pr(!0),Ne(X=>[...X,{role:"user",text:_,at:Date.now()}]);try{await In(s,l);const X=await fetch("/api/workspace/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...i,prompt:_,outputKind:"markdown",workspaceGraph:V,allowFlowYaml:!1,model:Et,selectedSkills:Ut,selectedNodeIds:Qi})}),Z=await X.json();if(!X.ok)throw new Error(Z.error||"生成失败");const ne=String(Z.content||"").trim();Ne(ae=>[...ae,{role:"assistant",text:ne,at:Date.now()}]),await Si(),Je("AI 生成完成")}catch(X){const Z=String(X.message||X);Ne(ne=>[...ne,{role:"assistant",text:Z,error:!0,at:Date.now()}]),Je(Z)}finally{De(!1)}},[Et,$t,jt,l,i,Si,s,In,Qi,Ut]);return a.jsxs("div",{className:"af-workspace-page",children:[a.jsxs("header",{className:"af-pipeline-top af-workspace-top",children:[a.jsxs("div",{className:"af-pipeline-top-left",children:[a.jsx("button",{type:"button",className:"af-icon-btn af-pipeline-back",onClick:()=>t("/projects"),"aria-label":"返回",children:a.jsx("span",{className:"material-symbols-outlined",children:"arrow_back"})}),a.jsxs("div",{className:"af-pipeline-brand",title:i.flowId?`${i.flowId} · ${On}`:On||"PROJECT",children:[a.jsx("span",{className:"af-pipeline-brand-name",children:"WORKSPACE"}),a.jsxs("span",{className:"af-pipeline-brand-ver",children:["V",cW,"-STABLE"]})]}),a.jsxs("div",{className:"af-view-switch","aria-label":"视图切换",children:[a.jsx("button",{type:"button",onClick:()=>{t(Dw({id:i.flowId,source:i.flowSource||"user",archived:!!i.archived},"pipeline"))},children:"Pipeline"}),a.jsx("button",{type:"button",className:"af-view-switch__active",children:"Workspace"})]})]}),a.jsxs("div",{className:"af-pipeline-top-right af-workspace-actions",children:[a.jsx("span",{className:"af-workspace-save-status",children:dt}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Pn(!0),"aria-label":"快捷键",title:"快捷键 (?)",children:a.jsx("span",{className:"material-symbols-outlined",children:"help"})}),a.jsx("button",{type:"button",className:"af-composer-topbar-btn"+(an?" af-composer-topbar-btn--active":"")+($t?" af-composer-topbar-btn--running":""),onClick:()=>pr(_=>!_),children:"AI"}),a.jsx("button",{type:"button",className:"af-btn-primary af-btn-primary--lg",onClick:()=>In().catch(_=>Je(String(_.message||_))),children:"Save"})]})]}),te?a.jsxs("div",{className:"af-flow-snippet-toast",role:"status","aria-live":"polite",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"check_circle"}),a.jsx("span",{children:te}),a.jsx("button",{type:"button",onClick:()=>ce(""),"aria-label":"关闭发布提示",children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}):null,a.jsxs("div",{className:"af-workspace-body"+(an||Te?" af-workspace-body--drawer":"")+(Mn?" af-workspace-body--sidebar-collapsed":""),children:[Mn?a.jsx("nav",{className:"af-workspace-rail","aria-label":"Workspace sidebar",children:a.jsxs("div",{className:"af-workspace-rail__stack",children:[a.jsxs("button",{type:"button",className:"af-workspace-rail__primary",onClick:()=>ue(!0),"aria-label":"添加节点",title:"添加节点",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"add"}),a.jsx("span",{className:"af-workspace-rail__dot","aria-hidden":!0})]}),a.jsx("button",{type:"button",className:"af-workspace-rail__btn",onClick:()=>$n(!1),"aria-label":"展开文件",title:"展开文件",children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"folder"})}),a.jsx("span",{className:"af-workspace-rail__divider","aria-hidden":!0}),a.jsx("button",{type:"button",className:"af-workspace-rail__avatar",onClick:()=>$n(!1),"aria-label":"展开侧边栏",title:(Xt==null?void 0:Xt.username)||(Xt==null?void 0:Xt.userId)||"展开侧边栏",children:Wa})]})}):null,a.jsxs("aside",{className:"af-workspace-sidebar","aria-hidden":Mn,children:[a.jsxs("section",{className:"af-workspace-files-section",children:[a.jsxs("div",{className:"af-workspace-sidebar-head",children:[a.jsx("h2",{children:"Files"}),a.jsxs("div",{className:"af-workspace-sidebar-actions",children:[a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>$n(!0),"aria-label":"最小化侧边栏",title:"最小化侧边栏",children:a.jsx("span",{className:"material-symbols-outlined",children:"keyboard_double_arrow_left"})}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>sa(""),"aria-label":"新增文件",title:"新增文件",children:a.jsx("span",{className:"material-symbols-outlined",children:"note_add"})}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>Sc(""),"aria-label":"新增文件夹",title:"新增文件夹",children:a.jsx("span",{className:"material-symbols-outlined",children:"create_new_folder"})}),a.jsx("button",{type:"button",className:"af-icon-btn",onClick:()=>void hn(),"aria-label":"刷新文件",title:"刷新文件",children:a.jsx("span",{className:"material-symbols-outlined",children:"refresh"})})]})]}),a.jsx("input",{className:"af-workspace-search",value:Jn,onChange:_=>oe(_.target.value),placeholder:"搜索文件..."}),a.jsx("div",{className:"af-workspace-files-scroll",children:a.jsx(UI,{items:Dd,onOpen:ia,collapsedDirs:he,onToggleDir:gm,onCreateFile:sa,onCreateFolder:Sc,onDelete:no,onFileDragStart:Ci})})]}),a.jsxs("section",{className:"af-workspace-nodes-section",children:[a.jsxs("div",{className:"af-node-palette-head af-workspace-node-palette-head",children:[a.jsxs("h2",{className:"af-node-palette-title",children:[a.jsx("span",{children:"Palette"}),a.jsx("span",{className:"af-node-palette-title-kbd","aria-label":"快捷键 A",children:"A"})]}),a.jsxs("label",{className:"af-palette-search-wrap",children:[a.jsx("span",{className:"af-visually-hidden",children:O==="flows"?"搜索流程片段":"搜索节点"}),a.jsx("span",{className:"af-palette-search-icon material-symbols-outlined","aria-hidden":!0,children:"search"}),a.jsx("input",{type:"search",className:"af-palette-search-input",value:j,onChange:_=>P(_.target.value),placeholder:O==="flows"?"搜索流程片段...":"搜索节点...","aria-label":O==="flows"?"搜索流程片段":"搜索节点"})]}),a.jsxs("div",{className:"af-palette-tabs",role:"tablist","aria-label":"Palette 类型",children:[a.jsxs("button",{type:"button",role:"tab","aria-selected":O==="nodes",className:"af-palette-tab"+(O==="nodes"?" af-palette-tab--active":""),onClick:()=>F("nodes"),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"category"}),"节点"]}),a.jsxs("button",{type:"button",role:"tab","aria-selected":O==="flows",className:"af-palette-tab"+(O==="flows"?" af-palette-tab--active":""),onClick:()=>F("flows"),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"account_tree"}),"流程"]})]})]}),a.jsx("div",{className:"af-node-palette-scroll af-workspace-node-palette-scroll",children:O==="flows"?a.jsxs(a.Fragment,{children:[a.jsx("section",{className:"af-palette-section af-flow-palette-section--snippets",children:a.jsxs("div",{className:"af-flow-snippet-actions",children:[a.jsxs("button",{type:"button",className:"af-flow-snippet-publish-btn",onClick:qa,disabled:ln.length<2,title:ln.length<2?"选择至少两个节点后发布流程片段":"发布选中的流程片段",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"ios_share"}),"发布选中片段"]}),a.jsxs("span",{className:"af-flow-snippet-selection",children:["已选 ",ln.length," 节点 / ",kt.length," 连线"]})]})}),$?a.jsx("p",{className:"af-err af-palette-list-err",children:$}):null,I?a.jsx("p",{className:"af-palette-empty",children:"正在加载流程片段..."}):Ka.length>0?a.jsxs("section",{className:"af-palette-section af-flow-palette-section--snippets",children:[a.jsx("h3",{className:"af-palette-cat",children:"FLOW SNIPPETS"}),a.jsx("div",{className:"af-palette-cards",children:Ka.map(_=>{const V=`${_.id}@${_.version}`,X=_.displayName||_.name||_.id,Z=_.description||`${_.nodeCount||0} 个节点,${_.edgeCount||0} 条连线`;return a.jsxs("button",{type:"button",className:"af-palette-card af-flow-snippet-card",draggable:!0,onDragStart:ne=>{ne.dataTransfer.effectAllowed="move",ne.dataTransfer.setData("application/agentflow-snippet",V),ne.dataTransfer.setData("text/plain",V)},onClick:()=>Is(_),title:Z,children:[a.jsxs("span",{className:"af-palette-card-head",children:[a.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:a.jsx("span",{className:"material-symbols-outlined",children:"account_tree"})}),a.jsxs("span",{className:"af-palette-card-main",children:[a.jsx("span",{className:"af-palette-card-label",children:X}),a.jsxs("span",{className:"af-palette-card-id",children:[_.id,"@",_.version]})]})]}),Z?a.jsx("span",{className:"af-palette-card-desc",children:Z}):null,a.jsxs("span",{className:"af-flow-snippet-meta","aria-hidden":!0,children:[a.jsxs("span",{children:[_.nodeCount||0," nodes"]}),a.jsxs("span",{children:[_.edgeCount||0," edges"]})]})]},V)})})]}):a.jsx("p",{className:"af-palette-empty",children:j.trim()?"没有匹配的流程片段":"暂无流程片段。选择多个节点后发布。"})]}):a.jsxs(a.Fragment,{children:[pl.map(_=>{var V;return(V=Qo[_])!=null&&V.length?a.jsxs("section",{className:`af-palette-section af-flow-palette-section--${_}`,children:[a.jsx("h3",{className:"af-palette-cat",children:_}),a.jsx("div",{className:"af-palette-cards",children:Qo[_].map(X=>{const Z=_N(X.inputs,"input"),ne=_N(X.outputs,"output"),ae=Mx(X),me=hu(X);return a.jsxs("button",{type:"button",className:"af-palette-card",draggable:!0,onDragStart:be=>bc(be,X),onClick:()=>yr(X),title:ae||X.id,children:[a.jsxs("span",{className:"af-palette-card-head",children:[a.jsx("span",{className:"af-palette-card-icon","aria-hidden":!0,children:a.jsx("span",{className:"material-symbols-outlined",children:CN(_)})}),a.jsxs("span",{className:"af-palette-card-main",children:[a.jsx("span",{className:"af-palette-card-label",children:me}),me!==X.id?a.jsx("span",{className:"af-palette-card-id",children:X.id}):null]})]}),ae?a.jsx("span",{className:"af-palette-card-desc",children:ae}):null,a.jsxs("span",{className:"af-palette-card-ports","aria-hidden":!0,children:[a.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--in",children:[a.jsxs("span",{className:"af-palette-card-port-count",children:[Z.list.length," IN"]}),a.jsxs("span",{className:"af-palette-card-port-list",children:[Z.shown.map((be,Pe)=>a.jsxs("span",{className:"af-palette-card-port",title:EN("input",be,Pe),children:[a.jsx("span",{className:"af-palette-card-port-dot",style:{background:vn(be==null?void 0:be.type)}}),a.jsx("span",{className:"af-palette-card-port-name",children:Vg(be,Pe)})]},`in-${Pe}`)),Z.hidden>0?a.jsxs("span",{className:"af-palette-card-port-more",children:["+",Z.hidden]}):null]})]}),a.jsxs("span",{className:"af-palette-card-port-side af-palette-card-port-side--out",children:[a.jsxs("span",{className:"af-palette-card-port-count",children:[ne.list.length," OUT"]}),a.jsxs("span",{className:"af-palette-card-port-list",children:[ne.shown.map((be,Pe)=>a.jsxs("span",{className:"af-palette-card-port",title:EN("output",be,Pe),children:[a.jsx("span",{className:"af-palette-card-port-name",children:Vg(be,Pe)}),a.jsx("span",{className:"af-palette-card-port-dot",style:{background:vn(be==null?void 0:be.type)}})]},`out-${Pe}`)),ne.hidden>0?a.jsxs("span",{className:"af-palette-card-port-more",children:["+",ne.hidden]}):null]})]})]})]},X.id)})})]},_):null}),k.length>0&&j.trim()&&pl.every(_=>{var V;return!((V=Qo[_])!=null&&V.length)})?a.jsx("p",{className:"af-palette-empty",children:"没有匹配的节点"}):null]})})]})]}),a.jsxs("main",{className:"af-workspace-canvas",children:[a.jsx(B_,{className:"af-flow-canvas af-workspace-flow"+(Wr==="pan"?" af-flow-canvas--tool-pan":" af-flow-canvas--tool-select"),nodes:Ps,edges:Va,nodeTypes:LW,onNodesChange:ea,onEdgesChange:d,onConnect:Bd,onConnectStart:ta,onConnectEnd:Xa,isValidConnection:Ga,onNodeClick:(_,V)=>{st&&Ke(V.id)},onNodeDoubleClick:(_,V)=>{_.preventDefault(),pr(!1),o(X=>X.map(Z=>({...Z,selected:Z.id===V.id}))),c(X=>X.map(Z=>({...Z,selected:!1}))),Ke(V.id)},onPaneClick:()=>Ke(""),onDrop:kc,onDragOver:Hd,selectionOnDrag:Wr==="select",panOnDrag:Wr==="pan"?!0:[1,2],panActivationKeyCode:"Space",proOptions:{hideAttribution:!0},fitView:!1,minZoom:.1,maxZoom:4,children:a.jsx(K_,{color:"rgba(255,255,255,0.12)",gap:22,size:1})}),h?(()=>{var Z;const _=String(h.query||"").trim().toLowerCase(),V=_?h.candidates.filter(ne=>{var ae,me,be;return[(ae=ne.def)==null?void 0:ae.id,ne.displayLabel,ne.description,(me=ne.slot)==null?void 0:me.name,(be=ne.slot)==null?void 0:be.type].filter(Boolean).some(Pe=>String(Pe).toLowerCase().includes(_))}):h.candidates,X=h.draft.handleType==="source"?"IN":"OUT";return a.jsxs("div",{className:"af-connect-node-menu",style:{left:h.left,top:h.top},role:"dialog","aria-label":"选择匹配节点",children:[a.jsxs("div",{className:"af-connect-node-menu__head",children:[a.jsxs("div",{className:"af-connect-node-menu__title",children:[a.jsx("span",{className:"af-connect-node-menu__dot",style:{background:vn((Z=h.draft.slot)==null?void 0:Z.type)},"aria-hidden":!0}),a.jsxs("span",{children:["匹配 ",h.draft.slotType," 节点"]})]}),a.jsx("button",{type:"button",className:"af-connect-node-menu__close","aria-label":"关闭",onClick:()=>y(null),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),a.jsxs("label",{className:"af-connect-node-menu__search",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),a.jsx("input",{type:"search",value:h.query,onChange:ne=>y(ae=>ae&&{...ae,query:ne.target.value}),placeholder:"搜索节点",autoFocus:!0})]}),a.jsxs("div",{className:"af-connect-node-menu__list",children:[V.map(ne=>{var be,Pe;const ae=ne.displayLabel||((be=ne.def)==null?void 0:be.id),me=Vg(ne.slot,ne.slotIndex);return a.jsxs("button",{type:"button",className:"af-connect-node-menu__item",onClick:()=>Ja(ne),title:ne.description||ne.def.id,children:[a.jsxs("span",{className:"af-connect-node-menu__item-main",children:[a.jsx("span",{className:"af-connect-node-menu__item-label",children:ae}),ae!==ne.def.id?a.jsx("span",{className:"af-connect-node-menu__item-id",children:ne.def.id}):null]}),a.jsxs("span",{className:"af-connect-node-menu__port",children:[a.jsx("span",{children:X}),a.jsx("span",{className:"af-connect-node-menu__port-dot",style:{background:vn((Pe=ne.slot)==null?void 0:Pe.type)},"aria-hidden":!0}),a.jsx("span",{className:"af-connect-node-menu__port-name",children:me})]})]},`${ne.def.id}-${ne.slotIndex}`)}),V.length===0?a.jsx("div",{className:"af-connect-node-menu__empty",children:"没有匹配结果"}):null]})]})})():null,ot?a.jsx("button",{type:"button",className:"af-workspace-composer-fab",onClick:()=>ai(!1),"aria-label":"展开 AI 输入框",title:"展开 AI 输入框",children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"auto_awesome"})}):a.jsx("div",{className:"af-workspace-composer af-bottom-composer-stack af-flow-bottom-composer",children:a.jsxs("div",{className:"af-pipeline-composer-inner",children:[a.jsx("button",{type:"button",className:"af-workspace-composer-minimize",onClick:()=>ai(!0),"aria-label":"最小化 AI 输入框",title:"最小化",children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"remove"})}),a.jsx("div",{className:"af-composer-selected","aria-label":"Selected workspace nodes",children:ln.length===0?a.jsx("span",{className:"af-composer-selected-empty",children:"选择画布节点后,可作为本次 Workspace AI 的上下文。"}):ln.map(_=>{var ne,ae;const V=String(((ne=_.data)==null?void 0:ne.label)??_.id),X=(ae=_.data)!=null&&ae.definitionId?String(_.data.definitionId):"",Z=X&&X!==V?`${V} · ${_.id} · ${X}`:`${V} · ${_.id}`;return a.jsxs("div",{className:"af-composer-node-chip",title:Z,children:[a.jsx("span",{className:"af-composer-node-chip-kind",children:X||"node"}),a.jsx("span",{className:"af-composer-node-chip-label",children:V}),a.jsx("button",{type:"button",className:"af-composer-node-chip-dismiss",onClick:()=>Ya(_.id),"aria-label":`取消选择 ${_.id}`,children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]},_.id)})}),a.jsxs("div",{className:"af-composer-card af-composer-card--input-only",children:[a.jsx("div",{className:"af-composer-input-wrap",children:a.jsx("textarea",{className:"af-composer-textarea",value:jt,rows:2,onChange:_=>At(_.target.value),onKeyDown:_=>{(_.metaKey||_.ctrlKey)&&_.key==="Enter"&&(_.preventDefault(),oa())},placeholder:"描述你想在 workspace 中生成、分析或展示的内容",autoComplete:"off",spellCheck:!1})}),a.jsxs("div",{className:"af-composer-toolbar",children:[a.jsxs("div",{className:"af-composer-skills-field",children:[a.jsxs("button",{ref:Gi,type:"button",className:"af-composer-skills-button"+(Ut.length>0?" af-composer-skills-button--active":""),disabled:$t,"aria-haspopup":"listbox","aria-expanded":er,onClick:()=>oi(_=>!_),children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"extension"}),a.jsx("span",{children:Ut.length>0?`Skills ${Ut.length}`:"Skills"})]}),er&&!$t?Tr.createPortal(a.jsx("div",{ref:tr,className:"af-composer-skills-menu",role:"listbox","aria-label":"Skills",style:Xi,children:xt.length===0?a.jsx("div",{className:"af-composer-skills-empty",children:"No skills found"}):a.jsxs(a.Fragment,{children:[Zo.groups.map(_=>{const V=Bo(_,xt),X=XC(_,qr,xt),Z=fr.has(_.id);return a.jsxs("div",{className:"af-composer-skill-group af-composer-skill-group--framed"+(Z?" af-composer-skill-group--collapsed":""),children:[a.jsxs("div",{className:"af-composer-skill-group-title af-composer-skill-group-title--selectable",children:[a.jsxs("label",{className:"af-composer-skill-group-check",children:[a.jsx("input",{type:"checkbox",checked:X==="all",disabled:V.length===0,onChange:ne=>{const ae=ne.target.checked;on(me=>ae?YC(me,V):GC(me,V))}}),a.jsxs("span",{className:"af-composer-skill-group-title-main",children:[a.jsx("span",{children:_.name}),_.builtin?a.jsx("em",{children:"built-in"}):null,X==="partial"?a.jsx("em",{children:"partial"}):null]})]}),a.jsxs("button",{type:"button",className:"af-composer-skill-group-toggle","aria-label":Z?`展开 ${_.name}`:`收起 ${_.name}`,onClick:()=>{Zn(ne=>{const ae=new Set(ne);return ae.has(_.id)?ae.delete(_.id):ae.add(_.id),ae})},children:[a.jsx("span",{children:_.skills.length}),a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:Z?"expand_more":"expand_less"})]})]}),Z?null:a.jsx("div",{className:"af-composer-skill-group-items",children:_.skills.map(ne=>a.jsxs("label",{className:"af-composer-skill-option",children:[a.jsx("input",{type:"checkbox",checked:qr.has(ne.key),onChange:ae=>{const me=ae.target.checked;on(be=>me?be.includes(ne.key)?be:[...be,ne.key]:be.filter(Pe=>Pe!==ne.key))}}),a.jsxs("span",{className:"af-composer-skill-option-main",children:[a.jsx("span",{className:"af-composer-skill-option-title",children:ne.name}),ne.description?a.jsx("span",{className:"af-composer-skill-option-desc",children:ne.description}):null]})]},`${_.id}:${ne.key}`))})]},_.id)}),Zo.ungrouped.length>0?a.jsxs("div",{className:"af-composer-skill-group",children:[a.jsxs("div",{className:"af-composer-skill-group-title",children:[a.jsx("span",{children:"Ungrouped"}),a.jsx("span",{children:Zo.ungrouped.length})]}),Zo.ungrouped.map(_=>a.jsxs("label",{className:"af-composer-skill-option",children:[a.jsx("input",{type:"checkbox",checked:qr.has(_.key),onChange:V=>{const X=V.target.checked;on(Z=>X?Z.includes(_.key)?Z:[...Z,_.key]:Z.filter(ne=>ne!==_.key))}}),a.jsxs("span",{className:"af-composer-skill-option-main",children:[a.jsx("span",{className:"af-composer-skill-option-title",children:_.name}),_.description?a.jsx("span",{className:"af-composer-skill-option-desc",children:_.description}):null]})]},`ungrouped:${_.key}`))]}):null]})}),document.body):null]}),a.jsx("label",{className:"af-composer-model-field",children:a.jsxs("select",{className:"af-composer-model-select",value:Et,onChange:_=>jn(_.target.value),"aria-label":"模型",children:[a.jsx("option",{value:"",children:"默认模型"}),zd.map(_=>a.jsx("option",{value:_.value,children:_.label},_.value))]})}),a.jsx("button",{type:"button",className:"af-composer-send"+(jt.trim()&&!$t?" af-composer-send--active":"")+($t?" af-composer-send--stop":""),disabled:$t||!jt.trim(),"aria-label":$t?"Running":"Send",onClick:()=>void oa(),children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:$t?"sync":"arrow_upward"})})]})]})]})})]}),an?a.jsx("aside",{className:"af-pipeline-drawer af-pipeline-drawer--wide af-workspace-composer-drawer","aria-label":"Workspace AI Composer",children:a.jsxs("div",{className:"af-composer-sidebar",children:[a.jsxs("div",{className:"af-pipeline-drawer-head",children:[a.jsx("h2",{className:"af-pipeline-drawer-title",children:"AI Composer"}),a.jsx("button",{type:"button",className:"af-pipeline-drawer-close af-icon-btn",onClick:()=>pr(!1),"aria-label":"关闭 AI 对话侧栏",children:a.jsx("span",{className:"material-symbols-outlined",children:"close"})})]}),a.jsx("div",{className:"af-composer-session-tabs",children:a.jsx("button",{type:"button",className:"af-composer-session-tab af-composer-session-tab--active",children:a.jsx("span",{className:"af-composer-session-label",children:"Workspace"})})}),a.jsx("div",{className:"af-composer-sidebar-status"+($t?" af-composer-sidebar-status--running":""),role:"status","aria-live":"polite",children:$t?"Workspace agent running":_n.length>0?"Workspace conversation":"Ready"}),a.jsx("div",{className:"af-composer-sidebar-thread",children:a.jsx(OW,{messages:_n,running:$t})})]})}):Te&&at?a.jsx("aside",{className:"af-pipeline-drawer af-workspace-node-drawer","aria-label":"Workspace Node Properties",children:a.jsx(II,{draft:Te,setDraft:It,definitionId:String(((Za=at.data)==null?void 0:Za.definitionId)||at.id),systemPromptReadonly:String(((xr=at.data)==null?void 0:xr.description)||""),modelLists:Xe,disabled:!1,onIdBlur:()=>Ji(!0),onClose:()=>Ke(""),onPublishToMarketplace:Ni,error:pn,ioSlots:{inputs:Array.isArray(Te==null?void 0:Te.inputs)?Te.inputs:[],outputs:Array.isArray(Te==null?void 0:Te.outputs)?Te.outputs:[]}})}):null,a.jsx(jI,{open:Vr,onClose:()=>Pn(!1)}),z?Tr.createPortal(a.jsx("div",{className:"af-flow-snippet-modal-overlay",children:a.jsxs("div",{className:"af-flow-snippet-modal",role:"dialog","aria-modal":"true","aria-label":"发布流程片段",children:[a.jsxs("div",{className:"af-flow-snippet-modal__head",children:[a.jsxs("span",{className:"af-flow-snippet-modal__title",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"ios_share"}),"发布流程片段"]}),a.jsx("button",{type:"button",className:"af-flow-snippet-modal__close",onClick:()=>Y(!1),"aria-label":"关闭",children:a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"close"})})]}),a.jsxs("div",{className:"af-flow-snippet-modal__body",children:[a.jsxs("label",{className:"af-flow-snippet-field",children:[a.jsx("span",{children:"名称"}),a.jsx("input",{type:"text",value:A.name,onChange:_=>{const V=_.target.value;T(X=>({...X,name:V,id:X.id?X.id:V.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"")}))},placeholder:"例如:内容整理片段",autoFocus:!0})]}),a.jsxs("label",{className:"af-flow-snippet-field",children:[a.jsx("span",{children:"ID"}),a.jsx("input",{type:"text",value:A.id,onChange:_=>T(V=>({...V,id:_.target.value})),placeholder:"content-cleanup-snippet"})]}),a.jsxs("label",{className:"af-flow-snippet-field",children:[a.jsx("span",{children:"说明"}),a.jsx("textarea",{value:A.description,onChange:_=>T(V=>({...V,description:_.target.value})),placeholder:"这段流程适合什么 workspace 场景、需要接哪些上下游。",rows:4})]}),a.jsxs("div",{className:"af-flow-snippet-summary",children:["将发布 ",ln.length," 个节点和 ",kt.length," 条内部连线。"]}),Q?a.jsx("div",{className:"af-flow-snippet-error",children:Q}):null]}),a.jsxs("div",{className:"af-flow-snippet-modal__foot",children:[a.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn",onClick:()=>Y(!1),children:"取消"}),a.jsx("button",{type:"button",className:"af-flow-snippet-modal__btn af-flow-snippet-modal__btn--primary",disabled:C||!A.name.trim(),onClick:()=>void Zi(),children:C?"发布中...":"发布"})]})]})}),document.body):null,de?Tr.createPortal(a.jsx("div",{className:"af-workspace-quick-add-backdrop",onMouseDown:()=>ue(!1),children:a.jsxs("div",{className:"af-workspace-quick-add",role:"dialog","aria-modal":"true","aria-label":"Add workspace node",onMouseDown:_=>_.stopPropagation(),children:[a.jsxs("div",{className:"af-workspace-quick-add__tabs",role:"tablist","aria-label":"选择添加类型",children:[a.jsx("button",{type:"button",role:"tab","aria-selected":se==="nodes",className:"af-workspace-quick-add__tab"+(se==="nodes"?" af-workspace-quick-add__tab--active":""),onClick:()=>re("nodes"),children:"节点"}),a.jsx("button",{type:"button",role:"tab","aria-selected":se==="flows",className:"af-workspace-quick-add__tab"+(se==="flows"?" af-workspace-quick-add__tab--active":""),onClick:()=>re("flows"),children:"流程"})]}),a.jsxs("div",{className:"af-workspace-quick-add__search",children:[a.jsx("span",{className:"material-symbols-outlined","aria-hidden":!0,children:"search"}),a.jsx("input",{ref:Vn,value:fe,onChange:_=>ye(_.target.value),onKeyDown:_=>{if(_.key==="Escape")_.preventDefault(),ue(!1);else if(_.key==="ArrowDown"){_.preventDefault();const V=se==="flows"?ji.length:Jt.length;He(X=>Math.min(Math.max(0,V-1),X+1))}else _.key==="ArrowUp"?(_.preventDefault(),He(V=>Math.max(0,V-1))):_.key==="Tab"?(_.preventDefault(),re(V=>V==="nodes"?"flows":"nodes")):_.key==="Enter"&&(_.preventDefault(),se==="flows"?na(ji[Se]||ji[0]):Qa(Jt[Se]||Jt[0]))},placeholder:se==="flows"?"搜索流程片段...":"搜索节点...","aria-label":se==="flows"?"搜索流程片段":"搜索节点"})]}),a.jsx("div",{className:"af-workspace-quick-add__list",children:se==="flows"?ji.length===0?a.jsx("div",{className:"af-workspace-quick-add__empty",children:I?"正在加载流程片段...":$||"没有匹配的流程片段"}):ji.map((_,V)=>{const X=_.displayName||_.name||_.id,Z=_.snippet&&typeof _.snippet=="object"?_.snippet.instances:null,ne=_.snippet&&typeof _.snippet=="object"?_.snippet.edges:null,ae=Number.isFinite(Number(_.nodeCount))?Number(_.nodeCount):Object.keys(Z||{}).length,me=Number.isFinite(Number(_.edgeCount))?Number(_.edgeCount):Array.isArray(ne)?ne.length:0;return a.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(V===Se?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>He(V),onClick:()=>na(_),children:[a.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:"schema"}),a.jsxs("span",{className:"af-workspace-quick-add__main",children:[a.jsx("span",{className:"af-workspace-quick-add__label",children:X}),a.jsxs("span",{className:"af-workspace-quick-add__meta",children:[_.id,_.version?` · v${_.version}`:""]}),a.jsx("span",{className:"af-workspace-quick-add__desc",children:_.description||`${ae} 节点 / ${me} 连线`})]}),a.jsx("span",{className:"af-workspace-quick-add__cat",children:"FLOW"})]},`${_.id}@${_.version}`)}):Jt.length===0?a.jsx("div",{className:"af-workspace-quick-add__empty",children:"没有匹配的节点"}):Jt.map((_,V)=>{const X=pu(_),Z=hu(_),ne=Mx(_);return a.jsxs("button",{type:"button",className:"af-workspace-quick-add__item"+(V===Se?" af-workspace-quick-add__item--active":""),onMouseEnter:()=>He(V),onClick:()=>Qa(_),children:[a.jsx("span",{className:"af-workspace-quick-add__icon material-symbols-outlined","aria-hidden":!0,children:CN(X)}),a.jsxs("span",{className:"af-workspace-quick-add__main",children:[a.jsx("span",{className:"af-workspace-quick-add__label",children:Z}),a.jsx("span",{className:"af-workspace-quick-add__meta",children:_.id}),ne?a.jsx("span",{className:"af-workspace-quick-add__desc",children:ne}):null]}),a.jsx("span",{className:"af-workspace-quick-add__cat",children:X})]},_.id)})})]})}),document.body):null]})]})}function zW(){return a.jsx(iv,{children:a.jsx(DW,{})})}const rt=e=>typeof e=="string",tu=()=>{let e,t;const n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n},TN=e=>e==null?"":""+e,BW=(e,t,n)=>{e.forEach(r=>{t[r]&&(n[r]=t[r])})},HW=/###/g,RN=e=>e&&e.indexOf("###")>-1?e.replace(HW,"."):e,LN=e=>!e||rt(e),Au=(e,t,n)=>{const r=rt(t)?t.split("."):t;let i=0;for(;i<r.length-1;){if(LN(e))return{};const s=RN(r[i]);!e[s]&&n&&(e[s]=new n),Object.prototype.hasOwnProperty.call(e,s)?e=e[s]:e={},++i}return LN(e)?{}:{obj:e,k:RN(r[i])}},ON=(e,t,n)=>{const{obj:r,k:i}=Au(e,t,Object);if(r!==void 0||t.length===1){r[i]=n;return}let s=t[t.length-1],o=t.slice(0,t.length-1),l=Au(e,o,Object);for(;l.obj===void 0&&o.length;)s=`${o[o.length-1]}.${s}`,o=o.slice(0,o.length-1),l=Au(e,o,Object),l&&l.obj&&typeof l.obj[`${l.k}.${s}`]<"u"&&(l.obj=void 0);l.obj[`${l.k}.${s}`]=n},UW=(e,t,n,r)=>{const{obj:i,k:s}=Au(e,t,Object);i[s]=i[s]||[],i[s].push(n)},vh=(e,t)=>{const{obj:n,k:r}=Au(e,t);if(n)return n[r]},VW=(e,t,n)=>{const r=vh(e,n);return r!==void 0?r:vh(t,n)},VI=(e,t,n)=>{for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?rt(e[r])||e[r]instanceof String||rt(t[r])||t[r]instanceof String?n&&(e[r]=t[r]):VI(e[r],t[r],n):e[r]=t[r]);return e},ul=e=>e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&");var WW={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};const KW=e=>rt(e)?e.replace(/[&<>"'\/]/g,t=>WW[t]):e;class qW{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 YW=[" ",",","?","!",";"],GW=new qW(20),XW=(e,t,n)=>{t=t||"",n=n||"";const r=YW.filter(o=>t.indexOf(o)<0&&n.indexOf(o)<0);if(r.length===0)return!0;const i=GW.getRegExp(`(${r.map(o=>o==="?"?"\\?":o).join("|")})`);let s=!i.test(e);if(!s){const o=e.indexOf(n);o>0&&!i.test(e.substring(0,o))&&(s=!0)}return s},$x=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let i=e;for(let s=0;s<r.length;){if(!i||typeof i!="object")return;let o,l="";for(let c=s;c<r.length;++c)if(c!==s&&(l+=n),l+=r[c],o=i[l],o!==void 0){if(["string","number","boolean"].indexOf(typeof o)>-1&&c<r.length-1)continue;s+=c-s+1;break}i=o}return i},bh=e=>e&&e.replace("_","-"),JW={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 kh{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||JW,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,i){return i&&!this.debug?null:(rt(t[0])&&(t[0]=`${r}${this.prefix} ${t[0]}`),this.logger[n](t))}create(t){return new kh(this.logger,{prefix:`${this.prefix}:${t}:`,...this.options})}clone(t){return t=t||this.options,t.prefix=t.prefix||this.prefix,new kh(this.logger,t)}}var ms=new kh;class um{constructor(){this.observers={}}on(t,n){return t.split(" ").forEach(r=>{this.observers[r]||(this.observers[r]=new Map);const i=this.observers[r].get(n)||0;this.observers[r].set(n,i+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),i=1;i<n;i++)r[i-1]=arguments[i];this.observers[t]&&Array.from(this.observers[t].entries()).forEach(o=>{let[l,c]=o;for(let d=0;d<c;d++)l(...r)}),this.observers["*"]&&Array.from(this.observers["*"].entries()).forEach(o=>{let[l,c]=o;for(let d=0;d<c;d++)l.apply(l,[t,...r])})}}class MN extends um{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 i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,o=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let l;t.indexOf(".")>-1?l=t.split("."):(l=[t,n],r&&(Array.isArray(r)?l.push(...r):rt(r)&&s?l.push(...r.split(s)):l.push(r)));const c=vh(this.data,l);return!c&&!n&&!r&&t.indexOf(".")>-1&&(t=l[0],n=l[1],r=l.slice(2).join(".")),c||!o||!rt(r)?c:$x(this.data&&this.data[t]&&this.data[t][n],r,s)}addResource(t,n,r,i){let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const o=s.keySeparator!==void 0?s.keySeparator:this.options.keySeparator;let l=[t,n];r&&(l=l.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(l=t.split("."),i=n,n=l[1]),this.addNamespaces(n),ON(this.data,l,i),s.silent||this.emit("added",t,n,r,i)}addResources(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const s in r)(rt(r[s])||Array.isArray(r[s]))&&this.addResource(t,n,s,r[s],{silent:!0});i.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,i,s){let o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1,skipCopy:!1},l=[t,n];t.indexOf(".")>-1&&(l=t.split("."),i=r,r=n,n=l[1]),this.addNamespaces(n);let c=vh(this.data,l)||{};o.skipCopy||(r=JSON.parse(JSON.stringify(r))),i?VI(c,r,s):c={...c,...r},ON(this.data,l,c),o.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(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var WI={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(s=>{this.processors[s]&&(t=this.processors[s].process(t,n,r,i))}),t}};const $N={};class Sh extends um{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),BW(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=ms.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 i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let s=n.ns||this.options.defaultNS||[];const o=r&&t.indexOf(r)>-1,l=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!XW(t,r,i);if(o&&!l){const c=t.match(this.interpolator.nestingRegexp);if(c&&c.length>0)return{key:t,namespaces:rt(s)?[s]:s};const d=t.split(r);(r!==i||r===i&&this.options.ns.indexOf(d[0])>-1)&&(s=d.shift()),t=d.join(i)}return{key:t,namespaces:rt(s)?[s]:s}}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 i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,s=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:o,namespaces:l}=this.extractFromKey(t[t.length-1],n),c=l[l.length-1],d=n.lng||this.language,u=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(d&&d.toLowerCase()==="cimode"){if(u){const k=n.nsSeparator||this.options.nsSeparator;return i?{res:`${c}${k}${o}`,usedKey:o,exactUsedKey:o,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:`${c}${k}${o}`}return i?{res:o,usedKey:o,exactUsedKey:o,usedLng:d,usedNS:c,usedParams:this.getUsedParamsDetails(n)}:o}const p=this.resolve(t,n);let f=p&&p.res;const h=p&&p.usedKey||o,y=p&&p.exactUsedKey||o,b=Object.prototype.toString.apply(f),S=["[object Number]","[object Function]","[object RegExp]"],g=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,v=!this.i18nFormat||this.i18nFormat.handleAsObject,w=!rt(f)&&typeof f!="boolean"&&typeof f!="number";if(v&&f&&w&&S.indexOf(b)<0&&!(rt(g)&&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 k=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,f,{...n,ns:l}):`key '${o} (${this.language})' returned an object instead of string.`;return i?(p.res=k,p.usedParams=this.getUsedParamsDetails(n),p):k}if(s){const k=Array.isArray(f),E=k?[]:{},j=k?y:h;for(const P in f)if(Object.prototype.hasOwnProperty.call(f,P)){const O=`${j}${s}${P}`;E[P]=this.translate(O,{...n,joinArrays:!1,ns:l}),E[P]===O&&(E[P]=f[P])}f=E}}else if(v&&rt(g)&&Array.isArray(f))f=f.join(g),f&&(f=this.extendTranslation(f,t,n,r));else{let k=!1,E=!1;const j=n.count!==void 0&&!rt(n.count),P=Sh.hasDefaultValue(n),O=j?this.pluralResolver.getSuffix(d,n.count,n):"",F=n.ordinal&&j?this.pluralResolver.getSuffix(d,n.count,{ordinal:!1}):"",W=j&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),R=W&&n[`defaultValue${this.options.pluralSeparator}zero`]||n[`defaultValue${O}`]||n[`defaultValue${F}`]||n.defaultValue;!this.isValidLookup(f)&&P&&(k=!0,f=R),this.isValidLookup(f)||(E=!0,f=o);const q=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&E?void 0:f,$=P&&R!==f&&this.options.updateMissing;if(E||k||$){if(this.logger.log($?"updateKey":"missingKey",d,c,o,$?R:f),s){const A=this.resolve(o,{...n,keySeparator:!1});A&&A.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 H=[];const z=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&z&&z[0])for(let A=0;A<z.length;A++)H.push(z[A]);else this.options.saveMissingTo==="all"?H=this.languageUtils.toResolveHierarchy(n.lng||this.language):H.push(n.lng||this.language);const Y=(A,T,C)=>{const G=P&&C!==f?C:q;this.options.missingKeyHandler?this.options.missingKeyHandler(A,c,T,G,$,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(A,c,T,G,$,n),this.emit("missingKey",A,c,T,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&j?H.forEach(A=>{const T=this.pluralResolver.getSuffixes(A,n);W&&n[`defaultValue${this.options.pluralSeparator}zero`]&&T.indexOf(`${this.options.pluralSeparator}zero`)<0&&T.push(`${this.options.pluralSeparator}zero`),T.forEach(C=>{Y([A],o+C,n[`defaultValue${C}`]||R)})}):Y(H,o,R))}f=this.extendTranslation(f,t,n,p,r),E&&f===o&&this.options.appendNamespaceToMissingKey&&(f=`${c}:${o}`),(E||k)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${c}:${o}`:o,k?f:void 0):f=this.options.parseMissingKeyHandler(f))}return i?(p.res=f,p.usedParams=this.getUsedParamsDetails(n),p):f}extendTranslation(t,n,r,i,s){var o=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},r.lng||this.language||i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const d=rt(t)&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let u;if(d){const f=t.match(this.interpolator.nestingRegexp);u=f&&f.length}let p=r.replace&&!rt(r.replace)?r.replace:r;if(this.options.interpolation.defaultVariables&&(p={...this.options.interpolation.defaultVariables,...p}),t=this.interpolator.interpolate(t,p,r.lng||this.language||i.usedLng,r),d){const f=t.match(this.interpolator.nestingRegexp),h=f&&f.length;u<h&&(r.nest=!1)}!r.lng&&this.options.compatibilityAPI!=="v1"&&i&&i.res&&(r.lng=this.language||i.usedLng),r.nest!==!1&&(t=this.interpolator.nest(t,function(){for(var f=arguments.length,h=new Array(f),y=0;y<f;y++)h[y]=arguments[y];return s&&s[0]===h[0]&&!r.context?(o.logger.warn(`It seems you are nesting recursively key: ${h[0]} in key: ${n[0]}`),null):o.translate(...h,n)},r)),r.interpolation&&this.interpolator.reset()}const l=r.postProcess||this.options.postProcess,c=rt(l)?[l]:l;return t!=null&&c&&c.length&&r.applyPostProcessor!==!1&&(t=WI.handle(c,t,n,this.options&&this.options.postProcessPassResolved?{i18nResolved:{...i,usedParams:this.getUsedParamsDetails(r)},...r}:r,this)),t}resolve(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r,i,s,o,l;return rt(t)&&(t=[t]),t.forEach(c=>{if(this.isValidLookup(r))return;const d=this.extractFromKey(c,n),u=d.key;i=u;let p=d.namespaces;this.options.fallbackNS&&(p=p.concat(this.options.fallbackNS));const f=n.count!==void 0&&!rt(n.count),h=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),y=n.context!==void 0&&(rt(n.context)||typeof n.context=="number")&&n.context!=="",b=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);p.forEach(S=>{this.isValidLookup(r)||(l=S,!$N[`${b[0]}-${S}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(l)&&($N[`${b[0]}-${S}`]=!0,this.logger.warn(`key "${i}" for languages "${b.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),b.forEach(g=>{if(this.isValidLookup(r))return;o=g;const v=[u];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(v,u,g,S,n);else{let k;f&&(k=this.pluralResolver.getSuffix(g,n.count,n));const E=`${this.options.pluralSeparator}zero`,j=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(v.push(u+k),n.ordinal&&k.indexOf(j)===0&&v.push(u+k.replace(j,this.options.pluralSeparator)),h&&v.push(u+E)),y){const P=`${u}${this.options.contextSeparator}${n.context}`;v.push(P),f&&(v.push(P+k),n.ordinal&&k.indexOf(j)===0&&v.push(P+k.replace(j,this.options.pluralSeparator)),h&&v.push(P+E))}}let w;for(;w=v.pop();)this.isValidLookup(r)||(s=w,r=this.getResource(g,S,w,n))}))})}),{res:r,usedKey:i,exactUsedKey:s,usedLng:o,usedNS:l}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,i):this.resourceStore.getResource(t,n,r,i)}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&&!rt(t.replace);let i=r?t.replace:t;if(r&&typeof t.count<"u"&&(i.count=t.count),this.options.interpolation.defaultVariables&&(i={...this.options.interpolation.defaultVariables,...i}),!r){i={...i};for(const s of n)delete i[s]}return i}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 qg=e=>e.charAt(0).toUpperCase()+e.slice(1);class FN{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=ms.create("languageUtils")}getScriptPartFromCode(t){if(t=bh(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=bh(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(rt(t)&&t.indexOf("-")>-1){if(typeof Intl<"u"&&typeof Intl.getCanonicalLocales<"u")try{let i=Intl.getCanonicalLocales(t)[0];if(i&&this.options.lowerCaseLng&&(i=i.toLowerCase()),i)return i}catch{}const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=qg(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]=qg(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=qg(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 i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(s=>{if(s===i)return s;if(!(s.indexOf("-")<0&&i.indexOf("-")<0)&&(s.indexOf("-")>0&&i.indexOf("-")<0&&s.substring(0,s.indexOf("-"))===i||s.indexOf(i)===0&&i.length>1))return s})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),rt(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),i=[],s=o=>{o&&(this.isSupportedCode(o)?i.push(o):this.logger.warn(`rejecting language code not found in supportedLngs: ${o}`))};return rt(t)&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&s(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&s(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&s(this.getLanguagePartFromCode(t))):rt(t)&&s(this.formatLanguageCode(t)),r.forEach(o=>{i.indexOf(o)<0&&s(this.formatLanguageCode(o))}),i}}let QW=[{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}],ZW={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 e7=["v1","v2","v3"],t7=["v4"],DN={zero:0,one:1,two:2,few:3,many:4,other:5},n7=()=>{const e={};return QW.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:ZW[t.fc]}})}),e};class r7{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=ms.create("pluralResolver"),(!this.options.compatibilityJSON||t7.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=n7(),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=bh(t==="dev"?"en":t),i=n.ordinal?"ordinal":"cardinal",s=JSON.stringify({cleanedCode:r,type:i});if(s in this.pluralRulesCache)return this.pluralRulesCache[s];let o;try{o=new Intl.PluralRules(r,{type:i})}catch{if(!t.match(/-|_/))return;const c=this.languageUtils.getLanguagePartFromCode(t);o=this.getRule(c,n)}return this.pluralRulesCache[s]=o,o}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(i=>`${n}${i}`)}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((i,s)=>DN[i]-DN[s]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(t,i,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(t,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,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 i=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const s=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:s():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?s():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!e7.includes(this.options.compatibilityJSON)}}const zN=function(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,s=VW(e,t,n);return!s&&i&&rt(n)&&(s=$x(e,n,r),s===void 0&&(s=$x(t,n,r))),s},Yg=e=>e.replace(/\$/g,"$$$$");class i7{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=ms.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:i,prefix:s,prefixEscaped:o,suffix:l,suffixEscaped:c,formatSeparator:d,unescapeSuffix:u,unescapePrefix:p,nestingPrefix:f,nestingPrefixEscaped:h,nestingSuffix:y,nestingSuffixEscaped:b,nestingOptionsSeparator:S,maxReplaces:g,alwaysFormat:v}=t.interpolation;this.escape=n!==void 0?n:KW,this.escapeValue=r!==void 0?r:!0,this.useRawValueToEscape=i!==void 0?i:!1,this.prefix=s?ul(s):o||"{{",this.suffix=l?ul(l):c||"}}",this.formatSeparator=d||",",this.unescapePrefix=u?"":p||"-",this.unescapeSuffix=this.unescapePrefix?"":u||"",this.nestingPrefix=f?ul(f):h||ul("$t("),this.nestingSuffix=y?ul(y):b||ul(")"),this.nestingOptionsSeparator=S||",",this.maxReplaces=g||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,i){let s,o,l;const c=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{},d=h=>{if(h.indexOf(this.formatSeparator)<0){const g=zN(n,c,h,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(g,void 0,r,{...i,...n,interpolationkey:h}):g}const y=h.split(this.formatSeparator),b=y.shift().trim(),S=y.join(this.formatSeparator).trim();return this.format(zN(n,c,b,this.options.keySeparator,this.options.ignoreJSONStructure),S,r,{...i,...n,interpolationkey:b})};this.resetRegExp();const u=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,p=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:h=>Yg(h)},{regex:this.regexp,safeValue:h=>this.escapeValue?Yg(this.escape(h)):Yg(h)}].forEach(h=>{for(l=0;s=h.regex.exec(t);){const y=s[1].trim();if(o=d(y),o===void 0)if(typeof u=="function"){const S=u(t,s,i);o=rt(S)?S:""}else if(i&&Object.prototype.hasOwnProperty.call(i,y))o="";else if(p){o=s[0];continue}else this.logger.warn(`missed to pass in variable ${y} for interpolating ${t}`),o="";else!rt(o)&&!this.useRawValueToEscape&&(o=TN(o));const b=h.safeValue(o);if(t=t.replace(s[0],b),p?(h.regex.lastIndex+=o.length,h.regex.lastIndex-=s[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]:{},i,s,o;const l=(c,d)=>{const u=this.nestingOptionsSeparator;if(c.indexOf(u)<0)return c;const p=c.split(new RegExp(`${u}[ ]*{`));let f=`{${p[1]}`;c=p[0],f=this.interpolate(f,o);const h=f.match(/'/g),y=f.match(/"/g);(h&&h.length%2===0&&!y||y.length%2!==0)&&(f=f.replace(/'/g,'"'));try{o=JSON.parse(f),d&&(o={...d,...o})}catch(b){return this.logger.warn(`failed parsing options string in nesting for key ${c}`,b),`${c}${u}${f}`}return o.defaultValue&&o.defaultValue.indexOf(this.prefix)>-1&&delete o.defaultValue,c};for(;i=this.nestingRegexp.exec(t);){let c=[];o={...r},o=o.replace&&!rt(o.replace)?o.replace:o,o.applyPostProcessor=!1,delete o.defaultValue;let d=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const u=i[1].split(this.formatSeparator).map(p=>p.trim());i[1]=u.shift(),c=u,d=!0}if(s=n(l.call(this,i[1].trim(),o),o),s&&i[0]===t&&!rt(s))return s;rt(s)||(s=TN(s)),s||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),s=""),d&&(s=c.reduce((u,p)=>this.format(u,p,r.lng,{...r,interpolationkey:i[1].trim()}),s.trim())),t=t.replace(i[0],s),this.regexp.lastIndex=0}return t}}const s7=e=>{let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);t==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(o=>{if(o){const[l,...c]=o.split(":"),d=c.join(":").trim().replace(/^'+|'+$/g,""),u=l.trim();n[u]||(n[u]=d),d==="false"&&(n[u]=!1),d==="true"&&(n[u]=!0),isNaN(d)||(n[u]=parseInt(d,10))}})}return{formatName:t,formatOptions:n}},dl=e=>{const t={};return(n,r,i)=>{let s=i;i&&i.interpolationkey&&i.formatParams&&i.formatParams[i.interpolationkey]&&i[i.interpolationkey]&&(s={...s,[i.interpolationkey]:void 0});const o=r+JSON.stringify(s);let l=t[o];return l||(l=e(bh(r),i),t[o]=l),l(n)}};class o7{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=ms.create("formatter"),this.options=t,this.formats={number:dl((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return s=>i.format(s)}),currency:dl((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return s=>i.format(s)}),datetime:dl((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return s=>i.format(s)}),relativetime:dl((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return s=>i.format(s,r.range||"day")}),list:dl((n,r)=>{const i=new Intl.ListFormat(n,{...r});return s=>i.format(s)})},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()]=dl(n)}format(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const s=n.split(this.formatSeparator);if(s.length>1&&s[0].indexOf("(")>1&&s[0].indexOf(")")<0&&s.find(l=>l.indexOf(")")>-1)){const l=s.findIndex(c=>c.indexOf(")")>-1);s[0]=[s[0],...s.splice(1,l)].join(this.formatSeparator)}return s.reduce((l,c)=>{const{formatName:d,formatOptions:u}=s7(c);if(this.formats[d]){let p=l;try{const f=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||r;p=this.formats[d](l,h,{...u,...i,...f})}catch(f){this.logger.warn(f)}return p}else this.logger.warn(`there was no format function for ${d}`);return l},t)}}const a7=(e,t)=>{e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)};class l7 extends um{constructor(t,n,r){let i=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=i,this.logger=ms.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(t,n,r,i){const s={},o={},l={},c={};return t.forEach(d=>{let u=!0;n.forEach(p=>{const f=`${d}|${p}`;!r.reload&&this.store.hasResourceBundle(d,p)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?o[f]===void 0&&(o[f]=!0):(this.state[f]=1,u=!1,o[f]===void 0&&(o[f]=!0),s[f]===void 0&&(s[f]=!0),c[p]===void 0&&(c[p]=!0)))}),u||(l[d]=!0)}),(Object.keys(s).length||Object.keys(o).length)&&this.queue.push({pending:o,pendingCount:Object.keys(o).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(s),pending:Object.keys(o),toLoadLanguages:Object.keys(l),toLoadNamespaces:Object.keys(c)}}loaded(t,n,r){const i=t.split("|"),s=i[0],o=i[1];n&&this.emit("failedLoading",s,o,n),!n&&r&&this.store.addResourceBundle(s,o,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=>{UW(c.loaded,[s],o),a7(c,t),n&&c.errors.push(n),c.pendingCount===0&&!c.done&&(Object.keys(c.loaded).forEach(d=>{l[d]||(l[d]={});const u=c.loaded[d];u.length&&u.forEach(p=>{l[d][p]===void 0&&(l[d][p]=!0)})}),c.done=!0,c.errors.length?c.callback(c.errors):c.callback())}),this.emit("loaded",l),this.queue=this.queue.filter(c=>!c.done)}read(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,o=arguments.length>5?arguments[5]:void 0;if(!t.length)return o(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:i,wait:s,callback:o});return}this.readingCalls++;const l=(d,u)=>{if(this.readingCalls--,this.waitingReads.length>0){const p=this.waitingReads.shift();this.read(p.lng,p.ns,p.fcName,p.tried,p.wait,p.callback)}if(d&&u&&i<this.maxRetries){setTimeout(()=>{this.read.call(this,t,n,r,i+1,s*2,o)},s);return}o(d,u)},c=this.backend[r].bind(this.backend);if(c.length===2){try{const d=c(t,n);d&&typeof d.then=="function"?d.then(u=>l(null,u)).catch(l):l(null,d)}catch(d){l(d)}return}return c(t,n,l)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=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."),i&&i();rt(t)&&(t=this.languageUtils.toResolveHierarchy(t)),rt(n)&&(n=[n]);const s=this.queueLoad(t,n,r,i);if(!s.toLoad.length)return s.pending.length||i(),null;s.toLoad.forEach(o=>{this.loadOne(o)})}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("|"),i=r[0],s=r[1];this.read(i,s,"read",void 0,void 0,(o,l)=>{o&&this.logger.warn(`${n}loading namespace ${s} for language ${i} failed`,o),!o&&l&&this.logger.log(`${n}loaded namespace ${s} for language ${i}`,l),this.loaded(t,o,l)})}saveMissing(t,n,r,i,s){let o=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={...o,isUpdate:s},d=this.backend.create.bind(this.backend);if(d.length<6)try{let u;d.length===5?u=d(t,n,r,i,c):u=d(t,n,r,i),u&&typeof u.then=="function"?u.then(p=>l(null,p)).catch(l):l(null,u)}catch(u){l(u)}else d(t,n,r,i,l,c)}!t||!t[0]||this.store.addResource(t[0],n,r,i)}}}const BN=()=>({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]),rt(e[1])&&(t.defaultValue=e[1]),rt(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}}),HN=e=>(rt(e.ns)&&(e.ns=[e.ns]),rt(e.fallbackLng)&&(e.fallbackLng=[e.fallbackLng]),rt(e.fallbackNS)&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e),tp=()=>{},c7=e=>{Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})};class pd extends um{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=HN(t),this.services={},this.logger=ms,this.modules={external:[]},c7(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&&(rt(n.ns)?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=BN();this.options={...i,...this.options,...HN(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);const s=u=>u?typeof u=="function"?new u:u:null;if(!this.options.isClone){this.modules.logger?ms.init(s(this.modules.logger),this.options):ms.init(null,this.options);let u;this.modules.formatter?u=this.modules.formatter:typeof Intl<"u"&&(u=o7);const p=new FN(this.options);this.store=new MN(this.options.resources,this.options);const f=this.services;f.logger=ms,f.resourceStore=this.store,f.languageUtils=p,f.pluralResolver=new r7(p,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),u&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=s(u),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new i7(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new l7(s(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(h){for(var y=arguments.length,b=new Array(y>1?y-1:0),S=1;S<y;S++)b[S-1]=arguments[S];t.emit(h,...b)}),this.modules.languageDetector&&(f.languageDetector=s(this.modules.languageDetector),f.languageDetector.init&&f.languageDetector.init(f,this.options.detection,this.options)),this.modules.i18nFormat&&(f.i18nFormat=s(this.modules.i18nFormat),f.i18nFormat.init&&f.i18nFormat.init(this)),this.translator=new Sh(this.services,this.options),this.translator.on("*",function(h){for(var y=arguments.length,b=new Array(y>1?y-1:0),S=1;S<y;S++)b[S-1]=arguments[S];t.emit(h,...b)}),this.modules.external.forEach(h=>{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=tp),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const u=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);u.length>0&&u[0]!=="dev"&&(this.options.lng=u[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(u=>{this[u]=function(){return t.store[u](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(u=>{this[u]=function(){return t.store[u](...arguments),t}});const c=tu(),d=()=>{const u=(p,f)=>{this.isInitializing=!1,this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),c.resolve(f),r(p,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return u(null,this.t.bind(this));this.changeLanguage(this.options.lng,u)};return this.options.resources||!this.options.initImmediate?d():setTimeout(d,0),c}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:tp;const i=rt(t)?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode"&&(!this.options.preload||this.options.preload.length===0))return r();const s=[],o=l=>{if(!l||l==="cimode")return;this.services.languageUtils.toResolveHierarchy(l).forEach(d=>{d!=="cimode"&&s.indexOf(d)<0&&s.push(d)})};i?o(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(c=>o(c)),this.options.preload&&this.options.preload.forEach(l=>o(l)),this.services.backendConnector.load(s,this.options.ns,l=>{!l&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(l)})}else r(null)}reloadResources(t,n,r){const i=tu();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=tp),this.services.backendConnector.reload(t,n,s=>{i.resolve(),r(s)}),i}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"&&WI.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 i=tu();this.emit("languageChanging",t);const s=c=>{this.language=c,this.languages=this.services.languageUtils.toResolveHierarchy(c),this.resolvedLanguage=void 0,this.setResolvedLanguage(c)},o=(c,d)=>{d?(s(d),this.translator.changeLanguage(d),this.isLanguageChangingTo=void 0,this.emit("languageChanged",d),this.logger.log("languageChanged",d)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(c,function(){return r.t(...arguments)})},l=c=>{!t&&!c&&this.services.languageDetector&&(c=[]);const d=rt(c)?c:this.services.languageUtils.getBestMatchFromCodes(c);d&&(this.language||s(d),this.translator.language||this.translator.changeLanguage(d),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(d)),this.loadResources(d,u=>{o(u,d)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?l(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(l):this.services.languageDetector.detect(l):l(t),i}getFixedT(t,n,r){var i=this;const s=function(o,l){let c;if(typeof l!="object"){for(var d=arguments.length,u=new Array(d>2?d-2:0),p=2;p<d;p++)u[p-2]=arguments[p];c=i.options.overloadTranslationOptionHandler([o,l].concat(u))}else c={...l};c.lng=c.lng||s.lng,c.lngs=c.lngs||s.lngs,c.ns=c.ns||s.ns,c.keyPrefix!==""&&(c.keyPrefix=c.keyPrefix||r||s.keyPrefix);const f=i.options.keySeparator||".";let h;return c.keyPrefix&&Array.isArray(o)?h=o.map(y=>`${c.keyPrefix}${f}${y}`):h=c.keyPrefix?`${c.keyPrefix}${f}${o}`:o,i.t(h,c)};return rt(t)?s.lng=t:s.lngs=t,s.ns=n,s.keyPrefix=r,s}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],i=this.options?this.options.fallbackLng:!1,s=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const o=(l,c)=>{const d=this.services.backendConnector.state[`${l}|${c}`];return d===-1||d===0||d===2};if(n.precheck){const l=n.precheck(this,o);if(l!==void 0)return l}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||o(r,t)&&(!i||o(s,t)))}loadNamespaces(t,n){const r=tu();return this.options.ns?(rt(t)&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=tu();rt(t)&&(t=[t]);const i=this.options.preload||[],s=t.filter(o=>i.indexOf(o)<0&&this.services.languageUtils.isSupportedCode(o));return s.length?(this.options.preload=i.concat(s),this.loadResources(o=>{r.resolve(),n&&n(o)}),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 FN(BN());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 pd(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:tp;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},s=new pd(i);return(t.debug!==void 0||t.prefix!==void 0)&&(s.logger=s.logger.clone(t)),["store","services","language"].forEach(l=>{s[l]=this[l]}),s.services={...this.services},s.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},r&&(s.store=new MN(this.store.data,i),s.services.resourceStore=s.store),s.translator=new Sh(s.services,i),s.translator.on("*",function(l){for(var c=arguments.length,d=new Array(c>1?c-1:0),u=1;u<c;u++)d[u-1]=arguments[u];s.emit(l,...d)}),s.init(i,n),s.translator.options=i,s.translator.backendConnector.services.utils={hasLoadedNamespace:s.hasLoadedNamespace.bind(s)},s}toJSON(){return{options:this.options,store:this.store,language:this.language,languages:this.languages,resolvedLanguage:this.resolvedLanguage}}}const Xn=pd.createInstance();Xn.createInstance=pd.createInstance;Xn.createInstance;Xn.dir;Xn.init;Xn.loadResources;Xn.reloadResources;Xn.use;Xn.changeLanguage;Xn.getFixedT;Xn.t;Xn.exists;Xn.setDefaultNamespace;Xn.hasLoadedNamespace;Xn.loadNamespaces;Xn.loadLanguages;function u7(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function hd(e){"@babel/helpers - typeof";return hd=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},hd(e)}function d7(e,t){if(hd(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(hd(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function f7(e){var t=d7(e,"string");return hd(t)=="symbol"?t:t+""}function p7(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,f7(r.key),r)}}function h7(e,t,n){return t&&p7(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}var KI=[],m7=KI.forEach,g7=KI.slice;function y7(e){return m7.call(g7.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}var UN=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,x7=function(t,n,r){var i=r||{};i.path=i.path||"/";var s=encodeURIComponent(n),o="".concat(t,"=").concat(s);if(i.maxAge>0){var l=i.maxAge-0;if(Number.isNaN(l))throw new Error("maxAge should be a Number");o+="; Max-Age=".concat(Math.floor(l))}if(i.domain){if(!UN.test(i.domain))throw new TypeError("option domain is invalid");o+="; Domain=".concat(i.domain)}if(i.path){if(!UN.test(i.path))throw new TypeError("option path is invalid");o+="; Path=".concat(i.path)}if(i.expires){if(typeof i.expires.toUTCString!="function")throw new TypeError("option expires is invalid");o+="; Expires=".concat(i.expires.toUTCString())}if(i.httpOnly&&(o+="; HttpOnly"),i.secure&&(o+="; Secure"),i.sameSite){var c=typeof i.sameSite=="string"?i.sameSite.toLowerCase():i.sameSite;switch(c){case!0:o+="; SameSite=Strict";break;case"lax":o+="; SameSite=Lax";break;case"strict":o+="; SameSite=Strict";break;case"none":o+="; SameSite=None";break;default:throw new TypeError("option sameSite is invalid")}}return o},VN={create:function(t,n,r,i){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{path:"/",sameSite:"strict"};r&&(s.expires=new Date,s.expires.setTime(s.expires.getTime()+r*60*1e3)),i&&(s.domain=i),document.cookie=x7(t,encodeURIComponent(n),s)},read:function(t){for(var n="".concat(t,"="),r=document.cookie.split(";"),i=0;i<r.length;i++){for(var s=r[i];s.charAt(0)===" ";)s=s.substring(1,s.length);if(s.indexOf(n)===0)return s.substring(n.length,s.length)}return null},remove:function(t){this.create(t,"",-1)}},w7={name:"cookie",lookup:function(t){var n;if(t.lookupCookie&&typeof document<"u"){var r=VN.read(t.lookupCookie);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupCookie&&typeof document<"u"&&VN.create(n.lookupCookie,t,n.cookieMinutes,n.cookieDomain,n.cookieOptions)}},v7={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 i=r.substring(1),s=i.split("&"),o=0;o<s.length;o++){var l=s[o].indexOf("=");if(l>0){var c=s[o].substring(0,l);c===t.lookupQuerystring&&(n=s[o].substring(l+1))}}}return n}},nu=null,WN=function(){if(nu!==null)return nu;try{nu=window!=="undefined"&&window.localStorage!==null;var t="i18next.translate.boo";window.localStorage.setItem(t,"foo"),window.localStorage.removeItem(t)}catch{nu=!1}return nu},b7={name:"localStorage",lookup:function(t){var n;if(t.lookupLocalStorage&&WN()){var r=window.localStorage.getItem(t.lookupLocalStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupLocalStorage&&WN()&&window.localStorage.setItem(n.lookupLocalStorage,t)}},ru=null,KN=function(){if(ru!==null)return ru;try{ru=window!=="undefined"&&window.sessionStorage!==null;var t="i18next.translate.boo";window.sessionStorage.setItem(t,"foo"),window.sessionStorage.removeItem(t)}catch{ru=!1}return ru},k7={name:"sessionStorage",lookup:function(t){var n;if(t.lookupSessionStorage&&KN()){var r=window.sessionStorage.getItem(t.lookupSessionStorage);r&&(n=r)}return n},cacheUserLanguage:function(t,n){n.lookupSessionStorage&&KN()&&window.sessionStorage.setItem(n.lookupSessionStorage,t)}},S7={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}},N7={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}},j7={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}},C7={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]}},qI=!1;try{document.cookie,qI=!0}catch{}var YI=["querystring","cookie","localStorage","sessionStorage","navigator","htmlTag"];qI||YI.splice(1,1);function E7(){return{order:YI,lookupQuerystring:"lng",lookupCookie:"i18next",lookupLocalStorage:"i18nextLng",lookupSessionStorage:"i18nextLng",caches:["localStorage"],excludeCacheFor:["cimode"],convertDetectedLanguage:function(t){return t}}}var GI=function(){function e(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};u7(this,e),this.type="languageDetector",this.detectors={},this.init(t,n)}return h7(e,[{key:"init",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n||{languageUtils:{}},this.options=y7(r,this.options||{},E7()),typeof this.options.convertDetectedLanguage=="string"&&this.options.convertDetectedLanguage.indexOf("15897")>-1&&(this.options.convertDetectedLanguage=function(s){return s.replace("-","_")}),this.options.lookupFromUrlIndex&&(this.options.lookupFromPathIndex=this.options.lookupFromUrlIndex),this.i18nOptions=i,this.addDetector(w7),this.addDetector(v7),this.addDetector(b7),this.addDetector(k7),this.addDetector(S7),this.addDetector(N7),this.addDetector(j7),this.addDetector(C7)}},{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 i=[];return n.forEach(function(s){if(r.detectors[s]){var o=r.detectors[s].lookup(r.options);o&&typeof o=="string"&&(o=[o]),o&&(i=i.concat(o))}}),i=i.map(function(s){return r.options.convertDetectedLanguage(s)}),this.services.languageUtils.getBestMatchFromCodes?i:i.length>0?i[0]:null}},{key:"cacheUserLanguage",value:function(n,r){var i=this;r||(r=this.options.caches),r&&(this.options.excludeCacheFor&&this.options.excludeCacheFor.indexOf(n)>-1||r.forEach(function(s){i.detectors[s]&&i.detectors[s].cacheUserLanguage(n,i.options)}))}}])}();GI.type="languageDetector";const _7={name:"AgentFlow",tagline:"AI Workflow Orchestration"},P7={projects:"Projects",nodes:"Nodes",myNodes:"My Nodes",myFlows:"My Flows",skills:"Skills",flowEditor:"Flow Editor",settings:"Settings",back:"Back"},I7={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"},A7={success:"Success",failed:"Failed",pending:"Pending",running:"Running",skipped:"Skipped"},T7={agent:"Agent",control:"Control",tool:"Tool",start:"Start",end:"End"},R7={online:"Engine Online",offline:"Engine Offline",connecting:"Connecting…"},L7={hub:"AgentFlow Hub",docs:"Documentation",github:"GitHub Repository"},O7={app:_7,nav:P7,common:I7,status:A7,nodeTypes:T7,engine:R7,links:L7},M7="Flow Editor",$7="Nodes",F7="Edges",D7="Properties",z7={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"},B7={title:"Node Properties",noInputPins:"No input pins",noOutputPins:"No output pins",type:"Type",name:"Name",defaultValue:"Default / value",required:"Req",showOnNode:"Card",requiredHint:"Mark this pin as required so users know it must be connected or given a value",showOnNodeHint:"Show this pin name on the canvas node card; hidden pins can still be connected",pinRequiredAriaLabel:"{{label}} {{index}} required",pinShowOnNodeAriaLabel:"{{label}} {{index}} show on node card",conversationOutput:"Conversation & Output",addPin:"Add Pin",addPinAriaLabel:"Add {{label}}",handleHint:"Matches Handle index on canvas ({{prefix}}-0, {{prefix}}-1…). After adding/removing/reordering, existing connections may break — check validation after saving.",handle:"Handle",pinTypeAriaLabel:"{{label}} {{index}} type",pinNameAriaLabel:"{{label}} {{index}} name",pinDefaultAriaLabel:"{{label}} {{index}} default",deletePinAriaLabel:"Delete {{label}} {{index}}",deletePin:"Delete this pin",instanceId:"Node ID",yamlValueNotInList:"(YAML value, not in current list)",inputPins:"Input Pins (INPUT)",outputPins:"Output Pins (OUTPUT)",expand:"Expand",collapse:"Collapse",expandEditScript:"Expand edit script",expandEdit:"Expand edit",editScript:"Edit script",editUserPrompt:"Edit user prompt",scriptPlaceholder:"instances.*.script — full shell command; supports ${workspaceRoot}, ${pipelineWorkspace}, ${flowDir}, ${runDir} and slot names (don't quote placeholders)",scriptPlaceholderExpand:"instances.*.script — full shell command; don't quote ${workspaceRoot}, ${pipelineWorkspace}, ${flowDir} placeholders",bodyPlaceholder:"instances.*.body — supports multiline and ${variables}; type ${ to pick a slot",bodyPlaceholderExpand:"instances.*.body — supports multiline and ${variables}",noDescription:"(No description in current node definition)",modelAriaLabel:"Model",placeholderSlots:"Placeholders: input/output slots",publishToMarketplace:"Publish Node",publishToMarketplaceHint:"Publish the current node to the workspace local marketplace",publishing:"Publishing…",publishRunning:"Publishing to local marketplace…",publishSuccess:"Node published to local marketplace",publishSuccessWithId:"Node published: {{id}}"},H7={run:"Run Flow",stop:"Stop",resume:"Resume",validate:"Validate",export:"Export",import:"Import"},U7={nodeList:"Node List",runHistory:"Run History",validation:"Validation Results"},V7={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"},W7={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)"},K7={saving:"Saving...",saved:"Saved",saveFailed:"Save failed",runInTerminal:"Please use terminal to run"},q7={requirement:"Requirement Analysis",planning:"Technical Planning",code:"Code Execution",test:"Test Regression",normal:"Normal"},Y7={phase:"Phase",allPhasesComplete:"All phases completed",currentPhaseComplete:"Current phase completed, waiting for confirmation..."},G7={node:"Node",text:"Text",file:"File",bool:"Boolean"},X7={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"},J7={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",selectAll:"Select all nodes"},Q7={title:"Jump to node",placeholder:"Type node ID or label…",empty:"No matching nodes",hintNavigate:"navigate",hintJump:"jump",hintClose:"close"},Z7={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."},eK={mainNav:"Main Navigation"},tK={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'},nK={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):
138
- {{summary}}`,step:"Step {{current}}/{{total}}: {{description}}",phaseGeneration:`Phased generation ({{count}} phases): {{labels}}
139
- 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}}"},rK={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"},iK={nodePalette:"Node Palette",noPipelineSelected:"No pipeline selected",moreRuns:"+{{count}} more",moreFlows:"+{{count}} more flows",runId:"Run ID: {{id}}"},sK={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}}"},oK={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"},aK={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"},lK={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"},cK={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"},uK={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"},dK={invalidPlaceholder:"Invalid placeholder: {{hint}}",empty:"(empty)",inputSubtitle:"Input · {{type}}",inputSubtitleNoType:"Input",outputSubtitle:"Output · {{type}}",outputSubtitleNoType:"Output",runtimeConst:"Runtime constant"},fK={justNow:"Just now",minutesAgo:"{{n}} min ago",hoursAgo:"{{n}} hr ago",yesterday:"Yesterday",daysAgo:"{{n}} days ago",milliseconds:"{{n}} ms",seconds:"{{n}} s"},pK={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"},hK={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."},mK={title:"Print Output: {{instanceId}}",expand:"Expand",restore:"Restore"},gK={save:"Save",cancel:"Cancel"},yK={title:"Run with Params",noParams:"No input params in this flow",run:"Run",cancel:"Cancel"},xK={title:"Run with Preset",noPresets:"No presets available",default:"Default run",run:"Run",cancel:"Cancel"},wK={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"},vK={title:M7,nodes:$7,edges:F7,properties:D7,node:z7,nodeProps:B7,actions:H7,panel:U7,palette:V7,pipeline:W7,status:K7,roles:q7,phases:Y7,types:G7,runContext:X7,shortcuts:J7,jumpPalette:Q7,emptyCanvas:Z7,sidebar:eK,validation:tK,composer:nK,topbar:rK,palette2:iK,run:sK,fileEdit:oK,settings:aK,schedule:lK,history:cK,nodePropsError:uK,placeholder:dK,time:fK,userCheck:pK,userAsk:hK,toolPrint:mK,provideEdit:gK,runParams:yK,runPreset:xK,runConfig:wK},bK="Settings",kK={engine:"Engine Settings",preferences:"Global Preferences"},SK={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)."},NK={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..."}},jK={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."},CK={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."},EK={title:"Environment Variables",note:"Private to the current signed-in user; overrides service-level env at runtime",saving:"Saving...",key:"Key",value:"Value",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)"},_K={title:"System Status",normal:"Service normal",abnormal:"Some interfaces abnormal",cursorModels:"Cursor Models",opencodeModels:"OpenCode Models",claudeCodeModels:"Claude Code Models"},PK={title:"Shortcuts",projects:"Projects & Pipelines",flowEditor:"Node Canvas"},IK={title:"Language",description:"Select your preferred language for the interface",options:{zh:"中文",en:"English",ja:"日本語"}},AK={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."},TK={title:bK,crumb:kK,workspace:SK,cursor:NK,opencode:jK,claudeCode:CK,env:EK,system:_K,shortcuts:PK,language:IK,onboarding:AK},RK={thinking:"Thinking",result:"Result",reply:"Reply",error:"Error"},LK={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)"},OK={send:"Send",stop:"Stop",expand:"Expand",collapse:"Collapse",clear:"Clear"},MK={conversation:"Chat",conversationWithNumber:"Chat {{num}}",default:"Default"},$K={endSession:"End chat (will stop generation)",closeSession:"Close chat",newSession:"New chat",expandComposer:"Expand chat and output"},FK={hint:"Use the bottom input box for AI chat, with @node mentions, model selection, and more"},DK={aiLabels:RK,placeholders:LK,actions:OK,labels:MK,tooltips:$K,rightPanel:FK},zK="Projects",BK="All",HK="Archived",UK="Nodes",VK="My Nodes",WK="My Flows",KK="Skills",qK="Active Projects",YK="Archived Pipelines",GK="Global Nodes",XK="Manage node versions published to the current workspace marketplace, {{count}} total.",JK="Manage flow snippets published to the current workspace marketplace, {{count}} total.",QK="Global Skills",ZK="Create New Project",eq="New Pipeline",tq="SEARCH PIPELINES...",nq="SEARCH NODES...",rq="SEARCH FLOW SNIPPETS...",iq="SEARCH SKILLS...",sq="Refresh Resources",oq="Loading pipelines...",aq="Loading global resources...",lq="Filter result: {{count}} items (matching title, description, path and tags)",cq="Archived pipelines can still be opened and edited; files are located in the _archived subdirectory of each pipelines directory.",uq="Manage your distributed node architectures and monitoring pipelines. Drag flow.yaml or .zip into this page to import shared flows.",dq="Review all globally available node definitions, {{count}} total, including built-in, workspace, and marketplace nodes.",fq="Review Composer-selectable skills, {{count}} total, including AgentFlow built-ins and workspace skills.",pq="Executable building blocks for pipeline runtime",hq="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.",mq="Published local node packages",gq="Only node versions published to this workspace marketplace appear here. Inspect details and delete versions that no flow uses.",yq="Published flow snippets",xq="Flow snippets published from Pipeline or Workspace canvases appear here. Search and inspect them, then load them from the canvas flow palette.",wq="Operating guides for Composer and agents",vq="Skills tell AI which rules to follow for a task, how to change flows, and how to reuse project conventions.",bq="No archived projects.",kq="No active pipelines; archived items are in the Archived tab.",Sq="No global nodes available.",Nq="No marketplace nodes have been published.",jq="No flow snippets have been published. Select multiple canvas nodes and publish them first.",Cq="No skills available.",Eq="No description.",_q='No node matches "{{query}}".',Pq='No flow snippet matches "{{query}}".',Iq='No skill matches "{{query}}".',Aq="{{inputs}} in / {{outputs}} out",Tq="Flow Snippet",Rq="{{nodes}} nodes / {{edges}} edges",Lq="Skill",Oq="Node detail",Mq="Flow snippet detail",$q="Skill detail",Fq="Type",Dq="Source",zq="Package",Bq="Version",Hq="Path",Uq="Editable",Vq="Read only",Wq="Editable",Kq="Schema",qq="Inputs",Yq="Outputs",Gq="Runtime",Xq="Node Body",Jq="Files",Qq="Usage",Zq="No runtime manifest.",eY="No node body or README.",tY="No previewable files.",nY="Select a file to preview.",rY="Binary file preview is not supported.",iY="Large file; showing the first 256KB only.",sY="No pipelines using this node were found.",oY="Node Management",aY="Delete Node Version",lY="Deleting...",cY="AgentFlow checks all flow references before deleting; installed or used versions are kept.",uY="Delete {{id}}@{{version}}? This cannot be undone.",dY="Deleted {{id}}@{{version}}.",fY="{{count}} flow(s) still use it.",pY="No slots",hY="Purpose",mY="This node is an execution unit in a pipeline. Its schema affects canvas wiring, parameter input, and runtime scheduling.",gY="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.",yY="Scale",xY="Snippet JSON",wY="This skill is injected into Composer as context for AI, constraining its decisions, edit strategy, and output format.",vY="SKILL.md Preview",bY="No preview content available.",kY="Select a resource to inspect details.",SY="Failed to load pipeline list.",NY="No pipelines in current workspace.",jY="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.",CY='No pipelines found matching "{{query}}". Try different keywords or clear the search.',EY="Recent Activity",_Y="No recent activity",PY="No recent activity matching the keyword",IY="Recent Run",AY="Recent Open",TY={builtin:"Built-in",workspace:"Workspace",user:"User"},RY={flow:"Flow",global:"Global",marketplace:"Marketplace"},LY={all:"All",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},OY={overview:"Overview",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},MY="Open to edit this pipeline in the node canvas.",$Y={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>"},FY={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"},DY={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"},zY={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"},BY={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"},HY={title:zK,all:BK,archived:HK,nodes:UK,myNodes:VK,myFlows:WK,skills:KK,activeProjects:qK,archivedPipelines:YK,globalNodes:GK,myNodesHint:XK,myFlowsHint:JK,globalSkills:QK,createNew:ZK,newPipeline:eq,searchPipelines:tq,searchNodes:nq,searchFlows:rq,searchSkills:iq,refreshResources:sq,loadingPipelines:oq,loadingResources:aq,filterResult:lq,archivedHint:cq,activeHint:uq,nodesHint:dq,skillsHint:fq,nodesPurposeTitle:pq,nodesPurposeDesc:hq,myNodesPurposeTitle:mq,myNodesPurposeDesc:gq,myFlowsPurposeTitle:yq,myFlowsPurposeDesc:xq,skillsPurposeTitle:wq,skillsPurposeDesc:vq,noArchived:bq,noActive:kq,noNodes:Sq,noMyNodes:Nq,noMyFlows:jq,noSkills:Cq,noDescription:Eq,noNodeMatch:_q,noFlowSnippetMatch:Pq,noSkillMatch:Iq,nodeSlots:Aq,flowSnippet:Tq,flowSnippetNodes:Rq,skill:Lq,nodeDetail:Oq,flowDetail:Mq,skillDetail:$q,detailType:Fq,detailSource:Dq,detailPackage:zq,detailVersion:Bq,detailPath:Hq,detailEditable:Uq,readOnly:Vq,editable:Wq,nodeSchema:Kq,nodeInputs:qq,nodeOutputs:Yq,nodeRuntime:Gq,nodeBody:Xq,nodeFiles:Jq,nodeUsage:Qq,noRuntimeManifest:Zq,noNodeBody:eY,noNodeFiles:tY,selectNodeFile:nY,binaryFile:rY,fileTruncated:iY,noNodeUsage:sY,myNodeManagement:oY,deleteMyNode:aY,deletingMyNode:lY,deleteMyNodeHint:cY,deleteMyNodeConfirm:uY,deleteMyNodeSuccess:dY,deleteMyNodeUsedBy:fY,noSlots:pY,resourceMeaning:hY,nodesMeaning:mY,myFlowsMeaning:gY,flowSnippetScale:yY,flowSnippetPreview:xY,skillsMeaning:wY,skillPreview:vY,skillPreviewEmpty:bY,selectResource:kY,loadFailed:SY,noPipelines:NY,emptyHint:jY,noMatch:CY,recentActivity:EY,noRecentActivity:_Y,noMatchRecent:PY,recentRun:IY,recentOpen:AY,sourceBadge:TY,resourceSource:RY,resourceFilter:LY,nodeDetailTabs:OY,defaultCardDesc:MY,hubCard:$Y,newPipelineModal:FY,importModal:DY,deleteModal:zY,archiveModal:BY},UY="Back",VY="Next",WY="Skip",KY="Done",qY="Start Creating",YY={intro:`Welcome to AgentFlow! This is a visual workflow orchestration tool.
140
-
141
- Click the button below to create your first pipeline.`,hubIntro:`Don't want to start from scratch?
142
-
143
- Browse ready-made pipelines on AgentFlow Hub — community-shared flows you can install and run in one click.`},GY={intro:`Now you're in the flow editor.
144
-
145
- Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
146
-
147
- The left node panel allows you to freely drag, delete, and adjust connections.`,introEmpty:`The canvas is empty. Start creating your flow!
148
-
149
- Describe your requirements in natural language in the input box below, and AI will generate the flow graph.
150
-
151
- The left node panel allows you to freely drag, delete, and adjust connections.`},XY={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"},JY={back:UY,next:VY,skip:WY,done:KY,startCreate:qY,projects:YY,flow:GY,newPipeline:XY},QY={name:"AgentFlow",tagline:"AI 工作流编排"},ZY={projects:"项目",nodes:"Nodes",myNodes:"我的 Nodes",myFlows:"我的流程",skills:"Skills",flowEditor:"流程编辑器",settings:"设置",back:"返回"},eG={loading:"加载中…",saving:"保存中…",save:"保存",cancel:"取消",delete:"删除",edit:"编辑",create:"创建",close:"关闭",confirm:"确认",copy:"复制",copied:"已复制!",refresh:"刷新",search:"搜索",filter:"筛选",success:"成功",error:"错误",warning:"警告",info:"信息",done:"完成",pending:"待处理",running:"运行中",notFound:"未找到",required:"必填",optional:"可选"},tG={success:"成功",failed:"失败",pending:"等待",running:"运行中",skipped:"跳过"},nG={agent:"Agent 节点",control:"控制节点",tool:"工具节点",start:"开始",end:"结束"},rG={online:"引擎在线",offline:"引擎离线",connecting:"连接中…"},iG={hub:"AgentFlow Hub",docs:"文档",github:"GitHub 仓库"},sG={app:QY,nav:ZY,common:eG,status:tG,nodeTypes:nG,engine:rG,links:iG},oG="流程编辑器",aG="节点",lG="连线",cG="属性",uG={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:"编辑内容"},dG={title:"节点属性",noInputPins:"当前无输入引脚",noOutputPins:"当前无输出引脚",type:"类型",name:"名称",defaultValue:"默认值 / value",required:"必填",showOnNode:"卡片",requiredHint:"标记为必填,用于提示用户该槽位必须提供值或连线",showOnNodeHint:"是否在画布节点卡片旁展示这个引脚名称;关闭后仍可连线",pinRequiredAriaLabel:"{{label}} {{index}} 是否必填",pinShowOnNodeAriaLabel:"{{label}} {{index}} 是否在节点卡片展示",conversationOutput:"对话与输出",addPin:"添加引脚",addPinAriaLabel:"添加{{label}}",handleHint:"与画布上 Handle 序号一致({{prefix}}-0、{{prefix}}-1…)。增删或调整顺序后,原有连线可能失效,保存后请留意校验提示。",handle:"Handle",pinTypeAriaLabel:"{{label}} {{index}} 类型",pinNameAriaLabel:"{{label}} {{index}} 名称",pinDefaultAriaLabel:"{{label}} {{index}} 默认值",deletePinAriaLabel:"删除 {{label}} {{index}}",deletePin:"删除此引脚",instanceId:"节点 ID",yamlValueNotInList:"(YAML 中的值,不在当前列表)",inputPins:"输入引脚(INPUT)",outputPins:"输出引脚(OUTPUT)",expand:"展开",collapse:"收起",expandEditScript:"展开编辑 script",expandEdit:"展开编辑",editScript:"编辑 script",editUserPrompt:"编辑用户提示",scriptPlaceholder:"instances.*.script,完整 shell 命令;支持 ${workspaceRoot}、${pipelineWorkspace}、${flowDir}、${runDir} 与各槽位名(勿对占位符再包双引号)",scriptPlaceholderExpand:"instances.*.script,完整 shell 命令;勿对 ${workspaceRoot}、${pipelineWorkspace}、${flowDir} 等占位符再包双引号",bodyPlaceholder:"instances.*.body,支持多行与 ${变量};输入 ${ 选择槽位",bodyPlaceholderExpand:"instances.*.body,支持多行与 ${变量}",noDescription:"(当前节点定义无 description)",modelAriaLabel:"模型",placeholderSlots:"占位符:输入输出槽位",publishToMarketplace:"发布节点",publishToMarketplaceHint:"将当前节点发布到 Workspace 本地节点市场",publishing:"发布中…",publishRunning:"正在发布到本地节点市场…",publishSuccess:"节点已发布到本地节点市场",publishSuccessWithId:"节点已发布:{{id}}"},fG={run:"运行流程",stop:"停止",resume:"继续",validate:"校验",export:"导出",import:"导入"},pG={nodeList:"节点列表",runHistory:"运行历史",validation:"校验结果"},hG={workspace:"工作区",loading:"加载中…",archived:"已归档",noPipelines:"暂无流水线",more:"更多",moreFlows:"更多流程",noRuns:"暂无运行记录",searchNodes:"搜索节点",noComponents:"暂无可用组件(检查节点库目录)",noMatch:"无匹配节点,请调整搜索词",selectPipeline:"从上方选择一条流水线以加载组件与画布",validationWarnings:"校验警告(与 agentflow validate 槽位检查一致)",output:"输出",model:"模型",userDir:"用户目录",toggleRecentActivity:"展开或收起最近打开或最近运行"},mG={selectPipeline:"请从顶部下拉选择一条流水线",loadingProps:"加载节点属性…",pipelineId:"流水线 ID",diskPath:"磁盘路径",storageLocation:"存储位置",introduction:"介绍",introductionPlaceholder:"简要描述这条流水线的用途(写入 flow.yaml 的 ui.description)",metadata:"元数据",nodeCount:"节点数",nodesUnit:"个节点",loading:"加载中…",noRuns:"暂无运行记录(终端执行后会在工作区生成运行目录)"},gG={saving:"保存中…",saved:"已保存",saveFailed:"保存失败",runInTerminal:"运行请使用终端"},yG={requirement:"需求拆解",planning:"技术规划",code:"代码执行",test:"测试回归",normal:"普通"},xG={phase:"阶段",allPhasesComplete:"所有阶段完成",currentPhaseComplete:"当前阶段完成,等待确认继续…"},wG={node:"节点",text:"文本",file:"文件",bool:"布尔"},vG={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:"等待"},bG={title:"快捷键",general:"常规",saveDesc:"保存;节点属性侧栏打开时先提交节点再保存 flow",shortcutsLabel:"快捷键",jumpToNode:"按 ID 跳转到节点",openNodePalette:"打开节点面板",canvas:"画布",selectTool:"选择工具",panTool:"平移工具",holdSpacePan:"按住空格临时平移",selectAll:"全选所有节点"},kG={title:"跳转到节点",placeholder:"输入节点 ID 或名称…",empty:"未匹配到节点",hintNavigate:"切换",hintJump:"跳转",hintClose:"关闭"},SG={title:"开始构建你的流程",text:"在下方 AI 输入框中描述你的流程,或从左侧面板拖拽节点到画布",composerHint:"使用 AI Composer 构建 AgentFlow",composerSub:"从左侧拖入节点,或在<strong>下方输入框</strong>中用自然语言描述工作流。<br/>按 <kbd>?</kbd> 查看快捷键。"},NG={mainNav:"主导航"},jG={flowWarningAriaLabel:"流程校验警告",reloadFromServer:"从服务器重新加载流程并刷新校验",reloadFromServerShort:"从服务器重新加载",closeBanner:"关闭校验警告横幅",nodePrefix:"节点",focusNodeAriaLabel:"在画布中选中并定位节点 {{nodeId}}",slotWarningCount:"槽位校验 {{count}} 条(已隐藏)",show:"显示",shortcutHint:"按 ? 查看快捷键",shortcutHintLabel:"快捷键",inputSlotNoEdge:' 的 input 槽位 "{{slotName}}"({{handle}})无对应 edge 连接',outputSlotNoEdge:' 的 output 槽位 "{{slotName}}"({{handle}})无对应 edge 连接'},CG={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}} 步):
152
- {{summary}}`,step:"步骤 {{current}}/{{total}}: {{description}}",phaseGeneration:`分阶段生成({{count}} 阶段):{{labels}}
153
- 当前:{{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}}"},EG={currentPipeline:"当前流水线",backToEdit:"返回编辑",backToProjects:"返回项目",executionLog:"执行日志",history:"历史",pipelineSettings:"流水线设置",shortcutsLabel:"快捷键",shortcutsTitle:"快捷键 (?)",deletePipeline:"删除流水线",resumeTitle:"在同一 run 目录继续执行(uuid={{uuid}})",resumeTitleNoUuid:"尚未收到 apply-start,将发起新的 run",rerunTitle:"从头开始新的运行",runOptions:"运行选项",runWithParams:"带参数运行",runWithPreset:"指定预设运行",editRun:"编辑运行参数",startRun:"开始执行",stopRun:"停止后台运行"},_G={nodePalette:"节点调色板",noPipelineSelected:"未选择流水线",moreRuns:"+{{count}} 更多",moreFlows:"+{{count}} 更多流程",runId:"运行 ID: {{id}}"},PG={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}} 的分支"},IG={close:"关闭",loading:"加载中…",placeholder:"文件内容",largeFileWarning:"文件较大,编辑器性能可能受影响",reset:"重置",aiEdit:"AI 修改",aiRunning:"AI 处理中…",save:"保存",saving:"保存中…",saved:"已保存"},AG={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:"已复制"},TG={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:"定时配置已保存"},RG={title:"执行历史",summary:"执行结果汇总",successCount:"{{count}} 成功",failedCount:"{{count}} 失败",stoppedCount:"{{count}} 已停止",interruptedCount:"{{count}} 已中断",runningCount:"{{count}} 进行中",success:"成功",failed:"失败",stopped:"已停止",interrupted:"已中断",running:"进行中",unknown:"未知",runLabel:"运行 #{{id}}",enterRunView:"进入该次运行的画布与日志态"},LG={invalidInstanceId:"实例 ID 格式无效:仅允许英文字母、数字、下划线、短横线,且不能以数字开头。",duplicateInstanceId:"该实例 ID 已存在,请换一个。",loadFlowFailed:"读取 flow 失败",loadNodesFailed:"读取节点库失败"},OG={invalidPlaceholder:"无效占位符: {{hint}}",empty:"(空)",inputSubtitle:"输入 · {{type}}",inputSubtitleNoType:"输入",outputSubtitle:"输出 · {{type}}",outputSubtitleNoType:"输出",runtimeConst:"运行时常量"},MG={justNow:"刚刚",minutesAgo:"{{n}} 分钟前",hoursAgo:"{{n}} 小时前",yesterday:"昨天",daysAgo:"{{n}} 天前",milliseconds:"{{n}} 毫秒",seconds:"{{n}} 秒"},$G={title:"用户确认 ({{instanceId}})",edit:"编辑",save:"保存",cancel:"取消",aiEditPlaceholder:"输入 AI 修改指令,如:删除第二项、合并前两项…",aiEditBtn:"AI 修改",aiEditStarted:"AI 正在修改内容…",aiEditDone:"AI 修改完成",aiEditFailed:"AI 修改失败",contentSaved:"内容已保存",saveFailed:"保存失败",close:"关闭",continue:"继续执行",hint:"编辑或使用 AI 修改后点击保存,然后点击「继续执行」恢复流程"},FG={title:"用户选择 ({{instanceId}})",hint:"请从下方选项中选择一项以继续流程",submitting:"提交中…",submitFailed:"提交失败",close:"关闭",noOptions:"该节点未配置选项,请先在编辑器中为 output 槽位添加条目。"},DG={title:"Print 输出: {{instanceId}}",expand:"放大",restore:"还原"},zG={save:"保存",cancel:"取消"},BG={title:"带参数运行",noParams:"此流程无输入参数",run:"运行",cancel:"取消"},HG={title:"指定预设运行",noPresets:"无可用预设",default:"默认运行",run:"运行",cancel:"取消"},UG={preset:"预设",default:"默认",newPreset:"新建预设",deletePreset:"删除预设",presetNamePlaceholder:"预设名称",inputParams:"输入参数",noProvideNodes:"此流程无 provide 节点",filePathPlaceholder:"文件路径…",stringValuePlaceholder:"值…",presetSaved:"预设已保存",presetDeleted:"预设已删除",savePreset:"保存当前预设",expandInput:"编辑内容"},VG={title:oG,nodes:aG,edges:lG,properties:cG,node:uG,nodeProps:dG,actions:fG,panel:pG,palette:hG,pipeline:mG,status:gG,roles:yG,phases:xG,types:wG,runContext:vG,shortcuts:bG,jumpPalette:kG,emptyCanvas:SG,sidebar:NG,validation:jG,composer:CG,topbar:EG,palette2:_G,run:PG,fileEdit:IG,settings:AG,schedule:TG,history:RG,nodePropsError:LG,placeholder:OG,time:MG,userCheck:$G,userAsk:FG,toolPrint:DG,provideEdit:zG,runParams:BG,runPreset:HG,runConfig:UG},WG="设置",KG={engine:"引擎设置",preferences:"全局首选项"},qG={title:"工作区",currentPath:"当前工作区根目录",placeholder:"加载中…",copyPath:"复制路径",description:"流水线与节点清单将相对于此目录解析(由启动 UI 时传入)。"},YG={title:"Cursor CLI",status:{cached:"已缓存",notCached:"未缓存"},modelPreviewLabel:"Cursor 模型名称列表",modelList:{cached:"模型清单已缓存",empty:"暂无模型列表",count:"{{count}} 条",fetchedAt:"更新 {{time}}",never:"尚未拉取",refresh:"刷新清单",fetching:"拉取中…"}},GG={modelPreviewLabel:"OpenCode 模型名称列表",title:"OpenCode CLI",status:{ready:"就绪",notFound:"未找到"},provider:"方案 / Provider 标识",providerPlaceholder:"例如 bailian-coding-plan",saving:"正在保存并更新清单…",description:"对应 CLI opencode models <provider> 的参数;停止输入后会写入用户目录 config 并刷新 model-lists.json。"},XG={title:"Claude Code CLI",status:{ready:"就绪",notFound:"未找到"},modelPreviewLabel:"Claude Code 模型名称列表",description:"内置模型列表(Claude Code CLI 无 models 子命令);刷新将探测 claude 二进制是否在 PATH 中。首次使用请先执行 claude /login。"},JG={title:"环境变量",note:"当前登录用户私有,运行时优先于服务全局环境变量",saving:"正在保存...",key:"键",value:"值",add:"添加",delete:"删除 {{key}}",invalidKey:"环境变量名必须以字母或下划线开头,且只能包含字母、数字和下划线。",newKey:"新环境变量键",newValue:"值(密钥请谨慎)"},QG={title:"系统状态",normal:"服务正常",abnormal:"部分接口异常",cursorModels:"Cursor 模型",opencodeModels:"OpenCode 模型",claudeCodeModels:"Claude Code 模型"},ZG={title:"快捷入口",projects:"项目与流水线",flowEditor:"节点画布"},eX={title:"语言",description:"选择界面显示语言",options:{zh:"中文",en:"English",ja:"日本語"}},tX={title:"新手引导",description:"重新启动产品引导流程,了解 AgentFlow 的核心功能。",reset:"重置引导",resetSuccess:"已重置,下次访问将自动启动引导"},nX={title:WG,crumb:KG,workspace:qG,cursor:YG,opencode:GG,claudeCode:XG,env:JG,system:QG,shortcuts:ZG,language:eX,onboarding:tX},rX={thinking:"思考",result:"结果",reply:"回复",error:"错误"},iX={input:"让 AI 协助编辑此节点…",waiting:"等待响应…",selectedEmpty:"在画布上选择节点,或在输入框用 @ 选择实例(Instances)或节点类型(Node)",textarea:"描述你的流程或让 AI 协助编辑(⌘/Ctrl+Enter 发送)"},sX={send:"发送",stop:"停止",expand:"展开",collapse:"收起",clear:"清空"},oX={conversation:"对话",conversationWithNumber:"对话 {{num}}",default:"默认"},aX={endSession:"结束对话(将停止生成)",closeSession:"关闭对话",newSession:"新建对话",expandComposer:"展开对话与输出"},lX={hint:"使用底部输入框进行 AI 对话,支持 @节点、选择模型等功能"},cX={aiLabels:rX,placeholders:iX,actions:sX,labels:oX,tooltips:aX,rightPanel:lX},uX="项目",dX="全部",fX="已归档",pX="Nodes",hX="我的 Nodes",mX="我的流程",gX="Skills",yX="活跃项目",xX="已归档流水线",wX="全局 Nodes",vX="管理当前工作区已发布到本地 Marketplace 的节点,共 {{count}} 个。",bX="管理当前工作区已发布到本地 Marketplace 的流程片段,共 {{count}} 个。",kX="全局 Skills",SX="创建新项目",NX="新建流水线",jX="搜索流水线…",CX="搜索 nodes…",EX="搜索流程片段…",_X="搜索 skills…",PX="刷新资源",IX="加载流水线列表…",AX="加载全局资源…",TX="筛选结果:{{count}} 条(匹配标题、描述、路径与标签)",RX="已归档的流水线仍可打开与编辑;文件位于各 pipelines 目录下的 _archived。",LX="管理分布式节点架构与监控流水线。可将 flow.yaml 或 .zip 拖入本页导入分享流程。",OX="查看当前可用的全局节点定义,共 {{count}} 个;包含内置、工作区与 marketplace 节点。",MX="查看当前 Composer 可选择的 skills,共 {{count}} 个;包含 AgentFlow 内置与工作区 skills。",$X="流程运行时的可执行积木",FX="Nodes 决定画布上能拖什么、节点有哪些输入输出,以及运行时走 agent、control、provide 或 marketplace 哪类逻辑。",DX="已发布的本地节点包",zX="这里仅显示你发布到当前 Workspace Marketplace 的节点版本;可查看详情并删除未被 Flow 使用的版本。",BX="已发布的流程片段",HX="这里显示从 Pipeline 或 Workspace 画布发布的流程片段,可搜索、检查内容,并从画布的流程面板中加载复用。",UX="Composer/Agent 的操作指南",VX="Skills 告诉 AI 在特定任务里应遵守什么规则、如何修改 flow、如何复用项目约定。",WX="暂无归档项目。",KX="暂无未归档流水线;已归档项在 Archived 标签中查看。",qX="暂无可用全局 nodes。",YX="暂无已发布的 marketplace nodes。",GX="暂无已发布的流程片段。可在画布中选中多个节点后发布。",XX="暂无可用 skills。",JX="暂无描述。",QX="未找到与「{{query}}」匹配的 node。",ZX="未找到与「{{query}}」匹配的流程片段。",eJ="未找到与「{{query}}」匹配的 skill。",tJ="{{inputs}} in / {{outputs}} out",nJ="流程片段",rJ="{{nodes}} 节点 / {{edges}} 连线",iJ="Skill",sJ="Node 详情",oJ="流程片段详情",aJ="Skill 详情",lJ="类型",cJ="来源",uJ="包",dJ="版本",fJ="路径",pJ="可编辑",hJ="只读",mJ="可编辑",gJ="Schema",yJ="输入",xJ="输出",wJ="Runtime",vJ="节点内容",bJ="Files",kJ="Usage",SJ="暂无 runtime manifest。",NJ="暂无节点正文或 README。",jJ="暂无可预览文件。",CJ="请选择文件查看内容。",EJ="二进制文件暂不支持预览。",_J="文件较大,仅显示前 256KB。",PJ="暂未发现使用此 node 的流水线。",IJ="节点管理",AJ="删除节点版本",TJ="删除中…",RJ="删除前会检查所有 Flow 引用;仍被安装或使用的版本不会被删除。",LJ="确定删除 {{id}}@{{version}}?此操作不可撤销。",OJ="已删除 {{id}}@{{version}}。",MJ="仍有 {{count}} 个 Flow 使用它。",$J="无槽位",FJ="作用",DJ="这个 node 是 pipeline 的执行单元。它的 schema 会影响画布连线、参数输入和运行时调度。",zJ="流程片段是固定化流程的一部分。加载时会复制这组节点、连线和布局到当前画布,不覆盖已有内容。",BJ="规模",HJ="片段 JSON",UJ="这个 skill 会作为 Composer 的上下文注入给 AI,用于约束 AI 的判断、修改方式和输出口径。",VJ="SKILL.md 预览",WJ="暂无可预览内容。",KJ="请选择一个资源查看详情。",qJ="未能加载流水线列表。",YJ="当前工作区暂无流水线。",GJ="在仓库根目录执行 {{code1}} 并确认工作区包含 {{code2}} 或用户目录下的流水线;亦可点击 New Pipeline 新建。",XJ="未找到与「{{query}}」匹配的流水线。可尝试其他关键词,或点击清除搜索。",JJ="最近打开或最近运行",QJ="暂无打开或运行记录",ZJ="暂无与关键词匹配的最近记录",eQ="最近运行",tQ="最近打开",nQ={builtin:"内置",workspace:"工作区",user:"用户"},rQ={flow:"Flow",global:"Global",marketplace:"Marketplace"},iQ={all:"全部",agent:"Agent",control:"Control",provide:"Provide",marketplace:"Marketplace",builtin:"AgentFlow","workspace-agents":".agents","workspace-cursor":".cursor"},sQ={overview:"概览",schema:"Schema",runtime:"Runtime",files:"Files",usage:"Usage"},oQ="打开以在节点画布中编辑此流水线。",aQ={eyebrow:"AgentFlow Hub",title:"浏览社区流程",desc:"发现并一键安装社区分享的现成流水线。",cta:"前往 Hub",cliHint:"或通过 CLI 安装:agentflow download <slug>"},lQ={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:"关闭"},cQ={title:"导入流水线",lead:"已选择文件「{{filename}}」。请确认流水线名称与保存位置;ZIP 将保留目录内脚本等文件。",nameLabel:"名称(必填)",namePlaceholder:"例如 my_shared_flow",nameHint:"须以英文字母开头,仅可使用字母、数字、下划线 _ 与连字符 -",locationLabel:"保存位置",userDir:"用户目录(~/agentflow/pipelines)",workspaceDir:"当前工作区(.workspace/agentflow/pipelines)",changeFile:"更换文件…",importFailed:"导入失败",importing:"导入中…",importAndOpen:"导入并打开",cancel:"取消",close:"关闭"},uQ={title:"删除流水线",lead:"将永久删除磁盘上的流水线目录(含 flow.yaml、脚本等),无法撤销。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",deleteFailed:"删除失败",deleteTimeout:"删除请求超时,请重试(可先检查终端中的 UI 服务日志)",delete:"删除",deleting:"删除中…",confirmDelete:"确认删除",cancel:"取消",close:"关闭"},dQ={title:"归档流水线",lead:"归档后流水线将移入「Archived」列表,仍可从该列表打开与编辑。请在下方输入流水线 ID「{{flowId}}」以确认。",confirmLabel:"确认流水线名称",archiveFailed:"归档失败",archive:"归档",archiving:"归档中…",confirmArchive:"确认归档",cancel:"取消",close:"关闭"},fQ={title:uX,all:dX,archived:fX,nodes:pX,myNodes:hX,myFlows:mX,skills:gX,activeProjects:yX,archivedPipelines:xX,globalNodes:wX,myNodesHint:vX,myFlowsHint:bX,globalSkills:kX,createNew:SX,newPipeline:NX,searchPipelines:jX,searchNodes:CX,searchFlows:EX,searchSkills:_X,refreshResources:PX,loadingPipelines:IX,loadingResources:AX,filterResult:TX,archivedHint:RX,activeHint:LX,nodesHint:OX,skillsHint:MX,nodesPurposeTitle:$X,nodesPurposeDesc:FX,myNodesPurposeTitle:DX,myNodesPurposeDesc:zX,myFlowsPurposeTitle:BX,myFlowsPurposeDesc:HX,skillsPurposeTitle:UX,skillsPurposeDesc:VX,noArchived:WX,noActive:KX,noNodes:qX,noMyNodes:YX,noMyFlows:GX,noSkills:XX,noDescription:JX,noNodeMatch:QX,noFlowSnippetMatch:ZX,noSkillMatch:eJ,nodeSlots:tJ,flowSnippet:nJ,flowSnippetNodes:rJ,skill:iJ,nodeDetail:sJ,flowDetail:oJ,skillDetail:aJ,detailType:lJ,detailSource:cJ,detailPackage:uJ,detailVersion:dJ,detailPath:fJ,detailEditable:pJ,readOnly:hJ,editable:mJ,nodeSchema:gJ,nodeInputs:yJ,nodeOutputs:xJ,nodeRuntime:wJ,nodeBody:vJ,nodeFiles:bJ,nodeUsage:kJ,noRuntimeManifest:SJ,noNodeBody:NJ,noNodeFiles:jJ,selectNodeFile:CJ,binaryFile:EJ,fileTruncated:_J,noNodeUsage:PJ,myNodeManagement:IJ,deleteMyNode:AJ,deletingMyNode:TJ,deleteMyNodeHint:RJ,deleteMyNodeConfirm:LJ,deleteMyNodeSuccess:OJ,deleteMyNodeUsedBy:MJ,noSlots:$J,resourceMeaning:FJ,nodesMeaning:DJ,myFlowsMeaning:zJ,flowSnippetScale:BJ,flowSnippetPreview:HJ,skillsMeaning:UJ,skillPreview:VJ,skillPreviewEmpty:WJ,selectResource:KJ,loadFailed:qJ,noPipelines:YJ,emptyHint:GJ,noMatch:XJ,recentActivity:JJ,noRecentActivity:QJ,noMatchRecent:ZJ,recentRun:eQ,recentOpen:tQ,sourceBadge:nQ,resourceSource:rQ,resourceFilter:iQ,nodeDetailTabs:sQ,defaultCardDesc:oQ,hubCard:aQ,newPipelineModal:lQ,importModal:cQ,deleteModal:uQ,archiveModal:dQ},pQ="返回",hQ="下一步",mQ="跳过",gQ="完成",yQ="开始创建",xQ={intro:`欢迎使用 AgentFlow!这是一个可视化流程编排工具。
154
-
155
- 点击下方按钮开始创建你的第一个流水线。`,hubIntro:`不想从零开始?
156
-
157
- 在 AgentFlow Hub 浏览社区分享的现成流水线,一键安装即可运行。`},wQ={intro:`现在进入流程编辑器。
158
-
159
- 在下方输入框用自然语言描述你的需求,AI 会自动生成流程图。
160
-
161
- 左侧节点面板可以自由拖拽、删除和调整连接。`,introEmpty:`画布为空,开始创建你的流程吧!
162
-
163
- 在下方输入框用自然语言描述需求,AI 会自动生成流程图。
164
-
165
- 左侧节点面板可以自由拖拽、删除和调整连接。`},vQ={guideTitle:"首次创建提示",guideDesc:"输入名称和描述后,AI 会自动生成流程图。你可以在编辑器中自由调整节点和连接。",nameHintGuide:"例如:MyFirstFlow(字母开头,支持数字和下划线)",descPlaceholderGuide:"例如:实现用户登录功能,包含注册、验证、授权",descHintGuide:"描述越详细,AI 生成的流程越准确",createGuide:"创建并开始编辑",typeNode:"节点引用类型",typeStr:"字符串类型",typeFile:"文件路径类型",typeBool:"布尔值类型"},bQ={back:pQ,next:hQ,skip:mQ,done:gQ,startCreate:yQ,projects:xQ,flow:wQ,newPipeline:vQ},kQ={en:{common:O7,flow:vK,settings:TK,composer:DK,project:HY,onboarding:JY},zh:{common:sG,flow:VG,settings:nX,composer:cX,project:fQ,onboarding:bQ}};Xn.use(GI).use(pL).init({resources:kQ,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 SQ=[{code:"zh",name:"中文",flag:"🇨🇳"},{code:"en",name:"English",flag:"🇬🇧"}];function NQ(e){return Xn.changeLanguage(e)}const Fx="agentflow-settings-opencode-plan-v1";function Gg(e){if(!e||typeof e!="object")return{cursor:[],opencode:[],claudeCode:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null};const t=e;return{cursor:Array.isArray(t.cursor)?t.cursor.map(String):[],opencode:Array.isArray(t.opencode)?t.opencode.map(String):[],claudeCode:Array.isArray(t.claudeCode)?t.claudeCode.map(String):[],cursorFetchedAt:t.cursorFetchedAt??null,opencodeFetchedAt:t.opencodeFetchedAt??null,claudeCodeFetchedAt:t.claudeCodeFetchedAt??null}}function XI(){return`e_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`}function jQ(e){return/^[A-Za-z_][A-Za-z0-9_]*$/.test(String(e||"").trim())}function np(e){if(!Array.isArray(e))return[];const t=[];for(const n of e){if(!n||typeof n!="object")continue;const r=String(n.key??"").trim(),i=String(n.value??""),s=String(n.id??"").trim()||XI();!r&&!i||t.push({id:s,key:r,value:i})}return t}function qN(){try{return localStorage.getItem(Fx)??""}catch{return""}}function CQ(e){return e?e.length<=6?"•".repeat(e.length):`${"•".repeat(Math.min(20,e.length-4))}${e.slice(-4)}`:""}function EQ(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 _Q(){const{t:e,i18n:t}=Mt(["common","settings"]),n=t.language||"zh",[r,i]=m.useState(""),[s,o]=m.useState(""),[l,c]=m.useState({cursor:[],opencode:[],claudeCode:[],cursorFetchedAt:null,opencodeFetchedAt:null,claudeCodeFetchedAt:null}),[d,u]=m.useState(""),[p,f]=m.useState(!1),[h,y]=m.useState(!1),[b,S]=m.useState(""),[g,v]=m.useState([]),[w,k]=m.useState(""),[E,j]=m.useState(!1),[P,O]=m.useState(""),[F,W]=m.useState(""),[R,I]=m.useState(""),q=m.useRef(null),$=m.useRef(!1),H=m.useRef(!1),z=m.useRef(""),Y=m.useCallback(async()=>{o("");try{const re=await fetch("/api/ui-context");if(!re.ok)throw new Error("HTTP "+re.status);const fe=await re.json();i(typeof fe.workspaceRoot=="string"?fe.workspaceRoot:"")}catch(re){o(String(re.message||re)),i("")}},[]),A=m.useCallback(async()=>{u(""),f(!0);try{const re=await fetch("/api/model-lists");if(!re.ok)throw new Error("HTTP "+re.status);const fe=await re.json();c(Gg(fe))}catch(re){u(String(re.message||re))}finally{f(!1)}},[]),T=m.useCallback(async()=>{k("");try{const re=await fetch("/api/user-env"),fe=await re.json().catch(()=>({}));if(!re.ok)throw new Error(typeof fe.error=="string"?fe.error:"HTTP "+re.status);const ye=np(Array.isArray(fe.env)?fe.env:[]);z.current=JSON.stringify(ye),v(ye)}catch(re){v([]),k(String(re.message||re))}finally{H.current=!0}},[]),C=m.useCallback(async re=>{const fe=np(re);j(!0),k("");try{const ye=await fetch("/api/user-env",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({env:fe})}),Se=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(typeof Se.error=="string"?Se.error:"HTTP "+ye.status);const He=np(Array.isArray(Se.env)?Se.env:[]);z.current=JSON.stringify(He),v(He)}catch(ye){k(String(ye.message||ye))}finally{j(!1)}},[]),G=m.useCallback(async()=>{u(""),f(!0);try{const re=await fetch("/api/update-model-lists",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:R.trim()})}),fe=await re.json().catch(()=>({}));if(!re.ok)throw new Error(typeof fe.error=="string"?fe.error:"HTTP "+re.status);c(Gg(fe.modelLists))}catch(re){u(String(re.message||re))}finally{f(!1)}},[R]);m.useEffect(()=>{Y(),A(),T(),(async()=>{try{const re=await fetch("/api/agentflow-config");if(re.ok){const fe=await re.json(),ye=typeof fe.opencodeProvider=="string"?fe.opencodeProvider:"";I(ye),q.current=ye;try{localStorage.setItem(Fx,ye)}catch{}}else{const fe=qN();I(fe),q.current=fe}}catch{const re=qN();I(re),q.current=re}finally{$.current=!0}})()},[Y,A,T]),m.useEffect(()=>{if(!H.current||JSON.stringify(np(g))===z.current)return;const fe=setTimeout(()=>{C(g)},350);return()=>clearTimeout(fe)},[g,C]),m.useEffect(()=>{if(!$.current)return;const re=R.trim();if(re===q.current)return;const fe=setTimeout(()=>{(async()=>{y(!0),S("");try{const ye=await fetch("/api/agentflow-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({opencodeProvider:re})}),Se=await ye.json().catch(()=>({}));if(!ye.ok)throw new Error(typeof Se.error=="string"?Se.error:"HTTP "+ye.status);q.current=re;try{localStorage.setItem(Fx,re)}catch{}Se.modelLists&&c(Gg(Se.modelLists))}catch(ye){S(String(ye.message||ye))}finally{y(!1)}})()},450);return()=>clearTimeout(fe)},[R]);const Q=l.cursor.length>0,M=l.opencode.length>0,te=l.claudeCode.length>0,ce=m.useCallback(()=>{var re;r&&((re=navigator.clipboard)==null||re.writeText(r))},[r]),le=m.useCallback(()=>{const re=P.trim(),fe=F;if(re){if(!jQ(re)){k(e("settings:env.invalidKey"));return}v(ye=>[...ye,{id:XI(),key:re,value:fe}]),O(""),W("")}},[P,F,e]),de=m.useCallback(re=>{v(fe=>fe.filter(ye=>ye.id!==re))},[]),ue=m.useCallback(re=>{const fe=re.target.value;NQ(fe)},[]),se=re=>{const fe=EQ(re,n);return fe?e("settings:cursor.modelList.fetchedAt",{time:fe}):e("settings:cursor.modelList.never")};return a.jsxs("div",{className:"af-settings-page",children:[a.jsx("header",{className:"af-settings-top",children:a.jsxs("div",{className:"af-settings-crumb","aria-label":e("settings:title"),children:[a.jsx("span",{className:"af-settings-crumb-muted",children:e("settings:crumb.engine")}),a.jsx("span",{className:"af-settings-crumb-sep","aria-hidden":!0,children:"/"}),a.jsx("span",{className:"af-settings-crumb-active",children:e("settings:crumb.preferences")})]})}),a.jsx("div",{className:"af-settings-body",children:a.jsxs("div",{className:"af-settings-inner",children:[a.jsxs("header",{className:"af-settings-hero",children:[a.jsxs("h1",{className:"af-settings-h1",children:[e("common:app.name")," ",e("settings:title")]}),a.jsx("p",{className:"af-settings-lead",children:e("settings:workspace.description")}),s?a.jsx("p",{className:"af-err af-settings-api-hint",children:s}):null,d?a.jsx("p",{className:"af-err af-settings-api-hint",children:d}):null,w?a.jsx("p",{className:"af-err af-settings-api-hint",children:w}):null]}),a.jsxs("div",{className:"af-settings-layout",children:[a.jsxs("div",{className:"af-settings-bento",children:[a.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--low af-set-workspace",children:[a.jsxs("div",{className:"af-set-card-inner",children:[a.jsxs("div",{className:"af-set-card-head",children:[a.jsx("span",{className:"material-symbols-outlined af-set-icon af-set-icon--secondary",children:"folder_managed"}),a.jsx("h2",{className:"af-set-h2",children:e("settings:workspace.title")})]}),a.jsx("label",{className:"af-set-label",htmlFor:"af-workspace-path",children:e("settings:workspace.currentPath")}),a.jsxs("div",{className:"af-set-input-wrap",children:[a.jsx("input",{id:"af-workspace-path",className:"af-set-input af-set-input--mono",type:"text",readOnly:!0,value:r,placeholder:e("common:loading")}),a.jsx("button",{type:"button",className:"af-set-input-suffix",onClick:ce,"aria-label":e("settings:workspace.copyPath"),disabled:!r,children:a.jsx("span",{className:"material-symbols-outlined",children:"content_copy"})})]}),a.jsx("p",{className:"af-set-hint",children:e("settings:workspace.description")})]}),a.jsx("div",{className:"af-set-watermark","aria-hidden":!0,children:a.jsx("span",{className:"material-symbols-outlined",children:"account_tree"})})]}),a.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[a.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[a.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:"Cursor CLI"}),a.jsx("span",{className:"af-set-badge"+(Q?" af-set-badge--ok":" af-set-badge--muted"),children:e(Q?"settings:cursor.status.cached":"settings:cursor.status.notCached")})]}),a.jsxs("div",{className:"af-set-cli-block",children:[a.jsx("div",{className:"af-set-cli-icon",children:a.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:Q?"check_circle":"hourglass_empty"})}),a.jsxs("div",{children:[a.jsx("p",{className:"af-set-cli-title",children:e(Q?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),a.jsx("p",{className:"af-set-cli-mono",children:Q?e("settings:cursor.modelList.count",{count:l.cursor.length})+" · "+se(l.cursorFetchedAt):e("settings:cursor.modelList.refresh")})]})]}),Q?a.jsx("pre",{className:"af-set-model-preview","aria-label":e("settings:cursor.modelPreviewLabel"),children:l.cursor.join(`
166
- `)}):null,a.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>G(),disabled:p,children:e(p?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),a.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[a.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[a.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:"OpenCode"}),a.jsx("span",{className:"af-set-badge"+(M?" af-set-badge--ok":" af-set-badge--err"),children:e(M?"settings:opencode.status.ready":"settings:opencode.status.notFound")})]}),a.jsx("p",{className:"af-set-p",children:e("settings:opencode.description")}),a.jsxs("div",{children:[a.jsx("label",{className:"af-set-label-sm",htmlFor:"af-opencode-plan",children:e("settings:opencode.provider")}),a.jsx("input",{id:"af-opencode-plan",className:"af-set-input af-set-input--sm af-set-input--mono",type:"text",value:R,onChange:re=>I(re.target.value),placeholder:e("settings:opencode.providerPlaceholder"),autoComplete:"off"}),h?a.jsx("p",{className:"af-set-hint af-set-hint--inline","aria-live":"polite",children:e("settings:opencode.saving")}):null,b?a.jsx("p",{className:"af-err af-set-hint af-set-hint--inline",role:"alert",children:b}):null]}),M?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"af-set-cli-mono af-set-cli-mono--block",children:e("settings:cursor.modelList.count",{count:l.opencode.length})+" · "+se(l.opencodeFetchedAt)}),a.jsx("pre",{className:"af-set-model-preview","aria-label":e("settings:opencode.modelPreviewLabel"),children:l.opencode.join(`
167
- `)})]}):null,a.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>G(),disabled:p,children:e(p?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),a.jsxs("section",{className:"af-set-card af-set-card--narrow af-set-card--high",children:[a.jsxs("div",{className:"af-set-card-head af-set-card-head--spread",children:[a.jsx("h2",{className:"af-set-h2 af-set-h2--caps",children:e("settings:claudeCode.title")}),a.jsx("span",{className:"af-set-badge"+(te?" af-set-badge--ok":" af-set-badge--err"),children:e(te?"settings:claudeCode.status.ready":"settings:claudeCode.status.notFound")})]}),a.jsxs("div",{className:"af-set-cli-block",children:[a.jsx("div",{className:"af-set-cli-icon",children:a.jsx("span",{className:"material-symbols-outlined af-set-icon--tertiary",children:te?"check_circle":"hourglass_empty"})}),a.jsxs("div",{children:[a.jsx("p",{className:"af-set-cli-title",children:e(te?"settings:cursor.modelList.cached":"settings:cursor.modelList.empty")}),a.jsx("p",{className:"af-set-cli-mono",children:te?e("settings:cursor.modelList.count",{count:l.claudeCode.length})+" · "+se(l.claudeCodeFetchedAt):e("settings:cursor.modelList.refresh")})]})]}),a.jsx("p",{className:"af-set-p",children:e("settings:claudeCode.description")}),te?a.jsx("pre",{className:"af-set-model-preview","aria-label":e("settings:claudeCode.modelPreviewLabel"),children:l.claudeCode.join(`
168
- `)}):null,a.jsx("button",{type:"button",className:"af-set-btn-outline",onClick:()=>G(),disabled:p,children:e(p?"settings:cursor.modelList.fetching":"settings:cursor.modelList.refresh")})]}),a.jsxs("section",{className:"af-set-card af-set-card--wide af-set-card--low af-set-env",children:[a.jsxs("div",{className:"af-set-env-head",children:[a.jsxs("div",{className:"af-set-card-head",children:[a.jsx("div",{className:"af-set-env-icon-wrap",children:a.jsx("span",{className:"material-symbols-outlined af-set-icon--primary",children:"variables"})}),a.jsx("h2",{className:"af-set-h2",children:e("settings:env.title")})]}),a.jsx("span",{className:"af-set-env-note",children:e(E?"settings:env.saving":"settings:env.note")})]}),a.jsxs("div",{className:"af-set-env-rows",children:[g.map(re=>a.jsxs("div",{className:"af-set-env-row",children:[a.jsxs("div",{className:"af-set-env-cell",children:[a.jsx("span",{className:"af-set-env-k",children:e("settings:env.key")}),a.jsx("code",{className:"af-set-code-key",children:re.key||"—"})]}),a.jsxs("div",{className:"af-set-env-cell af-set-env-cell--grow",children:[a.jsx("span",{className:"af-set-env-k",children:e("settings:env.value")}),a.jsx("code",{className:"af-set-code-val",children:CQ(re.value)})]}),a.jsx("div",{className:"af-set-env-actions",children:a.jsx("button",{type:"button",className:"af-set-env-del","aria-label":e("settings:env.delete",{key:re.key}),onClick:()=>de(re.id),children:a.jsx("span",{className:"material-symbols-outlined",children:"delete_outline"})})})]},re.id)),a.jsxs("div",{className:"af-set-env-row af-set-env-row--draft",children:[a.jsx("div",{className:"af-set-env-cell",children:a.jsx("input",{className:"af-set-input af-set-input--dashed af-set-input--mono",placeholder:"KEY_NAME",value:P,onChange:re=>O(re.target.value),"aria-label":e("settings:env.newKey")})}),a.jsx("div",{className:"af-set-env-cell af-set-env-cell--grow",children:a.jsx("input",{className:"af-set-input af-set-input--dashed af-set-input--mono",type:"password",placeholder:e("settings:env.newValue"),value:F,onChange:re=>W(re.target.value),"aria-label":e("settings:env.newValue")})}),a.jsx("div",{className:"af-set-env-actions",children:a.jsxs("button",{type:"button",className:"af-set-btn-add",onClick:le,disabled:!P.trim(),children:[a.jsx("span",{className:"material-symbols-outlined",children:"add"}),e("settings:env.add")]})})]})]})]})]}),a.jsxs("aside",{className:"af-settings-rail","aria-label":e("settings:title"),children:[a.jsxs("div",{className:"af-set-rail-card af-set-rail-card--accent",children:[a.jsxs("div",{className:"af-set-rail-inner",children:[a.jsx("h3",{className:"af-set-rail-h3",children:e("settings:system.title")}),a.jsxs("div",{className:"af-set-health-line",children:[a.jsx("span",{className:"af-set-pulse-dot","aria-hidden":!0}),a.jsx("span",{className:"af-set-health-label",children:e(!s&&!d?"settings:system.normal":"settings:system.abnormal")})]}),a.jsxs("div",{className:"af-set-meter",children:[a.jsxs("div",{className:"af-set-meter-row",children:[a.jsx("span",{children:e("settings:system.cursorModels")}),a.jsx("span",{children:l.cursor.length})]}),a.jsx("div",{className:"af-set-meter-bar",children:a.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,l.cursor.length>0?12+l.cursor.length*3:4)}%`}})})]}),a.jsxs("div",{className:"af-set-meter",children:[a.jsxs("div",{className:"af-set-meter-row",children:[a.jsx("span",{children:e("settings:system.opencodeModels")}),a.jsx("span",{children:l.opencode.length})]}),a.jsx("div",{className:"af-set-meter-bar",children:a.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,l.opencode.length>0?12+l.opencode.length*3:4)}%`}})})]}),a.jsxs("div",{className:"af-set-meter",children:[a.jsxs("div",{className:"af-set-meter-row",children:[a.jsx("span",{children:e("settings:system.claudeCodeModels")}),a.jsx("span",{children:l.claudeCode.length})]}),a.jsx("div",{className:"af-set-meter-bar",children:a.jsx("div",{className:"af-set-meter-fill",style:{width:`${Math.min(100,l.claudeCode.length>0?12+l.claudeCode.length*3:4)}%`}})})]})]}),a.jsx("div",{className:"af-set-rail-watermark","aria-hidden":!0,children:a.jsx("span",{className:"material-symbols-outlined",children:"vital_signs"})})]}),a.jsxs("div",{className:"af-set-rail-card",children:[a.jsx("h3",{className:"af-set-rail-h3 af-set-rail-h3--sm",children:e("settings:language.title")}),a.jsxs("div",{className:"af-set-language-selector",children:[a.jsx("select",{className:"af-set-input af-set-input--sm",value:n,onChange:ue,"aria-label":e("settings:language.description"),children:SQ.map(re=>a.jsxs("option",{value:re.code,children:[re.flag," ",re.name]},re.code))}),a.jsx("p",{className:"af-set-hint",children:e("settings:language.description")})]})]})]})]})]})})]})}function JI(e){return t=>typeof t===e}var PQ=JI("function"),IQ=e=>e===null,YN=e=>Object.prototype.toString.call(e).slice(8,-1)==="RegExp",GN=e=>!AQ(e)&&!IQ(e)&&(PQ(e)||typeof e=="object"),AQ=JI("undefined");function TQ(e,t,n){return DQ(n,e,t)?!0:(zQ(n,e,t),e.constructor!==t.constructor?!1:Array.isArray(e)&&Array.isArray(t)?RQ(e,t,n):e instanceof Map&&t instanceof Map?MQ(e,t,n):e instanceof Set&&t instanceof Set?FQ(e,t):e instanceof WeakMap||e instanceof WeakSet?!1:ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)?LQ(e,t):YN(e)&&YN(t)?e.source===t.source&&e.flags===t.flags:e instanceof Error&&t instanceof Error?OQ(e,t,n):e.valueOf!==Object.prototype.valueOf?e.valueOf()===t.valueOf():e.toString!==Object.prototype.toString?e.toString()===t.toString():$Q(e,t,n))}function Ld(e,t,n){return e===t||Number.isNaN(e)&&Number.isNaN(t)?!0:!e||!GN(e)||!t||!GN(t)?!1:TQ(e,t,n)}function RQ(e,t,n){const{length:r}=e;if(r!==t.length)return!1;for(let i=r;i--!==0;)if(!Ld(e[i],t[i],n))return!1;return!0}function LQ(e,t){if(e.byteLength!==t.byteLength)return!1;const n=new DataView(e.buffer),r=new DataView(t.buffer);let i=e.byteLength;for(;i--;)if(n.getUint8(i)!==r.getUint8(i))return!1;return!0}function OQ(e,t,n){return e.message===t.message&&e.name===t.name&&Ld(e.cause,t.cause,n)}function MQ(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(!Ld(r[1],t.get(r[0]),n))return!1;return!0}function $Q(e,t,n){const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let i=r.length;i--!==0;)if(!Object.prototype.hasOwnProperty.call(t,r[i]))return!1;for(let i=r.length;i--!==0;){const s=r[i];if(!(s==="_owner"&&e.$$typeof)&&!Ld(e[s],t[s],n))return!1}return!0}function FQ(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 DQ(e,t,n){var r;return((r=e.get(t))==null?void 0:r.has(n))??!1}function zQ(e,t,n){let r=e.get(t);r||(r=new WeakSet,e.set(t,r)),r.add(n)}function Pv(e,t){return Ld(e,t,new WeakMap)}function Xg(){var e;return!!(typeof window<"u"&&((e=window==null?void 0:window.document)!=null&&e.createElement))}function BQ(e,...t){e&&e.removeEventListener&&e.removeEventListener(...t)}function HQ(e,...t){e&&e.addEventListener&&e.addEventListener(...t)}function UQ(){const e=m.useRef(!0);return e.current?(e.current=!1,!0):e.current}function VQ(e,t){const n=UQ();m.useEffect(()=>{if(!n)return e()},t)}function QI(e){const t=m.useRef(void 0);return m.useEffect(()=>{t.current=e}),t.current}function WQ(e,t){const n=m.useRef(t);return Pv(t,n.current)||(n.current=t),m.useMemo(e,n.current)}function KQ(e){m.useEffect(()=>{e()},[])}function qQ(e=0){const[t,n]=m.useState({height:Xg()?window.innerHeight:0,width:Xg()?window.innerWidth:0}),r=m.useRef(0),i=m.useRef(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(()=>{n({width:window.innerWidth,height:window.innerHeight})},e)});return m.useEffect(()=>{if(!Xg())return()=>{};const s=i.current;return n({height:window.innerHeight,width:window.innerWidth}),HQ(window,"resize",s),()=>{BQ(window,"resize",s)}},[]),t}var YQ=["Array","ArrayBuffer","AsyncFunction","AsyncGenerator","AsyncGeneratorFunction","Date","Error","Function","Generator","GeneratorFunction","HTMLElement","Map","Object","Promise","RegExp","Set","URL","WeakMap","WeakSet"],GQ=["bigint","boolean","null","number","string","symbol","undefined"];function Od(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(/HTML\w+Element/.test(t))return"HTMLElement";if(XQ(t))return t}function qi(e){return t=>Od(t)===e}function XQ(e){return YQ.includes(e)}function gc(e){return t=>typeof t===e}function JQ(e){return GQ.includes(e)}var QQ=["innerHTML","ownerDocument","style","attributes","nodeValue"],Md=e=>Array.isArray(e),ZQ=e=>Od(e)==="AsyncGeneratorFunction",eZ=qi("AsyncFunction"),tZ=gc("bigint"),nZ=e=>e===!0||e===!1,rZ=qi("Date"),iZ=qi("Error"),Vo=gc("function"),sZ=qi("GeneratorFunction"),oZ=e=>typeof e=="number"&&Number.isInteger(e),Dx=qi("Map"),ZI=e=>Number.isNaN(e),Iv=e=>e===null,eA=qi("Function"),aZ=qi("Promise"),lZ=qi("RegExp"),zx=qi("Set"),$d=gc("string"),cZ=gc("symbol"),Av=gc("undefined"),uZ=qi("WeakMap"),dZ=qi("WeakSet"),Tv=e=>Iv(e)||Av(e),tA=e=>!Av(e),fZ=e=>gc("number")(e)&&!ZI(e),pZ=e=>$d(e)&&e.trim().length>0,hZ=e=>{if(!$d(e)||e.length===0)return!1;const t=e.trim();return t.length>0&&Number.isFinite(Number(t))},dm=e=>!Tv(e)&&(Vo(e)||typeof e=="object"),nA=e=>{if(Od(e)!=="Object")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.getPrototypeOf({})},mZ=e=>Iv(e)||JQ(typeof e),gZ=e=>Od(e)==="URL",rA=e=>!Tv(e)&&Vo(e[Symbol.iterator]),yZ=e=>rA(e)&&Vo(e.next)&&Vo(e.throw),xZ=e=>Vo(e)&&/^class\s/.test(e.toString()),wZ=(e,t)=>!Md(e)||!Vo(t)?!1:e.every(n=>t(n)),vZ=e=>dm(e)&&!nA(e)&&e.nodeType===1&&$d(e.nodeName)&&QQ.every(t=>t in e),bZ=e=>$d(e)&&e.length===0||Md(e)&&e.length===0||dm(e)&&!Dx(e)&&!zx(e)&&Object.keys(e).length===0||zx(e)&&e.size===0||Dx(e)&&e.size===0,kZ=(e,t)=>!e||!t?!1:Object.getPrototypeOf(e)===t.prototype,SZ=(e,t)=>Md(e)?e.indexOf(t)>-1:!1,NZ=(e,t,n)=>{if(!dm(e)||!t)return!1;const r=e[t];return Vo(n)?n(r):tA(r)};function ut(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(Md(e))return"Array";if(eA(e))return"Function";const t=Od(e);return t||"Object"}ut.array=Md;ut.arrayOf=wZ;ut.asyncGeneratorFunction=ZQ;ut.asyncFunction=eZ;ut.bigint=tZ;ut.boolean=nZ;ut.class=xZ;ut.date=rZ;ut.defined=tA;ut.domElement=vZ;ut.empty=bZ;ut.error=iZ;ut.function=Vo;ut.generator=yZ;ut.generatorFunction=sZ;ut.instanceOf=kZ;ut.integer=oZ;ut.iterable=rA;ut.map=Dx;ut.nan=ZI;ut.null=Iv;ut.nullOrUndefined=Tv;ut.nonEmptyString=pZ;ut.number=fZ;ut.numericString=hZ;ut.object=dm;ut.oneOf=SZ;ut.plainFunction=eA;ut.plainObject=nA;ut.primitive=mZ;ut.promise=aZ;ut.propertyOf=NZ;ut.regexp=lZ;ut.set=zx;ut.string=$d;ut.symbol=cZ;ut.undefined=Av;ut.url=gZ;ut.weakMap=uZ;ut.weakSet=dZ;var lr=ut;/* v8 ignore next -- @preserve */var jZ=function(e){return Object.prototype.hasOwnProperty.call(e,"props")},CZ=function(e,t){return e+md(t)},md=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(CZ,""):jZ(e)&&Object.prototype.hasOwnProperty.call(e.props,"children")?md(e.props.children):""};md.default=md;var EZ=md;const Jg=Ko(EZ);var iA={exports:{}};(function(e){const t=Object.getPrototypeOf({});function n(){return function(s){return typeof s=="object"&&s!==null&&!(s instanceof RegExp)&&!(s instanceof Date)}}function r(i){function s(E){return E!=="constructor"&&E!=="prototype"&&E!=="__proto__"}function o(E){let j=0;const P=E.length,O=new Array(P);for(j;j<P;++j)O[j]=g(E[j]);return O}function l(E){const j={};if(f&&Object.getPrototypeOf(E)!==t)return f(E);const P=p(E);let O,F,W;for(O=0,F=P.length;O<F;++O)s(W=P[O])&&(j[W]=g(E[W]));return j}function c(E,j){const P=E.length,O=j.length;let F=0;const W=new Array(P+O);for(F;F<P;++F)W[F]=g(E[F]);for(F=0;F<O;++F)W[F+P]=g(j[F]);return W}const d=Object.prototype.propertyIsEnumerable;function u(E){const j=Object.keys(E),P=Object.getOwnPropertySymbols(E);for(let O=0,F=P.length;O<F;++O)d.call(E,P[O])&&j.push(P[O]);return j}const p=i!=null&&i.symbols?u:Object.keys,f=typeof(i==null?void 0:i.cloneProtoObject)=="function"?i.cloneProtoObject:void 0,h=typeof(i==null?void 0:i.isMergeableObject)=="function"?i.isMergeableObject:n(),y=(i==null?void 0:i.onlyDefinedProperties)===!0;function b(E){return typeof E!="object"||E===null}const S=i&&typeof i.mergeArray=="function"?i.mergeArray({clone:g,deepmerge:w,getKeys:p,isMergeableObject:h}):c;function g(E){return h(E)?Array.isArray(E)?o(E):l(E):E}function v(E,j){const P={},O=p(E),F=p(j);let W,R,I;for(W=0,R=O.length;W<R;++W)s(I=O[W])&&F.indexOf(I)===-1&&(P[I]=g(E[I]));for(W=0,R=F.length;W<R;++W)if(s(I=F[W]))if(I in E)O.indexOf(I)!==-1&&(f&&h(j[I])&&Object.getPrototypeOf(j[I])!==t?P[I]=f(j[I]):P[I]=w(E[I],j[I]));else{if(y&&typeof j[I]>"u")continue;P[I]=g(j[I])}return P}function w(E,j){if(y&&typeof j>"u")return g(E);const P=Array.isArray(j),O=Array.isArray(E);return b(j)?j:h(E)?P&&O?S(E,j):P!==O?g(j):v(E,j):g(j)}function k(){switch(arguments.length){case 0:return{};case 1:return g(arguments[0]);case 2:return w(arguments[0],arguments[1])}let E;for(let j=0,P=arguments.length;j<P;++j)E=w(E,arguments[j]);return E}return i!=null&&i.all?k:w}e.exports=r,e.exports.default=r,e.exports.deepmerge=r,Object.defineProperty(e.exports,"isMergeableObject",{get:n})})(iA);var _Z=iA.exports;const PZ=Ko(_Z);var IZ=new Error("Element already at target scroll position"),AZ=new Error("Scroll cancelled"),TZ=Math.min,XN=Date.now,RZ={left:JN("scrollLeft"),top:JN("scrollTop")};function JN(e){return function(n,r,i,s){i=i||{},typeof i=="function"&&(s=i,i={}),typeof s!="function"&&(s=OZ);var o=XN(),l=n[e],c=i.ease||LZ,d=isNaN(i.duration)?350:+i.duration,u=!1;return l===r?s(IZ,n[e]):requestAnimationFrame(f),p;function p(){u=!0}function f(h){if(u)return s(AZ,n[e]);var y=XN(),b=TZ(1,(y-o)/d),S=c(b);n[e]=S*(r-l)+l,b<1?requestAnimationFrame(f):requestAnimationFrame(function(){s(null,n[e])})}}}function LZ(e){return .5*(1-Math.cos(Math.PI*e))}function OZ(){}const MZ=Ko(RZ);var sA={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.Scrollparent=n()})(Tu,function(){function t(r){var i=getComputedStyle(r,null).getPropertyValue("overflow");return i.indexOf("scroll")>-1||i.indexOf("auto")>-1}function n(r){if(r instanceof HTMLElement||r instanceof SVGElement){for(var i=r.parentNode;i.parentNode;){if(t(i))return i;i=i.parentNode}return document.scrollingElement||document.documentElement}}return n})})(sA);var $Z=sA.exports;const oA=Ko($Z),FZ=["top","right","bottom","left"],QN=["start","end"],ZN=FZ.reduce((e,t)=>e.concat(t,t+"-"+QN[0],t+"-"+QN[1]),[]),cc=Math.min,Ea=Math.max,Nh=Math.round,rp=Math.floor,vs=e=>({x:e,y:e}),DZ={left:"right",right:"left",bottom:"top",top:"bottom"};function Bx(e,t,n){return Ea(e,cc(t,n))}function yc(e,t){return typeof e=="function"?e(t):e}function Js(e){return e.split("-")[0]}function bs(e){return e.split("-")[1]}function aA(e){return e==="x"?"y":"x"}function Rv(e){return e==="y"?"height":"width"}function Eo(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Lv(e){return aA(Eo(e))}function lA(e,t,n){n===void 0&&(n=!1);const r=bs(e),i=Lv(e),s=Rv(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=Ch(o)),[o,Ch(o)]}function zZ(e){const t=Ch(e);return[jh(e),t,jh(t)]}function jh(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const e1=["left","right"],t1=["right","left"],BZ=["top","bottom"],HZ=["bottom","top"];function UZ(e,t,n){switch(e){case"top":case"bottom":return n?t?t1:e1:t?e1:t1;case"left":case"right":return t?BZ:HZ;default:return[]}}function VZ(e,t,n,r){const i=bs(e);let s=UZ(Js(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(jh)))),s}function Ch(e){const t=Js(e);return DZ[t]+e.slice(t.length)}function WZ(e){return{top:0,right:0,bottom:0,left:0,...e}}function cA(e){return typeof e!="number"?WZ(e):{top:e,right:e,bottom:e,left:e}}function Eh(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function n1(e,t,n){let{reference:r,floating:i}=e;const s=Eo(t),o=Lv(t),l=Rv(o),c=Js(t),d=s==="y",u=r.x+r.width/2-i.width/2,p=r.y+r.height/2-i.height/2,f=r[l]/2-i[l]/2;let h;switch(c){case"top":h={x:u,y:r.y-i.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:p};break;case"left":h={x:r.x-i.width,y:p};break;default:h={x:r.x,y:r.y}}switch(bs(t)){case"start":h[o]-=f*(n&&d?-1:1);break;case"end":h[o]+=f*(n&&d?-1:1);break}return h}async function KZ(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:p="floating",altBoundary:f=!1,padding:h=0}=yc(t,e),y=cA(h),S=l[f?p==="floating"?"reference":"floating":p],g=Eh(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(S)))==null||n?S:S.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:u,strategy:c})),v=p==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),k=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},E=Eh(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:w,strategy:c}):v);return{top:(g.top-E.top+y.top)/k.y,bottom:(E.bottom-g.bottom+y.bottom)/k.y,left:(g.left-E.left+y.left)/k.x,right:(E.right-g.right+y.right)/k.x}}const qZ=50,YZ=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:KZ},c=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:p}=n1(d,r,c),f=r,h=0;const y={};for(let b=0;b<s.length;b++){const S=s[b];if(!S)continue;const{name:g,fn:v}=S,{x:w,y:k,data:E,reset:j}=await v({x:u,y:p,initialPlacement:r,placement:f,strategy:i,middlewareData:y,rects:d,platform:l,elements:{reference:e,floating:t}});u=w??u,p=k??p,y[g]={...y[g],...E},j&&h<qZ&&(h++,typeof j=="object"&&(j.placement&&(f=j.placement),j.rects&&(d=j.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):j.rects),{x:u,y:p}=n1(d,f,c)),b=-1)}return{x:u,y:p,placement:f,strategy:i,middlewareData:y}},GZ=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:l,middlewareData:c}=t,{element:d,padding:u=0}=yc(e,t)||{};if(d==null)return{};const p=cA(u),f={x:n,y:r},h=Lv(i),y=Rv(h),b=await o.getDimensions(d),S=h==="y",g=S?"top":"left",v=S?"bottom":"right",w=S?"clientHeight":"clientWidth",k=s.reference[y]+s.reference[h]-f[h]-s.floating[y],E=f[h]-s.reference[h],j=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let P=j?j[w]:0;(!P||!await(o.isElement==null?void 0:o.isElement(j)))&&(P=l.floating[w]||s.floating[y]);const O=k/2-E/2,F=P/2-b[y]/2-1,W=cc(p[g],F),R=cc(p[v],F),I=W,q=P-b[y]-R,$=P/2-b[y]/2+O,H=Bx(I,$,q),z=!c.arrow&&bs(i)!=null&&$!==H&&s.reference[y]/2-($<I?W:R)-b[y]/2<0,Y=z?$<I?$-I:$-q:0;return{[h]:f[h]+Y,data:{[h]:H,centerOffset:$-H-Y,...z&&{alignmentOffset:Y}},reset:z}}});function XZ(e,t,n){return(e?[...n.filter(i=>bs(i)===e),...n.filter(i=>bs(i)!==e)]:n.filter(i=>Js(i)===i)).filter(i=>e?bs(i)===e||(t?jh(i)!==i:!1):!0)}const JZ=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,i;const{rects:s,middlewareData:o,placement:l,platform:c,elements:d}=t,{crossAxis:u=!1,alignment:p,allowedPlacements:f=ZN,autoAlignment:h=!0,...y}=yc(e,t),b=p!==void 0||f===ZN?XZ(p||null,h,f):f,S=await c.detectOverflow(t,y),g=((n=o.autoPlacement)==null?void 0:n.index)||0,v=b[g];if(v==null)return{};const w=lA(v,s,await(c.isRTL==null?void 0:c.isRTL(d.floating)));if(l!==v)return{reset:{placement:b[0]}};const k=[S[Js(v)],S[w[0]],S[w[1]]],E=[...((r=o.autoPlacement)==null?void 0:r.overflows)||[],{placement:v,overflows:k}],j=b[g+1];if(j)return{data:{index:g+1,overflows:E},reset:{placement:j}};const P=E.map(W=>{const R=bs(W.placement);return[W.placement,R&&u?W.overflows.slice(0,2).reduce((I,q)=>I+q,0):W.overflows[0],W.overflows]}).sort((W,R)=>W[1]-R[1]),F=((i=P.filter(W=>W[2].slice(0,bs(W[0])?2:3).every(R=>R<=0))[0])==null?void 0:i[0])||P[0][0];return F!==l?{data:{index:g+1,overflows:E},reset:{placement:F}}:{}}}},QZ=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:u=!0,crossAxis:p=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:b=!0,...S}=yc(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const g=Js(i),v=Eo(l),w=Js(l)===l,k=await(c.isRTL==null?void 0:c.isRTL(d.floating)),E=f||(w||!b?[Ch(l)]:zZ(l)),j=y!=="none";!f&&j&&E.push(...VZ(l,b,y,k));const P=[l,...E],O=await c.detectOverflow(t,S),F=[];let W=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&F.push(O[g]),p){const $=lA(i,o,k);F.push(O[$[0]],O[$[1]])}if(W=[...W,{placement:i,overflows:F}],!F.every($=>$<=0)){var R,I;const $=(((R=s.flip)==null?void 0:R.index)||0)+1,H=P[$];if(H&&(!(p==="alignment"?v!==Eo(H):!1)||W.every(A=>Eo(A.placement)===v?A.overflows[0]>0:!0)))return{data:{index:$,overflows:W},reset:{placement:H}};let z=(I=W.filter(Y=>Y.overflows[0]<=0).sort((Y,A)=>Y.overflows[1]-A.overflows[1])[0])==null?void 0:I.placement;if(!z)switch(h){case"bestFit":{var q;const Y=(q=W.filter(A=>{if(j){const T=Eo(A.placement);return T===v||T==="y"}return!0}).map(A=>[A.placement,A.overflows.filter(T=>T>0).reduce((T,C)=>T+C,0)]).sort((A,T)=>A[1]-T[1])[0])==null?void 0:q[0];Y&&(z=Y);break}case"initialPlacement":z=l;break}if(i!==z)return{reset:{placement:z}}}return{}}}},ZZ=new Set(["left","top"]);async function eee(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Js(n),l=bs(n),c=Eo(n)==="y",d=ZZ.has(o)?-1:1,u=s&&c?-1:1,p=yc(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:y}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return l&&typeof y=="number"&&(h=l==="end"?y*-1:y),c?{x:h*u,y:f*d}:{x:f*d,y:h*u}}const tee=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:l}=t,c=await eee(t,e);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:o}}}}},nee=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:g=>{let{x:v,y:w}=g;return{x:v,y:w}}},...d}=yc(e,t),u={x:n,y:r},p=await s.detectOverflow(t,d),f=Eo(Js(i)),h=aA(f);let y=u[h],b=u[f];if(o){const g=h==="y"?"top":"left",v=h==="y"?"bottom":"right",w=y+p[g],k=y-p[v];y=Bx(w,y,k)}if(l){const g=f==="y"?"top":"left",v=f==="y"?"bottom":"right",w=b+p[g],k=b-p[v];b=Bx(w,b,k)}const S=c.fn({...t,[h]:y,[f]:b});return{...S,data:{x:S.x-n,y:S.y-r,enabled:{[h]:o,[f]:l}}}}}};function fm(){return typeof window<"u"}function xc(e){return uA(e)?(e.nodeName||"").toLowerCase():"#document"}function ti(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function js(e){var t;return(t=(uA(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function uA(e){return fm()?e instanceof Node||e instanceof ti(e).Node:!1}function Vi(e){return fm()?e instanceof Element||e instanceof ti(e).Element:!1}function eo(e){return fm()?e instanceof HTMLElement||e instanceof ti(e).HTMLElement:!1}function r1(e){return!fm()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ti(e).ShadowRoot}function Fd(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Wi(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function ree(e){return/^(table|td|th)$/.test(xc(e))}function pm(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const iee=/transform|translate|scale|rotate|perspective|filter/,see=/paint|layout|strict|content/,pa=e=>!!e&&e!=="none";let Qg;function Ov(e){const t=Vi(e)?Wi(e):e;return pa(t.transform)||pa(t.translate)||pa(t.scale)||pa(t.rotate)||pa(t.perspective)||!Mv()&&(pa(t.backdropFilter)||pa(t.filter))||iee.test(t.willChange||"")||see.test(t.contain||"")}function oee(e){let t=Wo(e);for(;eo(t)&&!uc(t);){if(Ov(t))return t;if(pm(t))return null;t=Wo(t)}return null}function Mv(){return Qg==null&&(Qg=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Qg}function uc(e){return/^(html|body|#document)$/.test(xc(e))}function Wi(e){return ti(e).getComputedStyle(e)}function hm(e){return Vi(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Wo(e){if(xc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||r1(e)&&e.host||js(e);return r1(t)?t.host:t}function dA(e){const t=Wo(e);return uc(t)?e.ownerDocument?e.ownerDocument.body:e.body:eo(t)&&Fd(t)?t:dA(t)}function gd(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=dA(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=ti(i);if(s){const l=Hx(o);return t.concat(o,o.visualViewport||[],Fd(i)?i:[],l&&n?gd(l):[])}else return t.concat(i,gd(i,[],n))}function Hx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function fA(e){const t=Wi(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=eo(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,l=Nh(n)!==s||Nh(r)!==o;return l&&(n=s,r=o),{width:n,height:r,$:l}}function $v(e){return Vi(e)?e:e.contextElement}function Ul(e){const t=$v(e);if(!eo(t))return vs(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=fA(t);let o=(s?Nh(n.width):n.width)/r,l=(s?Nh(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const aee=vs(0);function pA(e){const t=ti(e);return!Mv()||!t.visualViewport?aee:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function lee(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ti(e)?!1:t}function $a(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=$v(e);let o=vs(1);t&&(r?Vi(r)&&(o=Ul(r)):o=Ul(e));const l=lee(s,n,r)?pA(s):vs(0);let c=(i.left+l.x)/o.x,d=(i.top+l.y)/o.y,u=i.width/o.x,p=i.height/o.y;if(s){const f=ti(s),h=r&&Vi(r)?ti(r):r;let y=f,b=Hx(y);for(;b&&r&&h!==y;){const S=Ul(b),g=b.getBoundingClientRect(),v=Wi(b),w=g.left+(b.clientLeft+parseFloat(v.paddingLeft))*S.x,k=g.top+(b.clientTop+parseFloat(v.paddingTop))*S.y;c*=S.x,d*=S.y,u*=S.x,p*=S.y,c+=w,d+=k,y=ti(b),b=Hx(y)}}return Eh({width:u,height:p,x:c,y:d})}function mm(e,t){const n=hm(e).scrollLeft;return t?t.left+n:$a(js(e)).left+n}function hA(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-mm(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function cee(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=js(r),l=t?pm(t.floating):!1;if(r===o||l&&s)return n;let c={scrollLeft:0,scrollTop:0},d=vs(1);const u=vs(0),p=eo(r);if((p||!p&&!s)&&((xc(r)!=="body"||Fd(o))&&(c=hm(r)),p)){const h=$a(r);d=Ul(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}const f=o&&!p&&!s?hA(o,c):vs(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x+f.x,y:n.y*d.y-c.scrollTop*d.y+u.y+f.y}}function uee(e){return Array.from(e.getClientRects())}function dee(e){const t=js(e),n=hm(e),r=e.ownerDocument.body,i=Ea(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ea(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+mm(e);const l=-n.scrollTop;return Wi(r).direction==="rtl"&&(o+=Ea(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:l}}const i1=25;function fee(e,t){const n=ti(e),r=js(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,l=0,c=0;if(i){s=i.width,o=i.height;const u=Mv();(!u||u&&t==="fixed")&&(l=i.offsetLeft,c=i.offsetTop)}const d=mm(r);if(d<=0){const u=r.ownerDocument,p=u.body,f=getComputedStyle(p),h=u.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,y=Math.abs(r.clientWidth-p.clientWidth-h);y<=i1&&(s-=y)}else d<=i1&&(s+=d);return{width:s,height:o,x:l,y:c}}function pee(e,t){const n=$a(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=eo(e)?Ul(e):vs(1),o=e.clientWidth*s.x,l=e.clientHeight*s.y,c=i*s.x,d=r*s.y;return{width:o,height:l,x:c,y:d}}function s1(e,t,n){let r;if(t==="viewport")r=fee(e,n);else if(t==="document")r=dee(js(e));else if(Vi(t))r=pee(t,n);else{const i=pA(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Eh(r)}function mA(e,t){const n=Wo(e);return n===t||!Vi(n)||uc(n)?!1:Wi(n).position==="fixed"||mA(n,t)}function hee(e,t){const n=t.get(e);if(n)return n;let r=gd(e,[],!1).filter(l=>Vi(l)&&xc(l)!=="body"),i=null;const s=Wi(e).position==="fixed";let o=s?Wo(e):e;for(;Vi(o)&&!uc(o);){const l=Wi(o),c=Ov(o);!c&&l.position==="fixed"&&(i=null),(s?!c&&!i:!c&&l.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Fd(o)&&!c&&mA(e,o))?r=r.filter(u=>u!==o):i=l,o=Wo(o)}return t.set(e,r),r}function mee(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?pm(t)?[]:hee(t,this._c):[].concat(n),r],l=s1(t,o[0],i);let c=l.top,d=l.right,u=l.bottom,p=l.left;for(let f=1;f<o.length;f++){const h=s1(t,o[f],i);c=Ea(h.top,c),d=cc(h.right,d),u=cc(h.bottom,u),p=Ea(h.left,p)}return{width:d-p,height:u-c,x:p,y:c}}function gee(e){const{width:t,height:n}=fA(e);return{width:t,height:n}}function yee(e,t,n){const r=eo(t),i=js(t),s=n==="fixed",o=$a(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=vs(0);function d(){c.x=mm(i)}if(r||!r&&!s)if((xc(t)!=="body"||Fd(i))&&(l=hm(t)),r){const h=$a(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else i&&d();s&&!r&&i&&d();const u=i&&!r&&!s?hA(i,l):vs(0),p=o.left+l.scrollLeft-c.x-u.x,f=o.top+l.scrollTop-c.y-u.y;return{x:p,y:f,width:o.width,height:o.height}}function Zg(e){return Wi(e).position==="static"}function o1(e,t){if(!eo(e)||Wi(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return js(e)===n&&(n=n.ownerDocument.body),n}function gA(e,t){const n=ti(e);if(pm(e))return n;if(!eo(e)){let i=Wo(e);for(;i&&!uc(i);){if(Vi(i)&&!Zg(i))return i;i=Wo(i)}return n}let r=o1(e,t);for(;r&&ree(r)&&Zg(r);)r=o1(r,t);return r&&uc(r)&&Zg(r)&&!Ov(r)?n:r||oee(e)||n}const xee=async function(e){const t=this.getOffsetParent||gA,n=this.getDimensions,r=await n(e.floating);return{reference:yee(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function wee(e){return Wi(e).direction==="rtl"}const vee={convertOffsetParentRelativeRectToViewportRelativeRect:cee,getDocumentElement:js,getClippingRect:mee,getOffsetParent:gA,getElementRects:xee,getClientRects:uee,getDimensions:gee,getScale:Ul,isElement:Vi,isRTL:wee};function yA(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function bee(e,t){let n=null,r;const i=js(e);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const d=e.getBoundingClientRect(),{left:u,top:p,width:f,height:h}=d;if(l||t(),!f||!h)return;const y=rp(p),b=rp(i.clientWidth-(u+f)),S=rp(i.clientHeight-(p+h)),g=rp(u),w={rootMargin:-y+"px "+-b+"px "+-S+"px "+-g+"px",threshold:Ea(0,cc(1,c))||1};let k=!0;function E(j){const P=j[0].intersectionRatio;if(P!==c){if(!k)return o();P?o(!1,P):r=setTimeout(()=>{o(!1,1e-7)},1e3)}P===1&&!yA(d,e.getBoundingClientRect())&&o(),k=!1}try{n=new IntersectionObserver(E,{...w,root:i.ownerDocument})}catch{n=new IntersectionObserver(E,w)}n.observe(e)}return o(!0),s}function a1(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=$v(e),u=i||s?[...d?gd(d):[],...t?gd(t):[]]:[];u.forEach(g=>{i&&g.addEventListener("scroll",n,{passive:!0}),s&&g.addEventListener("resize",n)});const p=d&&l?bee(d,n):null;let f=-1,h=null;o&&(h=new ResizeObserver(g=>{let[v]=g;v&&v.target===d&&h&&t&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(t)})),n()}),d&&!c&&h.observe(d),t&&h.observe(t));let y,b=c?$a(e):null;c&&S();function S(){const g=$a(e);b&&!yA(b,g)&&n(),b=g,y=requestAnimationFrame(S)}return n(),()=>{var g;u.forEach(v=>{i&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),p==null||p(),(g=h)==null||g.disconnect(),h=null,c&&cancelAnimationFrame(y)}}const kee=tee,See=JZ,Nee=nee,jee=QZ,l1=GZ,Cee=(e,t,n)=>{const r=new Map,i={platform:vee,...n},s={...i.platform,_c:r};return YZ(e,t,{...i,platform:s})};var Eee=typeof document<"u",_ee=function(){},_p=Eee?m.useLayoutEffect:_ee;function _h(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,i;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(!_h(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!_h(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function xA(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function c1(e,t){const n=xA(e);return Math.round(t*n)/n}function ey(e){const t=m.useRef(e);return _p(()=>{t.current=e}),t}function u1(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[u,p]=m.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=m.useState(r);_h(f,r)||h(r);const[y,b]=m.useState(null),[S,g]=m.useState(null),v=m.useCallback(A=>{A!==j.current&&(j.current=A,b(A))},[]),w=m.useCallback(A=>{A!==P.current&&(P.current=A,g(A))},[]),k=s||y,E=o||S,j=m.useRef(null),P=m.useRef(null),O=m.useRef(u),F=c!=null,W=ey(c),R=ey(i),I=ey(d),q=m.useCallback(()=>{if(!j.current||!P.current)return;const A={placement:t,strategy:n,middleware:f};R.current&&(A.platform=R.current),Cee(j.current,P.current,A).then(T=>{const C={...T,isPositioned:I.current!==!1};$.current&&!_h(O.current,C)&&(O.current=C,Tr.flushSync(()=>{p(C)}))})},[f,t,n,R,I]);_p(()=>{d===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,p(A=>({...A,isPositioned:!1})))},[d]);const $=m.useRef(!1);_p(()=>($.current=!0,()=>{$.current=!1}),[]),_p(()=>{if(k&&(j.current=k),E&&(P.current=E),k&&E){if(W.current)return W.current(k,E,q);q()}},[k,E,q,W,F]);const H=m.useMemo(()=>({reference:j,floating:P,setReference:v,setFloating:w}),[v,w]),z=m.useMemo(()=>({reference:k,floating:E}),[k,E]),Y=m.useMemo(()=>{const A={position:n,left:0,top:0};if(!z.floating)return A;const T=c1(z.floating,u.x),C=c1(z.floating,u.y);return l?{...A,transform:"translate("+T+"px, "+C+"px)",...xA(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:T,top:C}},[n,l,z.floating,u.x,u.y]);return m.useMemo(()=>({...u,update:q,refs:H,elements:z,floatingStyles:Y}),[u,q,H,z,Y])}const Pee=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?l1({element:r.current,padding:i}).fn(n):{}:r?l1({element:r,padding:i}).fn(n):{}}}},d1=(e,t)=>{const n=kee(e);return{name:n.name,fn:n.fn,options:[e,t]}},Iee=(e,t)=>{const n=Nee(e);return{name:n.name,fn:n.fn,options:[e,t]}},Aee=(e,t)=>{const n=jee(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tee=(e,t)=>{const n=See(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ree=(e,t)=>{const n=Pee(e);return{name:n.name,fn:n.fn,options:[e,t]}},Lee={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},Oee={beaconOptions:{offset:-18}},wA={back:"Back",close:"Close",last:"Last",next:"Next",nextWithProgress:"Next ({current} of {total})",open:"Open the dialog",skip:"Skip"},Mee={isFixed:!1,locale:wA,placement:"bottom"},$ee={continuous:!1,debug:!1,run:!1,scrollToFirstStep:!1,steps:[]},mt={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"},Re={INIT:"init",READY:"ready",BEACON_BEFORE:"beacon_before",BEACON:"beacon",TOOLTIP_BEFORE:"tooltip_before",TOOLTIP:"tooltip",COMPLETE:"complete"},ds={BUTTON_BACK:"button_back",BUTTON_CLOSE:"button_close",BUTTON_PRIMARY:"button_primary",BUTTON_SKIP:"button_skip",KEYBOARD:"keyboard",OVERLAY:"overlay"},pt={IDLE:"idle",READY:"ready",WAITING:"waiting",RUNNING:"running",PAUSED:"paused",SKIPPED:"skipped",FINISHED:"finished"},Fee="react-joyride-portal";function Dee(e){const t={};for(const n in e)e[n]!==void 0&&(t[n]=e[n]);return t}function Tl(...e){return PZ({all:!0,isMergeableObject:t=>!(!lr.plainObject(t)||m.isValidElement(t))})(...e)}function vA(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}function Ds(e,t={}){const{defaultValue:n,step:r,steps:i}=t;let s=Jg(e);if(s)(s.includes("{current}")||s.includes("{total}"))&&r&&i&&(s=s.replace("{current}",r.toString()).replace("{total}",i.toString()));else if(m.isValidElement(e)&&!Object.values(e.props).length&&vA(e.type)==="function")try{s=Ds(e.type({}),t)}catch{s=Jg(n)}else s=Jg(n);return s}function Hn(e,t,n,...r){if(!e)return;const i=new Date,s=`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}:${String(i.getSeconds()).padStart(2,"0")}.${String(i.getMilliseconds()).padStart(3,"0")}`;console.log(`${t} %c${n}%c ${s}`,"font-weight: bold","color: gray; font-weight: normal",...r)}function zee(e,t){const n=Dee(t);return{...e,...n}}function yd(){}function Bee(e){return Object.keys(e)}function Ph(e,...t){if(!lr.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 f1(e,...t){if(!lr.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 Ux(e,t,n){const r=s=>s.replace("{current}",String(t)).replace("{total}",String(n));if(vA(e)==="string")return r(e);if(!m.isValidElement(e))return e;const{children:i}=e.props;if(lr.string(i)&&i.includes("{current}"))return m.cloneElement(e,{children:r(i)});if(Array.isArray(i))return m.cloneElement(e,{children:i.map(s=>typeof s=="string"?r(s):Ux(s,t,n))});if(lr.function(e.type)&&!Object.values(e.props).length)try{return Ux(e.type({}),t,n)}catch{return e}return e}function p1(e){return Bee(e).sort().reduce((t,n)=>(t[n]=e[n],t),{})}function Fv(){var e;return!!(typeof window<"u"&&((e=window.document)!=null&&e.createElement))}function h1(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 Dv(e){return e?e.getBoundingClientRect():null}function Hee(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((s,o)=>s-o),i=Math.floor(r.length/2);return r.length%2===0?(r[i-1]+r[i])/2:r[i]}return Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)}function hi(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 Uee(e,t,n){const r=Dv(e),i=wc(e),s=i?!i.isSameNode(Mr()):!1,o=n??vc(e);let l=0,c=(r==null?void 0:r.top)??0;return s&&o?c=(r==null?void 0:r.top)??0:i instanceof HTMLElement&&(l=i.scrollTop,!s&&!o&&(c+=l),i.isSameNode(Mr())||(c+=Mr().scrollTop)),Math.floor(c-t)}function wc(e,t){if(!e)return Mr();const n=oA(e);if(n){if(n.isSameNode(Mr()))return t?document:Mr();if(!(n.scrollHeight>n.offsetHeight))return Mr()}return n}function Vee(e){const t=e.getBoundingClientRect(),n=Mr(),r=t.top+t.height/2,i=window.innerHeight/2;return Math.max(0,n.scrollTop+r-i)}function Wee(e,t){if(!e)return 0;const n=oA(e)??Mr(),r=parseFloat(getComputedStyle(e).scrollMarginTop)||0,i=Dv(n),s=n.scrollTop??0,{offsetTop:o=0,scrollTop:l=0}=n;let c=e.getBoundingClientRect().top+l;if(o&&(bA(e)||Kee(e))){const u=e.getBoundingClientRect(),p=u.top-((i==null?void 0:i.top)??0),f=p+u.height,h=n.clientHeight,y=h*.2;p>=y&&f<=h-y?c=s:c=p+s}const d=Math.floor(c-t-r);return d<0?0:d}function Kee(e){return e.offsetParent!==document.body}function bA(e){if(!e)return!1;const t=wc(e);return t?!t.isSameNode(Mr()):!1}function vc(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?vc(e.parentNode,t):!1}function ip(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 m1(e){const{isFirstStep:t,scrollToFirstStep:n,step:r,target:i,targetLifecycle:s}=e;if(r.skipScroll||t&&!n&&s!==Re.TOOLTIP||r.placement==="center")return!1;const o=i!=null&&i.isConnected?wc(i):Mr(),l=o?!o.isSameNode(Mr()):!1;return(r.isFixed||vc(i))&&!l?!1:o.scrollHeight>o.clientHeight}function Mr(){return document.scrollingElement??document.documentElement}function g1(e,t){const{duration:n,element:r}=t;let i=()=>{};const s=new Promise(o=>{const{scrollTop:l}=r,c=e>l?e-l:l-e;i=MZ.top(r,e,{duration:c<100?50:n},()=>{o()})});return{cancel:i,promise:s}}function qee(e){const t=e.replace(/^#?([\da-f])([\da-f])([\da-f])$/i,(r,i,s,o)=>i+i+s+s+o+o),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 kA={backgroundColor:"transparent",border:0,borderRadius:0,color:"#555555",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,WebkitAppearance:"none"},sp={...kA,borderRadius:4,padding:8};function Yee(e,t){const{styles:n}=e,r=Tl(n??{},t.styles??{});let{width:i}=t;Fv()&&(i=typeof i=="number"&&window.innerWidth<i?window.innerWidth-30:i);const s={bottom:0,left:0,overflow:"hidden",position:"absolute",right:0,top:0,zIndex:t.zIndex};return Tl({arrow:{alignItems:"center",color:t.arrowColor,display:"inline-flex",justifyContent:"center",position:"absolute"},beaconWrapper:{...kA,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(${qee(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:{...sp,color:t.primaryColor,marginLeft:"auto",marginRight:5},buttonClose:{...sp,color:t.textColor,height:12,padding:8,position:"absolute",right:0,top:0,width:12},buttonPrimary:{...sp,backgroundColor:t.primaryColor,color:t.backgroundColor},buttonSkip:{...sp,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:{...s,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:i},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 Gee=["after","arrowBase","arrowColor","arrowSize","arrowSpacing","backgroundColor","beaconSize","beaconTrigger","before","beforeTimeout","buttons","closeButtonAction","skipBeacon","dismissKeyAction","disableFocusTrap","hideOverlay","skipScroll","blockTargetInteraction","loaderDelay","offset","overlayClickAction","overlayColor","primaryColor","scrollDuration","scrollOffset","showProgress","spotlightPadding","spotlightRadius","targetWaitTimeout","textColor","width","zIndex"];function zv(e,t){if(!t)return null;const n=Tl(Mee,f1(e,"arrowComponent","beaconComponent","floatingOptions","loaderComponent","locale","styles","tooltipComponent"),t),r=Tl(Lee,e.options??{},f1(t,...Gee)),i=Yee(e,{...n,...r}),s=Tl(Oee,e.floatingOptions??{},n.floatingOptions??{});return{...n,...r,locale:Tl(wA,e.locale??{},n.locale||{}),floatingOptions:s,spotlightPadding:Xee(r.spotlightPadding),styles:i}}function Xee(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 Jee(e,t,n){const{action:r}=t,i=n&&[mt.PREV,mt.NEXT].includes(r);return e.skipBeacon||e.placement==="center"||i}function SA(e,t=!1){return lr.plainObject(e)?e.target?!0:(Hn(t,"tour","target is missing from the step"),!1):(Hn(t,"tour","step must be an object"),!1)}function NA(e,t=!1){return lr.array(e)?e.every(n=>SA(n,t)):(Hn(t,"tour","steps must be an array"),!1)}var Qee=class{constructor(e){dn(this,"beaconPosition",null);dn(this,"debug");dn(this,"eventListeners",new Map);dn(this,"listeners",new Set);dn(this,"props");dn(this,"snapshot");dn(this,"state");dn(this,"steps");dn(this,"tooltipPosition",null);dn(this,"cleanupPositionData",()=>{this.beaconPosition=null,this.tooltipPosition=null});dn(this,"getPositionData",e=>e==="beacon"?this.beaconPosition:this.tooltipPosition);dn(this,"getServerSnapshot",()=>this.snapshot);dn(this,"getSnapshot",()=>this.snapshot);dn(this,"getEventState",()=>Ph(this.snapshot,"positioned"));dn(this,"getState",()=>Ph(this.snapshot,"positioned"));dn(this,"setPositionData",(e,t)=>{var r,i,s;((r=e==="beacon"?this.beaconPosition:this.tooltipPosition)==null?void 0:r.placement)!==t.placement&&Hn(this.debug,`step:${this.state.index}`,"positioned",`${e} ${t.placement}`),e==="beacon"?this.beaconPosition=t:this.tooltipPosition=t,(this.state.lifecycle===Re.BEACON_BEFORE||this.state.lifecycle===Re.TOOLTIP_BEFORE)&&!this.state.positioned&&this.updateState({positioned:!0});const n=(s=(i=this.getStep())==null?void 0:i.floatingOptions)==null?void 0:s.onPosition;n&&n(t)});dn(this,"setSteps",e=>{this.steps=e,this.updateState({size:e.length})});dn(this,"dispatch",(e,t)=>{const n=this.eventListeners.get(e.type);if(n)for(const r of n)try{r(e,t)}catch{}});dn(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)}});dn(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));dn(this,"updateState",(e,t=!1)=>{const{controlled:n,index:r}=this.state,i=this.snapshot,s=n&&!t&&e.index!==void 0?r:e.index??r,o={action:e.action??this.state.action,controlled:n,index:s,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(o);if(this.state=l,!Pv(i,l)){this.snapshot=Object.freeze({...l});for(const c of this.listeners)c(this.snapshot)}});const{initialStepIndex:t,stepIndex:n,steps:r=[]}=e??{},i=lr.number(n);let s=0;this.debug=(e==null?void 0:e.debug)??!1,i?(s=n,lr.number(t)&&Hn(this.debug,"tour","initialStepIndex is ignored in controlled mode")):lr.number(t)&&(t>=0&&t<r.length?s=t:r.length>0&&Hn(this.debug,"tour","initialStepIndex is out of bounds")),this.props=e??{steps:[]},this.steps=r,this.state={action:mt.INIT,controlled:i,index:s,lifecycle:Re.INIT,origin:null,positioned:!1,scrolling:!1,size:r.length,status:r.length?pt.READY:pt.IDLE,waiting:!1},this.snapshot=Object.freeze({...this.state})}applyTransitions(e){return e.status===pt.WAITING&&e.size>0?{...e,status:pt.RUNNING}:e}getStep(e){return zv(this.props,this.steps[e??this.state.index])}};function Zee(e){return new Qee(e)}function y1(e,t){return Math.min(Math.max(e,0),t)}function ete(e,t,n){const r=m.useRef(t),i=m.useRef(n);return r.current=t,i.current=n,m.useMemo(()=>{const s=()=>e.current.getSnapshot();return{close:(S=null)=>{const{index:g,status:v}=s();v===pt.RUNNING&&e.current.updateState({action:mt.CLOSE,index:g+1,origin:S,lifecycle:Re.COMPLETE,positioned:!1,scrolling:!1,waiting:!1})},go:S=>{const{controlled:g,size:v,status:w}=s();if(g){Hn(r.current,"tour","go() is not supported in controlled mode");return}w===pt.RUNNING&&e.current.updateState({action:mt.GO,index:S,lifecycle:Re.COMPLETE,positioned:!1,scrolling:!1,status:S<v?w:pt.FINISHED,waiting:!1})},info:()=>Ph(e.current.getSnapshot(),"positioned"),next:S=>{const{index:g,size:v,status:w}=s();w===pt.RUNNING&&e.current.updateState({action:mt.NEXT,index:y1(g+1,v),lifecycle:Re.COMPLETE,origin:S,positioned:!1,scrolling:!1,waiting:!1})},open:()=>{const{status:S}=s();S===pt.RUNNING&&e.current.updateState({action:mt.UPDATE,lifecycle:Re.TOOLTIP_BEFORE,positioned:!1,scrolling:!1,waiting:!1})},prev:S=>{const{index:g,size:v,status:w}=s();w===pt.RUNNING&&e.current.updateState({action:mt.PREV,index:y1(g-1,v),lifecycle:Re.COMPLETE,origin:S,positioned:!1,scrolling:!1,waiting:!1})},reset:(S=!1)=>{const{controlled:g}=s();if(g){Hn(r.current,"tour","reset() is not supported in controlled mode");return}i.current(),e.current.updateState({action:mt.RESET,index:0,lifecycle:Re.INIT,positioned:!1,scrolling:!1,status:S?pt.RUNNING:pt.READY,waiting:!1})},skip:S=>{const{status:g}=s();g===pt.RUNNING&&e.current.updateState({action:mt.SKIP,lifecycle:Re.COMPLETE,origin:S,positioned:!1,scrolling:!1,status:pt.SKIPPED,waiting:!1})},start:S=>{const{index:g,size:v}=s();i.current(),e.current.updateState({action:mt.START,index:lr.number(S)?S:g,lifecycle:Re.INIT,positioned:!1,scrolling:!1,status:v?pt.RUNNING:pt.WAITING,waiting:!1},!0)},stop:(S=!1)=>{const{index:g,status:v}=s();[pt.FINISHED,pt.SKIPPED].includes(v)||e.current.updateState({action:mt.STOP,index:g+(S?1:0),lifecycle:Re.COMPLETE,positioned:!1,scrolling:!1,status:pt.PAUSED,waiting:!1})}}},[e])}const tte=new Set(["origin","positioned"]);function nte(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!t)return;const r=e.current.getSnapshot();return Hn(!0,"tour","init",r),n.current=r,e.current.subscribe(i=>{const s=n.current;if(n.current=i,!s)return;const o={};let l=!1;for(const c of Object.keys(i))i[c]!==s[c]&&!tte.has(c)&&(o[c]={from:s[c],to:i[c]},(c==="status"||c==="size")&&(l=!0));Object.keys(o).length&&(!l&&i.index>=i.size||Hn(!0,l?"tour":`step:${i.index}`,"state",o))})},[t,e])}function rte(e,t,n){const r=m.useRef(e),i=m.useRef(t);return r.current=e,i.current=t,m.useCallback((s,o,l)=>{var d;const c={...n.current.getEventState(),error:null,scroll:null,step:o,type:s,...l};(d=r.current)==null||d.call(r,c,i.current),n.current.dispatch(c,i.current)},[n])}function vo(e,t){return{hasChanged(n){return e[n]!==t[n]},hasChangedTo(n,r){const i=e[n],s=t[n];return Array.isArray(r)?r.includes(i)&&!r.includes(s):i===r&&s!==r},previous:t}}function ite(e){const{addFailure:t,controls:n,emitEvent:r,previousState:i,props:s,state:o,step:l,store:c}=e,{action:d,index:u,lifecycle:p,positioned:f,scrolling:h,size:y,status:b}=o,S=QI(l)??null,g=m.useRef(null),v=m.useRef(s),w=m.useRef(o),k=m.useRef(i),E=m.useRef(l),j=m.useRef(S),P=m.useRef(n),O=m.useRef(null),F=m.useRef(null),W=m.useRef(null);v.current=s,w.current=o,k.current=i,E.current=l,j.current=S,P.current=n;const R=()=>{O.current&&(clearInterval(O.current),O.current=null),F.current=null,W.current&&(W.current.cancel(),W.current=null)};m.useEffect(()=>{if(!k.current)return;const{hasChangedTo:I}=vo(w.current,k.current);(I("action",[mt.NEXT,mt.PREV,mt.SKIP,mt.CLOSE])||g.current===mt.CLOSE&&d===mt.START)&&(g.current=d)},[d]),m.useEffect(()=>{if(!k.current)return()=>{R()};const{hasChanged:I}=vo(w.current,k.current),q=E.current;if(I("index")&&R(),b!==pt.RUNNING||!q||p!==Re.INIT)return()=>{R()};const{hasChangedTo:$}=vo(w.current,k.current);$("status",pt.RUNNING)&&[pt.IDLE,pt.READY,pt.PAUSED].includes(k.current.status)&&r(zn.TOUR_START,q),c.current.cleanupPositionData();const{debug:H}=v.current;if(q.before&&!W.current){Hn(H,`step:${u}`,"before()",q),W.current={cancel:()=>{}},c.current.updateState({waiting:!0}),r(zn.STEP_BEFORE_HOOK,q,{action:g.current??w.current.action});const z=()=>{W.current=null,c.current.updateState({action:g.current??w.current.action,waiting:!1,lifecycle:Re.READY})},Y=new AbortController,A=q.beforeTimeout;W.current={cancel:()=>Y.abort()};const T=A?setTimeout(()=>{Y.signal.aborted||(Hn(H,`step:${u}`,"before()","timed out",`${A}ms`),Y.abort(),t(q,"before_hook"),r(zn.ERROR,q,{error:new Error("Step before hook timed out")}),z())},A):null;q.before({...c.current.getState(),action:g.current??c.current.getState().action,step:q}).then(()=>{Y.signal.aborted||(T&&clearTimeout(T),z())}).catch(C=>{Y.signal.aborted||(T&&clearTimeout(T),t(q,"before_hook"),r(zn.ERROR,q,{error:C instanceof Error?C:new Error(String(C))}),z())})}else if(!W.current){O.current&&F.current!==q.target&&R();const z=hi(q.target);if(z&&ip(z))R(),c.current.updateState({action:g.current??mt.UPDATE,lifecycle:Re.READY,waiting:!1});else if(q.targetWaitTimeout===0)c.current.updateState({action:g.current??mt.UPDATE,lifecycle:Re.READY,waiting:!1});else if(!O.current){const{targetWaitTimeout:Y}=q,A=Date.now();F.current=q.target,Hn(H,`step:${u}`,"polling","started",`${Y}ms`),c.current.updateState({waiting:!0}),O.current=setInterval(()=>{const T=hi(q.target),C=Date.now()-A,G=C>=Y;(T&&ip(T)||G)&&(Hn(H,`step:${u}`,"polling",T&&ip(T)?"found":"timed out",`${C}ms`),R(),c.current.updateState({action:g.current??mt.UPDATE,lifecycle:Re.READY,waiting:!1}))},100)}}return()=>{R()}},[t,r,u,p,b,c]),m.useEffect(()=>{if(!k.current)return;const{hasChanged:I,hasChangedTo:q,previous:$}=vo(w.current,k.current),H=E.current;if(!H)return;const z=hi(H.target),Y=!!z;if(Y&&ip(z)){if(q("lifecycle",Re.READY)&&$.lifecycle===Re.INIT&&r(zn.STEP_BEFORE,H,{action:g.current??w.current.action}),q("lifecycle",Re.READY)){const A=w.current,T=Jee(H,A,v.current.continuous)?Re.TOOLTIP:Re.BEACON,C=hi(H.scrollTarget??H.spotlightTarget??H.target),G=m1({isFirstStep:A.index===0,scrollToFirstStep:v.current.scrollToFirstStep,step:H,target:C,targetLifecycle:T}),Q=T===Re.TOOLTIP?Re.TOOLTIP_BEFORE:Re.BEACON_BEFORE;Hn(v.current.debug,`step:${u}`,"scroll",G?"needed":"skipped"),c.current.updateState({action:mt.UPDATE,lifecycle:Q,scrolling:G})}}else if(w.current.status===pt.RUNNING&&p!==Re.INIT&&p!==Re.COMPLETE&&I("lifecycle")){Hn(v.current.debug,`step:${u}`,Y?"Target not visible":"Target not mounted",H),t(H,"target_not_found"),r(zn.TARGET_NOT_FOUND,H);const A=w.current;A.controlled||c.current.updateState({action:mt.UPDATE,index:A.index+(A.action===mt.PREV?-1:1),lifecycle:Re.INIT})}},[t,r,u,p,c]),m.useEffect(()=>{if(!k.current)return;const{hasChangedTo:I,previous:q}=vo(w.current,k.current),$=E.current,H=j.current;if($&&I("lifecycle",Re.TOOLTIP_BEFORE)&&q.lifecycle===Re.BEACON){const A=hi($.scrollTarget??$.spotlightTarget??$.target);if(m1({isFirstStep:w.current.index===0,scrollToFirstStep:v.current.scrollToFirstStep,step:$,target:A,targetLifecycle:Re.TOOLTIP})){c.current.updateState({scrolling:!0,positioned:!1});return}}const z=p===Re.BEACON_BEFORE||p===Re.TOOLTIP_BEFORE;if($&&z&&!h){const A=p===Re.TOOLTIP_BEFORE?Re.TOOLTIP:Re.BEACON;c.current.updateState({action:mt.UPDATE,lifecycle:A})}$&&I("lifecycle",Re.BEACON)&&r(zn.BEACON,$),$&&I("lifecycle",Re.TOOLTIP)&&r(zn.TOOLTIP,$);const Y=w.current;if((Y.status===pt.RUNNING||Y.controlled&&Y.status===pt.PAUSED&&$)&&H&&I("lifecycle",Re.COMPLETE)&&q.lifecycle===Re.TOOLTIP&&(r(zn.STEP_AFTER,H,{action:g.current??mt.UPDATE,index:q.index??Y.index,lifecycle:Y.lifecycle}),H.after)){r(zn.STEP_AFTER_HOOK,H,{action:g.current??mt.UPDATE,index:q.index??Y.index,lifecycle:Y.lifecycle});try{H.after({...c.current.getState(),action:g.current??mt.UPDATE,index:q.index??Y.index,lifecycle:Y.lifecycle,step:H})}catch{}}},[r,p,f,h,c]),m.useEffect(()=>{if(!k.current)return;const{hasChangedTo:I,previous:q}=vo(w.current,k.current),$=E.current,H=j.current;y&&!$&&p===Re.INIT&&c.current.updateState({action:mt.UPDATE,lifecycle:Re.COMPLETE,status:pt.FINISHED}),!w.current.controlled&&b===pt.RUNNING&&I("lifecycle",Re.COMPLETE)&&u<y&&c.current.updateState({action:mt.UPDATE,lifecycle:Re.INIT}),I("lifecycle",Re.COMPLETE)&&u>=y&&c.current.updateState({action:mt.UPDATE,lifecycle:Re.COMPLETE,status:pt.FINISHED});const z=$??H??zv(v.current,v.current.steps[u-1]);if(z&&I("status",[pt.FINISHED,pt.SKIPPED])){let Y;$?Y=u:H?Y=q.index??u:Y=u-1,r(zn.TOUR_END,z,{index:Y}),w.current.controlled||P.current.reset(),g.current=null}$&&I("action",mt.STOP)&&(g.current=null,r(zn.TOUR_STATUS,$)),$&&I("action",mt.RESET)&&(r(zn.TOUR_STATUS,$),g.current=null)},[d,r,u,p,y,b,c])}function ste({controls:e,emitEvent:t,props:n,state:r,store:i}){const{debug:s,initialStepIndex:o,run:l,stepIndex:c,steps:d}=n,u=m.useRef(void 0),p=m.useRef(r),f=m.useRef(e);p.current=r,f.current=e,m.useEffect(()=>{const h=u.current;if(u.current=n,!h||n===h)return;const{hasChanged:y}=vo(n,h);if(Pv(h.steps,d)||(NA(d,s)?i.current.setSteps(d):(Hn(s,"tour","Steps are not valid",d),t(zn.ERROR,d[0]??{target:"",content:""},{error:new Error("Steps are not valid")}))),y("run"))l?i.current.getState().size&&f.current.start(c??o):f.current.stop();else if(lr.number(c)&&y("stepIndex")){const b=lr.number(h.stepIndex)&&h.stepIndex<c?mt.NEXT:mt.PREV;[pt.FINISHED,pt.SKIPPED].includes(p.current.status)||i.current.updateState({action:b,index:c,lifecycle:Re.INIT,positioned:!1},!0)}},[s,t,o,n,l,c,d,i])}function ote(e,t){var l,c,d,u;const{beaconPosition:n,lifecycle:r,scrollOffset:i,step:s}=t;if(s.scrollTarget||s.spotlightTarget)return Math.max(0,e);let o=e-s.spotlightPadding.top;if(r===Re.BEACON_BEFORE&&(n!=null&&n.placement)){const p=ate(n);["bottom"].includes(n.placement)||(o+=Math.floor(p-i))}else if(r===Re.TOOLTIP_BEFORE){const{placement:p}=s;if(p==="top"){const f=((l=document.querySelector(".react-joyride__floater"))==null?void 0:l.getBoundingClientRect().height)??0,h=(c=s.floatingOptions)!=null&&c.hideArrow?0:s.arrowSize,y=s.offset+s.spotlightPadding.top+h;o-=f+y}else if(p==="left"||p==="right"){const f=((d=document.querySelector(".react-joyride__floater"))==null?void 0:d.getBoundingClientRect().height)??0,h=((u=hi(s.target))==null?void 0:u.getBoundingClientRect().height)??0,y=i+s.spotlightPadding.top+h/2-f/2;y<i&&(o-=i-y)}}return Math.max(0,o)}function ate(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 lte({emitEvent:e,previousState:t,props:n,state:r,step:i,store:s}){const{index:o,lifecycle:l,positioned:c,scrolling:d,status:u}=r,p=m.useRef(null),f=m.useRef(r),h=m.useRef(t),y=m.useRef(n),b=m.useRef(i);f.current=r,h.current=t,y.current=n,b.current=i,m.useEffect(()=>()=>{var S;(S=p.current)==null||S.call(p)},[]),m.useEffect(()=>{var E;if(!h.current||!b.current)return;const{hasChangedTo:S}=vo(f.current,h.current),g=b.current,{debug:v}=y.current,{scrollDuration:w}=g,k=l===Re.BEACON_BEFORE||l===Re.TOOLTIP_BEFORE;if(u===pt.RUNNING&&k&&d&&S("positioned",!0)){const j=hi(g.scrollTarget??g.spotlightTarget??g.target),P=s.current.getPositionData("beacon"),O=wc(j),F=O?!O.isSameNode(Mr()):!1;(E=p.current)==null||E.call(p),(async()=>{if(F&&!vc(O)){const Y=Mr(),A=Vee(O),T={initial:Y.scrollTop,target:A,element:Y,duration:w};e(zn.SCROLL_START,g,{scroll:T});const{cancel:C,promise:G}=g1(A,{element:Y,duration:w});p.current=C,await G,e(zn.SCROLL_END,g,{scroll:T})}const R=Math.floor(Wee(j,g.scrollOffset))||0,I=F?R:ote(R,{beaconPosition:P,lifecycle:l,scrollOffset:g.scrollOffset,step:g});Hn(v,`step:${o}`,"scroll",F?"custom":"document",`${R} → ${I}`);const q=O,$={initial:q.scrollTop,target:I,element:q,duration:w};e(zn.SCROLL_START,g,{scroll:$});const{cancel:H,promise:z}=g1(I,{element:q,duration:w});p.current=H,await z,e(zn.SCROLL_END,g,{scroll:$}),s.current.updateState({scrolling:!1})})().catch(()=>{s.current.updateState({scrolling:!1})})}},[e,o,l,c,d,u,s])}function cte(e){const t=WQ(()=>zee($ee,e),[e]),{debug:n,initialStepIndex:r,onEvent:i,run:s,stepIndex:o,steps:l}=t,c=m.useRef(Zee(t)),d=c_.useSyncExternalStore(c.current.subscribe,c.current.getSnapshot,c.current.getServerSnapshot),[u,p]=m.useState([]),f=m.useCallback((E,j)=>{p(P=>[...P,{reason:j,step:E}])},[]),h=m.useCallback(()=>{p([])},[]);nte(c,n);const y=ete(c,n,h),b=rte(i,y,c),{index:S,size:g,status:v}=d,w=QI(d),k=m.useMemo(()=>zv(t,l[S]),[S,t,l]);return KQ(()=>{s&&g&&NA(l,n)&&y.start(o??r)}),VQ(()=>{s&&g&&v===pt.IDLE&&c.current.updateState({status:pt.READY})},[s,g,v]),ste({controls:y,emitEvent:b,props:t,state:d,store:c}),ite({addFailure:f,controls:y,emitEvent:b,previousState:w,props:t,state:d,step:k,store:c}),lte({emitEvent:b,previousState:w,props:t,state:d,step:k,store:c}),{controls:y,failures:u,mergedProps:t,state:d,step:k,store:c}}function ute(e){const[t,n]=m.useState(null);return m.useEffect(()=>{let r=null,i=!1;if(e)if(lr.domElement(e))r=e,i=!0;else{const s=document.querySelector(e);s&&(r=s)}else{const s=document.createElement("div");s.id=Fee,document.body.appendChild(s),r=s}return n(r),()=>{!r||i||r.parentNode===document.body&&document.body.removeChild(r)}},[e]),t}const dte={animation:"joyride-loader-spin 1s linear infinite",border:"5px solid rgba(0, 0, 0, 0.1)",borderRadius:"50%",borderTopColor:"#555"};function fte({nonce:e,step:t}){const{loaderComponent:n}=t,r=!!n;if(m.useEffect(()=>{if(r||document.getElementById("joyride-loader-animation"))return yd;const c=document.createElement("style");return c.id="joyride-loader-animation",e&&c.setAttribute("nonce",e),c.appendChild(document.createTextNode(`
169
- @keyframes joyride-loader-spin {
170
- to { transform: rotate(360deg); }
171
- }
172
- `)),document.head.appendChild(c),()=>{const d=document.getElementById("joyride-loader-animation");d!=null&&d.parentNode&&d.parentNode.removeChild(d)}},[r,e]),n===null)return null;const{height:i,width:s,...o}=t.styles.loader;let l;if(n){const c=n;l=We.createElement(c,{step:t})}else l=We.createElement("div",{style:{...dte,height:i,width:s,borderTopColor:t.primaryColor}});return We.createElement("div",{className:"react-joyride__loader","data-testid":"loader",style:o},l)}const pte={height:0,isFixed:!1,left:0,top:0,width:0};function iu(e,t){const n=hi(e);if(!n)return pte;const r=Dv(n),i=vc(n),s=Uee(n,t.top,i);return{height:Math.round(((r==null?void 0:r.height)??0)+t.top+t.bottom),isFixed:i,left:Math.round(((r==null?void 0:r.left)??0)-t.left),top:s,width:Math.round(((r==null?void 0:r.width)??0)+t.left+t.right)}}function hte(e,t,n){const[r,i]=m.useState(()=>iu(e,t)),s=m.useRef(void 0),o=m.useRef(null),l=m.useRef(n),c=m.useRef(null),d=m.useCallback(()=>{clearTimeout(s.current),s.current=window.setTimeout(()=>{i(p=>{const f=iu(e,t);return p.top===f.top&&p.left===f.left&&p.width===f.width&&p.height===f.height&&p.isFixed===f.isFixed?p:f})},100)},[e,t]);m.useEffect(()=>{let p=null;const f=y=>{o.current=wc(y,!0),o.current&&o.current.addEventListener("scroll",d,{passive:!0}),window.addEventListener("scroll",d,{passive:!0}),window.addEventListener("resize",d),typeof ResizeObserver<"u"&&(c.current=new ResizeObserver(d),c.current.observe(y)),i(iu(e,t))},h=hi(e);return h?f(h):(p=new MutationObserver(()=>{const y=hi(e);y&&(p==null||p.disconnect(),p=null,f(y))}),p.observe(document.body,{childList:!0,subtree:!0})),()=>{var y;p==null||p.disconnect(),o.current&&o.current.removeEventListener("scroll",d),window.removeEventListener("scroll",d),window.removeEventListener("resize",d),(y=c.current)==null||y.disconnect(),clearTimeout(s.current)}},[e,t,d]),m.useEffect(()=>{l.current&&!n&&i(iu(e,t)),l.current=n},[n,e,t]);let u=r;return l.current&&!n&&(u=iu(e,t)),u}function mte(e,t,n){let r=`M0 0H${e}V${t}H0Z`;return n&&(r+=` ${n}`),r}function x1(e,t,n,r,i){if(n<=0||r<=0)return"";const s=Math.max(0,Math.min(i,n/2,r/2));let o=`M${e+s} ${t}`;return o+=`H${e+n-s}`,o+=`A${s} ${s} 0 0 1 ${e+n} ${t+s}`,o+=`V${t+r-s}`,o+=`A${s} ${s} 0 0 1 ${e+n-s} ${t+r}`,o+=`H${e+s}`,o+=`A${s} ${s} 0 0 1 ${e} ${t+r-s}`,o+=`V${t+s}`,o+=`A${s} ${s} 0 0 1 ${e+s} ${t}Z`,o}const gte=[Re.BEACON_BEFORE,Re.BEACON];function yte(e){var z,Y;const{blockTargetInteraction:t,continuous:n,hideOverlay:r,lifecycle:i,onClickOverlay:s,overlayClickAction:o,placement:l,portalElement:c,scrolling:d,spotlightPadding:u,spotlightRadius:p,spotlightTarget:f,styles:h,target:y,waiting:b}=e,S=qQ(),g=hte(f??y,u,d||b),v=m.useRef(null),w=(i===Re.TOOLTIP||i===Re.TOOLTIP_BEFORE)&&l!=="center",[k,E]=m.useState(!1),j=c?(z=v.current)==null?void 0:z.offsetParent:null,P=(j==null?void 0:j.clientWidth)??S.width,O=(j==null?void 0:j.clientHeight)??Hee()??S.height,F=((Y=h.overlay)==null?void 0:Y.backgroundColor)??"rgba(0, 0, 0, 0.5)",W=m.useMemo(()=>{const{backgroundColor:A,mixBlendMode:T,...C}=h.overlay;return{height:O,pointerEvents:"none",...C}},[O,h.overlay]),R=w&&!d&&!b;m.useEffect(()=>{R?requestAnimationFrame(()=>E(!0)):E(!1)},[R]);const I=n&&gte.includes(i),q=!n&&i!==Re.TOOLTIP;if(r||!b&&(I||q))return null;let $="";if(R)if(c&&j){const A=hi(f??y);if(A){const T=h1(A),C=h1(j);$=x1(T.left-C.left-u.left,T.top-C.top-u.top,A.offsetWidth+u.left+u.right,A.offsetHeight+u.top+u.bottom,p)}}else $=x1(g.left,g.top,g.width,g.height,p);const H=mte(P,O,$);return We.createElement("div",{ref:v,"aria-hidden":"true",className:"react-joyride__overlay","data-testid":"overlay",style:W},We.createElement("svg",{className:"react-joyride__spotlight","data-testid":"spotlight",style:{height:O,left:0,position:g.isFixed?"fixed":"absolute",top:0,width:P}},We.createElement("path",{d:H,fill:F,fillRule:"evenodd",onClick:s,style:{cursor:o?"pointer":"default",pointerEvents:"auto"}}),$&&We.createElement("path",{d:$,fill:F,style:{opacity:k?0:1,pointerEvents:t?"auto":"none",transition:"opacity 0.2s"}}),$&&Object.keys(h.spotlight).length>0&&We.createElement("path",{d:$,fill:"none",style:{pointerEvents:"none"},...h.spotlight})))}function jA(e){const{children:t,element:n}=e;return n?Tr.createPortal(t,n):null}const xte='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), area[href], [tabindex]:not([tabindex="-1"]), [contenteditable]';function wte(e,t){const n=m.useRef(null);m.useEffect(()=>{if(!e)return yd;n.current=document.activeElement;const r=s=>{if(s.key!=="Tab")return;const o=[...e.querySelectorAll(xte)],{shiftKey:l}=s;if(!o.length)return;s.preventDefault();let c=document.activeElement?o.indexOf(document.activeElement):0;c===-1||!l&&c+1===o.length?c=0:l&&c===0?c=o.length-1:c+=l?-1:1,o[c].focus()};e.addEventListener("keydown",r,!1);let i;{const s=e.querySelector(t);s&&(i=setTimeout(()=>{s.focus({preventScroll:!0})},100))}return()=>{var s;e.removeEventListener("keydown",r),i!==void 0&&clearTimeout(i),(s=n.current)==null||s.focus({preventScroll:!0})}},[e,t])}function Us(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 vte(e,t,n){const[r]=e.split("-");switch(r){case"top":return{points:`0,0 ${t/2},${n} ${t},0`,...Us(e,t,n)};case"bottom":return{points:`${t},${n} ${t/2},0 0,${n}`,...Us(e,t,n)};case"left":return{points:`0,0 ${n},${t/2} 0,${t}`,...Us(e,t,n)};case"right":return{points:`${n},${t} ${n},0 0,${t/2}`,...Us(e,t,n)};default:return null}}function bte(e,t,n,r){if(!t)return{};const[i]=e.split("-");switch(i){case"top":return{bottom:-n,left:t.x??0,...Us(e,r,n)};case"bottom":return{top:-n,left:t.x??0,...Us(e,r,n)};case"left":return{right:-n,top:t.y??0,...Us(e,r,n)};case"right":return{left:-n,top:t.y??0,...Us(e,r,n)};default:return{}}}function kte({arrowComponent:e,arrowRef:t,base:n,placement:r,position:i,size:s,styles:o}){const l=e;let c=null;if(l){if(!Us(r,n,s))return null;c=We.createElement("span",{style:{flexShrink:0}},We.createElement(l,{base:n,placement:r,size:s}))}else{const d=vte(r,n,s);if(!d)return null;c=We.createElement("svg",{height:d.height,width:d.width,xmlns:"http://www.w3.org/2000/svg"},We.createElement("polygon",{fill:"currentColor",points:d.points}))}return We.createElement("span",{ref:t,className:"react-joyride__arrow","data-testid":"arrow",style:{...o,...bte(r,i,s,n),...i?{}:{visibility:"hidden"}}},c)}function Ste(e){const{beaconComponent:t,continuous:n,index:r,isLastStep:i,locale:s,nonce:o,onInteract:l,shouldFocus:c,size:d,step:u,styles:p}=e,f=m.useRef(null),h=!!t;m.useEffect(()=>{if(h||document.getElementById("joyride-beacon-animation"))return yd;const S=document.createElement("style");S.id="joyride-beacon-animation",o&&S.setAttribute("nonce",o),S.appendChild(document.createTextNode(`
173
- @keyframes joyride-beacon-inner {
174
- 20% {
175
- opacity: 0.9;
176
- }
177
-
178
- 90% {
179
- opacity: 0.7;
180
- }
181
- }
182
-
183
- @keyframes joyride-beacon-outer {
184
- 0% {
185
- transform: scale(1);
186
- }
187
-
188
- 45% {
189
- opacity: 0.7;
190
- transform: scale(0.75);
191
- }
192
-
193
- 100% {
194
- opacity: 0.9;
195
- transform: scale(1);
196
- }
197
- }
198
- `)),document.head.appendChild(S);const g=setTimeout(()=>{lr.domElement(f.current)&&c&&f.current.focus()},0);return()=>{clearTimeout(g);const v=document.getElementById("joyride-beacon-animation");v!=null&&v.parentNode&&v.parentNode.removeChild(v)}},[h,o,c]);const y=Ds(s.open);let b;if(t){const S=t;b=We.createElement(S,{continuous:n,index:r,isLastStep:i,size:d,step:u})}else b=We.createElement("span",{style:p.beacon},We.createElement("span",{style:p.beaconOuter}),We.createElement("span",{style:p.beaconInner}));return We.createElement("button",{ref:f,"aria-label":y,className:"react-joyride__beacon","data-testid":"button-beacon",onClick:l,onMouseEnter:l,style:p.beaconWrapper,title:y,type:"button"},b)}function Nte({styles:e,...t}){const{color:n,height:r,width:i,...s}=e;return We.createElement("button",{style:s,type:"button",...t},We.createElement("svg",{height:typeof r=="number"?`${r}px`:r,preserveAspectRatio:"xMidYMid",version:"1.1",viewBox:"0 0 18 18",width:typeof i=="number"?`${i}px`:i,xmlns:"http://www.w3.org/2000/svg"},We.createElement("g",null,We.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 jte(e){const{backProps:t,closeProps:n,index:r,isLastStep:i,primaryProps:s,skipProps:o,step:l,tooltipProps:c}=e,{buttons:d,content:u,styles:p,title:f}=l,h={};d.includes("primary")&&(h.primary=We.createElement("button",{"data-testid":"button-primary",style:p.buttonPrimary,type:"button",...s})),d.includes("skip")&&!i&&(h.skip=We.createElement("button",{"aria-live":"off","data-testid":"button-skip",style:p.buttonSkip,type:"button",...o})),d.includes("back")&&r>0&&(h.back=We.createElement("button",{"data-testid":"button-back",style:p.buttonBack,type:"button",...t})),h.close=d.includes("close")&&We.createElement(Nte,{"data-testid":"button-close",styles:p.buttonClose,...n});const y=f?{"aria-labelledby":"joyride-tooltip-title","aria-describedby":"joyride-tooltip-content"}:{"aria-label":Ds(u),"aria-describedby":"joyride-tooltip-content"};return We.createElement("div",{key:"JoyrideTooltip",className:"react-joyride__tooltip","data-joyride-step":r,...l.id&&{"data-joyride-id":l.id},style:p.tooltip,...c,...y},We.createElement("div",{style:p.tooltipContainer},f&&We.createElement("h4",{id:"joyride-tooltip-title",style:p.tooltipTitle},f),We.createElement("div",{id:"joyride-tooltip-content",style:p.tooltipContent},u)),d.some(b=>b==="back"||b==="primary"||b==="skip")&&We.createElement("div",{style:p.tooltipFooter},We.createElement("div",{style:p.tooltipFooterSpacer},h.skip),h.back,h.primary),h.close)}function Cte(e){const{continuous:t,controls:n,index:r,isLastStep:i,size:s,step:o}=e,l=g=>{g.preventDefault(),n.prev(ds.BUTTON_BACK)},c=g=>{g.preventDefault(),o.closeButtonAction==="skip"?n.skip(ds.BUTTON_CLOSE):n.close(ds.BUTTON_CLOSE)},d=g=>{if(g.preventDefault(),!t){n.close(ds.BUTTON_PRIMARY);return}n.next(ds.BUTTON_PRIMARY)},u=g=>{g.preventDefault(),n.skip(ds.BUTTON_SKIP)},p=()=>{const{back:g,close:v,last:w,next:k,nextWithProgress:E,skip:j}=o.locale,P=Ds(g),O=Ds(v),F=Ds(w),W=Ds(k),R=Ds(j);let I=v,q=O;if(t){if(I=k,q=W,o.showProgress&&!i){const $=Ds(E,{step:r+1,steps:s});I=Ux(E,r+1,s),q=$}i&&(I=w,q=F)}return{backProps:{"aria-label":P,children:g,"data-action":"back",onClick:l,role:"button",title:P},closeProps:{"aria-label":O,children:v,"data-action":"close",onClick:c,role:"button",title:O},primaryProps:{"aria-label":q,children:I,"data-action":"primary",onClick:d,role:"button",title:q},skipProps:{"aria-label":R,children:j,"data-action":"skip",onClick:u,role:"button",title:R},tooltipProps:{"aria-modal":!0,role:"alertdialog"}}},{arrowComponent:f,beaconComponent:h,tooltipComponent:y,...b}=o;let S;if(y){const g=y;S=We.createElement(g,{...p(),continuous:t,controls:n,index:r,isLastStep:i,size:s,step:b})}else S=We.createElement(jte,{...p(),continuous:t,controls:n,index:r,isLastStep:i,size:s,step:b});return S}function Ete(e){if(e.startsWith("left"))return["top","bottom"];if(e.startsWith("right"))return["bottom","top"]}function _te(e,t,n){var r,i;return e?[Tee()]:((r=t.floatingOptions)==null?void 0:r.flipOptions)===!1?[]:[Aee({crossAxis:!1,fallbackPlacements:Ete(n),padding:20,...(i=t.floatingOptions)==null?void 0:i.flipOptions})]}function Pte(e){var T,C,G,Q,M;const{continuous:t,controls:n,index:r,lifecycle:i,nonce:s,open:o,portalElement:l,setPositionData:c,setTooltipRef:d,shouldScroll:u,size:p,step:f,target:h,updateState:y}=e,b=m.useRef(null),S=m.useRef({}),g=m.useRef({}),v=f.placement==="center",w=f.placement==="auto",k=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})}),[]),E=m.useMemo(()=>bA(h)?wc(h):void 0,[h]),j=m.useMemo(()=>vc(h),[h]),P=m.useMemo(()=>E?{boundary:E,rootBoundary:"viewport"}:{},[E]),O=v||w?"bottom":f.placement,F=v?"fixed":((T=f.floatingOptions)==null?void 0:T.strategy)??(f.isFixed||j?"fixed":"absolute"),W=m.useMemo(()=>{var te,ce,le,de;return v?[{name:"center",fn:({rects:ue})=>({x:(window.innerWidth-ue.floating.width)/2,y:(window.innerHeight-ue.floating.height)/2})}]:[d1(({placement:ue})=>{var fe;let se="right";ue.startsWith("top")?se="top":ue.startsWith("bottom")?se="bottom":ue.startsWith("left")&&(se="left");const re=f.spotlightTarget?0:f.spotlightPadding[se];return f.offset+re+((fe=f.floatingOptions)!=null&&fe.hideArrow?0:f.arrowSize)},[f.offset,f.spotlightPadding,f.spotlightTarget,f.arrowSize,(te=f.floatingOptions)==null?void 0:te.hideArrow]),..._te(w,f,O),Iee({padding:10,...P,...(ce=f.floatingOptions)==null?void 0:ce.shiftOptions}),...(le=f.floatingOptions)!=null&&le.hideArrow?[]:[Ree({element:b,padding:f.arrowSpacing},[f.arrowSpacing,f.arrowBase])],...((de=f.floatingOptions)==null?void 0:de.middleware)??[]]},[v,f,w,O,P]),R=u1({...v?{elements:{reference:k}}:{},placement:O,strategy:F,middleware:W}),I=u1({strategy:F,placement:f.beaconPlacement??(w||v?"bottom":f.placement),middleware:m.useMemo(()=>{var te,ce;return[d1(((ce=(te=f.floatingOptions)==null?void 0:te.beaconOptions)==null?void 0:ce.offset)??-18)]},[(G=(C=f.floatingOptions)==null?void 0:C.beaconOptions)==null?void 0:G.offset]),whileElementsMounted:a1});g.current=R.middlewareData,S.current=I.middlewareData,m.useEffect(()=>{var le;const{floating:te,reference:ce}=R.elements;if(!(!ce||!te||i!==Re.TOOLTIP))return a1(ce,te,R.update,(le=f.floatingOptions)==null?void 0:le.autoUpdate)},[i,R.update,(Q=f.floatingOptions)==null?void 0:Q.autoUpdate,f.target,R.elements]),m.useEffect(()=>{!v&&h&&R.refs.setReference(h),h&&I.refs.setReference(h)},[I.refs,v,h,R.refs]),m.useEffect(()=>{R.isPositioned&&c("tooltip",{placement:R.placement,x:R.x??0,y:R.y??0,middlewareData:g.current})},[c,R.isPositioned,R.placement,R.x,R.y]),m.useEffect(()=>{I.isPositioned&&c("beacon",{placement:I.placement,x:I.x??0,y:I.y??0,middlewareData:S.current})},[c,I.isPositioned,I.placement,I.x,I.y]);const q=f.zIndex+100,$=m.useCallback(te=>{te.type==="mouseenter"&&f.beaconTrigger!=="hover"||y({lifecycle:Re.TOOLTIP_BEFORE,positioned:!1})},[f.beaconTrigger,y]),H=m.useCallback(te=>{te&&(R.refs.setFloating(te),d(te))},[R.refs,d]),{arrow:z,floater:Y}=f.styles;let A=null;if(i===Re.TOOLTIP||i===Re.TOOLTIP_BEFORE){const te=p1({...Y,...R.floatingStyles,zIndex:q,opacity:o&&R.isPositioned?1:0,...!o&&{transition:"none"}});A=We.createElement("div",{ref:H,className:"react-joyride__floater","data-testid":"floater",id:`react-joyride-step-${r}`,style:te},We.createElement(Cte,{continuous:t,controls:n,index:r,isLastStep:r+1===p,size:p,step:f}),!v&&!((M=f.floatingOptions)!=null&&M.hideArrow)&&We.createElement(kte,{arrowComponent:f.arrowComponent,arrowRef:b,base:f.arrowBase,placement:R.placement,position:R.middlewareData.arrow,size:f.arrowSize,styles:z}))}else(i===Re.BEACON||i===Re.BEACON_BEFORE)&&(A=We.createElement("div",{ref:I.refs.setFloating,className:"react-joyride__floater","data-testid":"floater-beacon",id:`react-joyride-step-${r}-beacon`,style:p1({...I.floatingStyles,zIndex:q})},We.createElement(Ste,{beaconComponent:f.beaconComponent,continuous:t,index:r,isLastStep:r+1===p,locale:f.locale,nonce:s,onInteract:$,shouldFocus:u,size:p,step:f,styles:f.styles})));return We.createElement(jA,{element:l},A)}function Ite(e){const{continuous:t,controls:n,index:r,lifecycle:i,nonce:s,portalElement:o,setPositionData:l,shouldScroll:c,size:d,step:u,updateState:p}=e,[f,h]=m.useState(null);wte(u.disableFocusTrap?null:f,"[data-action=primary]");const y=hi(u.target),b=i===Re.TOOLTIP;return!SA(u)||!lr.domElement(y)?null:We.createElement(Pte,{key:`JoyrideStep-${r}`,continuous:t,controls:n,index:r,lifecycle:i,nonce:s,open:b,portalElement:o,setPositionData:l,setTooltipRef:h,shouldScroll:c,size:d,step:u,target:y,updateState:p})}function Ate({controls:e,mergedProps:t,state:n,step:r,store:i}){const{continuous:s,debug:o,nonce:l,portalElement:c,scrollToFirstStep:d}=t,u=ute(c),{index:p,lifecycle:f,status:h}=n,y=h===pt.RUNNING,[b,S]=m.useState(!1),g=m.useRef(null),v=(r==null?void 0:r.loaderDelay)??0;m.useEffect(()=>(n.waiting?v===0?S(!0):g.current=setTimeout(()=>{S(!0)},v):S(!1),()=>{g.current&&(clearTimeout(g.current),g.current=null)}),[v,n.waiting]),m.useEffect(()=>{if(!y)return;const E=j=>{!r||f!==Re.TOOLTIP||j.key==="Escape"&&r.dismissKeyAction&&(r.dismissKeyAction==="next"?e.next(ds.KEYBOARD):e.close(ds.KEYBOARD))};return document.body.addEventListener("keydown",E,{passive:!0}),()=>{document.body.removeEventListener("keydown",E)}},[e,y,f,r]);const w=m.useCallback(()=>{(r==null?void 0:r.overlayClickAction)==="close"?e.close(ds.OVERLAY):(r==null?void 0:r.overlayClickAction)==="next"&&e.next(ds.OVERLAY)},[e,r==null?void 0:r.overlayClickAction]);if(!r||!y)return null;const k=n.action===mt.START&&!r.skipBeacon&&r.placement!=="center";return We.createElement(We.Fragment,null,f!==Re.INIT&&We.createElement(Ite,{...n,continuous:s,controls:e,debug:o,nonce:l,portalElement:u,setPositionData:i.current.setPositionData,shouldScroll:!r.skipScroll&&(p!==0||d),step:r,updateState:i.current.updateState}),We.createElement(jA,{element:u},We.createElement(We.Fragment,null,b&&We.createElement(fte,{nonce:l,step:r}),!k&&We.createElement(yte,{...r,continuous:s,lifecycle:f,onClickOverlay:w,portalElement:c?u:null,scrolling:n.scrolling,waiting:n.waiting}))))}function Tte(e){const{controls:t,failures:n,mergedProps:r,state:i,step:s,store:o}=cte(e);return{controls:t,failures:n,on:m.useCallback((l,c)=>o.current.on(l,c),[o]),state:m.useMemo(()=>Ph(i,"positioned"),[i]),step:s,Tour:Fv()?We.createElement(Ate,{controls:t,mergedProps:r,state:i,step:s,store:o}):null}}function Rte(e){const{Tour:t}=Tte(e);return t}function Lte(e){return Fv()?We.createElement(Rte,e):null}function Ote(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 Mte(e){return[{target:"body",content:e("onboarding:flow.intro"),disableBeacon:!0,placement:"center"}]}function $te(e){return[{target:"body",content:e("onboarding:flow.introEmpty"),disableBeacon:!0,placement:"center"}]}const ty="af:onboarding";function Fte({page:e,hasNodes:t=!1}){const{t:n}=Mt(),[r,i]=m.useState(!1),[s,o]=m.useState([]),l=m.useRef(null),c=m.useMemo(()=>e==="projects"?Ote(n):t?Mte(n):$te(n),[e,t,n]);return m.useEffect(()=>{const d=localStorage.getItem(ty);console.log("[Onboarding] localStorage:",d);const u=d?JSON.parse(d):{};if(console.log("[Onboarding] progress:",u,"page:",e),u.completed||u[e]){console.log("[Onboarding] skipped - already done"),i(!1),o([]);return}console.log("[Onboarding] starting with steps:",c),o(c),i(!0)},[e,t,c]),m.useEffect(()=>{if(!r)return;const d=u=>{var y;const p=u.target.closest("button");if(!p||!p.closest(".react-joyride__tooltip"))return;const h=(y=p.textContent)==null?void 0:y.trim();if(h===n("onboarding:done")||h===n("onboarding:startCreate")||h===n("onboarding:skip")){const b=localStorage.getItem(ty)||"{}",S=JSON.parse(b);h===n("onboarding:skip")?(S.projects=!0,S.flow=!0,S.completed=!0):S[e]=!0,localStorage.setItem(ty,JSON.stringify(S)),o([]),i(!1),e==="projects"&&(h===n("onboarding:done")||h===n("onboarding:startCreate"))&&(localStorage.setItem("af:newPipelineGuide","true"),setTimeout(()=>{const g=document.querySelector(".af-create-btn");g&&g.click()},500))}};return document.addEventListener("click",d,!0),()=>document.removeEventListener("click",d,!0)},[r,e,n]),!r||s.length===0?null:a.jsx(Lte,{ref:l,steps:s,run:r,continuous:!0,showSkipButton:!0,showProgress:s.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 Dte(){const{navigate:e,path:t}=za(),[n,r]=m.useState([]),[i,s]=m.useState(!1);if(m.useEffect(()=>{let u=!1;const p=async()=>{try{const h=await fetch("/api/pipeline-recent-runs");if(!h.ok)return;const y=await h.json();if(u)return;const b=Array.isArray(y.runs)?y.runs:[];r(b.filter(S=>S&&S.status==="running"))}catch{}};p();const f=window.setInterval(p,3e3);return()=>{u=!0,window.clearInterval(f)}},[]),n.length===0)return null;const o=u=>{const p=new URLSearchParams({flowId:u.flowId,flowSource:u.flowSource||"workspace"});e(`/flow?${p.toString()}`),s(!1)},l=t==="/flow"?new URLSearchParams(window.location.search):null,c=(l==null?void 0:l.get("flowId"))||"",d=n.length===1;return a.jsxs("div",{className:"af-run-indicator",role:"status","aria-live":"polite",children:[i&&!d&&a.jsx("div",{className:"af-run-indicator__menu",onMouseLeave:()=>s(!1),children:n.map(u=>a.jsxs("button",{type:"button",className:"af-run-indicator__item"+(u.flowId===c?" af-run-indicator__item--current":""),onClick:()=>o(u),title:`${u.flowId} · ${u.runId}`,children:[a.jsx("span",{className:"af-run-indicator__dot"}),a.jsx("span",{className:"af-run-indicator__flow",children:u.flowId}),a.jsx("span",{className:"af-run-indicator__run",children:u.runId.slice(0,12)})]},`${u.flowId}:${u.runId}`))}),a.jsxs("button",{type:"button",className:"af-run-indicator__btn",onClick:()=>d?o(n[0]):s(u=>!u),title:d?`${n[0].flowId} 运行中,点击跳转`:`${n.length} 个 pipeline 运行中`,children:[a.jsx("span",{className:"af-run-indicator__pulse"}),a.jsx("span",{className:"af-run-indicator__label",children:d?n[0].flowId:`${n.length} running`})]})]})}class zte 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,i,s;if(!this.state.error)return this.props.children;const t=String(((r=this.state.error)==null?void 0:r.stack)||((i=this.state.error)==null?void 0:i.message)||this.state.error),n=String(((s=this.state.info)==null?void 0:s.componentStack)||"");return a.jsx("div",{className:"af-auth-screen",children:a.jsxs("div",{className:"af-auth-panel af-ui-error-panel",children:[a.jsxs("div",{className:"af-auth-brand",children:[a.jsx("span",{className:"material-symbols-outlined",children:"error"}),a.jsxs("div",{children:[a.jsx("h1",{children:"AgentFlow UI Error"}),a.jsx("p",{children:"页面渲染失败,下面是调试堆栈。"})]})]}),a.jsx("pre",{children:t}),n?a.jsx("pre",{children:n}):null]})})}}function Bte(){const{path:e}=za();return e==="/projects"||e==="/"?a.jsx(sl,{}):e==="/nodes"?a.jsx(sl,{resourceKind:"nodes"}):e==="/my-nodes"?a.jsx(sl,{resourceKind:"my-nodes"}):e==="/my-flows"?a.jsx(sl,{resourceKind:"my-flows"}):e==="/skills"?a.jsx(sl,{resourceKind:"skills"}):e==="/flow"?a.jsx(iW,{}):e==="/workspace"?a.jsx(zW,{}):e==="/settings"?a.jsx(_Q,{}):a.jsx(sl,{})}function Hte({children:e}){const[t,n]=m.useState({loading:!0,authenticated:!1,user:null,setupRequired:!1}),[r,i]=m.useState(""),[s,o]=m.useState(""),[l,c]=m.useState(!1),[d,u]=m.useState(""),p=async()=>{try{const y=await(await fetch("/api/auth/me")).json().catch(()=>({}));n({loading:!1,authenticated:!!y.authenticated,user:y.user||null,setupRequired:!!y.setupRequired})}catch(h){n({loading:!1,authenticated:!1,user:null,setupRequired:!1}),u(String(h.message||h))}};m.useEffect(()=>{p()},[]);const f=async h=>{h.preventDefault(),c(!0),u("");try{const y=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({username:r,password:s})}),b=await y.json().catch(()=>({}));if(!y.ok)throw new Error(b.error||"登录失败");n({loading:!1,authenticated:!0,user:b.user||null,setupRequired:!1})}catch(y){u(String(y.message||y))}finally{c(!1)}};return t.loading?a.jsx("div",{className:"af-auth-screen",children:a.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})}}):a.jsx("div",{className:"af-auth-screen",children:a.jsxs("form",{className:"af-auth-panel",onSubmit:f,children:[a.jsxs("div",{className:"af-auth-brand",children:[a.jsx("span",{className:"material-symbols-outlined",children:"account_circle"}),a.jsxs("div",{children:[a.jsx("h1",{children:"AgentFlow"}),a.jsx("p",{children:t.setupRequired?"初始化管理员账号":"登录或创建用户"})]})]}),a.jsxs("label",{className:"af-auth-field",children:[a.jsx("span",{children:"用户名"}),a.jsx("input",{value:r,onChange:h=>i(h.target.value),autoComplete:"username",autoFocus:!0})]}),a.jsxs("label",{className:"af-auth-field",children:[a.jsx("span",{children:"密码"}),a.jsx("input",{type:"password",value:s,onChange:h=>o(h.target.value),autoComplete:t.setupRequired?"new-password":"current-password"})]}),d?a.jsx("p",{className:"af-auth-error",children:d}):null,a.jsx("button",{className:"af-auth-submit",type:"submit",disabled:l||!r.trim()||s.length<4,children:l?"处理中...":t.setupRequired?"创建并登录":"登录"})]})})}function Ute({authUser:e,onLogout:t}){const{path:n}=za(),r=n==="/flow"||n==="/workspace";return a.jsxs("div",{className:"af-app",children:[n!=="/settings"?a.jsx(Fte,{page:r?"flow":"projects"}):null,r?null:a.jsx(vL,{authUser:e,onLogout:t}),a.jsx("div",{className:r?"af-main af-main--pipeline":"af-main",children:a.jsx(Bte,{})}),a.jsx(Dte,{})]})}function Vte(){return a.jsx(zte,{children:a.jsx(tL,{children:a.jsx(Hte,{children:({user:e,onLogout:t})=>a.jsx(Ute,{authUser:e,onLogout:t})})})})}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 w1=document.querySelector('link[rel="icon"]');w1&&(w1.href=OC);ny.createRoot(document.getElementById("root")).render(a.jsx(We.StrictMode,{children:a.jsx(Vte,{})}));